Implement cut, fill in x-special/gnome-copied-files mime
This commit is contained in:
parent
dca3f4c08d
commit
57fa0cdbc0
2 changed files with 49 additions and 15 deletions
20
src/app.rs
20
src/app.rs
|
|
@ -33,7 +33,7 @@ use std::{
|
|||
};
|
||||
|
||||
use crate::{
|
||||
clipboard::ClipboardContents,
|
||||
clipboard::{ClipboardContents, ClipboardKind},
|
||||
config::{AppTheme, Config, IconSizes, TabConfig, CONFIG_VERSION},
|
||||
fl, home_dir,
|
||||
key_bind::key_binds,
|
||||
|
|
@ -801,11 +801,23 @@ impl Application for App {
|
|||
}
|
||||
}
|
||||
}
|
||||
let contents = ClipboardContents::new(&paths);
|
||||
let contents = ClipboardContents::new(ClipboardKind::Copy, &paths);
|
||||
return clipboard::write_data(contents);
|
||||
}
|
||||
Message::Cut(_entity_opt) => {
|
||||
log::warn!("TODO: CUT");
|
||||
Message::Cut(entity_opt) => {
|
||||
let mut paths = Vec::new();
|
||||
let entity = entity_opt.unwrap_or_else(|| self.tab_model.active());
|
||||
if let Some(tab) = self.tab_model.data_mut::<Tab>(entity) {
|
||||
if let Some(ref items) = tab.items_opt() {
|
||||
for item in items.iter() {
|
||||
if item.selected {
|
||||
paths.push(item.path.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let contents = ClipboardContents::new(ClipboardKind::Cut, &paths);
|
||||
return clipboard::write_data(contents);
|
||||
}
|
||||
Message::DialogCancel => {
|
||||
self.dialog_pages.pop_front();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue