Merge branch 'master' into context_driven_buttons, review context_driven_buttons
authorSami Rämö <sami.ramo@ixonos.com>
Fri, 3 Sep 2010 10:12:12 +0000 (13:12 +0300)
committerSami Rämö <sami.ramo@ixonos.com>
Fri, 3 Sep 2010 11:06:29 +0000 (14:06 +0300)
 - Reviewed by Jussi Laitinen

Conflicts:
images.qrc
src/src.pro
src/ui/friendlistpanel.cpp
src/ui/locationsearchpanel.cpp

1  2 
images.qrc
src/src.pro
src/ui/friendlistpanel.cpp
src/ui/friendlistpanel.h
src/ui/locationsearchpanel.cpp
src/ui/locationsearchpanel.h
src/ui/mainwindow.cpp

diff --cc images.qrc
          <file>res/images/zoom_in.png</file>
          <file>res/images/zoom_out.png</file>
          <file>res/images/location_search.png</file>
 +        <file>res/images/list_item_context_button_bar_left.png</file>
 +        <file>res/images/list_item_context_button_bar_right.png</file>
 +        <file>res/images/list_item_context_button_bar_tile.png</file>
+         <file>res/images/search_history.png</file>
+         <file>res/images/clear_btn_d.png</file>
+         <file>res/images/clear_btn_s.png</file>
+         <file>res/images/clear_btn.png</file>
+         <file>res/images/contact_btn.png</file>
+         <file>res/images/contact_btn_d.png</file>
+         <file>res/images/contact_btn_s.png</file>
      </qresource>
  </RCC>
diff --cc src/src.pro
@@@ -76,14 -72,20 +72,21 @@@ SOURCES += main.cpp 
      ui/panelcontextbuttonbar.cpp \
      ui/paneltab.cpp \
      ui/paneltabbar.cpp \
-     ui/tabbedpanel.cpp \
      ui/routingpanel.cpp \
      ui/routewaypointlistitem.cpp \
-     ui/routewaypointlistview.cpp \
-     user/user.cpp \
-     ui/locationsearchpanel.cpp \
+     ui/routewaypointlistview.cpp \    
+     ui/searchdialog.cpp \
+     ui/searchhistorylistitem.cpp \
+     ui/searchhistorylistview.cpp \
+     ui/settingsdialog.cpp \
+     ui/tabbedpanel.cpp \
      ui/textmodifier.cpp \
+     ui/userinfo.cpp \
+     ui/userinfopanel.cpp \
+     ui/zoombutton.cpp \
+     ui/zoombuttonpanel.cpp \
 -    user/user.cpp
++    user/user.cpp \
 +    ui/listitemcontextbuttonbar.cpp
  HEADERS += application.h \
      common.h \
      coordinates/geocoordinate.h \
      ui/routingpanel.h \
      ui/routewaypointlistitem.h \
      ui/routewaypointlistview.h \
-     user/user.h \
-     ui/locationsearchpanel.h \
+     ui/searchdialog.h \
+     ui/searchhistorylistitem.h \
+     ui/searchhistorylistview.h \
+     ui/settingsdialog.h \
+     ui/tabbedpanel.h \
      ui/textmodifier.h \
+     ui/userinfo.h \
+     ui/userinfopanel.h \
+     ui/zoombutton.h \
+     ui/zoombuttonpanel.h \
 -    user/user.h
++    user/user.h \
 +    ui/listitemcontextbuttonbar.h
  QT += network \
      webkit
  DEFINES += QT_NO_DEBUG_OUTPUT
@@@ -132,8 -140,9 +139,9 @@@ FriendListPanel::FriendListPanel(QWidge
      connect(m_clearGroupFilteringButton, SIGNAL(clicked()),
              this, SLOT(clearFiltering()));
  
 -    m_contextButtonLayout->addWidget(m_routeButton);
 -    m_contextButtonLayout->addWidget(m_showContactButton);
 -    m_contextButtonLayout->addWidget(m_clearGroupFilteringButton);
 +    m_itemButtonsLayout->addWidget(m_routeButton);
++    m_itemButtonsLayout->addWidget(m_showContactButton);
 +    m_genericButtonsLayout->addWidget(m_clearGroupFilteringButton);
  }
  
  void FriendListPanel::anyPanelClosed()
@@@ -234,8 -244,22 +242,21 @@@ void FriendListPanel::hideEvent(QHideEv
      clearFiltering();
  
      m_friendListView->clearItemSelection();
 -    setRouteButtonDisabled();
  }
  
+ void FriendListPanel::requestSelectedFriendContactDialog()
+ {
+      qDebug() << __PRETTY_FUNCTION__;
+      FriendListItem *item = dynamic_cast<FriendListItem *>(m_friendListView->selectedItem());
+      if (item) {
+          QString facebookId = item->facebookId();
+          if (!facebookId.isEmpty())
+              emit requestContactDialog(facebookId);
+      }
+ }
  void FriendListPanel::routeToSelectedFriend()
  {
      qDebug() << __PRETTY_FUNCTION__;
Simple merge
@@@ -89,8 -108,57 +107,57 @@@ LocationSearchPanel::LocationSearchPane
      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->setDisabled(true);
+     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();
+ }
+ LocationSearchPanel::~LocationSearchPanel()
+ {
+     qDebug() << __PRETTY_FUNCTION__;
+     QSettings settings(DIRECTORY_NAME, FILE_NAME);
+     QList<QVariant> searchHistories;
+     for (int i = 0; i < m_searchHistoryListView->count(); ++i) {
+         SearchHistoryListItem *item = dynamic_cast<SearchHistoryListItem*>(
+                 m_searchHistoryListView->listItemAt(i));
+         if (item) {
+             QList<QString> searchHistory;
+             searchHistory.append(item->title());
+             searchHistory.append(item->dateTime().toString());
+             searchHistories.append(QVariant(searchHistory));
+         }
+     }
+     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;
+     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__;
  
      m_locationListView->clearItemSelection();
+     m_searchHistoryListView->clearItemSelection();
 -
 -    setRouteButtonDisabled();
  }
  
  void LocationSearchPanel::hideEvent(QHideEvent *event)
@@@ -153,3 -242,32 +239,25 @@@ void LocationSearchPanel::setHeaderText
  
      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__;
+     m_searchHistoryListView->clearItemSelection();
+     m_searchHistoryListView->hide();
+     setHeaderText(locationItemsCount);
+     m_clearLocationListButton->setEnabled(true);
+     m_locationListView->show();
+ }
+ void LocationSearchPanel::showSearchHistoryListView()
+ {
+     qDebug() << __PRETTY_FUNCTION__;
+     m_locationListView->clearList();
+     m_locationListView->hide();
+     m_resultsLabel->setText(tr("Search history:"));
+     m_clearLocationListButton->setDisabled(true);
+     m_searchHistoryListView->show();
+ }
Simple merge
Simple merge