Searching from location search results does not flash history view.
authorSami Rämö <sami.ramo@ixonos.com>
Thu, 23 Sep 2010 11:05:26 +0000 (14:05 +0300)
committerSami Rämö <sami.ramo@ixonos.com>
Thu, 23 Sep 2010 11:05:26 +0000 (14:05 +0300)
 - When location search results are open, and user does make another
   search, the view is not changed to search history view.

src/ui/locationsearchpanel.cpp

index e9fb481..ed60db1 100644 (file)
@@ -128,7 +128,6 @@ LocationSearchPanel::LocationSearchPanel(QWidget *parent)
     m_genericButtonsLayout->addWidget(searchLocationButton);
     m_genericButtonsLayout->addWidget(m_clearLocationListButton);
 
-    showSearchHistoryListView();
     showEmptyPanel(true);
     readSettings();
 }
@@ -155,24 +154,6 @@ LocationSearchPanel::~LocationSearchPanel()
     settings.setValue(SETTINGS_SEARCH_HISTORY, searchHistories);
 }
 
-void LocationSearchPanel::prependSearchHistory(QString searchString, QDateTime dateTime)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    const int SEARCH_HISTORY_LIMIT = 10;
-    static int counter = 0;
-
-    showSearchHistoryListView();
-    showEmptyPanel(false);
-
-    if (m_searchHistoryListView->count() >= SEARCH_HISTORY_LIMIT)
-        m_searchHistoryListView->removeLastItem();
-
-    SearchHistoryListItem *item = new SearchHistoryListItem();
-    item->setSearchHistoryData(searchString, dateTime);
-    m_searchHistoryListView->prependListItem(QString::number(counter++), item);
-}
-
 void LocationSearchPanel::clearListsSelections()
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -206,6 +187,21 @@ void LocationSearchPanel::populateLocationListView(const QList<Location> &locati
     m_locationListView->scrollToTop();
 }
 
+void LocationSearchPanel::prependSearchHistory(QString searchString, QDateTime dateTime)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    const int SEARCH_HISTORY_LIMIT = 10;
+    static int counter = 0;
+
+    if (m_searchHistoryListView->count() >= SEARCH_HISTORY_LIMIT)
+        m_searchHistoryListView->removeLastItem();
+
+    SearchHistoryListItem *item = new SearchHistoryListItem();
+    item->setSearchHistoryData(searchString, dateTime);
+    m_searchHistoryListView->prependListItem(QString::number(counter++), item);
+}
+
 void LocationSearchPanel::readSettings()
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -215,6 +211,9 @@ void LocationSearchPanel::readSettings()
     QSettings settings(DIRECTORY_NAME, FILE_NAME);
     QList<QVariant> searchHistories = settings.value(SETTINGS_SEARCH_HISTORY).toList();
 
+    if (searchHistories.count() > 0)
+            showSearchHistoryListView();
+
     //Read from end to begin so items are prepended in correct order
     for (int i = searchHistories.count() - 1; i >= 0; --i) {
         QList<QVariant> searchHistory = searchHistories.at(i).toList();
@@ -236,6 +235,13 @@ void LocationSearchPanel::routeToSelectedLocation()
         emit routeToLocation(item->coordinates());
 }
 
+void LocationSearchPanel::setHeaderText(int count)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    m_resultsLabel->setText(tr("Search results: %1").arg(count));
+}
+
 void LocationSearchPanel::showEmptyPanel(bool show)
 {
     if (show) {
@@ -247,13 +253,6 @@ void LocationSearchPanel::showEmptyPanel(bool show)
     }
 }
 
-void LocationSearchPanel::setHeaderText(int count)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    m_resultsLabel->setText(tr("Search results: %1").arg(count));
-}
-
 void LocationSearchPanel::showLocationListView(int locationItemsCount)
 {
     qDebug() << __PRETTY_FUNCTION__;