Added getPublicUpload to LinkShare
authorRoeland Jago Douma <rullzer@owncloud.com>
Thu, 29 Oct 2015 10:47:14 +0000 (11:47 +0100)
committerRoeland Jago Douma <rullzer@owncloud.com>
Thu, 29 Oct 2015 14:42:25 +0000 (15:42 +0100)
so the gui does not have to know abou the internal permissions

src/gui/share.cpp
src/gui/share.h
src/gui/sharedialog.cpp

index f749b59e74f720a457f05bdfd57c5f855892e3f7..abce0be52bf1cdb803350d5a5c14445b6661e534 100644 (file)
@@ -96,6 +96,12 @@ LinkShare::LinkShare(AccountPtr account,
 
 }
 
+bool LinkShare::getPublicUpload()
+{
+    return ((_permissions & OcsShareJob::Permission::Update) &&
+            (_permissions & OcsShareJob::Permission::Create));
+}
+
 void LinkShare::setPublicUpload(bool publicUpload)
 {
     OcsShareJob *job = new OcsShareJob(_account, this);
index a275f04af3651b5ed0a99c34cb500a36459a560d..7da2b06eddb32cbb66d02faaa018ab2e134e8d2a 100644 (file)
@@ -112,6 +112,11 @@ public:
      */
     const QUrl getLink();
 
+    /*
+     * Get the publicUpload status of this share
+     */
+    bool getPublicUpload();
+
     /*
      * Set a share to be public upload
      * This function can only be called on link shares
index 086f300cdc593c025550a06b3c4387ad59cf552e..54abbeecc7318523ae278937e7120c85d7784013 100644 (file)
@@ -307,10 +307,8 @@ void ShareDialog::slotSharesFetched(const QList<QSharedPointer<Share>> &shares)
              * Only directories can have public upload set
              * For public links the server sets CREATE and UPDATE permissions.
              */
-            if (!_isFile && 
-                (_share->getPermissions() & static_cast<int>(OcsShareJob::Permission::Update)) &&
-                (_share->getPermissions() & static_cast<int>(OcsShareJob::Permission::Create))) {
-                    _ui->checkBox_editing->setChecked(true);
+            if (!_isFile && _share->getPublicUpload()) {
+                _ui->checkBox_editing->setChecked(true);
             }
 
             setShareLink(_share->getLink().toString());