summaryrefslogtreecommitdiff
path: root/src/viewmodel/telephone.rs
diff options
context:
space:
mode:
authorjelemux <jeremias.weber@protonmail.com>2021-01-28 22:24:32 +0100
committerjelemux <jeremias.weber@protonmail.com>2021-01-28 22:24:32 +0100
commit94a0e361e180223adf2bc9760c8810dfa3c2681f (patch)
treed29de5300d0ff0ba636f48eca8df43bb5256b49c /src/viewmodel/telephone.rs
parent3f0892368bcf475fdae39f24ef51b82b3013535f (diff)
downloadwasm-card-94a0e361e180223adf2bc9760c8810dfa3c2681f.tar.gz
wasm-card-94a0e361e180223adf2bc9760c8810dfa3c2681f.tar.bz2
use different vcard library
Diffstat (limited to 'src/viewmodel/telephone.rs')
-rw-r--r--src/viewmodel/telephone.rs56
1 files changed, 1 insertions, 55 deletions
diff --git a/src/viewmodel/telephone.rs b/src/viewmodel/telephone.rs
index f90df5d..e5f63f0 100644
--- a/src/viewmodel/telephone.rs
+++ b/src/viewmodel/telephone.rs
@@ -1,6 +1,3 @@
-use vcard::properties;
-use vcard::parameters;
-use vcard::values;
use std::collections::HashSet;
use super::*;
use crate::view::telephone::*;
@@ -20,7 +17,7 @@ pub struct Telephone {
pub text_phone: bool,
}
-impl VCardPropertyInputObject<properties::Telephone, TelephoneView> for Telephone {
+impl VCardPropertyInputObject<TelephoneView> for Telephone {
fn new() -> Self {
Self {
number: String::new(),
@@ -112,55 +109,4 @@ impl VCardPropertyInputObject<properties::Telephone, TelephoneView> for Telephon
self.number.is_empty() &&
self.extension.is_empty()
}
- fn to_vcard_property(&self) -> Result<properties::Telephone, Error> { // TODO error handling
- let mut telephone = properties::Telephone::from_telephone_value(
- values::telephone_value::TelephoneValue::from_telephone_number_str(
- self.number.clone(),
- match self.extension.is_empty() {
- true => None::<&str>,
- false => Some(&self.extension),
- },
- ).unwrap()
- );
-
- let type_values = {
- let mut type_values = HashSet::new();
-
- if self.work {
- type_values.insert(values::type_value::TypeValueWithTelephoneType::Work);
- }
- if self.home {
- type_values.insert(values::type_value::TypeValueWithTelephoneType::Home);
- }
- if self.text {
- type_values.insert(values::type_value::TypeValueWithTelephoneType::Text);
- }
- if self.voice {
- type_values.insert(values::type_value::TypeValueWithTelephoneType::Voice);
- }
- if self.fax {
- type_values.insert(values::type_value::TypeValueWithTelephoneType::Fax);
- }
- if self.cell {
- type_values.insert(values::type_value::TypeValueWithTelephoneType::Cell);
- }
- if self.video {
- type_values.insert(values::type_value::TypeValueWithTelephoneType::Video);
- }
- if self.pager {
- type_values.insert(values::type_value::TypeValueWithTelephoneType::Pager);
- }
- if self.text_phone {
- type_values.insert(values::type_value::TypeValueWithTelephoneType::TextPhone);
- }
-
- vcard::Set::from_hash_set(type_values).unwrap()
- };
-
- if let properties::Telephone::TelephoneValue { ref mut typ, .. } = telephone {
- *typ = Some(parameters::typ::TypeWithTelType::from_type_values(type_values));
- }
-
- Ok(telephone)
- }
} \ No newline at end of file