1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

JsOptions: Add new options in QtWebEngine 5.10 and 5.11

This commit is contained in:
David Rosca 2018-03-01 12:09:54 +01:00
parent d61b117959
commit e4c58424f0
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
3 changed files with 32 additions and 7 deletions

View File

@ -915,6 +915,14 @@ void MainApplication::loadSettings()
webSettings->setAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls, true);
webSettings->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, false);
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
webSettings->setAttribute(QWebEngineSettings::AllowWindowActivationFromJavaScript, settings.value("allowJavaScriptActivateWindow", false).toBool());
#endif
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
webSettings->setAttribute(QWebEngineSettings::JavascriptCanPaste, settings.value("allowJavaScriptPaste", true).toBool());
#endif
webSettings->setDefaultTextEncoding(settings.value("DefaultEncoding", webSettings->defaultTextEncoding()).toString());
setWheelScrollLines(settings.value("wheelScrollLines", wheelScrollLines()).toInt());

View File

@ -29,11 +29,20 @@ JsOptions::JsOptions(QWidget* parent)
ui->setupUi(this);
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
ui->jscanActivateWindow->setVisible(false);
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
ui->jscanPaste->setVisible(false);
#endif
Settings settings;
settings.beginGroup("Web-Browser-Settings");
ui->jscanOpenWindow->setChecked(settings.value("allowJavaScriptOpenWindow", false).toBool());
ui->jscanChangeSize->setChecked(settings.value("allowJavaScriptGeometryChange", true).toBool());
ui->jscanAccessClipboard->setChecked(settings.value("allowJavaScriptAccessClipboard", false).toBool());
ui->jscanActivateWindow->setChecked(settings.value("allowJavaScriptActivateWindow", false).toBool());
ui->jscanAccessClipboard->setChecked(settings.value("allowJavaScriptAccessClipboard", true).toBool());
ui->jscanPaste->setChecked(settings.value("allowJavaScriptPaste", true).toBool());
settings.endGroup();
}
@ -42,8 +51,9 @@ void JsOptions::accept()
Settings settings;
settings.beginGroup("Web-Browser-Settings");
settings.setValue("allowJavaScriptOpenWindow", ui->jscanOpenWindow->isChecked());
settings.setValue("allowJavaScriptGeometryChange", ui->jscanChangeSize->isChecked());
settings.setValue("allowJavaScriptActivateWindow", ui->jscanActivateWindow->isChecked());
settings.setValue("allowJavaScriptAccessClipboard", ui->jscanAccessClipboard->isChecked());
settings.setValue("allowJavaScriptPaste", ui->jscanPaste->isChecked());
settings.endGroup();
QDialog::close();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>214</width>
<height>193</height>
<width>268</width>
<height>222</height>
</rect>
</property>
<property name="windowTitle">
@ -31,9 +31,9 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="jscanChangeSize">
<widget class="QCheckBox" name="jscanActivateWindow">
<property name="text">
<string>Change window size</string>
<string>Activate windows</string>
</property>
</widget>
</item>
@ -44,6 +44,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="jscanPaste">
<property name="text">
<string>Paste from clipboard</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">