]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.h
Update the size of the menu toolbar-item
[dolphin.git] / src / dolphinmainwindow.h
index 10ebccb805e0548404d6ea1cd5d9b8f02b30d280..10fcf57fd32daa9278983588777795b9bf5f2842 100644 (file)
 
 typedef KIO::FileUndoManager::CommandType CommandType;
 
-class KAction;
 class DolphinViewActionHandler;
 class DolphinApplication;
 class DolphinSettingsDialog;
 class DolphinViewContainer;
 class DolphinRemoteEncoding;
+class KAction;
+class KJob;
 class KNewFileMenu;
 class KTabBar;
 class KUrl;
 class QSplitter;
-class KJob;
+class QToolButton;
 
 /**
  * @short Main window for Dolphin.
@@ -108,12 +109,6 @@ public:
      */
     KNewFileMenu* newFileMenu() const;
 
-    /**
-     * Returns the 'Show Menubar' action which can be shared with
-     * other menus (e. g. a context menu).
-     */
-    KAction* showMenuBarAction() const;
-
 public slots:
     /**
      * Pastes the clipboard data into the currently selected folder
@@ -261,6 +256,13 @@ private slots:
      */
     void togglePanelLockState();
 
+    /**
+     * Is invoked if the Places panel got visible/invisible and takes care
+     * that the places-selector of all views is only shown if the Places panel
+     * is invisible.
+     */
+    void slotPlacesPanelVisibilityChanged(bool visible);
+
     /** Goes back one step of the URL history. */
     void goBack();
 
@@ -288,9 +290,6 @@ private slots:
      */
     void goUp(Qt::MouseButtons buttons);
 
-    /** Goes to the home URL. */
-    void goHome();
-
     /** Opens Kompare for 2 selected files. */
     void compareFiles();
 
@@ -439,6 +438,13 @@ private slots:
                          const KUrl& url,
                          const QList<QAction*>& customActions);
 
+    void openToolBarMenu();
+    void updateToolBarMenu();
+    void updateToolBar();
+    void slotToolBarSpacerDeleted();
+    void slotToolBarMenuButtonDeleted();
+    void slotToolBarIconSizeChanged(const QSize& iconSize);
+
 private:
     DolphinMainWindow(int id);
     void init();
@@ -451,12 +457,27 @@ private:
      */
     void setActiveViewContainer(DolphinViewContainer* view);
 
+    /**
+     * Creates a view container and does a default initialization.
+     */
+    DolphinViewContainer* createViewContainer(const KUrl& url, QWidget* parent);
+
     void setupActions();
     void setupDockWidgets();
     void updateEditActions();
     void updateViewActions();
     void updateGoActions();
 
+    void createToolBarMenuButton();
+    void deleteToolBarMenuButton();
+
+    /**
+     * Adds the action \p action to the menu \p menu in
+     * case if it has not added already to the toolbar.
+     * @return True if the action has been added to the menu.
+     */
+    bool addActionToMenu(QAction* action, KMenu* menu);
+
     /**
      * Adds the tab[\a index] to the closed tab menu's list of actions.
      */
@@ -525,12 +546,12 @@ private:
 
     KNewFileMenu* m_newFileMenu;
     KActionMenu* m_recentTabsMenu;
-    KAction* m_showMenuBar;
     KTabBar* m_tabBar;
     DolphinViewContainer* m_activeViewContainer;
     QVBoxLayout* m_centralWidgetLayout;
     int m_id;
 
+    // Members for the tab-handling:
     struct ViewTab
     {
         ViewTab() : isPrimaryViewActive(true), primaryView(0), secondaryView(0), splitter(0) {}
@@ -539,7 +560,6 @@ private:
         DolphinViewContainer* secondaryView;
         QSplitter* splitter;
     };
-
     int m_tabIndex;
     QList<ViewTab> m_viewTab;
 
@@ -547,6 +567,12 @@ private:
     DolphinRemoteEncoding* m_remoteEncoding;
     QPointer<DolphinSettingsDialog> m_settingsDialog;
 
+    // Members for the toolbar menu that is shown when the menubar is hidden:
+    QWidget* m_toolBarSpacer;
+    QToolButton* m_openToolBarMenuButton;
+    QWeakPointer<KMenu> m_toolBarMenu;
+    QTimer* m_updateToolBarTimer;
+
     KJob* m_lastHandleUrlStatJob;
 
     /**
@@ -571,11 +597,6 @@ inline KNewFileMenu* DolphinMainWindow::newFileMenu() const
     return m_newFileMenu;
 }
 
-inline KAction* DolphinMainWindow::showMenuBarAction() const
-{
-    return m_showMenuBar;
-}
-
 inline int DolphinMainWindow::getId() const
 {
     return m_id;