diff --git a/src/content.h b/src/content.h --- a/src/content.h +++ b/src/content.h @@ -233,6 +233,16 @@ void setVideos(QList videos); /** + * Get all the tags for this content + */ + QStringList tags() const; + /** + * Set the list of tags + * @param tags list of tags for this content + */ + 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. * @param key the key of the attribute 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,7 @@ QString packageName() const; Q_DECL_DEPRECATED QString repository(); QString repository() const; + QStringList tags() const; void setId(int id); void setType(Attica::DownloadDescription::Type type); @@ -99,6 +100,7 @@ void setGpgSignature(const QString &signature); void setPackageName(const QString &packageName); void setRepository(const QString &repository); + 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 @@ -43,6 +43,7 @@ QString gpgSignature; QString packageName; QString repository; + QStringList tags; uint size; Private() : id(0), type(Attica::DownloadDescription::FileDownload), hasPrice(false), size(0) @@ -296,3 +297,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 @@ -140,7 +140,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;