Separate clearing for friend group filtering and text based filtering
authorSami Rämö <sami.ramo@ixonos.com>
Tue, 17 Aug 2010 07:52:28 +0000 (10:52 +0300)
committerSami Rämö <sami.ramo@ixonos.com>
Tue, 17 Aug 2010 07:52:28 +0000 (10:52 +0300)
 - Fixed keyboard grabbing related error prints when opening friend
   group before opening friend list when application was started.

src/ui/friendlistpanel.cpp
src/ui/friendlistpanel.h

index 192972e..bbec55e 100644 (file)
@@ -85,7 +85,7 @@ FriendListPanel::FriendListPanel(QWidget *parent)
             this, SIGNAL(findFriend(GeoCoordinate)));
 
     connect(m_clearFilterButton, SIGNAL(clicked()),
-            this, SLOT(clearFiltering()));
+            this, SLOT(clearFriendGroupFiltering()));
 
     connect(m_routeButton, SIGNAL(clicked()),
             this, SLOT(routeToSelectedFriend()));
@@ -105,7 +105,7 @@ FriendListPanel::FriendListPanel(QWidget *parent)
     filteringLayout->addWidget(m_filterField);
 
     connect(m_filterField, SIGNAL(returnPressed()),
-            this, SLOT(clearFiltering()));
+            this, SLOT(clearTextFiltering()));
 
     connect(m_filterField, SIGNAL(textChanged(QString)),
             this, SLOT(filterTextChanged(QString)));
@@ -116,7 +116,7 @@ FriendListPanel::FriendListPanel(QWidget *parent)
     m_filterClearButton->setIcon(QIcon::fromTheme(QLatin1String("general_close")));
 
     connect(m_filterClearButton, SIGNAL(clicked()),
-            this, SLOT(clearFiltering()));
+            this, SLOT(clearTextFiltering()));
 
     connect(qApp, SIGNAL(topmostWindowChanged(bool)),
             this, SLOT(topmostWindowChanged(bool)));
@@ -129,7 +129,7 @@ void FriendListPanel::anyPanelClosed()
     m_somePanelIsOpen = false;
     updateKeyboardGrabbing();
 
-    clearFiltering();
+    clearFriendGroupFiltering();
 }
 
 void FriendListPanel::anyPanelOpened()
@@ -140,12 +140,16 @@ void FriendListPanel::anyPanelOpened()
     updateKeyboardGrabbing();
 }
 
-void FriendListPanel::clearFiltering()
+void FriendListPanel::clearFriendGroupFiltering()
 {
-    qWarning() << __PRETTY_FUNCTION__;
-
     m_friendListHeaderWidget->hide();
     m_friendListView->clearFilter();
+    clearTextFiltering();
+}
+
+void FriendListPanel::clearTextFiltering()
+{
+    qWarning() << __PRETTY_FUNCTION__;
 
     // clearing the filtering text field does cause also hiding the filtering layout
     m_filterField->clear();
@@ -207,7 +211,7 @@ void FriendListPanel::hideEvent(QHideEvent *event)
 
     QWidget::hideEvent(event);
     updateKeyboardGrabbing();
-    clearFiltering();
+    clearFriendGroupFiltering();
 }
 
 void FriendListPanel::routeToSelectedFriend()
@@ -263,8 +267,7 @@ void FriendListPanel::showFriendsInList(const QList<QString> &userIDs)
     m_friendListHeaderWidget->show();
     m_friendListView->filter(userIDs);
 
-    // hide the text filtering fields
-    setFilteringLayoutVisibility(false);
+    clearTextFiltering();
 
     emit showPanelRequested(this);
 }
index e88abfc..ba5a109 100644 (file)
@@ -65,7 +65,7 @@ protected:
     /**
     * @brief Re-implemented from QWidget::hideEvent()
     *
-    * Calls updateKeyboardGrabbing().
+    * Calls updateKeyboardGrabbing() and clearFriendGroupFiltering().
     *
     * @param event
     */
@@ -119,9 +119,10 @@ private slots:
     /**
     * @brief Called when any of the panel tabs is closed
     *
-    * Does clear the filtering. Calls updateKeyboardGrabbing() for releasing the grabbing when
-    * FriendListPanel is closed, not changed to other panel. In this case the hideEvent() is
-    * not triggered.
+    * Does call clearFriendGroupFiltering().
+    *
+    * Calls updateKeyboardGrabbing() for releasing the grabbing when FriendListPanel is closed, not
+    * changed to other panel. In this case the hideEvent() is not triggered.
     */
     void anyPanelClosed();
 
@@ -134,9 +135,18 @@ private slots:
     void anyPanelOpened();
 
     /**
-    * @brief Slot for clearing the friend list filtering.
+    * @brief Slot for clearing the friend group filtering
+    *
+    * Does also call clearTextFiltering().
+    */
+    void clearFriendGroupFiltering();
+
+    /**
+    * @brief Slot for clearing the text based filtering.
+    *
+    * Does clear only the text based filtering. Friend group based filtering is not affected.
     */
-    void clearFiltering();
+    void clearTextFiltering();
 
     /**
     * @brief Updates the filtering when filtering text value is changed