]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
Add resharing allowed property to ShareModel
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Thu, 10 Aug 2023 08:54:35 +0000 (16:54 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Fri, 11 Aug 2023 14:59:59 +0000 (22:59 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/filedetails/sharemodel.cpp
src/gui/filedetails/sharemodel.h

index 22e3cd7641ce3f5e75cd729b12a5c99eee9a74ee..3205b704191d8ca5b499549a718ec3cad7918245 100644 (file)
@@ -1251,6 +1251,7 @@ void ShareModel::setAccountState(AccountState *accountState)
     Q_EMIT sharingEnabledChanged();
     Q_EMIT publicLinkSharesEnabledChanged();
     Q_EMIT userGroupSharingEnabledChanged();
+    Q_EMIT resharingAllowedChanged();
     updateData();
 }
 
@@ -1310,6 +1311,12 @@ bool ShareModel::canShare() const
     return _maxSharingPermissions & SharePermissionShare;
 }
 
+bool ShareModel::resharingAllowed() const
+{
+    return _accountState && _accountState->account() && _accountState->account()->capabilities().isValid()
+        && _accountState->account()->capabilities().shareResharing();
+}
+
 QVariantList ShareModel::sharees() const
 {
     QVariantList returnSharees;
index 8655d8ebdc21fc6a9a930b8b12b5d18f93f70882..b38499d278b4b5c11c1ebf29fde74d3c6bd56b7d 100644 (file)
@@ -35,6 +35,7 @@ class ShareModel : public QAbstractListModel
     Q_PROPERTY(bool canShare READ canShare NOTIFY sharePermissionsChanged)
     Q_PROPERTY(bool fetchOngoing READ fetchOngoing NOTIFY fetchOngoingChanged)
     Q_PROPERTY(bool hasInitialShareFetchCompleted READ hasInitialShareFetchCompleted NOTIFY hasInitialShareFetchCompletedChanged)
+    Q_PROPERTY(bool resharingAllowed READ resharingAllowed NOTIFY resharingAllowedChanged)
     Q_PROPERTY(QVariantList sharees READ sharees NOTIFY shareesChanged)
 
 public:
@@ -116,6 +117,7 @@ public:
     [[nodiscard]] bool publicLinkSharesEnabled() const;
     [[nodiscard]] bool userGroupSharingEnabled() const;
     [[nodiscard]] bool canShare() const;
+    [[nodiscard]] bool resharingAllowed() const;
 
     [[nodiscard]] bool fetchOngoing() const;
     [[nodiscard]] bool hasInitialShareFetchCompleted() const;
@@ -135,6 +137,7 @@ signals:
     void hasInitialShareFetchCompletedChanged();
     void shareesChanged();
     void internalLinkReady();
+    void resharingAllowedChanged();
 
     void serverError(const int code, const QString &message);
     void passwordSetError(const QString &shareId, const int code, const QString &message);