author | ulf69 <ulf69> | 2004-07-09 08:10:08 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-07-09 08:10:08 (UTC) |
commit | de99e22a7093e857ee3c08a67ccc389d6374099a (patch) (unidiff) | |
tree | 511c309f9df3ae71d43c194cc41f27bdb1966a05 | |
parent | d56bb523048598245ac4ffcb16689687e082f831 (diff) | |
download | kdepimpi-de99e22a7093e857ee3c08a67ccc389d6374099a.zip kdepimpi-de99e22a7093e857ee3c08a67ccc389d6374099a.tar.gz kdepimpi-de99e22a7093e857ee3c08a67ccc389d6374099a.tar.bz2 |
support of caseinsensitive phone and adress types, as required by the vcard spec
-rw-r--r-- | kabc/converter/opie/opieconverterE.pro | 2 | ||||
-rw-r--r-- | kabc/formats/vcardformatplugin2.cpp | 4 | ||||
-rw-r--r-- | kabc/vcardformatimpl.cpp | 48 | ||||
-rw-r--r-- | kabc/vcardformatplugin.cpp | 4 | ||||
-rw-r--r-- | kabc/vcardparser/vcardtool.cpp | 22 |
5 files changed, 53 insertions, 27 deletions
diff --git a/kabc/converter/opie/opieconverterE.pro b/kabc/converter/opie/opieconverterE.pro index 85ba28f..e026f2a 100644 --- a/kabc/converter/opie/opieconverterE.pro +++ b/kabc/converter/opie/opieconverterE.pro | |||
@@ -1,14 +1,14 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | INCLUDEPATH += . ../.. ../../../microkde ../../../microkde/kdecore $(QPEDIR)/include $(OPIEDIR)/include | 2 | INCLUDEPATH += . ../.. ../../../microkde ../../../microkde/kdecore $(OPIEDIR)/include $(OPEDIR)/include |
3 | #CONFIG += staticlib | 3 | #CONFIG += staticlib |
4 | OBJECTS_DIR = obj/$(PLATFORM) | 4 | OBJECTS_DIR = obj/$(PLATFORM) |
5 | MOC_DIR = moc/$(PLATFORM) | 5 | MOC_DIR = moc/$(PLATFORM) |
6 | 6 | ||
7 | #for static linkage, put it here | 7 | #for static linkage, put it here |
8 | #DESTDIR=../../lib/$(PLATFORM) | 8 | #DESTDIR=../../lib/$(PLATFORM) |
9 | 9 | ||
10 | #for dynamic linkage, put it here | 10 | #for dynamic linkage, put it here |
11 | DESTDIR=$(QPEDIR)/lib | 11 | DESTDIR=$(QPEDIR)/lib |
12 | 12 | ||
13 | LIBS += -lmicrokde | 13 | LIBS += -lmicrokde |
14 | LIBS += -lmicrokabc | 14 | LIBS += -lmicrokabc |
diff --git a/kabc/formats/vcardformatplugin2.cpp b/kabc/formats/vcardformatplugin2.cpp index f19e218..41b0c9a 100644 --- a/kabc/formats/vcardformatplugin2.cpp +++ b/kabc/formats/vcardformatplugin2.cpp | |||
@@ -25,80 +25,84 @@ extern "C" | |||
25 | } | 25 | } |
26 | 26 | ||
27 | VCardFormatPlugin2::VCardFormatPlugin2() | 27 | VCardFormatPlugin2::VCardFormatPlugin2() |
28 | { | 28 | { |
29 | } | 29 | } |
30 | 30 | ||
31 | VCardFormatPlugin2::~VCardFormatPlugin2() | 31 | VCardFormatPlugin2::~VCardFormatPlugin2() |
32 | { | 32 | { |
33 | } | 33 | } |
34 | 34 | ||
35 | bool VCardFormatPlugin2::load( Addressee &addressee, QFile *file ) | 35 | bool VCardFormatPlugin2::load( Addressee &addressee, QFile *file ) |
36 | { | 36 | { |
37 | qDebug("VCardFormatPlugin2::load"); | ||
37 | QString data; | 38 | QString data; |
38 | 39 | ||
39 | QTextStream t( file ); | 40 | QTextStream t( file ); |
40 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 41 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
41 | data = t.read(); | 42 | data = t.read(); |
42 | 43 | ||
43 | VCardTool tool; | 44 | VCardTool tool; |
44 | 45 | ||
45 | Addressee::List l = tool.parseVCards( data ); | 46 | Addressee::List l = tool.parseVCards( data ); |
46 | 47 | ||
47 | if ( ! l.first().isEmpty() ) { | 48 | if ( ! l.first().isEmpty() ) { |
48 | addressee = l.first(); | 49 | addressee = l.first(); |
49 | return true; | 50 | return true; |
50 | } | 51 | } |
51 | 52 | ||
52 | return false; | 53 | return false; |
53 | } | 54 | } |
54 | 55 | ||
55 | bool VCardFormatPlugin2::loadAll( AddressBook *addressBook, Resource *resource, QFile *file ) | 56 | bool VCardFormatPlugin2::loadAll( AddressBook *addressBook, Resource *resource, QFile *file ) |
56 | { | 57 | { |
58 | qDebug("VCardFormatPlugin2::loadAll"); | ||
57 | QString data; | 59 | QString data; |
58 | 60 | ||
59 | QTextStream t( file ); | 61 | QTextStream t( file ); |
60 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 62 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
61 | data = t.read(); | 63 | data = t.read(); |
62 | 64 | ||
63 | VCardTool tool; | 65 | VCardTool tool; |
64 | 66 | ||
65 | Addressee::List l = tool.parseVCards( data ); | 67 | Addressee::List l = tool.parseVCards( data ); |
66 | 68 | ||
67 | Addressee::List::Iterator itr; | 69 | Addressee::List::Iterator itr; |
68 | 70 | ||
69 | for ( itr = l.begin(); itr != l.end(); ++itr) { | 71 | for ( itr = l.begin(); itr != l.end(); ++itr) { |
70 | Addressee addressee = *itr; | 72 | Addressee addressee = *itr; |
71 | addressee.setResource( resource ); | 73 | addressee.setResource( resource ); |
72 | addressBook->insertAddressee( addressee ); | 74 | addressBook->insertAddressee( addressee ); |
73 | } | 75 | } |
74 | 76 | ||
75 | return true; | 77 | return true; |
76 | } | 78 | } |
77 | 79 | ||
78 | void VCardFormatPlugin2::save( const Addressee &addressee, QFile *file ) | 80 | void VCardFormatPlugin2::save( const Addressee &addressee, QFile *file ) |
79 | { | 81 | { |
82 | qDebug("VCardFormatPlugin2::save"); | ||
80 | VCardTool tool; | 83 | VCardTool tool; |
81 | Addressee::List vcardlist; | 84 | Addressee::List vcardlist; |
82 | 85 | ||
83 | 86 | ||
84 | vcardlist.append( addressee ); | 87 | vcardlist.append( addressee ); |
85 | 88 | ||
86 | QTextStream t( file ); | 89 | QTextStream t( file ); |
87 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 90 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
88 | t << tool.createVCards( vcardlist ); | 91 | t << tool.createVCards( vcardlist ); |
89 | } | 92 | } |
90 | 93 | ||
91 | void VCardFormatPlugin2::saveAll( AddressBook *ab, Resource *resource, QFile *file ) | 94 | void VCardFormatPlugin2::saveAll( AddressBook *ab, Resource *resource, QFile *file ) |
92 | { | 95 | { |
96 | qDebug("VCardFormatPlugin2::saveAll"); | ||
93 | VCardTool tool; | 97 | VCardTool tool; |
94 | Addressee::List vcardlist; | 98 | Addressee::List vcardlist; |
95 | 99 | ||
96 | AddressBook::Iterator it; | 100 | AddressBook::Iterator it; |
97 | for ( it = ab->begin(); it != ab->end(); ++it ) { | 101 | for ( it = ab->begin(); it != ab->end(); ++it ) { |
98 | if ( (*it).resource() == resource ) { | 102 | if ( (*it).resource() == resource ) { |
99 | (*it).setChanged( false ); | 103 | (*it).setChanged( false ); |
100 | vcardlist.append( *it ); | 104 | vcardlist.append( *it ); |
101 | } | 105 | } |
102 | } | 106 | } |
103 | 107 | ||
104 | QTextStream t( file ); | 108 | QTextStream t( file ); |
diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp index f90f813..3fcaf94 100644 --- a/kabc/vcardformatimpl.cpp +++ b/kabc/vcardformatimpl.cpp | |||
@@ -515,33 +515,35 @@ Address VCardFormatImpl::readAddressValue( ContentLine *cl ) | |||
515 | a.setCountry( QString::fromUtf8( v->countryName() ) ); | 515 | a.setCountry( QString::fromUtf8( v->countryName() ) ); |
516 | 516 | ||
517 | a.setType( readAddressParam( cl ) ); | 517 | a.setType( readAddressParam( cl ) ); |
518 | 518 | ||
519 | return a; | 519 | return a; |
520 | } | 520 | } |
521 | 521 | ||
522 | int VCardFormatImpl::readAddressParam( ContentLine *cl ) | 522 | int VCardFormatImpl::readAddressParam( ContentLine *cl ) |
523 | { | 523 | { |
524 | int type = 0; | 524 | int type = 0; |
525 | ParamList params = cl->paramList(); | 525 | ParamList params = cl->paramList(); |
526 | ParamListIterator it( params ); | 526 | ParamListIterator it( params ); |
527 | QCString tmpStr; | ||
527 | for( ; it.current(); ++it ) { | 528 | for( ; it.current(); ++it ) { |
528 | if ( (*it)->name() == "TYPE" ) { | 529 | if ( (*it)->name().upper() == "TYPE" ) { |
529 | if ( (*it)->value() == "dom" ) type |= Address::Dom; | 530 | tmpStr = (*it)->value().lower(); |
530 | else if ( (*it)->value() == "intl" ) type |= Address::Intl; | 531 | if ( tmpStr == "dom" ) type |= Address::Dom; |
531 | else if ( (*it)->value() == "parcel" ) type |= Address::Parcel; | 532 | else if ( tmpStr == "intl" ) type |= Address::Intl; |
532 | else if ( (*it)->value() == "postal" ) type |= Address::Postal; | 533 | else if ( tmpStr == "parcel" ) type |= Address::Parcel; |
533 | else if ( (*it)->value() == "work" ) type |= Address::Work; | 534 | else if ( tmpStr == "postal" ) type |= Address::Postal; |
534 | else if ( (*it)->value() == "home" ) type |= Address::Home; | 535 | else if ( tmpStr == "work" ) type |= Address::Work; |
535 | else if ( (*it)->value() == "pref" ) type |= Address::Pref; | 536 | else if ( tmpStr == "home" ) type |= Address::Home; |
537 | else if ( tmpStr == "pref" ) type |= Address::Pref; | ||
536 | } | 538 | } |
537 | } | 539 | } |
538 | return type; | 540 | return type; |
539 | } | 541 | } |
540 | 542 | ||
541 | void VCardFormatImpl::addNValue( VCard *vcard, const Addressee &a ) | 543 | void VCardFormatImpl::addNValue( VCard *vcard, const Addressee &a ) |
542 | { | 544 | { |
543 | ContentLine cl; | 545 | ContentLine cl; |
544 | cl.setName(EntityTypeToParamName( EntityN ) ); | 546 | cl.setName(EntityTypeToParamName( EntityN ) ); |
545 | NValue *v = new NValue; | 547 | NValue *v = new NValue; |
546 | v->setFamily( a.familyName().utf8() ); | 548 | v->setFamily( a.familyName().utf8() ); |
547 | v->setGiven( a.givenName().utf8() ); | 549 | v->setGiven( a.givenName().utf8() ); |
@@ -592,40 +594,42 @@ void VCardFormatImpl::addTelephoneValue( VCard *v, const PhoneNumber &p ) | |||
592 | v->add(cl); | 594 | v->add(cl); |
593 | } | 595 | } |
594 | 596 | ||
595 | PhoneNumber VCardFormatImpl::readTelephoneValue( ContentLine *cl ) | 597 | PhoneNumber VCardFormatImpl::readTelephoneValue( ContentLine *cl ) |
596 | { | 598 | { |
597 | PhoneNumber p; | 599 | PhoneNumber p; |
598 | TelValue *value = (TelValue *)cl->value(); | 600 | TelValue *value = (TelValue *)cl->value(); |
599 | p.setNumber( QString::fromUtf8( value->asString() ) ); | 601 | p.setNumber( QString::fromUtf8( value->asString() ) ); |
600 | 602 | ||
601 | int type = 0; | 603 | int type = 0; |
602 | ParamList params = cl->paramList(); | 604 | ParamList params = cl->paramList(); |
603 | ParamListIterator it( params ); | 605 | ParamListIterator it( params ); |
606 | QCString tmpStr; | ||
604 | for( ; it.current(); ++it ) { | 607 | for( ; it.current(); ++it ) { |
605 | if ( (*it)->name() == "TYPE" ) { | 608 | if ( (*it)->name() == "TYPE" ) { |
606 | if ( (*it)->value() == "home" ) type |= PhoneNumber::Home; | 609 | tmpStr = (*it)->value().lower(); |
607 | else if ( (*it)->value() == "work" ) type |= PhoneNumber::Work; | 610 | if ( tmpStr == "home" ) type |= PhoneNumber::Home; |
608 | else if ( (*it)->value() == "msg" ) type |= PhoneNumber::Msg; | 611 | else if ( tmpStr == "work" ) type |= PhoneNumber::Work; |
609 | else if ( (*it)->value() == "pref" ) type |= PhoneNumber::Pref; | 612 | else if ( tmpStr == "msg" ) type |= PhoneNumber::Msg; |
610 | else if ( (*it)->value() == "voice" ) type |= PhoneNumber::Voice; | 613 | else if ( tmpStr == "pref" ) type |= PhoneNumber::Pref; |
611 | else if ( (*it)->value() == "fax" ) type |= PhoneNumber::Fax; | 614 | else if ( tmpStr == "voice" ) type |= PhoneNumber::Voice; |
612 | else if ( (*it)->value() == "cell" ) type |= PhoneNumber::Cell; | 615 | else if ( tmpStr == "fax" ) type |= PhoneNumber::Fax; |
613 | else if ( (*it)->value() == "video" ) type |= PhoneNumber::Video; | 616 | else if ( tmpStr == "cell" ) type |= PhoneNumber::Cell; |
614 | else if ( (*it)->value() == "bbs" ) type |= PhoneNumber::Bbs; | 617 | else if ( tmpStr == "video" ) type |= PhoneNumber::Video; |
615 | else if ( (*it)->value() == "modem" ) type |= PhoneNumber::Modem; | 618 | else if ( tmpStr == "bbs" ) type |= PhoneNumber::Bbs; |
616 | else if ( (*it)->value() == "car" ) type |= PhoneNumber::Car; | 619 | else if ( tmpStr == "modem" ) type |= PhoneNumber::Modem; |
617 | else if ( (*it)->value() == "isdn" ) type |= PhoneNumber::Isdn; | 620 | else if ( tmpStr == "car" ) type |= PhoneNumber::Car; |
618 | else if ( (*it)->value() == "pcs" ) type |= PhoneNumber::Pcs; | 621 | else if ( tmpStr == "isdn" ) type |= PhoneNumber::Isdn; |
619 | else if ( (*it)->value() == "pager" ) type |= PhoneNumber::Pager; | 622 | else if ( tmpStr == "pcs" ) type |= PhoneNumber::Pcs; |
623 | else if ( tmpStr == "pager" ) type |= PhoneNumber::Pager; | ||
620 | } | 624 | } |
621 | } | 625 | } |
622 | p.setType( type ); | 626 | p.setType( type ); |
623 | 627 | ||
624 | return p; | 628 | return p; |
625 | } | 629 | } |
626 | 630 | ||
627 | QString VCardFormatImpl::readTextValue( ContentLine *cl ) | 631 | QString VCardFormatImpl::readTextValue( ContentLine *cl ) |
628 | { | 632 | { |
629 | VCARD::Value *value = cl->value(); | 633 | VCARD::Value *value = cl->value(); |
630 | if ( value ) { | 634 | if ( value ) { |
631 | return QString::fromUtf8( value->asString() ); | 635 | return QString::fromUtf8( value->asString() ); |
diff --git a/kabc/vcardformatplugin.cpp b/kabc/vcardformatplugin.cpp index 3cba59a..bc18690 100644 --- a/kabc/vcardformatplugin.cpp +++ b/kabc/vcardformatplugin.cpp | |||
@@ -26,39 +26,43 @@ using namespace KABC; | |||
26 | VCardFormatPlugin::VCardFormatPlugin() | 26 | VCardFormatPlugin::VCardFormatPlugin() |
27 | { | 27 | { |
28 | mImpl = new VCardFormatImpl; | 28 | mImpl = new VCardFormatImpl; |
29 | } | 29 | } |
30 | 30 | ||
31 | VCardFormatPlugin::~VCardFormatPlugin() | 31 | VCardFormatPlugin::~VCardFormatPlugin() |
32 | { | 32 | { |
33 | delete mImpl; | 33 | delete mImpl; |
34 | } | 34 | } |
35 | 35 | ||
36 | bool VCardFormatPlugin::load( Addressee &addressee, QFile *file ) | 36 | bool VCardFormatPlugin::load( Addressee &addressee, QFile *file ) |
37 | { | 37 | { |
38 | qDebug("VCardFormatPlugin::load"); | ||
38 | return mImpl->load( addressee, file ); | 39 | return mImpl->load( addressee, file ); |
39 | } | 40 | } |
40 | 41 | ||
41 | bool VCardFormatPlugin::loadAll( AddressBook *addressBook, Resource *resource, QFile *file ) | 42 | bool VCardFormatPlugin::loadAll( AddressBook *addressBook, Resource *resource, QFile *file ) |
42 | { | 43 | { |
44 | qDebug("VCardFormatPlugin::loadAll"); | ||
43 | return mImpl->loadAll( addressBook, resource, file ); | 45 | return mImpl->loadAll( addressBook, resource, file ); |
44 | } | 46 | } |
45 | 47 | ||
46 | void VCardFormatPlugin::save( const Addressee &addressee, QFile *file ) | 48 | void VCardFormatPlugin::save( const Addressee &addressee, QFile *file ) |
47 | { | 49 | { |
50 | qDebug("VCardFormatPlugin::save"); | ||
48 | mImpl->save( addressee, file ); | 51 | mImpl->save( addressee, file ); |
49 | } | 52 | } |
50 | 53 | ||
51 | void VCardFormatPlugin::saveAll( AddressBook *addressBook, Resource *resource, QFile *file ) | 54 | void VCardFormatPlugin::saveAll( AddressBook *addressBook, Resource *resource, QFile *file ) |
52 | { | 55 | { |
56 | qDebug("VCardFormatPlugin::saveAll"); | ||
53 | mImpl->saveAll( addressBook, resource, file ); | 57 | mImpl->saveAll( addressBook, resource, file ); |
54 | } | 58 | } |
55 | 59 | ||
56 | bool VCardFormatPlugin::checkFormat( QFile *file ) const | 60 | bool VCardFormatPlugin::checkFormat( QFile *file ) const |
57 | { | 61 | { |
58 | QString line; | 62 | QString line; |
59 | 63 | ||
60 | file->readLine( line, 1024 ); | 64 | file->readLine( line, 1024 ); |
61 | line = line.stripWhiteSpace(); | 65 | line = line.stripWhiteSpace(); |
62 | if ( line == "BEGIN:VCARD" ) | 66 | if ( line == "BEGIN:VCARD" ) |
63 | return true; | 67 | return true; |
64 | else | 68 | else |
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,27 +94,38 @@ QString VCardTool::createVCards( Addressee::List list, VCard::Version version ) | |||
94 | address.append( (*it).locality().replace( QRegExp(";"), "\\;" ) ); | 94 | address.append( (*it).locality().replace( QRegExp(";"), "\\;" ) ); |
95 | address.append( (*it).region().replace( QRegExp(";"), "\\;" ) ); | 95 | address.append( (*it).region().replace( QRegExp(";"), "\\;" ) ); |
96 | address.append( (*it).postalCode().replace( QRegExp(";"), "\\;" ) ); | 96 | address.append( (*it).postalCode().replace( QRegExp(";"), "\\;" ) ); |
97 | address.append( (*it).country().replace( QRegExp(";"), "\\;" ) ); | 97 | address.append( (*it).country().replace( QRegExp(";"), "\\;" ) ); |
98 | 98 | ||
99 | VCardLine adrLine( "ADR", address.join( ";" ) ); | 99 | VCardLine adrLine( "ADR", address.join( ";" ) ); |
100 | VCardLine labelLine( "LABEL", (*it).label() ); | 100 | VCardLine labelLine( "LABEL", (*it).label() ); |
101 | 101 | ||
102 | bool hasLabel = !(*it).label().isEmpty(); | 102 | bool hasLabel = !(*it).label().isEmpty(); |
103 | QMap<QString, int>::Iterator typeIt; | 103 | QMap<QString, int>::Iterator typeIt; |
104 | for ( typeIt = mAddressTypeMap.begin(); typeIt != mAddressTypeMap.end(); ++typeIt ) { | 104 | for ( typeIt = mAddressTypeMap.begin(); typeIt != mAddressTypeMap.end(); ++typeIt ) { |
105 | if ( typeIt.data() & (*it).type() ) { | 105 | if ( typeIt.data() & (*it).type() ) { |
106 | adrLine.addParameter( "TYPE", typeIt.key() ); | 106 | if ( version == VCard::v3_0 ) { |
107 | if ( hasLabel ) | 107 | adrLine.addParameter( "TYPE", typeIt.key().lower() ); |
108 | labelLine.addParameter( "TYPE", typeIt.key() ); | 108 | } |
109 | else { | ||
110 | adrLine.addParameter( "TYPE", typeIt.key() ); | ||
111 | } | ||
112 | if ( hasLabel ) { | ||
113 | if ( version == VCard::v3_0 ) { | ||
114 | labelLine.addParameter( "TYPE", typeIt.key().lower() ); | ||
115 | } | ||
116 | else { | ||
117 | labelLine.addParameter( "TYPE", typeIt.key() ); | ||
118 | } | ||
119 | } | ||
109 | } | 120 | } |
110 | } | 121 | } |
111 | 122 | ||
112 | card.addLine( adrLine ); | 123 | card.addLine( adrLine ); |
113 | if ( hasLabel ) | 124 | if ( hasLabel ) |
114 | card.addLine( labelLine ); | 125 | card.addLine( labelLine ); |
115 | } | 126 | } |
116 | 127 | ||
117 | // AGENT | 128 | // AGENT |
118 | card.addLine( createAgent( version, (*addrIt).agent() ) ); | 129 | card.addLine( createAgent( version, (*addrIt).agent() ) ); |
119 | 130 | ||
120 | // BDAY | 131 | // BDAY |
@@ -224,25 +235,28 @@ QString VCardTool::createVCards( Addressee::List list, VCard::Version version ) | |||
224 | // SOUND | 235 | // SOUND |
225 | card.addLine( createSound( (*addrIt).sound() ) ); | 236 | card.addLine( createSound( (*addrIt).sound() ) ); |
226 | 237 | ||
227 | // TEL | 238 | // TEL |
228 | PhoneNumber::List phoneNumbers = (*addrIt).phoneNumbers(); | 239 | PhoneNumber::List phoneNumbers = (*addrIt).phoneNumbers(); |
229 | PhoneNumber::List::ConstIterator phoneIt; | 240 | PhoneNumber::List::ConstIterator phoneIt; |
230 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { | 241 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { |
231 | VCardLine line( "TEL", (*phoneIt).number() ); | 242 | VCardLine line( "TEL", (*phoneIt).number() ); |
232 | 243 | ||
233 | QMap<QString, int>::Iterator typeIt; | 244 | QMap<QString, int>::Iterator typeIt; |
234 | for ( typeIt = mPhoneTypeMap.begin(); typeIt != mPhoneTypeMap.end(); ++typeIt ) { | 245 | for ( typeIt = mPhoneTypeMap.begin(); typeIt != mPhoneTypeMap.end(); ++typeIt ) { |
235 | if ( typeIt.data() & (*phoneIt).type() ) | 246 | if ( typeIt.data() & (*phoneIt).type() ) |
236 | line.addParameter( "TYPE", typeIt.key() ); | 247 | if ( version == VCard::v3_0 ) |
248 | line.addParameter( "TYPE", typeIt.key().lower() ); | ||
249 | else | ||
250 | line.addParameter( "TYPE", typeIt.key() ); | ||
237 | } | 251 | } |
238 | 252 | ||
239 | card.addLine( line ); | 253 | card.addLine( line ); |
240 | } | 254 | } |
241 | 255 | ||
242 | // TITLE | 256 | // TITLE |
243 | card.addLine( VCardLine( "TITLE", (*addrIt).title() ) ); | 257 | card.addLine( VCardLine( "TITLE", (*addrIt).title() ) ); |
244 | 258 | ||
245 | // TZ | 259 | // TZ |
246 | TimeZone timeZone = (*addrIt).timeZone(); | 260 | TimeZone timeZone = (*addrIt).timeZone(); |
247 | if ( timeZone.isValid() ) { | 261 | if ( timeZone.isValid() ) { |
248 | QString str; | 262 | QString str; |