From: Claudio Cambra Date: Thu, 20 Apr 2023 13:17:24 +0000 (+0800) Subject: Add support for system tags in filetagmodel X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~10^2~49^2~9 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b79a038d9218a84f2a100552d05b33f09c872507;p=nextcloud-desktop.git Add support for system tags in filetagmodel Signed-off-by: Claudio Cambra --- diff --git a/src/gui/filetagmodel.cpp b/src/gui/filetagmodel.cpp index 4f00e41f2..a9bd35bbd 100644 --- a/src/gui/filetagmodel.cpp +++ b/src/gui/filetagmodel.cpp @@ -65,7 +65,8 @@ void FileTagModel::fetchFileTags() qCDebug(lcFileTagModel) << "Starting fetch of filetags for file at:" << _serverRelativePath; const auto propfindJob = new PropfindJob(_account, _serverRelativePath, this); - propfindJob->setProperties({ QByteArrayLiteral("http://nextcloud.org/ns:tags") }); + propfindJob->setProperties({ QByteArrayLiteral("http://nextcloud.org/ns:tags"), + QByteArrayLiteral("http://nextcloud.org/ns:system-tags") }); connect(propfindJob, &PropfindJob::result, this, &FileTagModel::processFileTagRequestFinished); connect(propfindJob, &PropfindJob::finishedWithError, this, &FileTagModel::processFileTagRequestFinishedWithError); @@ -85,7 +86,20 @@ void FileTagModel::processFileTagRequestFinished(const QVariantMap &result) << _serverRelativePath; beginResetModel(); - _tags = result.value(QStringLiteral("tags")).toStringList(); + _tags.clear(); + + const auto normalTags = result.value(QStringLiteral("tags")).toStringList(); + const auto systemTags = result.value(QStringLiteral("system-tags")).toList(); + + auto systemTagStringList = QStringList(); + for (const auto &systemTagMapVariant : systemTags) { + const auto systemTagMap = systemTagMapVariant.toMap(); + const auto systemTag = systemTagMap.value(QStringLiteral("tag")).toString(); + systemTagStringList << systemTag; + } + + _tags << normalTags << systemTagStringList; + Q_EMIT totalTagsChanged(); endResetModel(); }