1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Fixed crash when cleaning cache while cache is not used (disabled).

This commit is contained in:
nowrep 2012-06-15 17:43:19 +02:00
parent 0cba7628de
commit 8f75fd2532
12 changed files with 32 additions and 26 deletions

View File

@ -76,7 +76,7 @@ MainApplication::MainApplication(int &argc, char** argv)
, m_bookmarksModel(0)
, m_downloadManager(0)
, m_autofill(0)
, m_networkCache(new QNetworkDiskCache(this))
, m_networkCache(0)
, m_desktopNotifications(0)
, m_searchEnginesManager(0)
, m_dbWriter(new DatabaseWriter(this))
@ -712,6 +712,16 @@ SearchEnginesManager* MainApplication::searchEnginesManager()
return m_searchEnginesManager;
}
QNetworkDiskCache* MainApplication::networkCache()
{
if (!m_networkCache) {
m_networkCache = new QNetworkDiskCache(this);
m_networkCache->setCacheDirectory(m_activeProfil + "/networkcache");
}
return m_networkCache;
}
DesktopNotificationsFactory* MainApplication::desktopNotifications()
{
if (!m_desktopNotifications) {

View File

@ -93,7 +93,7 @@ public:
DownloadManager* downManager();
AutoFillModel* autoFill();
SearchEnginesManager* searchEnginesManager();
QNetworkDiskCache* networkCache() { return m_networkCache; }
QNetworkDiskCache* networkCache();
DesktopNotificationsFactory* desktopNotifications();
DatabaseWriter* dbWriter() { return m_dbWriter; }

View File

@ -67,7 +67,7 @@ NetworkManager::NetworkManager(QupZilla* mainClass, QObject* parent)
connect(this, SIGNAL(sslErrors(QNetworkReply*, QList<QSslError>)), this, SLOT(sslError(QNetworkReply*, QList<QSslError>)));
connect(this, SIGNAL(finished(QNetworkReply*)), this, SLOT(setSSLConfiguration(QNetworkReply*)));
m_schemeHandlers["qupzilla"] = new QupZillaSchemeHandler;
m_schemeHandlers["qupzilla"] = new QupZillaSchemeHandler();
m_proxyFactory = new NetworkProxyFactory();
setProxyFactory(m_proxyFactory);
@ -80,10 +80,9 @@ void NetworkManager::loadSettings()
settings.beginGroup("Web-Browser-Settings");
if (settings.value("AllowLocalCache", true).toBool()) {
m_diskCache = mApp->networkCache();
m_diskCache->setCacheDirectory(mApp->currentProfilePath() + "/networkcache");
m_diskCache->setMaximumCacheSize(settings.value("MaximumCacheSize", 50).toInt() * 1024 * 1024); //MegaBytes
setCache(m_diskCache);
QNetworkDiskCache* cache = mApp->networkCache();
cache->setMaximumCacheSize(settings.value("MaximumCacheSize", 50).toInt() * 1024 * 1024); //MegaBytes
setCache(cache);
}
m_doNotTrack = settings.value("DoNotTrack", false).toBool();
m_sendReferer = settings.value("SendReferer", true).toBool();

View File

@ -24,8 +24,6 @@
#include "qz_namespace.h"
#include "networkmanagerproxy.h"
class QNetworkDiskCache;
class QupZilla;
class AdBlockManager;
class NetworkProxyFactory;
@ -72,7 +70,6 @@ private slots:
private:
AdBlockManager* m_adblockManager;
QupZilla* p_QupZilla;
QNetworkDiskCache* m_diskCache;
NetworkProxyFactory* m_proxyFactory;
QStringList m_certPaths;

View File

@ -77,8 +77,8 @@ void ClearPrivateData::clearWebDatabases()
void ClearPrivateData::clearCache()
{
mApp->networkCache()->clear();
mApp->webSettings()->clearMemoryCaches();
mApp->networkManager()->cache()->clear();
QFile::remove(mApp->currentProfilePath() + "ApplicationCache.db");
}