Merge pull request #1353 from HakanSeven12/ui/options-ok-apply-close

feat(options): OK / Apply / Close with a discard guard

# Conflicts:
#	src/app/view/modal.rs
#	src/ui/window/options.rs
This commit is contained in:
Hakan Seven committed 2026-09-19 22:59:56 +03:00
commit 1c0ef9d7a0
8 files changed
+365 -55

No files matched your search

+37 -1
View File
@@ -177,6 +177,10 @@ impl OpenCADStudio {
self.drafting_settings_state = None;
self.drafting_settings_saved = None;
}
if self.active_modal == Some(Options) {
self.options_saved = None;
self.options_close_confirm = false;
}
#[cfg(not(target_arch = "wasm32"))]
if self.active_modal == Some(FileInUse) {
self.pending_save_failure = None;
@@ -7065,7 +7069,35 @@ impl OpenCADStudio {
}
// ── Options / About windows ───────────────────────────────────
Message::OptionsOpen => {
self.active_modal = Some(super::ModalKind::Options);
self.options_open();
Task::none()
}
Message::OptionsApply => {
self.options_apply();
Task::none()
}
Message::OptionsOk => {
self.options_apply();
self.options_forget();
self.close_active_modal();
Task::none()
}
Message::OptionsClose => {
if !self.options_close_confirm && self.options_dirty() {
self.options_close_confirm = true;
return Task::none();
}
self.options_discard();
self.close_active_modal();
Task::none()
}
Message::OptionsCloseDiscard => {
self.options_discard();
self.close_active_modal();
Task::none()
}
Message::OptionsCloseKeep => {
self.options_close_confirm = false;
Task::none()
}
@@ -7682,6 +7714,10 @@ impl OpenCADStudio {
if self.active_modal == Some(super::ModalKind::RecoveryPrompt) {
return self.update(Message::RecoveryDecline);
}
// The Options window's × and Esc behave like its Close button.
if self.active_modal == Some(super::ModalKind::Options) {
return self.update(Message::OptionsClose);
}
// Closing the shortcut editor with un-applied rows needs an
// explicit discard; a second close attempt (or the overlay's
// Discard button) goes through.