rename src-tauri -> src
This commit is contained in:
parent
b7b70fe22d
commit
500da04ce7
55 changed files with 11 additions and 5277 deletions
47
src/ui/drag.rs
Normal file
47
src/ui/drag.rs
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
use crate::domain::file_entry::FileEntry;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum DragPayload {
|
||||
LocalFile(String, String),
|
||||
RemoteFile(String, String, String),
|
||||
}
|
||||
|
||||
impl DragPayload {
|
||||
pub fn file_name(&self) -> &str {
|
||||
match self {
|
||||
DragPayload::LocalFile(_, name) => name,
|
||||
DragPayload::RemoteFile(_, name, _) => name,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn make_local_payload(entry: &FileEntry) -> Option<DragPayload> {
|
||||
if entry.name == ".." {
|
||||
return None;
|
||||
}
|
||||
Some(DragPayload::LocalFile(
|
||||
entry.path.clone(),
|
||||
entry.name.clone(),
|
||||
))
|
||||
}
|
||||
|
||||
pub fn make_remote_payload(entry: &FileEntry, connection_id: &str) -> Option<DragPayload> {
|
||||
if entry.name == ".." {
|
||||
return None;
|
||||
}
|
||||
Some(DragPayload::RemoteFile(
|
||||
entry.path.clone(),
|
||||
entry.name.clone(),
|
||||
connection_id.to_string(),
|
||||
))
|
||||
}
|
||||
|
||||
impl DragPayload {
|
||||
pub fn is_from_local(&self) -> bool {
|
||||
matches!(self, DragPayload::LocalFile(_, _))
|
||||
}
|
||||
|
||||
pub fn is_from_remote(&self) -> bool {
|
||||
matches!(self, DragPayload::RemoteFile(_, _, _))
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue