report error when downloaded icon failed
This commit is contained in:
parent
29fc83e5b2
commit
4fde99931b
1 changed files with 13 additions and 7 deletions
|
|
@ -681,7 +681,9 @@ RootItem* TtRssGetFeedsCategoriesResponse::feedsCategories(bool obtain_icons, co
|
||||||
auto* parent = new RootItem();
|
auto* parent = new RootItem();
|
||||||
|
|
||||||
// Chop the "api/" from the end of the address.
|
// Chop the "api/" from the end of the address.
|
||||||
qDebug("TT-RSS: Base address to '%s' to get feed icons.", qPrintable(base_address));
|
qDebugNN << LOGSEC_TTRSS
|
||||||
|
<< "Base address to get feed icons is"
|
||||||
|
<< QUOTE_W_SPACE_DOT(base_address);
|
||||||
|
|
||||||
if (status() == TTRSS_API_STATUS_OK) {
|
if (status() == TTRSS_API_STATUS_OK) {
|
||||||
// We have data, construct object tree according to data.
|
// We have data, construct object tree according to data.
|
||||||
|
|
@ -731,8 +733,6 @@ RootItem* TtRssGetFeedsCategoriesResponse::feedsCategories(bool obtain_icons, co
|
||||||
// We have feed.
|
// We have feed.
|
||||||
auto* feed = new TtRssFeed();
|
auto* feed = new TtRssFeed();
|
||||||
|
|
||||||
IOFactory::writeFile("aa.json", QJsonDocument(item).toJson());
|
|
||||||
|
|
||||||
if (obtain_icons) {
|
if (obtain_icons) {
|
||||||
QString icon_path = item[QSL("icon")].type() == QJsonValue::String ? item[QSL("icon")].toString() : QString();
|
QString icon_path = item[QSL("icon")].type() == QJsonValue::String ? item[QSL("icon")].toString() : QString();
|
||||||
|
|
||||||
|
|
@ -740,13 +740,19 @@ RootItem* TtRssGetFeedsCategoriesResponse::feedsCategories(bool obtain_icons, co
|
||||||
// Chop the "api/" suffix out and append
|
// Chop the "api/" suffix out and append
|
||||||
QString full_icon_address = base_address + QL1C('/') + icon_path;
|
QString full_icon_address = base_address + QL1C('/') + icon_path;
|
||||||
QIcon icon;
|
QIcon icon;
|
||||||
|
auto res = NetworkFactory::downloadIcon({ { full_icon_address, true } },
|
||||||
|
DOWNLOAD_TIMEOUT,
|
||||||
|
icon,
|
||||||
|
proxy);
|
||||||
|
|
||||||
if (NetworkFactory::downloadIcon({ { full_icon_address, true } },
|
if (res == QNetworkReply::NoError) {
|
||||||
DOWNLOAD_TIMEOUT,
|
|
||||||
icon,
|
|
||||||
proxy) == QNetworkReply::NoError) {
|
|
||||||
feed->setIcon(icon);
|
feed->setIcon(icon);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
qWarningNN << LOGSEC_TTRSS
|
||||||
|
<< "Failed to download icon with error"
|
||||||
|
<< QUOTE_W_SPACE_DOT(res);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue