Commit 93b3a266 authored by Scott Petrovic's avatar Scott Petrovic

Add category to model for RSS feed

Signed-off-by: Scott Petrovic's avatarScott Petrovic <scottpetrovic@gmail.com>
parent 3602c724
......@@ -72,6 +72,8 @@ public:
QString dateStr = streamReader.readElementText();
item.pubDate = QDateTime::fromString(dateStr, Qt::RFC2822Date);
}
else if (streamReader.name() == QLatin1String("category"))
item.category = streamReader.readElementText();
else if (streamReader.name() == QLatin1String("description"))
item.description = streamReader.readElementText(); //shortenHtml(streamReader.readElementText());
break;
......@@ -146,6 +148,7 @@ QHash<int, QByteArray> MultiFeedRssModel::roleNames() const
roleNames[DescriptionRole] = "description";
roleNames[PubDateRole] = "pubDate";
roleNames[LinkRole] = "link";
roleNames[CategoryRole] = "category";
roleNames[BlogNameRole] = "blogName";
roleNames[BlogIconRole] = "blogIcon";
return roleNames;
......@@ -209,6 +212,8 @@ QVariant MultiFeedRssModel::data(const QModelIndex &index, int role) const
return item.pubDate.toString("dd-MM-yyyy hh:mm");
case LinkRole:
return item.link;
case CategoryRole:
return item.category;
case BlogNameRole:
return item.blogName;
case BlogIconRole:
......
......@@ -48,6 +48,7 @@ struct RssItem {
QString title;
QString link;
QString description;
QString category;
QString blogName;
QString blogIcon;
QDateTime pubDate;
......@@ -58,7 +59,7 @@ typedef QList<RssItem> RssItemList;
class KisNetworkAccessManager;
enum RssRoles { TitleRole = Qt::UserRole + 1, DescriptionRole, LinkRole,
PubDateRole, BlogNameRole, BlogIconRole
PubDateRole, CategoryRole, BlogNameRole, BlogIconRole
};
class KRITAUI_EXPORT MultiFeedRssModel : public QAbstractListModel
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment