[kde-doc-english] [trojita] src/Gui: GUI: Only add button for showing main menu when toolbar is hidden, too

Jan Kundrát jkt at kde.org
Thu Mar 5 18:45:43 UTC 2015


Git commit 41c3d76326090fe27ab1111481504bd63527837f by Jan Kundrát.
Committed on 03/03/2015 at 18:19.
Pushed by gerrit into branch 'master'.

GUI: Only add button for showing main menu when toolbar is hidden, too

If the toolbar is visible, showing an explicit button for this feels a
bit redundant.

Change-Id: I33cc57709140cf35fe273c67eaf938402f822b49

M  +8    -2    src/Gui/Window.cpp
M  +1    -0    src/Gui/Window.h

http://commits.kde.org/trojita/41c3d76326090fe27ab1111481504bd63527837f

diff --git a/src/Gui/Window.cpp b/src/Gui/Window.cpp
index 18763a0..729b144 100644
--- a/src/Gui/Window.cpp
+++ b/src/Gui/Window.cpp
@@ -289,7 +289,7 @@ void MainWindow::createActions()
     showMenuBar->setCheckable(true);
     showMenuBar->setChecked(true);
     connect(showMenuBar, SIGNAL(triggered(bool)), menuBar(), SLOT(setVisible(bool)));
-    connect(showMenuBar, SIGNAL(triggered(bool)), menuShow, SLOT(setHidden(bool)));
+    connect(showMenuBar, SIGNAL(triggered(bool)), this, SLOT(updateMenuHidingButton()));
     connect(showMenuBar, SIGNAL(triggered(bool)), m_delayedStateSaving, SLOT(start()));
     connect(menuShow, SIGNAL(clicked()), showMenuBar , SLOT(trigger()));
 
@@ -299,6 +299,7 @@ void MainWindow::createActions()
     connect(showToolBar, SIGNAL(triggered(bool)), m_mainToolbar, SLOT(setVisible(bool)));
     connect(m_mainToolbar, SIGNAL(visibilityChanged(bool)), showToolBar, SLOT(setChecked(bool)));
     connect(m_mainToolbar, SIGNAL(visibilityChanged(bool)), m_delayedStateSaving, SLOT(start()));
+    connect(m_mainToolbar, SIGNAL(visibilityChanged(bool)), this, SLOT(updateMenuHidingButton()));
 
     configSettings = new QAction(loadIcon(QLatin1String("configure")),  tr("&Settings..."), this);
     connect(configSettings, SIGNAL(triggered()), this, SLOT(slotShowSettings()));
@@ -2402,7 +2403,7 @@ void MainWindow::applySizesAndState()
         if (ok) {
             menuBar()->setVisible(visibility);
             showMenuBar->setChecked(visibility);
-            menuShow->setVisible(!visibility);
+            updateMenuHidingButton();
         }
     }
 
@@ -2438,4 +2439,9 @@ void MainWindow::enableLoggingToDisk()
     imapLogger->slotSetPersistentLogging(true);
 }
 
+void MainWindow::updateMenuHidingButton()
+{
+    menuShow->setVisible(!menuBar()->isVisibleTo(this) && !m_mainToolbar->isVisibleTo(this));
+}
+
 }
diff --git a/src/Gui/Window.h b/src/Gui/Window.h
index 445b4c3..91062a8 100644
--- a/src/Gui/Window.h
+++ b/src/Gui/Window.h
@@ -204,6 +204,7 @@ private slots:
     void saveSizesAndState();
     void saveRawStateSetting(bool enabled);
     void possiblyLoadMessageOnSplittersChanged();
+    void updateMenuHidingButton();
 
     void desktopGeometryChanged();
 



More information about the kde-doc-english mailing list