summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/application.cpp1
-rw-r--r--src/cleardata.ui12
-rw-r--r--src/mainwindow.cpp4
-rw-r--r--src/networkmanager.cpp43
-rw-r--r--src/networkmanager.h6
5 files changed, 58 insertions, 8 deletions
diff --git a/src/application.cpp b/src/application.cpp
index 8581c56d..60d5ee48 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -131,7 +131,6 @@ void Application::postLaunch()
}
-
void Application::slotSaveConfiguration() const
{
ReKonfig::self()->writeConfig();
diff --git a/src/cleardata.ui b/src/cleardata.ui
index 217ef136..94a39c69 100644
--- a/src/cleardata.ui
+++ b/src/cleardata.ui
@@ -26,6 +26,9 @@
<property name="text">
<string>history</string>
</property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
</widget>
</item>
<item>
@@ -33,6 +36,9 @@
<property name="text">
<string>Cookies</string>
</property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
</widget>
</item>
<item>
@@ -40,6 +46,9 @@
<property name="text">
<string>Cached web pages</string>
</property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
</widget>
</item>
<item>
@@ -47,6 +56,9 @@
<property name="text">
<string>Website Icons</string>
</property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
</widget>
</item>
<item>
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 2d809162..ea9f1fea 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -965,12 +965,12 @@ void MainWindow::clearPrivateData()
if(clearWidget.clearCachedPages->isChecked())
{
- Application::historyManager()->clear();
+ Application::networkAccessManager()->resetDiskCache();
}
if(clearWidget.clearWebIcons->isChecked())
{
- Application::historyManager()->clear();
+ QWebSettings::clearIconDatabase();
}
}
delete dialog;
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();
diff --git a/src/networkmanager.h b/src/networkmanager.h
index 62c01e99..1f1af2ef 100644
--- a/src/networkmanager.h
+++ b/src/networkmanager.h
@@ -26,6 +26,7 @@
#include <KIO/AccessManager>
// Forward Declarations
+class QNetworkDiskCache;
using namespace KIO;
@@ -36,6 +37,8 @@ class NetworkAccessManager : public AccessManager
public:
NetworkAccessManager(QObject *parent = 0);
+ void resetDiskCache();
+
public slots:
void loadSettings();
@@ -47,6 +50,9 @@ private slots:
void slotSSLErrors(QNetworkReply *reply, const QList<QSslError> &error);
#endif
+private:
+ QNetworkDiskCache *m_diskCache;
+
};
#endif // NETWORKMANAGER_H