diff options
| author | Manjeet Dahiya <manjeetdahiya@gmail.com> | 2010-09-28 16:08:11 +0000 |
|---|---|---|
| committer | Manjeet Dahiya <manjeetdahiya@gmail.com> | 2010-09-28 16:08:11 +0000 |
| commit | 740343ca5bd92532eb77df67211733db53447a3d (patch) | |
| tree | 963714eeef4ede9c578dbff07d3b6af22461522a /examples/GuiClient | |
| parent | 97c57b6463e094e934b5fe460201dcf1b169f1be (diff) | |
| download | qxmpp-740343ca5bd92532eb77df67211733db53447a3d.tar.gz | |
add removeContact signaling
Diffstat (limited to 'examples/GuiClient')
| -rw-r--r-- | examples/GuiClient/customListView.cpp | 14 | ||||
| -rw-r--r-- | examples/GuiClient/customListView.h | 3 |
2 files changed, 16 insertions, 1 deletions
diff --git a/examples/GuiClient/customListView.cpp b/examples/GuiClient/customListView.cpp index a071722f..37c6e056 100644 --- a/examples/GuiClient/customListView.cpp +++ b/examples/GuiClient/customListView.cpp @@ -28,7 +28,8 @@ #include <QMenu> #include <QKeyEvent> -customListView::customListView(QWidget* parent):QListView(parent), m_chat("Chat", this), m_profile("View Profile", this) +customListView::customListView(QWidget* parent):QListView(parent), m_chat("Chat", this), +m_profile("View Profile", this), m_removeContact("Remove", this) { bool check = connect(this, SIGNAL(pressed(const QModelIndex&)), this, SLOT(mousePressed(const QModelIndex&))); @@ -46,6 +47,10 @@ customListView::customListView(QWidget* parent):QListView(parent), m_chat("Chat" check = connect(&m_profile, SIGNAL(triggered()), this, SLOT(showProfile_helper())); Q_ASSERT(check); + + check = connect(&m_removeContact, SIGNAL(triggered()), this, + SLOT(removeContact_helper())); + Q_ASSERT(check); } bool customListView::event(QEvent* e) @@ -105,3 +110,10 @@ void customListView::keyPressEvent(QKeyEvent* event1) } QListView::keyPressEvent(event1); } + +void customListView::removeContact_helper() +{ + QString bareJid = selectedBareJid(); + if(!bareJid.isEmpty()) + emit removeContact(bareJid); +} diff --git a/examples/GuiClient/customListView.h b/examples/GuiClient/customListView.h index d088eeb6..1b2b54d4 100644 --- a/examples/GuiClient/customListView.h +++ b/examples/GuiClient/customListView.h @@ -44,6 +44,7 @@ public slots: private slots: void showChatDialog_helper(); void showProfile_helper(); + void removeContact_helper(); protected: void keyPressEvent(QKeyEvent*); @@ -51,6 +52,7 @@ protected: signals: void showChatDialog(const QString& bareJid); void showProfile(const QString& bareJid); + void removeContact(const QString& bareJid); private: QString selectedBareJid(); @@ -58,6 +60,7 @@ private: private: QAction m_chat; QAction m_profile; + QAction m_removeContact; }; #endif // CUSTOMLISTVIEW_H |
