mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
feat: add entry in left panel
This commit is contained in:
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", "复制指纹"),
|
||||
("no fingerprints", "没有指纹"),
|
||||
("Select a peer", "选择一个被控端"),
|
||||
("Select peers", "选择被控端")
|
||||
("Select peers", "选择被控"),
|
||||
("Plugins", "插件")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", "Fingerabdruck kopieren"),
|
||||
("no fingerprints", "Keine Fingerabdrücke"),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", "Copiar huella digital"),
|
||||
("no fingerprints", "sin huellas digitales"),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", "کپی کردن اثر انگشت"),
|
||||
("no fingerprints", "بدون اثر انگشت"),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", "Copia firma digitale"),
|
||||
("no fingerprints", "Nessuna firma digitale"),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", "Kopieer Vingerafdruk"),
|
||||
("no fingerprints", "geen vingerafdrukken"),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", "Skopiuj sygnaturę"),
|
||||
("no fingerprints", "brak sygnatur"),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", "Копировать отпечаток"),
|
||||
("no fingerprints", "отпечатки отсутствуют"),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", "複製指紋"),
|
||||
("no fingerprints", "沒有指紋"),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -499,6 +499,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Copy Fingerprint", ""),
|
||||
("no fingerprints", ""),
|
||||
("Select a peer", ""),
|
||||
("Select peers", "")
|
||||
("Select peers", ""),
|
||||
("Plugins", "")
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -58,6 +58,33 @@ impl PluginNativeHandler for PluginNativeUIHandler {
|
||||
data: "missing cb field message".as_ptr() as _,
|
||||
});
|
||||
}
|
||||
"register_ui_entry" => {
|
||||
let title;
|
||||
if let Some(v) = data.get("title") {
|
||||
title = v.as_str().unwrap_or("");
|
||||
} else {
|
||||
title = "";
|
||||
}
|
||||
if let Some(on_tap_cb) = data.get("on_tap_cb") {
|
||||
if let Some(on_tap_cb) = on_tap_cb.as_u64() {
|
||||
let user_data = match data.get("user_data") {
|
||||
Some(user_data) => {
|
||||
user_data.as_u64().unwrap_or(0)
|
||||
},
|
||||
None => 0,
|
||||
};
|
||||
self.register_ui_entry(title, on_tap_cb, user_data);
|
||||
return Some(super::NR {
|
||||
return_type: 0,
|
||||
data: std::ptr::null(),
|
||||
});
|
||||
}
|
||||
}
|
||||
return Some(super::NR {
|
||||
return_type: -1,
|
||||
data: "missing cb field message".as_ptr() as _,
|
||||
});
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
None
|
||||
@@ -97,4 +124,26 @@ impl PluginNativeUIHandler {
|
||||
serde_json::to_string(¶m).unwrap_or("".to_string()),
|
||||
);
|
||||
}
|
||||
|
||||
/// Call with method `register_ui_entry` and the following json:
|
||||
/// ```
|
||||
/// {
|
||||
///
|
||||
/// "on_tap_cb": 0, // The function address
|
||||
/// "user_data": 0, // An opaque pointer value passed to the callback.
|
||||
/// "title": "entry name"
|
||||
/// }
|
||||
/// ```
|
||||
fn register_ui_entry(&self, title: &str, on_tap_cb: u64, user_data: u64) {
|
||||
let mut param = HashMap::new();
|
||||
param.insert("name", json!("native_ui"));
|
||||
param.insert("action", json!("register_ui_entry"));
|
||||
param.insert("title", json!(title));
|
||||
param.insert("cb", json!(on_tap_cb));
|
||||
param.insert("user_data", json!(user_data));
|
||||
crate::flutter::push_global_event(
|
||||
APP_TYPE_MAIN,
|
||||
serde_json::to_string(¶m).unwrap_or("".to_string()),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user