This commit is contained in:
Jeremy Soller 2025-03-19 09:55:01 -06:00
parent ca7b55bf0b
commit 6dc24b52e8
No known key found for this signature in database
GPG key ID: 670FDFB5428E05CA

View file

@ -438,7 +438,7 @@ pub enum DialogPage {
ExtractTo { ExtractTo {
paths: Vec<PathBuf>, paths: Vec<PathBuf>,
to: PathBuf, to: PathBuf,
password: Option<String> password: Option<String>,
}, },
EmptyTrash, EmptyTrash,
FailedOperation(u64), FailedOperation(u64),
@ -2222,13 +2222,17 @@ impl Application for App {
DialogPage::EmptyTrash => { DialogPage::EmptyTrash => {
self.operation(Operation::EmptyTrash); self.operation(Operation::EmptyTrash);
} }
DialogPage::ExtractTo { paths, to, password } => { DialogPage::ExtractTo {
paths,
to,
password,
} => {
self.operation(Operation::Extract { self.operation(Operation::Extract {
paths, paths,
to, to,
password: None, password: None,
}); });
}, }
DialogPage::FailedOperation(id) => { DialogPage::FailedOperation(id) => {
log::warn!("TODO: retry operation {}", id); log::warn!("TODO: retry operation {}", id);
} }
@ -2377,7 +2381,6 @@ impl Application for App {
} }
} }
Message::ExtractTo(entity_opt) => { Message::ExtractTo(entity_opt) => {
let paths = self.selected_paths(entity_opt); let paths = self.selected_paths(entity_opt);
if let Some(destination) = paths if let Some(destination) = paths
.first() .first()
@ -2385,9 +2388,9 @@ impl Application for App {
.map(|parent| parent.to_path_buf()) .map(|parent| parent.to_path_buf())
{ {
self.dialog_pages.push_back(DialogPage::ExtractTo { self.dialog_pages.push_back(DialogPage::ExtractTo {
paths, paths,
to: destination, to: destination,
password: None, password: None,
}); });
}; };
} }
@ -4103,24 +4106,30 @@ impl Application for App {
.secondary_action( .secondary_action(
widget::button::standard(fl!("cancel")).on_press(Message::DialogCancel), widget::button::standard(fl!("cancel")).on_press(Message::DialogCancel),
), ),
DialogPage::ExtractTo { paths, to, password } => { DialogPage::ExtractTo {
widget::dialog() paths,
.title(fl!("extract-to")) to,
.body(fl!("extract-to-prompt")) password,
.control(widget::text_input("Enter the path to extract to", to.to_string_lossy()).on_input( } => widget::dialog()
move |to| { .title(fl!("extract-to"))
Message::DialogUpdate(DialogPage::ExtractTo { paths: paths.clone(), to: PathBuf::from(to), password: password.clone() }) .body(fl!("extract-to-prompt"))
}, .control(
)) widget::text_input("Enter the path to extract to", to.to_string_lossy())
.primary_action( .on_input(move |to| {
widget::button::suggested(fl!("extract-here")) Message::DialogUpdate(DialogPage::ExtractTo {
.on_press(Message::DialogComplete), paths: paths.clone(),
) to: PathBuf::from(to),
.secondary_action( password: password.clone(),
widget::button::standard(fl!("cancel")).on_press(Message::DialogCancel), })
) }),
)
} .primary_action(
widget::button::suggested(fl!("extract-here"))
.on_press(Message::DialogComplete),
)
.secondary_action(
widget::button::standard(fl!("cancel")).on_press(Message::DialogCancel),
),
DialogPage::FailedOperation(id) => { DialogPage::FailedOperation(id) => {
//TODO: try next dialog page (making sure index is used by Dialog messages)? //TODO: try next dialog page (making sure index is used by Dialog messages)?
let (operation, _, err) = self.failed_operations.get(id)?; let (operation, _, err) = self.failed_operations.get(id)?;