fix: format emails correctly
This commit is contained in:
parent
c961e87897
commit
8b296ebe8f
2 changed files with 54 additions and 4 deletions
|
|
@ -10,18 +10,22 @@ pub struct About {
|
||||||
/// The application's icon name.
|
/// The application's icon name.
|
||||||
pub application_icon: Option<String>,
|
pub application_icon: Option<String>,
|
||||||
/// Artists who contributed to the application.
|
/// Artists who contributed to the application.
|
||||||
|
#[setters(skip)]
|
||||||
pub artists: BTreeMap<String, String>,
|
pub artists: BTreeMap<String, String>,
|
||||||
/// Comments about the application.
|
/// Comments about the application.
|
||||||
pub comments: Option<String>,
|
pub comments: Option<String>,
|
||||||
/// The application's copyright.
|
/// The application's copyright.
|
||||||
pub copyright: Option<String>,
|
pub copyright: Option<String>,
|
||||||
/// Designers who contributed to the application.
|
/// Designers who contributed to the application.
|
||||||
|
#[setters(skip)]
|
||||||
pub designers: BTreeMap<String, String>,
|
pub designers: BTreeMap<String, String>,
|
||||||
/// Name of the application's developer.
|
/// Name of the application's developer.
|
||||||
pub developer_name: Option<String>,
|
pub developer_name: Option<String>,
|
||||||
/// Developers who contributed to the application.
|
/// Developers who contributed to the application.
|
||||||
|
#[setters(skip)]
|
||||||
pub developers: BTreeMap<String, String>,
|
pub developers: BTreeMap<String, String>,
|
||||||
/// Documenters who contributed to the application.
|
/// Documenters who contributed to the application.
|
||||||
|
#[setters(skip)]
|
||||||
pub documenters: BTreeMap<String, String>,
|
pub documenters: BTreeMap<String, String>,
|
||||||
/// The license text.
|
/// The license text.
|
||||||
pub license: Option<String>,
|
pub license: Option<String>,
|
||||||
|
|
@ -32,9 +36,57 @@ pub struct About {
|
||||||
/// The URL of the application’s repository.
|
/// The URL of the application’s repository.
|
||||||
pub repository_url: Option<String>,
|
pub repository_url: Option<String>,
|
||||||
/// Translators who contributed to the application.
|
/// Translators who contributed to the application.
|
||||||
|
#[setters(skip)]
|
||||||
pub translators: BTreeMap<String, String>,
|
pub translators: BTreeMap<String, String>,
|
||||||
/// The application’s version.
|
/// The application’s version.
|
||||||
pub version: Option<String>,
|
pub version: Option<String>,
|
||||||
/// The application’s website.
|
/// The application’s website.
|
||||||
pub website: Option<String>,
|
pub website: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl About {
|
||||||
|
pub fn set_artists(mut self, artists: impl Into<BTreeMap<String, String>>) -> Self {
|
||||||
|
let artists: BTreeMap<String, String> = artists.into();
|
||||||
|
self.artists = artists
|
||||||
|
.into_iter()
|
||||||
|
.map(|(k, v)| (k, format!("mailto:{v}")))
|
||||||
|
.collect();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_designers(mut self, designers: impl Into<BTreeMap<String, String>>) -> Self {
|
||||||
|
let designers: BTreeMap<String, String> = designers.into();
|
||||||
|
self.designers = designers
|
||||||
|
.into_iter()
|
||||||
|
.map(|(k, v)| (k, format!("mailto:{v}")))
|
||||||
|
.collect();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_developers(mut self, developers: impl Into<BTreeMap<String, String>>) -> Self {
|
||||||
|
let developers: BTreeMap<String, String> = developers.into();
|
||||||
|
self.developers = developers
|
||||||
|
.into_iter()
|
||||||
|
.map(|(k, v)| (k, format!("mailto:{v}")))
|
||||||
|
.collect();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_documenters(mut self, documenters: impl Into<BTreeMap<String, String>>) -> Self {
|
||||||
|
let documenters: BTreeMap<String, String> = documenters.into();
|
||||||
|
self.documenters = documenters
|
||||||
|
.into_iter()
|
||||||
|
.map(|(k, v)| (k, format!("mailto:{v}")))
|
||||||
|
.collect();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_translators(mut self, translators: impl Into<BTreeMap<String, String>>) -> Self {
|
||||||
|
let translators: BTreeMap<String, String> = translators.into();
|
||||||
|
self.translators = translators
|
||||||
|
.into_iter()
|
||||||
|
.map(|(k, v)| (k, format!("mailto:{v}")))
|
||||||
|
.collect();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -620,7 +620,7 @@ where
|
||||||
} else {
|
} else {
|
||||||
let developers: Vec<Element<crate::app::cosmic::Message>> = list
|
let developers: Vec<Element<crate::app::cosmic::Message>> = list
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(name, email)| {
|
.map(|(name, url)| {
|
||||||
widget::button::custom(
|
widget::button::custom(
|
||||||
widget::row()
|
widget::row()
|
||||||
.push(widget::text(name))
|
.push(widget::text(name))
|
||||||
|
|
@ -630,9 +630,7 @@ where
|
||||||
.align_y(Vertical::Center),
|
.align_y(Vertical::Center),
|
||||||
)
|
)
|
||||||
.class(crate::theme::Button::Text)
|
.class(crate::theme::Button::Text)
|
||||||
.on_press(crate::app::cosmic::Message::OpenUrl(format!(
|
.on_press(crate::app::cosmic::Message::OpenUrl(url))
|
||||||
"mailto:{email}"
|
|
||||||
)))
|
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.into()
|
.into()
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue