Add rolenames for FileProviderMaterialisedItemsModel

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-10-17 14:31:40 +08:00
parent 89bb008bd7
commit bfaba671f3
No known key found for this signature in database
GPG key ID: C839200C384636B0
2 changed files with 37 additions and 0 deletions

View file

@ -98,6 +98,42 @@ QVariant FileProviderMaterialisedItemsModel::data(const QModelIndex &index, int
return {}; return {};
} }
QHash<int, QByteArray> FileProviderMaterialisedItemsModel::roleNames() const
{
auto roleNames = QAbstractListModel::roleNames();
roleNames.insert({
{ IdentifierRole, "identifier" },
{ ParentItemIdentifierRole, "parentItemIdentifier" },
{ FilenameRole, "fileName" },
{ TypeIdentifierRole, "typeIdentifier" },
{ SymlinkTargetPathRole, "symlinkTargetPath" },
{ UploadingErrorRole, "uploadingError" },
{ DownloadingErrorRole, "downloadingError" },
{ MostRecentEditorNameRole, "mostRecentEditorName" },
{ OwnerNameRole, "ownerName" },
{ ContentModificationDateRole, "contentModificationDate" },
{ CreationDateRole, "creationDate" },
{ LastUsedDateRole, "lastUsedDate" },
{ ContentVersionRole, "contentVersion" },
{ MetadataVersionRole, "metadataVersion" },
{ TagDataRole, "tagData" },
{ CapabilitiesRole, "capabilities" },
{ FileSystemFlagsRole, "fileSystemFlags" },
{ ChildItemCountRole, "childItemCount" },
{ TypeOsCodeRole, "typeOsCode" },
{ CreatorOsCodeRole, "creatorOsCode" },
{ DocumentSizeRole, "documentSize" },
{ MostRecentVersionDownloadedRole, "mostRecentVersionDownloaded" },
{ UploadingRole, "uploading" },
{ UploadedRole, "uploaded" },
{ DownloadingRole, "downloading" },
{ DownloadedRole, "downloaded" },
{ SharedRole, "shared" },
{ SharedByCurrentUserRole, "sharedByCurrentUser" },
});
return roleNames;
}
QVector<FileProviderItemMetadata> FileProviderMaterialisedItemsModel::items() const QVector<FileProviderItemMetadata> FileProviderMaterialisedItemsModel::items() const
{ {
return _items; return _items;

View file

@ -64,6 +64,7 @@ public:
explicit FileProviderMaterialisedItemsModel(QObject *parent = nullptr); explicit FileProviderMaterialisedItemsModel(QObject *parent = nullptr);
int rowCount(const QModelIndex &parent = {}) const override; int rowCount(const QModelIndex &parent = {}) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QHash<int, QByteArray> roleNames() const override;
QVector<FileProviderItemMetadata> items() const; QVector<FileProviderItemMetadata> items() const;