]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.h
DolphinMainWindow: autosave session
[dolphin.git] / src / dolphinmainwindow.h
index fe07cbc1740f5038ccf3c755c995dc1b80488b53..bff0ef4de8cac5d60908bc07ef80036832db98c7 100644 (file)
@@ -20,6 +20,7 @@
 #include "panels/information/informationpanel.h"
 #endif
 
+#include <QFutureWatcher>
 #include <QIcon>
 #include <QList>
 #include <QMenu>
@@ -116,6 +117,14 @@ public:
      */
     void setViewsToHomeIfMountPathOpen(const QString &mountPath);
 
+    /**
+     * Enables or disables the session autosaving feature.
+     *
+     * @param enable If true, saves the session automatically after a fixed
+     *               time interval from the last state change.
+     */
+    void setSessionAutoSaveEnabled(bool enable);
+
     bool isFoldersPanelEnabled() const;
     bool isInformationPanelEnabled() const;
     bool isSplitViewEnabledInCurrentTab() const;
@@ -204,9 +213,6 @@ public Q_SLOTS:
     /** @see GeneralSettings::splitViewChanged() */
     void slotSplitViewChanged();
 
-    bool isOnActivity(const QString &activityId) const;
-    bool isOnCurrentDesktop() const;
-
 Q_SIGNALS:
     /**
      * Is sent if the selection of the currently active view has
@@ -238,6 +244,9 @@ Q_SIGNALS:
     void settingsChanged();
 
 protected:
+    /** @see QObject::event() */
+    bool event(QEvent *event) override;
+
     /** @see QWidget::showEvent() */
     void showEvent(QShowEvent *event) override;
 
@@ -476,6 +485,11 @@ private Q_SLOTS:
      */
     void openInNewWindow();
 
+    /**
+     * Opens the selected folder in the other inactive split view, enables split view if necessary.
+     */
+    void openInSplitView(const QUrl &url);
+
     /**
      * Show the target of the selected symlink
      */
@@ -614,6 +628,11 @@ private Q_SLOTS:
      */
     void slotKeyBindings();
 
+    /**
+     * Saves the session.
+     */
+    void slotSaveSession();
+
 private:
     /**
      * Sets up the various menus and actions and connects them.
@@ -654,11 +673,9 @@ private:
 
     /**
      * Creates an action for showing/hiding a panel, that is accessible
-     * in "Configure toolbars..." and "Configure shortcuts...". This is necessary
-     * as the action for toggling the dock visibility is done by Qt which
-     * is no KAction instance.
+     * in "Configure toolbars..." and "Configure shortcuts...".
      */
-    void createPanelAction(const QIcon &icon, const QKeySequence &shortcut, QAction *dockAction, const QString &actionName);
+    void createPanelAction(const QIcon &icon, const QKeySequence &shortcut, QDockWidget *dockAction, const QString &actionName);
 
     /** Adds "What's This?" texts to many widgets and StandardActions. */
     void setupWhatsThis();
@@ -715,6 +732,10 @@ private:
     QMenu m_searchTools;
     KFileItemActions m_fileItemActions;
 
+    QTimer *m_sessionSaveTimer;
+    QFutureWatcher<void> *m_sessionSaveWatcher;
+    bool m_sessionSaveScheduled;
+
     friend class DolphinMainWindowTest;
 };