diff --git a/CHANGELOG b/CHANGELOG
index 472b1464d..dbdb68b64 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -14,6 +14,7 @@ Version 1.4.0
* option to hide reload/stop buttons in navigationbar
* option to disable alt/ctrl + numbers shortcuts
* option to switch to tab from locationbar popup completer
+ * option to set where to store network cache
* use .qupzilla/tmp instead of /tmp for temporary data
* saving passwords should now work for much more sites
* don't steal Ctrl+B/U/I shortcuts from page
diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp
index 777a1c6c8..22dad30c2 100644
--- a/src/lib/app/mainapplication.cpp
+++ b/src/lib/app/mainapplication.cpp
@@ -855,9 +855,13 @@ SearchEnginesManager* MainApplication::searchEnginesManager()
QNetworkDiskCache* MainApplication::networkCache()
{
if (!m_networkCache) {
- const QString &cachePath = "networkcache/" + qWebKitVersion() + "/";
+ Settings settings;
+ const QString &basePath = settings.value("Web-Browser-Settings/CachePath",
+ QString("%1networkcache/").arg(m_activeProfil)).toString();
+
+ const QString &cachePath = basePath + "/" + qWebKitVersion() + "/";
m_networkCache = new QNetworkDiskCache(this);
- m_networkCache->setCacheDirectory(m_activeProfil + cachePath);
+ m_networkCache->setCacheDirectory(cachePath);
}
return m_networkCache;
diff --git a/src/lib/network/networkmanager.cpp b/src/lib/network/networkmanager.cpp
index a467cf4be..4b6f93ca3 100644
--- a/src/lib/network/networkmanager.cpp
+++ b/src/lib/network/networkmanager.cpp
@@ -88,14 +88,14 @@ NetworkManager::NetworkManager(QupZilla* mainClass, QObject* parent)
void NetworkManager::loadSettings()
{
Settings settings;
- settings.beginGroup("Web-Browser-Settings");
- if (settings.value("AllowLocalCache", true).toBool() && !mApp->isPrivateSession()) {
+ if (settings.value("Web-Browser-Settings/AllowLocalCache", true).toBool() && !mApp->isPrivateSession()) {
QNetworkDiskCache* cache = mApp->networkCache();
cache->setMaximumCacheSize(settings.value("MaximumCacheSize", 50).toInt() * 1024 * 1024); //MegaBytes
setCache(cache);
}
+ settings.beginGroup("Web-Browser-Settings");
m_doNotTrack = settings.value("DoNotTrack", false).toBool();
m_sendReferer = settings.value("SendReferer", true).toBool();
settings.endGroup();
diff --git a/src/lib/preferences/preferences.cpp b/src/lib/preferences/preferences.cpp
index a7a2f26b5..e9043a54e 100644
--- a/src/lib/preferences/preferences.cpp
+++ b/src/lib/preferences/preferences.cpp
@@ -262,8 +262,10 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
ui->allowCache->setChecked(settings.value("AllowLocalCache", true).toBool());
ui->cacheMB->setValue(settings.value("LocalCacheSize", 50).toInt());
ui->MBlabel->setText(settings.value("LocalCacheSize", 50).toString() + " MB");
+ ui->cachePath->setText(settings.value("CachePath", QString("%1networkcache/").arg(mApp->currentProfilePath())).toString());
connect(ui->allowCache, SIGNAL(clicked(bool)), this, SLOT(allowCacheChanged(bool)));
connect(ui->cacheMB, SIGNAL(valueChanged(int)), this, SLOT(cacheValueChanged(int)));
+ connect(ui->changeCachePath, SIGNAL(clicked()), this, SLOT(changeCachePathClicked()));
allowCacheChanged(ui->allowCache->isChecked());
//PASSWORD MANAGER
@@ -520,6 +522,9 @@ void Preferences::allowCacheChanged(bool state)
{
ui->cacheFrame->setEnabled(state);
ui->cacheMB->setEnabled(state);
+ ui->storeCacheLabel->setEnabled(state);
+ ui->cachePath->setEnabled(state);
+ ui->changeCachePath->setEnabled(state);
}
void Preferences::useActualHomepage()
@@ -534,7 +539,7 @@ void Preferences::useActualNewTab()
void Preferences::chooseDownPath()
{
- QString userFileName = QFileDialog::getExistingDirectory(p_QupZilla, tr("Choose download location..."), QDir::homePath());
+ QString userFileName = QFileDialog::getExistingDirectory(this, tr("Choose download location..."), QDir::homePath());
if (userFileName.isEmpty()) {
return;
}
@@ -548,7 +553,7 @@ void Preferences::chooseDownPath()
void Preferences::chooseUserStyleClicked()
{
- QString file = QFileDialog::getOpenFileName(p_QupZilla, tr("Choose stylesheet location..."), QDir::homePath(), "*.css");
+ QString file = QFileDialog::getOpenFileName(this, tr("Choose stylesheet location..."), QDir::homePath(), "*.css");
if (file.isEmpty()) {
return;
}
@@ -565,7 +570,7 @@ void Preferences::deleteHtml5storage()
void Preferences::chooseExternalDownloadManager()
{
- QString path = QFileDialog::getOpenFileName(p_QupZilla, tr("Choose executable location..."), QDir::homePath());
+ QString path = QFileDialog::getOpenFileName(this, tr("Choose executable location..."), QDir::homePath());
if (path.isEmpty()) {
return;
}
@@ -654,14 +659,6 @@ void Preferences::afterLaunchChanged(int value)
void Preferences::cacheValueChanged(int value)
{
ui->MBlabel->setText(QString::number(value) + " MB");
- if (value == 0) {
- ui->allowCache->setChecked(false);
- allowCacheChanged(false);
- }
- else if (!ui->allowCache->isChecked()) {
- ui->allowCache->setChecked(true);
- allowCacheChanged(true);
- }
}
void Preferences::pageCacheValueChanged(int value)
@@ -689,6 +686,16 @@ void Preferences::showTabPreviewsChanged(bool state)
ui->animatedTabPreviews->setEnabled(state);
}
+void Preferences::changeCachePathClicked()
+{
+ QString path = QFileDialog::getExistingDirectory(this, tr("Choose cache path..."), ui->cachePath->text());
+ if (path.isEmpty()) {
+ return;
+ }
+
+ ui->cachePath->setText(path);
+}
+
void Preferences::showPassManager(bool state)
{
m_autoFillManager->setVisible(state);
@@ -905,6 +912,7 @@ void Preferences::saveSettings()
settings.setValue("maximumCachedPages", ui->pagesInCache->value());
settings.setValue("AllowLocalCache", ui->allowCache->isChecked());
settings.setValue("LocalCacheSize", ui->cacheMB->value());
+ settings.setValue("CachePath", ui->cachePath->text());
//CSS Style
settings.setValue("userStyleSheet", ui->userStyleSheet->text());
diff --git a/src/lib/preferences/preferences.h b/src/lib/preferences/preferences.h
index dbab678d8..b01d4e6c7 100644
--- a/src/lib/preferences/preferences.h
+++ b/src/lib/preferences/preferences.h
@@ -73,6 +73,7 @@ private slots:
void useExternalDownManagerChanged(bool state);
void useDifferentProxyForHttpsChanged(bool state);
void showTabPreviewsChanged(bool state);
+ void changeCachePathClicked();
void newTabChanged(int value);
void afterLaunchChanged(int value);
diff --git a/src/lib/preferences/preferences.ui b/src/lib/preferences/preferences.ui
index 497660c7d..6a1965d13 100644
--- a/src/lib/preferences/preferences.ui
+++ b/src/lib/preferences/preferences.ui
@@ -1200,32 +1200,6 @@
-
-
-
-
-
- Maximum pages in cache:
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 20
- 0
-
-
-
- 1
-
-
-
-
@@ -1260,13 +1234,6 @@
- -
-
-
- Allow storing network cache on disk
-
-
-
-
@@ -1300,6 +1267,63 @@
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 20
+ 0
+
+
+
+ 1
+
+
+
+ -
+
+
+ Maximum pages in cache:
+
+
+
+ -
+
+
+ Allow storing network cache on disk
+
+
+
+ -
+
+
+ Store cache in:
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
-
+
+
+ -
+
+
+ ...
+
+
+
+
+
-
diff --git a/translations/empty.ts b/translations/empty.ts
index 172e42d55..f9c513d0f 100644
--- a/translations/empty.ts
+++ b/translations/empty.ts
@@ -2824,6 +2824,14 @@
+
+
+
+
+
+
+
+
QObject