summaryrefslogtreecommitdiff
path: root/src/kaccessmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/kaccessmanager.cpp')
-rw-r--r--src/kaccessmanager.cpp40
1 files changed, 35 insertions, 5 deletions
diff --git a/src/kaccessmanager.cpp b/src/kaccessmanager.cpp
index c298ed88..a79ff865 100644
--- a/src/kaccessmanager.cpp
+++ b/src/kaccessmanager.cpp
@@ -53,7 +53,7 @@
NetworkAccessManager::NetworkAccessManager(QObject *parent)
- : KNetworkAccessManager(parent)
+ : QNetworkAccessManager(parent)
{
connect(this, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)),
SLOT(authenticationRequired(QNetworkReply*, QAuthenticator*)));
@@ -67,10 +67,8 @@ NetworkAccessManager::NetworkAccessManager(QObject *parent)
loadSettings();
- QNetworkDiskCache *diskCache = new QNetworkDiskCache(this);
- QString location = KStandardDirs::locateLocal("cache", "", true);
- diskCache->setCacheDirectory(location);
- setCache(diskCache);
+ // resetting disk cache
+ resetDiskCache();
}
@@ -129,6 +127,38 @@ void NetworkAccessManager::authenticationRequired(QNetworkReply *reply, QAuthent
}
+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::proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth)
{
MainWindow *mainWindow = Application::instance()->mainWindow();