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 | 24 | ||||
-rw-r--r-- | kaddressbook/xxport/vcard_xxport.cpp | 17 |
3 files changed, 57 insertions, 21 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,40 +1,73 @@ 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. ********** VERSION 2.1.11 ************ KO/Pi: Because we can have many calendars now in KO/Pi we can have more than one journal entry per day. Added features to handle (and add ) more than one journal entry per day. Added option for a journal title. Added info about the calendar, the item belongs to, to the event/todo/journal viewer. Fixed a problem of the alarm of completed recurring todos. Added to the event/todo editor to set quickly the category of an item. Fixed some problems when calling KO/Pi or KA/Pi from the alarm applet. Added KA/Pi multi sync to the multi sync called from the alarm applet. ********** VERSION 2.1.10 ************ KO/Pi: Importing Birthdays will now create another file resource "Birthdays" and import the birthday data from KA/Pi into that file. When a multidayevent is selected in monthview all occurences of this event in the monthview are now hightlighted. Fixed a bug in searching for a small timerange, i.e. one day. diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp index b9fe6ff..ec5ed80 100644 --- a/kabc/vcardformatimpl.cpp +++ b/kabc/vcardformatimpl.cpp @@ -1,167 +1,159 @@ /* This file is part of libkabc. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* 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> #include "addressbook.h" #include "vcardformatimpl.h" using namespace KABC; using namespace VCARD; int VCardFormatImpl::debug = -1; VCardFormatImpl::VCardFormatImpl() { debug = (getenv("KABC_DEBUG") != 0); } bool VCardFormatImpl::load( Addressee &addressee, QFile *file ) { kdDebug(5700) << "VCardFormat::load()" << endl; QByteArray fdata = file->readAll(); QCString data(fdata.data(), fdata.size()+1); VCardEntity e( data ); VCardListIterator it( e.cardList() ); if ( it.current() ) { //US VCard v(*it.current()); //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 ); VCard *v = new VCard; saveAddressee( addressee, v, false ); vcardlist.append( v ); 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; 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() ) { QCString n = cl->name(); if ( n.left( 2 ) == "X-" ) { n = n.mid( 2 ); int posDash = n.find( "-" ); addressee.insertCustom( QString::fromUtf8( n.left( posDash ) ), QString::fromUtf8( n.mid( posDash + 1 ) ), QString::fromUtf8( cl->value()->asString() ) ); continue; } EntityType type = cl->entityType(); switch( type ) { case EntityUID: addressee.setUid( readTextValue( cl ) ); break; case EntityEmail: addressee.insertEmail( readTextValue( cl ) ); break; case EntityName: addressee.setName( readTextValue( cl ) ); break; 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 @@ -168,68 +168,79 @@ KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const KMessageBox::error( parentWidget(), text.arg( url.url() ), caption ); } } #else //KAB_EMBEDDED if ( !XXPortManager::importData.isEmpty() ) addrList = parseVCard( XXPortManager::importData ); else { if ( XXPortManager::importURL.isEmpty() ) { fileName = KFileDialog::getOpenFileName( QString::null, i18n("Select vCard to Import"), parentWidget() ); if ( fileName.isEmpty() ) return addrList; QFileInfo fi ( fileName ); if ( !fi.isFile() ) return addrList; } else { //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; } KABC::AddresseeList VCardXXPort::parseVCard( const QString &data ) const { KABC::VCardTool tool; KABC::AddresseeList addrList; addrList = tool.parseVCards( data ); // LR : I switched to the code, which is in current cvs HEAD /* uint numVCards = data.contains( "BEGIN:VCARD", false ); QStringList dataList = QStringList::split( "\r\n\r\n", data ); for ( uint i = 0; i < numVCards && i < dataList.count(); ++i ) { KABC::Addressee addr; bool ok = false; if ( dataList[ i ].contains( "VERSION:3.0" ) ) ok = converter.vCardToAddressee( dataList[ i ], addr, KABC::VCardConverter::v3_0 ); else if ( dataList[ i ].contains( "VERSION:2.1" ) ) ok = converter.vCardToAddressee( dataList[ i ], addr, KABC::VCardConverter::v2_1 ); else { KMessageBox::sorry( parentWidget(), i18n( "Not supported vCard version." ) ); continue; } |