From afd4c43bcef467da03d89d5468742a1dcbfa04fa Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 18 Aug 2014 18:19:48 +0200 Subject: Re-enable some qwebenginesetting features in browser example We now have the QWebEngineSettings class and can re-enable the features that were previously disabled in the browser that depended on it. Change-Id: I525dd1a4b5c380ad4c6060f276440e069f633897 Reviewed-by: Jocelyn Turcotte --- .../webenginewidgets/browser/browserapplication.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'examples/webenginewidgets/browser/browserapplication.cpp') diff --git a/examples/webenginewidgets/browser/browserapplication.cpp b/examples/webenginewidgets/browser/browserapplication.cpp index 89fc698a7..9ea9fbfcf 100644 --- a/examples/webenginewidgets/browser/browserapplication.cpp +++ b/examples/webenginewidgets/browser/browserapplication.cpp @@ -66,9 +66,7 @@ #include #include -#if defined(QWEBENGINESETTINGS) #include -#endif #include @@ -203,10 +201,10 @@ void BrowserApplication::quitBrowser() */ void BrowserApplication::postLaunch() { -#if defined(QWEBENGINESETTINGS) QString directory = QStandardPaths::writableLocation(QStandardPaths::DataLocation); if (directory.isEmpty()) directory = QDir::homePath() + QLatin1String("/.") + QCoreApplication::applicationName(); +#if defined(QWEBENGINESETTINGS_PATHS) QWebEngineSettings::setIconDatabasePath(directory); QWebEngineSettings::setOfflineStoragePath(directory); #endif @@ -228,7 +226,6 @@ void BrowserApplication::postLaunch() void BrowserApplication::loadSettings() { -#if defined(QWEBENGINESETTINGS) QSettings settings; settings.beginGroup(QLatin1String("websettings")); @@ -248,15 +245,17 @@ void BrowserApplication::loadSettings() defaultSettings->setFontSize(QWebEngineSettings::DefaultFixedFontSize, fixedFont.pointSize()); defaultSettings->setAttribute(QWebEngineSettings::JavascriptEnabled, settings.value(QLatin1String("enableJavascript"), true).toBool()); + +#if defined(QTWEBENGINE_PLUGINS) defaultSettings->setAttribute(QWebEngineSettings::PluginsEnabled, settings.value(QLatin1String("enablePlugins"), true).toBool()); +#endif +#if defined(QTWEBENGINE_USERSTYLESHEET) QUrl url = settings.value(QLatin1String("userStyleSheet")).toUrl(); defaultSettings->setUserStyleSheetUrl(url); - - defaultSettings->setAttribute(QWebEngineSettings::DnsPrefetchEnabled, true); +#endif settings.endGroup(); -#endif } QList BrowserApplication::mainWindows() @@ -278,7 +277,7 @@ void BrowserApplication::clean() void BrowserApplication::saveSession() { -#if defined(QWEBENGINESETTINGS) +#if defined(QTWEBENGINE_PRIVATEBROWSING) QWebEngineSettings *globalSettings = QWebEngineSettings::globalSettings(); if (globalSettings->testAttribute(QWebEngineSettings::PrivateBrowsingEnabled)) return; @@ -466,7 +465,7 @@ BookmarksManager *BrowserApplication::bookmarksManager() QIcon BrowserApplication::icon(const QUrl &url) const { -#if defined(QWEBENGINESETTINGS) +#if defined(QTWEBENGINE_ICONDATABASE) QIcon icon = QWebEngineSettings::iconForUrl(url); if (!icon.isNull()) return icon.pixmap(16, 16); -- cgit v1.2.1