mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
Changed log function to accept String instead of &str
This commit is contained in:
@@ -199,8 +199,7 @@ impl FileTransferActivity {
|
|||||||
"Copied \"{}\" to \"{}\"",
|
"Copied \"{}\" to \"{}\"",
|
||||||
entry.get_abs_path().display(),
|
entry.get_abs_path().display(),
|
||||||
dest_path.display()
|
dest_path.display()
|
||||||
)
|
),
|
||||||
.as_str(),
|
|
||||||
);
|
);
|
||||||
// Reload entries
|
// Reload entries
|
||||||
let wrkdir: PathBuf = self.local.wrkdir.clone();
|
let wrkdir: PathBuf = self.local.wrkdir.clone();
|
||||||
@@ -234,8 +233,7 @@ impl FileTransferActivity {
|
|||||||
"Copied \"{}\" to \"{}\"",
|
"Copied \"{}\" to \"{}\"",
|
||||||
entry.get_abs_path().display(),
|
entry.get_abs_path().display(),
|
||||||
dest_path.display()
|
dest_path.display()
|
||||||
)
|
),
|
||||||
.as_str(),
|
|
||||||
);
|
);
|
||||||
self.reload_remote_dir();
|
self.reload_remote_dir();
|
||||||
}
|
}
|
||||||
@@ -256,10 +254,7 @@ impl FileTransferActivity {
|
|||||||
match self.host.mkdir(PathBuf::from(input.as_str()).as_path()) {
|
match self.host.mkdir(PathBuf::from(input.as_str()).as_path()) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
// Reload files
|
// Reload files
|
||||||
self.log(
|
self.log(LogLevel::Info, format!("Created directory \"{}\"", input));
|
||||||
LogLevel::Info,
|
|
||||||
format!("Created directory \"{}\"", input).as_ref(),
|
|
||||||
);
|
|
||||||
let wrkdir: PathBuf = self.local.wrkdir.clone();
|
let wrkdir: PathBuf = self.local.wrkdir.clone();
|
||||||
self.local_scan(wrkdir.as_path());
|
self.local_scan(wrkdir.as_path());
|
||||||
}
|
}
|
||||||
@@ -280,10 +275,7 @@ impl FileTransferActivity {
|
|||||||
{
|
{
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
// Reload files
|
// Reload files
|
||||||
self.log(
|
self.log(LogLevel::Info, format!("Created directory \"{}\"", input));
|
||||||
LogLevel::Info,
|
|
||||||
format!("Created directory \"{}\"", input).as_ref(),
|
|
||||||
);
|
|
||||||
self.reload_remote_dir();
|
self.reload_remote_dir();
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
@@ -320,8 +312,7 @@ impl FileTransferActivity {
|
|||||||
"Renamed file \"{}\" to \"{}\"",
|
"Renamed file \"{}\" to \"{}\"",
|
||||||
full_path.display(),
|
full_path.display(),
|
||||||
dst_path.display()
|
dst_path.display()
|
||||||
)
|
),
|
||||||
.as_ref(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
@@ -352,8 +343,7 @@ impl FileTransferActivity {
|
|||||||
"Renamed file \"{}\" to \"{}\"",
|
"Renamed file \"{}\" to \"{}\"",
|
||||||
full_path.display(),
|
full_path.display(),
|
||||||
dst_path.display()
|
dst_path.display()
|
||||||
)
|
),
|
||||||
.as_ref(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
@@ -380,7 +370,7 @@ impl FileTransferActivity {
|
|||||||
// Log
|
// Log
|
||||||
self.log(
|
self.log(
|
||||||
LogLevel::Info,
|
LogLevel::Info,
|
||||||
format!("Removed file \"{}\"", full_path.display()).as_ref(),
|
format!("Removed file \"{}\"", full_path.display()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
@@ -404,7 +394,7 @@ impl FileTransferActivity {
|
|||||||
self.reload_remote_dir();
|
self.reload_remote_dir();
|
||||||
self.log(
|
self.log(
|
||||||
LogLevel::Info,
|
LogLevel::Info,
|
||||||
format!("Removed file \"{}\"", full_path.display()).as_ref(),
|
format!("Removed file \"{}\"", full_path.display()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
@@ -467,7 +457,7 @@ impl FileTransferActivity {
|
|||||||
} else {
|
} else {
|
||||||
self.log(
|
self.log(
|
||||||
LogLevel::Info,
|
LogLevel::Info,
|
||||||
format!("Created file \"{}\"", file_path.display()).as_str(),
|
format!("Created file \"{}\"", file_path.display()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// Reload files
|
// Reload files
|
||||||
@@ -527,7 +517,7 @@ impl FileTransferActivity {
|
|||||||
} else {
|
} else {
|
||||||
self.log(
|
self.log(
|
||||||
LogLevel::Info,
|
LogLevel::Info,
|
||||||
format!("Created file \"{}\"", file_path.display()).as_str(),
|
format!("Created file \"{}\"", file_path.display()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// Reload files
|
// Reload files
|
||||||
@@ -544,10 +534,7 @@ impl FileTransferActivity {
|
|||||||
match self.host.exec(input.as_str()) {
|
match self.host.exec(input.as_str()) {
|
||||||
Ok(output) => {
|
Ok(output) => {
|
||||||
// Reload files
|
// Reload files
|
||||||
self.log(
|
self.log(LogLevel::Info, format!("\"{}\": {}", input, output));
|
||||||
LogLevel::Info,
|
|
||||||
format!("\"{}\": {}", input, output).as_ref(),
|
|
||||||
);
|
|
||||||
let wrkdir: PathBuf = self.local.wrkdir.clone();
|
let wrkdir: PathBuf = self.local.wrkdir.clone();
|
||||||
self.local_scan(wrkdir.as_path());
|
self.local_scan(wrkdir.as_path());
|
||||||
}
|
}
|
||||||
@@ -565,10 +552,7 @@ impl FileTransferActivity {
|
|||||||
match self.client.as_mut().exec(input.as_str()) {
|
match self.client.as_mut().exec(input.as_str()) {
|
||||||
Ok(output) => {
|
Ok(output) => {
|
||||||
// Reload files
|
// Reload files
|
||||||
self.log(
|
self.log(LogLevel::Info, format!("\"{}\": {}", input, output));
|
||||||
LogLevel::Info,
|
|
||||||
format!("\"{}\": {}", input, output).as_ref(),
|
|
||||||
);
|
|
||||||
self.reload_remote_dir();
|
self.reload_remote_dir();
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
@@ -651,7 +635,7 @@ impl FileTransferActivity {
|
|||||||
// Log
|
// Log
|
||||||
self.log(
|
self.log(
|
||||||
LogLevel::Info,
|
LogLevel::Info,
|
||||||
format!("Removed file \"{}\"", full_path.display()).as_ref(),
|
format!("Removed file \"{}\"", full_path.display()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
@@ -674,7 +658,7 @@ impl FileTransferActivity {
|
|||||||
self.reload_remote_dir();
|
self.reload_remote_dir();
|
||||||
self.log(
|
self.log(
|
||||||
LogLevel::Info,
|
LogLevel::Info,
|
||||||
format!("Removed file \"{}\"", full_path.display()).as_ref(),
|
format!("Removed file \"{}\"", full_path.display()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
@@ -693,6 +677,50 @@ impl FileTransferActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(super) fn action_edit_local_file(&mut self) {
|
||||||
|
if self.get_local_file_entry().is_some() {
|
||||||
|
let fsentry: FsEntry = self.get_local_file_entry().unwrap().clone();
|
||||||
|
// Check if file
|
||||||
|
if fsentry.is_file() {
|
||||||
|
self.log(
|
||||||
|
LogLevel::Info,
|
||||||
|
format!("Opening file \"{}\"...", fsentry.get_abs_path().display()),
|
||||||
|
);
|
||||||
|
// Edit file
|
||||||
|
match self.edit_local_file(fsentry.get_abs_path().as_path()) {
|
||||||
|
Ok(_) => {
|
||||||
|
// Reload directory
|
||||||
|
let pwd: PathBuf = self.local.wrkdir.clone();
|
||||||
|
self.local_scan(pwd.as_path());
|
||||||
|
}
|
||||||
|
Err(err) => self.log_and_alert(LogLevel::Error, err),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn action_edit_remote_file(&mut self) {
|
||||||
|
if self.get_remote_file_entry().is_some() {
|
||||||
|
let fsentry: FsEntry = self.get_remote_file_entry().unwrap().clone();
|
||||||
|
// Check if file
|
||||||
|
if let FsEntry::File(file) = fsentry.clone() {
|
||||||
|
self.log(
|
||||||
|
LogLevel::Info,
|
||||||
|
format!("Opening file \"{}\"...", fsentry.get_abs_path().display()),
|
||||||
|
);
|
||||||
|
// Edit file
|
||||||
|
match self.edit_remote_file(&file) {
|
||||||
|
Ok(_) => {
|
||||||
|
// Reload directory
|
||||||
|
let pwd: PathBuf = self.remote.wrkdir.clone();
|
||||||
|
self.remote_scan(pwd.as_path());
|
||||||
|
}
|
||||||
|
Err(err) => self.log_and_alert(LogLevel::Error, err),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// ### get_local_file_entry
|
/// ### get_local_file_entry
|
||||||
///
|
///
|
||||||
/// Get local file entry
|
/// Get local file entry
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ impl FileTransferActivity {
|
|||||||
/// ### log
|
/// ### log
|
||||||
///
|
///
|
||||||
/// Add message to log events
|
/// Add message to log events
|
||||||
pub(super) fn log(&mut self, level: LogLevel, msg: &str) {
|
pub(super) fn log(&mut self, level: LogLevel, msg: String) {
|
||||||
// Create log record
|
// Create log record
|
||||||
let record: LogRecord = LogRecord::new(level, msg);
|
let record: LogRecord = LogRecord::new(level, msg);
|
||||||
//Check if history overflows the size
|
//Check if history overflows the size
|
||||||
@@ -52,8 +52,8 @@ impl FileTransferActivity {
|
|||||||
///
|
///
|
||||||
/// Add message to log events and also display it as an alert
|
/// Add message to log events and also display it as an alert
|
||||||
pub(super) fn log_and_alert(&mut self, level: LogLevel, msg: String) {
|
pub(super) fn log_and_alert(&mut self, level: LogLevel, msg: String) {
|
||||||
self.log(level, msg.as_str());
|
|
||||||
self.mount_error(msg.as_str());
|
self.mount_error(msg.as_str());
|
||||||
|
self.log(level, msg);
|
||||||
// Update log
|
// Update log
|
||||||
let msg = self.update_logbox();
|
let msg = self.update_logbox();
|
||||||
self.update(msg);
|
self.update(msg);
|
||||||
|
|||||||
@@ -119,11 +119,11 @@ impl LogRecord {
|
|||||||
/// ### new
|
/// ### new
|
||||||
///
|
///
|
||||||
/// Instantiates a new LogRecord
|
/// Instantiates a new LogRecord
|
||||||
pub fn new(level: LogLevel, msg: &str) -> LogRecord {
|
pub fn new(level: LogLevel, msg: String) -> LogRecord {
|
||||||
LogRecord {
|
LogRecord {
|
||||||
time: Local::now(),
|
time: Local::now(),
|
||||||
level,
|
level,
|
||||||
msg: String::from(msg),
|
msg,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ impl FileTransferActivity {
|
|||||||
// Log welcome
|
// Log welcome
|
||||||
self.log(
|
self.log(
|
||||||
LogLevel::Info,
|
LogLevel::Info,
|
||||||
format!("Established connection with '{}': \"{}\"", addr, banner).as_ref(),
|
format!("Established connection with '{}': \"{}\"", addr, banner),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// Try to change directory to entry directory
|
// Try to change directory to entry directory
|
||||||
@@ -192,8 +192,7 @@ impl FileTransferActivity {
|
|||||||
"Could not remove created file {}: {}",
|
"Could not remove created file {}: {}",
|
||||||
remote_path.display(),
|
remote_path.display(),
|
||||||
err
|
err
|
||||||
)
|
),
|
||||||
.as_str(),
|
|
||||||
),
|
),
|
||||||
Ok(entry) => {
|
Ok(entry) => {
|
||||||
if let Err(err) = self.client.remove(&entry) {
|
if let Err(err) = self.client.remove(&entry) {
|
||||||
@@ -203,8 +202,7 @@ impl FileTransferActivity {
|
|||||||
"Could not remove created file {}: {}",
|
"Could not remove created file {}: {}",
|
||||||
remote_path.display(),
|
remote_path.display(),
|
||||||
err
|
err
|
||||||
)
|
),
|
||||||
.as_str(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -218,7 +216,7 @@ impl FileTransferActivity {
|
|||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
self.log(
|
self.log(
|
||||||
LogLevel::Info,
|
LogLevel::Info,
|
||||||
format!("Created directory \"{}\"", remote_path.display()).as_ref(),
|
format!("Created directory \"{}\"", remote_path.display()),
|
||||||
);
|
);
|
||||||
// Get files in dir
|
// Get files in dir
|
||||||
match self.host.scan_dir(dir.abs_path.as_path()) {
|
match self.host.scan_dir(dir.abs_path.as_path()) {
|
||||||
@@ -324,8 +322,7 @@ impl FileTransferActivity {
|
|||||||
"Could not remove created file {}: {}",
|
"Could not remove created file {}: {}",
|
||||||
local_file_path.display(),
|
local_file_path.display(),
|
||||||
err
|
err
|
||||||
)
|
),
|
||||||
.as_str(),
|
|
||||||
),
|
),
|
||||||
Ok(entry) => {
|
Ok(entry) => {
|
||||||
if let Err(err) = self.host.remove(&entry) {
|
if let Err(err) = self.host.remove(&entry) {
|
||||||
@@ -335,8 +332,7 @@ impl FileTransferActivity {
|
|||||||
"Could not remove created file {}: {}",
|
"Could not remove created file {}: {}",
|
||||||
local_file_path.display(),
|
local_file_path.display(),
|
||||||
err
|
err
|
||||||
)
|
),
|
||||||
.as_str(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -365,14 +361,13 @@ impl FileTransferActivity {
|
|||||||
pex,
|
pex,
|
||||||
local_dir_path.display(),
|
local_dir_path.display(),
|
||||||
err
|
err
|
||||||
)
|
),
|
||||||
.as_ref(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.log(
|
self.log(
|
||||||
LogLevel::Info,
|
LogLevel::Info,
|
||||||
format!("Created directory \"{}\"", local_dir_path.display()).as_ref(),
|
format!("Created directory \"{}\"", local_dir_path.display()),
|
||||||
);
|
);
|
||||||
// Get files in dir
|
// Get files in dir
|
||||||
match self.client.list_dir(dir.abs_path.as_path()) {
|
match self.client.list_dir(dir.abs_path.as_path()) {
|
||||||
@@ -407,8 +402,7 @@ impl FileTransferActivity {
|
|||||||
"Failed to create directory \"{}\": {}",
|
"Failed to create directory \"{}\": {}",
|
||||||
local_dir_path.display(),
|
local_dir_path.display(),
|
||||||
err
|
err
|
||||||
)
|
),
|
||||||
.as_ref(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -519,7 +513,7 @@ impl FileTransferActivity {
|
|||||||
if let Err(err) = self.client.on_sent(rhnd) {
|
if let Err(err) = self.client.on_sent(rhnd) {
|
||||||
self.log(
|
self.log(
|
||||||
LogLevel::Warn,
|
LogLevel::Warn,
|
||||||
format!("Could not finalize remote stream: \"{}\"", err).as_str(),
|
format!("Could not finalize remote stream: \"{}\"", err),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// if upload was abrupted, return error
|
// if upload was abrupted, return error
|
||||||
@@ -534,8 +528,7 @@ impl FileTransferActivity {
|
|||||||
remote.display(),
|
remote.display(),
|
||||||
fmt_millis(self.transfer.started.elapsed()),
|
fmt_millis(self.transfer.started.elapsed()),
|
||||||
ByteSize(self.transfer.bytes_per_second()),
|
ByteSize(self.transfer.bytes_per_second()),
|
||||||
)
|
),
|
||||||
.as_ref(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Err(err) => return Err(TransferErrorReason::FileTransferError(err)),
|
Err(err) => return Err(TransferErrorReason::FileTransferError(err)),
|
||||||
@@ -622,7 +615,7 @@ impl FileTransferActivity {
|
|||||||
if let Err(err) = self.client.on_recv(rhnd) {
|
if let Err(err) = self.client.on_recv(rhnd) {
|
||||||
self.log(
|
self.log(
|
||||||
LogLevel::Warn,
|
LogLevel::Warn,
|
||||||
format!("Could not finalize remote stream: \"{}\"", err).as_str(),
|
format!("Could not finalize remote stream: \"{}\"", err),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// If download was abrupted, return Error
|
// If download was abrupted, return Error
|
||||||
@@ -640,8 +633,7 @@ impl FileTransferActivity {
|
|||||||
pex,
|
pex,
|
||||||
local.display(),
|
local.display(),
|
||||||
err
|
err
|
||||||
)
|
),
|
||||||
.as_ref(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -654,8 +646,7 @@ impl FileTransferActivity {
|
|||||||
local.display(),
|
local.display(),
|
||||||
fmt_millis(self.transfer.started.elapsed()),
|
fmt_millis(self.transfer.started.elapsed()),
|
||||||
ByteSize(self.transfer.bytes_per_second()),
|
ByteSize(self.transfer.bytes_per_second()),
|
||||||
)
|
),
|
||||||
.as_ref(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Err(err) => return Err(TransferErrorReason::FileTransferError(err)),
|
Err(err) => return Err(TransferErrorReason::FileTransferError(err)),
|
||||||
@@ -713,7 +704,7 @@ impl FileTransferActivity {
|
|||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
self.log(
|
self.log(
|
||||||
LogLevel::Info,
|
LogLevel::Info,
|
||||||
format!("Changed directory on local: {}", path.display()).as_str(),
|
format!("Changed directory on local: {}", path.display()),
|
||||||
);
|
);
|
||||||
// Reload files
|
// Reload files
|
||||||
self.local_scan(path);
|
self.local_scan(path);
|
||||||
@@ -742,7 +733,7 @@ impl FileTransferActivity {
|
|||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
self.log(
|
self.log(
|
||||||
LogLevel::Info,
|
LogLevel::Info,
|
||||||
format!("Changed directory on remote: {}", path.display()).as_str(),
|
format!("Changed directory on remote: {}", path.display()),
|
||||||
);
|
);
|
||||||
// Update files
|
// Update files
|
||||||
self.remote_scan(path);
|
self.remote_scan(path);
|
||||||
@@ -800,8 +791,7 @@ impl FileTransferActivity {
|
|||||||
format!(
|
format!(
|
||||||
"Changes performed through editor saved to \"{}\"!",
|
"Changes performed through editor saved to \"{}\"!",
|
||||||
path.display()
|
path.display()
|
||||||
)
|
),
|
||||||
.as_str(),
|
|
||||||
),
|
),
|
||||||
Err(err) => return Err(format!("Could not open editor: {}", err)),
|
Err(err) => return Err(format!("Could not open editor: {}", err)),
|
||||||
}
|
}
|
||||||
@@ -865,8 +855,7 @@ impl FileTransferActivity {
|
|||||||
format!(
|
format!(
|
||||||
"File \"{}\" has changed; writing changes to remote",
|
"File \"{}\" has changed; writing changes to remote",
|
||||||
file.abs_path.display()
|
file.abs_path.display()
|
||||||
)
|
),
|
||||||
.as_ref(),
|
|
||||||
);
|
);
|
||||||
// Get local fs entry
|
// Get local fs entry
|
||||||
let tmpfile_entry: FsEntry = match self.host.stat(tmpfile.path()) {
|
let tmpfile_entry: FsEntry = match self.host.stat(tmpfile.path()) {
|
||||||
@@ -900,7 +889,7 @@ impl FileTransferActivity {
|
|||||||
false => {
|
false => {
|
||||||
self.log(
|
self.log(
|
||||||
LogLevel::Info,
|
LogLevel::Info,
|
||||||
format!("File \"{}\" hasn't changed", file.abs_path.display()).as_ref(),
|
format!("File \"{}\" hasn't changed", file.abs_path.display()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,27 +135,7 @@ impl FileTransferActivity {
|
|||||||
self.update_local_filelist()
|
self.update_local_filelist()
|
||||||
}
|
}
|
||||||
(COMPONENT_EXPLORER_LOCAL, &MSG_KEY_CHAR_O) => {
|
(COMPONENT_EXPLORER_LOCAL, &MSG_KEY_CHAR_O) => {
|
||||||
// Clone entry due to mutable stuff...
|
self.action_edit_local_file();
|
||||||
if self.get_local_file_entry().is_some() {
|
|
||||||
let fsentry: FsEntry = self.get_local_file_entry().unwrap().clone();
|
|
||||||
// Check if file
|
|
||||||
if fsentry.is_file() {
|
|
||||||
self.log(
|
|
||||||
LogLevel::Info,
|
|
||||||
format!("Opening file \"{}\"...", fsentry.get_abs_path().display())
|
|
||||||
.as_str(),
|
|
||||||
);
|
|
||||||
// Edit file
|
|
||||||
match self.edit_local_file(fsentry.get_abs_path().as_path()) {
|
|
||||||
Ok(_) => {
|
|
||||||
// Reload directory
|
|
||||||
let pwd: PathBuf = self.local.wrkdir.clone();
|
|
||||||
self.local_scan(pwd.as_path());
|
|
||||||
}
|
|
||||||
Err(err) => self.log_and_alert(LogLevel::Error, err),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Reload file list component
|
// Reload file list component
|
||||||
self.update_local_filelist()
|
self.update_local_filelist()
|
||||||
}
|
}
|
||||||
@@ -238,27 +218,8 @@ impl FileTransferActivity {
|
|||||||
self.update_remote_filelist()
|
self.update_remote_filelist()
|
||||||
}
|
}
|
||||||
(COMPONENT_EXPLORER_REMOTE, &MSG_KEY_CHAR_O) => {
|
(COMPONENT_EXPLORER_REMOTE, &MSG_KEY_CHAR_O) => {
|
||||||
// Clone entry due to mutable stuff...
|
// Edit file
|
||||||
if self.get_remote_file_entry().is_some() {
|
self.action_edit_remote_file();
|
||||||
let fsentry: FsEntry = self.get_remote_file_entry().unwrap().clone();
|
|
||||||
// Check if file
|
|
||||||
if let FsEntry::File(file) = fsentry.clone() {
|
|
||||||
self.log(
|
|
||||||
LogLevel::Info,
|
|
||||||
format!("Opening file \"{}\"...", fsentry.get_abs_path().display())
|
|
||||||
.as_str(),
|
|
||||||
);
|
|
||||||
// Edit file
|
|
||||||
match self.edit_remote_file(&file) {
|
|
||||||
Ok(_) => {
|
|
||||||
// Reload directory
|
|
||||||
let pwd: PathBuf = self.remote.wrkdir.clone();
|
|
||||||
self.remote_scan(pwd.as_path());
|
|
||||||
}
|
|
||||||
Err(err) => self.log_and_alert(LogLevel::Error, err),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Reload file list component
|
// Reload file list component
|
||||||
self.update_remote_filelist()
|
self.update_remote_filelist()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user