forked from 1b-agent/opencadstudio-upstream
feat(save): native OS dialog for Save As, keep in-app format picker
Replace the custom in-app file-browser save dialog with the native OS save dialog for choosing the destination path — folder browsing and overwrite confirmation now come from the OS. A compact in-app modal still selects the DWG/DXF format and version (a native dialog cannot carry the version year) and appears only for Save As. Plain Save on an unsaved drawing defaults to DWG 2018 with no picker. The file-name field is shown only on web, where there is no native dialog. Remove the hand-rolled directory listing, folder navigation, and overwrite modal. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
f3482e8b3e
commit
6032a024d2
8 files changed
+212
-526
No files matched your search
+6
-24
@@ -558,29 +558,16 @@ impl OpenCADStudio {
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::SaveDialogNavigate(path) => {
|
||||
self.save_dialog_folder = path.clone();
|
||||
self.save_dialog_entries = crate::io::read_dir_entries(&path);
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::SaveDialogEntryClicked(path, is_dir) => {
|
||||
if is_dir {
|
||||
self.save_dialog_folder = path.clone();
|
||||
self.save_dialog_entries = crate::io::read_dir_entries(&path);
|
||||
} else {
|
||||
// Fill filename from clicked file.
|
||||
if let Some(name) = path.file_name() {
|
||||
self.save_dialog_filename = name.to_string_lossy().into_owned();
|
||||
}
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::SaveDialogConfirm => self.on_save_dialog_confirm(),
|
||||
|
||||
Message::SaveDialogCancel => self.close_save_dialog_window(),
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
Message::SaveDialogPathPicked(picked) => self.on_save_dialog_path_picked(picked),
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
Message::SaveDialogPathPicked(_) => Task::none(),
|
||||
|
||||
Message::ClearScene => {
|
||||
let i = self.active_tab;
|
||||
self.push_undo_snapshot(i, "CLEAR");
|
||||
@@ -3139,11 +3126,6 @@ impl OpenCADStudio {
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::OverwriteConfirm => self.on_overwrite_confirm(),
|
||||
Message::OverwriteCancel => {
|
||||
self.active_modal = Some(crate::app::ModalKind::SaveDialog);
|
||||
Task::none()
|
||||
}
|
||||
Message::AutoSave => self.on_autosave(),
|
||||
|
||||
Message::UnsavedPickedSavePath(Some(path)) => {
|
||||
|
||||
Reference in new issue
Block a user