-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 @@ -1,16 +1,49 @@ Info about the changes in new versions of KDE-Pim/Pi ********** VERSION 2.1.13 ************ 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. ********** VERSION 2.1.12 ************ KO/Pi: Many small usability fixes, e.g. rearranged the popup menus such that they are better to use on the Zaurus. Fixed a problem with the month view when file was saved but KO/Pi was not the active window. Fixed some problems in the resource config dialog (e.g. added a warning if you set all calendars to read-only). Fixed some other small problems. diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp index b9fe6ff..ec5ed80 100644 --- a/kabc/vcardformatimpl.cpp +++ b/kabc/vcardformatimpl.cpp @@ -22,16 +22,17 @@ Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #include <qfile.h> #include <qregexp.h> +#include <qapplication.h> #include <kdebug.h> #include <kmdcodec.h> #include <kstandarddirs.h> #include <ktempfile.h> #include <VCard.h> @@ -64,40 +65,38 @@ bool VCardFormatImpl::load( Addressee &addressee, QFile *file ) //US loadAddressee( addressee, v ); loadAddressee( addressee, it.current() ); return true; } return false; } + +#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 ); VCardListIterator it( e.cardList() ); for (; it.current(); ++it) { //US VCard v(*it.current()); Addressee addressee; //US loadAddressee( addressee, v ); loadAddressee( addressee, it.current() ); addressee.setResource( resource ); addressBook->insertAddressee( addressee ); if (debug == true) { printf("address %s loaded successfully\n", addressee.formattedName().latin1()); } } - return true; } void VCardFormatImpl::save( const Addressee &addressee, QFile *file ) { VCardEntity vcards; VCardList vcardlist; vcardlist.setAutoDelete( true ); @@ -110,34 +109,27 @@ void VCardFormatImpl::save( const Addressee &addressee, QFile *file ) vcards.setCardList( vcardlist ); QCString vcardData = vcards.asString(); file->writeBlock( (const char*)vcardData, vcardData.length() ); } 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 ") ); } bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v ) { QPtrList<ContentLine> contentLines = v->contentLineList(); ContentLine *cl; for( cl = contentLines.first(); cl; cl = contentLines.next() ) { 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 @@ -192,20 +192,31 @@ KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const //US url = XXPortManager::importURL; qDebug("VCardXXPort::importContacts Urls at the moment not supported"); if ( url.isEmpty() ) return addrList; } QFile file( fileName ); 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() ) ); } } #endif //KAB_EMBEDDED return addrList; } |