-rw-r--r-- | kabc/vcardparser/vcardtool.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/kabc/vcardparser/vcardtool.cpp b/kabc/vcardparser/vcardtool.cpp index 01c5b3e..71f29d7 100644 --- a/kabc/vcardparser/vcardtool.cpp +++ b/kabc/vcardparser/vcardtool.cpp @@ -94,29 +94,40 @@ QString VCardTool::createVCards( Addressee::List list, VCard::Version version ) address.append( (*it).locality().replace( QRegExp(";"), "\\;" ) ); address.append( (*it).region().replace( QRegExp(";"), "\\;" ) ); address.append( (*it).postalCode().replace( QRegExp(";"), "\\;" ) ); address.append( (*it).country().replace( QRegExp(";"), "\\;" ) ); VCardLine adrLine( "ADR", address.join( ";" ) ); VCardLine labelLine( "LABEL", (*it).label() ); bool hasLabel = !(*it).label().isEmpty(); QMap<QString, int>::Iterator typeIt; for ( typeIt = mAddressTypeMap.begin(); typeIt != mAddressTypeMap.end(); ++typeIt ) { if ( typeIt.data() & (*it).type() ) { + if ( version == VCard::v3_0 ) { + adrLine.addParameter( "TYPE", typeIt.key().lower() ); + } + else { adrLine.addParameter( "TYPE", typeIt.key() ); - if ( hasLabel ) + } + if ( hasLabel ) { + if ( version == VCard::v3_0 ) { + labelLine.addParameter( "TYPE", typeIt.key().lower() ); + } + else { labelLine.addParameter( "TYPE", typeIt.key() ); } } + } + } card.addLine( adrLine ); if ( hasLabel ) card.addLine( labelLine ); } // AGENT card.addLine( createAgent( version, (*addrIt).agent() ) ); // BDAY card.addLine( VCardLine( "BDAY", createDateTime( (*addrIt).birthday() ) ) ); @@ -224,24 +235,27 @@ QString VCardTool::createVCards( Addressee::List list, VCard::Version version ) // SOUND card.addLine( createSound( (*addrIt).sound() ) ); // TEL PhoneNumber::List phoneNumbers = (*addrIt).phoneNumbers(); PhoneNumber::List::ConstIterator phoneIt; for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { VCardLine line( "TEL", (*phoneIt).number() ); QMap<QString, int>::Iterator typeIt; for ( typeIt = mPhoneTypeMap.begin(); typeIt != mPhoneTypeMap.end(); ++typeIt ) { if ( typeIt.data() & (*phoneIt).type() ) + if ( version == VCard::v3_0 ) + line.addParameter( "TYPE", typeIt.key().lower() ); + else line.addParameter( "TYPE", typeIt.key() ); } card.addLine( line ); } // TITLE card.addLine( VCardLine( "TITLE", (*addrIt).title() ) ); // TZ TimeZone timeZone = (*addrIt).timeZone(); if ( timeZone.isValid() ) { |