Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 1eea5131 authored by Laurent Montel's avatar Laurent Montel 😁

Fix save on disk

parent eb508869
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment