]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.h
do not open excessive tab
[dolphin.git] / src / dolphinmainwindow.h
index 3c83b21789afd16b6722bc9f73e8145e1b2b6b29..e26bf50dd40a4e2d5f0493be29ff87451adb4a16 100644 (file)
 #define DOLPHIN_MAINWINDOW_H
 
 #include "dolphintabwidget.h"
-#include <config-baloo.h>
+#include "config-dolphin.h"
+#include <KFileItemActions>
 #include <kio/fileundomanager.h>
-#include <KSortableList>
 #include <kxmlguiwindow.h>
 
-#ifdef HAVE_BALOO
+#if HAVE_BALOO
     #include "panels/information/informationpanel.h"
 #endif
 
@@ -95,6 +95,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
@@ -105,12 +111,6 @@ public:
      */
     void setViewsToHomeIfMountPathOpen(const QString& mountPath);
 
-    /**
-     * Sets any of the window's view containers which are currently displaying
-     * invalid locations to the home path
-     */
-    void setViewsWithInvalidPathsToHome();
-
     bool isFoldersPanelEnabled() const;
     bool isInformationPanelEnabled() const;
 
@@ -138,6 +138,8 @@ public Q_SLOTS:
      */
     void activateWindow();
 
+    bool isActiveWindow();
+
     /**
      * Determines if a URL is open in any tab.
      * @note Use of QString instead of QUrl is required to be callable via DBus.
@@ -147,6 +149,15 @@ public Q_SLOTS:
      */
     bool isUrlOpen(const QString &url);
 
+    /**
+     * Determines if a URL or it's parent is open in any tab.
+     * @note Use of QString instead of QUrl is required to be callable via DBus.
+     *
+     * @param url URL to look for
+     * @returns true if url or it's parent is currently open in a tab, false otherwise.
+     */
+    bool isUrlOrParentOpen(const QString &url);
+
 
     /**
      * Pastes the clipboard data into the currently selected folder
@@ -177,6 +188,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
@@ -386,6 +410,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();
 
@@ -462,17 +492,19 @@ 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.
+     *
+     * In true "simple by default" fashion, the menu only contains the most important
+     * and necessary actions to be able to use Dolphin. This is supposed to hold true even
+     * if the user does not know how to open a context menu. More advanced actions can be
+     * discovered through a sub-menu (@see KConfigWidgets::KHamburgerMenu::setMenuBarAdvertised()).
      */
     void updateHamburgerMenu();
 
@@ -564,6 +596,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.
@@ -629,6 +667,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
@@ -666,10 +707,9 @@ private:
     KToolBarPopupAction* m_backAction;
     KToolBarPopupAction* m_forwardAction;
 
-    /** Makes sure that only one object is ever connected to the history. */
-    QMetaObject::Connection m_updateHistoryConnection;
-
     QMenu m_searchTools;
+    KFileItemActions m_fileItemActions;
+
 };
 
 inline DolphinViewContainer* DolphinMainWindow::activeViewContainer() const