summaryrefslogtreecommitdiffstats
path: root/tests/quicktestbrowser/BrowserWindow.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/quicktestbrowser/BrowserWindow.qml')
-rw-r--r--tests/quicktestbrowser/BrowserWindow.qml46
1 files changed, 19 insertions, 27 deletions
diff --git a/tests/quicktestbrowser/BrowserWindow.qml b/tests/quicktestbrowser/BrowserWindow.qml
index e173080d..f93a6ccd 100644
--- a/tests/quicktestbrowser/BrowserWindow.qml
+++ b/tests/quicktestbrowser/BrowserWindow.qml
@@ -78,22 +78,6 @@ ApplicationWindow {
property alias errorPageEnabled: errorPageEnabled.checked;
}
- WebEngineProfile {
- id: testProfile
- storageName: "Test"
- httpCacheType: httpDiskCacheEnabled.checked ? WebEngineProfile.DiskHttpCache : WebEngineProfile.MemoryHttpCache;
- onDownloadRequested: {
- downloadView.visible = true
- downloadView.append(download)
- download.accept()
- }
- }
-
- WebEngineProfile {
- id: otrProfile
- offTheRecord: true
- }
-
// Make sure the Qt.WindowFullscreenButtonHint is set on OS X.
Component.onCompleted: flags = flags | Qt.WindowFullscreenButtonHint
@@ -127,7 +111,7 @@ ApplicationWindow {
Action {
shortcut: "Ctrl+T"
onTriggered: {
- tabs.createEmptyTab()
+ tabs.createEmptyTab(currentWebView.profile)
tabs.currentIndex = tabs.count - 1
addressBar.forceActiveFocus();
addressBar.selectAll();
@@ -264,13 +248,15 @@ ApplicationWindow {
id: offTheRecordEnabled
text: "Off The Record"
checkable: true
- checked: false
+ checked: currentWebView.profile.offTheRecord
+ onToggled: currentWebView.profile = checked ? otrProfile : testProfile;
}
MenuItem {
id: httpDiskCacheEnabled
text: "HTTP Disk Cache"
- checkable: true
- checked: (testProfile.httpCacheType == WebEngineProfile.DiskHttpCache)
+ checkable: !currentWebView.profile.offTheRecord
+ checked: (currentWebView.profile.httpCacheType == WebEngineProfile.DiskHttpCache)
+ onToggled: currentWebView.profile.httpCacheType = checked ? WebEngineProfile.DiskHttpCache : WebEngineProfile.MemoryHttpCache;
}
}
}
@@ -297,16 +283,17 @@ ApplicationWindow {
TabView {
id: tabs
- function createEmptyTab() {
+ function createEmptyTab(profile) {
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 })
+ tab.item.webView.profile = profile
return tab
}
anchors.fill: parent
- Component.onCompleted: createEmptyTab()
+ Component.onCompleted: createEmptyTab(testProfile)
Component {
id: tabComponent
@@ -335,7 +322,6 @@ ApplicationWindow {
WebEngineView {
id: webEngineView
- profile: offTheRecordEnabled.checked ? otrProfile : testProfile
anchors {
fill: parent
@@ -375,17 +361,17 @@ ApplicationWindow {
if (!request.userInitiated)
print("Warning: Blocked a popup window.")
else if (request.destination == WebEngineView.NewViewInTab) {
- var tab = tabs.createEmptyTab()
+ var tab = tabs.createEmptyTab(currentWebView.profile)
tabs.currentIndex = tabs.count - 1
request.openIn(tab.item.webView)
} else if (request.destination == WebEngineView.NewViewInBackgroundTab) {
- var tab = tabs.createEmptyTab()
+ var tab = tabs.createEmptyTab(currentWebView.profile)
request.openIn(tab.item.webView)
} else if (request.destination == WebEngineView.NewViewInDialog) {
- var dialog = applicationRoot.createDialog()
+ var dialog = applicationRoot.createDialog(currentWebView.profile)
request.openIn(dialog.currentWebView)
} else {
- var window = applicationRoot.createWindow()
+ var window = applicationRoot.createWindow(currentWebView.profile)
request.openIn(window.currentWebView)
}
}
@@ -506,6 +492,12 @@ ApplicationWindow {
anchors.fill: parent
}
+ function onDownloadRequested(download) {
+ downloadView.visible = true
+ downloadView.append(download)
+ download.accept()
+ }
+
ZoomController {
id: zoomController
y: parent.mapFromItem(currentWebView, 0 , 0).y - 4