diff options
Diffstat (limited to 'examples')
66 files changed, 1662 insertions, 1451 deletions
diff --git a/examples/webengine/quicknanobrowser/ApplicationRoot.qml b/examples/webengine/quicknanobrowser/ApplicationRoot.qml new file mode 100644 index 000000000..b16ee0078 --- /dev/null +++ b/examples/webengine/quicknanobrowser/ApplicationRoot.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 + +QtObject { + id: root + property Component browserWindowComponent: BrowserWindow { + applicationRoot: root + onClosing: destroy() + } + property Component browserDialogComponent: BrowserDialog { + onClosing: destroy() + } + function createWindow() { return browserWindowComponent.createObject(root) } + function createDialog() { return browserDialogComponent.createObject(root) } + function load(url) { + var browserWindow = createWindow() + browserWindow.currentWebView.url = url + } +} diff --git a/examples/webengine/quicknanobrowser/BrowserDialog.qml b/examples/webengine/quicknanobrowser/BrowserDialog.qml new file mode 100644 index 000000000..302833083 --- /dev/null +++ b/examples/webengine/quicknanobrowser/BrowserDialog.qml @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Window 2.2 +import QtWebEngine 1.0 + +Window { + property alias currentWebView: webView + flags: Qt.Dialog + width: 800 + height: 600 + visible: true + onClosing: destroy() + WebEngineView { + id: webView + anchors.fill: parent + } +} diff --git a/examples/webengine/quicknanobrowser/BrowserWindow.qml b/examples/webengine/quicknanobrowser/BrowserWindow.qml new file mode 100644 index 000000000..a047b2be5 --- /dev/null +++ b/examples/webengine/quicknanobrowser/BrowserWindow.qml @@ -0,0 +1,426 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtWebEngine 1.1 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Styles 1.0 +import QtQuick.Layouts 1.0 +import QtQuick.Window 2.1 +import QtQuick.Controls.Private 1.0 +import QtQuick.Dialogs 1.2 +import Qt.labs.settings 1.0 + +ApplicationWindow { + id: browserWindow + property QtObject applicationRoot + property Item currentWebView: tabs.currentIndex < tabs.count ? tabs.getTab(tabs.currentIndex).item : null + property int previousVisibility: Window.Windowed + + property bool isFullScreen: visibility == Window.FullScreen + onIsFullScreenChanged: { + // This is for the case where the system forces us to leave fullscreen. + if (currentWebView && !isFullScreen) { + currentWebView.state = "" + if (currentWebView.isFullScreen) + currentWebView.fullScreenCancelled() + } + } + + width: 1300 + height: 900 + visible: true + title: currentWebView && currentWebView.title + + // Make sure the Qt.WindowFullscreenButtonHint is set on OS X. + Component.onCompleted: flags = flags | Qt.WindowFullscreenButtonHint + + // Create a styleItem to determine the platform. + // When using style "mac", ToolButtons are not supposed to accept focus. + StyleItem { id: styleItem } + property bool platformIsMac: styleItem.style == "mac" + + Settings { + id : appSettings + property alias autoLoadImages: loadImages.checked; + property alias javaScriptEnabled: javaScriptEnabled.checked; + property alias errorPageEnabled: errorPageEnabled.checked; + } + + WebEngineProfile { + id: defaultProfile + storageName: "Default" + httpCacheType: httpDiskCacheEnabled.checked ? WebEngineProfile.DiskHttpCache : WebEngineProfile.MemoryHttpCache; + onDownloadRequested: { + downloadView.visible = true + downloadView.append(download) + download.accept() + } + } + + WebEngineProfile { + id: otrProfile + offTheRecord: true + } + + Action { + shortcut: "Ctrl+D" + onTriggered: { + downloadView.visible = !downloadView.visible + } + } + Action { + id: focus + shortcut: "Ctrl+L" + onTriggered: { + addressBar.forceActiveFocus(); + addressBar.selectAll(); + } + } + Action { + shortcut: "Ctrl+R" + onTriggered: { + if (currentWebView) + currentWebView.reload() + } + } + Action { + shortcut: "Ctrl+T" + onTriggered: { + tabs.createEmptyTab() + tabs.currentIndex = tabs.count - 1 + addressBar.forceActiveFocus(); + addressBar.selectAll(); + } + } + Action { + shortcut: "Ctrl+W" + onTriggered: { + if (tabs.count == 1) + browserWindow.close() + else + tabs.removeTab(tabs.currentIndex) + } + } + Action { + shortcut: "Escape" + onTriggered: { + if (browserWindow.isFullScreen) + browserWindow.visibility = browserWindow.previousVisibility + } + } + Action { + shortcut: "Ctrl+0" + onTriggered: currentWebView.zoomFactor = 1.0; + } + Action { + shortcut: "Ctrl+-" + onTriggered: currentWebView.zoomFactor -= 0.1; + } + Action { + shortcut: "Ctrl+=" + onTriggered: currentWebView.zoomFactor += 0.1; + } + + toolBar: ToolBar { + id: navigationBar + RowLayout { + anchors.fill: parent; + ToolButton { + enabled: currentWebView && (currentWebView.canGoBack || currentWebView.canGoForward) + menu:Menu { + id: historyMenu + + Instantiator { + model: currentWebView && currentWebView.navigationHistory.items + MenuItem { + text: model.title + onTriggered: currentWebView.goBackOrForward(model.offset) + checkable: !enabled + checked: !enabled + enabled: model.offset + } + + onObjectAdded: historyMenu.insertItem(index, object) + onObjectRemoved: historyMenu.removeItem(object) + } + } + } + + ToolButton { + id: backButton + iconSource: "icons/go-previous.png" + onClicked: currentWebView.goBack() + enabled: currentWebView && currentWebView.canGoBack + activeFocusOnTab: !browserWindow.platformIsMac + } + ToolButton { + id: forwardButton + iconSource: "icons/go-next.png" + onClicked: currentWebView.goForward() + enabled: currentWebView && currentWebView.canGoForward + activeFocusOnTab: !browserWindow.platformIsMac + } + ToolButton { + id: reloadButton + iconSource: currentWebView && currentWebView.loading ? "icons/process-stop.png" : "icons/view-refresh.png" + onClicked: currentWebView && currentWebView.loading ? currentWebView.stop() : currentWebView.reload() + activeFocusOnTab: !browserWindow.platformIsMac + } + TextField { + id: addressBar + Image { + anchors.verticalCenter: addressBar.verticalCenter; + x: 5 + z: 2 + id: faviconImage + width: 16; height: 16 + source: currentWebView && currentWebView.icon + } + style: TextFieldStyle { + padding { + left: 26; + } + } + focus: true + Layout.fillWidth: true + text: currentWebView && currentWebView.url + onAccepted: currentWebView.url = utils.fromUserInput(text) + } + ToolButton { + id: settingsMenuButton + menu: Menu { + MenuItem { + id: loadImages + text: "Autoload images" + checkable: true + checked: WebEngine.settings.autoLoadImages + } + MenuItem { + id: javaScriptEnabled + text: "JavaScript On" + checkable: true + checked: WebEngine.settings.javascriptEnabled + } + MenuItem { + id: errorPageEnabled + text: "ErrorPage On" + checkable: true + checked: WebEngine.settings.errorPageEnabled + } + MenuItem { + id: offTheRecordEnabled + text: "Off The Record" + checkable: true + checked: false + } + MenuItem { + id: httpDiskCacheEnabled + text: "HTTP Disk Cache" + checkable: true + checked: (defaultProfile.httpCacheType == WebEngineProfile.DiskHttpCache) + } + } + } + } + ProgressBar { + id: progressBar + height: 3 + anchors { + left: parent.left + top: parent.bottom + right: parent.right + leftMargin: -parent.leftMargin + rightMargin: -parent.rightMargin + } + style: ProgressBarStyle { + background: Item {} + } + z: -2; + minimumValue: 0 + maximumValue: 100 + value: (currentWebView && currentWebView.loadProgress < 100) ? currentWebView.loadProgress : 0 + } + } + + TabView { + id: tabs + function createEmptyTab() { + var tab = addTab("", tabComponent) + // We must do this first to make sure that tab.active gets set so that tab.item gets instantiated immediately. + tab.active = true + tab.title = Qt.binding(function() { return tab.item.title }) + return tab + } + + anchors.fill: parent + Component.onCompleted: createEmptyTab() + + Component { + id: tabComponent + WebEngineView { + id: webEngineView + focus: true + profile: offTheRecordEnabled.checked ? otrProfile : defaultProfile + + onLinkHovered: { + if (hoveredUrl == "") + resetStatusText.start() + else { + resetStatusText.stop() + statusText.text = hoveredUrl + } + } + + states: [ + State { + name: "FullScreen" + PropertyChanges { + target: tabs + frameVisible: false + tabsVisible: false + } + PropertyChanges { + target: navigationBar + visible: false + } + } + ] + settings.autoLoadImages: appSettings.autoLoadImages + settings.javascriptEnabled: appSettings.javaScriptEnabled + settings.errorPageEnabled: appSettings.errorPageEnabled + + onCertificateError: { + error.defer() + sslDialog.enqueue(error) + } + + onNewViewRequested: { + if (!request.userInitiated) + print("Warning: Blocked a popup window.") + else if (request.destination == WebEngineView.NewViewInTab) { + var tab = tabs.createEmptyTab() + tabs.currentIndex = tabs.count - 1 + request.openIn(tab.item) + } else if (request.destination == WebEngineView.NewViewInBackgroundTab) { + var tab = tabs.createEmptyTab() + request.openIn(tab.item) + } else if (request.destination == WebEngineView.NewViewInDialog) { + var dialog = applicationRoot.createDialog() + request.openIn(dialog.currentWebView) + } else { + var window = applicationRoot.createWindow() + request.openIn(window.currentWebView) + } + } + + onFullScreenRequested: { + if (request.toggleOn) { + webEngineView.state = "FullScreen" + browserWindow.previousVisibility = browserWindow.visibility + browserWindow.showFullScreen() + } else { + webEngineView.state = "" + browserWindow.visibility = browserWindow.previousVisibility + } + request.accept() + } + } + } + } + MessageDialog { + id: sslDialog + + property var certErrors: [] + icon: StandardIcon.Warning + standardButtons: StandardButton.No | StandardButton.Yes + title: "Server's certificate not trusted" + text: "Do you wish to continue?" + detailedText: "If you wish so, you may continue with an unverified certificate. " + + "Accepting an unverified certificate means " + + "you may not be connected with the host you tried to connect to.\n" + + "Do you wish to override the security check and continue?" + onYes: { + certErrors.shift().ignoreCertificateError() + presentError() + } + onNo: reject() + onRejected: reject() + + function reject(){ + certErrors.shift().rejectCertificate() + presentError() + } + function enqueue(error){ + certErrors.push(error) + presentError() + } + function presentError(){ + visible = certErrors.length > 0 + } + } + DownloadView { + id: downloadView + visible: false + anchors.fill: parent + } + Rectangle { + id: statusBubble + color: "oldlace" + property int padding: 8 + + anchors.left: parent.left + anchors.bottom: parent.bottom + width: statusText.paintedWidth + padding + height: statusText.paintedHeight + padding + + Text { + id: statusText + anchors.centerIn: statusBubble + elide: Qt.ElideMiddle + + Timer { + id: resetStatusText + interval: 750 + onTriggered: statusText.text = "" + } + } + } +} diff --git a/examples/webengine/quicknanobrowser/DownloadView.qml b/examples/webengine/quicknanobrowser/DownloadView.qml new file mode 100644 index 000000000..9a5cdd28f --- /dev/null +++ b/examples/webengine/quicknanobrowser/DownloadView.qml @@ -0,0 +1,165 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Styles 1.0 +import QtWebEngine 1.0 +import QtQuick.Layouts 1.0 + +Rectangle { + id: downloadView + color: "lightgray" + + ListModel { + id: downloadModel + property var downloads: [] + } + + function append(download) { + downloadModel.append(download) + downloadModel.downloads.push(download) + } + + Component { + id: downloadItemDelegate + + Rectangle { + width: listView.width + height: childrenRect.height + anchors.margins: 10 + radius: 3 + color: "transparent" + border.color: "black" + Rectangle { + id: progressBar + + property real progress: downloadModel.downloads[index] + ? downloadModel.downloads[index].receivedBytes / downloadModel.downloads[index].totalBytes : 0 + + radius: 3 + color: width == listView.width ? "green" : "#2b74c7" + width: listView.width * progress + height: cancelButton.height + + Behavior on width { + SmoothedAnimation { duration: 100 } + } + } + Rectangle { + anchors { + left: parent.left + right: parent.right + leftMargin: 20 + } + Label { + id: label + text: path + anchors { + verticalCenter: cancelButton.verticalCenter + left: parent.left + right: cancelButton.left + } + } + Button { + id: cancelButton + anchors.right: parent.right + iconSource: "icons/process-stop.png" + onClicked: { + var download = downloadModel.downloads[index] + + download.cancel() + + downloadModel.downloads = downloadModel.downloads.filter(function (el) { + return el.id !== download.id; + }); + downloadModel.remove(index) + } + } + } + } + + } + ListView { + id: listView + anchors { + topMargin: 10 + top: parent.top + bottom: parent.bottom + horizontalCenter: parent.horizontalCenter + } + width: parent.width - 20 + spacing: 5 + + model: downloadModel + delegate: downloadItemDelegate + + Text { + visible: !listView.count + horizontalAlignment: Text.AlignHCenter + height: 30 + anchors { + top: parent.top + left: parent.left + right: parent.right + } + font.pixelSize: 20 + text: "No active downloads." + } + + Rectangle { + color: "gray" + anchors { + bottom: parent.bottom + left: parent.left + right: parent.right + } + height: 30 + Button { + id: okButton + text: "OK" + anchors.centerIn: parent + onClicked: { + downloadView.visible = false + } + } + } + } +} diff --git a/examples/webengine/quicknanobrowser/doc/src/quicknanobrowser.qdoc b/examples/webengine/quicknanobrowser/doc/src/quicknanobrowser.qdoc index e42637073..4fac9fe09 100644 --- a/examples/webengine/quicknanobrowser/doc/src/quicknanobrowser.qdoc +++ b/examples/webengine/quicknanobrowser/doc/src/quicknanobrowser.qdoc @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. ** @@ -10,15 +10,15 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure +** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: http://www.gnu.org/copyleft/fdl.html. ** $QT_END_LICENSE$ diff --git a/examples/webengine/quicknanobrowser/main.cpp b/examples/webengine/quicknanobrowser/main.cpp index d5a4ade55..455c409a1 100644 --- a/examples/webengine/quicknanobrowser/main.cpp +++ b/examples/webengine/quicknanobrowser/main.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWebEngine module of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -39,7 +39,8 @@ ** ****************************************************************************/ -#include "quickwindow.h" +#include "utils.h" + #ifndef QT_NO_WIDGETS #include <QtWidgets/QApplication> typedef QApplication Application; @@ -47,15 +48,36 @@ typedef QApplication Application; #include <QtGui/QGuiApplication> typedef QGuiApplication Application; #endif +#include <QtQml/QQmlApplicationEngine> +#include <QtQml/QQmlContext> #include <QtWebEngine/qtwebengineglobal.h> +static QUrl startupUrl() +{ + QUrl ret; + QStringList args(qApp->arguments()); + args.takeFirst(); + Q_FOREACH (const QString& arg, args) { + if (arg.startsWith(QLatin1Char('-'))) + continue; + ret = Utils::fromUserInput(arg); + if (ret.isValid()) + return ret; + } + return QUrl(QStringLiteral("http://qt.io/")); +} + int main(int argc, char **argv) { Application app(argc, argv); QtWebEngine::initialize(); - ApplicationEngine appEngine; + QQmlApplicationEngine appEngine; + Utils utils; + appEngine.rootContext()->setContextProperty("utils", &utils); + appEngine.load(QUrl("qrc:/ApplicationRoot.qml")); + QMetaObject::invokeMethod(appEngine.rootObjects().first(), "load", Q_ARG(QVariant, startupUrl())); return app.exec(); } diff --git a/examples/webengine/quicknanobrowser/quicknanobrowser.pro b/examples/webengine/quicknanobrowser/quicknanobrowser.pro index a8e57b0a4..1447af927 100644 --- a/examples/webengine/quicknanobrowser/quicknanobrowser.pro +++ b/examples/webengine/quicknanobrowser/quicknanobrowser.pro @@ -3,12 +3,13 @@ requires(contains(QT_CONFIG, accessibility)) TEMPLATE = app TARGET = quicknanobrowser -HEADERS = quickwindow.h \ - util.h -SOURCES = quickwindow.cpp \ - main.cpp +HEADERS = utils.h +SOURCES = main.cpp -OTHER_FILES += quickwindow.qml +OTHER_FILES += ApplicationRoot.qml \ + BrowserDialog.qml \ + BrowserWindow.qml \ + DownloadView.qml RESOURCES += resources.qrc diff --git a/examples/webengine/quicknanobrowser/quickwindow.cpp b/examples/webengine/quicknanobrowser/quickwindow.cpp deleted file mode 100644 index ec7b6f94a..000000000 --- a/examples/webengine/quicknanobrowser/quickwindow.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "quickwindow.h" - -#include "util.h" - -#include <QFileInfo> -#include <QObject> -#include <QQmlContext> -#include <QQmlEngine> -#include <QUrl> - -class Utils : public QObject { - Q_OBJECT -public: - Utils(QObject* parent = 0) : QObject(parent) { } - Q_INVOKABLE static QUrl fromUserInput(const QString& userInput) { return urlFromUserInput(userInput); } -}; - -#include "quickwindow.moc" - -ApplicationEngine::ApplicationEngine() -{ - rootContext()->setContextProperty("utils", new Utils(this)); - load(QUrl("qrc:/quickwindow.qml")); - QMetaObject::invokeMethod(rootObjects().first(), "load", Q_ARG(QVariant, startupUrl())); -} diff --git a/examples/webengine/quicknanobrowser/quickwindow.qml b/examples/webengine/quicknanobrowser/quickwindow.qml deleted file mode 100644 index 610144dca..000000000 --- a/examples/webengine/quicknanobrowser/quickwindow.qml +++ /dev/null @@ -1,215 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.1 -import QtWebEngine 1.0 -import QtQuick.Controls 1.0 -import QtQuick.Controls.Styles 1.0 -import QtQuick.Layouts 1.0 -import QtQuick.Window 2.1 -import QtQuick.Controls.Private 1.0 - -ApplicationWindow { - id: browserWindow - function load(url) { currentWebView.url = url } - property Item currentWebView: tabs.currentIndex < tabs.count ? tabs.getTab(tabs.currentIndex).item : null - - width: 1300 - height: 900 - visible: true - title: currentWebView && currentWebView.title - - // Create a styleItem to determine the platform. - // When using style "mac", ToolButtons are not supposed to accept focus. - StyleItem { id: styleItem } - property bool platformIsMac: styleItem.style == "mac" - - Action { - id: focus - shortcut: "Ctrl+L" - onTriggered: { - addressBar.forceActiveFocus(); - addressBar.selectAll(); - } - } - Action { - shortcut: "Ctrl+R" - onTriggered: { - if (currentWebView) - currentWebView.reload() - } - } - Action { - shortcut: "Ctrl+T" - onTriggered: { - tabs.createEmptyTab() - addressBar.forceActiveFocus(); - addressBar.selectAll(); - } - } - Action { - shortcut: "Ctrl+W" - onTriggered: { - if (tabs.count == 1) - browserWindow.close() - else - tabs.removeTab(tabs.currentIndex) - } - } - - toolBar: ToolBar { - id: navigationBar - RowLayout { - anchors.fill: parent; - ToolButton { - id: backButton - iconSource: "icons/go-previous.png" - onClicked: currentWebView.goBack() - enabled: currentWebView && currentWebView.canGoBack - activeFocusOnTab: !browserWindow.platformIsMac - } - ToolButton { - id: forwardButton - iconSource: "icons/go-next.png" - onClicked: currentWebView.goForward() - enabled: currentWebView && currentWebView.canGoForward - activeFocusOnTab: !browserWindow.platformIsMac - } - ToolButton { - id: reloadButton - iconSource: currentWebView && currentWebView.loading ? "icons/process-stop.png" : "icons/view-refresh.png" - onClicked: currentWebView && currentWebView.loading ? currentWebView.stop() : currentWebView.reload() - activeFocusOnTab: !browserWindow.platformIsMac - } - TextField { - id: addressBar - Image { - anchors.verticalCenter: addressBar.verticalCenter; - x: 5 - z: 2 - id: faviconImage - width: 16; height: 16 - source: currentWebView && currentWebView.icon - } - style: TextFieldStyle { - padding { - left: 26; - } - } - focus: true - Layout.fillWidth: true - text: currentWebView && currentWebView.url - onAccepted: currentWebView.url = utils.fromUserInput(text) - } - } - ProgressBar { - id: progressBar - height: 3 - anchors { - left: parent.left - top: parent.bottom - right: parent.right - leftMargin: -parent.leftMargin - rightMargin: -parent.rightMargin - } - style: ProgressBarStyle { - background: Item {} - } - z: -2; - minimumValue: 0 - maximumValue: 100 - value: (currentWebView && currentWebView.loadProgress < 100) ? currentWebView.loadProgress : 0 - } - } - - TabView { - id: tabs - function createEmptyTab() { - var tab = addTab("", tabComponent) - // We must do this first to make sure that tab.active gets set so that tab.item gets instantiated immediately. - tabs.currentIndex = tabs.count - 1 - tab.title = Qt.binding(function() { return tab.item.title }) - return tab - } - - anchors.fill: parent - Component.onCompleted: createEmptyTab() - - Component { - id: tabComponent - WebEngineView { - id: webEngineView - focus: true - - onLinkHovered: { - if (hoveredUrl == "") - resetStatusText.start() - else { - resetStatusText.stop() - statusText.text = hoveredUrl - } - } - } - } - } - - Rectangle { - id: statusBubble - color: "oldlace" - property int padding: 8 - - anchors.left: parent.left - anchors.bottom: parent.bottom - width: statusText.paintedWidth + padding - height: statusText.paintedHeight + padding - - Text { - id: statusText - anchors.centerIn: statusBubble - elide: Qt.ElideMiddle - - Timer { - id: resetStatusText - interval: 750 - onTriggered: statusText.text = "" - } - } - } -} diff --git a/examples/webengine/quicknanobrowser/resources.qrc b/examples/webengine/quicknanobrowser/resources.qrc index 549207726..28fd7b7dc 100644 --- a/examples/webengine/quicknanobrowser/resources.qrc +++ b/examples/webengine/quicknanobrowser/resources.qrc @@ -1,6 +1,9 @@ <!DOCTYPE RCC><RCC version="1.0"> <qresource prefix="/"> - <file>quickwindow.qml</file> + <file>ApplicationRoot.qml</file> + <file>BrowserDialog.qml</file> + <file>BrowserWindow.qml</file> + <file>DownloadView.qml</file> </qresource> <qresource prefix="icons"> <file alias="go-next.png">icons/go-next.png</file> diff --git a/examples/webengine/quicknanobrowser/util.h b/examples/webengine/quicknanobrowser/util.h deleted file mode 100644 index bc1cf8beb..000000000 --- a/examples/webengine/quicknanobrowser/util.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef UTIL_H -#define UTIL_H - -#include <QtCore/QCoreApplication> -#include <QtCore/QFileInfo> -#include <QtCore/QUrl> -#include <QtCore/QStringList> - -QUrl urlFromUserInput(const QString& userInput) -{ - QFileInfo fileInfo(userInput); - if (fileInfo.exists()) - return QUrl(fileInfo.absoluteFilePath()); - return QUrl::fromUserInput(userInput); -} - -QUrl startupUrl() -{ - QUrl ret; - QStringList args(qApp->arguments()); - args.takeFirst(); - Q_FOREACH (const QString& arg, args) { - if (arg.startsWith(QLatin1Char('-'))) - continue; - ret = urlFromUserInput(arg); - if (ret.isValid()) - return ret; - } - return QUrl(QStringLiteral("http://qt.io/")); -} - - -#endif // UTIL_H diff --git a/examples/webengine/quicknanobrowser/quickwindow.h b/examples/webengine/quicknanobrowser/utils.h index ed25a23b8..0f4460dfe 100644 --- a/examples/webengine/quicknanobrowser/quickwindow.h +++ b/examples/webengine/quicknanobrowser/utils.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWebEngine module of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -38,18 +38,24 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#ifndef UTILS_H +#define UTILS_H -#ifndef QUICKWINDOW_H -#define QUICKWINDOW_H +#include <QtCore/QFileInfo> +#include <QtCore/QUrl> -#include <QQmlApplicationEngine> - -class QWebEngineView; - -class ApplicationEngine : public QQmlApplicationEngine { +class Utils : public QObject { Q_OBJECT public: - ApplicationEngine(); + Q_INVOKABLE static QUrl fromUserInput(const QString& userInput); }; -#endif // QUICKWINDOW_H +inline QUrl Utils::fromUserInput(const QString& userInput) +{ + QFileInfo fileInfo(userInput); + if (fileInfo.exists()) + return QUrl::fromLocalFile(fileInfo.absoluteFilePath()); + return QUrl::fromUserInput(userInput); +} + +#endif // UTILS_H diff --git a/examples/webenginewidgets/browser/Info_mac.plist b/examples/webenginewidgets/browser/Info_mac.plist index 87435b2b6..ccd4b3f28 100644 --- a/examples/webenginewidgets/browser/Info_mac.plist +++ b/examples/webenginewidgets/browser/Info_mac.plist @@ -1,7 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> -<plist version="0.9"> +<plist version="1.0"> <dict> + <key>NSPrincipalClass</key> + <string>NSApplication</string> <key>CFBundleIconFile</key> <string>@ICON@</string> <key>CFBundlePackageType</key> @@ -38,6 +40,6 @@ </dict> </array> <key>NOTE</key> - <string>DemoBrowser by Digia Plc and/or its subsidiary(-ies)</string> + <string>DemoBrowser by The Qt Company Ltd.</string> </dict> </plist> diff --git a/examples/webenginewidgets/browser/autosaver.cpp b/examples/webenginewidgets/browser/autosaver.cpp index a6efa4ca1..dc72090dd 100644 --- a/examples/webenginewidgets/browser/autosaver.cpp +++ b/examples/webenginewidgets/browser/autosaver.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/autosaver.h b/examples/webenginewidgets/browser/autosaver.h index cf499b066..b0c73846f 100644 --- a/examples/webenginewidgets/browser/autosaver.h +++ b/examples/webenginewidgets/browser/autosaver.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/bookmarks.cpp b/examples/webenginewidgets/browser/bookmarks.cpp index 616065816..15078caa3 100644 --- a/examples/webenginewidgets/browser/bookmarks.cpp +++ b/examples/webenginewidgets/browser/bookmarks.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/bookmarks.h b/examples/webenginewidgets/browser/bookmarks.h index be29666df..244f003c6 100644 --- a/examples/webenginewidgets/browser/bookmarks.h +++ b/examples/webenginewidgets/browser/bookmarks.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/browser.pro b/examples/webenginewidgets/browser/browser.pro index c9bf1a9e0..f54186856 100644 --- a/examples/webenginewidgets/browser/browser.pro +++ b/examples/webenginewidgets/browser/browser.pro @@ -2,8 +2,6 @@ TEMPLATE = app TARGET = browser QT += webenginewidgets network widgets printsupport -macx: CONFIG -= app_bundle - qtHaveModule(uitools):!embedded: QT += uitools else: DEFINES += QT_NO_UITOOLS @@ -82,20 +80,6 @@ mac { ICON = browser.icns QMAKE_INFO_PLIST = Info_mac.plist TARGET = Browser - - # No 64-bit Flash on Mac, so build the browser 32-bit - contains(QT_CONFIG, x86) { - CONFIG -= x86_64 - CONFIG += x86 - } - contains(QT_CONFIG, ppc) { - CONFIG -= ppc64 - CONFIG += ppc - } -} - -wince*: { - DEPLOYMENT_PLUGIN += qjpeg qgif } EXAMPLE_FILES = Info_mac.plist browser.icns browser.ico browser.rc diff --git a/examples/webenginewidgets/browser/browserapplication.cpp b/examples/webenginewidgets/browser/browserapplication.cpp index 44713901d..b1426ea24 100644 --- a/examples/webenginewidgets/browser/browserapplication.cpp +++ b/examples/webenginewidgets/browser/browserapplication.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -66,7 +66,10 @@ #include <QtNetwork/QNetworkProxy> #include <QtNetwork/QSslSocket> +#include <QWebEngineProfile> #include <QWebEngineSettings> +#include <QWebEngineScript> +#include <QWebEngineScriptCollection> #include <QtCore/QDebug> @@ -75,6 +78,41 @@ HistoryManager *BrowserApplication::s_historyManager = 0; QNetworkAccessManager *BrowserApplication::s_networkAccessManager = 0; BookmarksManager *BrowserApplication::s_bookmarksManager = 0; +static void setUserStyleSheet(QWebEngineProfile *profile, const QString &styleSheet, BrowserMainWindow *mainWindow = 0) +{ + Q_ASSERT(profile); + QString scriptName(QStringLiteral("userStyleSheet")); + QWebEngineScript script; + QList<QWebEngineScript> styleSheets = profile->scripts().findScripts(scriptName); + if (!styleSheets.isEmpty()) + script = styleSheets.first(); + Q_FOREACH (const QWebEngineScript &s, styleSheets) + profile->scripts().remove(s); + + if (script.isNull()) { + script.setName(scriptName); + script.setInjectionPoint(QWebEngineScript::DocumentReady); + script.setRunsOnSubFrames(true); + script.setWorldId(QWebEngineScript::ApplicationWorld); + } + QString source = QString::fromLatin1("(function() {"\ + "var css = document.getElementById(\"_qt_testBrowser_userStyleSheet\");"\ + "if (css == undefined) {"\ + " css = document.createElement(\"style\");"\ + " css.type = \"text/css\";"\ + " css.id = \"_qt_testBrowser_userStyleSheet\";"\ + " document.head.appendChild(css);"\ + "}"\ + "css.innerText = \"%1\";"\ + "})()").arg(styleSheet); + script.setSourceCode(source); + profile->scripts().insert(script); + // run the script on the already loaded views + // this has to be deferred as it could mess with the storage initialization on startup + if (mainWindow) + QMetaObject::invokeMethod(mainWindow, "runScriptOnOpenViews", Qt::QueuedConnection, Q_ARG(QString, source)); +} + BrowserApplication::BrowserApplication(int &argc, char **argv) : QApplication(argc, argv) , m_localServer(0) @@ -179,7 +217,7 @@ void BrowserApplication::quitBrowser() clean(); int tabCount = 0; for (int i = 0; i < m_mainWindows.count(); ++i) { - tabCount =+ m_mainWindows.at(i)->tabWidget()->count(); + tabCount += m_mainWindows.at(i)->tabWidget()->count(); } if (tabCount > 1) { @@ -230,6 +268,8 @@ void BrowserApplication::loadSettings() settings.beginGroup(QLatin1String("websettings")); QWebEngineSettings *defaultSettings = QWebEngineSettings::globalSettings(); + QWebEngineProfile *defaultProfile = QWebEngineProfile::defaultProfile(); + QString standardFontFamily = defaultSettings->fontFamily(QWebEngineSettings::StandardFont); int standardFontSize = defaultSettings->fontSize(QWebEngineSettings::DefaultFontSize); QFont standardFont = QFont(standardFontFamily, standardFontSize); @@ -251,10 +291,17 @@ void BrowserApplication::loadSettings() 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); -#endif + QString css = settings.value(QLatin1String("userStyleSheet")).toString(); + setUserStyleSheet(defaultProfile, css, mainWindow()); + + defaultProfile->setHttpUserAgent(settings.value(QLatin1String("httpUserAgent")).toString()); + settings.endGroup(); + settings.beginGroup(QLatin1String("cookies")); + + QWebEngineProfile::PersistentCookiesPolicy persistentCookiesPolicy = QWebEngineProfile::PersistentCookiesPolicy(settings.value(QLatin1String("persistentCookiesPolicy")).toInt()); + defaultProfile->setPersistentCookiesPolicy(persistentCookiesPolicy); + QString pdataPath = settings.value(QLatin1String("persistentDataPath")).toString(); + defaultProfile->setPersistentStoragePath(pdataPath); settings.endGroup(); } diff --git a/examples/webenginewidgets/browser/browserapplication.h b/examples/webenginewidgets/browser/browserapplication.h index acb03ded5..97df0e431 100644 --- a/examples/webenginewidgets/browser/browserapplication.h +++ b/examples/webenginewidgets/browser/browserapplication.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/browsermainwindow.cpp b/examples/webenginewidgets/browser/browsermainwindow.cpp index cce603cff..98f61d6cb 100644 --- a/examples/webenginewidgets/browser/browsermainwindow.cpp +++ b/examples/webenginewidgets/browser/browsermainwindow.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -269,6 +269,12 @@ bool BrowserMainWindow::restoreState(const QByteArray &state) return true; } +void BrowserMainWindow::runScriptOnOpenViews(const QString &source) +{ + for (int i =0; i < tabWidget()->count(); ++i) + tabWidget()->webView(i)->page()->runJavaScript(source); +} + void BrowserMainWindow::setupMenu() { new QShortcut(QKeySequence(Qt::Key_F6), this, SLOT(slotSwapFocus())); @@ -284,7 +290,7 @@ void BrowserMainWindow::setupMenu() fileMenu->addSeparator(); fileMenu->addAction(m_tabWidget->closeTabAction()); fileMenu->addSeparator(); -#if defined(QWEBENGINEPAGE_SETNETWORKACCESSMANAGER) +#if defined(QWEBENGINE_SAVE_AS_FILE) fileMenu->addAction(tr("&Save As..."), this, SLOT(slotFileSaveAs()), QKeySequence(QKeySequence::Save)); fileMenu->addSeparator(); @@ -603,7 +609,7 @@ void BrowserMainWindow::slotSelectLineEdit() void BrowserMainWindow::slotFileSaveAs() { - BrowserApplication::downloadManager()->download(currentTab()->url(), true); + // not implemented yet. } void BrowserMainWindow::slotPreferences() @@ -940,10 +946,8 @@ void BrowserMainWindow::slotAboutToShowWindowMenu() m_windowMenu->addAction(m_tabWidget->nextTabAction()); m_windowMenu->addAction(m_tabWidget->previousTabAction()); m_windowMenu->addSeparator(); -#if defined(QWEBENGINEPAGE_SETNETWORKACCESSMANAGER) m_windowMenu->addAction(tr("Downloads"), this, SLOT(slotDownloadManager()), QKeySequence(tr("Alt+Ctrl+L", "Download Manager"))); m_windowMenu->addSeparator(); -#endif QList<BrowserMainWindow*> windows = BrowserApplication::instance()->mainWindows(); for (int i = 0; i < windows.count(); ++i) { diff --git a/examples/webenginewidgets/browser/browsermainwindow.h b/examples/webenginewidgets/browser/browsermainwindow.h index da767e35e..831504700 100644 --- a/examples/webenginewidgets/browser/browsermainwindow.h +++ b/examples/webenginewidgets/browser/browsermainwindow.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -77,6 +77,7 @@ public: WebView *currentTab() const; QByteArray saveState(bool withTabs = true) const; bool restoreState(const QByteArray &state); + Q_INVOKABLE void runScriptOnOpenViews(const QString &); public slots: void loadPage(const QString &url); diff --git a/examples/webenginewidgets/browser/chasewidget.cpp b/examples/webenginewidgets/browser/chasewidget.cpp index c34dde739..fb0e9ce76 100644 --- a/examples/webenginewidgets/browser/chasewidget.cpp +++ b/examples/webenginewidgets/browser/chasewidget.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/chasewidget.h b/examples/webenginewidgets/browser/chasewidget.h index 2c57d08ac..a90389034 100644 --- a/examples/webenginewidgets/browser/chasewidget.h +++ b/examples/webenginewidgets/browser/chasewidget.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/cookiejar.cpp b/examples/webenginewidgets/browser/cookiejar.cpp index 0b94d9903..d9a7465ca 100644 --- a/examples/webenginewidgets/browser/cookiejar.cpp +++ b/examples/webenginewidgets/browser/cookiejar.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/cookiejar.h b/examples/webenginewidgets/browser/cookiejar.h index 1cc7800e1..374156e89 100644 --- a/examples/webenginewidgets/browser/cookiejar.h +++ b/examples/webenginewidgets/browser/cookiejar.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/data/browser.svg b/examples/webenginewidgets/browser/data/browser.svg index 8795187b1..2127a0a6e 100644 --- a/examples/webenginewidgets/browser/data/browser.svg +++ b/examples/webenginewidgets/browser/data/browser.svg @@ -276,7 +276,7 @@ </dc:creator> <dc:rights> <cc:Agent> - <dc:title>Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).</dc:title> + <dc:title>Copyright (C) 2015 The Qt Company Ltd.</dc:title> </cc:Agent> </dc:rights> </cc:Work> diff --git a/examples/webenginewidgets/browser/doc/src/browser.qdoc b/examples/webenginewidgets/browser/doc/src/browser.qdoc index f4a51518b..99581d8a9 100644 --- a/examples/webenginewidgets/browser/doc/src/browser.qdoc +++ b/examples/webenginewidgets/browser/doc/src/browser.qdoc @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. ** @@ -10,15 +10,15 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure +** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: http://www.gnu.org/copyleft/fdl.html. ** $QT_END_LICENSE$ diff --git a/examples/webenginewidgets/browser/downloaditem.ui b/examples/webenginewidgets/browser/downloaditem.ui index 4a0a0fd9a..b7f7deb72 100644 --- a/examples/webenginewidgets/browser/downloaditem.ui +++ b/examples/webenginewidgets/browser/downloaditem.ui @@ -82,16 +82,6 @@ </spacer> </item> <item> - <widget class="QPushButton" name="tryAgainButton" > - <property name="enabled" > - <bool>false</bool> - </property> - <property name="text" > - <string>Try Again</string> - </property> - </widget> - </item> - <item> <widget class="QPushButton" name="stopButton" > <property name="text" > <string>Stop</string> diff --git a/examples/webenginewidgets/browser/downloadmanager.cpp b/examples/webenginewidgets/browser/downloadmanager.cpp index 1ed27e642..9609589d7 100644 --- a/examples/webenginewidgets/browser/downloadmanager.cpp +++ b/examples/webenginewidgets/browser/downloadmanager.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -58,48 +58,43 @@ #include <QtCore/QDebug> #include <QWebEngineSettings> +#include <QWebEngineDownloadItem> /*! - DownloadItem is a widget that is displayed in the download manager list. - It moves the data from the QNetworkReply into the QFile as well + DownloadWidget is a widget that is displayed in the download manager list. + It moves the data from the QWebEngineDownloadItem into the QFile as well as update the information/progressbar and report errors. */ -DownloadItem::DownloadItem(QNetworkReply *reply, bool requestFileName, QWidget *parent) + +DownloadWidget::DownloadWidget(QWebEngineDownloadItem *download, QWidget *parent) : QWidget(parent) - , m_reply(reply) - , m_requestFileName(requestFileName) , m_bytesReceived(0) + , m_download(download) { setupUi(this); QPalette p = downloadInfoLabel->palette(); p.setColor(QPalette::Text, Qt::darkGray); downloadInfoLabel->setPalette(p); progressBar->setMaximum(0); - tryAgainButton->hide(); connect(stopButton, SIGNAL(clicked()), this, SLOT(stop())); connect(openButton, SIGNAL(clicked()), this, SLOT(open())); - connect(tryAgainButton, SIGNAL(clicked()), this, SLOT(tryAgain())); + + if (download) { + m_file.setFile(download->path()); + m_url = download->url(); + } init(); } -void DownloadItem::init() +void DownloadWidget::init() { - if (!m_reply) - return; - - // attach to the m_reply - m_url = m_reply->url(); - m_reply->setParent(this); - connect(m_reply, SIGNAL(readyRead()), this, SLOT(downloadReadyRead())); - connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), - this, SLOT(error(QNetworkReply::NetworkError))); - connect(m_reply, SIGNAL(downloadProgress(qint64,qint64)), - this, SLOT(downloadProgress(qint64,qint64))); - connect(m_reply, SIGNAL(metaDataChanged()), - this, SLOT(metaDataChanged())); - connect(m_reply, SIGNAL(finished()), - this, SLOT(finished())); + if (m_download) { + connect(m_download.data(), SIGNAL(downloadProgress(qint64,qint64)), + this, SLOT(downloadProgress(qint64,qint64))); + connect(m_download.data(), SIGNAL(finished()), + this, SLOT(finished())); + } // reset info downloadInfoLabel->clear(); @@ -108,139 +103,58 @@ void DownloadItem::init() // start timer for the download estimation m_downloadTime.start(); - - if (m_reply->error() != QNetworkReply::NoError) { - error(m_reply->error()); - finished(); - } } -void DownloadItem::getFileName() +bool DownloadWidget::getFileName(bool promptForFileName) { QSettings settings; settings.beginGroup(QLatin1String("downloadmanager")); QString defaultLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); + if (m_file.absoluteDir().exists()) + defaultLocation = m_file.absolutePath(); QString downloadDirectory = settings.value(QLatin1String("downloadDirectory"), defaultLocation).toString(); if (!downloadDirectory.isEmpty()) downloadDirectory += QLatin1Char('/'); - QString defaultFileName = saveFileName(downloadDirectory); + QString defaultFileName = QFileInfo(downloadDirectory, m_file.fileName()).absoluteFilePath(); QString fileName = defaultFileName; - if (m_requestFileName) { + if (promptForFileName) { fileName = QFileDialog::getSaveFileName(this, tr("Save File"), defaultFileName); if (fileName.isEmpty()) { - m_reply->close(); + if (m_download) + m_download->cancel(); fileNameLabel->setText(tr("Download canceled: %1").arg(QFileInfo(defaultFileName).fileName())); - return; + return false; } } - m_output.setFileName(fileName); - fileNameLabel->setText(QFileInfo(m_output.fileName()).fileName()); - if (m_requestFileName) - downloadReadyRead(); -} + m_file.setFile(fileName); -QString DownloadItem::saveFileName(const QString &directory) const -{ - // Move this function into QNetworkReply to also get file name sent from the server - QString path = m_url.path(); - QFileInfo info(path); - QString baseName = info.completeBaseName(); - QString endName = info.suffix(); - - if (baseName.isEmpty()) { - baseName = QLatin1String("unnamed_download"); - qDebug() << "DownloadManager:: downloading unknown file:" << m_url; - } - QString name = directory + baseName + QLatin1Char('.') + endName; - if (QFile::exists(name)) { - // already exists, don't overwrite - int i = 1; - do { - name = directory + baseName + QLatin1Char('-') + QString::number(i++) + QLatin1Char('.') + endName; - } while (QFile::exists(name)); - } - return name; -} + if (m_download && m_download->state() == QWebEngineDownloadItem::DownloadRequested) + m_download->setPath(m_file.absoluteFilePath()); + fileNameLabel->setText(m_file.fileName()); + return true; +} -void DownloadItem::stop() +void DownloadWidget::stop() { setUpdatesEnabled(false); stopButton->setEnabled(false); stopButton->hide(); - tryAgainButton->setEnabled(true); - tryAgainButton->show(); setUpdatesEnabled(true); - m_reply->abort(); -} - -void DownloadItem::open() -{ - QFileInfo info(m_output); - QUrl url = QUrl::fromLocalFile(info.absolutePath()); - QDesktopServices::openUrl(url); -} + if (m_download) + m_download->cancel(); -void DownloadItem::tryAgain() -{ - if (!tryAgainButton->isEnabled()) - return; - - tryAgainButton->setEnabled(false); - tryAgainButton->setVisible(false); - stopButton->setEnabled(true); - stopButton->setVisible(true); - progressBar->setVisible(true); - - QNetworkReply *r = BrowserApplication::networkAccessManager()->get(QNetworkRequest(m_url)); - if (m_reply) - m_reply->deleteLater(); - if (m_output.exists()) - m_output.remove(); - m_reply = r; - init(); emit statusChanged(); } -void DownloadItem::downloadReadyRead() -{ - if (m_requestFileName && m_output.fileName().isEmpty()) - return; - if (!m_output.isOpen()) { - // in case someone else has already put a file there - if (!m_requestFileName) - getFileName(); - if (!m_output.open(QIODevice::WriteOnly)) { - downloadInfoLabel->setText(tr("Error opening save file: %1") - .arg(m_output.errorString())); - stopButton->click(); - emit statusChanged(); - return; - } - emit statusChanged(); - } - if (-1 == m_output.write(m_reply->readAll())) { - downloadInfoLabel->setText(tr("Error saving: %1") - .arg(m_output.errorString())); - stopButton->click(); - } -} - -void DownloadItem::error(QNetworkReply::NetworkError) -{ - qDebug() << "DownloadItem::error" << m_reply->errorString() << m_url; - downloadInfoLabel->setText(tr("Network Error: %1").arg(m_reply->errorString())); - tryAgainButton->setEnabled(true); - tryAgainButton->setVisible(true); -} - -void DownloadItem::metaDataChanged() +void DownloadWidget::open() { - qDebug() << "DownloadItem::metaDataChanged: not handled."; + QUrl url = QUrl::fromLocalFile(m_file.absolutePath()); + QDesktopServices::openUrl(url); } -void DownloadItem::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) +void DownloadWidget::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) { m_bytesReceived = bytesReceived; if (bytesTotal == -1) { @@ -253,13 +167,9 @@ void DownloadItem::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) updateInfoLabel(); } -void DownloadItem::updateInfoLabel() +void DownloadWidget::updateInfoLabel() { - if (m_reply->error() == QNetworkReply::NoError) - return; - qint64 bytesTotal = progressBar->maximum(); - bool running = !downloadedSuccessfully(); // update info label double speed = m_bytesReceived * 1000.0 / m_downloadTime.elapsed(); @@ -276,7 +186,7 @@ void DownloadItem::updateInfoLabel() timeRemaining = 1; QString info; - if (running) { + if (!downloadedSuccessfully()) { QString remaining; if (bytesTotal != 0) remaining = tr("- %4 %5 remaining") @@ -288,17 +198,17 @@ void DownloadItem::updateInfoLabel() .arg(dataString((int)speed)) .arg(remaining); } else { - if (m_bytesReceived == bytesTotal) - info = dataString(m_output.size()); - else + if (m_bytesReceived != bytesTotal) { info = tr("%1 of %2 - Stopped") .arg(dataString(m_bytesReceived)) .arg(dataString(bytesTotal)); + } else + info = dataString(m_bytesReceived); } downloadInfoLabel->setText(info); } -QString DownloadItem::dataString(int size) const +QString DownloadWidget::dataString(int size) const { QString unit; if (size < 1024) { @@ -313,28 +223,58 @@ QString DownloadItem::dataString(int size) const return QString(QLatin1String("%1 %2")).arg(size).arg(unit); } -bool DownloadItem::downloading() const +bool DownloadWidget::downloading() const { return (progressBar->isVisible()); } -bool DownloadItem::downloadedSuccessfully() const -{ - return (stopButton->isHidden() && tryAgainButton->isHidden()); -} +bool DownloadWidget::downloadedSuccessfully() const +{ + bool completed = m_download + && m_download->isFinished() + && m_download->state() == QWebEngineDownloadItem::DownloadCompleted; + return completed || !stopButton->isVisible(); +} + +void DownloadWidget::finished() +{ + if (m_download) { + QWebEngineDownloadItem::DownloadState state = m_download->state(); + QString message; + bool interrupted = false; + + switch (state) { + case QWebEngineDownloadItem::DownloadRequested: // Fall-through. + case QWebEngineDownloadItem::DownloadInProgress: + Q_UNREACHABLE(); + break; + case QWebEngineDownloadItem::DownloadCompleted: + break; + case QWebEngineDownloadItem::DownloadCancelled: + message = QStringLiteral("Download cancelled"); + interrupted = true; + break; + case QWebEngineDownloadItem::DownloadInterrupted: + message = QStringLiteral("Download interrupted"); + interrupted = true; + break; + } + + if (interrupted) { + downloadInfoLabel->setText(message); + return; + } + } -void DownloadItem::finished() -{ progressBar->hide(); stopButton->setEnabled(false); stopButton->hide(); - m_output.close(); updateInfoLabel(); emit statusChanged(); } /*! - DownloadManager is a Dialog that contains a list of DownloadItems + DownloadManager is a Dialog that contains a list of DownloadWidgets It is a basic download manager. It only downloads the file, doesn't do BitTorrent, extract zipped files or anything fancy. @@ -342,7 +282,6 @@ void DownloadItem::finished() DownloadManager::DownloadManager(QWidget *parent) : QDialog(parent) , m_autoSaver(new AutoSaver(this)) - , m_manager(BrowserApplication::networkAccessManager()) , m_iconProvider(0) , m_removePolicy(Never) { @@ -376,67 +315,51 @@ int DownloadManager::activeDownloads() const return count; } -void DownloadManager::download(const QNetworkRequest &request, bool requestFileName) +void DownloadManager::download(QWebEngineDownloadItem *download) { - if (request.url().isEmpty()) - return; - handleUnsupportedContent(m_manager->get(request), requestFileName); -} - -void DownloadManager::handleUnsupportedContent(QNetworkReply *reply, bool requestFileName) -{ - if (!reply || reply->url().isEmpty()) - return; - QVariant header = reply->header(QNetworkRequest::ContentLengthHeader); - bool ok; - int size = header.toInt(&ok); - if (ok && size == 0) - return; - - qDebug() << "DownloadManager::handleUnsupportedContent" << reply->url() << "requestFileName" << requestFileName; - DownloadItem *item = new DownloadItem(reply, requestFileName, this); - addItem(item); + DownloadWidget *widget = new DownloadWidget(download, this); + addItem(widget); } -void DownloadManager::addItem(DownloadItem *item) +void DownloadManager::addItem(DownloadWidget *widget) { - connect(item, SIGNAL(statusChanged()), this, SLOT(updateRow())); + connect(widget, SIGNAL(statusChanged()), this, SLOT(updateRow())); int row = m_downloads.count(); m_model->beginInsertRows(QModelIndex(), row, row); - m_downloads.append(item); + m_downloads.append(widget); m_model->endInsertRows(); updateItemCount(); if (row == 0) show(); - downloadsView->setIndexWidget(m_model->index(row, 0), item); + downloadsView->setIndexWidget(m_model->index(row, 0), widget); QIcon icon = style()->standardIcon(QStyle::SP_FileIcon); - item->fileIcon->setPixmap(icon.pixmap(48, 48)); - downloadsView->setRowHeight(row, item->sizeHint().height()); + widget->fileIcon->setPixmap(icon.pixmap(48, 48)); + downloadsView->setRowHeight(row, widget->sizeHint().height()); } void DownloadManager::updateRow() { - DownloadItem *item = qobject_cast<DownloadItem*>(sender()); - int row = m_downloads.indexOf(item); + DownloadWidget *widget = qobject_cast<DownloadWidget*>(sender()); + int row = m_downloads.indexOf(widget); if (-1 == row) return; if (!m_iconProvider) m_iconProvider = new QFileIconProvider(); - QIcon icon = m_iconProvider->icon(item->m_output.fileName()); + QIcon icon = m_iconProvider->icon(widget->m_file); if (icon.isNull()) icon = style()->standardIcon(QStyle::SP_FileIcon); - item->fileIcon->setPixmap(icon.pixmap(48, 48)); - downloadsView->setRowHeight(row, item->minimumSizeHint().height()); + widget->fileIcon->setPixmap(icon.pixmap(48, 48)); + downloadsView->setRowHeight(row, widget->minimumSizeHint().height()); bool remove = false; #if defined(QTWEBENGINE_PRIVATEBROWSING) QWebEngineSettings *globalSettings = QWebEngineSettings::globalSettings(); - if (!item->downloading() + if (!widget->downloading() && globalSettings->testAttribute(QWebEngineSettings::PrivateBrowsingEnabled)) remove = true; #endif - if (item->downloadedSuccessfully() + if (widget->downloadedSuccessfully() && removePolicy() == DownloadManager::SuccessFullDownload) { remove = true; } @@ -472,7 +395,7 @@ void DownloadManager::save() const for (int i = 0; i < m_downloads.count(); ++i) { QString key = QString(QLatin1String("download_%1_")).arg(i); settings.setValue(key + QLatin1String("url"), m_downloads[i]->m_url); - settings.setValue(key + QLatin1String("location"), QFileInfo(m_downloads[i]->m_output).filePath()); + settings.setValue(key + QLatin1String("location"), m_downloads[i]->m_file.filePath()); settings.setValue(key + QLatin1String("done"), m_downloads[i]->downloadedSuccessfully()); } int i = m_downloads.count(); @@ -504,17 +427,15 @@ void DownloadManager::load() QUrl url = settings.value(key + QLatin1String("url")).toUrl(); QString fileName = settings.value(key + QLatin1String("location")).toString(); bool done = settings.value(key + QLatin1String("done"), true).toBool(); - if (!url.isEmpty() && !fileName.isEmpty()) { - DownloadItem *item = new DownloadItem(0, this); - item->m_output.setFileName(fileName); - item->fileNameLabel->setText(QFileInfo(item->m_output.fileName()).fileName()); - item->m_url = url; - item->stopButton->setVisible(false); - item->stopButton->setEnabled(false); - item->tryAgainButton->setVisible(!done); - item->tryAgainButton->setEnabled(!done); - item->progressBar->setVisible(!done); - addItem(item); + if (done && !url.isEmpty() && !fileName.isEmpty()) { + DownloadWidget *widget = new DownloadWidget(0, this); + widget->m_file.setFile(fileName); + widget->fileNameLabel->setText(widget->m_file.fileName()); + widget->m_url = url; + widget->stopButton->setVisible(false); + widget->stopButton->setEnabled(false); + widget->progressBar->hide(); + addItem(widget); } key = QString(QLatin1String("download_%1_")).arg(++i); } @@ -568,8 +489,7 @@ bool DownloadModel::removeRows(int row, int count, const QModelIndex &parent) int lastRow = row + count - 1; for (int i = lastRow; i >= row; --i) { - if (m_downloadManager->m_downloads.at(i)->downloadedSuccessfully() - || m_downloadManager->m_downloads.at(i)->tryAgainButton->isEnabled()) { + if (m_downloadManager->m_downloads.at(i)->downloadedSuccessfully()) { beginRemoveRows(parent, i, i); m_downloadManager->m_downloads.takeAt(i)->deleteLater(); endRemoveRows(); diff --git a/examples/webenginewidgets/browser/downloadmanager.h b/examples/webenginewidgets/browser/downloadmanager.h index 072e99efd..877682d77 100644 --- a/examples/webenginewidgets/browser/downloadmanager.h +++ b/examples/webenginewidgets/browser/downloadmanager.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -45,12 +45,14 @@ #include "ui_downloads.h" #include "ui_downloaditem.h" -#include <QtNetwork/QNetworkReply> - -#include <QtCore/QFile> +#include <QtCore/QFileInfo> #include <QtCore/QTime> +#include <QtCore/QUrl> + +#include <QWebEngineDownloadItem> -class DownloadItem : public QWidget, public Ui_DownloadItem +class DownloadManager; +class DownloadWidget : public QWidget, public Ui_DownloadItem { Q_OBJECT @@ -58,37 +60,32 @@ signals: void statusChanged(); public: - DownloadItem(QNetworkReply *reply = 0, bool requestFileName = false, QWidget *parent = 0); + DownloadWidget(QWebEngineDownloadItem *download, QWidget *parent = 0); bool downloading() const; bool downloadedSuccessfully() const; - QUrl m_url; - - QFile m_output; - QNetworkReply *m_reply; + void init(); + bool getFileName(bool promptForFileName = false); private slots: void stop(); - void tryAgain(); void open(); - void downloadReadyRead(); - void error(QNetworkReply::NetworkError code); void downloadProgress(qint64 bytesReceived, qint64 bytesTotal); - void metaDataChanged(); void finished(); private: - void getFileName(); - void init(); + friend class DownloadManager; void updateInfoLabel(); QString dataString(int size) const; - QString saveFileName(const QString &directory) const; - - bool m_requestFileName; + QUrl m_url; + QFileInfo m_file; qint64 m_bytesReceived; QTime m_downloadTime; + bool m_stopped; + + QScopedPointer<QWebEngineDownloadItem> m_download; }; class AutoSaver; @@ -118,10 +115,7 @@ public: void setRemovePolicy(RemovePolicy policy); public slots: - void download(const QNetworkRequest &request, bool requestFileName = false); - inline void download(const QUrl &url, bool requestFileName = false) - { download(QNetworkRequest(url), requestFileName); } - void handleUnsupportedContent(QNetworkReply *reply, bool requestFileName = false); + void download(QWebEngineDownloadItem *download); void cleanup(); private slots: @@ -129,15 +123,14 @@ private slots: void updateRow(); private: - void addItem(DownloadItem *item); + void addItem(DownloadWidget *item); void updateItemCount(); void load(); AutoSaver *m_autoSaver; DownloadModel *m_model; - QNetworkAccessManager *m_manager; QFileIconProvider *m_iconProvider; - QList<DownloadItem*> m_downloads; + QList<DownloadWidget*> m_downloads; RemovePolicy m_removePolicy; friend class DownloadModel; }; diff --git a/examples/webenginewidgets/browser/edittableview.cpp b/examples/webenginewidgets/browser/edittableview.cpp index 71d9b5706..866ee6f1f 100644 --- a/examples/webenginewidgets/browser/edittableview.cpp +++ b/examples/webenginewidgets/browser/edittableview.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/edittableview.h b/examples/webenginewidgets/browser/edittableview.h index 1c865ad42..315427eac 100644 --- a/examples/webenginewidgets/browser/edittableview.h +++ b/examples/webenginewidgets/browser/edittableview.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/edittreeview.cpp b/examples/webenginewidgets/browser/edittreeview.cpp index 5b8007856..d515ea058 100644 --- a/examples/webenginewidgets/browser/edittreeview.cpp +++ b/examples/webenginewidgets/browser/edittreeview.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/edittreeview.h b/examples/webenginewidgets/browser/edittreeview.h index 4159812a6..1cf87d54f 100644 --- a/examples/webenginewidgets/browser/edittreeview.h +++ b/examples/webenginewidgets/browser/edittreeview.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/featurepermissionbar.cpp b/examples/webenginewidgets/browser/featurepermissionbar.cpp index 98f19ad1f..b7275dfc2 100644 --- a/examples/webenginewidgets/browser/featurepermissionbar.cpp +++ b/examples/webenginewidgets/browser/featurepermissionbar.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -53,15 +53,17 @@ static QString textForPermissionType(QWebEnginePage::Feature type) { switch (type) { case QWebEnginePage::Notifications: - return QObject::tr("desktop notifications"); + return QObject::tr("use desktop notifications"); case QWebEnginePage::Geolocation: - return QObject::tr("your position"); + return QObject::tr("use your position"); case QWebEnginePage::MediaAudioCapture: - return QObject::tr("your microphone"); + return QObject::tr("use your microphone"); case QWebEnginePage::MediaVideoCapture: - return QObject::tr("your camera"); + return QObject::tr("use your camera"); case QWebEnginePage::MediaAudioVideoCapture: - return QObject::tr("your camera and microphone"); + return QObject::tr("use your camera and microphone"); + case QWebEnginePage::MouseLock: + return QObject::tr("lock your mouse"); default: Q_UNREACHABLE(); } @@ -80,12 +82,13 @@ FeaturePermissionBar::FeaturePermissionBar(QWidget *view) l->addStretch(); QPushButton *allowButton = new QPushButton(tr("Allow"), this); QPushButton *denyButton = new QPushButton(tr("Deny"), this); + QPushButton *discardButton = new QPushButton(QIcon(QStringLiteral(":closetab.png")), QString(), this); connect(allowButton, &QPushButton::clicked, this, &FeaturePermissionBar::permissionGranted); connect(denyButton, &QPushButton::clicked, this, &FeaturePermissionBar::permissionDenied); - QPushButton *discardButton = new QPushButton(QIcon(QStringLiteral(":closetab.png")), QString(), this); - connect(discardButton, &QPushButton::clicked, this, &QObject::deleteLater); + connect(discardButton, &QPushButton::clicked, this, &FeaturePermissionBar::permissionUnknown); connect(allowButton, &QPushButton::clicked, this, &QObject::deleteLater); connect(denyButton, &QPushButton::clicked, this, &QObject::deleteLater); + connect(discardButton, &QPushButton::clicked, this, &QObject::deleteLater); l->addWidget(denyButton); l->addWidget(allowButton); l->addWidget(discardButton); @@ -96,7 +99,7 @@ void FeaturePermissionBar::requestPermission(const QUrl &securityOrigin, QWebEng { m_securityOrigin = securityOrigin; m_feature = feature; - m_messageLabel->setText(tr("%1 wants to use %2.").arg(securityOrigin.host()).arg(textForPermissionType(feature))); + m_messageLabel->setText(tr("%1 wants to %2.").arg(securityOrigin.host()).arg(textForPermissionType(feature))); show(); // Ease in QPropertyAnimation *animation = new QPropertyAnimation(this); @@ -118,3 +121,8 @@ void FeaturePermissionBar::permissionGranted() { emit featurePermissionProvided(m_securityOrigin, m_feature, QWebEnginePage::PermissionGrantedByUser); } + +void FeaturePermissionBar::permissionUnknown() +{ + emit featurePermissionProvided(m_securityOrigin, m_feature, QWebEnginePage::PermissionUnknown); +} diff --git a/examples/webenginewidgets/browser/featurepermissionbar.h b/examples/webenginewidgets/browser/featurepermissionbar.h index 92ca04773..1bfe1b483 100644 --- a/examples/webenginewidgets/browser/featurepermissionbar.h +++ b/examples/webenginewidgets/browser/featurepermissionbar.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWebEngine module of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -63,6 +63,7 @@ signals: private slots: void permissionDenied(); void permissionGranted(); + void permissionUnknown(); private: QWebEnginePage::Feature m_feature; diff --git a/examples/webenginewidgets/browser/history.cpp b/examples/webenginewidgets/browser/history.cpp index 53afce398..ffae0f55e 100644 --- a/examples/webenginewidgets/browser/history.cpp +++ b/examples/webenginewidgets/browser/history.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/history.h b/examples/webenginewidgets/browser/history.h index fecc168da..5a747c942 100644 --- a/examples/webenginewidgets/browser/history.h +++ b/examples/webenginewidgets/browser/history.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/main.cpp b/examples/webenginewidgets/browser/main.cpp index 0f8d238d3..86859f741 100644 --- a/examples/webenginewidgets/browser/main.cpp +++ b/examples/webenginewidgets/browser/main.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/modelmenu.cpp b/examples/webenginewidgets/browser/modelmenu.cpp index 56453b080..ec0eaffab 100644 --- a/examples/webenginewidgets/browser/modelmenu.cpp +++ b/examples/webenginewidgets/browser/modelmenu.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/modelmenu.h b/examples/webenginewidgets/browser/modelmenu.h index 4045a7758..c0a7d56b8 100644 --- a/examples/webenginewidgets/browser/modelmenu.h +++ b/examples/webenginewidgets/browser/modelmenu.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/networkaccessmanager.cpp b/examples/webenginewidgets/browser/networkaccessmanager.cpp index a7127ade6..d2b4f827f 100644 --- a/examples/webenginewidgets/browser/networkaccessmanager.cpp +++ b/examples/webenginewidgets/browser/networkaccessmanager.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/networkaccessmanager.h b/examples/webenginewidgets/browser/networkaccessmanager.h index 54c24f86e..f3ee2d338 100644 --- a/examples/webenginewidgets/browser/networkaccessmanager.h +++ b/examples/webenginewidgets/browser/networkaccessmanager.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/searchlineedit.cpp b/examples/webenginewidgets/browser/searchlineedit.cpp index 0d387da4b..5152ac1c0 100644 --- a/examples/webenginewidgets/browser/searchlineedit.cpp +++ b/examples/webenginewidgets/browser/searchlineedit.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/searchlineedit.h b/examples/webenginewidgets/browser/searchlineedit.h index e01fcbff2..b8b8337fd 100644 --- a/examples/webenginewidgets/browser/searchlineedit.h +++ b/examples/webenginewidgets/browser/searchlineedit.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/settings.cpp b/examples/webenginewidgets/browser/settings.cpp index 835e7a9b5..7ed5f707b 100644 --- a/examples/webenginewidgets/browser/settings.cpp +++ b/examples/webenginewidgets/browser/settings.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -58,9 +58,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent) { setupUi(this); - connect(exceptionsButton, SIGNAL(clicked()), this, SLOT(showExceptions())); connect(setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage())); - connect(cookiesButton, SIGNAL(clicked()), this, SLOT(showCookies())); connect(standardFontButton, SIGNAL(clicked()), this, SLOT(chooseFont())); connect(fixedFontButton, SIGNAL(clicked()), this, SLOT(chooseFixedFont())); @@ -89,6 +87,10 @@ void SettingsDialog::loadDefaults() #endif enableScrollAnimator->setChecked(defaultSettings->testAttribute(QWebEngineSettings::ScrollAnimatorEnabled)); + + persistentDataPath->setText(QWebEngineProfile::defaultProfile()->persistentStoragePath()); + sessionCookiesCombo->setCurrentIndex(QWebEngineProfile::defaultProfile()->persistentCookiesPolicy()); + httpUserAgent->setText(QWebEngineProfile::defaultProfile()->httpUserAgent()); } void SettingsDialog::loadFromSettings() @@ -135,49 +137,21 @@ void SettingsDialog::loadFromSettings() enableJavascript->setChecked(settings.value(QLatin1String("enableJavascript"), enableJavascript->isChecked()).toBool()); enablePlugins->setChecked(settings.value(QLatin1String("enablePlugins"), enablePlugins->isChecked()).toBool()); - userStyleSheet->setText(settings.value(QLatin1String("userStyleSheet")).toUrl().toString()); + userStyleSheet->setPlainText(settings.value(QLatin1String("userStyleSheet")).toString()); enableScrollAnimator->setChecked(settings.value(QLatin1String("enableScrollAnimator"), enableScrollAnimator->isChecked()).toBool()); + httpUserAgent->setText(settings.value(QLatin1String("httpUserAgent"), httpUserAgent->text()).toString()); settings.endGroup(); -#if defined(QWEBENGINEPAGE_SETNETWORKACCESSMANAGER) // Privacy settings.beginGroup(QLatin1String("cookies")); - QByteArray value = settings.value(QLatin1String("acceptCookies"), QLatin1String("AcceptOnlyFromSitesNavigatedTo")).toByteArray(); - QMetaEnum acceptPolicyEnum = CookieJar::staticMetaObject.enumerator(CookieJar::staticMetaObject.indexOfEnumerator("AcceptPolicy")); - CookieJar::AcceptPolicy acceptCookies = acceptPolicyEnum.keyToValue(value) == -1 ? - CookieJar::AcceptOnlyFromSitesNavigatedTo : - static_cast<CookieJar::AcceptPolicy>(acceptPolicyEnum.keyToValue(value)); - switch (acceptCookies) { - case CookieJar::AcceptAlways: - acceptCombo->setCurrentIndex(0); - break; - case CookieJar::AcceptNever: - acceptCombo->setCurrentIndex(1); - break; - case CookieJar::AcceptOnlyFromSitesNavigatedTo: - acceptCombo->setCurrentIndex(2); - break; - } + int persistentCookiesPolicy = settings.value(QLatin1String("persistentCookiesPolicy"), sessionCookiesCombo->currentIndex()).toInt(); + sessionCookiesCombo->setCurrentIndex(persistentCookiesPolicy); + + QString pdataPath = settings.value(QLatin1String("persistentDataPath"), persistentDataPath->text()).toString(); + persistentDataPath->setText(pdataPath); - value = settings.value(QLatin1String("keepCookiesUntil"), QLatin1String("Expire")).toByteArray(); - QMetaEnum keepPolicyEnum = CookieJar::staticMetaObject.enumerator(CookieJar::staticMetaObject.indexOfEnumerator("KeepPolicy")); - CookieJar::KeepPolicy keepCookies = keepPolicyEnum.keyToValue(value) == -1 ? - CookieJar::KeepUntilExpire : - static_cast<CookieJar::KeepPolicy>(keepPolicyEnum.keyToValue(value)); - switch (keepCookies) { - case CookieJar::KeepUntilExpire: - keepUntilCombo->setCurrentIndex(0); - break; - case CookieJar::KeepUntilExit: - keepUntilCombo->setCurrentIndex(1); - break; - case CookieJar::KeepUntilTimeLimit: - keepUntilCombo->setCurrentIndex(2); - break; - } settings.endGroup(); -#endif // Proxy settings.beginGroup(QLatin1String("proxy")); @@ -222,52 +196,20 @@ void SettingsDialog::saveToSettings() settings.setValue(QLatin1String("enableJavascript"), enableJavascript->isChecked()); settings.setValue(QLatin1String("enablePlugins"), enablePlugins->isChecked()); settings.setValue(QLatin1String("enableScrollAnimator"), enableScrollAnimator->isChecked()); - QString userStyleSheetString = userStyleSheet->text(); - if (QFile::exists(userStyleSheetString)) - settings.setValue(QLatin1String("userStyleSheet"), QUrl::fromLocalFile(userStyleSheetString)); - else - settings.setValue(QLatin1String("userStyleSheet"), QUrl(userStyleSheetString)); + settings.setValue(QLatin1String("userStyleSheet"), userStyleSheet->toPlainText()); + settings.setValue(QLatin1String("httpUserAgent"), httpUserAgent->text()); settings.endGroup(); -#if defined(QWEBENGINEPAGE_SETNETWORKACCESSMANAGER) //Privacy settings.beginGroup(QLatin1String("cookies")); - CookieJar::KeepPolicy keepCookies; - switch (acceptCombo->currentIndex()) { - default: - case 0: - keepCookies = CookieJar::KeepUntilExpire; - break; - case 1: - keepCookies = CookieJar::KeepUntilExit; - break; - case 2: - keepCookies = CookieJar::KeepUntilTimeLimit; - break; - } - QMetaEnum acceptPolicyEnum = CookieJar::staticMetaObject.enumerator(CookieJar::staticMetaObject.indexOfEnumerator("AcceptPolicy")); - settings.setValue(QLatin1String("acceptCookies"), QLatin1String(acceptPolicyEnum.valueToKey(keepCookies))); - - CookieJar::KeepPolicy keepPolicy; - switch (keepUntilCombo->currentIndex()) { - default: - case 0: - keepPolicy = CookieJar::KeepUntilExpire; - break; - case 1: - keepPolicy = CookieJar::KeepUntilExit; - break; - case 2: - keepPolicy = CookieJar::KeepUntilTimeLimit; - break; - } + int persistentCookiesPolicy = sessionCookiesCombo->currentIndex(); + settings.setValue(QLatin1String("persistentCookiesPolicy"), persistentCookiesPolicy); - QMetaEnum keepPolicyEnum = CookieJar::staticMetaObject.enumerator(CookieJar::staticMetaObject.indexOfEnumerator("KeepPolicy")); - settings.setValue(QLatin1String("keepCookiesUntil"), QLatin1String(keepPolicyEnum.valueToKey(keepPolicy))); + QString pdataPath = persistentDataPath->text(); + settings.setValue(QLatin1String("persistentDataPath"), pdataPath); settings.endGroup(); -#endif // proxy settings.beginGroup(QLatin1String("proxy")); diff --git a/examples/webenginewidgets/browser/settings.h b/examples/webenginewidgets/browser/settings.h index 0858e0023..6def66928 100644 --- a/examples/webenginewidgets/browser/settings.h +++ b/examples/webenginewidgets/browser/settings.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/settings.ui b/examples/webenginewidgets/browser/settings.ui index 08374ca7a..11bdee4d3 100644 --- a/examples/webenginewidgets/browser/settings.ui +++ b/examples/webenginewidgets/browser/settings.ui @@ -1,7 +1,8 @@ -<ui version="4.0" > +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> <class>Settings</class> - <widget class="QDialog" name="Settings" > - <property name="geometry" > + <widget class="QDialog" name="Settings"> + <property name="geometry"> <rect> <x>0</x> <y>0</y> @@ -9,64 +10,56 @@ <height>322</height> </rect> </property> - <property name="windowTitle" > + <property name="windowTitle"> <string>Settings</string> </property> - <layout class="QGridLayout" name="gridLayout" > - <item row="2" column="0" > - <widget class="QDialogButtonBox" name="buttonBox" > - <property name="orientation" > + <layout class="QGridLayout" name="gridLayout"> + <item row="2" column="0"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> <enum>Qt::Horizontal</enum> </property> - <property name="standardButtons" > + <property name="standardButtons"> <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> </property> </widget> </item> - <item row="1" column="0" > - <widget class="QTabWidget" name="tabWidget" > - <property name="currentIndex" > - <number>0</number> + <item row="1" column="0"> + <widget class="QTabWidget" name="tabWidget"> + <property name="currentIndex"> + <number>4</number> </property> - <widget class="QWidget" name="tab" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>627</width> - <height>243</height> - </rect> - </property> - <attribute name="title" > + <widget class="QWidget" name="tab"> + <attribute name="title"> <string>General</string> </attribute> - <layout class="QGridLayout" name="gridLayout_4" > - <item row="0" column="0" > - <widget class="QLabel" name="label_3" > - <property name="text" > + <layout class="QGridLayout" name="gridLayout_4"> + <item row="0" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> <string>Home:</string> </property> - <property name="alignment" > + <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="0" column="1" colspan="2" > - <widget class="QLineEdit" name="homeLineEdit" /> + <item row="0" column="1" colspan="2"> + <widget class="QLineEdit" name="homeLineEdit"/> </item> - <item row="1" column="1" > - <widget class="QPushButton" name="setHomeToCurrentPageButton" > - <property name="text" > + <item row="1" column="1"> + <widget class="QPushButton" name="setHomeToCurrentPageButton"> + <property name="text"> <string>Set to current page</string> </property> </widget> </item> - <item row="1" column="2" > - <spacer name="horizontalSpacer" > - <property name="orientation" > + <item row="1" column="2"> + <spacer name="horizontalSpacer"> + <property name="orientation"> <enum>Qt::Horizontal</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> <width>280</width> <height>18</height> @@ -74,103 +67,103 @@ </property> </spacer> </item> - <item row="2" column="0" > - <widget class="QLabel" name="label_4" > - <property name="text" > + <item row="2" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> <string>Remove history items:</string> </property> - <property name="alignment" > + <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="2" column="1" colspan="2" > - <widget class="QComboBox" name="expireHistory" > + <item row="2" column="1" colspan="2"> + <widget class="QComboBox" name="expireHistory"> <item> - <property name="text" > + <property name="text"> <string>After one day</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>After one week</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>After two weeks</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>After one month</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>After one year</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>Manually</string> </property> </item> </widget> </item> - <item row="3" column="0" > - <widget class="QLabel" name="label_7" > - <property name="text" > + <item row="3" column="0"> + <widget class="QLabel" name="label_7"> + <property name="text"> <string>Save downloads to:</string> </property> - <property name="alignment" > + <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="3" column="1" colspan="2" > - <widget class="QLineEdit" name="downloadsLocation" /> + <item row="3" column="1" colspan="2"> + <widget class="QLineEdit" name="downloadsLocation"/> </item> - <item row="4" column="0" > - <widget class="QLabel" name="label_8" > - <property name="text" > + <item row="4" column="0"> + <widget class="QLabel" name="label_8"> + <property name="text"> <string>Open links from applications:</string> </property> - <property name="alignment" > + <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="4" column="1" colspan="2" > - <widget class="QComboBox" name="openLinksIn" > + <item row="4" column="1" colspan="2"> + <widget class="QComboBox" name="openLinksIn"> <item> - <property name="text" > + <property name="text"> <string>In a tab in the current window</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>In a new window</string> </property> </item> </widget> </item> <item row="5" column="1" colspan="2"> - <widget class="QCheckBox" name="enableScrollAnimator" > - <property name="text" > - <string>Enable Scroll Animator</string> + <widget class="QCheckBox" name="enableScrollAnimator"> + <property name="text"> + <string>Enable Scroll Animator</string> </property> - <property name="checked" > - <bool>true</bool> + <property name="checked"> + <bool>true</bool> </property> </widget> </item> - <item row="6" column="1" colspan="2" > + <item row="6" column="1" colspan="2"> <spacer> - <property name="orientation" > + <property name="orientation"> <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> <width>391</width> <height>262</height> @@ -180,91 +173,83 @@ </item> </layout> </widget> - <widget class="QWidget" name="tab_3" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>627</width> - <height>243</height> - </rect> - </property> - <attribute name="title" > + <widget class="QWidget" name="tab_3"> + <attribute name="title"> <string>Appearance</string> </attribute> - <layout class="QGridLayout" name="gridLayout_3" > - <item row="0" column="0" > - <widget class="QLabel" name="label_5" > - <property name="text" > + <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="0"> + <widget class="QLabel" name="label_5"> + <property name="text"> <string>Standard font:</string> </property> - <property name="alignment" > + <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="0" column="1" > - <widget class="QLabel" name="standardLabel" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Preferred" hsizetype="Expanding" > + <item row="0" column="1"> + <widget class="QLabel" name="standardLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="frameShape" > + <property name="frameShape"> <enum>QFrame::StyledPanel</enum> </property> - <property name="text" > + <property name="text"> <string>Times 16</string> </property> - <property name="alignment" > + <property name="alignment"> <set>Qt::AlignCenter</set> </property> </widget> </item> - <item row="0" column="2" > - <widget class="QPushButton" name="standardFontButton" > - <property name="text" > + <item row="0" column="2"> + <widget class="QPushButton" name="standardFontButton"> + <property name="text"> <string>Select...</string> </property> </widget> </item> - <item row="1" column="0" > - <widget class="QLabel" name="label_6" > - <property name="text" > + <item row="1" column="0"> + <widget class="QLabel" name="label_6"> + <property name="text"> <string>Fixed-width font:</string> </property> - <property name="alignment" > + <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="1" column="1" > - <widget class="QLabel" name="fixedLabel" > - <property name="frameShape" > + <item row="1" column="1"> + <widget class="QLabel" name="fixedLabel"> + <property name="frameShape"> <enum>QFrame::StyledPanel</enum> </property> - <property name="text" > + <property name="text"> <string>Courier 13</string> </property> - <property name="alignment" > + <property name="alignment"> <set>Qt::AlignCenter</set> </property> </widget> </item> - <item row="1" column="2" > - <widget class="QPushButton" name="fixedFontButton" > - <property name="text" > + <item row="1" column="2"> + <widget class="QPushButton" name="fixedFontButton"> + <property name="text"> <string>Select...</string> </property> </widget> </item> - <item row="2" column="1" > - <spacer name="verticalSpacer" > - <property name="orientation" > + <item row="2" column="1"> + <spacer name="verticalSpacer"> + <property name="orientation"> <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> <width>20</width> <height>93</height> @@ -274,41 +259,33 @@ </item> </layout> </widget> - <widget class="QWidget" name="tab_2" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>627</width> - <height>243</height> - </rect> - </property> - <attribute name="title" > + <widget class="QWidget" name="tab_2"> + <attribute name="title"> <string>Privacy</string> </attribute> - <layout class="QVBoxLayout" name="verticalLayout_3" > + <layout class="QVBoxLayout" name="verticalLayout_3"> <item> - <widget class="QGroupBox" name="groupBox" > - <property name="title" > + <widget class="QGroupBox" name="groupBox"> + <property name="title"> <string>Web Content</string> </property> - <layout class="QVBoxLayout" name="verticalLayout_2" > + <layout class="QVBoxLayout" name="verticalLayout_2"> <item> - <widget class="QCheckBox" name="enablePlugins" > - <property name="text" > + <widget class="QCheckBox" name="enablePlugins"> + <property name="text"> <string>Enable Plugins</string> </property> - <property name="checked" > + <property name="checked"> <bool>true</bool> </property> </widget> </item> <item> - <widget class="QCheckBox" name="enableJavascript" > - <property name="text" > + <widget class="QCheckBox" name="enableJavascript"> + <property name="text"> <string>Enable Javascript</string> </property> - <property name="checked" > + <property name="checked"> <bool>true</bool> </property> </widget> @@ -317,186 +294,151 @@ </widget> </item> <item> - <widget class="QGroupBox" name="cookiesGroupBox" > - <property name="title" > + <widget class="QGroupBox" name="cookiesGroupBox"> + <property name="title"> <string>Cookies</string> </property> - <layout class="QGridLayout" > - <item row="0" column="0" > - <widget class="QLabel" name="label_2" > - <property name="text" > - <string>Accept Cookies:</string> + <layout class="QGridLayout"> + <property name="leftMargin"> + <number>9</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Persistent Cookie Policy</string> </property> - <property name="alignment" > + <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="0" column="1" > - <widget class="QComboBox" name="acceptCombo" > + <item row="0" column="1"> + <widget class="QComboBox" name="sessionCookiesCombo"> <item> - <property name="text" > - <string>Always</string> + <property name="text"> + <string>Treat all cookies as session cookies</string> </property> </item> <item> - <property name="text" > - <string>Never</string> + <property name="text"> + <string>Allow persistent cookies</string> </property> </item> <item> - <property name="text" > - <string>Only from sites you navigate to</string> + <property name="text"> + <string>Treat all cookies as persistent cookies</string> </property> </item> </widget> </item> - <item row="0" column="2" > - <widget class="QPushButton" name="exceptionsButton" > - <property name="text" > - <string>Exceptions...</string> + <item row="1" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Persistent Data Path:</string> </property> - </widget> - </item> - <item row="1" column="0" > - <widget class="QLabel" name="label" > - <property name="text" > - <string>Keep until:</string> - </property> - <property name="alignment" > + <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="1" column="1" > - <widget class="QComboBox" name="keepUntilCombo" > - <item> - <property name="text" > - <string>They expire</string> - </property> - </item> - <item> - <property name="text" > - <string>I exit the application</string> - </property> - </item> - <item> - <property name="text" > - <string>At most 90 days</string> - </property> - </item> - </widget> - </item> - <item row="1" column="2" > - <widget class="QPushButton" name="cookiesButton" > - <property name="text" > - <string>Cookies...</string> - </property> - </widget> + <item row="1" column="1"> + <widget class="QLineEdit" name="persistentDataPath"/> </item> </layout> </widget> </item> <item> - <spacer> - <property name="orientation" > + <spacer name="verticalSpacer_4"> + <property name="orientation"> <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> - <width>371</width> - <height>177</height> + <width>20</width> + <height>40</height> </size> </property> </spacer> </item> </layout> </widget> - <widget class="QWidget" name="tab_4" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>627</width> - <height>243</height> - </rect> - </property> - <attribute name="title" > + <widget class="QWidget" name="tab_4"> + <attribute name="title"> <string>Proxy</string> </attribute> - <layout class="QVBoxLayout" name="verticalLayout" > + <layout class="QVBoxLayout" name="verticalLayout"> <item> - <widget class="QGroupBox" name="proxySupport" > - <property name="title" > + <widget class="QGroupBox" name="proxySupport"> + <property name="title"> <string>Enable proxy</string> </property> - <property name="checkable" > + <property name="checkable"> <bool>true</bool> </property> - <layout class="QGridLayout" name="gridLayout_6" > - <item row="0" column="0" > - <widget class="QLabel" name="label_9" > - <property name="text" > + <layout class="QGridLayout" name="gridLayout_6"> + <item row="0" column="0"> + <widget class="QLabel" name="label_9"> + <property name="text"> <string>Type:</string> </property> - <property name="alignment" > + <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="0" column="1" colspan="2" > - <widget class="QComboBox" name="proxyType" > + <item row="0" column="1" colspan="2"> + <widget class="QComboBox" name="proxyType"> <item> - <property name="text" > + <property name="text"> <string>Socks5</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>Http</string> </property> </item> </widget> </item> - <item row="1" column="0" > - <widget class="QLabel" name="label_10" > - <property name="text" > + <item row="1" column="0"> + <widget class="QLabel" name="label_10"> + <property name="text"> <string>Host:</string> </property> - <property name="alignment" > + <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="1" column="1" colspan="2" > - <widget class="QLineEdit" name="proxyHostName" /> + <item row="1" column="1" colspan="2"> + <widget class="QLineEdit" name="proxyHostName"/> </item> - <item row="2" column="0" > - <widget class="QLabel" name="label_11" > - <property name="text" > + <item row="2" column="0"> + <widget class="QLabel" name="label_11"> + <property name="text"> <string>Port:</string> </property> - <property name="alignment" > + <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="2" column="1" > - <widget class="QSpinBox" name="proxyPort" > - <property name="maximum" > + <item row="2" column="1"> + <widget class="QSpinBox" name="proxyPort"> + <property name="maximum"> <number>10000</number> </property> - <property name="value" > + <property name="value"> <number>1080</number> </property> </widget> </item> - <item row="2" column="2" > - <spacer name="horizontalSpacer_2" > - <property name="orientation" > + <item row="2" column="2"> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> <enum>Qt::Horizontal</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> <width>293</width> <height>20</height> @@ -504,42 +446,42 @@ </property> </spacer> </item> - <item row="3" column="0" > - <widget class="QLabel" name="label_12" > - <property name="text" > + <item row="3" column="0"> + <widget class="QLabel" name="label_12"> + <property name="text"> <string>User Name:</string> </property> - <property name="alignment" > + <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="3" column="1" colspan="2" > - <widget class="QLineEdit" name="proxyUserName" /> + <item row="3" column="1" colspan="2"> + <widget class="QLineEdit" name="proxyUserName"/> </item> - <item row="4" column="0" > - <widget class="QLabel" name="label_13" > - <property name="text" > + <item row="4" column="0"> + <widget class="QLabel" name="label_13"> + <property name="text"> <string>Password:</string> </property> - <property name="alignment" > + <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="4" column="1" colspan="2" > - <widget class="QLineEdit" name="proxyPassword" > - <property name="echoMode" > + <item row="4" column="1" colspan="2"> + <widget class="QLineEdit" name="proxyPassword"> + <property name="echoMode"> <enum>QLineEdit::Password</enum> </property> </widget> </item> - <item row="5" column="0" > - <spacer name="verticalSpacer_2" > - <property name="orientation" > + <item row="5" column="0"> + <spacer name="verticalSpacer_2"> + <property name="orientation"> <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> <width>20</width> <height>8</height> @@ -552,27 +494,37 @@ </item> </layout> </widget> - <widget class="QWidget" name="tab_5" > - <attribute name="title" > + <widget class="QWidget" name="tab_5"> + <attribute name="title"> <string>Advanced</string> </attribute> - <layout class="QGridLayout" name="gridLayout_2" > - <item row="0" column="0" > - <widget class="QLabel" name="label_14" > - <property name="text" > - <string>Style Sheet:</string> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="2" column="1"> + <widget class="QTextEdit" name="userStyleSheet"/> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="httpUserAgent"/> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_15"> + <property name="text"> + <string>HTTP User-Agent:</string> </property> </widget> </item> - <item row="0" column="1" > - <widget class="QLineEdit" name="userStyleSheet" /> + <item row="2" column="0"> + <widget class="QLabel" name="label_14"> + <property name="text"> + <string>Style Sheet:</string> + </property> + </widget> </item> - <item row="1" column="1" > - <spacer name="verticalSpacer_3" > - <property name="orientation" > + <item row="4" column="1"> + <spacer name="verticalSpacer_3"> + <property name="orientation"> <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> <width>20</width> <height>176</height> @@ -594,11 +546,11 @@ <receiver>Settings</receiver> <slot>accept()</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>248</x> <y>254</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>157</x> <y>274</y> </hint> @@ -610,11 +562,11 @@ <receiver>Settings</receiver> <slot>reject()</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>316</x> <y>260</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>286</x> <y>274</y> </hint> diff --git a/examples/webenginewidgets/browser/squeezelabel.cpp b/examples/webenginewidgets/browser/squeezelabel.cpp index c40fe97da..78198c3f0 100644 --- a/examples/webenginewidgets/browser/squeezelabel.cpp +++ b/examples/webenginewidgets/browser/squeezelabel.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/squeezelabel.h b/examples/webenginewidgets/browser/squeezelabel.h index 6df84179a..628b7350a 100644 --- a/examples/webenginewidgets/browser/squeezelabel.h +++ b/examples/webenginewidgets/browser/squeezelabel.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/tabwidget.cpp b/examples/webenginewidgets/browser/tabwidget.cpp index 74fb05b46..06ff59ac3 100644 --- a/examples/webenginewidgets/browser/tabwidget.cpp +++ b/examples/webenginewidgets/browser/tabwidget.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -43,12 +43,15 @@ #include "browserapplication.h" #include "browsermainwindow.h" +#include "downloadmanager.h" #include "history.h" #include "urllineedit.h" #include "webview.h" #include <QtCore/QMimeData> #include <QtGui/QClipboard> +#include <QtWebEngineWidgets/QWebEngineDownloadItem> +#include <QtWebEngineWidgets/QWebEngineProfile> #include <QtWidgets/QCompleter> #include <QtWidgets/QListView> #include <QtWidgets/QMenu> @@ -314,6 +317,8 @@ void TabWidget::currentChanged(int index) this, SIGNAL(linkHovered(const QString&))); disconnect(oldWebView, SIGNAL(loadProgress(int)), this, SIGNAL(loadProgress(int))); + disconnect(oldWebView->page()->profile(), SIGNAL(downloadRequested(QWebEngineDownloadItem*)), + this, SLOT(downloadRequested(QWebEngineDownloadItem*))); } #if defined(QWEBENGINEVIEW_STATUSBARMESSAGE) @@ -324,6 +329,8 @@ void TabWidget::currentChanged(int index) this, SIGNAL(linkHovered(const QString&))); connect(webView, SIGNAL(loadProgress(int)), this, SIGNAL(loadProgress(int))); + connect(webView->page()->profile(), SIGNAL(downloadRequested(QWebEngineDownloadItem*)), + this, SLOT(downloadRequested(QWebEngineDownloadItem*))); for (int i = 0; i < m_actions.count(); ++i) { WebActionMapper *mapper = m_actions[i]; @@ -772,6 +779,12 @@ bool TabWidget::restoreState(const QByteArray &state) return true; } +void TabWidget::downloadRequested(QWebEngineDownloadItem *download) +{ + BrowserApplication::downloadManager()->download(download); + download->accept(); +} + WebActionMapper::WebActionMapper(QAction *root, QWebEnginePage::WebAction webAction, QObject *parent) : QObject(parent) , m_currentParent(0) diff --git a/examples/webenginewidgets/browser/tabwidget.h b/examples/webenginewidgets/browser/tabwidget.h index 497a2c572..74e98f46c 100644 --- a/examples/webenginewidgets/browser/tabwidget.h +++ b/examples/webenginewidgets/browser/tabwidget.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -45,6 +45,11 @@ #include <QtWidgets/QTabBar> #include <QtWidgets/QShortcut> + +QT_BEGIN_NAMESPACE +class QWebEngineDownloadItem; +QT_END_NAMESPACE + /* Tab bar with a few more features such as a context menu and shortcuts */ @@ -197,6 +202,7 @@ private slots: void currentChanged(int index); void aboutToShowRecentTabsMenu(); void aboutToShowRecentTriggeredAction(QAction *action); + void downloadRequested(QWebEngineDownloadItem *download); void webViewLoadStarted(); void webViewIconChanged(); void webViewTitleChanged(const QString &title); diff --git a/examples/webenginewidgets/browser/toolbarsearch.cpp b/examples/webenginewidgets/browser/toolbarsearch.cpp index eb699e60c..fa6e4f239 100644 --- a/examples/webenginewidgets/browser/toolbarsearch.cpp +++ b/examples/webenginewidgets/browser/toolbarsearch.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/toolbarsearch.h b/examples/webenginewidgets/browser/toolbarsearch.h index 1189785db..cbe00366c 100644 --- a/examples/webenginewidgets/browser/toolbarsearch.h +++ b/examples/webenginewidgets/browser/toolbarsearch.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/urllineedit.cpp b/examples/webenginewidgets/browser/urllineedit.cpp index 730d3f771..685277d9c 100644 --- a/examples/webenginewidgets/browser/urllineedit.cpp +++ b/examples/webenginewidgets/browser/urllineedit.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/urllineedit.h b/examples/webenginewidgets/browser/urllineedit.h index c30f40b57..775aa7d18 100644 --- a/examples/webenginewidgets/browser/urllineedit.h +++ b/examples/webenginewidgets/browser/urllineedit.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/webview.cpp b/examples/webenginewidgets/browser/webview.cpp index 5ea273e3a..6f503a3a2 100644 --- a/examples/webenginewidgets/browser/webview.cpp +++ b/examples/webenginewidgets/browser/webview.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -52,6 +52,7 @@ #include <QtGui/QClipboard> #include <QtNetwork/QAuthenticator> +#include <QtNetwork/QNetworkReply> #include <QtWidgets/QMenu> #include <QtWidgets/QMessageBox> #include <QtGui/QMouseEvent> @@ -97,37 +98,15 @@ BrowserMainWindow *WebPage::mainWindow() return BrowserApplication::instance()->mainWindow(); } -#if defined(QWEBENGINEPAGE_ACCEPTNAVIGATIONREQUEST) -bool WebPage::acceptNavigationRequest(QWebEngineFrame *frame, const QNetworkRequest &request, NavigationType type) +bool WebPage::acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame) { - // ctrl open in new tab - // ctrl-shift open in new tab and select - // ctrl-alt open in new window - if (type == QWebEnginePage::NavigationTypeLinkClicked - && (m_keyboardModifiers & Qt::ControlModifier - || m_pressedButtons == Qt::MidButton)) { - bool newWindow = (m_keyboardModifiers & Qt::AltModifier); - WebView *webView; - if (newWindow) { - BrowserApplication::instance()->newMainWindow(); - BrowserMainWindow *newMainWindow = BrowserApplication::instance()->mainWindow(); - webView = newMainWindow->currentTab(); - newMainWindow->raise(); - newMainWindow->activateWindow(); - webView->setFocus(); - } else { - bool selectNewTab = (m_keyboardModifiers & Qt::ShiftModifier); - webView = mainWindow()->tabWidget()->newTab(selectNewTab); - } - webView->load(request); - m_keyboardModifiers = Qt::NoModifier; - m_pressedButtons = Qt::NoButton; - return false; + Q_UNUSED(type); + if (isMainFrame) { + m_loadingUrl = url; + emit loadingUrl(m_loadingUrl); } - m_loadingUrl = request.url(); - emit loadingUrl(m_loadingUrl); + return true; } -#endif bool WebPage::certificateError(const QWebEngineCertificateError &error) { @@ -343,10 +322,6 @@ WebView::WebView(QWidget* parent) this, SIGNAL(urlChanged(QUrl))); connect(page(), SIGNAL(iconUrlChanged(QUrl)), this, SLOT(onIconUrlChanged(QUrl))); -#if defined(QWEBENGINEPAGE_DOWNLOADREQUESTED) - connect(page(), SIGNAL(downloadRequested(QNetworkRequest)), - this, SLOT(downloadRequested(QNetworkRequest))); -#endif connect(page(), &WebPage::featurePermissionRequested, this, &WebView::onFeaturePermissionRequested); #if defined(QWEBENGINEPAGE_UNSUPPORTEDCONTENT) page()->setForwardUnsupportedContent(true); @@ -494,8 +469,3 @@ void WebView::setStatusBarText(const QString &string) { m_statusBarText = string; } - -void WebView::downloadRequested(const QNetworkRequest &request) -{ - BrowserApplication::downloadManager()->download(request); -} diff --git a/examples/webenginewidgets/browser/webview.h b/examples/webenginewidgets/browser/webview.h index 2cedeb79b..e694d50ac 100644 --- a/examples/webenginewidgets/browser/webview.h +++ b/examples/webenginewidgets/browser/webview.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -65,9 +65,7 @@ public: BrowserMainWindow *mainWindow(); protected: -#if defined(QWEBENGINEPAGE_ACCEPTNAVIGATIONREQUEST) - bool acceptNavigationRequest(QWebEngineFrame *frame, const QNetworkRequest &request, NavigationType type); -#endif + bool acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame); QWebEnginePage *createWindow(QWebEnginePage::WebWindowType type); #if !defined(QT_NO_UITOOLS) QObject *createPlugin(const QString &classId, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); @@ -118,7 +116,6 @@ private slots: void setProgress(int progress); void loadFinished(bool success); void setStatusBarText(const QString &string); - void downloadRequested(const QNetworkRequest &request); void openLinkInNewTab(); void onFeaturePermissionRequested(const QUrl &securityOrigin, QWebEnginePage::Feature); void onIconUrlChanged(const QUrl &url); diff --git a/examples/webenginewidgets/browser/xbel.cpp b/examples/webenginewidgets/browser/xbel.cpp index ae84a6a37..6b4f53d2e 100644 --- a/examples/webenginewidgets/browser/xbel.cpp +++ b/examples/webenginewidgets/browser/xbel.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/browser/xbel.h b/examples/webenginewidgets/browser/xbel.h index 8ee9558ef..d95549dd8 100644 --- a/examples/webenginewidgets/browser/xbel.h +++ b/examples/webenginewidgets/browser/xbel.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the demonstration applications of the Qt Toolkit. ** @@ -10,27 +10,27 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** diff --git a/examples/webenginewidgets/fancybrowser/doc/src/fancybrowser.qdoc b/examples/webenginewidgets/fancybrowser/doc/src/fancybrowser.qdoc index f4b5321a1..e6c6ada34 100644 --- a/examples/webenginewidgets/fancybrowser/doc/src/fancybrowser.qdoc +++ b/examples/webenginewidgets/fancybrowser/doc/src/fancybrowser.qdoc @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. ** @@ -10,15 +10,15 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure +** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: http://www.gnu.org/copyleft/fdl.html. ** $QT_END_LICENSE$ diff --git a/examples/webenginewidgets/fancybrowser/fancybrowser.pro b/examples/webenginewidgets/fancybrowser/fancybrowser.pro index 5f2db6ee3..e5dcd9678 100644 --- a/examples/webenginewidgets/fancybrowser/fancybrowser.pro +++ b/examples/webenginewidgets/fancybrowser/fancybrowser.pro @@ -1,7 +1,5 @@ QT += webenginewidgets -macx: CONFIG -= app_bundle - HEADERS = mainwindow.h SOURCES = main.cpp \ mainwindow.cpp diff --git a/examples/webenginewidgets/fancybrowser/main.cpp b/examples/webenginewidgets/fancybrowser/main.cpp index e463151e9..a21d881f4 100644 --- a/examples/webenginewidgets/fancybrowser/main.cpp +++ b/examples/webenginewidgets/fancybrowser/main.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** diff --git a/examples/webenginewidgets/fancybrowser/mainwindow.cpp b/examples/webenginewidgets/fancybrowser/mainwindow.cpp index a311c2651..3dca497a3 100644 --- a/examples/webenginewidgets/fancybrowser/mainwindow.cpp +++ b/examples/webenginewidgets/fancybrowser/mainwindow.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** diff --git a/examples/webenginewidgets/fancybrowser/mainwindow.h b/examples/webenginewidgets/fancybrowser/mainwindow.h index 5f33bdf96..8e9b12538 100644 --- a/examples/webenginewidgets/fancybrowser/mainwindow.h +++ b/examples/webenginewidgets/fancybrowser/mainwindow.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** |