diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -974,6 +974,10 @@ webSettings->setAttribute(QWebEngineSettings::DnsPrefetchEnabled, settings.value(QSL("DNSPrefetch"), true).toBool()); #endif +#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 13, 0) + webSettings->setAttribute(QWebEngineSettings::PdfViewerEnabled, settings.value(QSL("intPDFViewer"), false).toBool()); +#endif + webSettings->setDefaultTextEncoding(settings.value(QSL("DefaultEncoding"), webSettings->defaultTextEncoding()).toString()); setWheelScrollLines(settings.value(QSL("wheelScrollLines"), wheelScrollLines()).toInt()); diff --git a/src/lib/preferences/preferences.h b/src/lib/preferences/preferences.h --- a/src/lib/preferences/preferences.h +++ b/src/lib/preferences/preferences.h @@ -74,6 +74,7 @@ void setManualProxyConfigurationEnabled(bool state); void useExternalDownManagerChanged(bool state); void changeCachePathClicked(); + void allowPluginsToggled(bool checked); void newTabChanged(int value); void afterLaunchChanged(int value); diff --git a/src/lib/preferences/preferences.cpp b/src/lib/preferences/preferences.cpp --- a/src/lib/preferences/preferences.cpp +++ b/src/lib/preferences/preferences.cpp @@ -121,6 +121,10 @@ ui->dnsPrefetch->setVisible(false); #endif +#if QTWEBENGINEWIDGETS_VERSION < QT_VERSION_CHECK(5, 13, 0) + ui->intPDFViewer->setVisible(false); +#endif + auto setCategoryIcon = [this](int index, const QIcon &icon) { ui->listWidget->item(index)->setIcon(QIcon(icon.pixmap(32))); }; @@ -284,6 +288,7 @@ // BROWSING settings.beginGroup("Web-Browser-Settings"); ui->allowPlugins->setChecked(settings.value("allowPlugins", true).toBool()); + connect(ui->allowPlugins, &QAbstractButton::toggled, this, &Preferences::allowPluginsToggled); ui->allowJavaScript->setChecked(settings.value("allowJavaScript", true).toBool()); ui->linksInFocusChain->setChecked(settings.value("IncludeLinkInFocusChain", false).toBool()); ui->spatialNavigation->setChecked(settings.value("SpatialNavigation", false).toBool()); @@ -295,6 +300,8 @@ ui->disableVideoAutoPlay->setChecked(settings.value("DisableVideoAutoPlay", false).toBool()); ui->webRTCPublicIpOnly->setChecked(settings.value("WebRTCPublicIpOnly", true).toBool()); ui->dnsPrefetch->setChecked(settings.value("DNSPrefetch", true).toBool()); + ui->intPDFViewer->setChecked(settings.value("intPDFViewer", false).toBool()); + ui->intPDFViewer->setEnabled(ui->allowPlugins->isChecked()); const auto levels = WebView::zoomLevels(); for (int level : levels) { @@ -539,6 +546,11 @@ QzTools::setWmClass("Preferences", this); } +void Preferences::allowPluginsToggled(bool checked) +{ + ui->intPDFViewer->setEnabled(checked); +} + void Preferences::chooseExternalDownloadManager() { QString path = QzTools::getOpenFileName("Preferences-ExternalDownloadManager", this, tr("Choose executable location..."), QDir::homePath()); @@ -959,6 +971,7 @@ settings.setValue("DisableVideoAutoPlay", ui->disableVideoAutoPlay->isChecked()); settings.setValue("WebRTCPublicIpOnly", ui->webRTCPublicIpOnly->isChecked()); settings.setValue("DNSPrefetch", ui->dnsPrefetch->isChecked()); + settings.setValue("intPDFViewer", ui->intPDFViewer->isChecked()); #ifdef Q_OS_WIN settings.setValue("CheckDefaultBrowser", ui->checkDefaultBrowser->isChecked()); diff --git a/src/lib/preferences/preferences.ui b/src/lib/preferences/preferences.ui --- a/src/lib/preferences/preferences.ui +++ b/src/lib/preferences/preferences.ui @@ -1008,7 +1008,14 @@ - Allow Pepper Plugins (Flash plugin) + Enable Pepper plugin API (PPAPI) + + + + + + + Use built-in PDF viewer (requires PPAPI)