mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-14 03:56:27 +00:00
@@ -85,6 +85,8 @@ pub trait InvokeUiCM: Send + Clone + 'static + Sized {
|
||||
fn change_theme(&self, dark: String);
|
||||
|
||||
fn change_language(&self);
|
||||
|
||||
fn show_elevation(&self, show: bool);
|
||||
}
|
||||
|
||||
impl<T: InvokeUiCM> Deref for ConnectionManager<T> {
|
||||
@@ -171,6 +173,10 @@ impl<T: InvokeUiCM> ConnectionManager<T> {
|
||||
|
||||
self.ui_handler.remove_connection(id, close);
|
||||
}
|
||||
|
||||
fn show_elevation(&self, show: bool) {
|
||||
self.ui_handler.show_elevation(show);
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -362,6 +368,9 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
|
||||
LocalConfig::set_option("lang".to_owned(), lang);
|
||||
self.cm.change_language();
|
||||
}
|
||||
Data::DataPortableService(ipc::DataPortableService::CmShowElevation(show)) => {
|
||||
self.cm.show_elevation(show);
|
||||
}
|
||||
_ => {
|
||||
|
||||
}
|
||||
@@ -757,3 +766,28 @@ fn cm_inner_send(id: i32, data: Data) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn can_elevate() -> bool {
|
||||
#[cfg(windows)]
|
||||
{
|
||||
use crate::portable_service::client::{
|
||||
PortableServiceStatus::NotStarted, PORTABLE_SERVICE_STATUS,
|
||||
};
|
||||
return !crate::platform::is_installed()
|
||||
&& PORTABLE_SERVICE_STATUS.lock().unwrap().clone() == NotStarted;
|
||||
}
|
||||
#[cfg(not(windows))]
|
||||
return false;
|
||||
}
|
||||
|
||||
pub fn elevate_portable(id: i32) {
|
||||
#[cfg(windows)]
|
||||
{
|
||||
let lock = CLIENTS.read().unwrap();
|
||||
if let Some(s) = lock.get(&id) {
|
||||
allow_err!(s.tx.send(ipc::Data::DataPortableService(
|
||||
ipc::DataPortableService::RequestStart
|
||||
)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user