Merge branch 'master' of https://vcs.maemo.org/git/situare
authorKatri Kaikkonen <katri.kaikkonen@ixonos.com>
Mon, 6 Sep 2010 11:24:36 +0000 (14:24 +0300)
committerKatri Kaikkonen <katri.kaikkonen@ixonos.com>
Mon, 6 Sep 2010 11:24:36 +0000 (14:24 +0300)
1  2 
src/ui/locationsearchpanel.cpp

@@@ -92,16 -92,8 +92,16 @@@ LocationSearchPanel::LocationSearchPane
      const int MARGIN_LEFT = 0;
      panelLayout->setContentsMargins(MARGIN_LEFT, PANEL_MARGIN_TOP,
                                      PANEL_MARGIN_RIGHT, PANEL_MARGIN_BOTTOM);
 +    m_noSearchLabel = new QLabel();
 +    m_noSearchLabel->setText("No Search Results");
 +    m_noSearchLabel->setAlignment(Qt::AlignCenter);
 +
 +    QPalette m_noSearchPalette = palette();
 +    m_noSearchPalette.setColor(QPalette::Foreground, Qt::white);
 +    m_noSearchLabel->setPalette(m_noSearchPalette);
  
      panelLayout->addWidget(resultsHeaderWidget);
 +    panelLayout->addWidget(m_noSearchLabel, Qt::AlignCenter);
      panelLayout->addLayout(resultsListViewLayout);
  
      // --- CONTEXT BUTTONS ---
      connect(searchLocationButton, SIGNAL(clicked()),
              this, SIGNAL(requestSearchLocation()));
  
-     m_clearLocationListButton = new ImageButton(":/res/images/clear_btn.png",
-                                                 ":/res/images/clear_btn_s.png",
-                                                 ":/res/images/clear_btn_d.png", this);
+     m_clearLocationListButton = new ImageButton(":/res/images/back_btn.png",
+                                                 ":/res/images/back_btn_s.png",
+                                                 ":/res/images/back_btn_d.png", this);
      m_clearLocationListButton->setDisabled(true);
  
      connect(m_clearLocationListButton, SIGNAL(clicked()),
  
      readSettings();
      showSearchHistoryListView();
 +    showEmptyPanel(true);
  }
  
  LocationSearchPanel::~LocationSearchPanel()
@@@ -199,16 -190,6 +199,6 @@@ void LocationSearchPanel::populateLocat
          m_locationListView->addListItem(QString::number(i), item);
      }
  
-     const int FIRST_LOCATION_ITEM_INDEX = 0;
-     const int ONE_LOCATION_ITEM = 1;
-     if (locations.size() == ONE_LOCATION_ITEM) {
-         ListItem *item = m_locationListView->listItemAt(FIRST_LOCATION_ITEM_INDEX);
-         if (item)
-             m_locationListView->setSelectedItem(item);
-     }
      m_locationListView->scrollToTop();
  }
  
@@@ -242,17 -223,6 +232,17 @@@ void LocationSearchPanel::routeToSelect
          emit routeToLocation(item->coordinates());
  }
  
 +void LocationSearchPanel::showEmptyPanel(bool show)
 +{
 +    if (show){
 +        m_noSearchLabel->show();
 +        m_searchHistoryListView->hide();
 +    }
 +    else {
 +        m_noSearchLabel->hide();
 +    }
 +}
 +
  void LocationSearchPanel::setHeaderText(int count)
  {
      qDebug() << __PRETTY_FUNCTION__;
@@@ -269,7 -239,6 +259,7 @@@ void LocationSearchPanel::showLocationL
      setHeaderText(locationItemsCount);
      m_clearLocationListButton->setEnabled(true);
      m_locationListView->show();
 +    showEmptyPanel(false);
  }
  
  void LocationSearchPanel::showSearchHistoryListView()
      m_resultsLabel->setText(tr("Search history:"));
      m_clearLocationListButton->setDisabled(true);
      m_searchHistoryListView->show();
 +    showEmptyPanel(false);
  }