Confirm clearing active downloads
This commit is contained in:
@@ -23,6 +23,7 @@ pub struct ElyShell {
|
||||
command_input: Entity<InputState>,
|
||||
last_intent: Option<CommandIntent>,
|
||||
download_file_error: Option<String>,
|
||||
download_clear_confirmation: bool,
|
||||
_command_subscription: Subscription,
|
||||
}
|
||||
|
||||
@@ -79,6 +80,7 @@ impl ElyShell {
|
||||
command_input,
|
||||
last_intent: None,
|
||||
download_file_error: None,
|
||||
download_clear_confirmation: false,
|
||||
_command_subscription: command_subscription,
|
||||
}
|
||||
}
|
||||
@@ -249,6 +251,25 @@ impl ElyShell {
|
||||
}
|
||||
}
|
||||
|
||||
fn request_clear_active_profile_downloads(&mut self, cx: &mut Context<Self>) {
|
||||
self.download_clear_confirmation = true;
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
fn cancel_clear_active_profile_downloads(&mut self, cx: &mut Context<Self>) {
|
||||
self.download_clear_confirmation = false;
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
fn clear_active_profile_downloads(&mut self, cx: &mut Context<Self>) {
|
||||
if let ShellState::Ready(core) = &mut self.state {
|
||||
core.clear_downloads_for_active_profile();
|
||||
}
|
||||
self.download_clear_confirmation = false;
|
||||
self.download_file_error = None;
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
fn open_download_file(&mut self, download_id: &DownloadId, cx: &mut Context<Self>) {
|
||||
self.run_download_file_action(download_id, DownloadFileAction::Open, cx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user