mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
@@ -232,7 +232,7 @@ class ChatBox: Reactor.Component {
|
||||
|
||||
/******************** start of msgbox ****************************************/
|
||||
var remember_password = false;
|
||||
function msgbox(type, title, content, callback=null, height=180, width=500, hasRetry=false, contentStyle="") {
|
||||
function msgbox(type, title, content, link, callback=null, height=180, width=500, hasRetry=false, contentStyle="") {
|
||||
$(body).scrollTo(0, 0);
|
||||
if (!type) {
|
||||
closeMsgbox();
|
||||
@@ -264,21 +264,21 @@ function msgbox(type, title, content, callback=null, height=180, width=500, hasR
|
||||
} else if (type.indexOf("custom") < 0 && !is_port_forward && !callback) {
|
||||
callback = function() { view.close(); }
|
||||
}
|
||||
$(#msgbox).content(<MsgboxComponent width={width} height={height} auto_login={auto_login} type={type} title={title} content={content} remember={remember} callback={callback} contentStyle={contentStyle} hasRetry={hasRetry} />);
|
||||
$(#msgbox).content(<MsgboxComponent width={width} height={height} auto_login={auto_login} type={type} title={title} content={content} link={link} remember={remember} callback={callback} contentStyle={contentStyle} hasRetry={hasRetry} />);
|
||||
}
|
||||
|
||||
function connecting() {
|
||||
handler.msgbox("connecting", "Connecting...", "Connection in progress. Please wait.");
|
||||
}
|
||||
|
||||
handler.msgbox = function(type, title, text, hasRetry=false) {
|
||||
handler.msgbox = function(type, title, text, link = "", hasRetry=false) {
|
||||
// crash somehow (when input wrong password), even with small time, for example, 1ms
|
||||
self.timer(60ms, function() { msgbox(type, title, text, null, 180, 500, hasRetry); });
|
||||
self.timer(60ms, function() { msgbox(type, title, text, link, null, 180, 500, hasRetry); });
|
||||
}
|
||||
|
||||
var reconnectTimeout = 1000;
|
||||
handler.msgbox_retry = function(type, title, text, hasRetry) {
|
||||
handler.msgbox(type, title, text, hasRetry);
|
||||
handler.msgbox_retry = function(type, title, text, link, hasRetry) {
|
||||
handler.msgbox(type, title, text, link, hasRetry);
|
||||
if (hasRetry) {
|
||||
self.timer(0, retryConnect);
|
||||
self.timer(reconnectTimeout, retryConnect);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import * as env from "@env";
|
||||
|
||||
function translate_text(text) {
|
||||
if (text.indexOf('Failed') == 0 && text.indexOf(': ') > 0) {
|
||||
var fds = text.split(': ');
|
||||
@@ -22,6 +24,7 @@ class MsgboxComponent: Reactor.Component {
|
||||
this.type = params.type;
|
||||
this.title = params.title;
|
||||
this.content = params.content;
|
||||
this.link = params.link;
|
||||
this.remember = params.remember;
|
||||
this.callback = params.callback;
|
||||
this.hasRetry = params.hasRetry;
|
||||
@@ -93,6 +96,7 @@ class MsgboxComponent: Reactor.Component {
|
||||
var content = this.getContent();
|
||||
var hasCancel = this.type.indexOf("error") < 0 && this.type.indexOf("nocancel") < 0 && this.type != "restarting";
|
||||
var hasOk = this.type != "connecting" && this.type != "success" && this.type.indexOf("nook") < 0;
|
||||
var hasLink = this.link != "";
|
||||
var hasClose = this.type.indexOf("hasclose") >= 0;
|
||||
var show_progress = this.type == "connecting";
|
||||
var me = this;
|
||||
@@ -121,6 +125,7 @@ class MsgboxComponent: Reactor.Component {
|
||||
{hasCancel || this.hasRetry ? <button .button #cancel .outline>{translate(this.hasRetry ? "OK" : "Cancel")}</button> : ""}
|
||||
{this.hasSkip() ? <button .button #skip .outline>{translate('Skip')}</button> : ""}
|
||||
{hasOk || this.hasRetry ? <button .button #submit>{translate(this.hasRetry ? "Retry" : "OK")}</button> : ""}
|
||||
{hasLink ? <button .button #jumplink .outline>{translate('JumpLink')}</button> : ""}
|
||||
{hasClose ? <button .button #cancel .outline>{translate('Close')}</button> : ""}
|
||||
</div>
|
||||
</div>
|
||||
@@ -155,6 +160,13 @@ class MsgboxComponent: Reactor.Component {
|
||||
if (this.callback) this.callback(values);
|
||||
if (this.close) this.close();
|
||||
}
|
||||
|
||||
event click $(button#jumplink) {
|
||||
stdout.println("REMOVE ME ================================= jump link" + this.link);
|
||||
if (this.link.indexOf("http") == 0) {
|
||||
env.launch(this.link);
|
||||
}
|
||||
}
|
||||
|
||||
event click $(button#submit) {
|
||||
if (this.type == "error") {
|
||||
|
||||
@@ -238,8 +238,8 @@ impl InvokeUiSession for SciterHandler {
|
||||
self.call("updatePi", &make_args!(pi_sciter));
|
||||
}
|
||||
|
||||
fn msgbox(&self, msgtype: &str, title: &str, text: &str, retry: bool) {
|
||||
self.call2("msgbox_retry", &make_args!(msgtype, title, text, retry));
|
||||
fn msgbox(&self, msgtype: &str, title: &str, text: &str, link: &str, retry: bool) {
|
||||
self.call2("msgbox_retry", &make_args!(msgtype, title, text, link, retry));
|
||||
}
|
||||
|
||||
fn new_message(&self, msg: String) {
|
||||
|
||||
Reference in New Issue
Block a user