diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-07-31 17:09:24 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-07-31 17:09:24 +0200 |
commit | 7dbff807a4a71d1bd81f438fe0facd833add3293 (patch) | |
tree | 8816d8f0177fbd22978cf2d89fa8c4c21b5472a3 /src/kaccessmanager.cpp | |
parent | String fix (diff) | |
download | rekonq-7dbff807a4a71d1bd81f438fe0facd833add3293.tar.xz |
This commit removes rekonq KDEnetwork dependencies.
All this just to support KDE 4.2
Anyway this will be dropped with rekonq 0.3..
Diffstat (limited to 'src/kaccessmanager.cpp')
-rw-r--r-- | src/kaccessmanager.cpp | 40 |
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(); |