This commit is contained in:
Martin Rotter 2023-02-02 14:59:01 +01:00
parent 6baa539480
commit 546a674ebf
5 changed files with 30 additions and 6 deletions

View File

@ -84,6 +84,8 @@ SettingsBrowserMail::SettingsBrowserMail(Settings* settings, QWidget* parent)
// Remove WebEngine tab.
m_ui->m_tabBrowserProxy->removeTab(2);
#else
connect(m_ui->m_cbDisableCache, &QCheckBox::stateChanged, this, &SettingsBrowserMail::dirtifySettings);
connect(m_ui->m_cbDisableCache, &QCheckBox::stateChanged, this, &SettingsBrowserMail::requireRestart);
connect(m_ui->m_txtWebEngineChromiumFlags, &QPlainTextEdit::textChanged, this, &SettingsBrowserMail::dirtifySettings);
connect(m_ui->m_txtWebEngineChromiumFlags, &QPlainTextEdit::textChanged, this, &SettingsBrowserMail::requireRestart);
#endif
@ -164,6 +166,7 @@ void SettingsBrowserMail::selectEmailExecutable() {
void SettingsBrowserMail::loadSettings() {
onBeginLoadSettings();
m_ui->m_cbDisableCache->setChecked(settings()->value(GROUP(Browser), SETTING(Browser::DisableCache)).toBool());
m_ui->m_cbEnableHttp2->setChecked(settings()->value(GROUP(Network), SETTING(Network::EnableHttp2)).toBool());
m_ui->m_cbIgnoreAllCookies
->setChecked(settings()->value(GROUP(Network), SETTING(Network::IgnoreAllCookies)).toBool());
@ -209,6 +212,7 @@ void SettingsBrowserMail::loadSettings() {
void SettingsBrowserMail::saveSettings() {
onBeginSaveSettings();
settings()->setValue(GROUP(Browser), Browser::DisableCache, m_ui->m_cbDisableCache->isChecked());
settings()->setValue(GROUP(Network), Network::EnableHttp2, m_ui->m_cbEnableHttp2->isChecked());
settings()->setValue(GROUP(Network), Network::IgnoreAllCookies, m_ui->m_cbIgnoreAllCookies->isChecked());

View File

@ -13,9 +13,6 @@
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QTabWidget" name="m_tabBrowserProxy">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="m_tabNetwork">
<attribute name="title">
<string>Network</string>
@ -42,16 +39,23 @@
<string>WebEngine</string>
</attribute>
<layout class="QFormLayout" name="formLayout_4">
<item row="0" column="0">
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Custom &quot;QTWEBENGINE_CHROMIUM_FLAGS&quot; flags</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<item row="2" column="0" colspan="2">
<widget class="QPlainTextEdit" name="m_txtWebEngineChromiumFlags"/>
</item>
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="m_cbDisableCache">
<property name="text">
<string>Disable cache</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="m_tabExternalBrowser">
@ -409,6 +413,8 @@
<tabstop>m_btnDeleteTool</tabstop>
<tabstop>m_cbIgnoreAllCookies</tabstop>
<tabstop>m_cbEnableHttp2</tabstop>
<tabstop>m_cbDisableCache</tabstop>
<tabstop>m_txtWebEngineChromiumFlags</tabstop>
</tabstops>
<resources/>
<connections/>

View File

@ -410,6 +410,9 @@ DKEY Notifications::ID = "notifications";
// Web browser.
DKEY Browser::ID = "browser";
DKEY Browser::DisableCache = "disable_cache";
DVALUE(bool) Browser::DisableCacheDef = false;
DKEY Browser::WebEngineChromiumFlags = "webengine_chromium_flags";
#if defined(Q_OS_LINUX) && !defined(IS_FLATPAK_BUILD)

View File

@ -451,6 +451,9 @@ namespace Notifications {
namespace Browser {
KEY ID;
KEY DisableCache;
VALUE(bool) DisableCacheDef;
KEY WebEngineChromiumFlags;
VALUE(QString) WebEngineChromiumFlagsDef;

View File

@ -32,7 +32,15 @@ WebFactory::WebFactory(QObject* parent) : QObject(parent), m_customUserAgent(QSt
m_adBlock = new AdBlockManager(this);
#if defined(USE_WEBENGINE)
m_engineProfile = new QWebEngineProfile(QSL(APP_LOW_NAME), this);
if (qApp->settings()->value(GROUP(Browser), SETTING(Browser::DisableCache)).toBool()) {
qWarningNN << LOGSEC_NETWORK << "Using off-the-record WebEngine profile.";
m_engineProfile = new QWebEngineProfile(this);
}
else {
m_engineProfile = new QWebEngineProfile(QSL(APP_LOW_NAME), this);
}
m_engineSettings = nullptr;
m_urlInterceptor = new NetworkUrlInterceptor(this);
#endif