mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-28 19:58:56 +03:00
Display share owner rather than file owner (this is more relevant to user)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
6620bf2dd2
commit
b325686ddc
3 changed files with 25 additions and 25 deletions
|
@ -145,15 +145,15 @@ ColumnLayout {
|
||||||
Layout.rightMargin: root.horizontalPadding
|
Layout.rightMargin: root.horizontalPadding
|
||||||
|
|
||||||
EnforcedPlainTextLabel {
|
EnforcedPlainTextLabel {
|
||||||
visible: shareModel.displayFileOwner
|
visible: shareModel.displayShareOwner
|
||||||
text: qsTr("Shared with you by %1").arg(shareModel.fileOwnerDisplayName)
|
text: qsTr("Shared with you by %1").arg(shareModel.shareOwnerDisplayName)
|
||||||
}
|
}
|
||||||
EnforcedPlainTextLabel {
|
EnforcedPlainTextLabel {
|
||||||
visible: shareModel.sharedWithMeExpires
|
visible: shareModel.sharedWithMeExpires
|
||||||
text: qsTr("Expires in %1").arg(shareModel.sharedWithMeRemainingTimeString)
|
text: qsTr("Expires in %1").arg(shareModel.sharedWithMeRemainingTimeString)
|
||||||
}
|
}
|
||||||
|
|
||||||
visible: shareModel.displayFileOwner
|
visible: shareModel.displayShareOwner
|
||||||
}
|
}
|
||||||
|
|
||||||
ShareeSearchField {
|
ShareeSearchField {
|
||||||
|
|
|
@ -220,8 +220,8 @@ void ShareModel::resetData()
|
||||||
_fetchOngoing = false;
|
_fetchOngoing = false;
|
||||||
_hasInitialShareFetchCompleted = false;
|
_hasInitialShareFetchCompleted = false;
|
||||||
_sharees.clear();
|
_sharees.clear();
|
||||||
_displayFileOwner = false;
|
_displayShareOwner = false;
|
||||||
_fileOwnerDisplayName.clear();
|
_shareOwnerDisplayName.clear();
|
||||||
_sharedWithMeExpires = false;
|
_sharedWithMeExpires = false;
|
||||||
_sharedWithMeRemainingTimeString.clear();
|
_sharedWithMeRemainingTimeString.clear();
|
||||||
|
|
||||||
|
@ -229,8 +229,8 @@ void ShareModel::resetData()
|
||||||
Q_EMIT fetchOngoingChanged();
|
Q_EMIT fetchOngoingChanged();
|
||||||
Q_EMIT hasInitialShareFetchCompletedChanged();
|
Q_EMIT hasInitialShareFetchCompletedChanged();
|
||||||
Q_EMIT shareesChanged();
|
Q_EMIT shareesChanged();
|
||||||
Q_EMIT displayFileOwnerChanged();
|
Q_EMIT displayShareOwnerChanged();
|
||||||
Q_EMIT fileOwnerDisplayNameChanged();
|
Q_EMIT shareOwnerDisplayNameChanged();
|
||||||
Q_EMIT sharedWithMeExpiresChanged();
|
Q_EMIT sharedWithMeExpiresChanged();
|
||||||
Q_EMIT sharedWithMeRemainingTimeStringChanged();
|
Q_EMIT sharedWithMeRemainingTimeStringChanged();
|
||||||
|
|
||||||
|
@ -466,11 +466,6 @@ void ShareModel::slotPropfindReceived(const QVariantMap &result)
|
||||||
const auto privateLinkUrl = result["privatelink"].toString();
|
const auto privateLinkUrl = result["privatelink"].toString();
|
||||||
_fileRemoteId = result["fileid"].toByteArray();
|
_fileRemoteId = result["fileid"].toByteArray();
|
||||||
|
|
||||||
_displayFileOwner = result["owner-id"].toString() != _accountState->account()->davUser();
|
|
||||||
Q_EMIT displayFileOwnerChanged();
|
|
||||||
_fileOwnerDisplayName = result["owner-display-name"].toString();
|
|
||||||
Q_EMIT fileOwnerDisplayNameChanged();
|
|
||||||
|
|
||||||
if (!privateLinkUrl.isEmpty()) {
|
if (!privateLinkUrl.isEmpty()) {
|
||||||
qCInfo(lcShareModel) << "Received private link url for" << _sharePath << privateLinkUrl;
|
qCInfo(lcShareModel) << "Received private link url for" << _sharePath << privateLinkUrl;
|
||||||
_privateLinkUrl = privateLinkUrl;
|
_privateLinkUrl = privateLinkUrl;
|
||||||
|
@ -495,6 +490,11 @@ void ShareModel::slotSharesFetched(const QList<SharePtr> &shares)
|
||||||
if (share.isNull()) {
|
if (share.isNull()) {
|
||||||
continue;
|
continue;
|
||||||
} else if (const auto selfUserId = _accountState->account()->davUser(); share->getUidOwner() != selfUserId) {
|
} else if (const auto selfUserId = _accountState->account()->davUser(); share->getUidOwner() != selfUserId) {
|
||||||
|
_displayShareOwner = true;
|
||||||
|
Q_EMIT displayShareOwnerChanged();
|
||||||
|
_shareOwnerDisplayName = share->getOwnerDisplayName();
|
||||||
|
Q_EMIT shareOwnerDisplayNameChanged();
|
||||||
|
|
||||||
if (share->getShareType() == Share::TypeUser &&
|
if (share->getShareType() == Share::TypeUser &&
|
||||||
share->getShareWith() &&
|
share->getShareWith() &&
|
||||||
share->getShareWith()->shareWith() == selfUserId)
|
share->getShareWith()->shareWith() == selfUserId)
|
||||||
|
@ -1409,14 +1409,14 @@ bool ShareModel::isShareDisabledEncryptedFolder() const
|
||||||
return _isShareDisabledEncryptedFolder;
|
return _isShareDisabledEncryptedFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ShareModel::displayFileOwner() const
|
bool ShareModel::displayShareOwner() const
|
||||||
{
|
{
|
||||||
return _displayFileOwner;
|
return _displayShareOwner;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ShareModel::fileOwnerDisplayName() const
|
QString ShareModel::shareOwnerDisplayName() const
|
||||||
{
|
{
|
||||||
return _fileOwnerDisplayName;
|
return _shareOwnerDisplayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ShareModel::sharedWithMeRemainingTimeString() const
|
QString ShareModel::sharedWithMeRemainingTimeString() const
|
||||||
|
|
|
@ -38,8 +38,8 @@ class ShareModel : public QAbstractListModel
|
||||||
Q_PROPERTY(bool hasInitialShareFetchCompleted READ hasInitialShareFetchCompleted NOTIFY hasInitialShareFetchCompletedChanged)
|
Q_PROPERTY(bool hasInitialShareFetchCompleted READ hasInitialShareFetchCompleted NOTIFY hasInitialShareFetchCompletedChanged)
|
||||||
Q_PROPERTY(bool serverAllowsResharing READ serverAllowsResharing NOTIFY serverAllowsResharingChanged)
|
Q_PROPERTY(bool serverAllowsResharing READ serverAllowsResharing NOTIFY serverAllowsResharingChanged)
|
||||||
Q_PROPERTY(QVariantList sharees READ sharees NOTIFY shareesChanged)
|
Q_PROPERTY(QVariantList sharees READ sharees NOTIFY shareesChanged)
|
||||||
Q_PROPERTY(bool displayFileOwner READ displayFileOwner NOTIFY displayFileOwnerChanged)
|
Q_PROPERTY(bool displayShareOwner READ displayShareOwner NOTIFY displayShareOwnerChanged)
|
||||||
Q_PROPERTY(QString fileOwnerDisplayName READ fileOwnerDisplayName NOTIFY fileOwnerDisplayNameChanged)
|
Q_PROPERTY(QString shareOwnerDisplayName READ shareOwnerDisplayName NOTIFY shareOwnerDisplayNameChanged)
|
||||||
Q_PROPERTY(bool sharedWithMeExpires READ sharedWithMeExpires NOTIFY sharedWithMeExpiresChanged)
|
Q_PROPERTY(bool sharedWithMeExpires READ sharedWithMeExpires NOTIFY sharedWithMeExpiresChanged)
|
||||||
Q_PROPERTY(QString sharedWithMeRemainingTimeString READ sharedWithMeRemainingTimeString NOTIFY sharedWithMeRemainingTimeStringChanged)
|
Q_PROPERTY(QString sharedWithMeRemainingTimeString READ sharedWithMeRemainingTimeString NOTIFY sharedWithMeRemainingTimeStringChanged)
|
||||||
|
|
||||||
|
@ -130,8 +130,8 @@ public:
|
||||||
|
|
||||||
[[nodiscard]] QVariantList sharees() const;
|
[[nodiscard]] QVariantList sharees() const;
|
||||||
|
|
||||||
[[nodiscard]] bool displayFileOwner() const;
|
[[nodiscard]] bool displayShareOwner() const;
|
||||||
[[nodiscard]] QString fileOwnerDisplayName() const;
|
[[nodiscard]] QString shareOwnerDisplayName() const;
|
||||||
[[nodiscard]] bool sharedWithMeExpires() const;
|
[[nodiscard]] bool sharedWithMeExpires() const;
|
||||||
[[nodiscard]] QString sharedWithMeRemainingTimeString() const;
|
[[nodiscard]] QString sharedWithMeRemainingTimeString() const;
|
||||||
|
|
||||||
|
@ -152,8 +152,8 @@ signals:
|
||||||
void shareesChanged();
|
void shareesChanged();
|
||||||
void internalLinkReady();
|
void internalLinkReady();
|
||||||
void serverAllowsResharingChanged();
|
void serverAllowsResharingChanged();
|
||||||
void displayFileOwnerChanged();
|
void displayShareOwnerChanged();
|
||||||
void fileOwnerDisplayNameChanged();
|
void shareOwnerDisplayNameChanged();
|
||||||
void sharedWithMeExpiresChanged();
|
void sharedWithMeExpiresChanged();
|
||||||
void sharedWithMeRemainingTimeStringChanged();
|
void sharedWithMeRemainingTimeStringChanged();
|
||||||
|
|
||||||
|
@ -259,8 +259,8 @@ private:
|
||||||
SyncJournalFileLockInfo _filelockState;
|
SyncJournalFileLockInfo _filelockState;
|
||||||
QString _privateLinkUrl;
|
QString _privateLinkUrl;
|
||||||
QByteArray _fileRemoteId;
|
QByteArray _fileRemoteId;
|
||||||
bool _displayFileOwner = false;
|
bool _displayShareOwner = false;
|
||||||
QString _fileOwnerDisplayName;
|
QString _shareOwnerDisplayName;
|
||||||
bool _sharedWithMeExpires = false;
|
bool _sharedWithMeExpires = false;
|
||||||
QString _sharedWithMeRemainingTimeString;
|
QString _sharedWithMeRemainingTimeString;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue