1
0
Fork 0
mirror of synced 2024-05-09 15:02:24 +12:00
czkawka/krokiet/src/connect_open.rs
Rafał Mikrut 378fa1fd6e
Excluded extensions and krokiet new features (#1184)
* AVC

* Import split

* Default thread size

* Hen

* Allowed extensions

* Perf

* Connect

* Excluded

* Zmiany

* Optimization

* 4.10

* At once

* Included

* Chang

* VD

* VD

* Hashes

* Wersja

* SD

* Up

* Up

* 2024

* Dup

* Slint files

* Added  select

* Selections

* Fix

* LTO

* Actions

* Added popup delete

* AB

* V4

* Release

* LTO

* Basic moving

* Commonsy

* Moving probably works

* Popup move
2024-02-14 17:45:25 +01:00

41 lines
1.3 KiB
Rust

use directories_next::ProjectDirs;
use log::error;
use slint::ComponentHandle;
use crate::{Callabler, MainWindow};
pub fn connect_open_items(app: &MainWindow) {
app.global::<Callabler>().on_item_opened(move |path| {
match open::that(&*path) {
Ok(()) => {}
Err(e) => {
eprintln!("Failed to open file: {e}");
}
};
// TODO - this should be added to line edit
});
app.global::<Callabler>().on_open_config_folder(move || {
let Some(dirs) = ProjectDirs::from("pl", "Qarmin", "Krokiet") else {
error!("Failed to open config folder");
return;
};
let config_folder = dirs.config_dir();
if let Err(e) = open::that(config_folder) {
error!("Failed to open config folder {:?}: {e}", config_folder);
}
});
// Cache uses Czkawka name to easily change between apps
app.global::<Callabler>().on_open_cache_folder(move || {
let Some(dirs) = ProjectDirs::from("pl", "Qarmin", "Czkawka") else {
error!("Failed to open cache folder");
return;
};
let cache_folder = dirs.cache_dir();
if let Err(e) = open::that(cache_folder) {
error!("Failed to open cache folder {:?}: {e}", cache_folder);
}
});
}