Format
This commit is contained in:
parent
ca7b55bf0b
commit
6dc24b52e8
1 changed files with 35 additions and 26 deletions
59
src/app.rs
59
src/app.rs
|
|
@ -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)?;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue