summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMateusz Piekos <mateuszpiekos@gmail.com>2012-03-31 16:34:53 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-04-09 09:15:05 (GMT)
commit1e61cace31a3395f5470a03c3bcf2b7f32d79d03 (patch)
tree972f42651900908a2a33bf34cf142fe573d5a3d4 /Swift/QtUI
parent736aae33a0af7bff42f73a323edb76775b2c39a9 (diff)
downloadswift-contrib-1e61cace31a3395f5470a03c3bcf2b7f32d79d03.zip
swift-contrib-1e61cace31a3395f5470a03c3bcf2b7f32d79d03.tar.bz2
Made MUC context options role-aware
License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
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_;
};
}