Add table of network schemes

This commit is contained in:
Jeremy Soller 2024-09-12 16:29:10 -06:00
parent 0d8fd00dd3
commit 7451ecf111
No known key found for this signature in database
GPG key ID: D02FD439211AF56F
2 changed files with 32 additions and 1 deletions

View file

@ -87,6 +87,15 @@ enter-server-address = Enter server address
network-drive-description =
Server addresses include a protocol prefix and address.
Examples: ssh://192.168.0.1, ftp://[2001:db8::1]
### Make sure to keep the comma which separates the columns
network-drive-schemes =
Available protocols,Prefix
AppleTalk,afp://
File Transfer Protocol,ftp:// or ftps://
Network File System,nfs://
Server Message Block,smb://
SSH File Transfer Protocol,sftp:// or ssh://
WebDav,dav:// or davs://
network-drive-error = Unable to access network drive
password = Password
remember-password = Remember password

View file

@ -829,7 +829,9 @@ impl App {
}
fn network_drive(&self) -> Element<Message> {
let cosmic_theme::Spacing { space_m, .. } = theme::active().cosmic().spacing;
let cosmic_theme::Spacing {
space_xxs, space_m, ..
} = theme::active().cosmic().spacing;
let mut text_input =
widget::text_input(fl!("enter-server-address"), &self.network_drive_input);
let button = if self.network_drive_connecting.is_some() {
@ -840,9 +842,29 @@ impl App {
.on_submit(Message::NetworkDriveSubmit);
widget::button::standard(fl!("connect")).on_press(Message::NetworkDriveSubmit)
};
let mut table = widget::column::with_capacity(8);
for (i, line) in fl!("network-drive-schemes").lines().enumerate() {
let mut row = widget::row::with_capacity(2);
for part in line.split(',') {
row = row.push(
widget::container(if i == 0 {
widget::text::heading(part.to_string())
} else {
widget::text::body(part.to_string())
})
.width(Length::Fill)
.padding(space_xxs),
);
}
table = table.push(row);
if i == 0 {
table = table.push(widget::divider::horizontal::light());
}
}
widget::column::with_children(vec![
text_input.into(),
widget::text(fl!("network-drive-description")).into(),
table.into(),
widget::row::with_children(vec![
widget::horizontal_space(Length::Fill).into(),
button.into(),