Revert "refactor: use libcosmic::dialog and make rfd optional"

This reverts commit a1c80efe69.
This commit is contained in:
Jeremy Soller 2024-01-30 18:53:40 -07:00
parent aac8b89e53
commit aee6b6ad31
3 changed files with 34 additions and 17 deletions

View file

@ -3,9 +3,7 @@
use cosmic::{
app::{message, Command, Core, Settings},
cosmic_config::{self, CosmicConfigEntry},
cosmic_theme,
dialog::file_chooser,
executor,
cosmic_theme, executor,
font::Font,
iced::{
clipboard, event,
@ -1439,15 +1437,17 @@ impl Application for App {
}
},
Message::OpenFileDialog => {
return cosmic::command::future(async {
if let Ok(response) = file_chooser::open::Dialog::new().open_file().await {
if let Ok(path) = response.url().to_file_path() {
return message::app(Message::OpenFile(path));
#[cfg(feature = "rfd")]
return Command::perform(
async {
if let Some(handle) = rfd::AsyncFileDialog::new().pick_file().await {
message::app(Message::OpenFile(handle.path().to_owned()))
} else {
message::none()
}
}
message::none()
});
},
|x| x,
);
}
Message::OpenFile(path) => {
self.open_tab(Some(path));