Browse Source

- Improved rss favicon handling a little

adaptive-webui-19844
Christophe Dumez 18 years ago
parent
commit
8c05caba3a
  1. 22
      src/rss.h

22
src/rss.h

@ -130,6 +130,7 @@ class RssStream : public QObject{
downloadThread* downloaderIcon; downloadThread* downloaderIcon;
QTime lastRefresh; QTime lastRefresh;
bool read; bool read;
bool downloadFailure;
signals: signals:
void refreshFinished(const QString& msg, const unsigned short& type); void refreshFinished(const QString& msg, const unsigned short& type);
@ -142,6 +143,7 @@ class RssStream : public QObject{
QFile::remove(filePath); QFile::remove(filePath);
} }
filePath = file_path; filePath = file_path;
downloadFailure = false;
openRss(); openRss();
emit refreshFinished(url, NEWS); emit refreshFinished(url, NEWS);
} }
@ -373,19 +375,14 @@ class RssStream : public QObject{
void openIcon() { void openIcon() {
QImage fileIcon(iconPath,0); QImage fileIcon(iconPath,0);
// if(!fileIcon.open(QIODevice::ReadOnly)) { if(!fileIcon.load(iconPath, 0)) {
// qDebug("error : icon open failed, no file or locked, "+iconPath.toUtf8()); qDebug("error: icon open failed, no file or empty file at "+iconPath.toUtf8());
// if(QFile::exists(iconPath)) {
// fileIcon.remove();
// iconPath = ":/Icons/rss.png";
// }
// return;
// }
if(fileIcon.isNull()) {
qDebug("error : icon open failed, file empty, "+iconPath.toUtf8());
if(QFile::exists(iconPath)) { if(QFile::exists(iconPath)) {
//QFile::remove(iconPath); QFile::remove(iconPath);
//iconPath = ":/Icons/rss.png"; if(downloadFailure)
iconPath = ":/Icons/unavailable.png";
else
iconPath = ":/Icons/rss.png";
} }
return; return;
} }
@ -395,6 +392,7 @@ class RssStream : public QObject{
void handleDownloadFailure(const QString&, const QString&){ void handleDownloadFailure(const QString&, const QString&){
// Change the stream icon to a red cross // Change the stream icon to a red cross
iconPath = ":/Icons/unavailable.png"; iconPath = ":/Icons/unavailable.png";
downloadFailure = true;
emit refreshFinished(url, ICON); emit refreshFinished(url, ICON);
} }
}; };

Loading…
Cancel
Save