From 740343ca5bd92532eb77df67211733db53447a3d Mon Sep 17 00:00:00 2001 From: Manjeet Dahiya Date: Tue, 28 Sep 2010 16:08:11 +0000 Subject: add removeContact signaling --- examples/GuiClient/customListView.cpp | 14 +++++++++++++- examples/GuiClient/customListView.h | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'examples/GuiClient') 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 #include -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 -- cgit v1.2.3