From bb9766016ac8db47d66b5819a9750f71aadf5b07 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Tue, 10 Oct 2023 13:43:06 +0800 Subject: [PATCH] Add custom equality check to FileProviderItemMetadata Signed-off-by: Claudio Cambra --- src/gui/macOS/fileprovideritemmetadata.cpp | 9 ++++++++- src/gui/macOS/fileprovideritemmetadata.h | 5 ++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gui/macOS/fileprovideritemmetadata.cpp b/src/gui/macOS/fileprovideritemmetadata.cpp index cec1dfa79e8fd..0ef97d0c02f7d 100644 --- a/src/gui/macOS/fileprovideritemmetadata.cpp +++ b/src/gui/macOS/fileprovideritemmetadata.cpp @@ -163,6 +163,13 @@ bool FileProviderItemMetadata::sharedByCurrentUser() const return _sharedByCurrentUser; } +bool operator==(const FileProviderItemMetadata &lhs, const FileProviderItemMetadata &rhs) +{ + return lhs.identifier() == rhs.identifier() && + lhs.contentVersion() == rhs.contentVersion() && + lhs.metadataVersion() == rhs.metadataVersion(); } -} +} // namespace Mac + +} // namespace OCC diff --git a/src/gui/macOS/fileprovideritemmetadata.h b/src/gui/macOS/fileprovideritemmetadata.h index 6ec4c0aca7f74..9986e737f45db 100644 --- a/src/gui/macOS/fileprovideritemmetadata.h +++ b/src/gui/macOS/fileprovideritemmetadata.h @@ -86,7 +86,10 @@ class FileProviderItemMetadata bool downloading() const; bool downloaded() const; bool shared() const; - bool sharedByCurrentUser() const; + bool sharedByCurrentUser() const; + + // Check equality via identifier, contentVersion, and metadataVersion + friend bool operator==(const FileProviderItemMetadata &lhs, const FileProviderItemMetadata &rhs); private: QString _identifier;