summaryrefslogtreecommitdiff
path: root/src/networkmanager.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-07-26 12:46:21 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-07-26 12:46:21 +0200
commit596e85667d9b2863340318a061dafa676111ff2c (patch)
tree602cd26418abab05643127331d8e3a28ae1af700 /src/networkmanager.cpp
parentClear Data UI (diff)
downloadrekonq-596e85667d9b2863340318a061dafa676111ff2c.tar.xz
New Clear Private Data action
Needs some fixes..
Diffstat (limited to 'src/networkmanager.cpp')
-rw-r--r--src/networkmanager.cpp43
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();