Merge branch 'master' into context_driven_buttons, review
[situare] / src / ui / locationsearchpanel.cpp
index 648a202..63449a0 100644 (file)
@@ -76,7 +76,7 @@ LocationSearchPanel::LocationSearchPanel(QWidget *parent)
             SIGNAL(locationItemClicked(const GeoCoordinate&, const GeoCoordinate&)));
 
     connect(m_locationListView, SIGNAL(listItemSelectionChanged()),
-            this, SLOT(setRouteButtonDisabled()));
+            this, SLOT(onListItemSelectionChanged()));
 
     QVBoxLayout *resultsListViewLayout = new QVBoxLayout;
     resultsListViewLayout->setContentsMargins(PANEL_MARGIN_LEFT, PANEL_MARGIN_TOP,
@@ -97,8 +97,7 @@ LocationSearchPanel::LocationSearchPanel(QWidget *parent)
     panelLayout->addLayout(resultsListViewLayout);
 
     // --- CONTEXT BUTTONS ---
-    m_routeButton = new ImageButton(":res/images/compass.png", "", "", this);
-    m_routeButton->setDisabled(true);
+    m_routeButton = new ImageButton(":res/images/routing.png", "", "", this);
     connect(m_routeButton, SIGNAL(clicked()),
             this, SLOT(routeToSelectedLocation()));
 
@@ -116,9 +115,9 @@ LocationSearchPanel::LocationSearchPanel(QWidget *parent)
     connect(m_clearLocationListButton, SIGNAL(clicked()),
             this, SLOT(showSearchHistoryListView()));
 
-    m_contextButtonLayout->addWidget(m_routeButton);
-    m_contextButtonLayout->addWidget(searchLocationButton);
-    m_contextButtonLayout->addWidget(m_clearLocationListButton);
+    m_itemButtonsLayout->addWidget(m_routeButton);
+    m_genericButtonsLayout->addWidget(searchLocationButton);
+    m_genericButtonsLayout->addWidget(m_clearLocationListButton);
 
     readSettings();
     showSearchHistoryListView();
@@ -167,8 +166,6 @@ void LocationSearchPanel::clearListsSelections()
 
     m_locationListView->clearItemSelection();
     m_searchHistoryListView->clearItemSelection();
-
-    setRouteButtonDisabled();
 }
 
 void LocationSearchPanel::hideEvent(QHideEvent *event)
@@ -243,13 +240,6 @@ void LocationSearchPanel::setHeaderText(int count)
     m_resultsLabel->setText(tr("Search results: %1").arg(count));
 }
 
-void LocationSearchPanel::setRouteButtonDisabled()
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    m_routeButton->setDisabled(m_locationListView->selectedItems().isEmpty());
-}
-
 void LocationSearchPanel::showLocationListView(int locationItemsCount)
 {
     qDebug() << __PRETTY_FUNCTION__;