Removed disabled button states, don't open panel without buttons
authorSami Rämö <sami.ramo@ixonos.com>
Fri, 3 Sep 2010 08:14:24 +0000 (11:14 +0300)
committerSami Rämö <sami.ramo@ixonos.com>
Fri, 3 Sep 2010 08:14:24 +0000 (11:14 +0300)
 - Removed disabled states from item related context buttons

 - ListItemContextButtonBar is not opened if it does not contain buttons

src/ui/friendlistpanel.cpp
src/ui/friendlistpanel.h
src/ui/listitemcontextbuttonbar.cpp
src/ui/locationsearchpanel.cpp
src/ui/locationsearchpanel.h

index 5e461e5..3827746 100644 (file)
@@ -83,9 +83,6 @@ FriendListPanel::FriendListPanel(QWidget *parent)
             this, SIGNAL(findFriend(GeoCoordinate)));
 
     connect(m_friendListView, SIGNAL(listItemSelectionChanged()),
-            this, SLOT(setRouteButtonDisabled()));
-
-    connect(m_friendListView, SIGNAL(listItemSelectionChanged()),
             this, SLOT(onListItemSelectionChanged()));
 
     // --- FOOTER, TEXT BASED FILTERING ---
@@ -124,7 +121,6 @@ FriendListPanel::FriendListPanel(QWidget *parent)
     m_routeButton = new ImageButton(":res/images/route_to_friend.png",
                                     ":res/images/route_to_friend_s.png",
                                     ":res/images/route_to_friend_d.png", this);
-    m_routeButton->setDisabled(true);
     connect(m_routeButton, SIGNAL(clicked()),
             this, SLOT(routeToSelectedFriend()));
 
@@ -150,7 +146,6 @@ void FriendListPanel::anyPanelClosed()
     clearFiltering();
 
     m_friendListView->clearItemSelection();
-    setRouteButtonDisabled();
 }
 
 void FriendListPanel::anyPanelOpened()
@@ -239,7 +234,6 @@ void FriendListPanel::hideEvent(QHideEvent *event)
     clearFiltering();
 
     m_friendListView->clearItemSelection();
-    setRouteButtonDisabled();
 }
 
 void FriendListPanel::routeToSelectedFriend()
@@ -273,13 +267,6 @@ void FriendListPanel::updateKeyboardGrabbing()
     }
 }
 
-void FriendListPanel::setRouteButtonDisabled()
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    m_routeButton->setDisabled(m_friendListView->selectedItems().isEmpty());
-}
-
 void FriendListPanel::showEvent(QShowEvent *event)
 {
     qDebug() << __PRETTY_FUNCTION__;
index a781517..6a2723e 100644 (file)
@@ -169,13 +169,6 @@ private slots:
     void routeToSelectedFriend();
 
     /**
-    * @brief Sets route button disabled.
-    *
-    * Disabled if there isn't any list item selected.
-    */
-    void setRouteButtonDisabled();
-
-    /**
      * @brief Slot to show friends in list.
      *
      * Shows only friends that are on userIDs list
index 3d5791e..d7b6551 100644 (file)
@@ -20,6 +20,7 @@
 */
 
 #include <QDebug>
+#include <QLayout>
 #include <QPainter>
 #include <QPropertyAnimation>
 #include <QStateMachine>
@@ -178,7 +179,9 @@ void ListItemContextButtonBar::showContextButtonBar()
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    m_state = StateOpening;
-    m_animation->setDirection(QAbstractAnimation::Forward);
-    m_animation->start();
+    if (m_contextButtons->layout()->count() > 0) {
+        m_state = StateOpening;
+        m_animation->setDirection(QAbstractAnimation::Forward);
+        m_animation->start();
+    }
 }
index b765744..c0d53a8 100644 (file)
@@ -60,9 +60,6 @@ LocationSearchPanel::LocationSearchPanel(QWidget *parent)
             SIGNAL(locationItemClicked(const GeoCoordinate&, const GeoCoordinate&)));
 
     connect(m_locationListView, SIGNAL(listItemSelectionChanged()),
-            this, SLOT(setRouteButtonDisabled()));
-
-    connect(m_locationListView, SIGNAL(listItemSelectionChanged()),
             this, SLOT(onListItemSelectionChanged()));
 
     QVBoxLayout *resultsListViewLayout = new QVBoxLayout;
@@ -83,8 +80,7 @@ LocationSearchPanel::LocationSearchPanel(QWidget *parent)
     panelLayout->addLayout(resultsListViewLayout);
 
     // --- CONTEXT BUTTONS ---
-    m_routeButton = new ImageButton(":res/images/compass.png", "", "", this);
-    m_routeButton->setDisabled(true);
+    m_routeButton = new ImageButton(":res/images/routing.png", "", "", this);
     connect(m_routeButton, SIGNAL(clicked()),
             this, SLOT(routeToSelectedLocation()));
 
@@ -102,8 +98,6 @@ void LocationSearchPanel::clearListsSelections()
     qDebug() << __PRETTY_FUNCTION__;
 
     m_locationListView->clearItemSelection();
-
-    setRouteButtonDisabled();
 }
 
 void LocationSearchPanel::hideEvent(QHideEvent *event)
@@ -159,10 +153,3 @@ void LocationSearchPanel::setHeaderText(int count)
 
     m_resultsLabel->setText(tr("Search results: %1").arg(count));
 }
-
-void LocationSearchPanel::setRouteButtonDisabled()
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    m_routeButton->setDisabled(m_locationListView->selectedItems().isEmpty());
-}
index fd87bf2..98b978d 100644 (file)
@@ -97,13 +97,6 @@ private slots:
     */
     void routeToSelectedLocation();
 
-    /**
-    * @brief Sets route button disabled.
-    *
-    * Disabled if there isn't any list item selected.
-    */
-    void setRouteButtonDisabled();
-
 /*******************************************************************************
  * SIGNALS
  ******************************************************************************/