Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2022-11-08 17:02:30 +0300
committerGitHub <noreply@github.com>2022-11-08 17:02:30 +0300
commitf969200a82228b2f6a641d7c5afdefc6ab0a3755 (patch)
tree0a23569dda1d534d660aa5b52e05828a463678ad
parent8af64e898929c4676e043f3ce2958f2ce4e9de2c (diff)
Open the browser instead of the share dialog (#10241)
When using role based sharing we no longer display the sharing dialog.
-rw-r--r--changelog/unreleased/102065
-rw-r--r--src/gui/owncloudgui.cpp71
-rw-r--r--src/libsync/capabilities.cpp11
-rw-r--r--src/libsync/capabilities.h22
4 files changed, 76 insertions, 33 deletions
diff --git a/changelog/unreleased/10206 b/changelog/unreleased/10206
new file mode 100644
index 000000000..71bbd3b5b
--- /dev/null
+++ b/changelog/unreleased/10206
@@ -0,0 +1,5 @@
+Change: When connected to oCIS, open the browser instead of the sharing dialog
+
+When connected to oCIS, we now open the browser and navigate to the file the user wanted to share instead of opening the legacy sharing dialog.
+
+https://github.com/owncloud/client/issues/10206
diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp
index 4d41d5d34..bafbdafb5 100644
--- a/src/gui/owncloudgui.cpp
+++ b/src/gui/owncloudgui.cpp
@@ -1207,47 +1207,52 @@ void ownCloudGui::slotShowShareDialog(const QString &sharePath, const QString &l
qCWarning(lcApplication) << "Could not open share dialog for" << localPath << "no responsible folder found";
return;
}
+ if (folder->accountState()->account()->capabilities().filesSharing().sharing_roles) {
+ fetchPrivateLinkUrl(folder->accountState()->account(), folder->webDavUrl(), sharePath, this, [](const QUrl &url) {
+ Utility::openBrowser(url, nullptr);
+ });
+ } else {
+ const auto accountState = folder->accountState();
- const auto accountState = folder->accountState();
-
- SyncJournalFileRecord fileRecord;
+ SyncJournalFileRecord fileRecord;
- bool resharingAllowed = true; // lets assume the good
- if (folder->journalDb()->getFileRecord(file, &fileRecord) && fileRecord.isValid()) {
- // check the permission: Is resharing allowed?
- if (!fileRecord._remotePerm.isNull() && !fileRecord._remotePerm.hasPermission(RemotePermissions::CanReshare)) {
- resharingAllowed = false;
+ bool resharingAllowed = true; // lets assume the good
+ if (folder->journalDb()->getFileRecord(file, &fileRecord) && fileRecord.isValid()) {
+ // check the permission: Is resharing allowed?
+ if (!fileRecord._remotePerm.isNull() && !fileRecord._remotePerm.hasPermission(RemotePermissions::CanReshare)) {
+ resharingAllowed = false;
+ }
}
- }
- // As a first approximation, set the set of permissions that can be granted
- // either to everything (resharing allowed) or nothing (no resharing).
- //
- // The correct value will be found with a propfind from ShareDialog.
- // (we want to show the dialog directly, not wait for the propfind first)
- SharePermissions maxSharingPermissions =
- SharePermissionRead
- | SharePermissionUpdate | SharePermissionCreate | SharePermissionDelete
- | SharePermissionShare;
- if (!resharingAllowed) {
- maxSharingPermissions = SharePermission(0);
- }
+ // As a first approximation, set the set of permissions that can be granted
+ // either to everything (resharing allowed) or nothing (no resharing).
+ //
+ // The correct value will be found with a propfind from ShareDialog.
+ // (we want to show the dialog directly, not wait for the propfind first)
+ SharePermissions maxSharingPermissions =
+ SharePermissionRead
+ | SharePermissionUpdate | SharePermissionCreate | SharePermissionDelete
+ | SharePermissionShare;
+ if (!resharingAllowed) {
+ maxSharingPermissions = SharePermission(0);
+ }
- ShareDialog *w = nullptr;
- if (_shareDialogs.contains(localPath) && _shareDialogs[localPath]) {
- qCInfo(lcApplication) << "Raising share dialog" << sharePath << localPath;
- w = _shareDialogs[localPath];
- } else {
- qCInfo(lcApplication) << "Opening share dialog" << sharePath << localPath << maxSharingPermissions;
- w = new ShareDialog(accountState, folder->webDavUrl(), sharePath, localPath, maxSharingPermissions, startPage, settingsDialog());
- w->setAttribute(Qt::WA_DeleteOnClose, true);
+ ShareDialog *w = nullptr;
+ if (_shareDialogs.contains(localPath) && _shareDialogs[localPath]) {
+ qCInfo(lcApplication) << "Raising share dialog" << sharePath << localPath;
+ w = _shareDialogs[localPath];
+ } else {
+ qCInfo(lcApplication) << "Opening share dialog" << sharePath << localPath << maxSharingPermissions;
+ w = new ShareDialog(accountState, folder->webDavUrl(), sharePath, localPath, maxSharingPermissions, startPage, settingsDialog());
+ w->setAttribute(Qt::WA_DeleteOnClose, true);
- _shareDialogs[localPath] = w;
- connect(w, &QObject::destroyed, this, &ownCloudGui::slotRemoveDestroyedShareDialogs);
+ _shareDialogs[localPath] = w;
+ connect(w, &QObject::destroyed, this, &ownCloudGui::slotRemoveDestroyedShareDialogs);
+ }
+ w->open();
+ raiseDialog(w);
}
- w->open();
- raiseDialog(w);
}
void ownCloudGui::slotRemoveDestroyedShareDialogs()
diff --git a/src/libsync/capabilities.cpp b/src/libsync/capabilities.cpp
index 90a385a78..a3da79978 100644
--- a/src/libsync/capabilities.cpp
+++ b/src/libsync/capabilities.cpp
@@ -30,6 +30,7 @@ Capabilities::Capabilities(const QVariantMap &capabilities)
, _spaces(_capabilities.value(QStringLiteral("spaces")).toMap())
, _status(_capabilities.value(QStringLiteral("core")).toMap().value(QStringLiteral("status")).toMap())
, _appProviders(AppProviders::findVersion(_capabilities.value(QStringLiteral("files")).toMap().value(QStringLiteral("app_providers")).toList(), QVersionNumber({ 1, 1, 0 })))
+ , _filesSharing(_fileSharingCapabilities)
{
}
@@ -334,4 +335,14 @@ Capabilities::AppProviders Capabilities::AppProviders::findVersion(const QVarian
: Capabilities::AppProviders();
}
+
+const FilesSharing &Capabilities::filesSharing() const
+{
+ return _filesSharing;
+}
+
+FilesSharing::FilesSharing(const QVariantMap &filesSharing)
+ : sharing_roles(filesSharing.value(QStringLiteral("sharing_roles"), false).toBool())
+{
+}
} // namespace OCC
diff --git a/src/libsync/capabilities.h b/src/libsync/capabilities.h
index 651a9a26f..9dfb03ccc 100644
--- a/src/libsync/capabilities.h
+++ b/src/libsync/capabilities.h
@@ -91,6 +91,25 @@ struct OWNCLOUDSYNC_EXPORT SpaceSupport
bool isValid() const;
};
+struct OWNCLOUDSYNC_EXPORT FilesSharing
+{
+ /**
+ api_enabled": true,
+ "resharing": true,
+ "group_sharing": true,
+ "sharing_roles": true,
+ "auto_accept_share": true,
+ "share_with_group_members_only": true,
+ "share_with_membership_groups_only": true,
+ "search_min_length": 3,
+ "default_permissions": 22,
+ */
+ FilesSharing(const QVariantMap &filesSharing);
+
+ // TODO: add more
+ bool sharing_roles = false;
+};
+
/**
* @brief The Capabilities class represents the capabilities of an ownCloud
* server
@@ -254,6 +273,8 @@ public:
const AppProviders &appProviders() const;
+ const FilesSharing &filesSharing() const;
+
QVariantMap raw() const;
@@ -265,6 +286,7 @@ private:
SpaceSupport _spaces;
Status _status;
AppProviders _appProviders;
+ FilesSharing _filesSharing;
};
}