-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,72 +1,105 @@ 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. KA/Pi: Fixed two problems in csv export. Fixed problems when calling the contact selection dialog from KO/Pi or OM/Pi. ********** VERSION 2.1.9 ************ KO/Pi: Fixed some problems of the new search options in the search dialog. Fixed some problems in the new resource config options. Changed the recurrence edit of events and todos such that the recurrence edit page now is notified about a change of the start date on the first page. Fixed a problem creating new events in the agenda view if at the day/time is already an agenda item shown: Now you can click on the bottom/top of an allday agenda item or on the left/right side of an agenda item to get the "new todo/new event" popup. Fixed a problem in recurrence range in syncing with DTM. KA/Pi: Made it posiible to show in the contact overview the details of all data available for that contact( e.g. office, spouse, children, nickname ...) PwM/Pi: Added "sec" to the timeout config settings to make it clear the timeout values are seconds. ********** VERSION 2.1.8 ************ KO/Pi: Added info about the completion state of a todo in the ListView/Searchdialog. If in TodoView is selected "do not show compledted todos" then completed todos are not shown in the ListView as well. Fixed some updating problems when changing the filter. KA/Pi: In the addressee selection dialog now the formatted name is shown, if not empty. Added a column "category" to the addressee selection dialog to make it possible to sort addressees after category. Now in the addressee selection dialog a selected contact is remove with a single click from the selected list. diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp index b9fe6ff..ec5ed80 100644 --- a/kabc/vcardformatimpl.cpp +++ b/kabc/vcardformatimpl.cpp @@ -1,199 +1,191 @@ /* 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; + 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; case EntityFullName: addressee.setFormattedName( readTextValue( cl ) ); break; case EntityURL: addressee.setUrl( KURL( readTextValue( cl ) ) ); break; case EntityNickname: addressee.setNickName( readTextValue( cl ) ); break; case EntityLabel: // not yet supported by kabc break; case EntityMailer: addressee.setMailer( readTextValue( cl ) ); break; case EntityTitle: addressee.setTitle( readTextValue( cl ) ); break; case EntityRole: addressee.setRole( readTextValue( cl ) ); break; case EntityOrganisation: addressee.setOrganization( 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 @@ -136,120 +136,131 @@ KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const QString fileName; KABC::AddresseeList addrList; KURL url; #ifndef KAB_EMBEDDED if ( !XXPortManager::importData.isEmpty() ) addrList = parseVCard( XXPortManager::importData ); else { if ( XXPortManager::importURL.isEmpty() ) { url = KFileDialog::getLoadFileName( QString::null, i18n("Select vCard to Import"), parentWidget() ); } else url = XXPortManager::importURL; if ( url.isEmpty() ) return addrList; QString caption( i18n( "vCard Import Failed" ) ); if ( KIO::NetAccess::download( url, fileName ) ) { QFile file( fileName ); file.open( IO_ReadOnly ); QByteArray rawData = file.readAll(); file.close(); QString data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); addrList = parseVCard( data ); if ( !url.isLocalFile() ) KIO::NetAccess::removeTempFile( fileName ); } else { QString text = i18n( "<qt>Unable to access <b>%1</b>.</qt>" ); 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; } if ( !addr.isEmpty() && ok ) addrList.append( addr ); else { QString text = i18n( "The selected file does not include a valid vCard. " "Please check the file and try again." ); KMessageBox::sorry( parentWidget(), text ); } } */ if ( addrList.isEmpty() ) { QString text = i18n( "The selected file does not\ninclude a valid vCard.\nPlease check the file and try again.\n" ); KMessageBox::sorry( parentWidget(), text ); } return addrList; } #ifndef KAB_EMBEDDED #include "vcard_xxport.moc" #endif //KAB_EMBEDDED |