diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-07-26 12:46:21 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-07-26 12:46:21 +0200 |
commit | 596e85667d9b2863340318a061dafa676111ff2c (patch) | |
tree | 602cd26418abab05643127331d8e3a28ae1af700 /src/networkmanager.cpp | |
parent | Clear Data UI (diff) | |
download | rekonq-596e85667d9b2863340318a061dafa676111ff2c.tar.xz |
New Clear Private Data action
Needs some fixes..
Diffstat (limited to 'src/networkmanager.cpp')
-rw-r--r-- | src/networkmanager.cpp | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/src/networkmanager.cpp b/src/networkmanager.cpp index 2cf65e1c..3d6df204 100644 --- a/src/networkmanager.cpp +++ b/src/networkmanager.cpp @@ -50,10 +50,12 @@ #include <QtNetwork/QNetworkReply> #include <QtNetwork/QNetworkRequest> #include <QtNetwork/QSslError> +#include <QtNetwork/QNetworkDiskCache> NetworkAccessManager::NetworkAccessManager(QObject *parent) : AccessManager(parent) + , m_diskCache(0) { connect(this, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), SLOT(authenticationRequired(QNetworkReply*, QAuthenticator*))); @@ -65,12 +67,11 @@ NetworkAccessManager::NetworkAccessManager(QObject *parent) SLOT(slotSSLErrors(QNetworkReply*, const QList<QSslError>&))); #endif + // load AccessManager Settings loadSettings(); - - QNetworkDiskCache *diskCache = new QNetworkDiskCache(this); - QString location = KStandardDirs::locateLocal("cache", "", true); - diskCache->setCacheDirectory(location); - setCache(diskCache); + + // resetting disk cache + resetDiskCache(); } @@ -97,6 +98,38 @@ void NetworkAccessManager::loadSettings() } +void NetworkAccessManager::resetDiskCache() +{ + if(!m_diskCache) + { + m_diskCache = new QNetworkDiskCache(this); + QString location = KStandardDirs::locateLocal("cache", "", true); + kDebug() << location; + + m_diskCache->setCacheDirectory(location); + setCache(m_diskCache); + } + else + { + QString location = m_diskCache->cacheDirectory(); +// setCache(0); +// delete m_diskCache; + + QDir cacheDir(location + QString("/http") ); + QStringList fileList = cacheDir.entryList(); + foreach(QString str, fileList) + { + QFile file(str); + file.remove(); + } + +// m_diskCache = new QNetworkDiskCache(this); +// m_diskCache->setCacheDirectory(location); +// setCache(m_diskCache); + } +} + + void NetworkAccessManager::authenticationRequired(QNetworkReply *reply, QAuthenticator *auth) { MainWindow *mainWindow = Application::instance()->mainWindow(); |