author | ulf69 <ulf69> | 2004-08-20 00:36:50 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-20 00:36:50 (UTC) |
commit | d39b363278224b969d4c2945d32968c980b5d842 (patch) (unidiff) | |
tree | 418087aff444216ddb08fcd94fa7fdbfa6d46947 /kabc | |
parent | f4149cef5f3be19d64c9c53130a62de0ec28ee44 (diff) | |
download | kdepimpi-d39b363278224b969d4c2945d32968c980b5d842.zip kdepimpi-d39b363278224b969d4c2945d32968c980b5d842.tar.gz kdepimpi-d39b363278224b969d4c2945d32968c980b5d842.tar.bz2 |
performance optimization during vCard loading
-rw-r--r-- | kabc/vcardformatimpl.cpp | 19 | ||||
-rw-r--r-- | kabc/vcardformatimpl.h | 2 |
2 files changed, 12 insertions, 9 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 | ||
125 | bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard &v ) | 127 | bool 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() ) { |
@@ -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 | |||
@@ -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 & ); |