Skip to content

Commit

Permalink
Bring back lost changes after merge.
Browse files Browse the repository at this point in the history
Signed-off-by: alex-z <blackslayer4@gmail.com>
  • Loading branch information
allexzander committed Aug 23, 2023
1 parent 35e9c46 commit 79d26d3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/gui/filedetails/sharemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "account.h"
#include "folderman.h"
#include "sharepermissions.h"
#include "theme.h"
#include "updatee2eefolderusersmetadatajob.h"
#include "wordlist.h"
Expand Down Expand Up @@ -80,6 +81,7 @@ QHash<int, QByteArray> ShareModel::roleNames() const
roles[IsSharePermissionsChangeInProgress] = "isSharePermissionChangeInProgress";
roles[HideDownloadEnabledRole] = "hideDownload";
roles[IsHideDownloadEnabledChangeInProgress] = "isHideDownloadInProgress";
roles[ResharingAllowedRole] = "resharingAllowed";

return roles;
}
Expand Down Expand Up @@ -181,6 +183,9 @@ QVariant ShareModel::data(const QModelIndex &index, const int role) const
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:
case ExpireDateEnabledRole:
Expand Down Expand Up @@ -1248,6 +1253,7 @@ void ShareModel::setAccountState(AccountState *accountState)
Q_EMIT sharingEnabledChanged();
Q_EMIT publicLinkSharesEnabledChanged();
Q_EMIT userGroupSharingEnabledChanged();
Q_EMIT serverAllowsResharingChanged();
updateData();
}

Expand Down Expand Up @@ -1307,6 +1313,12 @@ bool ShareModel::canShare() const
return _maxSharingPermissions & SharePermissionShare;
}

bool ShareModel::serverAllowsResharing() const
{
return _accountState && _accountState->account() && _accountState->account()->capabilities().isValid()
&& _accountState->account()->capabilities().shareResharing();
}

bool ShareModel::isShareDisabledFolder() const
{
return _isShareDisabledFolder;
Expand Down
4 changes: 4 additions & 0 deletions src/gui/filedetails/sharemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class ShareModel : public QAbstractListModel
Q_PROPERTY(bool isShareDisabledFolder READ isShareDisabledFolder NOTIFY isShareDisabledFolderChanged)
Q_PROPERTY(bool fetchOngoing READ fetchOngoing NOTIFY fetchOngoingChanged)
Q_PROPERTY(bool hasInitialShareFetchCompleted READ hasInitialShareFetchCompleted NOTIFY hasInitialShareFetchCompletedChanged)
Q_PROPERTY(bool serverAllowsResharing READ serverAllowsResharing NOTIFY serverAllowsResharingChanged)
Q_PROPERTY(QVariantList sharees READ sharees NOTIFY shareesChanged)

public:
Expand Down Expand Up @@ -63,6 +64,7 @@ class ShareModel : public QAbstractListModel
IsSharePermissionsChangeInProgress,
HideDownloadEnabledRole,
IsHideDownloadEnabledChangeInProgress,
ResharingAllowedRole,
};
Q_ENUM(Roles)

Expand Down Expand Up @@ -116,6 +118,7 @@ class ShareModel : public QAbstractListModel
[[nodiscard]] bool publicLinkSharesEnabled() const;
[[nodiscard]] bool userGroupSharingEnabled() const;
[[nodiscard]] bool canShare() const;
[[nodiscard]] bool serverAllowsResharing() const;
[[nodiscard]] bool isShareDisabledFolder() const;

[[nodiscard]] bool fetchOngoing() const;
Expand All @@ -139,6 +142,7 @@ class ShareModel : public QAbstractListModel
void hasInitialShareFetchCompletedChanged();
void shareesChanged();
void internalLinkReady();
void serverAllowsResharingChanged();

void serverError(const int code, const QString &message) const;
void passwordSetError(const QString &shareId, const int code, const QString &message);
Expand Down

0 comments on commit 79d26d3

Please sign in to comment.