summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtChatWindow.cpp40
-rw-r--r--Swift/QtUI/QtChatWindow.h4
2 files changed, 41 insertions, 3 deletions
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp
index fa039de..760e481 100644
--- a/Swift/QtUI/QtChatWindow.cpp
+++ b/Swift/QtUI/QtChatWindow.cpp
@@ -41,6 +41,7 @@
#include <QUrl>
#include <QPushButton>
#include <QFileDialog>
+#include <QMenu>
#include <QDebug>
@@ -80,6 +81,21 @@ QtChatWindow::QtChatWindow(const QString &contact, QtChatTheme* theme, UIEventSt
alertLabel_->setStyleSheet(alertStyleSheet_);
alertWidget_->hide();
+ QBoxLayout* subjectLayout = new QBoxLayout(QBoxLayout::LeftToRight);
+ subject_ = new QLineEdit(this);
+ subjectLayout->addWidget(subject_);
+ setSubject("");
+ subject_->setReadOnly(true);
+
+ actionButton_ = new QPushButton(tr("Actions"), this);
+ connect(actionButton_, SIGNAL(clicked()), this, SLOT(handleActionButtonClicked()));
+ subjectLayout->addWidget(actionButton_);
+
+ subject_->hide();
+ actionButton_->hide();
+
+ layout->addLayout(subjectLayout);
+
logRosterSplitter_ = new QSplitter(this);
logRosterSplitter_->setAutoFillBackground(true);
layout->addWidget(logRosterSplitter_);
@@ -330,11 +346,11 @@ void QtChatWindow::closeEvent(QCloseEvent* event) {
void QtChatWindow::convertToMUC() {
setAcceptDrops(false);
treeWidget_->show();
+ subject_->show();
+ actionButton_->show();
}
-void QtChatWindow::qAppFocusChanged(QWidget *old, QWidget *now) {
- Q_UNUSED(old);
- Q_UNUSED(now);
+void QtChatWindow::qAppFocusChanged(QWidget* /*old*/, QWidget* /*now*/) {
if (isWidgetSelected()) {
lastLineTracker_.setHasFocus(true);
input_->setFocus();
@@ -669,4 +685,22 @@ void QtChatWindow::setAvailableOccupantActions(const std::vector<OccupantAction>
treeWidget_->setAvailableOccupantActions(actions);
}
+void QtChatWindow::setSubject(const std::string& subject) {
+ //subject_->setVisible(!subject.empty());
+ subject_->setText(P2QSTRING(subject));
+}
+
+void QtChatWindow::handleActionButtonClicked() {
+ QMenu contextMenu;
+ QAction* changeSubject = contextMenu.addAction(tr("Change subject"));
+ QAction* result = contextMenu.exec(QCursor::pos());
+ if (result == changeSubject) {
+ bool ok;
+ QString subject = QInputDialog::getText(this, tr("Change room subject"), tr("New subject:"), QLineEdit::Normal, subject_->text(), &ok);
+ if (ok) {
+ onChangeSubjectRequest(Q2PSTRING(subject));
+ }
+ }
+}
+
}
diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h
index f0c078c..b8fa478 100644
--- a/Swift/QtUI/QtChatWindow.h
+++ b/Swift/QtUI/QtChatWindow.h
@@ -68,6 +68,7 @@ namespace Swift {
void flash();
QByteArray getSplitterState();
virtual void setAvailableOccupantActions(const std::vector<OccupantAction>& actions);
+ void setSubject(const std::string& subject);
public slots:
void handleChangeSplitterState(QByteArray state);
@@ -99,6 +100,7 @@ namespace Swift {
void handleKeyPressEvent(QKeyEvent* event);
void handleSplitterMoved(int pos, int index);
void handleAlertButtonClicked();
+ void handleActionButtonClicked();
void handleFileTransferCancel(QString id);
@@ -129,6 +131,8 @@ namespace Swift {
QWidget* alertWidget_;
QPushButton* alertButton_;
TabComplete* completer_;
+ QLineEdit* subject_;
+ QPushButton* actionButton_;
std::vector<SecurityLabelsCatalog::Item> availableLabels_;
bool isCorrection_;
bool previousMessageWasSelf_;