mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-30 09:04:52 +01:00
Download feed icons.
This commit is contained in:
parent
e4360447a4
commit
4ad1c85696
@ -119,26 +119,9 @@ RootItem* InoreaderNetworkFactory::decodeFeedCategoriesData(const QString& categ
|
||||
category->setDescription(label["htmlUrl"].toString());
|
||||
category->setTitle(label_id.mid(label_id.lastIndexOf(QL1C('/')) + 1));
|
||||
category->setCustomId(label_id);
|
||||
|
||||
cats.insert(category->customId(), category);
|
||||
|
||||
if (obtain_icons) {
|
||||
QString icon_url = label["iconUrl"].toString();
|
||||
|
||||
if (!icon_url.isEmpty()) {
|
||||
QByteArray icon_data;
|
||||
|
||||
if (NetworkFactory::performNetworkOperation(icon_url, DOWNLOAD_TIMEOUT,
|
||||
QByteArray(), QString(), icon_data,
|
||||
QNetworkAccessManager::GetOperation).first == QNetworkReply::NoError) {
|
||||
// Icon downloaded, set it up.
|
||||
QPixmap icon_pixmap;
|
||||
|
||||
icon_pixmap.loadFromData(icon_data);
|
||||
category->setIcon(QIcon(icon_pixmap));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// All categories in ownCloud are top-level.
|
||||
parent->appendChild(category);
|
||||
}
|
||||
@ -171,6 +154,24 @@ RootItem* InoreaderNetworkFactory::decodeFeedCategoriesData(const QString& categ
|
||||
feed->setTitle(title);
|
||||
feed->setCustomId(id);
|
||||
|
||||
if (obtain_icons) {
|
||||
QString icon_url = subscription["iconUrl"].toString();
|
||||
|
||||
if (!icon_url.isEmpty()) {
|
||||
QByteArray icon_data;
|
||||
|
||||
if (NetworkFactory::performNetworkOperation(icon_url, DOWNLOAD_TIMEOUT,
|
||||
QByteArray(), QString(), icon_data,
|
||||
QNetworkAccessManager::GetOperation).first == QNetworkReply::NoError) {
|
||||
// Icon downloaded, set it up.
|
||||
QPixmap icon_pixmap;
|
||||
|
||||
icon_pixmap.loadFromData(icon_data);
|
||||
feed->setIcon(QIcon(icon_pixmap));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cats.contains(parent_label)) {
|
||||
cats[parent_label]->appendChild(feed);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user