Merge remote-tracking branch 'upstream/master' into local/libcosmic-path-patch

# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	src/app.rs
#	src/dialog.rs
#	src/menu.rs
#	src/tab.rs
This commit is contained in:
Lionel DARNIS 2026-08-19 22:02:40 +02:00
commit 1488e2b01b
43 changed files with 2154 additions and 1007 deletions

View file

@ -181,7 +181,9 @@ fn button_appearance(
appearance.icon_color = Some(Color::from(cosmic.on_bg_component_color()));
appearance.text_color = Some(Color::from(cosmic.on_bg_component_color()));
if cut {
appearance.text_color = Some(Color::from(cosmic.background(false).component.on_disabled));
appearance.text_color = Some(Color::from(
cosmic.background(theme.transparent).component.on_disabled,
));
} else {
appearance.text_color = Some(Color::from(cosmic.on_bg_component_color()));
}
@ -192,12 +194,16 @@ fn button_appearance(
appearance.background = Some(Color::from(cosmic.bg_color()).into());
appearance.icon_color = Some(Color::from(cosmic.on_bg_color()));
if cut {
appearance.text_color = Some(Color::from(cosmic.background(false).component.disabled));
appearance.text_color = Some(Color::from(
cosmic.background(theme.transparent).component.disabled,
));
} else {
appearance.text_color = Some(Color::from(cosmic.on_bg_color()));
}
} else if cut {
appearance.text_color = Some(Color::from(cosmic.background(false).component.on_disabled));
appearance.text_color = Some(Color::from(
cosmic.background(theme.transparent).component.on_disabled,
));
}
if focused && accent {
appearance.outline_width = 1.0;
@ -945,11 +951,24 @@ fn item_from_trash_child(
metadata: fs::Metadata,
sizes: IconSizes,
) -> Option<Item> {
let original_path = crate::trash::original_path_for_trash_child(&path)?;
let Some(original_path) = crate::trash::original_path_for_trash_child(&path) else {
log::warn!(
"failed to resolve original path for trash item {}, skipping entry",
path.display()
);
return None;
};
let Some(original_parent) = original_path.parent() else {
log::warn!(
"trash item {} has no original parent, skipping entry",
path.display()
);
return None;
};
let entry = trash::TrashItem {
id: path.as_os_str().to_os_string(),
name: std::ffi::OsString::from(&name),
original_parent: original_path.parent()?.to_path_buf(),
original_parent: original_parent.to_path_buf(),
time_deleted: 0,
};
let size = if metadata.is_dir() {
@ -1042,6 +1061,7 @@ pub fn scan_path(tab_path: &PathBuf, sizes: IconSizes) -> Vec<Item> {
if !remote_scannable {
match fs::read_dir(tab_path) {
Ok(entries) => {
let trash = crate::trash::is_trash_path(tab_path);
items = entries
.filter_map(|entry_res| {
let entry = entry_res
@ -1082,7 +1102,6 @@ pub fn scan_path(tab_path: &PathBuf, sizes: IconSizes) -> Vec<Item> {
})
.ok()?;
let trash = crate::trash::is_trash_path(tab_path);
if trash {
item_from_trash_child(path, name, metadata, sizes)
} else {
@ -2382,10 +2401,8 @@ impl Item {
widget::image(handle.clone()).into()
}
ItemThumbnail::Svg(handle) => widget::svg(handle.clone()).into(),
ItemThumbnail::Text(content) => widget::text_editor(content)
.class(cosmic::theme::iced::TextEditor::Custom(Box::new(
text_editor_class,
)))
ItemThumbnail::Text(content) => widget::text_editor::text_editor(content)
.style(text_editor_class)
.width(THUMBNAIL_SIZE as f32)
.height(Length::Fixed(THUMBNAIL_SIZE as f32))
.padding(spacing.space_xxs)
@ -2436,7 +2453,7 @@ impl Item {
);
let mut details = widget::column::with_capacity(8).spacing(space_xxxs);
details = details.push(widget::text::heading(self.name.clone()));
details = details.push(widget::selectable_text::heading(self.name.clone()));
details = details.push(widget::text::body(fl!(
"type",
mime = self.mime.to_string()
@ -2493,21 +2510,21 @@ impl Item {
let time_formatter = time_formatter(military_time);
if let Ok(time) = metadata.created() {
details = details.push(widget::text::body(fl!(
details = details.push(widget::selectable_text::body(fl!(
"item-created",
created = format_time(time, &date_time_formatter, &time_formatter).to_string()
)));
}
if let Ok(time) = metadata.modified() {
details = details.push(widget::text::body(fl!(
details = details.push(widget::selectable_text::body(fl!(
"item-modified",
modified = format_time(time, &date_time_formatter, &time_formatter).to_string()
)));
}
if let Ok(time) = metadata.accessed() {
details = details.push(widget::text::body(fl!(
details = details.push(widget::selectable_text::body(fl!(
"item-accessed",
accessed = format_time(time, &date_time_formatter, &time_formatter).to_string()
)));
@ -3859,6 +3876,28 @@ impl Tab {
}
Message::EditLocationSubmit => {
if let Some(mut edit_location) = self.edit_location.take() {
let typed_opt = match &edit_location.location {
Location::Path(path) => path.to_str().map(str::to_string),
Location::Network(uri, ..) => Some(uri.clone()),
_ => None,
};
let mut typed_uri = false;
if let Some(typed) = typed_opt {
match typed.trim().parse::<url::Url>() {
Ok(url) if url.scheme() != "file" && url.has_host() => {
let uri = url.as_str().to_string();
edit_location =
Location::Network(uri.clone(), uri, None).normalize().into();
typed_uri = true;
}
Err(_) if matches!(edit_location.location, Location::Network(..)) => {
edit_location =
Location::Path(PathBuf::from(typed)).normalize().into();
}
_ => {}
}
}
// Select first completion if current location does not exist
if edit_location.selected.is_none()
&& edit_location
@ -3874,6 +3913,9 @@ impl Tab {
}
cd = edit_location.resolve();
if cd.is_none() && typed_uri {
cd = Some(edit_location.location);
}
}
}
Message::EditLocationTab => {
@ -5174,9 +5216,11 @@ impl Tab {
}
ItemThumbnail::Text(text) => {
element_opt = Some(
widget::container(widget::text_editor(text).padding(space_xxs).class(
cosmic::theme::iced::TextEditor::Custom(Box::new(text_editor_class)),
))
widget::container(
widget::text_editor::text_editor(text)
.padding(space_xxs)
.style(text_editor_class),
)
.center(Length::Fill)
.into(),
);
@ -7012,7 +7056,8 @@ impl Tab {
let path = path.clone();
// Acquire semaphore permit
_ = THUMB_SEMAPHORE.acquire().await;
let _permit =
THUMB_SEMAPHORE.acquire().await.unwrap();
tokio::task::spawn_blocking(move || {
let start = Instant::now();