Share UI: Hide 'allow editing' for files #4211
authorChristian Kamm <mail@ckamm.de>
Tue, 8 Dec 2015 14:37:17 +0000 (15:37 +0100)
committerChristian Kamm <mail@ckamm.de>
Tue, 8 Dec 2015 14:37:17 +0000 (15:37 +0100)
src/gui/sharelinkwidget.cpp
src/gui/sharelinkwidget.ui
src/libsync/capabilities.cpp

index 5d335b22367aaf9b6dbffa4c47a71d00e1a21c36..39df466f6a0b5e809a77640b130015bc4414ba5c 100644 (file)
@@ -129,13 +129,9 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account,
     }
 
     // File can't have public upload set.
-    if (_isFile) {
-        _ui->checkBox_editing->setEnabled(false);
-    } else {
-        if (!_account->capabilities().sharePublicLinkAllowUpload()) {
-            _ui->checkBox_editing->setEnabled(false);
-        }
-    }
+    _ui->widget_editing->setVisible(!_isFile);
+    _ui->checkBox_editing->setEnabled(
+            _account->capabilities().sharePublicLinkAllowUpload());
 
     /*
      * Create the share manager and connect it properly
@@ -268,13 +264,10 @@ void ShareLinkWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &shar
              * Only directories can have public upload set
              * For public links the server sets CREATE and UPDATE permissions.
              */
+            _ui->checkBox_editing->setEnabled(
+                    _account->capabilities().sharePublicLinkAllowUpload());
             if (!_isFile) {
-                _ui->checkBox_editing->setEnabled(true);
-                if (_share->getPublicUpload()) {
-                    _ui->checkBox_editing->setChecked(true);
-                } else {
-                    _ui->checkBox_editing->setChecked(false);
-                }
+                _ui->checkBox_editing->setChecked(_share->getPublicUpload());
             }
 
             setShareLink(_share->getLink().toString());
index 71aa051b8519da67c985e142f24f3f8596ed9982..254d50d8c645a8c60ab381f301908ce741b70e10 100644 (file)
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>372</width>
-    <height>212</height>
+    <height>237</height>
    </rect>
   </property>
   <property name="windowTitle">
        </layout>
       </item>
       <item row="3" column="0">
-       <layout class="QHBoxLayout" name="horizontalLayout_editing">
-        <item>
-         <widget class="QCheckBox" name="checkBox_editing">
-          <property name="text">
-           <string>Allow editing</string>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <spacer name="horizontalSpacer">
-          <property name="orientation">
-           <enum>Qt::Horizontal</enum>
-          </property>
-          <property name="sizeHint" stdset="0">
-           <size>
-            <width>40</width>
-            <height>20</height>
-           </size>
-          </property>
-         </spacer>
-        </item>
-       </layout>
+       <widget class="QWidget" name="widget_editing" native="true">
+        <layout class="QHBoxLayout" name="horizontalLayout_editing">
+         <property name="leftMargin">
+          <number>0</number>
+         </property>
+         <property name="topMargin">
+          <number>0</number>
+         </property>
+         <property name="rightMargin">
+          <number>0</number>
+         </property>
+         <property name="bottomMargin">
+          <number>0</number>
+         </property>
+         <item>
+          <widget class="QCheckBox" name="checkBox_editing">
+           <property name="text">
+            <string>Allow editing</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </widget>
       </item>
      </layout>
     </widget>
index f4a02174b26ee31670410c91f50fad4a7d5374c5..a53e00f3e0b0183e4cb88e1fac5486e938388731 100644 (file)
@@ -16,6 +16,7 @@
 #include "configfile.h"
 
 #include <QVariantMap>
+#include <QDebug>
 
 namespace OCC {