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

Preferences: Add new options in QtWebEngine 5.11

- Disable automatic playing of videos
- Prevent WebRTC from leaking local IP address
This commit is contained in:
David Rosca 2018-03-01 14:41:45 +01:00
parent e4c58424f0
commit ce3f4ed1e8
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
3 changed files with 26 additions and 0 deletions

View File

@ -921,6 +921,8 @@ void MainApplication::loadSettings()
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
webSettings->setAttribute(QWebEngineSettings::JavascriptCanPaste, settings.value("allowJavaScriptPaste", true).toBool());
webSettings->setAttribute(QWebEngineSettings::PlaybackRequiresUserGesture, settings.value("DisableVideoAutoPlay", false).toBool());
webSettings->setAttribute(QWebEngineSettings::WebRTCPublicInterfacesOnly, settings.value("WebRTCPublicIpOnly", true).toBool());
#endif
webSettings->setDefaultTextEncoding(settings.value("DefaultEncoding", webSettings->defaultTextEncoding()).toString());

View File

@ -110,6 +110,11 @@ Preferences::Preferences(BrowserWindow* window)
ui->checkUpdates->setVisible(false);
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
ui->disableVideoAutoPlay->setVisible(false);
ui->webRTCPublicIpOnly->setVisible(false);
#endif
auto setCategoryIcon = [this](int index, const QIcon &icon) {
ui->listWidget->item(index)->setIcon(QIcon(icon.pixmap(32)));
};
@ -273,6 +278,8 @@ Preferences::Preferences(BrowserWindow* window)
ui->xssAuditing->setChecked(settings.value("XSSAuditing", false).toBool());
ui->printEBackground->setChecked(settings.value("PrintElementBackground", true).toBool());
ui->useNativeScrollbars->setChecked(settings.value("UseNativeScrollbars", false).toBool());
ui->disableVideoAutoPlay->setChecked(settings.value("DisableVideoAutoPlay", false).toBool());
ui->webRTCPublicIpOnly->setChecked(settings.value("WebRTCPublicIpOnly", true).toBool());
foreach (int level, WebView::zoomLevels()) {
ui->defaultZoomLevel->addItem(QString("%1%").arg(level));
@ -924,6 +931,9 @@ void Preferences::saveSettings()
settings.setValue("PrintElementBackground", ui->printEBackground->isChecked());
settings.setValue("closeAppWithCtrlQ", ui->closeAppWithCtrlQ->isChecked());
settings.setValue("UseNativeScrollbars", ui->useNativeScrollbars->isChecked());
settings.setValue("DisableVideoAutoPlay", ui->disableVideoAutoPlay->isChecked());
settings.setValue("WebRTCPublicIpOnly", ui->webRTCPublicIpOnly->isChecked());
#ifdef Q_OS_WIN
settings.setValue("CheckDefaultBrowser", ui->checkDefaultBrowser->isChecked());
#endif

View File

@ -1061,6 +1061,20 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="disableVideoAutoPlay">
<property name="text">
<string>Disable automatic playing of videos</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="webRTCPublicIpOnly">
<property name="text">
<string>Prevent WebRTC from leaking local IP address</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">