diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-02-21 20:46:55 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-02-21 20:46:55 (GMT) |
commit | 811aa9951613990956ad9027f4b969c8886b1123 (patch) | |
tree | 0b2c5628cc64796a68f2e2008d81290a59fdd687 /Swift/QtUI/Roster | |
parent | ba81a3d454db0abd0b8e00a34a9da3b720af454f (diff) | |
download | swift-contrib-811aa9951613990956ad9027f4b969c8886b1123.zip swift-contrib-811aa9951613990956ad9027f4b969c8886b1123.tar.bz2 |
Added "Remove" context menu.
Resolves: #768
Diffstat (limited to 'Swift/QtUI/Roster')
-rw-r--r-- | Swift/QtUI/Roster/QtTreeWidget.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Swift/QtUI/Roster/QtTreeWidget.cpp b/Swift/QtUI/Roster/QtTreeWidget.cpp index e88e1bb..a76dc70 100644 --- a/Swift/QtUI/Roster/QtTreeWidget.cpp +++ b/Swift/QtUI/Roster/QtTreeWidget.cpp @@ -17,8 +17,10 @@ #include "Swift/Controllers/UIEvents/UIEventStream.h" #include "Swift/Controllers/UIEvents/RequestChatUIEvent.h" #include "Swift/Controllers/UIEvents/RequestContactEditorUIEvent.h" +#include "Swift/Controllers/UIEvents/RemoveRosterItemUIEvent.h" #include "Swift/Controllers/UIEvents/RenameGroupUIEvent.h" #include "QtSwiftUtil.h" +#include "QtContactEditWindow.h" namespace Swift { @@ -87,10 +89,16 @@ void QtTreeWidget::contextMenuEvent(QContextMenuEvent* event) { QMenu contextMenu; if (ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(item)) { QAction* editContact = contextMenu.addAction(tr("Edit")); + QAction* removeContact = contextMenu.addAction(tr("Remove")); QAction* result = contextMenu.exec(event->globalPos()); if (result == editContact) { eventStream_->send(boost::make_shared<RequestContactEditorUIEvent>(contact->getJID())); } + else if (result == removeContact) { + if (QtContactEditWindow::confirmContactDeletion(contact->getJID())) { + eventStream_->send(boost::make_shared<RemoveRosterItemUIEvent>(contact->getJID())); + } + } } else if (GroupRosterItem* group = dynamic_cast<GroupRosterItem*>(item)) { QAction* renameGroup = contextMenu.addAction(tr("Rename")); |