mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 03:19:33 +02:00
Set auto adding for Clara downloads
This commit is contained in:
parent
467741f348
commit
a4b2077d5a
3 changed files with 13 additions and 3 deletions
|
@ -46,6 +46,10 @@ ScrollingWindow {
|
|||
hidePermissionsBar();
|
||||
}
|
||||
|
||||
function setAutoAdd(auto) {
|
||||
desktop.setAutoAdd(auto);
|
||||
}
|
||||
|
||||
Item {
|
||||
id:item
|
||||
width: pane.contentWidth
|
||||
|
@ -257,7 +261,7 @@ ScrollingWindow {
|
|||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
desktop.initWebviewProfileHandlers(webview.profile, false);
|
||||
desktop.initWebviewProfileHandlers(webview.profile);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -103,6 +103,7 @@ Rectangle {
|
|||
var newWindow = component.createObject(desktop);
|
||||
request.openIn(newWindow.webView);
|
||||
if (File.isZippedFbx(desktop.currentUrl)) {
|
||||
newWindow.setAutoAdd(true);
|
||||
runJavaScript(autoCancel);
|
||||
newWindow.loadingChanged.connect(function(status) {
|
||||
if (status > 0) {
|
||||
|
|
|
@ -104,10 +104,9 @@ OriginalDesktop.Desktop {
|
|||
property string tempDir: ""
|
||||
property bool autoAdd: false
|
||||
|
||||
function initWebviewProfileHandlers(profile, auto) {
|
||||
function initWebviewProfileHandlers(profile) {
|
||||
console.log("The webview url in desktop is: " + currentUrl);
|
||||
if (webViewProfileSetup) return;
|
||||
autoAdd = auto;
|
||||
webViewProfileSetup = true;
|
||||
|
||||
profile.downloadRequested.connect(function(download){
|
||||
|
@ -117,6 +116,7 @@ OriginalDesktop.Desktop {
|
|||
console.log("Temp dir created: " + tempDir);
|
||||
download.path = tempDir + "/" + adaptedPath;
|
||||
console.log("Path where object should download: " + download.path);
|
||||
console.log("Auto add: " + autoAdd);
|
||||
download.accept();
|
||||
if (download.state === WebEngineDownloadItem.DownloadInterrupted) {
|
||||
console.log("download failed to complete");
|
||||
|
@ -129,9 +129,14 @@ OriginalDesktop.Desktop {
|
|||
} else {
|
||||
console.log("The download was corrupted, state: " + download.state);
|
||||
}
|
||||
autoAdd = false;
|
||||
})
|
||||
}
|
||||
|
||||
function setAutoAdd(auto) {
|
||||
autoAdd = auto;
|
||||
}
|
||||
|
||||
// Create or fetch a toolbar with the given name
|
||||
function getToolbar(name) {
|
||||
var result = toolbars[name];
|
||||
|
|
Loading…
Reference in a new issue