]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
DolphinContextMenu: Show "Show menubar" entry if necessary
[dolphin.git] / src / dolphinmainwindow.cpp
index 1f3e99f76f954ec06d8f615bd350466b81d95a17..e5cc9901f2603e2e4b74df910307a6a45b1defdf 100644 (file)
@@ -53,6 +53,7 @@
 #include "dolphin_iconsmodesettings.h"
 #include "dolphin_searchsettings.h"
 
+#include <KAcceleratorManager>
 #include <KAction>
 #include <KActionCollection>
 #include <KActionMenu>
@@ -71,7 +72,6 @@
 #include <KInputDialog>
 #include <KLocale>
 #include <KProtocolManager>
-#include <KPushButton>
 #include <KMenu>
 #include <KMenuBar>
 #include <KMessageBox>
@@ -93,8 +93,8 @@
 #include <QDBusMessage>
 #include <QKeyEvent>
 #include <QClipboard>
+#include <QToolButton>
 #include <QSplitter>
-#include <kacceleratormanager.h>
 
 /*
  * Remembers the tab configuration if a tab has been closed.
@@ -1429,6 +1429,13 @@ void DolphinMainWindow::slotToolBarMenuButtonDeleted()
     m_updateToolBarTimer->start();
 }
 
+void DolphinMainWindow::slotToolBarIconSizeChanged(const QSize& iconSize)
+{
+    if (m_openToolBarMenuButton) {
+        m_openToolBarMenuButton->setIconSize(iconSize);
+    }
+}
+
 void DolphinMainWindow::init()
 {
     DolphinSettings& settings = DolphinSettings::instance();
@@ -1962,12 +1969,10 @@ void DolphinMainWindow::createToolBarMenuButton()
     Q_ASSERT(!m_openToolBarMenuButton);
 
     m_toolBarSpacer = new QWidget(this);
-    m_toolBarSpacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
+    m_toolBarSpacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
 
-    m_openToolBarMenuButton = new KPushButton(this);
-    m_openToolBarMenuButton->setFlat(true);
+    m_openToolBarMenuButton = new QToolButton(this);
     m_openToolBarMenuButton->setIcon(KIcon("configure"));
-    m_openToolBarMenuButton->setMaximumWidth(m_openToolBarMenuButton->sizeHint().height());
 
     // Instead of using QPushButton::setMenu() the opening of the menu is done manually
     // to prevent the "clutter" of the down-arrow drawn by the style.
@@ -1975,6 +1980,7 @@ void DolphinMainWindow::createToolBarMenuButton()
 
     toolBar()->addWidget(m_toolBarSpacer);
     toolBar()->addWidget(m_openToolBarMenuButton);
+    connect(toolBar(), SIGNAL(iconSizeChanged(QSize)), this, SLOT(slotToolBarIconSizeChanged(QSize)));
 
     // The added widgets are owned by the toolbar and may get deleted when e.g. the toolbar
     // gets edited. In this case we must add them again. The adding is done asynchronously by