From 2bec587d4d233bf9769008bf5b177400350a845f Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Mon, 23 Apr 2018 11:03:34 +0200 Subject: [PATCH 1/2] SocketAPI: Allow opening share dialog if contents still syncing #4608 With the previous changes the "Share..." action was shown but it didn't work yet. --- src/gui/socketapi.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp index 0ab589b647..2907f3db8f 100644 --- a/src/gui/socketapi.cpp +++ b/src/gui/socketapi.cpp @@ -376,10 +376,8 @@ void SocketApi::processShareRequest(const QString &localFile, SocketListener *li const QString message = QLatin1String("SHARE:NOP:") + QDir::toNativeSeparators(localFile); listener->sendMessage(message); } else { - SyncFileStatus fileStatus = fileData.syncFileStatus(); - - // Verify the file is on the server (to our knowledge of course) - if (fileStatus.tag() != SyncFileStatus::StatusUpToDate) { + // If the file doesn't have a journal record, it might not be uploaded yet + if (!fileData.journalRecord().isValid()) { const QString message = QLatin1String("SHARE:NOTSYNCED:") + QDir::toNativeSeparators(localFile); listener->sendMessage(message); return; From ca8f569371294b594fc7b84293f65ee3675ff67e Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Mon, 23 Apr 2018 11:00:08 +0200 Subject: [PATCH 2/2] SocketAPI: Remove SHARE_STATUS It was never used by a shell integration. --- src/gui/socketapi.cpp | 49 ------------------------------------------- src/gui/socketapi.h | 1 - 2 files changed, 50 deletions(-) diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp index 2907f3db8f..52b4cf068c 100644 --- a/src/gui/socketapi.cpp +++ b/src/gui/socketapi.cpp @@ -452,55 +452,6 @@ void SocketApi::command_VERSION(const QString &, SocketListener *listener) listener->sendMessage(QLatin1String("VERSION:" MIRALL_VERSION_STRING ":" MIRALL_SOCKET_API_VERSION)); } -void SocketApi::command_SHARE_STATUS(const QString &localFile, SocketListener *listener) -{ - auto fileData = FileData::get(localFile); - if (!fileData.folder) { - const QString message = QLatin1String("SHARE_STATUS:NOP:") + QDir::toNativeSeparators(localFile); - listener->sendMessage(message); - return; - } - - SyncFileStatus fileStatus = fileData.syncFileStatus(); - - // Verify the file is on the server (to our knowledge of course) - if (fileStatus.tag() != SyncFileStatus::StatusUpToDate) { - const QString message = QLatin1String("SHARE_STATUS:NOTSYNCED:") + QDir::toNativeSeparators(localFile); - listener->sendMessage(message); - return; - } - - const Capabilities capabilities = fileData.folder->accountState()->account()->capabilities(); - - if (!capabilities.shareAPI()) { - const QString message = QLatin1String("SHARE_STATUS:DISABLED:") + QDir::toNativeSeparators(localFile); - listener->sendMessage(message); - } else { - auto theme = Theme::instance(); - QString available; - - if (theme->userGroupSharing()) { - available = "USER,GROUP"; - } - - if (theme->linkSharing() && capabilities.sharePublicLink()) { - if (available.isEmpty()) { - available = "LINK"; - } else { - available += ",LINK"; - } - } - - if (available.isEmpty()) { - const QString message = QLatin1String("SHARE_STATUS:DISABLED") + ":" + QDir::toNativeSeparators(localFile); - listener->sendMessage(message); - } else { - const QString message = QLatin1String("SHARE_STATUS:") + available + ":" + QDir::toNativeSeparators(localFile); - listener->sendMessage(message); - } - } -} - void SocketApi::command_SHARE_MENU_TITLE(const QString &, SocketListener *listener) { listener->sendMessage(QLatin1String("SHARE_MENU_TITLE:") + tr("Share with %1", "parameter is ownCloud").arg(Theme::instance()->appNameGUI())); diff --git a/src/gui/socketapi.h b/src/gui/socketapi.h index c0ebeda94e..f39e4dcc8d 100644 --- a/src/gui/socketapi.h +++ b/src/gui/socketapi.h @@ -95,7 +95,6 @@ private: Q_INVOKABLE void command_VERSION(const QString &argument, SocketListener *listener); - Q_INVOKABLE void command_SHARE_STATUS(const QString &localFile, SocketListener *listener); Q_INVOKABLE void command_SHARE_MENU_TITLE(const QString &argument, SocketListener *listener); // The context menu actions