diff options
| author | Manjeet Dahiya <manjeetdahiya@gmail.com> | 2010-09-09 09:25:50 +0000 |
|---|---|---|
| committer | Manjeet Dahiya <manjeetdahiya@gmail.com> | 2010-09-09 09:25:50 +0000 |
| commit | 821bc195035273682be37d91a19fcd4d33169a62 (patch) | |
| tree | 59b585fcabcbd03c38b756d82303c223896e7b9d /examples/GuiClient | |
| parent | f59f1f1402ef678b0789d14937d7806fd952601a (diff) | |
| download | qxmpp-821bc195035273682be37d91a19fcd4d33169a62.tar.gz | |
refactor
Diffstat (limited to 'examples/GuiClient')
| -rw-r--r-- | examples/GuiClient/customListView.cpp | 24 | ||||
| -rw-r--r-- | examples/GuiClient/customListView.h | 5 |
2 files changed, 22 insertions, 7 deletions
diff --git a/examples/GuiClient/customListView.cpp b/examples/GuiClient/customListView.cpp index a655aca3..e1a99a00 100644 --- a/examples/GuiClient/customListView.cpp +++ b/examples/GuiClient/customListView.cpp @@ -71,16 +71,26 @@ void customListView::clicked(const QModelIndex& index) {
}
-void customListView::showChatDialog_helper()
+QString customListView::selectedBareJid()
{
- QString bareJid;
if(selectedIndexes().size() > 0)
- {
- bareJid = selectedIndexes().at(0).data(rosterItem::BareJid).toString();
+ return selectedIndexes().at(0).data(rosterItem::BareJid).toString();
+ else
+ return "";
+}
- if(!bareJid.isEmpty())
- emit showChatDialog(bareJid);
- }
+void customListView::showChatDialog_helper()
+{
+ QString bareJid = selectedBareJid();
+ if(!bareJid.isEmpty())
+ emit showChatDialog(bareJid);
+}
+
+void customListView::showProfile_helper()
+{
+ QString bareJid = selectedBareJid();
+ if(!bareJid.isEmpty())
+ emit showProfile(bareJid);
}
void customListView::keyPressEvent(QKeyEvent* event1)
diff --git a/examples/GuiClient/customListView.h b/examples/GuiClient/customListView.h index d63ee467..764792a5 100644 --- a/examples/GuiClient/customListView.h +++ b/examples/GuiClient/customListView.h @@ -43,12 +43,17 @@ public slots: private slots:
void showChatDialog_helper();
+ void showProfile_helper();
protected:
void keyPressEvent(QKeyEvent*);
signals:
void showChatDialog(const QString& bareJid);
+ void showProfile(const QString& bareJid);
+
+private:
+ QString selectedBareJid();
private:
QAction m_chat;
|
