mirror of
https://github.com/kristoferssolo/traxor.git
synced 2025-10-21 20:10:35 +00:00
feat(move): pre-populate path
This commit is contained in:
parent
8870478cc6
commit
f2650c7090
@ -151,6 +151,23 @@ impl<'a> App<'a> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn prepare_move_action(&mut self) {
|
||||
if let Selected::Current(current_id) = self.selected(true) {
|
||||
if let Some(torrent) = self
|
||||
.torrents
|
||||
.torrents
|
||||
.iter()
|
||||
.find(|t| t.id == Some(current_id))
|
||||
{
|
||||
if let Some(download_dir) = &torrent.download_dir {
|
||||
self.input = download_dir.clone();
|
||||
self.cursor_position = self.input.len();
|
||||
}
|
||||
}
|
||||
}
|
||||
self.input_mode = true;
|
||||
}
|
||||
|
||||
pub fn select(&mut self) {
|
||||
if let Selected::Current(current_id) = self.selected(true) {
|
||||
if self.torrents.selected.contains(¤t_id) {
|
||||
|
||||
@ -78,7 +78,7 @@ pub async fn update(app: &mut App<'_>, action: Action) -> Result<()> {
|
||||
Action::ToggleAll => app.torrents.toggle_all().await?,
|
||||
Action::PauseAll => app.torrents.stop_all().await?,
|
||||
Action::StartAll => app.torrents.start_all().await?,
|
||||
Action::Move => app.input_mode = true,
|
||||
Action::Move => app.prepare_move_action(),
|
||||
Action::Delete(x) => app.delete(x).await?,
|
||||
Action::Rename => unimplemented!(),
|
||||
Action::Select => app.select(),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user