Merge branch 'locationlistview' of https://vcs.maemo.org/git/situare into locationlis...
authorSami Rämö <sami.ramo@ixonos.com>
Tue, 17 Aug 2010 07:02:11 +0000 (10:02 +0300)
committerSami Rämö <sami.ramo@ixonos.com>
Tue, 17 Aug 2010 07:02:11 +0000 (10:02 +0300)
src/ui/listview.cpp
src/ui/listview.h
src/ui/mainwindow.cpp
src/ui/routingpanel.cpp
src/ui/routingpanel.h

index 1538f0c..cd0090a 100644 (file)
@@ -86,6 +86,8 @@ void ListView::clearFilter()
 {
     qDebug() << __PRETTY_FUNCTION__;
 
+    m_filteredItemIDs.clear();
+
     if (m_previousItem)
         m_previousItem->setSelected(false);
 
@@ -104,6 +106,8 @@ void ListView::filter(const QList<QString> &itemIDs)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
+    m_filteredItemIDs = itemIDs;
+
     foreach (ListItem *item, m_listItems) {
         if (itemIDs.contains(m_listItems.key(item)))
             setItemHidden(item, false);
@@ -116,11 +120,23 @@ void ListView::filter(const QString &pattern)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    foreach (ListItem *item, m_listItems) {
-        if (item->title().contains(pattern, Qt::CaseInsensitive))
-            setItemHidden(item, false);
-        else
-            setItemHidden(item, true);
+    if (m_filteredItemIDs.isEmpty()) {
+        foreach (ListItem *item, m_listItems) {
+            if (item->title().contains(pattern, Qt::CaseInsensitive))
+                setItemHidden(item, false);
+            else
+                setItemHidden(item, true);
+        }
+    } else {
+        foreach (QString key, m_filteredItemIDs) {
+            ListItem *item = m_listItems.value(key);
+            if (item) {
+                if (item->title().contains(pattern, Qt::CaseInsensitive))
+                    setItemHidden(item, false);
+                else
+                    setItemHidden(item, true);
+            }
+        }
     }
 }
 
index 650175e..6c7b25a 100644 (file)
@@ -85,7 +85,7 @@ public:
     /**
     * @brief Clears filtering from list.
     *
-    * Shows all items.
+    * Clears m_filteredItemIDs and shows all items.
     */
     void clearFilter();
 
@@ -116,7 +116,7 @@ public:
     /**
     * @brief Filters list by text pattern.
     *
-    * Filtering uses item names.
+    * Filtering uses item names. If filtering by item IDs is on, filters only those items.
     *
     * @param pattern text pattern to filter
     */
@@ -185,6 +185,8 @@ private slots:
 private:
     QHash<QString, ListItem *> m_listItems; ///< List of items in this view. Key = user ID
 
+    QList<QString> m_filteredItemIDs;       ///< List of filtered item IDs
+
     ListItem *m_previousItem;               ///< Previously selected item
 };
 
index 03a9f7b..9077609 100644 (file)
@@ -334,6 +334,9 @@ void MainWindow::buildPanels()
     connect(m_friendsListPanel, SIGNAL(showPanelRequested(QWidget*)),
             m_tabbedPanel, SLOT(showPanel(QWidget*)));
 
+    connect(m_routingPanel, SIGNAL(showPanelRequested(QWidget*)),
+            m_tabbedPanel, SLOT(showPanel(QWidget*)));
+
     connect(m_tabbedPanel, SIGNAL(panelClosed()),
             m_friendsListPanel, SLOT(anyPanelClosed()));
 
index 089a917..a87c310 100644 (file)
@@ -142,4 +142,6 @@ void RoutingPanel::setRoute(Route &route)
     }
 
     m_routeWaypointListView->scrollToTop();
+
+    emit showPanelRequested(this);
 }
index 7ea34ed..d329f1e 100644 (file)
@@ -105,6 +105,13 @@ signals:
     */
     void routeWaypointItemClicked(const GeoCoordinate &coordinate);
 
+    /**
+     * @brief Signal for requesting a panel to be opened
+     *
+     * @param widget Pointer to the widget that emitted the signal
+     */
+    void showPanelRequested(QWidget *widget);
+
 /*******************************************************************************
  * DATA MEMBERS
  ******************************************************************************/