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);
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);
this, SLOT(routeToSelectedFriend()));
connect(m_friendListView, SIGNAL(listItemSelectionChanged()),
- this, SLOT(setRouteButtonDisabled()));
+ this, SLOT(setSelectionButtonsDisabled()));
/// @todo remove old filterLayout when new panel are merged
connect(qApp, SIGNAL(topmostWindowChanged(bool)),
this, SLOT(topmostWindowChanged(bool)));
+
+ connect(m_showContactButton, SIGNAL(clicked()),
+ this, SLOT(requestSelectedFriendContactDialog()));
}
void FriendListPanel::anyPanelClosed()
clearFiltering();
m_friendListView->clearItemSelection();
- setRouteButtonDisabled();
+ setSelectionButtonsDisabled();
}
void FriendListPanel::anyPanelOpened()
clearFiltering();
m_friendListView->clearItemSelection();
- setRouteButtonDisabled();
+ setSelectionButtonsDisabled();
}
-void FriendListPanel::routeToSelectedFriend()
+void FriendListPanel::requestSelectedFriendContactDialog()
{
qDebug() << __PRETTY_FUNCTION__;
FriendListItem *item = dynamic_cast<FriendListItem *>(m_friendListView->selectedItem());
-// if (item)
-// emit routeToFriend(item->coordinates());
-
if (item) {
QString facebookId = item->facebookId();
if (!facebookId.isEmpty())
}
}
+void FriendListPanel::routeToSelectedFriend()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ FriendListItem *item = dynamic_cast<FriendListItem *>(m_friendListView->selectedItem());
+
+ if (item)
+ emit routeToFriend(item->coordinates());
+}
+
void FriendListPanel::setFilteringLayoutVisibility(bool visible)
{
qDebug() << __PRETTY_FUNCTION__;
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__;
}
}
-void FriendListPanel::setRouteButtonDisabled()
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- m_routeButton->setDisabled(m_friendListView->selectedItems().isEmpty());
-}
-
void FriendListPanel::showEvent(QShowEvent *event)
{
qDebug() << __PRETTY_FUNCTION__;
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.
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