summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-08-20 00:36:50 (UTC)
committer ulf69 <ulf69>2004-08-20 00:36:50 (UTC)
commitd39b363278224b969d4c2945d32968c980b5d842 (patch) (side-by-side diff)
tree418087aff444216ddb08fcd94fa7fdbfa6d46947
parentf4149cef5f3be19d64c9c53130a62de0ec28ee44 (diff)
downloadkdepimpi-d39b363278224b969d4c2945d32968c980b5d842.zip
kdepimpi-d39b363278224b969d4c2945d32968c980b5d842.tar.gz
kdepimpi-d39b363278224b969d4c2945d32968c980b5d842.tar.bz2
performance optimization during vCard loading
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
@@ -55,4 +55,5 @@ bool VCardFormatImpl::load( Addressee &addressee, QFile *file )
if ( it.current() ) {
- VCard v(*it.current());
- loadAddressee( addressee, v );
+//US VCard v(*it.current());
+//US loadAddressee( addressee, v );
+ loadAddressee( addressee, it.current() );
return true;
@@ -75,5 +76,6 @@ bool VCardFormatImpl::loadAll( AddressBook *addressBook, Resource *resource, QFi
for (; it.current(); ++it) {
- VCard v(*it.current());
+//US VCard v(*it.current());
Addressee addressee;
- loadAddressee( addressee, v );
+//US loadAddressee( addressee, v );
+ loadAddressee( addressee, it.current() );
addressee.setResource( resource );
@@ -124,5 +126,5 @@ void VCardFormatImpl::saveAll( AddressBook *ab, Resource *resource, QFile *file
-bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard &v )
+bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v )
{
- QPtrList<ContentLine> contentLines = v.contentLineList();
+ QPtrList<ContentLine> contentLines = v->contentLineList();
ContentLine *cl;
@@ -786,5 +788,5 @@ void VCardFormatImpl::addAgentValue( VCARD::VCard *vcard, const Agent &agent )
writeToString( (*addr), vstr );
-
+
qDebug("VCardFormatImpl::addAgentValue please verify if replace is correct");
-/*US
+/*US
vstr.replace( ":", "\\:" );
@@ -793,8 +795,8 @@ void VCardFormatImpl::addAgentValue( VCARD::VCard *vcard, const Agent &agent )
vstr.replace( "\r\n", "\\n" );
-*/
- vstr.replace( QRegExp(":"), "\\:" );
- vstr.replace( QRegExp(","), "\\," );
- vstr.replace( QRegExp(";"), "\\;" );
- vstr.replace( QRegExp("\r\n"), "\\n" );
-
+*/
+ vstr.replace( QRegExp(":"), "\\:" );
+ vstr.replace( QRegExp(","), "\\," );
+ vstr.replace( QRegExp(";"), "\\;" );
+ vstr.replace( QRegExp("\r\n"), "\\n" );
+
cl.setValue( new TextValue( vstr.utf8() ) );
@@ -827,3 +829,3 @@ Agent VCardFormatImpl::readAgentValue( VCARD::ContentLine *cl )
qDebug("VCardFormatImpl::addAgentValue please verify if replace is correct");
-/*US
+/*US
vstr.replace( "\\n", "\r\n" );
@@ -833,7 +835,7 @@ Agent VCardFormatImpl::readAgentValue( VCARD::ContentLine *cl )
*/
- vstr.replace( QRegExp("\\n"), "\r\n" );
- vstr.replace( QRegExp("\\:"), ":" );
- vstr.replace( QRegExp("\\,"), "," );
- vstr.replace( QRegExp("\\;"), ";" );
-
+ vstr.replace( QRegExp("\\n"), "\r\n" );
+ vstr.replace( QRegExp("\\:"), ":" );
+ vstr.replace( QRegExp("\\,"), "," );
+ vstr.replace( QRegExp("\\;"), ";" );
+
Addressee *addr = new Addressee;
@@ -868,3 +870,3 @@ void VCardFormatImpl::addPictureValue( VCARD::VCard *vcard, VCARD::EntityType ty
cl.setValue( new TextValue( KCodecs::base64Encode( data ) ) );
-
+
} else { // save picture in cache
@@ -883,3 +885,3 @@ void VCardFormatImpl::addPictureValue( VCARD::VCard *vcard, VCARD::EntityType ty
} else {
-
+
cl.setValue( new TextValue( pic.url().utf8() ) );
@@ -1003,4 +1005,5 @@ bool VCardFormatImpl::readFromString( const QString &vcard, Addressee &addressee
if ( it.current() ) {
- VCard v(*it.current());
- loadAddressee( addressee, v );
+//US VCard v(*it.current());
+//US loadAddressee( addressee, v );
+ loadAddressee( addressee, it.current() );
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;
@short Implementation of vCard backend for address book.
-
+
This class implements reading and writing of address book information using
@@ -60,3 +60,3 @@ class VCardFormatImpl
protected:
- bool loadAddressee( Addressee &, VCARD::VCard & );
+ bool loadAddressee( Addressee &, VCARD::VCard * );
void saveAddressee( const Addressee &, VCARD::VCard *, bool intern );