Add role for resharing allowed in share model

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-08-10 16:03:14 +08:00
parent c05e1920bb
commit acb22b1684
2 changed files with 5 additions and 0 deletions

View file

@ -23,6 +23,7 @@
#include "account.h"
#include "folderman.h"
#include "sharepermissions.h"
#include "theme.h"
namespace {
@ -141,6 +142,7 @@ QHash<int, QByteArray> ShareModel::roleNames() const
roles[IsSharePermissionsChangeInProgress] = "isSharePermissionChangeInProgress";
roles[HideDownloadEnabledRole] = "hideDownload";
roles[IsHideDownloadEnabledChangeInProgress] = "isHideDownloadInProgress";
roles[ResharingAllowedRole] = "resharingAllowed";
return roles;
}
@ -241,6 +243,8 @@ QVariant ShareModel::data(const QModelIndex &index, const int role) const
|| (share->getShareType() == Share::TypeLink && _accountState->account()->capabilities().sharePublicLinkEnforcePassword()));
case EditingAllowedRole:
return share->getPermissions().testFlag(SharePermissionUpdate);
case ResharingAllowedRole:
return share->getPermissions().testFlag(SharePermissionShare);
// Deal with roles that only return certain values for link or user/group share types
case NoteEnabledRole:

View file

@ -62,6 +62,7 @@ public:
IsSharePermissionsChangeInProgress,
HideDownloadEnabledRole,
IsHideDownloadEnabledChangeInProgress,
ResharingAllowedRole,
};
Q_ENUM(Roles)