author | zautrix <zautrix> | 2005-07-06 09:29:15 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-06 09:29:15 (UTC) |
commit | 38c8ca3f376451c072650fad8964adbbc513a105 (patch) (side-by-side diff) | |
tree | b1d4f1cec8b208294a16ff0d88ef6f8d5812c887 | |
parent | 68016257abe13019610cb7bb230f8d754179abfb (diff) | |
download | kdepimpi-38c8ca3f376451c072650fad8964adbbc513a105.zip kdepimpi-38c8ca3f376451c072650fad8964adbbc513a105.tar.gz kdepimpi-38c8ca3f376451c072650fad8964adbbc513a105.tar.bz2 |
fixxxx
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 37 | ||||
-rw-r--r-- | kabc/vcardformatimpl.cpp | 28 | ||||
-rw-r--r-- | kaddressbook/xxport/vcard_xxport.cpp | 17 |
3 files changed, 59 insertions, 23 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 27d37c4..ea49c2c 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt @@ -6,4 +6,37 @@ Fixed a problem in KA/Pi search. Fixed some minor problems in KO/Pi. -Added calendar selection possibility to the todo view popup and to the event/todo editor. - +Added calendar selection possibility to the todo view popup and to the event/todo/journal editor. + +Fixed memory usage problems in KA/Pi: +When loading data KA/Pi did load the file data twice. +Example: + A 600k file did consume 1200k memory during loading process. + This is fixed, it does now consume only 600k during loading process. +When saving data KA/Pi did consume a lot of memory for the data parsing during the save process. +This is fixed. +Example: + Before saving a 600k file KA/Pi did consume 21.7 Meg of Ram. + When saving KA/Pi did consume 28.6 Meg of Ram. That causes a crash on the Zaurus because there was no memeory left in the system. + Now KA/Pi is consuming on saving the same data 22.0 Meg of Ram during the save process. +Note: The memory usage of KA/Pi after the data is loaded/saved has not changed. + +Fixed memory usage problems in KO/Pi: +When KO/Pi did save the data to file, it did not release the used buffers after saving. +The used buffer was released after saving the next time, but there was new buffer space allocated again on that save operation. +This is fixed. +Example: + When saving a 400k file KO/Pi do now use 400k less memory now. + +Optimized memory usage in KO/Pi Agenda view: +KO/Pi is storing some paint information in extra buffers for faster repainting of the agenda view. +These buffers were not made smaller (i.e. downsized) because of performance reasons. +The handling of these buffers are now much smarter: +Two (of six) buffers are removed completely. +The remaing four buffers are now downsized after not using the agenda view for 45 seconds. +Such that the memory usage of KO/Pi is smaller now in general ( because 2 buffers are removed) and is much smaller when not using the agenda view. That is very important when using fastload for KO/Pi. + +Worst case example ( for a maximum size agenda content): + When resizing the agenda content to a large scale, KO/Pi did use 17Meg of mem ( and did not use less memory until it was stopped). Now KO/Pi is using on the same operation only 14.3 Meg of mem and after 45 seconds not using the agenda view it uses only 9.4 Meg of mem. + +Summary: +Many memory wasting problems of KA/Pi and KO/Pi fixed such that it is better to use on the Zaurus. diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp index b9fe6ff..ec5ed80 100644 --- a/kabc/vcardformatimpl.cpp +++ b/kabc/vcardformatimpl.cpp @@ -29,2 +29,3 @@ $Id$ #include <qregexp.h> +#include <qapplication.h> @@ -71,9 +72,8 @@ bool VCardFormatImpl::load( Addressee &addressee, QFile *file ) + +#include <kmessagebox.h> bool VCardFormatImpl::loadAll( AddressBook *addressBook, Resource *resource, QFile *file ) { - kdDebug(5700) << "VCardFormat::loadAll()" << endl; - - QByteArray fdata = file->readAll(); - QCString data(fdata.data(), fdata.size()+1); - + + QCString data(file->readAll().data(), file->size()+1); VCardEntity e( data ); @@ -94,3 +94,2 @@ bool VCardFormatImpl::loadAll( AddressBook *addressBook, Resource *resource, QFi } - return true; @@ -117,20 +116,13 @@ void VCardFormatImpl::saveAll( AddressBook *ab, Resource *resource, QFile *file { - VCardEntity vcards; - VCardList vcardlist; - vcardlist.setAutoDelete( true ); - AddressBook::Iterator it; + AddressBook::Iterator it; for ( it = ab->begin(); it != ab->end(); ++it ) { if ( (*it).resource() == resource ) { - VCard *v = new VCard; - saveAddressee( (*it), v, true ); + save((*it),file); + qApp->processEvents(); (*it).setChanged( false ); - vcardlist.append( v ); } } - - vcards.setCardList( vcardlist ); - - QCString vcardData = vcards.asString(); - file->writeBlock( (const char*)vcardData, vcardData.length() ); + // for memory usage status test only + // KMessageBox::information ( 0, "Stoppppp", QString("Stop ") ); } diff --git a/kaddressbook/xxport/vcard_xxport.cpp b/kaddressbook/xxport/vcard_xxport.cpp index c56be8b..91df96d 100644 --- a/kaddressbook/xxport/vcard_xxport.cpp +++ b/kaddressbook/xxport/vcard_xxport.cpp @@ -199,6 +199,17 @@ KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const if ( file.open( IO_ReadOnly ) ) { - QByteArray rawData = file.readAll(); + QCString rawData ( file.readAll().data(),file.size()+1); file.close(); - QString data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); - addrList = parseVCard( data ); + int start = 0; +#ifndef DESKTOP_VERSION + while ( start < rawData.size()-2 ) { + if ( rawData.at( start ) == '\r' ) + if ( rawData.at( start+1 ) == '\n' ) + if ( rawData.at( start+2 ) == ' ' ) { + rawData.remove(start,3); + --start; + } + ++start; + } +#endif + addrList = parseVCard( QString::fromUtf8( rawData.data() ) ); } |