Merge branch 'master' into context_driven_buttons, review
[situare] / src / ui / friendlistpanel.cpp
index 3827746..99a2585 100644 (file)
@@ -6,6 +6,7 @@
         Henri Lampela - henri.lampela@ixonos.com
         Pekka Nissinen - pekka.nissinen@ixonos.com
         Sami Rämö - sami.ramo@ixonos.com
+        Jussi Laitinen - jussi.laitinen@ixonos.com
 
     Situare is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
@@ -124,6 +125,12 @@ FriendListPanel::FriendListPanel(QWidget *parent)
     connect(m_routeButton, SIGNAL(clicked()),
             this, SLOT(routeToSelectedFriend()));
 
+    m_showContactButton = new ImageButton(":res/images/contact_btn.png",
+                                          ":res/images/contact_btn_s.png",
+                                          ":res/images/contact_btn_d.png", this);
+    connect(m_showContactButton, SIGNAL(clicked()),
+            this, SLOT(requestSelectedFriendContactDialog()));
+
     m_clearGroupFilteringButton = new ImageButton(":res/images/filtered.png",
                                                   ":res/images/filtered_s.png",
                                                   ":res/images/filtered_d.png", this);
@@ -133,6 +140,7 @@ FriendListPanel::FriendListPanel(QWidget *parent)
             this, SLOT(clearFiltering()));
 
     m_itemButtonsLayout->addWidget(m_routeButton);
+    m_itemButtonsLayout->addWidget(m_showContactButton);
     m_genericButtonsLayout->addWidget(m_clearGroupFilteringButton);
 }
 
@@ -236,6 +244,19 @@ void FriendListPanel::hideEvent(QHideEvent *event)
     m_friendListView->clearItemSelection();
 }
 
+void FriendListPanel::requestSelectedFriendContactDialog()
+{
+     qDebug() << __PRETTY_FUNCTION__;
+
+     FriendListItem *item = dynamic_cast<FriendListItem *>(m_friendListView->selectedItem());
+
+     if (item) {
+         QString facebookId = item->facebookId();
+         if (!facebookId.isEmpty())
+             emit requestContactDialog(facebookId);
+     }
+}
+
 void FriendListPanel::routeToSelectedFriend()
 {
     qDebug() << __PRETTY_FUNCTION__;