diff options
Diffstat (limited to 'examples/webengine/quicknanobrowser/ApplicationRoot.qml')
-rw-r--r-- | examples/webengine/quicknanobrowser/ApplicationRoot.qml | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/examples/webengine/quicknanobrowser/ApplicationRoot.qml b/examples/webengine/quicknanobrowser/ApplicationRoot.qml index b16ee0078..b409696be 100644 --- a/examples/webengine/quicknanobrowser/ApplicationRoot.qml +++ b/examples/webengine/quicknanobrowser/ApplicationRoot.qml @@ -39,9 +39,19 @@ ****************************************************************************/ import QtQuick 2.1 +import QtWebEngine 1.1 QtObject { id: root + + property QtObject defaultProfile: WebEngineProfile { + storageName: "Default" + } + + property QtObject otrProfile: WebEngineProfile { + offTheRecord: true + } + property Component browserWindowComponent: BrowserWindow { applicationRoot: root onClosing: destroy() @@ -49,10 +59,19 @@ QtObject { property Component browserDialogComponent: BrowserDialog { onClosing: destroy() } - function createWindow() { return browserWindowComponent.createObject(root) } - function createDialog() { return browserDialogComponent.createObject(root) } + function createWindow(profile) { + var newWindow = browserWindowComponent.createObject(root) + newWindow.currentWebView.profile = profile + profile.downloadRequested.connect(newWindow.onDownloadRequested) + return newWindow + } + function createDialog(profile) { + var newDialog = browserDialogComponent.createObject(root) + newDialog.currentWebView.profile = profile + return newDialog + } function load(url) { - var browserWindow = createWindow() + var browserWindow = createWindow(defaultProfile) browserWindow.currentWebView.url = url } } |