From e9cbe1359851b338e1776f6d3a00aacc93fc9321 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Wed, 6 Feb 2019 10:17:35 +0100 Subject: [PATCH] Vfs: Add option to hide socketapi pin actions Because some plugins provide alternative ui. --- src/common/vfs.h | 8 ++++++++ src/gui/socketapi.cpp | 4 +++- src/libsync/vfs/suffix/vfs_suffix.h | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/common/vfs.h b/src/common/vfs.h index 7239a911c..fe4945b5b 100644 --- a/src/common/vfs.h +++ b/src/common/vfs.h @@ -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; } diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp index 9b2de08d6..2a3947be1 100644 --- a/src/gui/socketapi.cpp +++ b/src/gui/socketapi.cpp @@ -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; diff --git a/src/libsync/vfs/suffix/vfs_suffix.h b/src/libsync/vfs/suffix/vfs_suffix.h index 8f2c1e106..4abf3920a 100644 --- a/src/libsync/vfs/suffix/vfs_suffix.h +++ b/src/libsync/vfs/suffix/vfs_suffix.h @@ -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;