summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2015-05-13 13:41:46 +0200
committerMontel Laurent <[email protected]>2015-05-13 13:41:46 +0200
commit1eea513135279c4963b300c13ef1565a64996274 (patch)
tree0c5c7439e5548c1be090c80a9c0edb107747f189
parenteb5088698a0f8bd50999b53c12d8f17c4289efc3 (diff)
Fix save on disk
-rw-r--r--pimcommon/gravatar/gravatarcache.cpp7
-rw-r--r--pimcommon/gravatar/gravatarresolvurljob.cpp5
2 files changed, 8 insertions, 4 deletions
diff --git a/pimcommon/gravatar/gravatarcache.cpp b/pimcommon/gravatar/gravatarcache.cpp
index 1875e7c..aba6133 100644
--- a/pimcommon/gravatar/gravatarcache.cpp
+++ b/pimcommon/gravatar/gravatarcache.cpp
@@ -48,8 +48,9 @@ void GravatarCache::saveGravatarPixmap(const QString &hashStr, const QPixmap &pi
if (!hashStr.isEmpty() && !pixmap.isNull()) {
if (!mCachePixmap.contains(hashStr)) {
const QString path = KGlobal::dirs()->locateLocal("data", QLatin1String("gravatar/") + hashStr + QLatin1String(".png"));
- if (!pixmap.save(path)) {
- qDebug() <<" saved in cache "<< hashStr;
+ qDebug() << " path " << path;
+ if (pixmap.save(path)) {
+ qDebug() <<" saved in cache "<< hashStr << path;
mCachePixmap.insert(hashStr, pixmap);
}
}
@@ -70,7 +71,7 @@ QPixmap GravatarCache::loadGravatarPixmap(const QString &hashStr, bool &gravatar
if (fi.exists()) {
QPixmap pix;
if (pix.load(path)) {
- qDebug() << " add to cache "<<hashStr;
+ qDebug() << " add to cache "<<hashStr << path;
mCachePixmap.insert(hashStr, pix);
gravatarStored = true;
return pix;
diff --git a/pimcommon/gravatar/gravatarresolvurljob.cpp b/pimcommon/gravatar/gravatarresolvurljob.cpp
index bd7c590..684982d 100644
--- a/pimcommon/gravatar/gravatarresolvurljob.cpp
+++ b/pimcommon/gravatar/gravatarresolvurljob.cpp
@@ -98,7 +98,10 @@ void GravatarResolvUrlJob::slotFinishLoadPixmap(QNetworkReply *reply)
if (reply->error() == QNetworkReply::NoError) {
mPixmap.loadFromData(reply->readAll());
mHasGravatar = true;
- GravatarCache::self()->saveGravatarPixmap(mCalculatedHash, mPixmap);
+ //For the moment don't use cache other we will store a lot of pixmap
+ if (!mUseDefaultPixmap) {
+ GravatarCache::self()->saveGravatarPixmap(mCalculatedHash, mPixmap);
+ }
}
reply->deleteLater();
Q_EMIT finished(this);