┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinviewcontainer.h
diff options
context:
space:
mode:
authorFelix Ernst <[email protected]>2021-09-12 15:33:39 +0200
committerFelix Ernst <[email protected]>2022-08-14 14:42:40 +0000
commit3b7c05b385dc56fbc0b9ffdd332f8d30e7624d0c (patch)
treea54c8338e3dc7d420fd2223bbcfb5af0a186348e /src/dolphinviewcontainer.h
parent9dbe48137748c6197363236b67f6302e20b72167 (diff)
Add Selection Mode
The selection mode action is a checkable toggle action named "Select Files and Folders" which has "Space" as the default shortcut. In selection mode a bottom bar with contextual actions is shown. These should mostly mirror the actions which are available through the right-click context menu aka DolphinContextMenu. Resizing of the window might make a overflow button appear in the bottom selection mode bar. This commit makes press and hold in the view activate selection mode. This behaviour is not triggered if the press and hold is used to either start a rubberband selection or a drag operation within a short time. The length of the short timeframe is defined by a QStyleHint. This is currently not implemented in touch because I can't test it. Mix the selection mode bars' background colors using a nice combination of colors from the current color scheme BUG: 427202
Diffstat (limited to 'src/dolphinviewcontainer.h')
-rw-r--r--src/dolphinviewcontainer.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/dolphinviewcontainer.h b/src/dolphinviewcontainer.h
index 057e47149..a0936efd3 100644
--- a/src/dolphinviewcontainer.h
+++ b/src/dolphinviewcontainer.h
@@ -9,6 +9,7 @@
#include "config-dolphin.h"
#include "dolphinurlnavigator.h"
+#include "selectionmode/selectionmodebottombar.h"
#include "views/dolphinview.h"
#include <KFileItem>
@@ -27,9 +28,12 @@ namespace KActivities {
class FilterBar;
class KMessageWidget;
+class QAction;
+class QGridLayout;
class QUrl;
class DolphinSearchBox;
class DolphinStatusBar;
+class SelectionModeTopBar;
/**
* @short Represents a view for the directory content
@@ -131,6 +135,9 @@ public:
*/
void disconnectUrlNavigator();
+ void setSelectionModeEnabled(bool enabled, KActionCollection *actionCollection = nullptr, SelectionModeBottomBar::Contents bottomBarContents = SelectionModeBottomBar::Contents::GeneralContents);
+ bool isSelectionModeEnabled() const;
+
/**
* Shows the message \msg with the given type non-modal above
* the view-content.
@@ -206,6 +213,9 @@ public Q_SLOTS:
*/
void setSearchModeEnabled(bool enabled);
+ /** Used to notify the m_selectionModeBottomBar that there is no other ViewContainer in the tab. */
+ void slotSplitTabDisabled();
+
Q_SIGNALS:
/**
* Is emitted whenever the filter bar has changed its visibility state.
@@ -216,6 +226,8 @@ Q_SIGNALS:
*/
void searchModeEnabledChanged(bool enabled);
+ void selectionModeChanged(bool enabled);
+
/**
* Is emitted when the write state of the folder has been changed. The application
* should disable all actions like "Create New..." that depend on the write
@@ -395,7 +407,7 @@ private:
void tryRestoreViewState();
private:
- QVBoxLayout* m_topLayout;
+ QGridLayout *m_topLayout;
/**
* The internal UrlNavigator which is never visible to the user.
@@ -410,14 +422,22 @@ private:
* Otherwise it's one of the UrlNavigators visible in the toolbar.
*/
QPointer<DolphinUrlNavigator> m_urlNavigatorConnected;
+
DolphinSearchBox* m_searchBox;
bool m_searchModeEnabled;
+
KMessageWidget* m_messageWidget;
+ /// A bar shown at the top of the view to signify that selection mode is currently active.
+ SelectionModeTopBar *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;
+
DolphinStatusBar* m_statusBar;
QTimer* m_statusBarTimer; // Triggers a delayed update
QElapsedTimer m_statusBarTimestamp; // Time in ms since last update