summaryrefslogtreecommitdiffabout
path: root/kabc
authorulf69 <ulf69>2004-08-20 00:36:50 (UTC)
committer ulf69 <ulf69>2004-08-20 00:36:50 (UTC)
commitd39b363278224b969d4c2945d32968c980b5d842 (patch) (unidiff)
tree418087aff444216ddb08fcd94fa7fdbfa6d46947 /kabc
parentf4149cef5f3be19d64c9c53130a62de0ec28ee44 (diff)
downloadkdepimpi-d39b363278224b969d4c2945d32968c980b5d842.zip
kdepimpi-d39b363278224b969d4c2945d32968c980b5d842.tar.gz
kdepimpi-d39b363278224b969d4c2945d32968c980b5d842.tar.bz2
performance optimization during vCard loading
Diffstat (limited to 'kabc') (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
@@ -55,4 +55,5 @@ bool VCardFormatImpl::load( Addressee &addressee, QFile *file )
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;
@@ -75,5 +76,6 @@ bool VCardFormatImpl::loadAll( AddressBook *addressBook, Resource *resource, QFi
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 );
@@ -124,5 +126,5 @@ void VCardFormatImpl::saveAll( AddressBook *ab, Resource *resource, QFile *file
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;
@@ -786,5 +788,5 @@ void VCardFormatImpl::addAgentValue( VCARD::VCard *vcard, const Agent &agent )
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( ":", "\\:" );
@@ -793,8 +795,8 @@ void VCardFormatImpl::addAgentValue( VCARD::VCard *vcard, const Agent &agent )
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() ) );
@@ -827,3 +829,3 @@ Agent VCardFormatImpl::readAgentValue( VCARD::ContentLine *cl )
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" );
@@ -833,7 +835,7 @@ Agent VCardFormatImpl::readAgentValue( VCARD::ContentLine *cl )
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;
@@ -868,3 +870,3 @@ void VCardFormatImpl::addPictureValue( VCARD::VCard *vcard, VCARD::EntityType ty
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
@@ -883,3 +885,3 @@ void VCardFormatImpl::addPictureValue( VCARD::VCard *vcard, VCARD::EntityType ty
883 } else { 885 } else {
884 886
885 cl.setValue( new TextValue( pic.url().utf8() ) ); 887 cl.setValue( new TextValue( pic.url().utf8() ) );
@@ -1003,4 +1005,5 @@ bool VCardFormatImpl::readFromString( const QString &vcard, Addressee &addressee
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;
diff --git a/kabc/vcardformatimpl.h b/kabc/vcardformatimpl.h
index 2dd68d9..fa3d55f 100644
--- a/kabc/vcardformatimpl.h
+++ b/kabc/vcardformatimpl.h
@@ -44,3 +44,3 @@ class AddressBook;
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
@@ -60,3 +60,3 @@ class VCardFormatImpl
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 );