ShareDialog: Only link share if capabilities allow #4179
authorChristian Kamm <mail@ckamm.de>
Tue, 24 Nov 2015 10:58:10 +0000 (11:58 +0100)
committerChristian Kamm <mail@ckamm.de>
Tue, 24 Nov 2015 10:58:10 +0000 (11:58 +0100)
src/gui/sharelinkwidget.cpp
src/libsync/capabilities.cpp

index b1d971f3fdf34c6cffbce11257ade08bb4932f4e..97a6b5ec92a0a7d6a882237f01507d5aea32ca67 100644 (file)
@@ -221,8 +221,8 @@ void ShareLinkWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &shar
     const QString versionString = _account->serverVersion();
     qDebug() << Q_FUNC_INFO << versionString << "Fetched" << shares.count() << "shares";
 
-    //Show link checkbox now
-    _ui->checkBox_shareLink->setEnabled(true);
+    //Show link checkbox now if capabilities allow it
+    _ui->checkBox_shareLink->setEnabled(_account->capabilities().sharePublicLink());
     _pi_link->stopAnimation();
 
     Q_FOREACH(auto share, shares) {
@@ -292,7 +292,7 @@ void ShareLinkWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &shar
         if( !_resharingAllowed ) {
             displayError(tr("The file can not be shared because it was shared without sharing permission."));
             _ui->checkBox_shareLink->setEnabled(false);
-        } else if (_autoShare) {
+        } else if (_autoShare && _ui->checkBox_shareLink->isEnabled()) {
             _ui->checkBox_shareLink->setChecked(true);
             slotCheckBoxShareLinkClicked();
         }
index 202be49379d1ae3a42693191d0647599de5f5a63..f6e4edd6b3b7f0d500ec98c002a4c1c786203600 100644 (file)
@@ -37,7 +37,7 @@ bool Capabilities::shareAPI() const
 
 bool Capabilities::sharePublicLink() const
 {
-    return _capabilities["files_sharing"].toMap()["public"].toMap()["enabled"].toBool();
+    return shareAPI() && _capabilities["files_sharing"].toMap()["public"].toMap()["enabled"].toBool();
 }
 
 bool Capabilities::sharePublicLinkAllowUpload() const