summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtChatWindow.cpp28
-rw-r--r--Swift/QtUI/QtChatWindow.h2
2 files changed, 25 insertions, 5 deletions
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp
index dc89c21..c6519ba 100644
--- a/Swift/QtUI/QtChatWindow.cpp
+++ b/Swift/QtUI/QtChatWindow.cpp
@@ -726,23 +726,36 @@ void QtChatWindow::setAvailableOccupantActions(const std::vector<OccupantAction>
}
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* configure = contextMenu.addAction(tr("Configure room"));
- QAction* affiliations = contextMenu.addAction(tr("Edit affiliations"));
- QAction* destroy = contextMenu.addAction(tr("Destroy room"));
- QAction* invite = contextMenu.addAction(tr("Invite person to this room"));
+ QAction* changeSubject = NULL;
+ QAction* configure = NULL;
+ QAction* affiliations = NULL;
+ QAction* destroy = NULL;
+ QAction* invite = NULL;
+
+ foreach(ChatWindow::RoomAction availableAction, availableRoomActions_)
+ {
+ switch(availableAction)
+ {
+ case ChatWindow::ChangeSubject: changeSubject = contextMenu.addAction(tr("Change subject")); break;
+ case ChatWindow::Configure: configure = contextMenu.addAction(tr("Configure room")); break;
+ case ChatWindow::Affiliations: affiliations = contextMenu.addAction(tr("Edit affiliations")); break;
+ case ChatWindow::Destroy: destroy = contextMenu.addAction(tr("Destroy room")); break;
+ case ChatWindow::Invite: invite = contextMenu.addAction(tr("Invite person to this room")); break;
+ }
+ }
+
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));
}
}
else if (result == configure) {
@@ -779,18 +792,23 @@ void QtChatWindow::handleActionButtonClicked() {
void QtChatWindow::handleAffiliationEditorAccepted() {
onChangeAffiliationsRequest(affiliationEditor_->getChanges());
}
void QtChatWindow::setAffiliations(MUCOccupant::Affiliation affiliation, const std::vector<JID>& jids) {
if (!affiliationEditor_) return;
affiliationEditor_->setAffiliations(affiliation, jids);
}
+void QtChatWindow::setAvailableRoomActions(const std::vector<RoomAction> &actions)
+{
+ availableRoomActions_ = actions;
+}
+
void QtChatWindow::showRoomConfigurationForm(Form::ref form) {
if (mucConfigurationWindow_) {
delete mucConfigurationWindow_.data();
}
mucConfigurationWindow_ = new QtMUCConfigurationWindow(form);
mucConfigurationWindow_->onFormComplete.connect(boost::bind(boost::ref(onConfigureRequest), _1));
mucConfigurationWindow_->onFormCancelled.connect(boost::bind(boost::ref(onConfigurationFormCancelled)));
}
diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h
index 9203068..189a12a 100644
--- a/Swift/QtUI/QtChatWindow.h
+++ b/Swift/QtUI/QtChatWindow.h
@@ -73,18 +73,19 @@ namespace Swift {
void setMessageReceiptState(const std::string& id, ChatWindow::ReceiptState state);
void flash();
QByteArray getSplitterState();
virtual void setAvailableOccupantActions(const std::vector<OccupantAction>& actions);
void setSubject(const std::string& subject);
void showRoomConfigurationForm(Form::ref);
void addMUCInvitation(const JID& jid, const std::string& reason, const std::string& password, bool direct = true);
void setAffiliations(MUCOccupant::Affiliation, const std::vector<JID>&);
+ void setAvailableRoomActions(const std::vector<RoomAction> &actions);
public slots:
void handleChangeSplitterState(QByteArray state);
void handleFontResized(int fontSizeSteps);
void setAlert(const std::string& alertText, const std::string& buttonText = "");
void cancelAlert();
void setCorrectionEnabled(Tristate enabled);
signals:
@@ -157,11 +158,12 @@ namespace Swift {
QSplitter *logRosterSplitter_;
Tristate correctionEnabled_;
QString alertStyleSheet_;
std::map<QString, QString> descriptions;
QtFileTransferJSBridge* fileTransferJS;
QPointer<QtMUCConfigurationWindow> mucConfigurationWindow_;
QPointer<QtAffiliationEditor> affiliationEditor_;
int idCounter_;
SettingsProvider* settings_;
+ std::vector<ChatWindow::RoomAction> availableRoomActions_;
};
}