Merge tag 'epoch-1.8.0' into local/yoda-main-1.3.0
Epoch 1.8.0
This commit is contained in:
commit
0fec31749b
16 changed files with 208 additions and 50 deletions
|
|
@ -55,7 +55,7 @@ locale1 = { git = "https://github.com/pop-os/dbus-settings-bindings", optional =
|
|||
sysinfo = { version = "=0.38.0", optional = true }
|
||||
mime-apps = { package = "cosmic-mime-apps", git = "https://github.com/pop-os/cosmic-mime-apps", features = ["tokio"], optional = true }
|
||||
notify = "8.2.0"
|
||||
nmrs = { version = "3.4.2", optional = true }
|
||||
nmrs = { version = "3.5.2", optional = true }
|
||||
regex = "1.13.1"
|
||||
ron = "0.12"
|
||||
rust-embed = "8.12.0"
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ pub struct SettingsApp {
|
|||
pages: page::Binder<crate::pages::Message>,
|
||||
search_active: bool,
|
||||
search_id: cosmic::widget::Id,
|
||||
search_scroll_id: cosmic::iced::id::Id,
|
||||
search_input: String,
|
||||
search_selections: Vec<(page::Entity, section::Entity)>,
|
||||
context_title: Option<String>,
|
||||
|
|
@ -209,6 +210,7 @@ impl cosmic::Application for SettingsApp {
|
|||
pages: page::Binder::default(),
|
||||
search_active: false,
|
||||
search_id: cosmic::widget::Id::unique(),
|
||||
search_scroll_id: cosmic::iced::id::Id::new("COSMIC_search_results_scrollable"),
|
||||
search_input: String::new(),
|
||||
search_selections: Vec::default(),
|
||||
context_title: None,
|
||||
|
|
@ -1221,6 +1223,7 @@ impl SettingsApp {
|
|||
|
||||
self.page_container(settings::view_column(sections))
|
||||
.apply(scrollable)
|
||||
.apply(|w| id_container(w, self.search_scroll_id.clone()))
|
||||
.into()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,10 @@ enum Dialog {
|
|||
device: String,
|
||||
pincode: String,
|
||||
},
|
||||
RenameDevice {
|
||||
path: OwnedObjectPath,
|
||||
name: String,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
@ -353,6 +357,29 @@ impl page::Page<crate::pages::Message> for Page {
|
|||
|
||||
Some(dialog)
|
||||
}
|
||||
|
||||
Dialog::RenameDevice { name, .. } => {
|
||||
let is_valid = is_valid_bluetooth_alias(name);
|
||||
let input = widget::text_input("", name)
|
||||
.on_input(|value| Message::RenameDeviceInput(value))
|
||||
.on_submit(|_| Message::RenameDeviceConfirm);
|
||||
|
||||
let rename_button = widget::button::suggested(fl!("rename"))
|
||||
.on_press_maybe(is_valid.then_some(Message::RenameDeviceConfirm));
|
||||
|
||||
let cancel_button =
|
||||
widget::button::standard(fl!("cancel")).on_press(Message::RenameDeviceCancel);
|
||||
|
||||
let dialog = widget::dialog()
|
||||
.title(fl!("bluetooth-rename-device"))
|
||||
.control(input)
|
||||
.primary_action(rename_button)
|
||||
.secondary_action(cancel_button)
|
||||
.apply(Element::from)
|
||||
.map(Into::into);
|
||||
|
||||
Some(dialog)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -369,6 +396,10 @@ pub enum Message {
|
|||
PinConfirm,
|
||||
PopupDevice(Option<OwnedObjectPath>),
|
||||
PopupSetting(bool),
|
||||
RenameDevice(OwnedObjectPath),
|
||||
RenameDeviceInput(String),
|
||||
RenameDeviceConfirm,
|
||||
RenameDeviceCancel,
|
||||
SelectAdapter(Option<OwnedObjectPath>),
|
||||
ServiceActivate,
|
||||
ServiceEnable,
|
||||
|
|
@ -630,6 +661,10 @@ impl Page {
|
|||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
Event::DeviceRenameFailed(path) => {
|
||||
tracing::warn!("Failed to rename device {path}");
|
||||
}
|
||||
},
|
||||
|
||||
Message::PinCancel => {
|
||||
|
|
@ -836,6 +871,42 @@ impl Page {
|
|||
}
|
||||
}
|
||||
|
||||
Message::RenameDevice(path) => {
|
||||
self.model.popup_device = None;
|
||||
let name = self
|
||||
.model
|
||||
.devices
|
||||
.get(&path)
|
||||
.map_or_else(String::new, |d| d.alias_or_addr().to_owned());
|
||||
self.dialog = Some(Dialog::RenameDevice { path, name });
|
||||
}
|
||||
|
||||
Message::RenameDeviceInput(new_name) => {
|
||||
if let Some(Dialog::RenameDevice { name, .. }) = &mut self.dialog {
|
||||
*name = new_name;
|
||||
}
|
||||
}
|
||||
|
||||
Message::RenameDeviceCancel => {
|
||||
if matches!(self.dialog, Some(Dialog::RenameDevice { .. })) {
|
||||
self.dialog = None;
|
||||
}
|
||||
}
|
||||
|
||||
Message::RenameDeviceConfirm => {
|
||||
if let Some(Dialog::RenameDevice { path, name }) = self.dialog.take() {
|
||||
if let Some(connection) = self.connection.clone() {
|
||||
return cosmic::task::future(rename_device(
|
||||
connection,
|
||||
path,
|
||||
name.trim().into(),
|
||||
));
|
||||
} else {
|
||||
tracing::warn!("No DBus connection ready");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Message::ServiceActivate => {
|
||||
let activate_future = self.service_manager.activate();
|
||||
return cosmic::task::future(async move {
|
||||
|
|
@ -934,6 +1005,11 @@ fn status() -> Section<crate::pages::Message> {
|
|||
})
|
||||
}
|
||||
|
||||
fn is_valid_bluetooth_alias(name: &str) -> bool {
|
||||
let trimmed = name.trim();
|
||||
!trimmed.is_empty() && trimmed.len() <= 248
|
||||
}
|
||||
|
||||
fn popup_button(message: Option<Message>, text: &str) -> Element<'_, Message> {
|
||||
let spacing = theme::spacing();
|
||||
widget::text::body(text)
|
||||
|
|
@ -954,6 +1030,7 @@ fn connected_devices() -> Section<crate::pages::Message> {
|
|||
device_connect = fl!("bluetooth", "connect");
|
||||
device_disconnect = fl!("bluetooth", "disconnect");
|
||||
device_forget = fl!("bluetooth", "forget");
|
||||
device_rename = fl!("rename");
|
||||
});
|
||||
|
||||
Section::default()
|
||||
|
|
@ -991,13 +1068,17 @@ fn connected_devices() -> Section<crate::pages::Message> {
|
|||
.position(widget::popover::Position::Bottom)
|
||||
.on_close(Message::PopupDevice(None))
|
||||
.popup(
|
||||
widget::column::with_capacity(2)
|
||||
widget::column::with_capacity(3)
|
||||
.push_maybe(device.is_connected().then(|| {
|
||||
popup_button(
|
||||
Some(Message::DisconnectDevice(path.clone())),
|
||||
&descriptions[device_disconnect],
|
||||
)
|
||||
}))
|
||||
.push(popup_button(
|
||||
Some(Message::RenameDevice(path.clone())),
|
||||
&descriptions[device_rename],
|
||||
))
|
||||
.push_maybe(device.paired.then(|| {
|
||||
popup_button(
|
||||
Some(Message::ForgetDevice(path.clone())),
|
||||
|
|
|
|||
|
|
@ -197,6 +197,7 @@ impl<Message: Clone> Widget<Message, cosmic::Theme, Renderer> for Arrangement<'_
|
|||
);
|
||||
|
||||
shell.capture_event();
|
||||
shell.request_redraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ use nmrs::agent::{SecretAgent, SecretAgentFlags, SecretRequest, SecretResponder,
|
|||
use nmrs::raw::zbus;
|
||||
use nmrs::raw::zvariant::{Dict, OwnedObjectPath, OwnedValue, Str, Value};
|
||||
use nmrs::{
|
||||
ActiveConnection, ConnectType, ConnectionOptions, EapOptions, NetworkEvent, NetworkManager,
|
||||
SavedConnection, SettingsSummary, WifiKeyMgmt, WifiSecurity,
|
||||
ActiveConnection, ConnectByUuidConfig, ConnectType, ConnectionOptions, EapOptions,
|
||||
NetworkEvent, NetworkManager, SavedConnection, SettingsSummary, WifiKeyMgmt, WifiSecurity,
|
||||
};
|
||||
use secure_string::SecureString;
|
||||
use tokio::sync::oneshot;
|
||||
|
|
@ -620,7 +620,10 @@ async fn handle_request(nm: &NetworkManager, req: Request) -> Event {
|
|||
)
|
||||
.await
|
||||
.is_ok(),
|
||||
Request::ActivateVpn(uuid) => nm.connect_vpn_by_uuid(uuid).await.is_ok(),
|
||||
Request::ActivateVpn(uuid) => nm
|
||||
.connect_by_uuid(uuid, ConnectByUuidConfig::default())
|
||||
.await
|
||||
.is_ok(),
|
||||
Request::Deactivate(uuid) => deactivate_by_uuid(nm, uuid).await.is_ok(),
|
||||
Request::Disconnect(ssid) => disconnect_wifi_by_ssid(nm, ssid).await.is_ok(),
|
||||
Request::Forget(ssid) => nm.forget(ssid).await.is_ok(),
|
||||
|
|
@ -907,7 +910,7 @@ async fn disconnect_wifi_by_ssid(nm: &NetworkManager, ssid: &str) -> Result<(),
|
|||
}
|
||||
|
||||
async fn deactivate_by_uuid(nm: &NetworkManager, uuid: &str) -> Result<(), Error> {
|
||||
if nm.disconnect_vpn_by_uuid(uuid).await.is_ok() {
|
||||
if nm.disconnect_by_uuid(uuid).await.is_ok() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@ use super::model;
|
|||
use cosmic::desktop::{
|
||||
DesktopEntryCache, DesktopLookupContext, DesktopResolveOptions, resolve_desktop_entry,
|
||||
};
|
||||
use cosmic::iced::futures;
|
||||
use cosmic::iced::{self, Alignment, Length, window};
|
||||
use cosmic::iced::{self, Alignment, Length, futures, window};
|
||||
use cosmic::widget::space::horizontal as horizontal_space;
|
||||
use cosmic::{Apply, Element, surface, widget};
|
||||
use cosmic_config::{Config, ConfigGet};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue