Skip to content

Commit

Permalink
Add a user-understandable file type string to itemmetadata
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Oct 31, 2023
1 parent 198df8f commit 08c8864
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/gui/macOS/fileprovideritemmetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ QString FileProviderItemMetadata::userVisiblePath() const
return _userVisiblePath;
}

QString FileProviderItemMetadata::fileTypeString() const
{
return _fileTypeString;
}

bool operator==(const FileProviderItemMetadata &lhs, const FileProviderItemMetadata &rhs)
{
return lhs.identifier() == rhs.identifier() &&
Expand Down
2 changes: 2 additions & 0 deletions src/gui/macOS/fileprovideritemmetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class FileProviderItemMetadata
bool sharedByCurrentUser() const;

QString userVisiblePath() const;
QString fileTypeString() const;

// Check equality via identifier, contentVersion, and metadataVersion
friend bool operator==(const FileProviderItemMetadata &lhs, const FileProviderItemMetadata &rhs);
Expand Down Expand Up @@ -134,6 +135,7 @@ class FileProviderItemMetadata
bool _trashed = false;

QString _userVisiblePath;
QString _fileTypeString;
};

}
Expand Down
1 change: 1 addition & 0 deletions src/gui/macOS/fileprovideritemmetadata_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ QString nsNameComponentsToLocalisedQString(NSPersonNameComponents *const nameCom
metadata._sharedByCurrentUser = bridgedNsFileProviderItem.sharedByCurrentUser;

metadata._userVisiblePath = metadata.getUserVisiblePath();
metadata._fileTypeString = QString::fromNSString(bridgedNsFileProviderItem.contentType.localizedDescription);

return metadata;
}
Expand Down

0 comments on commit 08c8864

Please sign in to comment.