summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/vcardformatimpl.cpp51
-rw-r--r--kabc/vcardformatimpl.h4
2 files changed, 29 insertions, 26 deletions
diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp
index 3fcaf94..bd9a57b 100644
--- a/kabc/vcardformatimpl.cpp
+++ b/kabc/vcardformatimpl.cpp
@@ -53,8 +53,9 @@ bool VCardFormatImpl::load( Addressee &addressee, QFile *file )
53 VCardListIterator it( e.cardList() ); 53 VCardListIterator it( e.cardList() );
54 54
55 if ( it.current() ) { 55 if ( it.current() ) {
56 VCard v(*it.current()); 56//US VCard v(*it.current());
57 loadAddressee( addressee, v ); 57//US loadAddressee( addressee, v );
58 loadAddressee( addressee, it.current() );
58 return true; 59 return true;
59 } 60 }
60 61
@@ -73,9 +74,10 @@ bool VCardFormatImpl::loadAll( AddressBook *addressBook, Resource *resource, QFi
73 VCardListIterator it( e.cardList() ); 74 VCardListIterator it( e.cardList() );
74 75
75 for (; it.current(); ++it) { 76 for (; it.current(); ++it) {
76 VCard v(*it.current()); 77//US VCard v(*it.current());
77 Addressee addressee; 78 Addressee addressee;
78 loadAddressee( addressee, v ); 79//US loadAddressee( addressee, v );
80 loadAddressee( addressee, it.current() );
79 addressee.setResource( resource ); 81 addressee.setResource( resource );
80 addressBook->insertAddressee( addressee ); 82 addressBook->insertAddressee( addressee );
81 } 83 }
@@ -122,9 +124,9 @@ void VCardFormatImpl::saveAll( AddressBook *ab, Resource *resource, QFile *file
122 file->writeBlock( (const char*)vcardData, vcardData.length() ); 124 file->writeBlock( (const char*)vcardData, vcardData.length() );
123} 125}
124 126
125bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard &v ) 127bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v )
126{ 128{
127 QPtrList<ContentLine> contentLines = v.contentLineList(); 129 QPtrList<ContentLine> contentLines = v->contentLineList();
128 ContentLine *cl; 130 ContentLine *cl;
129 131
130 for( cl = contentLines.first(); cl; cl = contentLines.next() ) { 132 for( cl = contentLines.first(); cl; cl = contentLines.next() ) {
@@ -784,19 +786,19 @@ void VCardFormatImpl::addAgentValue( VCARD::VCard *vcard, const Agent &agent )
784 Addressee *addr = agent.addressee(); 786 Addressee *addr = agent.addressee();
785 if ( addr ) { 787 if ( addr ) {
786 writeToString( (*addr), vstr ); 788 writeToString( (*addr), vstr );
787 789
788 qDebug("VCardFormatImpl::addAgentValue please verify if replace is correct"); 790 qDebug("VCardFormatImpl::addAgentValue please verify if replace is correct");
789/*US 791/*US
790 vstr.replace( ":", "\\:" ); 792 vstr.replace( ":", "\\:" );
791 vstr.replace( ",", "\\," ); 793 vstr.replace( ",", "\\," );
792 vstr.replace( ";", "\\;" ); 794 vstr.replace( ";", "\\;" );
793 vstr.replace( "\r\n", "\\n" ); 795 vstr.replace( "\r\n", "\\n" );
794*/ 796*/
795 vstr.replace( QRegExp(":"), "\\:" ); 797 vstr.replace( QRegExp(":"), "\\:" );
796 vstr.replace( QRegExp(","), "\\," ); 798 vstr.replace( QRegExp(","), "\\," );
797 vstr.replace( QRegExp(";"), "\\;" ); 799 vstr.replace( QRegExp(";"), "\\;" );
798 vstr.replace( QRegExp("\r\n"), "\\n" ); 800 vstr.replace( QRegExp("\r\n"), "\\n" );
799 801
800 cl.setValue( new TextValue( vstr.utf8() ) ); 802 cl.setValue( new TextValue( vstr.utf8() ) );
801 } else 803 } else
802 return; 804 return;
@@ -825,17 +827,17 @@ Agent VCardFormatImpl::readAgentValue( VCARD::ContentLine *cl )
825 if ( isIntern ) { 827 if ( isIntern ) {
826 QString vstr = QString::fromUtf8( v->asString() ); 828 QString vstr = QString::fromUtf8( v->asString() );
827 qDebug("VCardFormatImpl::addAgentValue please verify if replace is correct"); 829 qDebug("VCardFormatImpl::addAgentValue please verify if replace is correct");
828/*US 830/*US
829 vstr.replace( "\\n", "\r\n" ); 831 vstr.replace( "\\n", "\r\n" );
830 vstr.replace( "\\:", ":" ); 832 vstr.replace( "\\:", ":" );
831 vstr.replace( "\\,", "," ); 833 vstr.replace( "\\,", "," );
832 vstr.replace( "\\;", ";" ); 834 vstr.replace( "\\;", ";" );
833*/ 835*/
834 vstr.replace( QRegExp("\\n"), "\r\n" ); 836 vstr.replace( QRegExp("\\n"), "\r\n" );
835 vstr.replace( QRegExp("\\:"), ":" ); 837 vstr.replace( QRegExp("\\:"), ":" );
836 vstr.replace( QRegExp("\\,"), "," ); 838 vstr.replace( QRegExp("\\,"), "," );
837 vstr.replace( QRegExp("\\;"), ";" ); 839 vstr.replace( QRegExp("\\;"), ";" );
838 840
839 Addressee *addr = new Addressee; 841 Addressee *addr = new Addressee;
840 readFromString( vstr, *addr ); 842 readFromString( vstr, *addr );
841 agent.setAddressee( addr ); 843 agent.setAddressee( addr );
@@ -866,7 +868,7 @@ void VCardFormatImpl::addPictureValue( VCARD::VCard *vcard, VCARD::EntityType ty
866 s.setVersion( 4 ); // to produce valid png files 868 s.setVersion( 4 ); // to produce valid png files
867 s << img; 869 s << img;
868 cl.setValue( new TextValue( KCodecs::base64Encode( data ) ) ); 870 cl.setValue( new TextValue( KCodecs::base64Encode( data ) ) );
869 871
870 } else { // save picture in cache 872 } else { // save picture in cache
871 QString dir; 873 QString dir;
872 if ( type == EntityPhoto ) 874 if ( type == EntityPhoto )
@@ -881,7 +883,7 @@ void VCardFormatImpl::addPictureValue( VCARD::VCard *vcard, VCARD::EntityType ty
881 if ( !pic.type().isEmpty() ) 883 if ( !pic.type().isEmpty() )
882 params.append( new Param( "TYPE", pic.type().utf8() ) ); 884 params.append( new Param( "TYPE", pic.type().utf8() ) );
883 } else { 885 } else {
884 886
885 cl.setValue( new TextValue( pic.url().utf8() ) ); 887 cl.setValue( new TextValue( pic.url().utf8() ) );
886 params.append( new Param( "VALUE", "uri" ) ); 888 params.append( new Param( "VALUE", "uri" ) );
887 } 889 }
@@ -1001,8 +1003,9 @@ bool VCardFormatImpl::readFromString( const QString &vcard, Addressee &addressee
1001 VCardListIterator it( e.cardList() ); 1003 VCardListIterator it( e.cardList() );
1002 1004
1003 if ( it.current() ) { 1005 if ( it.current() ) {
1004 VCard v(*it.current()); 1006//US VCard v(*it.current());
1005 loadAddressee( addressee, v ); 1007//US loadAddressee( addressee, v );
1008 loadAddressee( addressee, it.current() );
1006 return true; 1009 return true;
1007 } 1010 }
1008 1011
diff --git a/kabc/vcardformatimpl.h b/kabc/vcardformatimpl.h
index 2dd68d9..fa3d55f 100644
--- a/kabc/vcardformatimpl.h
+++ b/kabc/vcardformatimpl.h
@@ -42,7 +42,7 @@ class AddressBook;
42 42
43/** 43/**
44 @short Implementation of vCard backend for address book. 44 @short Implementation of vCard backend for address book.
45 45
46 This class implements reading and writing of address book information using 46 This class implements reading and writing of address book information using
47 the vCard format. It requires the vCard lib from kdepim. 47 the vCard format. It requires the vCard lib from kdepim.
48*/ 48*/
@@ -58,7 +58,7 @@ class VCardFormatImpl
58 bool writeToString( const Addressee &addressee, QString &vcard ); 58 bool writeToString( const Addressee &addressee, QString &vcard );
59 59
60 protected: 60 protected:
61 bool loadAddressee( Addressee &, VCARD::VCard & ); 61 bool loadAddressee( Addressee &, VCARD::VCard * );
62 void saveAddressee( const Addressee &, VCARD::VCard *, bool intern ); 62 void saveAddressee( const Addressee &, VCARD::VCard *, bool intern );
63 63
64 void addTextValue (VCARD::VCard *, VCARD::EntityType, const QString & ); 64 void addTextValue (VCARD::VCard *, VCARD::EntityType, const QString & );