popup windows

This commit is contained in:
James B. Pollack 2016-02-19 13:48:54 -08:00
parent e3ae2baa7b
commit 66e8f070e4
3 changed files with 27 additions and 12 deletions

View file

@ -14,7 +14,8 @@ Window {
destroyOnInvisible: true
width: 800
height: 600
property alias webView: webview
Component.onCompleted: {
visible = true
addressBar.text = webview.url
@ -28,6 +29,7 @@ Window {
}
Item {
id:item
anchors.fill: parent
Rectangle {
anchors.left: parent.left
@ -125,12 +127,10 @@ Window {
console.log("New icon: " + icon)
}
profile: WebEngineProfile {
id: webviewProfile
storageName: "qmlUserBrowser"
}
profile: desktop.browserProfile
}
} // item
Keys.onPressed: {

View file

@ -11,6 +11,7 @@ WebEngineView {
root.javaScriptConsoleMessage.connect(function(level, message, lineNumber, sourceID) {
console.log("Web Window JS message: " + sourceID + " " + lineNumber + " " + message);
});
}
// FIXME hack to get the URL with the auth token included. Remove when we move to Qt 5.6
@ -36,6 +37,11 @@ WebEngineView {
}
}
onFeaturePermissionRequested: {
console.log('permission requested',securityOrigin, feature)
grantFeaturePermission(securityOrigin, feature, true);
}
onLoadingChanged: {
// Required to support clicking on "hifi://" links
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
@ -48,9 +54,12 @@ WebEngineView {
}
}
profile: WebEngineProfile {
id: webviewProfile
httpUserAgent: "Mozilla/5.0 (HighFidelityInterface)"
storageName: "qmlWebEngine"
onNewViewRequested:{
var component = Qt.createComponent("../Browser.qml");
var newWindow = component.createObject(desktop);
request.openIn(newWindow.webView)
}
profile: desktop.browserProfile
}

View file

@ -9,8 +9,8 @@ Desktop {
id: desktop
Component.onCompleted: {
WebEngine.settings.javascriptCanOpenWindows = false;
WebEngine.settings.javascriptCanAccessClipboard = false;
WebEngine.settings.javascriptCanOpenWindows = true;
WebEngine.settings.javascriptCanAccessClipboard = true;
WebEngine.settings.spatialNavigationEnabled = true;
WebEngine.settings.localContentCanAccessRemoteUrls = true;
}
@ -18,6 +18,12 @@ Desktop {
// The tool window, one instance
property alias toolWindow: toolWindow
ToolWindow { id: toolWindow }
property var browserProfile: WebEngineProfile {
id: webviewProfile
httpUserAgent: "Chrome/48.0 (HighFidelityInterface)"
storageName: "qmlWebEngine"
}
Action {
text: "Open Browser"