]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.h
Fix view mode-specific settings not always applying
[dolphin.git] / src / dolphinmainwindow.h
index 3a29d1c0a483bef09e16e21e89c72032e43b00fc..bf74b77b72a9fbaf730b55742e5baac9b51b0b01 100644 (file)
 #define DOLPHIN_MAINWINDOW_H
 
 #include "dolphintabwidget.h"
-#include <config-baloo.h>
+#include "selectionmode/bottombar.h"
+#include "config-dolphin.h"
 #include <KFileItemActions>
 #include <kio/fileundomanager.h>
 #include <kxmlguiwindow.h>
 
-#ifdef HAVE_BALOO
+#if HAVE_BALOO
     #include "panels/information/informationpanel.h"
 #endif
 
@@ -38,7 +39,6 @@ class KFileItem;
 class KFileItemList;
 class KJob;
 class KNewFileMenu;
-class KHelpMenu;
 class KToolBarPopupAction;
 class QToolButton;
 class PlacesPanel;
@@ -47,6 +47,9 @@ class TerminalPanel;
 namespace KIO {
     class OpenUrlJob;
 }
+namespace SelectionMode {
+    class ActionTextHelper;
+}
 
 /**
  * @short Main window for Dolphin.
@@ -95,6 +98,12 @@ public:
      */
     KNewFileMenu* newFileMenu() const;
 
+    /**
+     * Augments Qt's build-in QMainWindow context menu to add
+     * Dolphin-specific actions, such as "unlock panels".
+     */
+    QMenu *createPopupMenu() override;
+
     /**
      * Switch the window's view containers' locations to display the home path
      * for any which are currently displaying a location corresponding to or
@@ -130,7 +139,9 @@ public Q_SLOTS:
     /**
      * Tries to raise/activate the Dolphin window.
      */
-    void activateWindow();
+    void activateWindow(const QString &activationToken);
+
+    bool isActiveWindow();
 
     /**
      * Determines if a URL is open in any tab.
@@ -141,6 +152,13 @@ public Q_SLOTS:
      */
     bool isUrlOpen(const QString &url);
 
+    /**
+     * @return Whether the item with @p url can be found in any view only by switching
+     * between already open tabs and scrolling in their primary or secondary view.
+     * @note Use of QString instead of QUrl is required to be callable via DBus.
+     */
+    bool isItemVisibleInAnyView(const QString &urlOfItem);
+
 
     /**
      * Pastes the clipboard data into the currently selected folder
@@ -171,6 +189,19 @@ public Q_SLOTS:
      */
     void openNewTab(const QUrl& url);
 
+    /**
+     * Opens a new tab  showing the URL \a url and activate it.
+     */
+    void openNewTabAndActivate(const QUrl &url);
+
+    /**
+     * Opens a new window showing the URL \a url.
+     */
+    void openNewWindow(const QUrl &url);
+
+    /** @see GeneralSettings::splitViewChanged() */
+    void slotSplitViewChanged();
+
 Q_SIGNALS:
     /**
      * Is sent if the selection of the currently active view has
@@ -214,11 +245,6 @@ protected:
     /** @see KMainWindow::readProperties() */
     void readProperties(const KConfigGroup& group) override;
 
-    /** Handles QWhatsThisClickedEvent and passes all others on. */
-    bool event(QEvent* event) override;
-    /** Handles QWhatsThisClickedEvent and passes all others on. */
-    bool eventFilter(QObject*, QEvent*) override;
-
     /** Sets a sane initial window size **/
     QSize sizeHint() const override;
 
@@ -283,6 +309,9 @@ private Q_SLOTS:
      */
     void updatePasteAction();
 
+    /** Calls DolphinViewContainer::setSelectionMode() for m_activeViewContainer. */
+    void slotSetSelectionMode(bool enabled, SelectionMode::BottomBar::Contents bottomBarContents);
+
     /** Selects all items from the active view. */
     void selectAll();
 
@@ -303,6 +332,12 @@ private Q_SLOTS:
     /** Dedicated action to open the stash:/ ioslave in split view. */
     void toggleSplitStash();
 
+    /** Copies all selected items to the inactive view. */
+    void copyToInactiveSplitView();
+
+    /** Moves all selected items to the inactive view. */
+    void moveToInactiveSplitView();
+
     /** Reloads the currently active view. */
     void reloadView();
 
@@ -312,6 +347,8 @@ private Q_SLOTS:
     void enableStopAction();
     void disableStopAction();
 
+    void toggleSelectionMode();
+
     void showFilterBar();
     void toggleFilterBar();
 
@@ -380,6 +417,12 @@ private Q_SLOTS:
     /** Opens a terminal window for the current location. */
     void openTerminal();
 
+    /** Opens terminal windows for the selected items' locations. */
+    void openTerminalHere();
+
+    /** Opens a terminal window for the URL. */
+    void openTerminalJob(const QUrl& url);
+
     /** Focus a Terminal Panel. */
     void focusTerminalPanel();
 
@@ -456,14 +499,11 @@ private Q_SLOTS:
      * @pos           Position in screen coordinates.
      * @item          File item context. If item is null, the context menu
      *                should be applied to \a url.
+     * @selectedItems The selected items for which the context menu
+     *                is opened. This list generally includes \a item.
      * @url           URL which contains \a item.
-     * @customActions Actions that should be added to the context menu,
-     *                if the file item is null.
      */
-    void openContextMenu(const QPoint& pos,
-                         const KFileItem& item,
-                         const QUrl& url,
-                         const QList<QAction*>& customActions);
+    void openContextMenu(const QPoint& pos, const KFileItem& item, const KFileItemList &selectedItems, const QUrl& url);
 
     /**
      * Updates the menu that is by default at the right end of the toolbar.
@@ -563,6 +603,12 @@ private Q_SLOTS:
       * to go to.
       */
     void slotGoForward(QAction* action);
+
+    /**
+     * Is called when configuring the keyboard shortcuts
+     */
+    void slotKeyBindings();
+
 private:
     /**
      * Sets up the various menus and actions and connects them.
@@ -628,6 +674,9 @@ private:
      */
     bool addHamburgerMenuToToolbar();
 
+    /** Creates an action representing an item in the URL navigator history */
+    static QAction *urlNavigatorHistoryAction(const KUrlNavigator *urlNavigator, int historyIndex, QObject *parent = nullptr);
+
 private:
     /**
      * Implements a custom error handling for the undo manager. This
@@ -643,7 +692,6 @@ private:
     };
 
     KNewFileMenu* m_newFileMenu;
-    KHelpMenu* m_helpMenu;
     DolphinTabWidget* m_tabWidget;
     DolphinViewContainer* m_activeViewContainer;
 
@@ -651,10 +699,7 @@ private:
     DolphinRemoteEncoding* m_remoteEncoding;
     QPointer<DolphinSettingsDialog> m_settingsDialog;
     DolphinBookmarkHandler* m_bookmarkHandler;
-
-    // Members for the toolbar menu that is shown when the menubar is hidden:
-    QToolButton* m_controlButton;
-    QTimer* m_updateToolBarTimer;
+    SelectionMode::ActionTextHelper* m_actionTextHelper;
 
     KIO::OpenUrlJob *m_lastHandleUrlOpenJob;
 
@@ -668,6 +713,7 @@ private:
     QMenu m_searchTools;
     KFileItemActions m_fileItemActions;
 
+    friend class DolphinMainWindowTest;
 };
 
 inline DolphinViewContainer* DolphinMainWindow::activeViewContainer() const