chore: set executable and launch dialog confirm button

This commit is contained in:
Ashley Wulber 2025-10-17 14:30:01 -04:00 committed by Ashley Wulber
parent 7be73d584d
commit ce207a54b3

View file

@ -98,6 +98,9 @@ static PERMANENT_DELETE_BUTTON_ID: LazyLock<widget::Id> =
static CONFIRM_OPEN_WITH_BUTTON_ID: LazyLock<widget::Id> = static CONFIRM_OPEN_WITH_BUTTON_ID: LazyLock<widget::Id> =
LazyLock::new(|| widget::Id::new("confirm-open-with-button")); LazyLock::new(|| widget::Id::new("confirm-open-with-button"));
static SET_EXECUTABLE_AND_LAUNCH_CONFIRM_BUTTON_ID: LazyLock<widget::Id> =
LazyLock::new(|| widget::Id::new("set-executable-and-launch-confirm-button"));
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum Mode { pub enum Mode {
App, App,
@ -756,10 +759,11 @@ impl App {
Err(err) => match err.kind() { Err(err) => match err.kind() {
io::ErrorKind::PermissionDenied => { io::ErrorKind::PermissionDenied => {
// If permission is denied, try marking as executable, then running // If permission is denied, try marking as executable, then running
tasks.push(self.dialog_pages.push_back( tasks.push(self.push_dialog(
DialogPage::SetExecutableAndLaunch { DialogPage::SetExecutableAndLaunch {
path: path.to_path_buf(), path: path.to_path_buf(),
}, },
Some(SET_EXECUTABLE_AND_LAUNCH_CONFIRM_BUTTON_ID.clone()),
)); ));
} }
_ => { _ => {
@ -5467,7 +5471,8 @@ impl Application for App {
.primary_action( .primary_action(
widget::button::text(fl!("set-and-launch")) widget::button::text(fl!("set-and-launch"))
.class(theme::Button::Suggested) .class(theme::Button::Suggested)
.on_press(Message::DialogComplete), .on_press(Message::DialogComplete)
.id(SET_EXECUTABLE_AND_LAUNCH_CONFIRM_BUTTON_ID.clone()),
) )
.secondary_action( .secondary_action(
widget::button::text(fl!("cancel")) widget::button::text(fl!("cancel"))