[Pkg-owncloud-commits] [owncloud-client] 291/498: Fore password request if required by capabilities
Sandro Knauß
hefee-guest at moszumanska.debian.org
Tue Aug 11 14:48:59 UTC 2015
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 7f893aa676002cc0e21ed10225be52548ebb5d84
Author: Roeland Jago Douma <r.j.douma at uva.nl>
Date: Fri Jul 10 15:26:26 2015 +0200
Fore password request if required by capabilities
---
src/gui/sharedialog.cpp | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/src/gui/sharedialog.cpp b/src/gui/sharedialog.cpp
index 2bcb126..d33530e 100644
--- a/src/gui/sharedialog.cpp
+++ b/src/gui/sharedialog.cpp
@@ -28,6 +28,7 @@
#include <QBuffer>
#include <QFileIconProvider>
#include <QClipboard>
+#include <QInputDialog>
namespace {
int SHARETYPE_PUBLIC = 3;
@@ -422,6 +423,28 @@ void ShareDialog::slotCheckBoxShareLinkClicked()
QList<QPair<QString, QString> > postParams;
postParams.append(qMakePair(QString::fromLatin1("path"), _sharePath));
postParams.append(qMakePair(QString::fromLatin1("shareType"), QString::number(SHARETYPE_PUBLIC)));
+
+ /*
+ * Check the capabilities if the server requires a password for a share
+ * Ask for it directly
+ */
+ if (_account->capabilities()["files_sharing"].toMap()["public"].toMap()["password"].toMap()["enforced"].toBool()) {
+ bool ok;
+ const QString pass = QInputDialog::getText(this,
+ tr("Password for share by link"),
+ tr("Sharing by link requires a password:"),
+ QLineEdit::Password,
+ QString(),
+ &ok);
+
+ if (!ok) {
+ _pi_link->stopAnimation();
+ _ui->checkBox_shareLink->setChecked(false);
+ return;
+ }
+ postParams.append(qMakePair(QString::fromLatin1("password"), pass));
+ }
+
OcsShareJob *job = new OcsShareJob("POST", url, _account, this);
job->setPostParams(postParams);
job->addPassStatusCode(403); // "password required" is not an error
--
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