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 cc834e4f authored by Laurent Montel's avatar Laurent Montel 😁

Move clear cache directly in gravatarcach

parent 832fbe96
......@@ -18,12 +18,10 @@
#include "gravatarconfigwidget.h"
#include "pimcommon/gravatar/gravatarcache.h"
#include <QDebug>
#include <KStandardDirs>
#include <QVBoxLayout>
#include <KLocalizedString>
#include <QCheckBox>
#include <QPushButton>
#include <KGlobal>
#include <QLabel>
#include <QDir>
#include <KIntNumInput>
......@@ -107,18 +105,7 @@ void GravatarConfigWidget::doResetToDefaultsOther()
void GravatarConfigWidget::slotClearGravatarCache()
{
const QString path = KGlobal::dirs()->locateLocal("data", QLatin1String("gravatar/"));
if (!path.isEmpty()) {
QDir dir(path);
if (dir.exists()) {
QFileInfoList list = dir.entryInfoList(); // get list of matching files and delete all
QFileInfo it;
Q_FOREACH( it, list ) {
dir.remove(it.fileName());
}
}
}
PimCommon::GravatarCache::self()->clear();
PimCommon::GravatarCache::self()->clearAllCache();
}
void GravatarConfigWidget::slotGravatarCacheSizeChanged()
......
......@@ -17,6 +17,7 @@
#include "gravatarcache.h"
#include <KGlobal>
#include <QDir>
#include <KStandardDirs>
#include <QDebug>
#include <QFile>
......@@ -101,3 +102,18 @@ void GravatarCache::clear()
mCachePixmap.clear();
}
void GravatarCache::clearAllCache()
{
const QString path = KGlobal::dirs()->locateLocal("data", QLatin1String("gravatar/"));
if (!path.isEmpty()) {
QDir dir(path);
if (dir.exists()) {
QFileInfoList list = dir.entryInfoList(); // get list of matching files and delete all
QFileInfo it;
Q_FOREACH( it, list ) {
dir.remove(it.fileName());
}
}
}
clear();
}
......@@ -41,6 +41,7 @@ public:
void setMaximumSize(int maximumSize);
void clear();
void clearAllCache();
private:
QCache<QString, QPixmap> mCachePixmap;
int mMaximumSize;
......
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