]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinviewcontainer.h
Exit the deleted directory when it is removed
[dolphin.git] / src / dolphinviewcontainer.h
index a0936efd3da083ad8df758490e0b67e4f14c00e6..83d3ed1a1be89dd27872720b467461cbbab97ace 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "config-dolphin.h"
 #include "dolphinurlnavigator.h"
-#include "selectionmode/selectionmodebottombar.h"
+#include "selectionmode/bottombar.h"
 #include "views/dolphinview.h"
 
 #include <KFileItem>
@@ -33,7 +33,9 @@ class QGridLayout;
 class QUrl;
 class DolphinSearchBox;
 class DolphinStatusBar;
-class SelectionModeTopBar;
+namespace SelectionMode {
+    class TopBar;
+}
 
 /**
  * @short Represents a view for the directory content
@@ -135,7 +137,20 @@ public:
      */
     void disconnectUrlNavigator();
 
-    void setSelectionModeEnabled(bool enabled, KActionCollection *actionCollection = nullptr, SelectionModeBottomBar::Contents bottomBarContents = SelectionModeBottomBar::Contents::GeneralContents);
+    /**
+     * Sets a selection mode that is useful for quick and easy selecting or deselecting of files.
+     * This method is the central authority about enabling or disabling selection mode:
+     * All other classes that want to enable or disable selection mode should trigger a call of this method.
+     *
+     * This method sets the selection mode for the view of this viewContainer and sets the visibility of the
+     * selection mode top and bottom bar which also belong to this viewContainer.
+     *
+     * @param enabled           Whether to enable or disable selection mode.
+     * @param actionCollection  The collection of actions from which the actions on the bottom bar are retrieved.
+     * @param bottomBarContents The contents the bar is supposed to show after this call.
+     */
+    void setSelectionModeEnabled(bool enabled, KActionCollection *actionCollection = nullptr, SelectionMode::BottomBar::Contents bottomBarContents = SelectionMode::BottomBar::Contents::GeneralContents);
+    /** @see setSelectionModeEnabled() */
     bool isSelectionModeEnabled() const;
 
     /**
@@ -385,6 +400,7 @@ private Q_SLOTS:
 
     void slotHiddenFilesShownChanged(bool showHiddenFiles);
     void slotSortHiddenLastChanged(bool hiddenLast);
+    void slotCurrentDirectoryRemoved();
 
     void slotOpenUrlFinished(KJob* job);
 
@@ -406,6 +422,11 @@ private:
      */
     void tryRestoreViewState();
 
+    /**
+     * @return Path of nearest existing ancestor directory.
+     */
+    QString getNearestExistingAncestorOfPath(const QString& path) const;
+
 private:
     QGridLayout *m_topLayout;
 
@@ -429,14 +450,14 @@ private:
     KMessageWidget* m_messageWidget;
 
     /// A bar shown at the top of the view to signify that selection mode is currently active.
-    SelectionModeTopBar *m_selectionModeTopBar;
+    SelectionMode::TopBar *m_selectionModeTopBar;
 
     DolphinView* m_view;
 
     FilterBar* m_filterBar;
 
     /// A bar shown at the bottom of the view whose contents depend on what the user is currently doing.
-    SelectionModeBottomBar *m_selectionModeBottomBar;
+    SelectionMode::BottomBar *m_selectionModeBottomBar;
 
     DolphinStatusBar* m_statusBar;
     QTimer* m_statusBarTimer;            // Triggers a delayed update