[Pkg-owncloud-commits] [owncloud-client] 79/484: Added setPublicUpload to OcsShareJob

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Dec 16 00:37:17 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 3ea944d1b349a82791b31c8c1707b35326d1d062
Author: Roeland Jago Douma <rullzer at owncloud.com>
Date:   Thu Oct 15 20:34:56 2015 +0200

    Added setPublicUpload to OcsShareJob
---
 src/gui/ocssharejob.cpp | 12 ++++++++++++
 src/gui/ocssharejob.h   |  7 +++++++
 src/gui/sharedialog.cpp | 16 +++-------------
 3 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/src/gui/ocssharejob.cpp b/src/gui/ocssharejob.cpp
index 408c529..5df074b 100644
--- a/src/gui/ocssharejob.cpp
+++ b/src/gui/ocssharejob.cpp
@@ -80,6 +80,18 @@ void OcsShareJob::setPassword(const QString &password)
     start();
 }
 
+void OcsShareJob::setPublicUpload(bool publicUpload)
+{
+    setVerb("PUT");
+
+    QList<QPair<QString, QString> > postParams;
+    const QString value = QString::fromLatin1(publicUpload ? "true" : "false");
+    postParams.append(qMakePair(QString::fromLatin1("publicUpload"), value));
+
+    setPostParams(postParams);
+    start();
+}
+
 void OcsShareJob::createShare(const QString &path, SHARETYPE shareType, const QString &password, const QDate &date)
 {
     setVerb("POST");
diff --git a/src/gui/ocssharejob.h b/src/gui/ocssharejob.h
index e662537..ed216cc 100644
--- a/src/gui/ocssharejob.h
+++ b/src/gui/ocssharejob.h
@@ -75,6 +75,13 @@ public:
     void setPassword(const QString& password);
 
     /**
+     * Void set the a share to be public upload
+     * 
+     * @param publicUpload Set or remove public upload
+     */
+    void setPublicUpload(bool publicUpload);
+
+    /**
      * Create a new share
      *
      * @param path The path of the file/folder to share
diff --git a/src/gui/sharedialog.cpp b/src/gui/sharedialog.cpp
index e02f686..76af797 100644
--- a/src/gui/sharedialog.cpp
+++ b/src/gui/sharedialog.cpp
@@ -33,8 +33,6 @@
 #include <QFileInfo>
 
 namespace {
-    int SHARETYPE_PUBLIC = 3;
-
 //    int PERMISSION_READ = 1;
     int PERMISSION_UPDATE = 2;
     int PERMISSION_CREATE = 4;
@@ -564,23 +562,15 @@ void ShareDialog::setPublicUpload(bool publicUpload)
     _ui->checkBox_editing->setEnabled(false);
     _pi_editing->startAnimation();
 
-    const QUrl url = Account::concatUrlPath(_account->url(), QString("ocs/v1.php/apps/files_sharing/api/v1/shares/%1").arg(_public_share_id));
-
-    QList<QPair<QString, QString> > requestParams;
-    const QString value = QString::fromLatin1(publicUpload ? "true" : "false");
-    requestParams.append(qMakePair(QString::fromLatin1("publicUpload"), value));
-
-    OcsShareJob *job = new OcsShareJob("PUT", url, _account, this);
-    job->setPostParams(requestParams);
+    OcsShareJob *job = new OcsShareJob(_public_share_id, _account, this);
     connect(job, SIGNAL(jobFinished(QVariantMap)), this, SLOT(slotPublicUploadSet(QVariantMap)));
-
-    job->start();
+    job->setPublicUpload(publicUpload);
 }
 
 void ShareDialog::slotPublicUploadSet(const QVariantMap &reply)
 {
     QString message;
-    int code = getJsonReturnCode(reply, message);
+    int code = OcsShareJob::getJsonReturnCode(reply, message);
     if (code == 100) {
         _ui->checkBox_editing->setEnabled(true);
     } else {

-- 
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