Vfs: Add option to hide socketapi pin actions
authorChristian Kamm <mail@ckamm.de>
Wed, 6 Feb 2019 09:17:35 +0000 (10:17 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:58:40 +0000 (10:58 +0100)
Because some plugins provide alternative ui.

src/common/vfs.h
src/gui/socketapi.cpp
src/libsync/vfs/suffix/vfs_suffix.h

index 7239a911c32ab46f6483b01acfe166ebf10891de..fe4945b5bf629cb5626e76f0cb6a02bddfbe7b5c 100644 (file)
@@ -127,6 +127,13 @@ public:
     virtual void unregisterFolder() = 0;
 
 
+    /** Whether the socket api should show pin state options
+     *
+     * Some plugins might provide alternate shell integration, making the normal
+     * context menu actions redundant.
+     */
+    virtual bool socketApiPinStateActionsShown() const = 0;
+
     /** Return true when download of a file's data is currently ongoing.
      *
      * See also the beginHydrating() and doneHydrating() signals.
@@ -251,6 +258,7 @@ public:
     void stop() override {}
     void unregisterFolder() override {}
 
+    bool socketApiPinStateActionsShown() const override { return false; }
     bool isHydrating() const override { return false; }
 
     bool updateMetadata(const QString &, time_t, quint64, const QByteArray &, QString *) override { return true; }
index 9b2de08d688a25e8fec93ab014578b035c301821..2a3947be1a52fd471b9883ee04271a264a7de1ae 100644 (file)
@@ -1011,7 +1011,9 @@ void SocketApi::command_GET_MENU_ITEMS(const QString &argument, OCC::SocketListe
     }
 
     // File availability actions
-    if (syncFolder && syncFolder->supportsVirtualFiles()) {
+    if (syncFolder
+        && syncFolder->supportsVirtualFiles()
+        && syncFolder->vfs().socketApiPinStateActionsShown()) {
         bool hasAlwaysLocal = false;
         bool hasOnlineOnly = false;
         bool hasHydratedOnlineOnly = false;
index 8f2c1e106994a142517ed98d2da88b14a4ed26f4..4abf3920a6b42eef1e317f040bbb04af8b2f327a 100644 (file)
@@ -35,6 +35,7 @@ public:
     void stop() override;
     void unregisterFolder() override;
 
+    bool socketApiPinStateActionsShown() const override { return true; }
     bool isHydrating() const override;
 
     bool updateMetadata(const QString &filePath, time_t modtime, quint64 size, const QByteArray &fileId, QString *error) override;