diff --git a/Cargo.lock b/Cargo.lock index 9d2cc69d7..64a074950 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2569,9 +2569,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.34" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f84e92c0f7c9d58328b85a78557813e4bd845130db68d7184635344399423b1" +checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" dependencies = [ "unicode-xid", ] @@ -2728,9 +2728,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.10" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" +checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d" dependencies = [ "proc-macro2", ] diff --git a/src/ui/ab.tis b/src/ui/ab.tis index 5ed992480..0a6dadf1a 100644 --- a/src/ui/ab.tis +++ b/src/ui/ab.tis @@ -146,7 +146,7 @@ class SessionList: Reactor.Component { createNewConnect(id, "port-forward"); } else if (action == "rename") { var old_name = handler.get_peer_option(id, "alias"); - handler.msgbox("custom-rename", "Rename", "
\ + msgbox("custom-rename", "Rename", "
\
\
\ ", function(res=null) { diff --git a/src/ui/common.tis b/src/ui/common.tis index c7c767645..97aa81b73 100644 --- a/src/ui/common.tis +++ b/src/ui/common.tis @@ -216,7 +216,7 @@ function getMsgboxParams() { return msgbox_params; } -function msgbox(type, title, text, callback, height, width, retry=0, contentStyle="") { +function msgbox(type, title, text, callback=null, height=180, width=500, retry=0, contentStyle="") { var has_msgbox = msgbox_params != null; if (!has_msgbox && !type) return; var remember = false; @@ -249,7 +249,7 @@ function msgbox(type, title, text, callback, height, width, retry=0, contentStyl } else if (res == "!alive") { // do nothing } else if (res.type == "input-password") { - if (!is_port_forward) handler.msgbox("connecting", "Connecting...", "Logging in..."); + if (!is_port_forward) msgbox("connecting", "Connecting...", "Logging in..."); handler.login(res.password, res.remember); } else if (res.reconnect) { if (!is_port_forward) connecting(); @@ -261,19 +261,13 @@ function connecting() { handler.msgbox("connecting", "Connecting...", "Connection in progress. Please wait."); } -handler.msgbox = function(type, title, text, callback=null, height=180, width=500, retry=0, contentStyle="") { - // directly call view.Dialog from native may crash, add timer here, seem safe - // too short time, msgbox won't get focus, per my test, 150 is almost minimun - self.timer(150ms, function() { msgbox(type, title, text, callback, height, width, retry, contentStyle); }); -} - -handler.block_msgbox = function(type, title, text, callback=null, height=180, width=500, retry=0) { - msgbox(type, title, text, callback, height, width, retry); +handler.msgbox = function(type, title, text, retry=0) { + self.timer(30ms, function() { msgbox(type, title, text, null, 180, 500, retry); }); } var reconnectTimeout = 1; -handler.msgbox_retry = function(type, title, text, hasRetry, callback=null, height=180, width=500) { - handler.msgbox(type, title, text, callback, height, width, hasRetry ? reconnectTimeout : 0); +handler.msgbox_retry = function(type, title, text, hasRetry) { + handler.msgbox(type, title, text, hasRetry ? reconnectTimeout : 0); if (hasRetry) { reconnectTimeout *= 2; } else { diff --git a/src/ui/file_transfer.tis b/src/ui/file_transfer.tis index e3a9c115d..83365d0ee 100644 --- a/src/ui/file_transfer.tis +++ b/src/ui/file_transfer.tis @@ -431,7 +431,7 @@ class FolderView : Reactor.Component { event click $(.add-folder) () { var me = this; - handler.msgbox("custom", translate("Create Folder"), "
\ + msgbox("custom", translate("Create Folder"), "
\
" + translate("Please enter the folder name") + ":
\
\
", function(res=null) { @@ -440,7 +440,7 @@ class FolderView : Reactor.Component { var name = res.name.trim(); if (!name) return; if (name.indexOf(me.sep()) >= 0) { - handler.msgbox("custom-error", "Create Folder", "Invalid folder name"); + msgbox("custom-error", "Create Folder", "Invalid folder name"); return; } var path = me.joinPath(name); @@ -576,16 +576,16 @@ handler.jobDone = function(id, file_num = -1) { handler.jobError = function(id, err, file_num = -1) { var job = deleting_single_file_jobs[id]; if (job) { - handler.msgbox("custom-error", "Delete File", err); + msgbox("custom-error", "Delete File", err); return; } job = create_dir_jobs[id]; if (job) { - handler.msgbox("custom-error", "Create Folder", err); + msgbox("custom-error", "Create Folder", err); return; } if (file_num < 0) { - handler.msgbox("custom-error", "Failed", err); + msgbox("custom-error", "Failed", err); } file_transfer.job_table.updateJobStatus(id, file_num, err); } @@ -599,7 +599,7 @@ var deleting_single_file_jobs = {}; var create_dir_jobs = {} function confirmDelete(path, is_remote) { - handler.block_msgbox("custom-skip", "Confirm Delete", "
\ + msgbox("custom-skip", "Confirm Delete", "
\
" + translate('Are you sure you want to delete this file?') + "
\ " + path + "
\
", function(res=null) { @@ -619,7 +619,7 @@ handler.confirmDeleteFiles = function(id, i, name) { if (i >= n) return; var file_path = job.path; if (name) file_path += handler.get_path_sep(job.is_remote) + name; - handler.block_msgbox("custom-skip", "Confirm Delete", "
\ + msgbox("custom-skip", "Confirm Delete", "
\
" + translate('Deleting') + " #" + (i + 1) + " / " + n + " " + translate('files') + ".
\
" + translate('Are you sure you want to delete this file?') + "
\ " + name + "
\ diff --git a/src/ui/header.tis b/src/ui/header.tis index 257231bca..0c40df158 100644 --- a/src/ui/header.tis +++ b/src/ui/header.tis @@ -277,7 +277,7 @@ function handle_custom_image_quality() { var tmp = handler.get_custom_image_quality(); var bitrate0 = tmp[0] || 50; var quantizer0 = tmp.length > 1 ? tmp[1] : 100; - handler.msgbox("custom", "Custom Image Quality", "
\ + msgbox("custom", "Custom Image Quality", "
\
x% bitrate
\
x% quantizer
\
", function(res=null) { diff --git a/src/ui/index.tis b/src/ui/index.tis index 962eeacc7..777c73b1d 100644 --- a/src/ui/index.tis +++ b/src/ui/index.tis @@ -71,7 +71,7 @@ function createNewConnect(id, type) { app.remote_id.value = formatId(id); if (!id) return; if (id == my_id) { - handler.msgbox("custom-error", "Error", "You cannot connect to your own computer"); + msgbox("custom-error", "Error", "You cannot connect to your own computer"); return; } handler.set_remote_id(id); @@ -182,7 +182,7 @@ class MyIdMenu: Reactor.Component { } if (me.id == "whitelist") { var old_value = handler.get_option("whitelist").split(",").join("\n"); - handler.msgbox("custom-whitelist", translate("IP Whitelisting"), "
\ + msgbox("custom-whitelist", translate("IP Whitelisting"), "
\
" + translate("whitelist_sep") + "
\ \
\ @@ -206,7 +206,7 @@ class MyIdMenu: Reactor.Component { var configOptions = handler.get_options(); var old_relay = configOptions["relay-server"] || ""; var old_id = configOptions["custom-rendezvous-server"] || ""; - handler.msgbox("custom-server", "ID/Relay Server", "
\ + msgbox("custom-server", "ID/Relay Server", "
\
" + translate("ID Server") + ":
\
" + translate("Relay Server") + ":
\
\ @@ -231,7 +231,7 @@ class MyIdMenu: Reactor.Component { handler.set_option("stop-service", service_stopped ? "" : "Y"); } else if (me.id == "about") { var name = handler.get_app_name(); - handler.msgbox("custom-nocancel-nook-hasclose", "About " + name, "
\ + msgbox("custom-nocancel-nook-hasclose", "About " + name, "
\
Version: " + handler.get_version() + " \
Privacy Statement
\
Website
\ @@ -412,7 +412,7 @@ class UpdateMe: Reactor.Component { handler.update_me(path); }; var onerror = function(err) { - handler.msgbox("custom-error", "Download Error", "Failed to download"); + msgbox("custom-error", "Download Error", "Failed to download"); }; var onprogress = function(loaded, total) { if (!total) total = 5 * 1024 * 1024; @@ -494,7 +494,7 @@ class ModifyDefaultLogin: Reactor.Component { event click $(#modify-default-login) { if (var r = handler.modify_default_login()) { - handler.msgbox("custom-error", "Error", r); + msgbox("custom-error", "Error", r); } app.update(); } @@ -557,7 +557,7 @@ class Password: Reactor.Component { event click $(li#set-password) { var me = this; - handler.msgbox("custom-password", translate("Set Password"), "
\ + msgbox("custom-password", translate("Set Password"), "
\
" + translate('Password') + ":
\
" + translate('Confirmation') + ":
\
\ diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 2b5c2f271..22c7dc8b9 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -80,6 +80,9 @@ impl sciter::EventHandler for Handler { fn attached(&mut self, root: HELEMENT) { self.write().unwrap().element = Some(Element::from(root)); + if self.is_port_forward() { + return; + } } fn detached(&mut self, _root: HELEMENT) { @@ -855,7 +858,6 @@ impl Handler { command: bool, extended: bool, ) { - if self.peer_platform() == "Windows" { if ctrl && alt && name == "VK_DELETE" { self.ctrl_alt_del();