]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/selectionmode/actiontexthelper.h
Add clang-format and format code as in Frameworks
[dolphin.git] / src / selectionmode / actiontexthelper.h
index 8f7501fa4eb6a185d490c0c0a24d48c2303246a4..6ca99990f89363d31d9ccadb8a62f7bab0c9ee1e 100644 (file)
@@ -17,6 +17,11 @@ namespace SelectionMode
 
 /**
  * @brief Helps changing the texts of actions depending on the current selection.
+ *
+ * This is useful for actions that directly trigger a change when there is a selection and do something
+ * different when nothing is selected. For example should the copy action read "Copy" when items are
+ * selected but when no items are selected it can read "Copy…" since triggering it will enter selection
+ * mode and ask users to select the files they want to copy first.
  */
 class ActionTextHelper : QObject
 {
@@ -25,7 +30,7 @@ public:
 
     /**
      * Changes the text of \a action to \a text whenever textsWhenNothingIsSelectedEnabled(true) is called.
-     * The texts can be changed back by calling textsWhenNothingIsSelectedEnabled(false) is called.
+     * The texts can be changed back by calling textsWhenNothingIsSelectedEnabled(false).
      * @see textsWhenNothingIsSelectedEnabled()
      */
     void registerTextWhenNothingIsSelected(QAction *action, QString registeredText);
@@ -37,10 +42,7 @@ public:
     void textsWhenNothingIsSelectedEnabled(bool enabled);
 
 private:
-    enum TextState {
-        TextWhenNothingIsSelected,
-        TextWhenSomethingIsSelected
-    };
+    enum TextState { TextWhenNothingIsSelected, TextWhenSomethingIsSelected };
 
     /**
      * Utility struct to allow switching back and forth between registered actions showing their
@@ -48,16 +50,15 @@ private:
      * An example is "Copy" or "Copy…". The latter one is used when nothing is selected and signifies
      * that it will trigger SelectionMode so items can be selected and then copied.
      */
-    struct RegisteredActionTextChange {            
+    struct RegisteredActionTextChange {
         QPointer<QAction> action;
         QString registeredText;
         TextState textStateOfRegisteredText;
 
-        RegisteredActionTextChange(QAction *action, QString registeredText, TextState state) :
-            action{action},
-            registeredText{registeredText},
-            textStateOfRegisteredText{state}
-        {   };
+        RegisteredActionTextChange(QAction *action, QString registeredText, TextState state)
+            : action{action}
+            , registeredText{registeredText}
+            , textStateOfRegisteredText{state} {};
     };
 
     /**