summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/ContextMenus')
-rw-r--r--Swift/QtUI/ContextMenus/QtContextMenu.h4
-rw-r--r--Swift/QtUI/ContextMenus/QtRosterContextMenu.cpp14
-rw-r--r--Swift/QtUI/ContextMenus/QtRosterContextMenu.h5
3 files changed, 14 insertions, 9 deletions
diff --git a/Swift/QtUI/ContextMenus/QtContextMenu.h b/Swift/QtUI/ContextMenus/QtContextMenu.h
index baa0180..9e73ef9 100644
--- a/Swift/QtUI/ContextMenus/QtContextMenu.h
+++ b/Swift/QtUI/ContextMenus/QtContextMenu.h
@@ -7,11 +7,11 @@
#pragma once
namespace Swift {
- class QtTreeWidgetItem;
+ class RosterItem;
class QtContextMenu {
public:
virtual ~QtContextMenu();
- virtual void show(QtTreeWidgetItem* item) = 0;
+ virtual void show(RosterItem* item) = 0;
};
}
diff --git a/Swift/QtUI/ContextMenus/QtRosterContextMenu.cpp b/Swift/QtUI/ContextMenus/QtRosterContextMenu.cpp
index 10e0b56..e6b5ae5 100644
--- a/Swift/QtUI/ContextMenus/QtRosterContextMenu.cpp
+++ b/Swift/QtUI/ContextMenus/QtRosterContextMenu.cpp
@@ -11,9 +11,10 @@
#include <boost/shared_ptr.hpp>
+#include "Swiften/Roster/ContactRosterItem.h"
#include "Swiften/Base/String.h"
-#include "Swift/Controllers/UIEvents/RemoveItemRosterAction.h"
-#include "Swift/QtUI/Roster/QtTreeWidgetItem.h"
+#include "Swift/Controllers/UIEvents/UIEvent.h"
+#include "Swift/Controllers/UIEvents/RemoveRosterItemUIEvent.h"
#include "Swift/QtUI/QtSwiftUtil.h"
namespace Swift {
@@ -22,8 +23,9 @@ QtRosterContextMenu::QtRosterContextMenu(UIEventStream* eventStream) {
eventStream_ = eventStream;
}
-void QtRosterContextMenu::show(QtTreeWidgetItem* item) {
- if (!item->isContact()) {
+void QtRosterContextMenu::show(RosterItem* item) {
+ ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(item);
+ if (!contact) {
return;
}
item_ = item;
@@ -33,7 +35,9 @@ void QtRosterContextMenu::show(QtTreeWidgetItem* item) {
}
void QtRosterContextMenu::handleRemove() {
- item_->performUserAction(boost::shared_ptr<UserRosterAction>(new RemoveItemRosterAction()));
+ ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(item_);
+ assert(contact);
+ eventStream_->send(boost::shared_ptr<UIEvent>(new RemoveRosterItemUIEvent(contact->getJID())));
}
}
diff --git a/Swift/QtUI/ContextMenus/QtRosterContextMenu.h b/Swift/QtUI/ContextMenus/QtRosterContextMenu.h
index ffa8ba6..51556e4 100644
--- a/Swift/QtUI/ContextMenus/QtRosterContextMenu.h
+++ b/Swift/QtUI/ContextMenus/QtRosterContextMenu.h
@@ -12,17 +12,18 @@
#include "Swift/Controllers/UIEvents/UIEventStream.h"
namespace Swift {
+ class RosterItem;
class QtRosterContextMenu : public QObject, public QtContextMenu {
Q_OBJECT
public:
QtRosterContextMenu(UIEventStream* eventStream);
- void show(QtTreeWidgetItem* item);
+ void show(RosterItem* item);
private slots:
void handleRemove();
private:
- QtTreeWidgetItem* item_;
+ RosterItem* item_;
UIEventStream* eventStream_;
};
}