Add profile download policy
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use crate::ProfileId;
|
||||
use crate::{DownloadPolicy, ProfileId};
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub enum ProfileKind {
|
||||
@@ -12,12 +12,19 @@ pub struct Profile {
|
||||
name: String,
|
||||
color_hex: u32,
|
||||
kind: ProfileKind,
|
||||
download_policy: DownloadPolicy,
|
||||
}
|
||||
|
||||
impl Profile {
|
||||
#[must_use]
|
||||
pub fn new(name: impl Into<String>, color_hex: u32, kind: ProfileKind) -> Self {
|
||||
Self { id: ProfileId::new(), name: name.into(), color_hex, kind }
|
||||
Self {
|
||||
id: ProfileId::new(),
|
||||
name: name.into(),
|
||||
color_hex,
|
||||
kind,
|
||||
download_policy: DownloadPolicy::ask_every_time(),
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
@@ -39,4 +46,13 @@ impl Profile {
|
||||
pub fn kind(&self) -> &ProfileKind {
|
||||
&self.kind
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn download_policy(&self) -> &DownloadPolicy {
|
||||
&self.download_policy
|
||||
}
|
||||
|
||||
pub fn set_download_policy(&mut self, download_policy: DownloadPolicy) {
|
||||
self.download_policy = download_policy;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user