Fix: one flag was not cleared when item was unselected
authorSami Rämö <sami.ramo@ixonos.com>
Fri, 3 Sep 2010 06:22:59 +0000 (09:22 +0300)
committerSami Rämö <sami.ramo@ixonos.com>
Fri, 3 Sep 2010 06:22:59 +0000 (09:22 +0300)
 - Buttons were shown when button bar was open, panel was changed
   and then item was selected and unselected before the actual
   change of the buttons was done.

src/ui/listitemcontextbuttonbar.cpp
src/ui/panelbase.cpp

index 96c0b75..b9ef662 100644 (file)
@@ -47,7 +47,7 @@ ListItemContextButtonBar::ListItemContextButtonBar(QWidget *parent) :
 
 void ListItemContextButtonBar::changeButtons()
 {
-    qWarning() << __PRETTY_FUNCTION__;
+    qDebug() << __PRETTY_FUNCTION__;
 
     Q_ASSERT(m_animation->state() == QAbstractAnimation::Stopped);
 
@@ -74,7 +74,7 @@ void ListItemContextButtonBar::changeButtons()
 
 void ListItemContextButtonBar::hideContextButtonBar()
 {
-    qWarning() << __PRETTY_FUNCTION__;
+    qDebug() << __PRETTY_FUNCTION__;
 
     m_state = StateClosing;
     m_animation->setDirection(QAbstractAnimation::Backward);
@@ -83,7 +83,7 @@ void ListItemContextButtonBar::hideContextButtonBar()
 
 void ListItemContextButtonBar::onAnimationFinished()
 {
-    qWarning() << __PRETTY_FUNCTION__;
+    qDebug() << __PRETTY_FUNCTION__;
 
     if (m_animation->direction() == QAbstractAnimation::Backward) {
         m_state = StateHidden;
@@ -101,21 +101,24 @@ void ListItemContextButtonBar::onAnimationFinished()
 
 void ListItemContextButtonBar::onListItemSelectionChanged(bool itemIsSelected)
 {
-    qWarning() << __PRETTY_FUNCTION__;
-
-    /// @todo m_waitForOpen is not cleared if item selection is removed while waiting
+    qDebug() << __PRETTY_FUNCTION__;
 
-    if (m_newContextButtons)
-        m_waitForOpen = true;
-    else if (itemIsSelected && (m_state != StateVisible))
-        showContextButtonBar();
-    else if (!itemIsSelected && (m_state != StateHidden))
-        hideContextButtonBar();
+    if (itemIsSelected) {
+        if (m_newContextButtons)
+            m_waitForOpen = true;
+        else if (m_state != StateVisible)
+            showContextButtonBar();
+    } else {
+        if (m_newContextButtons)
+            m_waitForOpen = false;
+        else if (m_state != StateHidden)
+            hideContextButtonBar();
+    }
 }
 
 void ListItemContextButtonBar::setContextButtons(QWidget *contextButtons)
 {
-    qWarning() << __PRETTY_FUNCTION__;
+    qDebug() << __PRETTY_FUNCTION__;
 
     m_newContextButtons = contextButtons;
     m_waitForOpen = false;
@@ -128,7 +131,7 @@ void ListItemContextButtonBar::setContextButtons(QWidget *contextButtons)
 
 void ListItemContextButtonBar::showContextButtonBar()
 {
-    qWarning() << __PRETTY_FUNCTION__;
+    qDebug() << __PRETTY_FUNCTION__;
 
     m_state = StateOpening;
     m_animation->setDirection(QAbstractAnimation::Forward);
index b9f8839..3510669 100644 (file)
@@ -55,7 +55,6 @@ PanelBase::PanelBase(QWidget *parent)
     m_itemButtonsLayout = new QHBoxLayout;
     /// @todo set margins
     m_itemButtons->setLayout(m_itemButtonsLayout);
-//    m_itemButtons->hide();
 }
 
 QWidget* PanelBase::genericPanelButtons() const