Moved setting the visibility of the buttons to ListItemContextButtonBar
authorSami Rämö <sami.ramo@ixonos.com>
Thu, 2 Sep 2010 12:26:28 +0000 (15:26 +0300)
committerSami Rämö <sami.ramo@ixonos.com>
Thu, 2 Sep 2010 12:26:28 +0000 (15:26 +0300)
src/ui/listitemcontextbuttonbar.cpp
src/ui/listitemcontextbuttonbar.h
src/ui/mainwindow.cpp
src/ui/panelbase.cpp
src/ui/panelbase.h
src/ui/tabbedpanel.cpp
src/ui/tabbedpanel.h

index 48487b3..722f123 100644 (file)
@@ -32,6 +32,19 @@ ListItemContextButtonBar::ListItemContextButtonBar(QWidget *parent) :
     qDebug() << __PRETTY_FUNCTION__;
 }
 
+void ListItemContextButtonBar::hideContextButtonBar()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+}
+
+void ListItemContextButtonBar::onListItemSelectionChanged(bool itemIsSelected)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    m_contextButtons->setVisible(itemIsSelected);
+}
+
 void ListItemContextButtonBar::setContextButtons(QWidget *contextButtons)
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -54,3 +67,9 @@ void ListItemContextButtonBar::setContextButtons(QWidget *contextButtons)
     const int Y = 0;
     move(PANEL_TAB_BAR_WIDTH + PANEL_BAR_WIDTH + FROM_PANEL_CONTENTS_LEFT, Y);
 }
+
+void ListItemContextButtonBar::showContextButtonBar()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+}
index 910729f..afbd971 100644 (file)
@@ -31,6 +31,8 @@ class ListItemContextButtonBar : public QWidget
 public:
     explicit ListItemContextButtonBar(QWidget *parent = 0);
 
+    void hideContextButtonBar();
+
     /**
      * @brief Sets the context buttons to the context button bar
      *
@@ -38,9 +40,12 @@ public:
      */
     void setContextButtons(QWidget *contextButtons);
 
+    void showContextButtonBar();
+
 signals:
 
 public slots:
+    void onListItemSelectionChanged(bool itemIsSelected);
 
 private:
     QWidget *m_contextButtons;      ///< Widget for context buttons
index e99cf6b..cfba1f0 100644 (file)
@@ -345,7 +345,7 @@ void MainWindow::buildPanels()
     buildRoutingPanel();
 
     m_tabbedPanel = new TabbedPanel(this);
-    
+
     //Save Situare related tab indexes so tabs can be enabled/disabled when logged in/out
     m_situareTabsIndexes.append(
             m_tabbedPanel->addTab(m_userInfoPanel, QIcon(":/res/images/user_info.png")));
@@ -384,6 +384,16 @@ void MainWindow::buildPanels()
 
     connect(m_tabbedPanel, SIGNAL(currentChanged(int)),
             m_userInfoPanel, SIGNAL(collapse()));
+
+    // signals for showing and hiding list item context buttons
+    connect(m_friendsListPanel, SIGNAL(listItemSelectionChanged(bool)),
+            m_tabbedPanel, SIGNAL(listItemSelectionChanged(bool)));
+
+    connect(m_locationSearchPanel, SIGNAL(listItemSelectionChanged(bool)),
+            m_tabbedPanel, SIGNAL(listItemSelectionChanged(bool)));
+
+    connect(m_routingPanel, SIGNAL(listItemSelectionChanged(bool)),
+            m_tabbedPanel, SIGNAL(listItemSelectionChanged(bool)));
 }
 
 void MainWindow::buildRoutingPanel()
index 6400053..a623abd 100644 (file)
@@ -78,7 +78,7 @@ void PanelBase::onListItemSelectionChanged()
 
     QListWidget *listWidget = dynamic_cast<QListWidget *>(sender());
     if (listWidget && (listWidget->selectedItems().count() > 0))
-        m_itemButtons->show();
+        emit listItemSelectionChanged(true);
     else
-        m_itemButtons->hide();
+        emit listItemSelectionChanged(false);
 }
index 6bc77af..6812113 100644 (file)
@@ -76,6 +76,8 @@ signals:
      */
     void openPanelRequested(QWidget *widget);
 
+    void listItemSelectionChanged(bool itemIsSelected);
+
 /*******************************************************************************
  * DATA MEMBERS
  ******************************************************************************/
index 3ffc2fb..f42b1ef 100644 (file)
@@ -87,6 +87,9 @@ TabbedPanel::TabbedPanel(QWidget *parent)
     // --- LIST ITEM RELATED CONTEXT BUTTONS BAR ---
     m_itemContextButtonBar = new ListItemContextButtonBar(this);
 
+    connect(this, SIGNAL(listItemSelectionChanged(bool)),
+            m_itemContextButtonBar, SLOT(onListItemSelectionChanged(bool)));
+
     // --- PANEL CONTENT ---
     m_panelContentStack = new PanelContentStack(this);
     m_panelContentStack->move(PANEL_TAB_BAR_WIDTH + PANEL_BAR_WIDTH, PANEL_TOP_Y);
index 95c46ff..ecd7899 100644 (file)
@@ -163,6 +163,8 @@ signals:
      */
     void currentChanged(int index);
 
+    void listItemSelectionChanged(bool itemIsSelected);
+
     /**
      * @brief Signal that is sent when panel is closed
      *