Implement browsing project save location

This commit is contained in:
Jaby 2025-03-19 21:17:26 +01:00
parent d42fe2776c
commit 18e6800e0f
1 changed files with 14 additions and 2 deletions

View File

@ -113,7 +113,19 @@ pub(super) fn on_browse_open_project_clicked() -> impl FnMut(&mut FileTab, &Main
}
pub(super) fn on_browse_save_project_clicked() -> impl FnMut(&mut FileTab, &MainWindow) -> Result<(), Error> + 'static {
move |_file_tab, _main_window| {
Err(Error::not_implemented("on_browse_save_project_clicked"))
move |_file_tab, main_window| {
let file_path = FileDialog::new()
.add_filter("TIM project file (.tim_project)", &["tim_project"])
.add_filter("JSON file (.json; .jsn)", &["json", "jsn"])
.add_filter("All", &["*"])
.set_title("Save location for TIM project file")
.save_file();
if let Some(file_path) = file_path {
if let Some(file_path) = file_path.to_str() {
main_window.set_project_widget_save_project_path(SharedString::from(file_path));
}
}
Ok(())
}
}