]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinnavigatorswidgetaction.h
Merge branch 'release/20.12'
[dolphin.git] / src / dolphinnavigatorswidgetaction.h
index 8046ce2dcb066ab9e200180dc88ff96f4f38e6bc..bbd8cf127fc9e51deb4515da2894718eb22455b0 100644 (file)
@@ -38,24 +38,9 @@ class DolphinNavigatorsWidgetAction : public QWidgetAction
 {
     Q_OBJECT
 
-    /**
-     * In Left-to-right languages the Primary side will be the left one.
-     */
-    enum Side {
-        Primary,
-        Secondary
-    };
-
 public:
     DolphinNavigatorsWidgetAction(QWidget *parent = nullptr);
 
-    /**
-     * Adds this action to the mainWindow's toolbar and saves the change
-     * in the users ui configuration file.
-     * @return true if successful. Otherwise false.
-     */
-    bool addToToolbarAndSave(KXmlGuiWindow *mainWindow);
-
     /**
      * The secondary UrlNavigator is only created on-demand. Such an action is not necessary
      * for the primary UrlNavigator which is created preemptively.
@@ -79,6 +64,8 @@ public:
     void followViewContainersGeometry(int globalXOfPrimary,   int widthOfPrimary,
                                       int globalXOfSecondary, int widthOfSecondary);
 
+    bool isInToolbar() const;
+
     /**
      * @return the primary UrlNavigator.
      */
@@ -96,6 +83,20 @@ public:
     void setSecondaryNavigatorVisible(bool visible);
 
 protected:
+    /**
+     * There should always ever be one navigatorsWidget for this action so
+     * this method always returns the same widget and reparents it.
+     * You normally don't have to use this method directly because
+     * QWidgetAction::requestWidget() is used to obtain the navigatorsWidget
+     * and to steal it from whereever it was prior.
+     * @param parent the new parent of the navigatorsWidget.
+     */
+    QWidget *createWidget(QWidget *parent) override;
+
+    /** @see QWidgetAction::deleteWidget() */
+    void deleteWidget(QWidget *widget) override;
+
+private:
     /**
      * Adjusts the width of the spacings used to align the UrlNavigators with ViewContainers.
      * This can only work nicely if up-to-date geometry of ViewContainers is cached so
@@ -103,6 +104,13 @@ protected:
      */
     void adjustSpacing();
 
+    /**
+     * In Left-to-right languages the Primary side will be the left one.
+     */
+    enum Side {
+        Primary,
+        Secondary
+    };
     /**
      * Used to create the navigatorWidgets for both sides of the QSplitter.
      */
@@ -133,6 +141,11 @@ protected:
      */
     QWidget *spacing(Side side, Position position) const;
 
+    /**
+     * Sets this action's text depending on the amount of visible UrlNavigators.
+     */
+    void updateText();
+
     /**
      * The defaultWidget() of this QWidgetAction.
      */