This commit is contained in:
parent
042114ae37
commit
f0a6c706fa
@ -186,5 +186,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Password missed", "密码没有填写"),
|
("Password missed", "密码没有填写"),
|
||||||
("Wrong credentials", "用户名或者密码错误"),
|
("Wrong credentials", "用户名或者密码错误"),
|
||||||
("Edit Tag", "修改标签"),
|
("Edit Tag", "修改标签"),
|
||||||
|
("Unremember Password", "忘掉密码"),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
13
src/ui.rs
13
src/ui.rs
@ -281,6 +281,16 @@ impl UI {
|
|||||||
Config::get_option(&key)
|
Config::get_option(&key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn peer_has_password(&self, id: String) -> bool {
|
||||||
|
!PeerConfig::load(&id).password.is_empty()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn forget_password(&self, id: String) {
|
||||||
|
let mut c = PeerConfig::load(&id);
|
||||||
|
c.password.clear();
|
||||||
|
c.store(&id);
|
||||||
|
}
|
||||||
|
|
||||||
fn get_peer_option(&self, id: String, name: String) -> String {
|
fn get_peer_option(&self, id: String, name: String) -> String {
|
||||||
let c = PeerConfig::load(&id);
|
let c = PeerConfig::load(&id);
|
||||||
c.options.get(&name).unwrap_or(&"".to_owned()).to_owned()
|
c.options.get(&name).unwrap_or(&"".to_owned()).to_owned()
|
||||||
@ -569,7 +579,6 @@ impl UI {
|
|||||||
crate::client::translate(name)
|
crate::client::translate(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn is_xfce(&self) -> bool {
|
fn is_xfce(&self) -> bool {
|
||||||
crate::platform::is_xfce()
|
crate::platform::is_xfce()
|
||||||
}
|
}
|
||||||
@ -609,6 +618,8 @@ impl sciter::EventHandler for UI {
|
|||||||
fn get_option(String);
|
fn get_option(String);
|
||||||
fn get_local_option(String);
|
fn get_local_option(String);
|
||||||
fn get_peer_option(String, String);
|
fn get_peer_option(String, String);
|
||||||
|
fn peer_has_password(String);
|
||||||
|
fn forget_password(String);
|
||||||
fn set_peer_option(String, String, String);
|
fn set_peer_option(String, String, String);
|
||||||
fn test_if_valid_server(String);
|
fn test_if_valid_server(String);
|
||||||
fn get_sound_inputs();
|
fn get_sound_inputs();
|
||||||
|
@ -119,9 +119,11 @@ class SessionList: Reactor.Component {
|
|||||||
<li #transfer>{translate('Transfer File')}</li>
|
<li #transfer>{translate('Transfer File')}</li>
|
||||||
<li #tunnel>{translate('TCP Tunneling')}</li>
|
<li #tunnel>{translate('TCP Tunneling')}</li>
|
||||||
<li #rdp>RDP<EditRdpPort /></li>
|
<li #rdp>RDP<EditRdpPort /></li>
|
||||||
|
<div .separator />
|
||||||
<li #rename>{translate('Rename')}</li>
|
<li #rename>{translate('Rename')}</li>
|
||||||
<li #remove>{translate('Remove')}</li>
|
<li #remove>{translate('Remove')}</li>
|
||||||
{is_win && <li #shortcut>{translate('Create Desktop Shortcut')}</li>}
|
{is_win && <li #shortcut>{translate('Create Desktop Shortcut')}</li>}
|
||||||
|
<li #forget-password>{translate('Unremember Password')}</li>
|
||||||
</menu>
|
</menu>
|
||||||
</popup>
|
</popup>
|
||||||
{sessions}
|
{sessions}
|
||||||
@ -169,9 +171,12 @@ class SessionList: Reactor.Component {
|
|||||||
event click $(#menu) (_, me) {
|
event click $(#menu) (_, me) {
|
||||||
var id = me.parent.parent.id;
|
var id = me.parent.parent.id;
|
||||||
var platform = me.parent.parent.attributes["platform"];
|
var platform = me.parent.parent.attributes["platform"];
|
||||||
$(#rdp).style.set{
|
this.$(#rdp).style.set{
|
||||||
display: (platform == "Windows" && is_win) ? "block" : "none",
|
display: (platform == "Windows" && is_win) ? "block" : "none",
|
||||||
};
|
};
|
||||||
|
this.$(#forget-password).style.set{
|
||||||
|
display: handler.peer_has_password(id) ? "block" : "none",
|
||||||
|
};
|
||||||
// https://sciter.com/forums/topic/replacecustomize-context-menu/
|
// https://sciter.com/forums/topic/replacecustomize-context-menu/
|
||||||
var menu = this.$(menu#remote-context);
|
var menu = this.$(menu#remote-context);
|
||||||
menu.attributes["remote-id"] = id;
|
menu.attributes["remote-id"] = id;
|
||||||
@ -190,6 +195,8 @@ class SessionList: Reactor.Component {
|
|||||||
handler.remove_peer(id);
|
handler.remove_peer(id);
|
||||||
app.update();
|
app.update();
|
||||||
}
|
}
|
||||||
|
} else if (action == "forget-password") {
|
||||||
|
handler.forget_password(id);
|
||||||
} else if (action == "shortcut") {
|
} else if (action == "shortcut") {
|
||||||
handler.create_shortcut(id);
|
handler.create_shortcut(id);
|
||||||
} else if (action == "rdp") {
|
} else if (action == "rdp") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user