From f249ca59ad8881700e1dd093de0dfda96a45f07c Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Tue, 31 Oct 2023 15:51:53 +0800 Subject: [PATCH] Get and set userVisiblePath at item metadata construction time Signed-off-by: Claudio Cambra --- src/gui/macOS/fileprovideritemmetadata.cpp | 5 +++++ src/gui/macOS/fileprovideritemmetadata.h | 4 ++++ src/gui/macOS/fileprovideritemmetadata_mac.mm | 4 +++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/gui/macOS/fileprovideritemmetadata.cpp b/src/gui/macOS/fileprovideritemmetadata.cpp index 9a9d38047385c..0d7421abc3e9d 100644 --- a/src/gui/macOS/fileprovideritemmetadata.cpp +++ b/src/gui/macOS/fileprovideritemmetadata.cpp @@ -168,6 +168,11 @@ bool FileProviderItemMetadata::sharedByCurrentUser() const return _sharedByCurrentUser; } +QString FileProviderItemMetadata::userVisiblePath() const +{ + return _userVisiblePath; +} + bool operator==(const FileProviderItemMetadata &lhs, const FileProviderItemMetadata &rhs) { return lhs.identifier() == rhs.identifier() && diff --git a/src/gui/macOS/fileprovideritemmetadata.h b/src/gui/macOS/fileprovideritemmetadata.h index cde6508de5b63..59b45733ad070 100644 --- a/src/gui/macOS/fileprovideritemmetadata.h +++ b/src/gui/macOS/fileprovideritemmetadata.h @@ -98,6 +98,8 @@ class FileProviderItemMetadata friend bool operator==(const FileProviderItemMetadata &lhs, const FileProviderItemMetadata &rhs); private: + QString getUserVisiblePath() const; + QString _identifier; QString _parentItemIdentifier; QString _domainIdentifier; @@ -130,6 +132,8 @@ class FileProviderItemMetadata bool _shared = false; bool _sharedByCurrentUser = false; bool _trashed = false; + + QString _userVisiblePath; }; } diff --git a/src/gui/macOS/fileprovideritemmetadata_mac.mm b/src/gui/macOS/fileprovideritemmetadata_mac.mm index daefc57219536..822872b281cf1 100644 --- a/src/gui/macOS/fileprovideritemmetadata_mac.mm +++ b/src/gui/macOS/fileprovideritemmetadata_mac.mm @@ -89,10 +89,12 @@ QString nsNameComponentsToLocalisedQString(NSPersonNameComponents *const nameCom metadata._shared = bridgedNsFileProviderItem.shared; metadata._sharedByCurrentUser = bridgedNsFileProviderItem.sharedByCurrentUser; + metadata._userVisiblePath = metadata.getUserVisiblePath(); + return metadata; } -QString FileProviderItemMetadata::userVisiblePath() const +QString FileProviderItemMetadata::getUserVisiblePath() const { qCDebug(lcMacImplFileProviderItemMetadata) << "Getting user visible path";