diff --git a/src/gui/filedetails/ShareView.qml b/src/gui/filedetails/ShareView.qml index 11e7b2a25..13a3d3049 100644 --- a/src/gui/filedetails/ShareView.qml +++ b/src/gui/filedetails/ShareView.qml @@ -145,15 +145,15 @@ ColumnLayout { Layout.rightMargin: root.horizontalPadding EnforcedPlainTextLabel { - visible: shareModel.displayFileOwner - text: qsTr("Shared with you by %1").arg(shareModel.fileOwnerDisplayName) + visible: shareModel.displayShareOwner + text: qsTr("Shared with you by %1").arg(shareModel.shareOwnerDisplayName) } EnforcedPlainTextLabel { visible: shareModel.sharedWithMeExpires text: qsTr("Expires in %1").arg(shareModel.sharedWithMeRemainingTimeString) } - visible: shareModel.displayFileOwner + visible: shareModel.displayShareOwner } ShareeSearchField { diff --git a/src/gui/filedetails/sharemodel.cpp b/src/gui/filedetails/sharemodel.cpp index 3a2615963..64c2d7aea 100644 --- a/src/gui/filedetails/sharemodel.cpp +++ b/src/gui/filedetails/sharemodel.cpp @@ -220,8 +220,8 @@ void ShareModel::resetData() _fetchOngoing = false; _hasInitialShareFetchCompleted = false; _sharees.clear(); - _displayFileOwner = false; - _fileOwnerDisplayName.clear(); + _displayShareOwner = false; + _shareOwnerDisplayName.clear(); _sharedWithMeExpires = false; _sharedWithMeRemainingTimeString.clear(); @@ -229,8 +229,8 @@ void ShareModel::resetData() Q_EMIT fetchOngoingChanged(); Q_EMIT hasInitialShareFetchCompletedChanged(); Q_EMIT shareesChanged(); - Q_EMIT displayFileOwnerChanged(); - Q_EMIT fileOwnerDisplayNameChanged(); + Q_EMIT displayShareOwnerChanged(); + Q_EMIT shareOwnerDisplayNameChanged(); Q_EMIT sharedWithMeExpiresChanged(); Q_EMIT sharedWithMeRemainingTimeStringChanged(); @@ -465,12 +465,7 @@ void ShareModel::slotPropfindReceived(const QVariantMap &result) const auto privateLinkUrl = result["privatelink"].toString(); _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()) { qCInfo(lcShareModel) << "Received private link url for" << _sharePath << privateLinkUrl; _privateLinkUrl = privateLinkUrl; @@ -495,6 +490,11 @@ void ShareModel::slotSharesFetched(const QList &shares) if (share.isNull()) { continue; } 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 && share->getShareWith() && share->getShareWith()->shareWith() == selfUserId) @@ -1409,14 +1409,14 @@ bool ShareModel::isShareDisabledEncryptedFolder() const 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 diff --git a/src/gui/filedetails/sharemodel.h b/src/gui/filedetails/sharemodel.h index 3608f0e97..2a419a7f3 100644 --- a/src/gui/filedetails/sharemodel.h +++ b/src/gui/filedetails/sharemodel.h @@ -38,8 +38,8 @@ class ShareModel : public QAbstractListModel Q_PROPERTY(bool hasInitialShareFetchCompleted READ hasInitialShareFetchCompleted NOTIFY hasInitialShareFetchCompletedChanged) Q_PROPERTY(bool serverAllowsResharing READ serverAllowsResharing NOTIFY serverAllowsResharingChanged) Q_PROPERTY(QVariantList sharees READ sharees NOTIFY shareesChanged) - Q_PROPERTY(bool displayFileOwner READ displayFileOwner NOTIFY displayFileOwnerChanged) - Q_PROPERTY(QString fileOwnerDisplayName READ fileOwnerDisplayName NOTIFY fileOwnerDisplayNameChanged) + Q_PROPERTY(bool displayShareOwner READ displayShareOwner NOTIFY displayShareOwnerChanged) + Q_PROPERTY(QString shareOwnerDisplayName READ shareOwnerDisplayName NOTIFY shareOwnerDisplayNameChanged) Q_PROPERTY(bool sharedWithMeExpires READ sharedWithMeExpires NOTIFY sharedWithMeExpiresChanged) Q_PROPERTY(QString sharedWithMeRemainingTimeString READ sharedWithMeRemainingTimeString NOTIFY sharedWithMeRemainingTimeStringChanged) @@ -130,8 +130,8 @@ public: [[nodiscard]] QVariantList sharees() const; - [[nodiscard]] bool displayFileOwner() const; - [[nodiscard]] QString fileOwnerDisplayName() const; + [[nodiscard]] bool displayShareOwner() const; + [[nodiscard]] QString shareOwnerDisplayName() const; [[nodiscard]] bool sharedWithMeExpires() const; [[nodiscard]] QString sharedWithMeRemainingTimeString() const; @@ -152,8 +152,8 @@ signals: void shareesChanged(); void internalLinkReady(); void serverAllowsResharingChanged(); - void displayFileOwnerChanged(); - void fileOwnerDisplayNameChanged(); + void displayShareOwnerChanged(); + void shareOwnerDisplayNameChanged(); void sharedWithMeExpiresChanged(); void sharedWithMeRemainingTimeStringChanged(); @@ -259,8 +259,8 @@ private: SyncJournalFileLockInfo _filelockState; QString _privateLinkUrl; QByteArray _fileRemoteId; - bool _displayFileOwner = false; - QString _fileOwnerDisplayName; + bool _displayShareOwner = false; + QString _shareOwnerDisplayName; bool _sharedWithMeExpires = false; QString _sharedWithMeRemainingTimeString;