示例#1
0
Secrecy VCardTool::parseSecrecy(const VCardLine &line)
{
    Secrecy secrecy;

    if(line.value().asString().lower() == "public")
        secrecy.setType(Secrecy::Public);
    if(line.value().asString().lower() == "private")
        secrecy.setType(Secrecy::Private);
    if(line.value().asString().lower() == "confidential")
        secrecy.setType(Secrecy::Confidential);

    return secrecy;
}
示例#2
0
Secrecy VCardFormatImpl::readClassValue( ContentLine *cl )
{
  ClassValue *classValue = (ClassValue *)cl->value();
  if ( classValue ) {
    Secrecy secrecy;
    switch ( classValue->type() ) {
      case ClassValue::Public:
        secrecy.setType( Secrecy::Public );
        break;
      case ClassValue::Private:
        secrecy.setType( Secrecy::Private );
        break;
      case ClassValue::Confidential:
        secrecy.setType( Secrecy::Confidential );
        break;
    }

    return secrecy;
  } else
    return Secrecy();
}
示例#3
0
VCardLine VCardTool::createSecrecy(const Secrecy &secrecy)
{
    VCardLine line("CLASS");

    int type = secrecy.type();

    if(type == Secrecy::Public)
        line.setValue("PUBLIC");
    else if(type == Secrecy::Private)
        line.setValue("PRIVATE");
    else if(type == Secrecy::Confidential)
        line.setValue("CONFIDENTIAL");

    return line;
}
示例#4
0
void VCardFormatImpl::addClassValue( VCARD::VCard *vcard, const Secrecy &secrecy )
{
  ContentLine cl;
  cl.setName( EntityTypeToParamName( EntityClass ) );

  ClassValue *v = new ClassValue;
  switch ( secrecy.type() ) {
    case Secrecy::Public:
      v->setType( (int)ClassValue::Public );
      break;
    case Secrecy::Private:
      v->setType( (int)ClassValue::Private );
      break;
    case Secrecy::Confidential:
      v->setType( (int)ClassValue::Confidential );
      break;
  }

  cl.setValue( v );
  vcard->add(cl);
}