diff --git a/src/content.h b/src/content.h --- a/src/content.h +++ b/src/content.h @@ -232,6 +232,18 @@ */ void setVideos(QList videos); + /** + * Get all the tags for this content + * @since 5.50 + */ + QStringList tags() const; + /** + * Set the list of tags + * @param tags list of tags for this content + * @since 5.50 + */ + void setTags(const QStringList &tags); + /** * Add an attribute that is not included in the basis set of attributes exposed by the Content class. * If the attribute already exists it gets overwritten. diff --git a/src/content.cpp b/src/content.cpp --- a/src/content.cpp +++ b/src/content.cpp @@ -39,6 +39,7 @@ QDateTime m_updated; QList m_icons; QList m_videos; + QStringList m_tags; QMap m_extendedAttributes; @@ -234,6 +235,7 @@ desc.setGpgSignature(attribute(QLatin1String("downloadgpgsignature") + num)); desc.setPackageName(attribute(QLatin1String("downloadpackagename") + num)); desc.setRepository(attribute(QLatin1String("downloadrepository") + num)); + desc.setTags(attribute(QLatin1String("downloadtags") + num).split(QLatin1Char(','))); return desc; } @@ -327,3 +329,13 @@ { d->m_videos = videos; } + +QStringList Attica::Content::tags() const +{ + return d->m_tags; +} + +void Attica::Content::setTags(const QStringList &tags) +{ + d->m_tags = tags; +} diff --git a/src/contentparser.cpp b/src/contentparser.cpp --- a/src/contentparser.cpp +++ b/src/contentparser.cpp @@ -78,6 +78,8 @@ videos = content.videos(); videos.append(video); content.setVideos(videos); + } else if (xml.name() == QLatin1String("tags")) { + content.setTags(xml.readElementText().split(QLatin1Char(','))); } else { content.addAttribute(xml.name().toString(), xml.readElementText()); } diff --git a/src/downloaddescription.h b/src/downloaddescription.h --- a/src/downloaddescription.h +++ b/src/downloaddescription.h @@ -83,6 +83,11 @@ QString packageName() const; Q_DECL_DEPRECATED QString repository(); QString repository() const; + /** + * Get the list of tags for this download description + * @since 5.50 + */ + QStringList tags() const; void setId(int id); void setType(Attica::DownloadDescription::Type type); @@ -99,6 +104,11 @@ void setGpgSignature(const QString &signature); void setPackageName(const QString &packageName); void setRepository(const QString &repository); + /** + * Set the list of tags for this download description + * @since 5.50 + */ + void setTags(const QStringList &tags); private: class Private; diff --git a/src/downloaddescription.cpp b/src/downloaddescription.cpp --- a/src/downloaddescription.cpp +++ b/src/downloaddescription.cpp @@ -44,6 +44,7 @@ QString packageName; QString repository; uint size = 0; + QStringList tags; }; } @@ -292,3 +293,13 @@ { d->repository = repository; } + +QStringList Attica::DownloadDescription::tags() const +{ + return d->tags; +} + +void Attica::DownloadDescription::setTags(const QStringList &tags) +{ + d->tags = tags; +} diff --git a/src/parser.cpp b/src/parser.cpp --- a/src/parser.cpp +++ b/src/parser.cpp @@ -149,7 +149,7 @@ } if (xml.hasError()) { // TODO: error handling in metadata? - qWarning() << "parseList():: XML Error: " << xml.errorString() << "\nIn XML:\n" << xmlString; + qWarning() << "parseList():: XML Error: " << xml.errorString() << "\nIn xml name" << xml.name() << "with text" << xml.text() << "at offset:\n" << xml.characterOffset() << "\nIn XML:\n" << xmlString; } return items;