fix #1471
This commit is contained in:
parent
9952329e74
commit
ab4861a64f
@ -51,6 +51,10 @@ SettingsBrowserMail::SettingsBrowserMail(Settings* settings, QWidget* parent)
|
||||
connect(m_ui->m_txtExternalBrowserExecutable, &QLineEdit::textChanged, this, &SettingsBrowserMail::dirtifySettings);
|
||||
connect(m_ui->m_txtExternalEmailArguments, &QLineEdit::textChanged, this, &SettingsBrowserMail::dirtifySettings);
|
||||
connect(m_ui->m_txtExternalEmailExecutable, &QLineEdit::textChanged, this, &SettingsBrowserMail::dirtifySettings);
|
||||
|
||||
connect(m_ui->m_txtUserAgent, &QLineEdit::textChanged, this, &SettingsBrowserMail::dirtifySettings);
|
||||
connect(m_ui->m_txtUserAgent, &QLineEdit::textChanged, this, &SettingsBrowserMail::requireRestart);
|
||||
|
||||
connect(m_ui->m_cmbExternalBrowserPreset,
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this,
|
||||
@ -178,6 +182,7 @@ void SettingsBrowserMail::loadSettings() {
|
||||
->setChecked(settings()->value(GROUP(Network), SETTING(Network::IgnoreAllCookies)).toBool());
|
||||
m_ui->m_checkOpenLinksInExternal
|
||||
->setChecked(settings()->value(GROUP(Browser), SETTING(Browser::OpenLinksInExternalBrowserRightAway)).toBool());
|
||||
m_ui->m_txtUserAgent->setText(settings()->value(GROUP(Network), SETTING(Network::CustomUserAgent)).toString());
|
||||
|
||||
// Load settings of web browser GUI.
|
||||
m_ui->m_cmbExternalBrowserPreset->addItem(tr("Opera 12 or older"), QSL("-nosession %1"));
|
||||
@ -222,6 +227,7 @@ void SettingsBrowserMail::saveSettings() {
|
||||
settings()->setValue(GROUP(Network), Network::EnableHttp2, m_ui->m_cbEnableHttp2->isChecked());
|
||||
settings()->setValue(GROUP(Network), Network::EnableApiServer, m_ui->m_cbEnableApiServer->isChecked());
|
||||
settings()->setValue(GROUP(Network), Network::IgnoreAllCookies, m_ui->m_cbIgnoreAllCookies->isChecked());
|
||||
settings()->setValue(GROUP(Network), Network::CustomUserAgent, m_ui->m_txtUserAgent->text());
|
||||
|
||||
qApp->web()->stopApiServer();
|
||||
|
||||
|
@ -42,6 +42,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="m_txtUserAgent"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Custom User-Agent</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="m_tabWebEngine">
|
||||
@ -83,7 +93,7 @@
|
||||
<item row="2" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@ -172,7 +182,7 @@
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="m_cmbExternalBrowserPreset">
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
<enum>QComboBox::SizeAdjustPolicy::AdjustToContents</enum>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
@ -197,7 +207,7 @@
|
||||
<item row="1" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@ -289,7 +299,7 @@
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="m_cmbExternalEmailPreset">
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
<enum>QComboBox::SizeAdjustPolicy::AdjustToContents</enum>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
@ -372,7 +382,7 @@
|
||||
<item row="3" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
|
@ -222,7 +222,13 @@ Application::Application(const QString& id, int& argc, char** argv, const QStrin
|
||||
}
|
||||
#endif
|
||||
|
||||
m_webFactory->setCustomUserAgent(custom_ua);
|
||||
if (!custom_ua.isEmpty()) {
|
||||
m_webFactory->setCustomUserAgent(custom_ua);
|
||||
}
|
||||
else {
|
||||
custom_ua = qApp->settings()->value(GROUP(Network), SETTING(Network::CustomUserAgent)).toString();
|
||||
m_webFactory->setCustomUserAgent(custom_ua);
|
||||
}
|
||||
|
||||
#if defined(NO_LITE)
|
||||
m_webFactory->urlIinterceptor()->load();
|
||||
@ -1358,7 +1364,8 @@ void Application::fillCmdArgumentsParser(QCommandLineParser& parser) {
|
||||
QSL("style-name"));
|
||||
|
||||
QCommandLineOption custom_ua({QSL(CLI_USERAGENT_SHORT), QSL(CLI_USERAGENT_LONG)},
|
||||
QSL("User custom User-Agent HTTP header for all network requests."),
|
||||
QSL("User custom User-Agent HTTP header for all network requests. This option "
|
||||
"takes precedence over User-Agent set via application settings."),
|
||||
QSL("user-agent"));
|
||||
QCommandLineOption
|
||||
adblock_port({QSL(CLI_ADBLOCKPORT_SHORT), QSL(CLI_ADBLOCKPORT_LONG)},
|
||||
|
@ -65,6 +65,9 @@ VALUE(bool) Network::EnableApiServerDef = false;
|
||||
DKEY Network::EnableHttp2 = "http2_enabled";
|
||||
DVALUE(bool) Network::EnableHttp2Def = false;
|
||||
|
||||
DKEY Network::CustomUserAgent = "user_agent";
|
||||
DVALUE(QString) Network::CustomUserAgentDef = QString();
|
||||
|
||||
DKEY Network::IgnoreAllCookies = "ignore_all_cookies";
|
||||
DVALUE(bool) Network::IgnoreAllCookiesDef = false;
|
||||
|
||||
|
@ -413,6 +413,9 @@ namespace Network {
|
||||
KEY EnableHttp2;
|
||||
VALUE(bool) EnableHttp2Def;
|
||||
|
||||
KEY CustomUserAgent;
|
||||
VALUE(QString) CustomUserAgentDef;
|
||||
|
||||
KEY IgnoreAllCookies;
|
||||
VALUE(bool) IgnoreAllCookiesDef;
|
||||
} // namespace Network
|
||||
|
Loading…
x
Reference in New Issue
Block a user