From 4ad1c856965f48ba50b9b56aafebe730cff842c5 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Tue, 26 Sep 2017 21:58:16 +0200 Subject: [PATCH] Download feed icons. --- .../network/inoreadernetworkfactory.cpp | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/services/inoreader/network/inoreadernetworkfactory.cpp b/src/services/inoreader/network/inoreadernetworkfactory.cpp index 1a49f8b64..a04207303 100755 --- a/src/services/inoreader/network/inoreadernetworkfactory.cpp +++ b/src/services/inoreader/network/inoreadernetworkfactory.cpp @@ -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); }