Search history feature reviewed.
authorJussi Laitinen <jupe@l3l7588.ixonos.local>
Fri, 3 Sep 2010 07:00:10 +0000 (10:00 +0300)
committerJussi Laitinen <jupe@l3l7588.ixonos.local>
Fri, 3 Sep 2010 07:01:14 +0000 (10:01 +0300)
Reviewed by: Katri Kaikkonen

src/ui/locationsearchpanel.cpp
src/ui/locationsearchpanel.h
src/ui/searchhistorylistitem.cpp

index 5bfd2e6..648a202 100644 (file)
@@ -20,7 +20,6 @@
     USA.
 */
 
-#include <QPair>
 #include <QSettings>
 
 #include "avatarimage.h"
@@ -115,14 +114,14 @@ LocationSearchPanel::LocationSearchPanel(QWidget *parent)
     m_clearLocationListButton->setDisabled(true);
 
     connect(m_clearLocationListButton, SIGNAL(clicked()),
-            this, SLOT(showSearchHistoryList()));
+            this, SLOT(showSearchHistoryListView()));
 
     m_contextButtonLayout->addWidget(m_routeButton);
     m_contextButtonLayout->addWidget(searchLocationButton);
     m_contextButtonLayout->addWidget(m_clearLocationListButton);
 
     readSettings();
-    showSearchHistoryList();
+    showSearchHistoryListView();
 }
 
 LocationSearchPanel::~LocationSearchPanel()
@@ -185,12 +184,8 @@ void LocationSearchPanel::populateLocationListView(const QList<Location> &locati
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    m_searchHistoryListView->clearItemSelection();
-    m_searchHistoryListView->hide();
-    setHeaderText(locations.count());
     m_locationListView->clearList();
-    m_clearLocationListButton->setEnabled(true);
-    m_locationListView->show();
+    showLocationListView(locations.count());
 
     for (int i = 0; i < locations.size(); ++i) {
         LocationListItem *item = new LocationListItem();
@@ -255,7 +250,18 @@ void LocationSearchPanel::setRouteButtonDisabled()
     m_routeButton->setDisabled(m_locationListView->selectedItems().isEmpty());
 }
 
-void LocationSearchPanel::showSearchHistoryList()
+void LocationSearchPanel::showLocationListView(int locationItemsCount)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    m_searchHistoryListView->clearItemSelection();
+    m_searchHistoryListView->hide();
+    setHeaderText(locationItemsCount);
+    m_clearLocationListButton->setEnabled(true);
+    m_locationListView->show();
+}
+
+void LocationSearchPanel::showSearchHistoryListView()
 {
     qDebug() << __PRETTY_FUNCTION__;
 
index d86190a..f01890f 100644 (file)
@@ -107,9 +107,16 @@ private slots:
     void clearListsSelections();
 
     /**
-    * @brief Shows search history list.
+    * @brief Shows location list view.
+    *
+    * @param locationItemsCount location items count
+    */
+    void showLocationListView(int locationItemsCount);
+
+    /**
+    * @brief Shows search history list view.
     */
-    void showSearchHistoryList();
+    void showSearchHistoryListView();
 
     /**
     * @brief Populates location list view.
index bd0aaff..53fd7a4 100644 (file)
@@ -41,10 +41,7 @@ void SearchHistoryListItem::setSearchHistoryData(const QString &searchString,
     qDebug() << __PRETTY_FUNCTION__;
 
     setDateTime(dateTime);
-
-    setTitle(shortenText(searchString, ITEM_WIDTH - 3 * MARGIN,
-                            ListItem::TEXT_SIZE_NORMAL));
-
+    setTitle(shortenText(searchString, ITEM_WIDTH - 3 * MARGIN, ListItem::TEXT_SIZE_NORMAL));
     setImage(AvatarImage::create(QPixmap(":/res/images/search_history.png"), AvatarImage::Small));
 
     clearSubItems();