- {platform && platformSvg(platform, "white")}
+ return (
-
- {platform && platformSvg(platform, "white")}
-
{username}@{hostname}
+ return (
+
-
-
{alias ? alias : formatId(id)}
+
+
{alias ? alias : formatId(id)}
{svg_menu}
-
-
;
+
+
);
}
- event dblclick $(div.remote-session-link) (evt, me) {
+ // TEST dbclick
+ ["on dbclick at div.remote-session-link"](evt, me) {
createNewConnect(me.id, "connect");
}
-
- event click $(#menu) (_, me) {
- var id = me.parent.parent.id;
- var platform = me.parent.parent.attributes["platform"];
- this.$(#rdp).style.set{
- display: (platform == "Windows" && is_win) ? "block" : "none",
- };
- this.$(#forget-password).style.set{
- display: handler.peer_has_password(id) ? "block" : "none",
- };
- if (!this.type || this.type == "fav") {
- var in_fav = handler.get_fav().indexOf(id) >= 0;
- this.$(#add-fav).style.set{
- display: in_fav ? "none" : "block",
- };
- this.$(#remove-fav).style.set{
- display: in_fav ? "block" : "none",
- };
- }
+
+ // TODO #menu
+ ["on click at #menu"](_, me) {
+ let id = me.parent.parent.id;
+ let platform = me.parent.parent.attributes["platform"]; // TODO attributes["platform"]
+ this.$("#rdp").style.setProperty("display", (platform == "Windows" && is_win) ? "block" : "none");
// https://sciter.com/forums/topic/replacecustomize-context-menu/
- var menu = this.$(menu#remote-context);
- menu.attributes["remote-id"] = id;
+ let menu = this.$("menu#remote-context");
+ menu.attributes["remote-id"] = id; // // TODO attributes["remote-id"]
me.popup(menu);
}
-
- event click $(menu#remote-context li) (evt, me) {
- var action = me.id;
- var id = me.parent.attributes["remote-id"];
+ // TODO li
+ ["on click at menu#remote-context li"](evt, me) {
+ let action = me.id;
+ let id = me.parent.attributes["remote-id"];
if (action == "connect") {
createNewConnect(id, "connect");
} else if (action == "transfer") {
createNewConnect(id, "file-transfer");
} else if (action == "remove") {
if (!this.type) {
- handler.remove_peer(id);
- app.update();
+ handler.xcall("remove_peer", id);
+ app.update(); // TODO app.update()
}
} else if (action == "forget-password") {
handler.forget_password(id);
} else if (action == "shortcut") {
- handler.create_shortcut(id);
+ handler.xcall("create_shortcut", id);
} else if (action == "rdp") {
createNewConnect(id, "rdp");
} else if (action == "add-fav") {
@@ -216,15 +208,15 @@ class SessionList: Reactor.Component {
} else if (action == "tunnel") {
createNewConnect(id, "port-forward");
} else if (action == "rename") {
- var old_name = handler.get_peer_option(id, "alias");
- msgbox("custom-rename", "Rename", "
\
- ", function(res=null) {
+ let old_name = handler.xcall("get_peer_option", id, "alias");
+ msgbox("custom-rename", "Rename", "
",
+ function (res = null) {
if (!res) return;
- var name = (res.name || "").trim();
+ let name = (res.name || "").trim();
if (name != old_name) {
- handler.set_peer_option(id, "alias", name);
+ handler.xcall("set_peer_option", id, "alias", name);
}
app.update();
});
diff --git a/src/ui/common.js b/src/ui/common.js
index cfcd21933..d9fa9de27 100644
--- a/src/ui/common.js
+++ b/src/ui/common.js
@@ -217,7 +217,7 @@ function getMsgboxParams() {
}
// tmp workaround https://sciter.com/forums/topic/menu-not-be-hidden-when-open-dialog-on-linux/
-function msgbox(type, title, text, callback = null, height = 180, width = 500, retry = 0, contentStyle = "") {
+export function msgbox(type, title, text, callback = null, height = 180, width = 500, retry = 0, contentStyle = "") {
if (is_linux) { // fix menu not hidden issue
setTimeout(() => msgbox_(type, title, text, callback, height, width, retry, contentStyle), 1);
} else {
@@ -285,45 +285,45 @@ handler.msgbox_retry = function (type, title, text, hasRetry) {
}
/******************** end of msgbox ****************************************/
// TODO Progress
-function Progress()
-{
- var _val;
- var pos = -0.25;
+// function Progress()
+// {
+// var _val;
+// var pos = -0.25;
- function step() {
- if( _val !== undefined ) { this.refresh(); return false; }
- pos += 0.02;
- if( pos > 1.25)
- pos = -0.25;
- this.refresh();
- return true;
- }
+// function step() {
+// if( _val !== undefined ) { this.refresh(); return false; }
+// pos += 0.02;
+// if( pos > 1.25)
+// pos = -0.25;
+// this.refresh();
+// return true;
+// }
- function paintNoValue(gfx)
- {
- var (w,h) = this.box(#dimension,#inner);
- var x = pos * w;
- w = w * 0.25;
- gfx.fillColor( this.style#color )
- .pushLayer(#inner-box)
- .rectangle(x,0,w,h)
- .popLayer();
- return true;
- }
+// function paintNoValue(gfx)
+// {
+// var (w,h) = this.box(#dimension,#inner);
+// var x = pos * w;
+// w = w * 0.25;
+// gfx.fillColor( this.style#color )
+// .pushLayer(#inner-box)
+// .rectangle(x,0,w,h)
+// .popLayer();
+// return true;
+// }
- this[#value] = property(v) {
- get return _val;
- set {
- _val = undefined;
- pos = -0.25;
- this.paintContent = paintNoValue;
- this.animate(step);
- this.refresh();
- }
- }
+// this[#value] = property(v) {
+// get return _val;
+// set {
+// _val = undefined;
+// pos = -0.25;
+// this.paintContent = paintNoValue;
+// this.animate(step);
+// this.refresh();
+// }
+// }
- this.value = "";
-}
+// this.value = "";
+// }
const svg_eye_cross = (