From bd3d10a4a892166c79563e0ef37b3065420f99d0 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Wed, 2 Mar 2016 09:51:53 +0100 Subject: Add settings for FaviconManager's icon download modes Change-Id: I8e4b11089de29623ed39ec6b13fe30be734baa3e Task-number: QTBUG-51179 Reviewed-by: Kai Koehne --- .../webengine/quicknanobrowser/BrowserWindow.qml | 17 +++ .../demobrowser/browserapplication.cpp | 15 +++ examples/webenginewidgets/demobrowser/settings.cpp | 9 ++ examples/webenginewidgets/demobrowser/settings.ui | 130 +++++++++++++-------- 4 files changed, 122 insertions(+), 49 deletions(-) (limited to 'examples') diff --git a/examples/webengine/quicknanobrowser/BrowserWindow.qml b/examples/webengine/quicknanobrowser/BrowserWindow.qml index 0b95c0db1..b468b2a77 100644 --- a/examples/webengine/quicknanobrowser/BrowserWindow.qml +++ b/examples/webengine/quicknanobrowser/BrowserWindow.qml @@ -84,6 +84,8 @@ ApplicationWindow { property alias errorPageEnabled: errorPageEnabled.checked; property alias pluginsEnabled: pluginsEnabled.checked; property alias fullScreenSupportEnabled: fullScreenSupportEnabled.checked; + property alias autoLoadIconsForPage: autoLoadIconsForPage.checked; + property alias touchIconsEnabled: touchIconsEnabled.checked; } Action { @@ -294,6 +296,19 @@ ApplicationWindow { checked: (currentWebView.profile.httpCacheType == WebEngineProfile.DiskHttpCache) onToggled: currentWebView.profile.httpCacheType = checked ? WebEngineProfile.DiskHttpCache : WebEngineProfile.MemoryHttpCache } + MenuItem { + id: autoLoadIconsForPage + text: "Icons On" + checkable: true + checked: WebEngine.settings.autoLoadIconsForPage + } + MenuItem { + id: touchIconsEnabled + text: "Touch Icons On" + checkable: true + checked: WebEngine.settings.touchIconsEnabled + enabled: autoLoadIconsForPage.checked + } } } } @@ -365,6 +380,8 @@ ApplicationWindow { settings.errorPageEnabled: appSettings.errorPageEnabled settings.pluginsEnabled: appSettings.pluginsEnabled settings.fullScreenSupportEnabled: appSettings.fullScreenSupportEnabled + settings.autoLoadIconsForPage: appSettings.autoLoadIconsForPage + settings.touchIconsEnabled: appSettings.touchIconsEnabled onCertificateError: { error.defer() diff --git a/examples/webenginewidgets/demobrowser/browserapplication.cpp b/examples/webenginewidgets/demobrowser/browserapplication.cpp index a2e47cd9f..027a7d148 100644 --- a/examples/webenginewidgets/demobrowser/browserapplication.cpp +++ b/examples/webenginewidgets/demobrowser/browserapplication.cpp @@ -299,6 +299,21 @@ void BrowserApplication::loadSettings() defaultProfile->setHttpUserAgent(settings.value(QLatin1String("httpUserAgent")).toString()); defaultProfile->setHttpAcceptLanguage(settings.value(QLatin1String("httpAcceptLanguage")).toString()); + + switch (settings.value(QLatin1String("faviconDownloadMode"), 1).toInt()) { + case 0: + defaultSettings->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, false); + break; + case 1: + defaultSettings->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, true); + defaultSettings->setAttribute(QWebEngineSettings::TouchIconsEnabled, false); + break; + case 2: + defaultSettings->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, true); + defaultSettings->setAttribute(QWebEngineSettings::TouchIconsEnabled, true); + break; + } + settings.endGroup(); settings.beginGroup(QLatin1String("cookies")); diff --git a/examples/webenginewidgets/demobrowser/settings.cpp b/examples/webenginewidgets/demobrowser/settings.cpp index 220fafdec..aa3110ae7 100644 --- a/examples/webenginewidgets/demobrowser/settings.cpp +++ b/examples/webenginewidgets/demobrowser/settings.cpp @@ -114,6 +114,13 @@ void SettingsDialog::loadDefaults() sessionCookiesCombo->setCurrentIndex(QWebEngineProfile::defaultProfile()->persistentCookiesPolicy()); httpUserAgent->setText(QWebEngineProfile::defaultProfile()->httpUserAgent()); httpAcceptLanguage->setText(defaultAcceptLanguage()); + + if (!defaultSettings->testAttribute(QWebEngineSettings::AutoLoadIconsForPage)) + faviconDownloadMode->setCurrentIndex(0); + else if (!defaultSettings->testAttribute(QWebEngineSettings::TouchIconsEnabled)) + faviconDownloadMode->setCurrentIndex(1); + else + faviconDownloadMode->setCurrentIndex(2); } void SettingsDialog::loadFromSettings() @@ -164,6 +171,7 @@ void SettingsDialog::loadFromSettings() enableScrollAnimator->setChecked(settings.value(QLatin1String("enableScrollAnimator"), enableScrollAnimator->isChecked()).toBool()); httpUserAgent->setText(settings.value(QLatin1String("httpUserAgent"), httpUserAgent->text()).toString()); httpAcceptLanguage->setText(settings.value(QLatin1String("httpAcceptLanguage"), httpAcceptLanguage->text()).toString()); + faviconDownloadMode->setCurrentIndex(settings.value(QLatin1String("faviconDownloadMode"), faviconDownloadMode->currentIndex()).toInt()); settings.endGroup(); // Privacy @@ -223,6 +231,7 @@ void SettingsDialog::saveToSettings() settings.setValue(QLatin1String("userStyleSheet"), userStyleSheet->toPlainText()); settings.setValue(QLatin1String("httpUserAgent"), httpUserAgent->text()); settings.setValue(QLatin1String("httpAcceptLanguage"), httpAcceptLanguage->text()); + settings.setValue(QLatin1String("faviconDownloadMode"), faviconDownloadMode->currentIndex()); settings.endGroup(); //Privacy diff --git a/examples/webenginewidgets/demobrowser/settings.ui b/examples/webenginewidgets/demobrowser/settings.ui index 38a7af344..c78a52dfe 100644 --- a/examples/webenginewidgets/demobrowser/settings.ui +++ b/examples/webenginewidgets/demobrowser/settings.ui @@ -27,13 +27,26 @@ - 4 + 0 General + + + + Qt::Horizontal + + + + 280 + 18 + + + + @@ -47,36 +60,63 @@ - - - - Set to current page - - - - - + + - Qt::Horizontal + Qt::Vertical - 280 - 18 + 391 + 262 - - + + - Remove history items: + Save downloads to: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Open links from applications: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + Enable Scroll Animator + + + true + + + + + + + + In a tab in the current window + + + + + In a new window + + + + @@ -111,10 +151,10 @@ - - + + - Save downloads to: + Remove history items: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -124,53 +164,45 @@ - - + + - Open links from applications: + Set to current page + + + + + + + Favicon download mode: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + + + 1 + - In a tab in the current window + Disable icons - In a new window + Enable favicons + + + + + Enable favicons and touch icons - - - - Enable Scroll Animator - - - true - - - - - - - Qt::Vertical - - - - 391 - 262 - - - - -- cgit v1.2.3