-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,24 +1,57 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | ********** VERSION 2.1.13 ************ | 3 | ********** VERSION 2.1.13 ************ |
4 | 4 | ||
5 | Fixed a problem in KA/Pi search. | 5 | Fixed a problem in KA/Pi search. |
6 | Fixed some minor problems in KO/Pi. | 6 | Fixed some minor problems in KO/Pi. |
7 | Added calendar selection possibility to the todo view popup and to the event/todo editor. | 7 | Added calendar selection possibility to the todo view popup and to the event/todo/journal editor. |
8 | 8 | ||
9 | Fixed memory usage problems in KA/Pi: | ||
10 | When loading data KA/Pi did load the file data twice. | ||
11 | Example: | ||
12 | A 600k file did consume 1200k memory during loading process. | ||
13 | This is fixed, it does now consume only 600k during loading process. | ||
14 | When saving data KA/Pi did consume a lot of memory for the data parsing during the save process. | ||
15 | This is fixed. | ||
16 | Example: | ||
17 | Before saving a 600k file KA/Pi did consume 21.7 Meg of Ram. | ||
18 | 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. | ||
19 | Now KA/Pi is consuming on saving the same data 22.0 Meg of Ram during the save process. | ||
20 | Note: The memory usage of KA/Pi after the data is loaded/saved has not changed. | ||
21 | |||
22 | Fixed memory usage problems in KO/Pi: | ||
23 | When KO/Pi did save the data to file, it did not release the used buffers after saving. | ||
24 | The used buffer was released after saving the next time, but there was new buffer space allocated again on that save operation. | ||
25 | This is fixed. | ||
26 | Example: | ||
27 | When saving a 400k file KO/Pi do now use 400k less memory now. | ||
28 | |||
29 | Optimized memory usage in KO/Pi Agenda view: | ||
30 | KO/Pi is storing some paint information in extra buffers for faster repainting of the agenda view. | ||
31 | These buffers were not made smaller (i.e. downsized) because of performance reasons. | ||
32 | The handling of these buffers are now much smarter: | ||
33 | Two (of six) buffers are removed completely. | ||
34 | The remaing four buffers are now downsized after not using the agenda view for 45 seconds. | ||
35 | 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. | ||
36 | |||
37 | Worst case example ( for a maximum size agenda content): | ||
38 | 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. | ||
39 | |||
40 | Summary: | ||
41 | Many memory wasting problems of KA/Pi and KO/Pi fixed such that it is better to use on the Zaurus. | ||
9 | 42 | ||
10 | ********** VERSION 2.1.12 ************ | 43 | ********** VERSION 2.1.12 ************ |
11 | 44 | ||
12 | KO/Pi: | 45 | KO/Pi: |
13 | Many small usability fixes, e.g. rearranged the popup menus such that they are better to use on the Zaurus. | 46 | Many small usability fixes, e.g. rearranged the popup menus such that they are better to use on the Zaurus. |
14 | Fixed a problem with the month view when file was saved but KO/Pi was not the active window. | 47 | Fixed a problem with the month view when file was saved but KO/Pi was not the active window. |
15 | Fixed some problems in the resource config dialog (e.g. added a warning if you set all calendars to read-only). | 48 | Fixed some problems in the resource config dialog (e.g. added a warning if you set all calendars to read-only). |
16 | Fixed some other small problems. | 49 | Fixed some other small problems. |
17 | 50 | ||
18 | ********** VERSION 2.1.11 ************ | 51 | ********** VERSION 2.1.11 ************ |
19 | 52 | ||
20 | KO/Pi: | 53 | KO/Pi: |
21 | Because we can have many calendars now in KO/Pi we can have more than one journal entry per day. | 54 | Because we can have many calendars now in KO/Pi we can have more than one journal entry per day. |
22 | Added features to handle (and add ) more than one journal entry per day. | 55 | Added features to handle (and add ) more than one journal entry per day. |
23 | Added option for a journal title. | 56 | Added option for a journal title. |
24 | 57 | ||
diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp index b9fe6ff..ec5ed80 100644 --- a/kabc/vcardformatimpl.cpp +++ b/kabc/vcardformatimpl.cpp | |||
@@ -14,32 +14,33 @@ | |||
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <qfile.h> | 28 | #include <qfile.h> |
29 | #include <qregexp.h> | 29 | #include <qregexp.h> |
30 | #include <qapplication.h> | ||
30 | 31 | ||
31 | #include <kdebug.h> | 32 | #include <kdebug.h> |
32 | #include <kmdcodec.h> | 33 | #include <kmdcodec.h> |
33 | #include <kstandarddirs.h> | 34 | #include <kstandarddirs.h> |
34 | #include <ktempfile.h> | 35 | #include <ktempfile.h> |
35 | 36 | ||
36 | #include <VCard.h> | 37 | #include <VCard.h> |
37 | 38 | ||
38 | #include "addressbook.h" | 39 | #include "addressbook.h" |
39 | #include "vcardformatimpl.h" | 40 | #include "vcardformatimpl.h" |
40 | 41 | ||
41 | using namespace KABC; | 42 | using namespace KABC; |
42 | using namespace VCARD; | 43 | using namespace VCARD; |
43 | 44 | ||
44 | int VCardFormatImpl::debug = -1; | 45 | int VCardFormatImpl::debug = -1; |
45 | 46 | ||
@@ -56,96 +57,87 @@ bool VCardFormatImpl::load( Addressee &addressee, QFile *file ) | |||
56 | QCString data(fdata.data(), fdata.size()+1); | 57 | QCString data(fdata.data(), fdata.size()+1); |
57 | 58 | ||
58 | VCardEntity e( data ); | 59 | VCardEntity e( data ); |
59 | 60 | ||
60 | VCardListIterator it( e.cardList() ); | 61 | VCardListIterator it( e.cardList() ); |
61 | 62 | ||
62 | if ( it.current() ) { | 63 | if ( it.current() ) { |
63 | //US VCard v(*it.current()); | 64 | //US VCard v(*it.current()); |
64 | //US loadAddressee( addressee, v ); | 65 | //US loadAddressee( addressee, v ); |
65 | loadAddressee( addressee, it.current() ); | 66 | loadAddressee( addressee, it.current() ); |
66 | return true; | 67 | return true; |
67 | } | 68 | } |
68 | 69 | ||
69 | return false; | 70 | return false; |
70 | } | 71 | } |
71 | 72 | ||
73 | |||
74 | #include <kmessagebox.h> | ||
72 | bool VCardFormatImpl::loadAll( AddressBook *addressBook, Resource *resource, QFile *file ) | 75 | bool VCardFormatImpl::loadAll( AddressBook *addressBook, Resource *resource, QFile *file ) |
73 | { | 76 | { |
74 | kdDebug(5700) << "VCardFormat::loadAll()" << endl; | 77 | |
75 | 78 | QCString data(file->readAll().data(), file->size()+1); | |
76 | QByteArray fdata = file->readAll(); | ||
77 | QCString data(fdata.data(), fdata.size()+1); | ||
78 | |||
79 | VCardEntity e( data ); | 79 | VCardEntity e( data ); |
80 | 80 | ||
81 | VCardListIterator it( e.cardList() ); | 81 | VCardListIterator it( e.cardList() ); |
82 | 82 | ||
83 | for (; it.current(); ++it) { | 83 | for (; it.current(); ++it) { |
84 | //US VCard v(*it.current()); | 84 | //US VCard v(*it.current()); |
85 | Addressee addressee; | 85 | Addressee addressee; |
86 | //US loadAddressee( addressee, v ); | 86 | //US loadAddressee( addressee, v ); |
87 | loadAddressee( addressee, it.current() ); | 87 | loadAddressee( addressee, it.current() ); |
88 | addressee.setResource( resource ); | 88 | addressee.setResource( resource ); |
89 | addressBook->insertAddressee( addressee ); | 89 | addressBook->insertAddressee( addressee ); |
90 | if (debug == true) | 90 | if (debug == true) |
91 | { | 91 | { |
92 | printf("address %s loaded successfully\n", addressee.formattedName().latin1()); | 92 | printf("address %s loaded successfully\n", addressee.formattedName().latin1()); |
93 | } | 93 | } |
94 | } | 94 | } |
95 | |||
96 | return true; | 95 | return true; |
97 | } | 96 | } |
98 | 97 | ||
99 | void VCardFormatImpl::save( const Addressee &addressee, QFile *file ) | 98 | void VCardFormatImpl::save( const Addressee &addressee, QFile *file ) |
100 | { | 99 | { |
101 | VCardEntity vcards; | 100 | VCardEntity vcards; |
102 | VCardList vcardlist; | 101 | VCardList vcardlist; |
103 | vcardlist.setAutoDelete( true ); | 102 | vcardlist.setAutoDelete( true ); |
104 | 103 | ||
105 | VCard *v = new VCard; | 104 | VCard *v = new VCard; |
106 | 105 | ||
107 | saveAddressee( addressee, v, false ); | 106 | saveAddressee( addressee, v, false ); |
108 | 107 | ||
109 | vcardlist.append( v ); | 108 | vcardlist.append( v ); |
110 | vcards.setCardList( vcardlist ); | 109 | vcards.setCardList( vcardlist ); |
111 | 110 | ||
112 | QCString vcardData = vcards.asString(); | 111 | QCString vcardData = vcards.asString(); |
113 | file->writeBlock( (const char*)vcardData, vcardData.length() ); | 112 | file->writeBlock( (const char*)vcardData, vcardData.length() ); |
114 | } | 113 | } |
115 | 114 | ||
116 | void VCardFormatImpl::saveAll( AddressBook *ab, Resource *resource, QFile *file ) | 115 | void VCardFormatImpl::saveAll( AddressBook *ab, Resource *resource, QFile *file ) |
117 | { | 116 | { |
118 | VCardEntity vcards; | ||
119 | VCardList vcardlist; | ||
120 | vcardlist.setAutoDelete( true ); | ||
121 | 117 | ||
122 | AddressBook::Iterator it; | 118 | AddressBook::Iterator it; |
123 | for ( it = ab->begin(); it != ab->end(); ++it ) { | 119 | for ( it = ab->begin(); it != ab->end(); ++it ) { |
124 | if ( (*it).resource() == resource ) { | 120 | if ( (*it).resource() == resource ) { |
125 | VCard *v = new VCard; | 121 | save((*it),file); |
126 | saveAddressee( (*it), v, true ); | 122 | qApp->processEvents(); |
127 | (*it).setChanged( false ); | 123 | (*it).setChanged( false ); |
128 | vcardlist.append( v ); | ||
129 | } | 124 | } |
130 | } | 125 | } |
131 | 126 | // for memory usage status test only | |
132 | vcards.setCardList( vcardlist ); | 127 | // KMessageBox::information ( 0, "Stoppppp", QString("Stop ") ); |
133 | |||
134 | QCString vcardData = vcards.asString(); | ||
135 | file->writeBlock( (const char*)vcardData, vcardData.length() ); | ||
136 | } | 128 | } |
137 | 129 | ||
138 | bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v ) | 130 | bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v ) |
139 | { | 131 | { |
140 | QPtrList<ContentLine> contentLines = v->contentLineList(); | 132 | QPtrList<ContentLine> contentLines = v->contentLineList(); |
141 | ContentLine *cl; | 133 | ContentLine *cl; |
142 | 134 | ||
143 | for( cl = contentLines.first(); cl; cl = contentLines.next() ) { | 135 | for( cl = contentLines.first(); cl; cl = contentLines.next() ) { |
144 | QCString n = cl->name(); | 136 | QCString n = cl->name(); |
145 | if ( n.left( 2 ) == "X-" ) { | 137 | if ( n.left( 2 ) == "X-" ) { |
146 | n = n.mid( 2 ); | 138 | n = n.mid( 2 ); |
147 | int posDash = n.find( "-" ); | 139 | int posDash = n.find( "-" ); |
148 | addressee.insertCustom( QString::fromUtf8( n.left( posDash ) ), | 140 | addressee.insertCustom( QString::fromUtf8( n.left( posDash ) ), |
149 | QString::fromUtf8( n.mid( posDash + 1 ) ), | 141 | QString::fromUtf8( n.mid( posDash + 1 ) ), |
150 | QString::fromUtf8( cl->value()->asString() ) ); | 142 | QString::fromUtf8( cl->value()->asString() ) ); |
151 | continue; | 143 | continue; |
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 | |||
@@ -184,36 +184,47 @@ KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const | |||
184 | if ( fileName.isEmpty() ) | 184 | if ( fileName.isEmpty() ) |
185 | return addrList; | 185 | return addrList; |
186 | QFileInfo fi ( fileName ); | 186 | QFileInfo fi ( fileName ); |
187 | if ( !fi.isFile() ) | 187 | if ( !fi.isFile() ) |
188 | return addrList; | 188 | return addrList; |
189 | } | 189 | } |
190 | else | 190 | else |
191 | { | 191 | { |
192 | //US url = XXPortManager::importURL; | 192 | //US url = XXPortManager::importURL; |
193 | qDebug("VCardXXPort::importContacts Urls at the moment not supported"); | 193 | qDebug("VCardXXPort::importContacts Urls at the moment not supported"); |
194 | if ( url.isEmpty() ) | 194 | if ( url.isEmpty() ) |
195 | return addrList; | 195 | return addrList; |
196 | 196 | ||
197 | } | 197 | } |
198 | QFile file( fileName ); | 198 | QFile file( fileName ); |
199 | if ( file.open( IO_ReadOnly ) ) { | 199 | if ( file.open( IO_ReadOnly ) ) { |
200 | QByteArray rawData = file.readAll(); | 200 | QCString rawData ( file.readAll().data(),file.size()+1); |
201 | file.close(); | 201 | file.close(); |
202 | QString data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); | 202 | int start = 0; |
203 | addrList = parseVCard( data ); | 203 | #ifndef DESKTOP_VERSION |
204 | while ( start < rawData.size()-2 ) { | ||
205 | if ( rawData.at( start ) == '\r' ) | ||
206 | if ( rawData.at( start+1 ) == '\n' ) | ||
207 | if ( rawData.at( start+2 ) == ' ' ) { | ||
208 | rawData.remove(start,3); | ||
209 | --start; | ||
210 | } | ||
211 | ++start; | ||
212 | } | ||
213 | #endif | ||
214 | addrList = parseVCard( QString::fromUtf8( rawData.data() ) ); | ||
204 | } | 215 | } |
205 | 216 | ||
206 | } | 217 | } |
207 | #endif //KAB_EMBEDDED | 218 | #endif //KAB_EMBEDDED |
208 | 219 | ||
209 | return addrList; | 220 | return addrList; |
210 | } | 221 | } |
211 | 222 | ||
212 | KABC::AddresseeList VCardXXPort::parseVCard( const QString &data ) const | 223 | KABC::AddresseeList VCardXXPort::parseVCard( const QString &data ) const |
213 | { | 224 | { |
214 | 225 | ||
215 | KABC::VCardTool tool; | 226 | KABC::VCardTool tool; |
216 | KABC::AddresseeList addrList; | 227 | KABC::AddresseeList addrList; |
217 | addrList = tool.parseVCards( data ); | 228 | addrList = tool.parseVCards( data ); |
218 | // LR : I switched to the code, which is in current cvs HEAD | 229 | // LR : I switched to the code, which is in current cvs HEAD |
219 | /* | 230 | /* |