diff options
author | Kevin Ottens <kevin.ottens@nextcloud.com> | 2020-08-20 15:13:56 +0300 |
---|---|---|
committer | Kevin Ottens <kevin.ottens@nextcloud.com> | 2020-08-20 15:13:56 +0300 |
commit | 07388e0f220d8960bf8f727c6ff40a682574c155 (patch) | |
tree | baef7554d808cd55a44a100655c421c765df8d0a /src/gui/socketapi.cpp | |
parent | b67c61bf4aef6c0304fc12f4912e036d77edc9c0 (diff) |
Disable context menu actions for E2EE files and folders
Those files and folders are not shareable and the "Edit" or "Open in
browser" actions will lead to showing an error in the web GUI. No need
to lead users there so just disable them.
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
Diffstat (limited to 'src/gui/socketapi.cpp')
-rw-r--r-- | src/gui/socketapi.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp index 47f03425a..f58c38e4e 100644 --- a/src/gui/socketapi.cpp +++ b/src/gui/socketapi.cpp @@ -718,11 +718,11 @@ void SocketApi::command_GET_STRINGS(const QString &argument, SocketListener *lis listener->sendMessage(QString("GET_STRINGS:END")); } -void SocketApi::sendSharingContextMenuOptions(const FileData &fileData, SocketListener *listener) +void SocketApi::sendSharingContextMenuOptions(const FileData &fileData, SocketListener *listener, bool enabled) { auto record = fileData.journalRecord(); bool isOnTheServer = record.isValid(); - auto flagString = isOnTheServer ? QLatin1String("::") : QLatin1String(":d:"); + auto flagString = isOnTheServer && enabled ? QLatin1String("::") : QLatin1String(":d:"); auto capabilities = fileData.folder->accountState()->account()->capabilities(); auto theme = Theme::instance(); @@ -798,7 +798,8 @@ void SocketApi::command_GET_MENU_ITEMS(const QString &argument, OCC::SocketListe bool hasSeveralFiles = argument.contains(QLatin1Char('\x1e')); // Record Separator FileData fileData = hasSeveralFiles ? FileData{} : FileData::get(argument); bool isOnTheServer = fileData.journalRecord().isValid(); - auto flagString = isOnTheServer ? QLatin1String("::") : QLatin1String(":d:"); + const auto isE2eEncryptedPath = fileData.journalRecord()._isE2eEncrypted || !fileData.journalRecord()._e2eMangledName.isEmpty(); + auto flagString = isOnTheServer && !isE2eEncryptedPath ? QLatin1String("::") : QLatin1String(":d:"); if (fileData.folder && fileData.folder->accountState()->isConnected()) { DirectEditor* editor = getDirectEditorForLocalFile(fileData.localPath); @@ -809,7 +810,7 @@ void SocketApi::command_GET_MENU_ITEMS(const QString &argument, OCC::SocketListe listener->sendMessage(QLatin1String("MENU_ITEM:OPEN_PRIVATE_LINK") + flagString + tr("Open in browser")); } - sendSharingContextMenuOptions(fileData, listener); + sendSharingContextMenuOptions(fileData, listener, !isE2eEncryptedPath); } listener->sendMessage(QString("GET_MENU_ITEMS:END")); } |