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
@@ -732,11 +732,24 @@ void QtChatWindow::setSubject(const std::string& 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;
@@ -785,6 +798,11 @@ void QtChatWindow::setAffiliations(MUCOccupant::Affiliation affiliation, const s
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();
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
@@ -79,6 +79,7 @@ namespace Swift {
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);
@@ -163,5 +164,6 @@ namespace Swift {
QPointer<QtAffiliationEditor> affiliationEditor_;
int idCounter_;
SettingsProvider* settings_;
+ std::vector<ChatWindow::RoomAction> availableRoomActions_;
};
}