mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 20:24:13 +02:00
saving work
This commit is contained in:
parent
f60deb0cfc
commit
9f33af479d
1 changed files with 36 additions and 13 deletions
|
@ -23,12 +23,15 @@ Item {
|
||||||
property bool keyboardRaised: false
|
property bool keyboardRaised: false
|
||||||
property bool punctuationMode: false
|
property bool punctuationMode: false
|
||||||
property bool isDesktop: false
|
property bool isDesktop: false
|
||||||
|
property bool startingUp: true
|
||||||
property bool removingPage: false
|
property bool removingPage: false
|
||||||
property bool loadingPage: false
|
|
||||||
property alias webView: webview
|
property alias webView: webview
|
||||||
property alias profile: webview.profile
|
property alias profile: webview.profile
|
||||||
property bool remove: false
|
property bool remove: false
|
||||||
property bool newPage: false
|
property bool windowClosed: false
|
||||||
|
property bool loadingStarted: false
|
||||||
|
property bool loadingFinished: false
|
||||||
|
property var urlList: []
|
||||||
|
|
||||||
|
|
||||||
property int currentPage: -1 // used as a model for repeater
|
property int currentPage: -1 // used as a model for repeater
|
||||||
|
@ -145,10 +148,6 @@ Item {
|
||||||
view.setEnabled(true);
|
view.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isNewPageOpen() {
|
|
||||||
return (web.newPage && web.currentPage > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
function shouldLoadUrl(url) {
|
function shouldLoadUrl(url) {
|
||||||
switch (url) {
|
switch (url) {
|
||||||
case "https://twitter.com/intent/sessions":
|
case "https://twitter.com/intent/sessions":
|
||||||
|
@ -156,30 +155,41 @@ Item {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function urlAppend(url) {
|
function urlAppend(url) {
|
||||||
console.log(url);
|
console.log(url);
|
||||||
if (removingPage || shouldLoadUrl(url) || isNewPageOpen()) {
|
if (removingPage || shouldLoadUrl(url)) {
|
||||||
removingPage = false;
|
removingPage = false;
|
||||||
web.newPage = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var lurl = decodeURIComponent(url)
|
var lurl = decodeURIComponent(url)
|
||||||
if (lurl[lurl.length - 1] !== "/") {
|
if (lurl[lurl.length - 1] !== "/") {
|
||||||
lurl = lurl + "/"
|
lurl = lurl + "/"
|
||||||
}
|
}
|
||||||
if (currentPage === -1 || (pagesModel.get(currentPage).webUrl !== lurl && !timer.running)) {
|
console.log("-------> trying to append url <------------");
|
||||||
|
console.log(currentPage);
|
||||||
|
console.log(pagesModel.get(currentPage).webUrl !== lurl);
|
||||||
|
if (currentPage === -1 || (pagesModel.get(currentPage).webUrl !== lurl)) {
|
||||||
timer.start();
|
timer.start();
|
||||||
|
console.log("---------> appending url <-------------");
|
||||||
pagesModel.append({webUrl: lurl});
|
pagesModel.append({webUrl: lurl});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
onCurrentPageChanged: {
|
onCurrentPageChanged: {
|
||||||
if (currentPage >= 0 && currentPage < pagesModel.count) {
|
if (currentPage >= 0 && currentPage < pagesModel.count && removingPage) {
|
||||||
timer.start();
|
timer.start();
|
||||||
webview.url = pagesModel.get(currentPage).webUrl;
|
webview.url = pagesModel.get(currentPage).webUrl;
|
||||||
web.url = webview.url;
|
web.url = webview.url;
|
||||||
web.address = webview.url;
|
web.address = webview.url;
|
||||||
|
removingPage = false;
|
||||||
|
} else if (startingUp) {
|
||||||
|
webview.url = pagesModel.get(currentPage).webUrl;
|
||||||
|
web.url = webview.url;
|
||||||
|
web.address = webview.url;
|
||||||
|
startingUp = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onUrlChanged: {
|
onUrlChanged: {
|
||||||
|
@ -270,8 +280,9 @@ Item {
|
||||||
// Required to support clicking on "hifi://" links
|
// Required to support clicking on "hifi://" links
|
||||||
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
|
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
|
||||||
var url = loadRequest.url.toString();
|
var url = loadRequest.url.toString();
|
||||||
urlAppend(url);
|
web.urlList.push(url);
|
||||||
loadingPage = true;
|
//urlAppend(url);
|
||||||
|
web.loadingStarted = true;
|
||||||
if (urlHandler.canHandleUrl(url)) {
|
if (urlHandler.canHandleUrl(url)) {
|
||||||
if (urlHandler.handleUrl(url)) {
|
if (urlHandler.handleUrl(url)) {
|
||||||
root.stop();
|
root.stop();
|
||||||
|
@ -282,10 +293,22 @@ Item {
|
||||||
if (WebEngineView.LoadFailedStatus == loadRequest.status) {
|
if (WebEngineView.LoadFailedStatus == loadRequest.status) {
|
||||||
console.log(" Tablet WebEngineView failed to laod url: " + loadRequest.url.toString());
|
console.log(" Tablet WebEngineView failed to laod url: " + loadRequest.url.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (WebEngineView.LoadSucceededStatus == loadRequest.status) {
|
||||||
|
console.log
|
||||||
|
urlList = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onWindowCloseRequested: {
|
||||||
|
console.log("---------->requested to closeWindow <--------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
onNewViewRequested: {
|
onNewViewRequested: {
|
||||||
web.newPage = true;
|
console.log("-----------> newViewRequested <--------------");
|
||||||
|
var currentUrl = webview.url;
|
||||||
|
console.log(currentUrl);
|
||||||
|
urlAppend(currentUrl);
|
||||||
request.openIn(webview);
|
request.openIn(webview);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue