diff options
Diffstat (limited to 'Swift/QtUI/ContextMenus/QtRosterContextMenu.cpp')
-rw-r--r-- | Swift/QtUI/ContextMenus/QtRosterContextMenu.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Swift/QtUI/ContextMenus/QtRosterContextMenu.cpp b/Swift/QtUI/ContextMenus/QtRosterContextMenu.cpp new file mode 100644 index 0000000..feb1226 --- /dev/null +++ b/Swift/QtUI/ContextMenus/QtRosterContextMenu.cpp @@ -0,0 +1,33 @@ +#include "Swift/QtUI/ContextMenus/QtRosterContextMenu.h" + +#include <QMenu> +#include <QDebug> + +#include <boost/shared_ptr.hpp> + +#include "Swiften/Base/String.h" +#include "Swift/Controllers/UIEvents/RemoveItemRosterAction.h" +#include "Swift/QtUI/Roster/QtTreeWidgetItem.h" +#include "Swift/QtUI/QtSwiftUtil.h" + +namespace Swift { + +QtRosterContextMenu::QtRosterContextMenu(UIEventStream* eventStream) { + eventStream_ = eventStream; +} + +void QtRosterContextMenu::show(QtTreeWidgetItem* item) { + if (!item->isContact()) { + return; + } + item_ = item; + QMenu* contextMenu = new QMenu(); + contextMenu->addAction("Remove", this, SLOT(handleRemove())); + contextMenu->exec(QCursor::pos()); +} + +void QtRosterContextMenu::handleRemove() { + item_->performUserAction(boost::shared_ptr<UserRosterAction>(new RemoveItemRosterAction())); +} + +} |