[Pkg-owncloud-commits] [owncloud-client] 54/470: Add theming options control sharing operations
Sandro Knauß
hefee-guest at moszumanska.debian.org
Thu May 12 16:24:44 UTC 2016
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit 99b3b752e3b8bf214347e316297e5fbd2fa83c92
Author: Roeland Jago Douma <rullzer at owncloud.com>
Date: Mon Feb 22 13:53:45 2016 +0100
Add theming options control sharing operations
Fixes #4325
---
src/gui/sharedialog.cpp | 11 +++++++----
src/gui/socketapi.cpp | 31 ++++++++++++++++++++++++++-----
src/libsync/theme.cpp | 11 +++++++++++
src/libsync/theme.h | 8 ++++++++
4 files changed, 52 insertions(+), 9 deletions(-)
diff --git a/src/gui/sharedialog.cpp b/src/gui/sharedialog.cpp
index e66b90c..cfef4fa 100644
--- a/src/gui/sharedialog.cpp
+++ b/src/gui/sharedialog.cpp
@@ -92,10 +92,11 @@ ShareDialog::ShareDialog(AccountPtr account, const QString &sharePath, const QSt
return;
}
+ auto theme = Theme::instance();
bool autoShare = true;
// We only do user/group sharing from 8.2.0
- if (account->serverVersionInt() >= ((8 << 16) + (2 << 8))) {
+ if (theme->userGroupSharing() && account->serverVersionInt() >= ((8 << 16) + (2 << 8))) {
_userGroupWidget = new ShareUserGroupWidget(account, sharePath, localPath, resharingAllowed, this);
_ui->shareWidgetsLayout->addWidget(_userGroupWidget);
@@ -112,9 +113,11 @@ ShareDialog::ShareDialog(AccountPtr account, const QString &sharePath, const QSt
autoShare = false;
}
- _linkWidget = new ShareLinkWidget(account, sharePath, localPath, resharingAllowed, autoShare, this);
- _linkWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
- _ui->shareWidgetsLayout->addWidget(_linkWidget);
+ if (theme->linkSharing()) {
+ _linkWidget = new ShareLinkWidget(account, sharePath, localPath, resharingAllowed, autoShare, this);
+ _linkWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
+ _ui->shareWidgetsLayout->addWidget(_linkWidget);
+ }
}
ShareDialog::~ShareDialog()
diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp
index 41e46c1..066beef 100644
--- a/src/gui/socketapi.cpp
+++ b/src/gui/socketapi.cpp
@@ -364,6 +364,8 @@ void SocketApi::command_SHARE(const QString& localFile, QIODevice* socket)
qDebug() << Q_FUNC_INFO << localFile;
+ auto theme = Theme::instance();
+
Folder *shareFolder = FolderMan::instance()->folderForPath(localFile);
if (!shareFolder) {
const QString message = QLatin1String("SHARE:NOP:")+QDir::toNativeSeparators(localFile);
@@ -373,6 +375,11 @@ void SocketApi::command_SHARE(const QString& localFile, QIODevice* socket)
const QString message = QLatin1String("SHARE:NOTCONNECTED:")+QDir::toNativeSeparators(localFile);
// if the folder isn't connected, don't open the share dialog
sendMessage(socket, message);
+ } else if (!theme->linkSharing() && (
+ !theme->userGroupSharing() ||
+ shareFolder->accountState()->account()->serverVersionInt() < ((8 << 16) + (2 << 8)))) {
+ const QString message = QLatin1String("SHARE:NOP:")+QDir::toNativeSeparators(localFile);
+ sendMessage(socket, message);
} else {
const QString localFileClean = QDir::cleanPath(localFile);
const QString file = localFileClean.mid(shareFolder->cleanPath().length()+1);
@@ -448,14 +455,28 @@ void SocketApi::command_SHARE_STATUS(const QString &localFile, QIODevice *socket
const QString message = QLatin1String("SHARE_STATUS:DISABLED:")+QDir::toNativeSeparators(localFile);
sendMessage(socket, message);
} else {
- QString available = "USER,GROUP";
+ auto theme = Theme::instance();
+ QString available;
- if (capabilities.sharePublicLink()) {
- available += ",LINK";
+ if (theme->userGroupSharing()) {
+ available = "USER,GROUP";
}
- const QString message = QLatin1String("SHARE_STATUS:") + available + ":" + QDir::toNativeSeparators(localFile);
- sendMessage(socket, message);
+ 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);
+ sendMessage(socket, message);
+ } else {
+ const QString message = QLatin1String("SHARE_STATUS:") + available + ":" + QDir::toNativeSeparators(localFile);
+ sendMessage(socket, message);
+ }
}
}
}
diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp
index 6fbe05f..1a80f4c 100644
--- a/src/libsync/theme.cpp
+++ b/src/libsync/theme.cpp
@@ -417,5 +417,16 @@ QString Theme::webDavPathNonShib() const
return QLatin1String("remote.php/nonshib-webdav/");
}
+bool Theme::linkSharing() const
+{
+ return false;
+}
+
+bool Theme::userGroupSharing() const
+{
+ return true;
+}
+
+
} // end namespace client
diff --git a/src/libsync/theme.h b/src/libsync/theme.h
index 7cd6e7b..c86d848 100644
--- a/src/libsync/theme.h
+++ b/src/libsync/theme.h
@@ -229,6 +229,14 @@ public:
virtual QString webDavPath() const;
virtual QString webDavPathNonShib() const;
+ /**
+ * @brief Sharing options
+ *
+ * Allow link sharing and or user/group sharing
+ */
+ virtual bool linkSharing() const;
+ virtual bool userGroupSharing() const;
+
protected:
#ifndef TOKEN_AUTH_ONLY
QIcon themeIcon(const QString& name, bool sysTray = false) const;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list