diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/kaccessmanager.cpp | 40 | ||||
-rw-r--r-- | src/kaccessmanager.h | 10 |
2 files changed, 40 insertions, 10 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(); diff --git a/src/kaccessmanager.h b/src/kaccessmanager.h index ed5c208d..8a88594f 100644 --- a/src/kaccessmanager.h +++ b/src/kaccessmanager.h @@ -22,20 +22,20 @@ #ifndef KACCESSMANAGER_H #define KACCESSMANAGER_H -//KDE Network Includes -#include <kdenetwork/knetworkaccessmanager.h> -#include <kdenetwork/knetworkreply.h> -// Forward Declarations +// Qt Includes +#include <QtNetwork/QNetworkAccessManager> -class NetworkAccessManager : public KNetworkAccessManager +class NetworkAccessManager : public QNetworkAccessManager { Q_OBJECT public: NetworkAccessManager(QObject *parent = 0); + void resetDiskCache(); + public slots: void loadSettings(); |