From 172c7ab711318c4b548fe70196d82a63da1ae3bd Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Thu, 10 Aug 2023 16:54:35 +0800 Subject: [PATCH] Add resharing allowed property to ShareModel Signed-off-by: Claudio Cambra --- src/gui/filedetails/sharemodel.cpp | 7 +++++++ src/gui/filedetails/sharemodel.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/src/gui/filedetails/sharemodel.cpp b/src/gui/filedetails/sharemodel.cpp index 22e3cd764..3205b7041 100644 --- a/src/gui/filedetails/sharemodel.cpp +++ b/src/gui/filedetails/sharemodel.cpp @@ -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; diff --git a/src/gui/filedetails/sharemodel.h b/src/gui/filedetails/sharemodel.h index 8655d8ebd..b38499d27 100644 --- a/src/gui/filedetails/sharemodel.h +++ b/src/gui/filedetails/sharemodel.h @@ -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); -- 2.30.2