Add resharing allowed property to ShareModel

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-08-10 16:54:35 +08:00
parent 4b3d6c5316
commit 172c7ab711
2 changed files with 10 additions and 0 deletions

View 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;

View 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);