This commit is contained in:
veeso
2021-05-12 20:55:17 +02:00
parent b8db557ffe
commit d96558c3df
6 changed files with 90 additions and 65 deletions

View File

@@ -28,9 +28,21 @@
// locals
use super::{FileTransferActivity, FsEntry, LogLevel};
use std::path::PathBuf;
use tuirealm::{Payload, Value};
impl FileTransferActivity {
pub(crate) fn action_local_delete(&mut self) {
// Get selection
let selection: Vec<usize> = match self.get_local_file_state() {
Some(Payload::One(Value::Usize(idx))) => vec![idx],
Some(Payload::Vec(list)) => list.into_iter().map(|x| {
match x {
Value::Usize(x) => x,
_ => panic!("File selection contains non-usize value"),
}
}),
}
let entry: Option<FsEntry> = self.get_local_file_entry().cloned();
if let Some(entry) = entry {
let full_path: PathBuf = entry.get_abs_path();
@@ -57,7 +69,7 @@ impl FileTransferActivity {
}
pub(crate) fn action_remote_delete(&mut self) {
if let Some(idx) = self.get_remote_file_idx() {
if let Some(idx) = self.get_remote_file_state() {
// Check if file entry exists
let entry = self.remote().get(idx).cloned();
if let Some(entry) = entry {