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

Added: Remove cache on close (#2185)

This commit is contained in:
Voldracarno Draconor 2017-01-27 13:37:56 +01:00 committed by David Rosca
parent bff02d75b8
commit 4729b24c64
3 changed files with 41 additions and 11 deletions

View File

@ -728,6 +728,7 @@ void MainApplication::saveSettings()
settings.endGroup();
settings.beginGroup("Web-Browser-Settings");
bool deleteCache = settings.value("deleteCacheOnClose", false).toBool();
bool deleteHistory = settings.value("deleteHistoryOnClose", false).toBool();
bool deleteHtml5Storage = settings.value("deleteHTML5StorageOnClose", false).toBool();
settings.endGroup();
@ -745,6 +746,9 @@ void MainApplication::saveSettings()
if (deleteCookies) {
m_cookieJar->deleteAllCookies();
}
if (deleteCache) {
QzTools::removeDir(mApp->webProfile()->cachePath());
}
m_searchEnginesManager->saveSettings();
m_plugins->shutdown();

View File

@ -287,6 +287,7 @@ Preferences::Preferences(BrowserWindow* window)
//Cache
ui->allowCache->setChecked(settings.value("AllowLocalCache", true).toBool());
ui->removeCache->setChecked(settings.value("deleteCacheOnClose", false).toBool());
ui->cacheMB->setValue(settings.value("LocalCacheSize", 50).toInt());
ui->cachePath->setText(settings.value("CachePath", QWebEngineProfile::defaultProfile()->cachePath()).toString());
connect(ui->allowCache, SIGNAL(clicked(bool)), this, SLOT(allowCacheChanged(bool)));
@ -603,6 +604,7 @@ void Preferences::makeQupZillaDefault()
void Preferences::allowCacheChanged(bool state)
{
ui->removeCache->setEnabled(state);
ui->maxCacheLabel->setEnabled(state);
ui->cacheMB->setEnabled(state);
ui->storeCacheLabel->setEnabled(state);
@ -962,6 +964,7 @@ void Preferences::saveSettings()
#endif
//Cache
settings.setValue("AllowLocalCache", ui->allowCache->isChecked());
settings.setValue("deleteCacheOnClose", ui->removeCache->isChecked());
settings.setValue("LocalCacheSize", ui->cacheMB->value());
settings.setValue("CachePath", ui->cachePath->text());
//CSS Style

View File

@ -1212,14 +1212,44 @@
<layout class="QGridLayout" name="gridLayout_19">
<item row="0" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_4">
<item row="1" column="1">
<item row="0" column="0" colspan="3">
<widget class="QCheckBox" name="allowCache">
<property name="text">
<string>Allow storing network cache on disk</string>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_33">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1" colspan="3">
<widget class="QCheckBox" name="removeCache">
<property name="text">
<string>Delete cache on close</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="maxCacheLabel">
<property name="text">
<string>Maximum:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<item row="2" column="2">
<widget class="QSpinBox" name="cacheMB">
<property name="minimum">
<number>1</number>
@ -1235,14 +1265,7 @@
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QCheckBox" name="allowCache">
<property name="text">
<string>Allow storing network cache on disk</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QLabel" name="storeCacheLabel">
<property name="text">
<string>Store cache in:</string>
@ -1252,7 +1275,7 @@
</property>
</widget>
</item>
<item row="2" column="2">
<item row="3" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_20">
<item>
<widget class="QLineEdit" name="cachePath"/>