mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
Option for internal PDFium-based viewer on Qt 5.13+
Summary: Qt 5.13+ has a built-in PDFium-based PDF viewer enabled in QWebEngineSettings by default. There is no way to disable it at run time by the user, and leaving it "as is" changes the browser's behavior, depending on which version of Qt is installed on a target system. The built-in plugin currently has quite a limited functionality and, e.g., misses ability to download the document being viewed. This adds a checkbox in Preferences->Browsing->Web configuration to enable/disable usage of internal Qt's PDF viewer on systems with Qt 5.13 and above. The feature uses Pepper plugin API (PPAPI) of QtWebEngine. The corresponding checkbox's text has been renamed to better reflect its impact on QtWebEngine's operation ("Allow Pepper Plugins (Flash plugin)" -> "Enable Pepper plugin API (PPAPI)"). To clarify dependency of internal PDF viewer on PPAPI, the checkbox gets disabled when the user unchecks "Enable Pepper plugin API (PPAPI)" checkbox. Also, the dependency is mentioned in its text. Reviewers: #falkon, SGOrava Reviewed By: #falkon, SGOrava Subscribers: pshaw, SGOrava, falkon, alukichev Tags: #falkon Differential Revision: https://phabricator.kde.org/D26753
This commit is contained in:
parent
2a0f092436
commit
90664879c5
|
@ -974,6 +974,10 @@ void MainApplication::loadSettings()
|
|||
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());
|
||||
|
|
|
@ -121,6 +121,10 @@ Preferences::Preferences(BrowserWindow* window)
|
|||
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 @@ Preferences::Preferences(BrowserWindow* window)
|
|||
// 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 @@ Preferences::Preferences(BrowserWindow* window)
|
|||
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 @@ Preferences::Preferences(BrowserWindow* window)
|
|||
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 @@ void Preferences::saveSettings()
|
|||
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());
|
||||
|
|
|
@ -74,6 +74,7 @@ private Q_SLOTS:
|
|||
void setManualProxyConfigurationEnabled(bool state);
|
||||
void useExternalDownManagerChanged(bool state);
|
||||
void changeCachePathClicked();
|
||||
void allowPluginsToggled(bool checked);
|
||||
|
||||
void newTabChanged(int value);
|
||||
void afterLaunchChanged(int value);
|
||||
|
|
|
@ -1008,7 +1008,14 @@
|
|||
<item>
|
||||
<widget class="QCheckBox" name="allowPlugins">
|
||||
<property name="text">
|
||||
<string>Allow Pepper Plugins (Flash plugin)</string>
|
||||
<string>Enable Pepper plugin API (PPAPI)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="intPDFViewer">
|
||||
<property name="text">
|
||||
<string>Use built-in PDF viewer (requires PPAPI)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
Loading…
Reference in New Issue
Block a user