From 3b7c05b385dc56fbc0b9ffdd332f8d30e7624d0c Mon Sep 17 00:00:00 2001 From: Felix Ernst Date: Sun, 12 Sep 2021 15:33:39 +0200 Subject: 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 --- src/views/dolphinview.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/views/dolphinview.h') diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h index d1ecf74ba..37af97137 100644 --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -23,6 +23,8 @@ #include #include +#include + typedef KIO::FileUndoManager::CommandType CommandType; class QVBoxLayout; class DolphinItemListView; @@ -36,6 +38,7 @@ class ViewProperties; class QLabel; class QGraphicsSceneDragDropEvent; class QHelpEvent; +class QProxyStyle; class QRegularExpression; /** @@ -106,8 +109,11 @@ public: * (GeneralSettings::globalViewProps() returns false), then the * changed view mode will be stored automatically. */ - void setMode(Mode mode); - Mode mode() const; + void setViewMode(Mode mode); + Mode viewMode() const; + + void setSelectionMode(bool enabled); + bool selectionMode() const; /** * Turns on the file preview for the all files of the current directory, @@ -599,6 +605,13 @@ Q_SIGNALS: */ void goForwardRequested(); + /** + * Is emitted when the selection mode is requested for the current view. + * This typically happens on press and hold. + * @see KItemListController::longPress() + */ + void selectionModeRequested(); + /** * Is emitted when the user wants to move the focus to another view. */ @@ -916,6 +929,9 @@ private: QLabel* m_placeholderLabel; QTimer* m_showLoadingPlaceholderTimer; + /// Used for selection mode. @see setSelectionMode() + std::unique_ptr m_proxyStyle; + // For unit tests friend class TestBase; friend class DolphinDetailsViewTest; -- cgit v1.3