From 523c2ca18c37b3c45f3d9beaebf691dfd0d7104b Mon Sep 17 00:00:00 2001 From: Patrick von Reth Date: Wed, 15 Jan 2014 11:39:59 +0100 Subject: [PATCH] added a timeout for the download of icons --- src/core/notification/icon_p.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/core/notification/icon_p.cpp b/src/core/notification/icon_p.cpp index 8674867..dc178aa 100644 --- a/src/core/notification/icon_p.cpp +++ b/src/core/notification/icon_p.cpp @@ -110,10 +110,14 @@ void IconData::download() request.setRawHeader("User-Agent", "SnoreNotify"); QNetworkReply *reply = manager.get(request); QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); + QTimer::singleShot(1000,&loop, SLOT(quit()));//timeout loop.exec(); - m_data = reply->readAll(); - m_img = QImage::fromData(m_data, "PNG"); - m_img.save(m_localUrl,"PNG"); + if(reply->isFinished()) + { + m_data = reply->readAll(); + m_img = QImage::fromData(m_data, "PNG"); + m_img.save(m_localUrl,"PNG"); + } } else {