Skip to content

Commit

Permalink
Add additional roles to FileProviderMaterialisedItemsModel
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Oct 11, 2023
1 parent b196928 commit ad14f2f
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
55 changes: 55 additions & 0 deletions src/gui/macOS/fileprovidermaterialiseditemsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,62 @@ QVariant FileProviderMaterialisedItemsModel::data(const QModelIndex &index, int

switch (role) {
case Qt::DisplayRole:
case FilenameRole:
return item.filename();
case IdentifierRole:
return item.identifier();
case ParentItemIdentifierRole:
return item.parentItemIdentifier();
case TypeIdentifierRole:
return item.typeIdentifier();
case SymlinkTargetPathRole:
return item.symlinkTargetPath();
case UploadingErrorRole:
return item.uploadingError();
case DownloadingErrorRole:
return item.downloadingError();
case MostRecentEditorNameRole:
return item.mostRecentEditorName();
case OwnerNameRole:
return item.ownerName();
case ContentModificationDateRole:
return item.contentModificationDate();
case CreationDateRole:
return item.creationDate();
case LastUsedDateRole:
return item.lastUsedDate();
case ContentVersionRole:
return item.contentVersion();
case MetadataVersionRole:
return item.metadataVersion();
case TagDataRole:
return item.tagData();
case CapabilitiesRole:
return item.capabilities();
case FileSystemFlagsRole:
return item.fileSystemFlags();
case ChildItemCountRole:
return item.childItemCount();
case TypeOsCodeRole:
return item.typeOsCode();
case CreatorOsCodeRole:
return item.creatorOsCode();
case DocumentSizeRole:
return item.documentSize();
case MostRecentVersionDownloadedRole:
return item.mostRecentVersionDownloaded();
case UploadingRole:
return item.uploading();
case UploadedRole:
return item.uploaded();
case DownloadingRole:
return item.downloading();
case DownloadedRole:
return item.downloaded();
case SharedRole:
return item.shared();
case SharedByCurrentUserRole:
return item.sharedByCurrentUser();
}
return {};
}
Expand Down
32 changes: 32 additions & 0 deletions src/gui/macOS/fileprovidermaterialiseditemsmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,38 @@ class FileProviderMaterialisedItemsModel : public QAbstractListModel
Q_PROPERTY(QVector<FileProviderItemMetadata> items READ items WRITE setItems NOTIFY itemsChanged)

public:
enum Roles {
IdentifierRole = Qt::UserRole + 1,
ParentItemIdentifierRole,
FilenameRole,
TypeIdentifierRole,
SymlinkTargetPathRole,
UploadingErrorRole,
DownloadingErrorRole,
MostRecentEditorNameRole,
OwnerNameRole,
ContentModificationDateRole,
CreationDateRole,
LastUsedDateRole,
ContentVersionRole,
MetadataVersionRole,
TagDataRole,
CapabilitiesRole,
FileSystemFlagsRole,
ChildItemCountRole,
TypeOsCodeRole,
CreatorOsCodeRole,
DocumentSizeRole,
MostRecentVersionDownloadedRole,
UploadingRole,
UploadedRole,
DownloadingRole,
DownloadedRole,
SharedRole,
SharedByCurrentUserRole,
};
Q_ENUM(Roles)

explicit FileProviderMaterialisedItemsModel(QObject *parent = nullptr);
int rowCount(const QModelIndex &parent = {}) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
Expand Down

0 comments on commit ad14f2f

Please sign in to comment.