From: Jussi Laitinen Date: Wed, 25 Aug 2010 13:56:56 +0000 (+0300) Subject: Added show contact button to FriendListPanel. X-Git-Tag: v2.0b-1~17^2^2~5 X-Git-Url: http://vcs.maemo.org/git/?a=commitdiff_plain;h=2c3f6e7bac9f39e3f84ad85a9ec55b2ac3c93543;p=situare Added show contact button to FriendListPanel. --- diff --git a/src/ui/friendlistpanel.cpp b/src/ui/friendlistpanel.cpp index aa3a3aa..f99bfa4 100644 --- a/src/ui/friendlistpanel.cpp +++ b/src/ui/friendlistpanel.cpp @@ -65,6 +65,9 @@ FriendListPanel::FriendListPanel(QWidget *parent) m_routeButton = new QPushButton(tr("Route to friend")); m_routeButton->setDisabled(true); + m_showContactButton = new QPushButton(tr("Show contact")); + m_showContactButton->setDisabled(true); + QPalette labelPalette = m_friendListHeaderWidget->palette(); labelPalette.setColor(QPalette::Background, Qt::black); @@ -84,6 +87,7 @@ FriendListPanel::FriendListPanel(QWidget *parent) PANEL_MARGIN_RIGHT, PANEL_MARGIN_BOTTOM); listViewLayout->addWidget(m_friendListView); + friendListPanelLayout->addWidget(m_showContactButton); friendListPanelLayout->addWidget(m_routeButton); friendListPanelLayout->addWidget(m_friendListHeaderWidget); friendListPanelLayout->addLayout(listViewLayout); @@ -98,7 +102,7 @@ FriendListPanel::FriendListPanel(QWidget *parent) this, SLOT(routeToSelectedFriend())); connect(m_friendListView, SIGNAL(listItemSelectionChanged()), - this, SLOT(setRouteButtonDisabled())); + this, SLOT(setSelectionButtonsDisabled())); /// @todo remove old filterLayout when new panel are merged @@ -130,6 +134,9 @@ FriendListPanel::FriendListPanel(QWidget *parent) connect(qApp, SIGNAL(topmostWindowChanged(bool)), this, SLOT(topmostWindowChanged(bool))); + + connect(m_showContactButton, SIGNAL(clicked()), + this, SLOT(requestSelectedFriendContactDialog())); } void FriendListPanel::anyPanelClosed() @@ -142,7 +149,7 @@ void FriendListPanel::anyPanelClosed() clearFiltering(); m_friendListView->clearItemSelection(); - setRouteButtonDisabled(); + setSelectionButtonsDisabled(); } void FriendListPanel::anyPanelOpened() @@ -229,18 +236,15 @@ void FriendListPanel::hideEvent(QHideEvent *event) clearFiltering(); m_friendListView->clearItemSelection(); - setRouteButtonDisabled(); + setSelectionButtonsDisabled(); } -void FriendListPanel::routeToSelectedFriend() +void FriendListPanel::requestSelectedFriendContactDialog() { qDebug() << __PRETTY_FUNCTION__; FriendListItem *item = dynamic_cast(m_friendListView->selectedItem()); -// if (item) -// emit routeToFriend(item->coordinates()); - if (item) { QString facebookId = item->facebookId(); if (!facebookId.isEmpty()) @@ -248,6 +252,16 @@ void FriendListPanel::routeToSelectedFriend() } } +void FriendListPanel::routeToSelectedFriend() +{ + qDebug() << __PRETTY_FUNCTION__; + + FriendListItem *item = dynamic_cast(m_friendListView->selectedItem()); + + if (item) + emit routeToFriend(item->coordinates()); +} + void FriendListPanel::setFilteringLayoutVisibility(bool visible) { qDebug() << __PRETTY_FUNCTION__; @@ -256,6 +270,16 @@ void FriendListPanel::setFilteringLayoutVisibility(bool visible) m_filterClearButton->setVisible(visible); } +void FriendListPanel::setSelectionButtonsDisabled() +{ + qDebug() << __PRETTY_FUNCTION__; + + bool isAnyItemSelected = m_friendListView->selectedItems().isEmpty(); + + m_routeButton->setDisabled(isAnyItemSelected); + m_showContactButton->setDisabled(isAnyItemSelected); +} + void FriendListPanel::updateKeyboardGrabbing() { qDebug() << __PRETTY_FUNCTION__; @@ -269,13 +293,6 @@ void FriendListPanel::updateKeyboardGrabbing() } } -void FriendListPanel::setRouteButtonDisabled() -{ - qDebug() << __PRETTY_FUNCTION__; - - m_routeButton->setDisabled(m_friendListView->selectedItems().isEmpty()); -} - void FriendListPanel::showEvent(QShowEvent *event) { qDebug() << __PRETTY_FUNCTION__; diff --git a/src/ui/friendlistpanel.h b/src/ui/friendlistpanel.h index 280e22a..dfa270a 100644 --- a/src/ui/friendlistpanel.h +++ b/src/ui/friendlistpanel.h @@ -169,11 +169,16 @@ private slots: void routeToSelectedFriend(); /** + * @brief Requests selected friend's contact dialog. + */ + void requestSelectedFriendContactDialog(); + + /** * @brief Sets route button disabled. * * Disabled if there isn't any list item selected. */ - void setRouteButtonDisabled(); + void setSelectionButtonsDisabled(); /** * @brief Slot to show friends in list. @@ -238,6 +243,7 @@ private: QPushButton *m_clearFilterButton; ///< Button to clear list filtering QPushButton *m_filterClearButton; ///< Button for clearing the filtering QPushButton *m_routeButton; ///< Button to route to friend + QPushButton *m_showContactButton; ///< Button to show contact dialog QWidget *m_friendListHeaderWidget; ///< Friend list header widget