fixed removig of the copies of resources

This commit is contained in:
Patrick von Reth 2014-09-22 15:26:14 +02:00
parent 6425338c35
commit 3f96f1effa
1 changed files with 8 additions and 6 deletions

View File

@ -69,8 +69,10 @@ IconData::IconData(const QString &url):
m_isDownloading = false; m_isDownloading = false;
}); });
} else if(m_isResource) { } else if(m_isResource) {
QFile file(url); m_img = QImage(url);
file.copy(m_localUrl); m_img.save(m_localUrl, "PNG");
s_localImageCache.insert(m_localUrl);
snoreDebug(SNORE_DEBUG) << m_localUrl << "added to cache";
} }
} }
@ -97,11 +99,11 @@ IconData::~IconData()
const QImage &IconData::image() const QImage &IconData::image()
{ {
if (m_img.isNull()) {
while(m_isDownloading) while(m_isDownloading)
{ {
qApp->processEvents(); qApp->processEvents();
} }
if (m_img.isNull()) {
if (!m_isRemoteFile) { if (!m_isRemoteFile) {
m_img = QImage(m_url); m_img = QImage(m_url);
} }