-rw-r--r-- | bin/kdepim/WhatsNew.txt | 2 | ||||
-rw-r--r-- | kabc/vcardparser/vcard.cpp | 2 | ||||
-rw-r--r-- | kabc/vcardparser/vcardline.cpp | 14 | ||||
-rw-r--r-- | kabc/vcardparser/vcardline.h | 7 | ||||
-rw-r--r-- | kabc/vcardparser/vcardparser.cpp | 8 | ||||
-rw-r--r-- | kabc/vcardparser/vcardtool.cpp | 86 | ||||
-rw-r--r-- | kaddressbook/views/cardview.cpp | 9 |
7 files changed, 67 insertions, 61 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index bc0c62a..97c8154 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,19 +1,21 @@ | |||
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.0.26 ************ | 3 | ********** VERSION 2.0.26 ************ |
4 | 4 | ||
5 | And again fixed some bugs. | 5 | And again fixed some bugs. |
6 | Added two more fields to the KA/Pi view config: | 6 | Added two more fields to the KA/Pi view config: |
7 | A "Mobile (home)" and a "Mobile (work)" field. | 7 | A "Mobile (home)" and a "Mobile (work)" field. |
8 | Fixed utf8 import (e.g. for Japaneese text) in KA/Pi. | ||
9 | |||
8 | 10 | ||
9 | ********** VERSION 2.0.25 ************ | 11 | ********** VERSION 2.0.25 ************ |
10 | 12 | ||
11 | And again fixed some bugs. | 13 | And again fixed some bugs. |
12 | 14 | ||
13 | ********** VERSION 2.0.24 ************ | 15 | ********** VERSION 2.0.24 ************ |
14 | 16 | ||
15 | Fixed again a lot of small bugs. | 17 | Fixed again a lot of small bugs. |
16 | Some performance optimizations in date navigator. | 18 | Some performance optimizations in date navigator. |
17 | Month view displays now multi days events on top of each cell, such that it is more likely that all multi days items of one event are in the same row. | 19 | Month view displays now multi days events on top of each cell, such that it is more likely that all multi days items of one event are in the same row. |
18 | 20 | ||
19 | ********** VERSION 2.0.23 ************ | 21 | ********** VERSION 2.0.23 ************ |
diff --git a/kabc/vcardparser/vcard.cpp b/kabc/vcardparser/vcard.cpp index 24fd498..bc9f208 100644 --- a/kabc/vcardparser/vcard.cpp +++ b/kabc/vcardparser/vcard.cpp | |||
@@ -102,17 +102,17 @@ void VCard::setVersion( Version version ) | |||
102 | line.setIdentifier( "3.0" ); | 102 | line.setIdentifier( "3.0" ); |
103 | 103 | ||
104 | mLineMap[ "VERSION" ].append( line ); | 104 | mLineMap[ "VERSION" ].append( line ); |
105 | } | 105 | } |
106 | 106 | ||
107 | VCard::Version VCard::version() const | 107 | VCard::Version VCard::version() const |
108 | { | 108 | { |
109 | LineMap::ConstIterator versionEntry = mLineMap.find( "VERSION" ); | 109 | LineMap::ConstIterator versionEntry = mLineMap.find( "VERSION" ); |
110 | if ( versionEntry == mLineMap.end() ) | 110 | if ( versionEntry == mLineMap.end() ) |
111 | return v3_0; | 111 | return v3_0; |
112 | 112 | ||
113 | VCardLine line = ( *versionEntry )[ 0 ]; | 113 | VCardLine line = ( *versionEntry )[ 0 ]; |
114 | if ( line.value() == "2.1" ) | 114 | if ( line.valueString() == "2.1" ) |
115 | return v2_1; | 115 | return v2_1; |
116 | else | 116 | else |
117 | return v3_0; | 117 | return v3_0; |
118 | } | 118 | } |
diff --git a/kabc/vcardparser/vcardline.cpp b/kabc/vcardparser/vcardline.cpp index 0972a35..8df2d32 100644 --- a/kabc/vcardparser/vcardline.cpp +++ b/kabc/vcardparser/vcardline.cpp | |||
@@ -73,37 +73,41 @@ VCardLine& VCardLine::operator=( const VCardLine& line ) | |||
73 | } | 73 | } |
74 | 74 | ||
75 | void VCardLine::setIdentifier( const QString& identifier ) | 75 | void VCardLine::setIdentifier( const QString& identifier ) |
76 | { | 76 | { |
77 | mIdentifier = identifier; | 77 | mIdentifier = identifier; |
78 | } | 78 | } |
79 | 79 | ||
80 | QString VCardLine::identifier() const | 80 | QString VCardLine::identifier() const |
81 | { | 81 | { |
82 | return mIdentifier; | 82 | return mIdentifier; |
83 | } | 83 | } |
84 | 84 | ||
85 | void VCardLine::setValue( const QString& value ) | 85 | void VCardLine::setValueString( const QString& value ) |
86 | { | 86 | { |
87 | mValue.duplicate( value.data(), value.length() ); | 87 | setValueCString( value.utf8() ); |
88 | } | ||
89 | void VCardLine::setValueCString( const QCString& value ) | ||
90 | { | ||
91 | mValue.duplicate( value.data(), value.length() ); | ||
88 | } | 92 | } |
89 | 93 | ||
90 | void VCardLine::setValue( const QByteArray& value ) | 94 | void VCardLine::setValueBytes( const QByteArray& value ) |
91 | { | 95 | { |
92 | mValue = value; | 96 | mValue = value; |
93 | } | 97 | } |
94 | 98 | ||
95 | QVariant VCardLine::value() const | 99 | QString VCardLine::valueString() const |
96 | { | 100 | { |
97 | return QVariant( QCString( mValue.data(), mValue.size()+1 ) ); | 101 | return QString::fromUtf8( mValue.data(), mValue.size() ); |
98 | } | 102 | } |
99 | 103 | ||
100 | QByteArray VCardLine::valueBytes() const | 104 | QByteArray VCardLine::valueBytes() const |
101 | { | 105 | { |
102 | return mValue; | 106 | return mValue; |
103 | } | 107 | } |
104 | 108 | ||
105 | void VCardLine::setGroup( const QString& group ) | 109 | void VCardLine::setGroup( const QString& group ) |
106 | { | 110 | { |
107 | if ( !d ) | 111 | if ( !d ) |
108 | d = new VCardLinePrivate(); | 112 | d = new VCardLinePrivate(); |
109 | 113 | ||
diff --git a/kabc/vcardparser/vcardline.h b/kabc/vcardparser/vcardline.h index 6e74b38..8dc9322 100644 --- a/kabc/vcardparser/vcardline.h +++ b/kabc/vcardparser/vcardline.h | |||
@@ -49,31 +49,32 @@ class VCardLine | |||
49 | * Sets the identifier of this line e.g. UID, FN, CLASS | 49 | * Sets the identifier of this line e.g. UID, FN, CLASS |
50 | */ | 50 | */ |
51 | void setIdentifier( const QString& identifier ); | 51 | void setIdentifier( const QString& identifier ); |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * Returns the identifier of this line. | 54 | * Returns the identifier of this line. |
55 | */ | 55 | */ |
56 | QString identifier() const; | 56 | QString identifier() const; |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * Sets the value of of this line. | 59 | * Sets the value of of this line. |
60 | */ | 60 | */ |
61 | void setValue( const QString& value ); | 61 | void setValueString( const QString& value ); |
62 | void setValue( const QByteArray& value ); | 62 | void setValueCString( const QCString& value ); |
63 | void setValueBytes( const QByteArray& value ); | ||
63 | 64 | ||
64 | /** | 65 | /** |
65 | * Returns the value of this line. | 66 | * Returns the value of this line. |
66 | */ | 67 | */ |
67 | QVariant value() const; | 68 | QString valueString() const; |
68 | QByteArray valueBytes() const; | 69 | QByteArray valueBytes() const; |
69 | 70 | ||
70 | /** | 71 | /** |
71 | * Sets the group the line belongs to. | 72 | * Sets the group the line belongs to. |
72 | */ | 73 | */ |
73 | void setGroup( const QString& group ); | 74 | void setGroup( const QString& group ); |
74 | 75 | ||
75 | /** | 76 | /** |
76 | * Returns the group the line belongs to. | 77 | * Returns the group the line belongs to. |
77 | */ | 78 | */ |
78 | QString group() const; | 79 | QString group() const; |
79 | 80 | ||
diff --git a/kabc/vcardparser/vcardparser.cpp b/kabc/vcardparser/vcardparser.cpp index 7fae011..11622a0 100644 --- a/kabc/vcardparser/vcardparser.cpp +++ b/kabc/vcardparser/vcardparser.cpp | |||
@@ -117,30 +117,30 @@ VCard::List VCardParser::parseVCards( const QString& text ) | |||
117 | // join any qp-folded lines | 117 | // join any qp-folded lines |
118 | while ( value.mid(value.length()-1,1) == "=" && it != linesEnd ) { | 118 | while ( value.mid(value.length()-1,1) == "=" && it != linesEnd ) { |
119 | value = value.remove( value.length()-1, 1 ) + (*it); | 119 | value = value.remove( value.length()-1, 1 ) + (*it); |
120 | ++it; | 120 | ++it; |
121 | } | 121 | } |
122 | input = value.local8Bit(); | 122 | input = value.local8Bit(); |
123 | KCodecs::quotedPrintableDecode( input, output ); | 123 | KCodecs::quotedPrintableDecode( input, output ); |
124 | } | 124 | } |
125 | //PP our vcards are *supposed* to be in UTF-8 | 125 | //PP our vcards are *supposed* to be in UTF-8 |
126 | // if ( vCardLine.parameter( "charset" ).lower() == "utf-8" ) { | 126 | // if ( vCardLine.parameter( "charset" ).lower() == "utf-8" ) { |
127 | // vCardLine.setValue( QString::fromUtf8( output.data(), output.size() ) ); | 127 | // vCardLine.setValue( QString::fromUtf8( output.data(), output.size() ) ); |
128 | // } else | 128 | // } else |
129 | vCardLine.setValue( output ); | 129 | vCardLine.setValueBytes( output ); |
130 | //PP our vcards are *supposed* to be in UTF-8 | 130 | //PP our vcards are *supposed* to be in UTF-8 |
131 | // } else if ( vCardLine.parameter( "charset" ).lower() == "utf-8" ) { | 131 | // } else if ( vCardLine.parameter( "charset" ).lower() == "utf-8" ) { |
132 | // vCardLine.setValue( QString::fromUtf8( value.ascii() ) ); | 132 | // vCardLine.setValue( QString::fromUtf8( value.ascii() ) ); |
133 | } else | 133 | } else |
134 | vCardLine.setValue( value.replace( QRegExp("\\\\n"), "\n" ) ); | 134 | vCardLine.setValueString( value.replace( QRegExp("\\\\n"), "\n" ) ); |
135 | 135 | ||
136 | currentVCard.addLine( vCardLine ); | 136 | currentVCard.addLine( vCardLine ); |
137 | } | 137 | } |
138 | 138 | ||
139 | // we do not save the start and end tag as vcardline | 139 | // we do not save the start and end tag as vcardline |
140 | if ( (*it).lower().startsWith( "begin:vcard" ) ) { | 140 | if ( (*it).lower().startsWith( "begin:vcard" ) ) { |
141 | inVCard = true; | 141 | inVCard = true; |
142 | currentLine = ""; | 142 | currentLine = ""; |
143 | currentVCard.clear(); // flush vcard | 143 | currentVCard.clear(); // flush vcard |
144 | continue; | 144 | continue; |
145 | } | 145 | } |
146 | 146 | ||
@@ -179,25 +179,25 @@ QString VCardParser::createVCards( const VCard::List& list ) | |||
179 | 179 | ||
180 | // iterate over the cards | 180 | // iterate over the cards |
181 | VCard::List::ConstIterator listEnd( list.end() ); | 181 | VCard::List::ConstIterator listEnd( list.end() ); |
182 | for ( cardIt = list.begin(); cardIt != listEnd; ++cardIt ) { | 182 | for ( cardIt = list.begin(); cardIt != listEnd; ++cardIt ) { |
183 | text.append( "BEGIN:VCARD\r\n" ); | 183 | text.append( "BEGIN:VCARD\r\n" ); |
184 | 184 | ||
185 | idents = (*cardIt).identifiers(); | 185 | idents = (*cardIt).identifiers(); |
186 | for ( identIt = idents.begin(); identIt != idents.end(); ++identIt ) { | 186 | for ( identIt = idents.begin(); identIt != idents.end(); ++identIt ) { |
187 | lines = (*cardIt).lines( (*identIt) ); | 187 | lines = (*cardIt).lines( (*identIt) ); |
188 | 188 | ||
189 | // iterate over the lines | 189 | // iterate over the lines |
190 | for ( lineIt = lines.begin(); lineIt != lines.end(); ++lineIt ) { | 190 | for ( lineIt = lines.begin(); lineIt != lines.end(); ++lineIt ) { |
191 | if ( !(*lineIt).value().asString().isEmpty() ) { | 191 | if ( !(*lineIt).valueString().isEmpty() ) { |
192 | if ( (*lineIt).hasGroup() ) | 192 | if ( (*lineIt).hasGroup() ) |
193 | textLine = (*lineIt).group() + "." + (*lineIt).identifier(); | 193 | textLine = (*lineIt).group() + "." + (*lineIt).identifier(); |
194 | else | 194 | else |
195 | textLine = (*lineIt).identifier(); | 195 | textLine = (*lineIt).identifier(); |
196 | 196 | ||
197 | params = (*lineIt).parameterList(); | 197 | params = (*lineIt).parameterList(); |
198 | hasEncoding = false; | 198 | hasEncoding = false; |
199 | if ( params.count() > 0 ) { // we have parameters | 199 | if ( params.count() > 0 ) { // we have parameters |
200 | for ( paramIt = params.begin(); paramIt != params.end(); ++paramIt ) { | 200 | for ( paramIt = params.begin(); paramIt != params.end(); ++paramIt ) { |
201 | if ( (*paramIt) == "encoding" ) { | 201 | if ( (*paramIt) == "encoding" ) { |
202 | hasEncoding = true; | 202 | hasEncoding = true; |
203 | encodingType = (*lineIt).parameter( "encoding" ).lower(); | 203 | encodingType = (*lineIt).parameter( "encoding" ).lower(); |
@@ -212,25 +212,25 @@ QString VCardParser::createVCards( const VCard::List& list ) | |||
212 | } | 212 | } |
213 | } | 213 | } |
214 | 214 | ||
215 | if ( hasEncoding ) { // have to encode the data | 215 | if ( hasEncoding ) { // have to encode the data |
216 | QByteArray input, output; | 216 | QByteArray input, output; |
217 | input = (*lineIt).valueBytes(); | 217 | input = (*lineIt).valueBytes(); |
218 | if ( encodingType == "b" ) | 218 | if ( encodingType == "b" ) |
219 | KCodecs::base64Encode( input, output ); | 219 | KCodecs::base64Encode( input, output ); |
220 | else if ( encodingType == "quoted-printable" ) | 220 | else if ( encodingType == "quoted-printable" ) |
221 | KCodecs::quotedPrintableEncode( input, output ); | 221 | KCodecs::quotedPrintableEncode( input, output ); |
222 | textLine.append( ":" + QString( output ) ); | 222 | textLine.append( ":" + QString( output ) ); |
223 | } else | 223 | } else |
224 | textLine.append( ":" + (*lineIt).value().asString().replace( QRegExp("\n"), "\\n" ) ); | 224 | textLine.append( ":" + (*lineIt).valueString().replace( QRegExp("\n"), "\\n" ) ); |
225 | 225 | ||
226 | if ( textLine.length() > FOLD_WIDTH ) { // we have to fold the line | 226 | if ( textLine.length() > FOLD_WIDTH ) { // we have to fold the line |
227 | for ( uint i = 0; i <= ( textLine.length() / FOLD_WIDTH ); ++i ) | 227 | for ( uint i = 0; i <= ( textLine.length() / FOLD_WIDTH ); ++i ) |
228 | text.append( ( i == 0 ? "" : " " ) + textLine.mid( i * FOLD_WIDTH, FOLD_WIDTH ) + "\r\n" ); | 228 | text.append( ( i == 0 ? "" : " " ) + textLine.mid( i * FOLD_WIDTH, FOLD_WIDTH ) + "\r\n" ); |
229 | } else | 229 | } else |
230 | text.append( textLine + "\r\n" ); | 230 | text.append( textLine + "\r\n" ); |
231 | } | 231 | } |
232 | } | 232 | } |
233 | } | 233 | } |
234 | 234 | ||
235 | text.append( "END:VCARD\r\n" ); | 235 | text.append( "END:VCARD\r\n" ); |
236 | text.append( "\r\n" ); | 236 | text.append( "\r\n" ); |
diff --git a/kabc/vcardparser/vcardtool.cpp b/kabc/vcardparser/vcardtool.cpp index 0cf72c0..c3d92b6 100644 --- a/kabc/vcardparser/vcardtool.cpp +++ b/kabc/vcardparser/vcardtool.cpp | |||
@@ -358,25 +358,25 @@ Addressee::List VCardTool::parseVCards( const QString& vcard ) | |||
358 | QStringList::ConstIterator identIt; | 358 | QStringList::ConstIterator identIt; |
359 | QStringList::ConstIterator identEnd( idents.end() ); | 359 | QStringList::ConstIterator identEnd( idents.end() ); |
360 | for ( identIt = idents.begin(); identIt != identEnd; ++identIt ) { | 360 | for ( identIt = idents.begin(); identIt != identEnd; ++identIt ) { |
361 | const VCardLine::List lines = (*cardIt).lines( (*identIt) ); | 361 | const VCardLine::List lines = (*cardIt).lines( (*identIt) ); |
362 | VCardLine::List::ConstIterator lineIt; | 362 | VCardLine::List::ConstIterator lineIt; |
363 | 363 | ||
364 | // iterate over the lines | 364 | // iterate over the lines |
365 | for ( lineIt = lines.begin(); lineIt != lines.end(); ++lineIt ) { | 365 | for ( lineIt = lines.begin(); lineIt != lines.end(); ++lineIt ) { |
366 | identifier = (*lineIt).identifier().lower(); | 366 | identifier = (*lineIt).identifier().lower(); |
367 | // ADR | 367 | // ADR |
368 | if ( identifier == "adr" ) { | 368 | if ( identifier == "adr" ) { |
369 | Address address; | 369 | Address address; |
370 | const QStringList addrParts = splitString( semicolonSep, (*lineIt).value().asString() ); | 370 | const QStringList addrParts = splitString( semicolonSep, (*lineIt).valueString() ); |
371 | if ( addrParts.count() > 0 ) | 371 | if ( addrParts.count() > 0 ) |
372 | address.setPostOfficeBox( addrParts[ 0 ] ); | 372 | address.setPostOfficeBox( addrParts[ 0 ] ); |
373 | if ( addrParts.count() > 1 ) | 373 | if ( addrParts.count() > 1 ) |
374 | address.setExtended( addrParts[ 1 ] ); | 374 | address.setExtended( addrParts[ 1 ] ); |
375 | if ( addrParts.count() > 2 ) | 375 | if ( addrParts.count() > 2 ) |
376 | address.setStreet( addrParts[ 2 ] ); | 376 | address.setStreet( addrParts[ 2 ] ); |
377 | if ( addrParts.count() > 3 ) | 377 | if ( addrParts.count() > 3 ) |
378 | address.setLocality( addrParts[ 3 ] ); | 378 | address.setLocality( addrParts[ 3 ] ); |
379 | if ( addrParts.count() > 4 ) | 379 | if ( addrParts.count() > 4 ) |
380 | address.setRegion( addrParts[ 4 ] ); | 380 | address.setRegion( addrParts[ 4 ] ); |
381 | if ( addrParts.count() > 5 ) | 381 | if ( addrParts.count() > 5 ) |
382 | address.setPostalCode( addrParts[ 5 ] ); | 382 | address.setPostalCode( addrParts[ 5 ] ); |
@@ -390,198 +390,198 @@ Addressee::List VCardTool::parseVCards( const QString& vcard ) | |||
390 | type += mAddressTypeMap[ (*it).lower() ]; | 390 | type += mAddressTypeMap[ (*it).lower() ]; |
391 | 391 | ||
392 | address.setType( type ); | 392 | address.setType( type ); |
393 | addr.insertAddress( address ); | 393 | addr.insertAddress( address ); |
394 | } | 394 | } |
395 | 395 | ||
396 | // AGENT | 396 | // AGENT |
397 | else if ( identifier == "agent" ) | 397 | else if ( identifier == "agent" ) |
398 | addr.setAgent( parseAgent( *lineIt ) ); | 398 | addr.setAgent( parseAgent( *lineIt ) ); |
399 | 399 | ||
400 | // BDAY | 400 | // BDAY |
401 | else if ( identifier == "bday" ) | 401 | else if ( identifier == "bday" ) |
402 | addr.setBirthday( parseDateTime( (*lineIt).value().asString() ) ); | 402 | addr.setBirthday( parseDateTime( (*lineIt).valueString() ) ); |
403 | 403 | ||
404 | // CATEGORIES | 404 | // CATEGORIES |
405 | else if ( identifier == "categories" ) { | 405 | else if ( identifier == "categories" ) { |
406 | const QStringList categories = splitString( commaSep, (*lineIt).value().asString() ); | 406 | const QStringList categories = splitString( commaSep, (*lineIt).valueString() ); |
407 | addr.setCategories( categories ); | 407 | addr.setCategories( categories ); |
408 | } | 408 | } |
409 | 409 | ||
410 | // CLASS | 410 | // CLASS |
411 | else if ( identifier == "class" ) | 411 | else if ( identifier == "class" ) |
412 | addr.setSecrecy( parseSecrecy( *lineIt ) ); | 412 | addr.setSecrecy( parseSecrecy( *lineIt ) ); |
413 | 413 | ||
414 | 414 | ||
415 | else if ( identifier == "email" ) { | 415 | else if ( identifier == "email" ) { |
416 | const QStringList types = (*lineIt).parameters( "type" ); | 416 | const QStringList types = (*lineIt).parameters( "type" ); |
417 | addr.insertEmail( (*lineIt).value().asString(), types.findIndex( "PREF" ) != -1 ); | 417 | addr.insertEmail( (*lineIt).valueString(), types.findIndex( "PREF" ) != -1 ); |
418 | } | 418 | } |
419 | 419 | ||
420 | // FN | 420 | // FN |
421 | else if ( identifier == "fn" ) | 421 | else if ( identifier == "fn" ) |
422 | addr.setFormattedName( (*lineIt).value().asString() ); | 422 | addr.setFormattedName( (*lineIt).valueString() ); |
423 | 423 | ||
424 | // GEO | 424 | // GEO |
425 | else if ( identifier == "geo" ) { | 425 | else if ( identifier == "geo" ) { |
426 | Geo geo; | 426 | Geo geo; |
427 | 427 | ||
428 | const QStringList geoParts = QStringList::split( ';', (*lineIt).value().asString(), true ); | 428 | const QStringList geoParts = QStringList::split( ';', (*lineIt).valueString(), true ); |
429 | geo.setLatitude( geoParts[ 0 ].toFloat() ); | 429 | geo.setLatitude( geoParts[ 0 ].toFloat() ); |
430 | geo.setLongitude( geoParts[ 1 ].toFloat() ); | 430 | geo.setLongitude( geoParts[ 1 ].toFloat() ); |
431 | 431 | ||
432 | addr.setGeo( geo ); | 432 | addr.setGeo( geo ); |
433 | } | 433 | } |
434 | 434 | ||
435 | // KEY | 435 | // KEY |
436 | else if ( identifier == "key" ) | 436 | else if ( identifier == "key" ) |
437 | addr.insertKey( parseKey( *lineIt ) ); | 437 | addr.insertKey( parseKey( *lineIt ) ); |
438 | 438 | ||
439 | // LABEL | 439 | // LABEL |
440 | else if ( identifier == "label" ) { | 440 | else if ( identifier == "label" ) { |
441 | int type = 0; | 441 | int type = 0; |
442 | 442 | ||
443 | const QStringList types = (*lineIt).parameters( "type" ); | 443 | const QStringList types = (*lineIt).parameters( "type" ); |
444 | for ( QStringList::ConstIterator it = types.begin(); it != types.end(); ++it ) | 444 | for ( QStringList::ConstIterator it = types.begin(); it != types.end(); ++it ) |
445 | type += mAddressTypeMap[ (*it).lower() ]; | 445 | type += mAddressTypeMap[ (*it).lower() ]; |
446 | 446 | ||
447 | bool available = false; | 447 | bool available = false; |
448 | KABC::Address::List addressList = addr.addresses(); | 448 | KABC::Address::List addressList = addr.addresses(); |
449 | KABC::Address::List::Iterator it; | 449 | KABC::Address::List::Iterator it; |
450 | for ( it = addressList.begin(); it != addressList.end(); ++it ) { | 450 | for ( it = addressList.begin(); it != addressList.end(); ++it ) { |
451 | if ( (*it).type() == type ) { | 451 | if ( (*it).type() == type ) { |
452 | (*it).setLabel( (*lineIt).value().asString() ); | 452 | (*it).setLabel( (*lineIt).valueString() ); |
453 | addr.insertAddress( *it ); | 453 | addr.insertAddress( *it ); |
454 | available = true; | 454 | available = true; |
455 | break; | 455 | break; |
456 | } | 456 | } |
457 | } | 457 | } |
458 | 458 | ||
459 | if ( !available ) { // a standalone LABEL tag | 459 | if ( !available ) { // a standalone LABEL tag |
460 | KABC::Address address( type ); | 460 | KABC::Address address( type ); |
461 | address.setLabel( (*lineIt).value().asString() ); | 461 | address.setLabel( (*lineIt).valueString() ); |
462 | addr.insertAddress( address ); | 462 | addr.insertAddress( address ); |
463 | } | 463 | } |
464 | } | 464 | } |
465 | 465 | ||
466 | // LOGO | 466 | // LOGO |
467 | else if ( identifier == "logo" ) | 467 | else if ( identifier == "logo" ) |
468 | addr.setLogo( parsePicture( *lineIt ) ); | 468 | addr.setLogo( parsePicture( *lineIt ) ); |
469 | 469 | ||
470 | // MAILER | 470 | // MAILER |
471 | else if ( identifier == "mailer" ) | 471 | else if ( identifier == "mailer" ) |
472 | addr.setMailer( (*lineIt).value().asString() ); | 472 | addr.setMailer( (*lineIt).valueString() ); |
473 | 473 | ||
474 | // N | 474 | // N |
475 | else if ( identifier == "n" ) { | 475 | else if ( identifier == "n" ) { |
476 | const QStringList nameParts = splitString( semicolonSep, (*lineIt).value().asString() ); | 476 | const QStringList nameParts = splitString( semicolonSep, (*lineIt).valueString() ); |
477 | if ( nameParts.count() > 0 ) | 477 | if ( nameParts.count() > 0 ) |
478 | addr.setFamilyName( nameParts[ 0 ] ); | 478 | addr.setFamilyName( nameParts[ 0 ] ); |
479 | if ( nameParts.count() > 1 ) | 479 | if ( nameParts.count() > 1 ) |
480 | addr.setGivenName( nameParts[ 1 ] ); | 480 | addr.setGivenName( nameParts[ 1 ] ); |
481 | if ( nameParts.count() > 2 ) | 481 | if ( nameParts.count() > 2 ) |
482 | addr.setAdditionalName( nameParts[ 2 ] ); | 482 | addr.setAdditionalName( nameParts[ 2 ] ); |
483 | if ( nameParts.count() > 3 ) | 483 | if ( nameParts.count() > 3 ) |
484 | addr.setPrefix( nameParts[ 3 ] ); | 484 | addr.setPrefix( nameParts[ 3 ] ); |
485 | if ( nameParts.count() > 4 ) | 485 | if ( nameParts.count() > 4 ) |
486 | addr.setSuffix( nameParts[ 4 ] ); | 486 | addr.setSuffix( nameParts[ 4 ] ); |
487 | } | 487 | } |
488 | 488 | ||
489 | // NAME | 489 | // NAME |
490 | else if ( identifier == "name" ) | 490 | else if ( identifier == "name" ) |
491 | addr.setName( (*lineIt).value().asString() ); | 491 | addr.setName( (*lineIt).valueString() ); |
492 | 492 | ||
493 | // NICKNAME | 493 | // NICKNAME |
494 | else if ( identifier == "nickname" ) | 494 | else if ( identifier == "nickname" ) |
495 | addr.setNickName( (*lineIt).value().asString() ); | 495 | addr.setNickName( (*lineIt).valueString() ); |
496 | 496 | ||
497 | // NOTE | 497 | // NOTE |
498 | else if ( identifier == "note" ) | 498 | else if ( identifier == "note" ) |
499 | addr.setNote( (*lineIt).value().asString() ); | 499 | addr.setNote( (*lineIt).valueString() ); |
500 | 500 | ||
501 | // ORGANIZATION | 501 | // ORGANIZATION |
502 | else if ( identifier == "org" ) | 502 | else if ( identifier == "org" ) |
503 | addr.setOrganization( (*lineIt).value().asString() ); | 503 | addr.setOrganization( (*lineIt).valueString() ); |
504 | 504 | ||
505 | // PHOTO | 505 | // PHOTO |
506 | else if ( identifier == "photo" ) | 506 | else if ( identifier == "photo" ) |
507 | addr.setPhoto( parsePicture( *lineIt ) ); | 507 | addr.setPhoto( parsePicture( *lineIt ) ); |
508 | 508 | ||
509 | // PROID | 509 | // PROID |
510 | else if ( identifier == "prodid" ) | 510 | else if ( identifier == "prodid" ) |
511 | addr.setProductId( (*lineIt).value().asString() ); | 511 | addr.setProductId( (*lineIt).valueString() ); |
512 | 512 | ||
513 | // REV | 513 | // REV |
514 | else if ( identifier == "rev" ) | 514 | else if ( identifier == "rev" ) |
515 | addr.setRevision( parseDateTime( (*lineIt).value().asString() ) ); | 515 | addr.setRevision( parseDateTime( (*lineIt).valueString() ) ); |
516 | 516 | ||
517 | // ROLE | 517 | // ROLE |
518 | else if ( identifier == "role" ) | 518 | else if ( identifier == "role" ) |
519 | addr.setRole( (*lineIt).value().asString() ); | 519 | addr.setRole( (*lineIt).valueString() ); |
520 | 520 | ||
521 | // SORT-STRING | 521 | // SORT-STRING |
522 | else if ( identifier == "sort-string" ) | 522 | else if ( identifier == "sort-string" ) |
523 | addr.setSortString( (*lineIt).value().asString() ); | 523 | addr.setSortString( (*lineIt).valueString() ); |
524 | 524 | ||
525 | // SOUND | 525 | // SOUND |
526 | else if ( identifier == "sound" ) | 526 | else if ( identifier == "sound" ) |
527 | addr.setSound( parseSound( *lineIt ) ); | 527 | addr.setSound( parseSound( *lineIt ) ); |
528 | 528 | ||
529 | // TEL | 529 | // TEL |
530 | else if ( identifier == "tel" ) { | 530 | else if ( identifier == "tel" ) { |
531 | PhoneNumber phone; | 531 | PhoneNumber phone; |
532 | phone.setNumber( (*lineIt).value().asString() ); | 532 | phone.setNumber( (*lineIt).valueString() ); |
533 | 533 | ||
534 | int type = 0; | 534 | int type = 0; |
535 | 535 | ||
536 | const QStringList types = (*lineIt).parameters( "type" ); | 536 | const QStringList types = (*lineIt).parameters( "type" ); |
537 | for ( QStringList::ConstIterator it = types.begin(); it != types.end(); ++it ) | 537 | for ( QStringList::ConstIterator it = types.begin(); it != types.end(); ++it ) |
538 | type += mPhoneTypeMap[(*it).upper()]; | 538 | type += mPhoneTypeMap[(*it).upper()]; |
539 | 539 | ||
540 | phone.setType( type ); | 540 | phone.setType( type ); |
541 | 541 | ||
542 | addr.insertPhoneNumber( phone ); | 542 | addr.insertPhoneNumber( phone ); |
543 | } | 543 | } |
544 | 544 | ||
545 | // TITLE | 545 | // TITLE |
546 | else if ( identifier == "title" ) | 546 | else if ( identifier == "title" ) |
547 | addr.setTitle( (*lineIt).value().asString() ); | 547 | addr.setTitle( (*lineIt).valueString() ); |
548 | 548 | ||
549 | // TZ | 549 | // TZ |
550 | else if ( identifier == "tz" ) { | 550 | else if ( identifier == "tz" ) { |
551 | TimeZone tz; | 551 | TimeZone tz; |
552 | const QString date = (*lineIt).value().asString(); | 552 | const QString date = (*lineIt).valueString(); |
553 | 553 | ||
554 | int hours = date.mid( 1, 2).toInt(); | 554 | int hours = date.mid( 1, 2).toInt(); |
555 | int minutes = date.mid( 4, 2 ).toInt(); | 555 | int minutes = date.mid( 4, 2 ).toInt(); |
556 | int offset = ( hours * 60 ) + minutes; | 556 | int offset = ( hours * 60 ) + minutes; |
557 | offset = offset * ( date[ 0 ] == '+' ? 1 : -1 ); | 557 | offset = offset * ( date[ 0 ] == '+' ? 1 : -1 ); |
558 | 558 | ||
559 | tz.setOffset( offset ); | 559 | tz.setOffset( offset ); |
560 | addr.setTimeZone( tz ); | 560 | addr.setTimeZone( tz ); |
561 | } | 561 | } |
562 | 562 | ||
563 | // UID | 563 | // UID |
564 | else if ( identifier == "uid" ) | 564 | else if ( identifier == "uid" ) |
565 | addr.setUid( (*lineIt).value().asString() ); | 565 | addr.setUid( (*lineIt).valueString() ); |
566 | 566 | ||
567 | // URL | 567 | // URL |
568 | else if ( identifier == "url" ) | 568 | else if ( identifier == "url" ) |
569 | addr.setUrl( KURL( (*lineIt).value().asString() ) ); | 569 | addr.setUrl( KURL( (*lineIt).valueString() ) ); |
570 | 570 | ||
571 | // X- | 571 | // X- |
572 | else if ( identifier.startsWith( "x-" ) ) { | 572 | else if ( identifier.startsWith( "x-" ) ) { |
573 | const QString key = (*lineIt).identifier().mid( 2 ); | 573 | const QString key = (*lineIt).identifier().mid( 2 ); |
574 | int dash = key.find( "-" ); | 574 | int dash = key.find( "-" ); |
575 | addr.insertCustom( key.left( dash ), key.mid( dash + 1 ), (*lineIt).value().asString() ); | 575 | addr.insertCustom( key.left( dash ), key.mid( dash + 1 ), (*lineIt).valueString() ); |
576 | } | 576 | } |
577 | } | 577 | } |
578 | } | 578 | } |
579 | 579 | ||
580 | addrList.append( addr ); | 580 | addrList.append( addr ); |
581 | } | 581 | } |
582 | 582 | ||
583 | return addrList; | 583 | return addrList; |
584 | } | 584 | } |
585 | 585 | ||
586 | QDateTime VCardTool::parseDateTime( const QString &str ) | 586 | QDateTime VCardTool::parseDateTime( const QString &str ) |
587 | { | 587 | { |
@@ -627,180 +627,180 @@ QString VCardTool::createDateTime( const QDateTime &dateTime ) | |||
627 | 627 | ||
628 | Picture VCardTool::parsePicture( const VCardLine &line ) | 628 | Picture VCardTool::parsePicture( const VCardLine &line ) |
629 | { | 629 | { |
630 | Picture pic; | 630 | Picture pic; |
631 | 631 | ||
632 | const QStringList params = line.parameterList(); | 632 | const QStringList params = line.parameterList(); |
633 | if ( params.findIndex( "encoding" ) != -1 ) { | 633 | if ( params.findIndex( "encoding" ) != -1 ) { |
634 | QImage img; | 634 | QImage img; |
635 | img.loadFromData( line.valueBytes() ); | 635 | img.loadFromData( line.valueBytes() ); |
636 | pic.setData( img ); | 636 | pic.setData( img ); |
637 | } else if ( params.findIndex( "value" ) != -1 ) { | 637 | } else if ( params.findIndex( "value" ) != -1 ) { |
638 | if ( line.parameter( "value" ).lower() == "uri" ) | 638 | if ( line.parameter( "value" ).lower() == "uri" ) |
639 | pic.setUrl( line.value().asString() ); | 639 | pic.setUrl( line.valueString() ); |
640 | } | 640 | } |
641 | 641 | ||
642 | if ( params.findIndex( "type" ) != -1 ) | 642 | if ( params.findIndex( "type" ) != -1 ) |
643 | pic.setType( line.parameter( "type" ) ); | 643 | pic.setType( line.parameter( "type" ) ); |
644 | 644 | ||
645 | return pic; | 645 | return pic; |
646 | } | 646 | } |
647 | 647 | ||
648 | VCardLine VCardTool::createPicture( const QString &identifier, const Picture &pic ) | 648 | VCardLine VCardTool::createPicture( const QString &identifier, const Picture &pic ) |
649 | { | 649 | { |
650 | VCardLine line( identifier ); | 650 | VCardLine line( identifier ); |
651 | 651 | ||
652 | if ( pic.isIntern() ) { | 652 | if ( pic.isIntern() ) { |
653 | if ( !pic.data().isNull() ) { | 653 | if ( !pic.data().isNull() ) { |
654 | QByteArray input; | 654 | QByteArray input; |
655 | QDataStream s( input, IO_WriteOnly ); | 655 | QDataStream s( input, IO_WriteOnly ); |
656 | s.setVersion( 4 ); | 656 | s.setVersion( 4 ); |
657 | s << pic.data(); | 657 | s << pic.data(); |
658 | line.setValue( input ); | 658 | line.setValueBytes( input ); |
659 | line.addParameter( "encoding", "b" ); | 659 | line.addParameter( "encoding", "b" ); |
660 | line.addParameter( "type", "image/png" ); | 660 | line.addParameter( "type", "image/png" ); |
661 | } | 661 | } |
662 | } else if ( !pic.url().isEmpty() ) { | 662 | } else if ( !pic.url().isEmpty() ) { |
663 | QByteArray ba; | 663 | QByteArray ba; |
664 | line.setValue( pic.url() ); | 664 | line.setValueString( pic.url() ); |
665 | line.addParameter( "value", "URI" ); | 665 | line.addParameter( "value", "URI" ); |
666 | } | 666 | } |
667 | 667 | ||
668 | return line; | 668 | return line; |
669 | } | 669 | } |
670 | 670 | ||
671 | Sound VCardTool::parseSound( const VCardLine &line ) | 671 | Sound VCardTool::parseSound( const VCardLine &line ) |
672 | { | 672 | { |
673 | Sound snd; | 673 | Sound snd; |
674 | 674 | ||
675 | const QStringList params = line.parameterList(); | 675 | const QStringList params = line.parameterList(); |
676 | if ( params.findIndex( "encoding" ) != -1 ) | 676 | if ( params.findIndex( "encoding" ) != -1 ) |
677 | snd.setData( line.valueBytes() ); | 677 | snd.setData( line.valueBytes() ); |
678 | else if ( params.findIndex( "value" ) != -1 ) { | 678 | else if ( params.findIndex( "value" ) != -1 ) { |
679 | if ( line.parameter( "value" ).lower() == "uri" ) | 679 | if ( line.parameter( "value" ).lower() == "uri" ) |
680 | snd.setUrl( line.value().asString() ); | 680 | snd.setUrl( line.valueString() ); |
681 | } | 681 | } |
682 | 682 | ||
683 | /* TODO: support sound types | 683 | /* TODO: support sound types |
684 | if ( params.contains( "type" ) ) | 684 | if ( params.contains( "type" ) ) |
685 | snd.setType( line.parameter( "type" ) ); | 685 | snd.setType( line.parameter( "type" ) ); |
686 | */ | 686 | */ |
687 | 687 | ||
688 | return snd; | 688 | return snd; |
689 | } | 689 | } |
690 | 690 | ||
691 | VCardLine VCardTool::createSound( const Sound &snd ) | 691 | VCardLine VCardTool::createSound( const Sound &snd ) |
692 | { | 692 | { |
693 | VCardLine line( "SOUND" ); | 693 | VCardLine line( "SOUND" ); |
694 | 694 | ||
695 | if ( snd.isIntern() ) { | 695 | if ( snd.isIntern() ) { |
696 | if ( !snd.data().isEmpty() ) { | 696 | if ( !snd.data().isEmpty() ) { |
697 | line.setValue( snd.data() ); | 697 | line.setValueBytes( snd.data() ); |
698 | line.addParameter( "encoding", "b" ); | 698 | line.addParameter( "encoding", "b" ); |
699 | // TODO: need to store sound type!!! | 699 | // TODO: need to store sound type!!! |
700 | } | 700 | } |
701 | } else if ( !snd.url().isEmpty() ) { | 701 | } else if ( !snd.url().isEmpty() ) { |
702 | line.setValue( snd.url() ); | 702 | line.setValueString( snd.url() ); |
703 | line.addParameter( "value", "URI" ); | 703 | line.addParameter( "value", "URI" ); |
704 | } | 704 | } |
705 | 705 | ||
706 | return line; | 706 | return line; |
707 | } | 707 | } |
708 | 708 | ||
709 | Key VCardTool::parseKey( const VCardLine &line ) | 709 | Key VCardTool::parseKey( const VCardLine &line ) |
710 | { | 710 | { |
711 | Key key; | 711 | Key key; |
712 | 712 | ||
713 | const QStringList params = line.parameterList(); | 713 | const QStringList params = line.parameterList(); |
714 | if ( params.findIndex( "encoding" ) != -1 ) | 714 | if ( params.findIndex( "encoding" ) != -1 ) |
715 | key.setBinaryData( line.valueBytes() ); | 715 | key.setBinaryData( line.valueBytes() ); |
716 | else | 716 | else |
717 | key.setTextData( line.value().asString() ); | 717 | key.setTextData( line.valueString() ); |
718 | 718 | ||
719 | if ( params.findIndex( "type" ) != -1 ) { | 719 | if ( params.findIndex( "type" ) != -1 ) { |
720 | if ( line.parameter( "type" ).lower() == "x509" ) | 720 | if ( line.parameter( "type" ).lower() == "x509" ) |
721 | key.setType( Key::X509 ); | 721 | key.setType( Key::X509 ); |
722 | else if ( line.parameter( "type" ).lower() == "pgp" ) | 722 | else if ( line.parameter( "type" ).lower() == "pgp" ) |
723 | key.setType( Key::PGP ); | 723 | key.setType( Key::PGP ); |
724 | else { | 724 | else { |
725 | key.setType( Key::Custom ); | 725 | key.setType( Key::Custom ); |
726 | key.setCustomTypeString( line.parameter( "type" ) ); | 726 | key.setCustomTypeString( line.parameter( "type" ) ); |
727 | } | 727 | } |
728 | } | 728 | } |
729 | 729 | ||
730 | return key; | 730 | return key; |
731 | } | 731 | } |
732 | 732 | ||
733 | VCardLine VCardTool::createKey( const Key &key ) | 733 | VCardLine VCardTool::createKey( const Key &key ) |
734 | { | 734 | { |
735 | VCardLine line( "KEY" ); | 735 | VCardLine line( "KEY" ); |
736 | 736 | ||
737 | if ( key.isBinary() ) { | 737 | if ( key.isBinary() ) { |
738 | if ( !key.binaryData().isEmpty() ) { | 738 | if ( !key.binaryData().isEmpty() ) { |
739 | line.setValue( key.binaryData() ); | 739 | line.setValueBytes( key.binaryData() ); |
740 | line.addParameter( "encoding", "b" ); | 740 | line.addParameter( "encoding", "b" ); |
741 | } | 741 | } |
742 | } else if ( !key.textData().isEmpty() ) | 742 | } else if ( !key.textData().isEmpty() ) |
743 | line.setValue( key.textData() ); | 743 | line.setValueString( key.textData() ); |
744 | 744 | ||
745 | if ( key.type() == Key::X509 ) | 745 | if ( key.type() == Key::X509 ) |
746 | line.addParameter( "type", "X509" ); | 746 | line.addParameter( "type", "X509" ); |
747 | else if ( key.type() == Key::PGP ) | 747 | else if ( key.type() == Key::PGP ) |
748 | line.addParameter( "type", "PGP" ); | 748 | line.addParameter( "type", "PGP" ); |
749 | else if ( key.type() == Key::Custom ) | 749 | else if ( key.type() == Key::Custom ) |
750 | line.addParameter( "type", key.customTypeString() ); | 750 | line.addParameter( "type", key.customTypeString() ); |
751 | 751 | ||
752 | return line; | 752 | return line; |
753 | } | 753 | } |
754 | 754 | ||
755 | Secrecy VCardTool::parseSecrecy( const VCardLine &line ) | 755 | Secrecy VCardTool::parseSecrecy( const VCardLine &line ) |
756 | { | 756 | { |
757 | Secrecy secrecy; | 757 | Secrecy secrecy; |
758 | 758 | ||
759 | if ( line.value().asString().lower() == "public" ) | 759 | if ( line.valueString().lower() == "public" ) |
760 | secrecy.setType( Secrecy::Public ); | 760 | secrecy.setType( Secrecy::Public ); |
761 | if ( line.value().asString().lower() == "private" ) | 761 | if ( line.valueString().lower() == "private" ) |
762 | secrecy.setType( Secrecy::Private ); | 762 | secrecy.setType( Secrecy::Private ); |
763 | if ( line.value().asString().lower() == "confidential" ) | 763 | if ( line.valueString().lower() == "confidential" ) |
764 | secrecy.setType( Secrecy::Confidential ); | 764 | secrecy.setType( Secrecy::Confidential ); |
765 | 765 | ||
766 | return secrecy; | 766 | return secrecy; |
767 | } | 767 | } |
768 | 768 | ||
769 | VCardLine VCardTool::createSecrecy( const Secrecy &secrecy ) | 769 | VCardLine VCardTool::createSecrecy( const Secrecy &secrecy ) |
770 | { | 770 | { |
771 | VCardLine line( "CLASS" ); | 771 | VCardLine line( "CLASS" ); |
772 | 772 | ||
773 | int type = secrecy.type(); | 773 | int type = secrecy.type(); |
774 | 774 | ||
775 | if ( type == Secrecy::Public ) | 775 | if ( type == Secrecy::Public ) |
776 | line.setValue( "PUBLIC" ); | 776 | line.setValueString( "PUBLIC" ); |
777 | else if ( type == Secrecy::Private ) | 777 | else if ( type == Secrecy::Private ) |
778 | line.setValue( "PRIVATE" ); | 778 | line.setValueString( "PRIVATE" ); |
779 | else if ( type == Secrecy::Confidential ) | 779 | else if ( type == Secrecy::Confidential ) |
780 | line.setValue( "CONFIDENTIAL" ); | 780 | line.setValueString( "CONFIDENTIAL" ); |
781 | 781 | ||
782 | return line; | 782 | return line; |
783 | } | 783 | } |
784 | 784 | ||
785 | Agent VCardTool::parseAgent( const VCardLine &line ) | 785 | Agent VCardTool::parseAgent( const VCardLine &line ) |
786 | { | 786 | { |
787 | Agent agent; | 787 | Agent agent; |
788 | 788 | ||
789 | const QStringList params = line.parameterList(); | 789 | const QStringList params = line.parameterList(); |
790 | if ( params.findIndex( "value" ) != -1 ) { | 790 | if ( params.findIndex( "value" ) != -1 ) { |
791 | if ( line.parameter( "value" ).lower() == "uri" ) | 791 | if ( line.parameter( "value" ).lower() == "uri" ) |
792 | agent.setUrl( line.value().asString() ); | 792 | agent.setUrl( line.valueString() ); |
793 | } else { | 793 | } else { |
794 | QString str = line.value().asString(); | 794 | QString str = line.valueString(); |
795 | str.replace( QRegExp("\\\\n"), "\r\n" ); | 795 | str.replace( QRegExp("\\\\n"), "\r\n" ); |
796 | str.replace( QRegExp("\\\\N"), "\r\n" ); | 796 | str.replace( QRegExp("\\\\N"), "\r\n" ); |
797 | str.replace( QRegExp("\\\\;"), ";" ); | 797 | str.replace( QRegExp("\\\\;"), ";" ); |
798 | str.replace( QRegExp("\\\\:"), ":" ); | 798 | str.replace( QRegExp("\\\\:"), ":" ); |
799 | str.replace( QRegExp("\\\\,"), "," ); | 799 | str.replace( QRegExp("\\\\,"), "," ); |
800 | 800 | ||
801 | const Addressee::List list = parseVCards( str ); | 801 | const Addressee::List list = parseVCards( str ); |
802 | if ( list.count() > 0 ) { | 802 | if ( list.count() > 0 ) { |
803 | Addressee *addr = new Addressee; | 803 | Addressee *addr = new Addressee; |
804 | *addr = list[ 0 ]; | 804 | *addr = list[ 0 ]; |
805 | agent.setAddressee( addr ); | 805 | agent.setAddressee( addr ); |
806 | } | 806 | } |
@@ -814,28 +814,28 @@ VCardLine VCardTool::createAgent( VCard::Version version, const Agent &agent ) | |||
814 | VCardLine line( "AGENT" ); | 814 | VCardLine line( "AGENT" ); |
815 | 815 | ||
816 | if ( agent.isIntern() ) { | 816 | if ( agent.isIntern() ) { |
817 | if ( agent.addressee() != 0 ) { | 817 | if ( agent.addressee() != 0 ) { |
818 | Addressee::List list; | 818 | Addressee::List list; |
819 | list.append( *agent.addressee() ); | 819 | list.append( *agent.addressee() ); |
820 | 820 | ||
821 | QString str = createVCards( list, version ); | 821 | QString str = createVCards( list, version ); |
822 | str.replace( QRegExp("\\r\\n"), "\\n" ); | 822 | str.replace( QRegExp("\\r\\n"), "\\n" ); |
823 | str.replace( QRegExp(";"), "\\;" ); | 823 | str.replace( QRegExp(";"), "\\;" ); |
824 | str.replace( QRegExp(":"), "\\:" ); | 824 | str.replace( QRegExp(":"), "\\:" ); |
825 | str.replace( QRegExp(","), "\\," ); | 825 | str.replace( QRegExp(","), "\\," ); |
826 | line.setValue( str ); | 826 | line.setValueString( str ); |
827 | } | 827 | } |
828 | } else if ( !agent.url().isEmpty() ) { | 828 | } else if ( !agent.url().isEmpty() ) { |
829 | line.setValue( agent.url() ); | 829 | line.setValueString( agent.url() ); |
830 | line.addParameter( "value", "URI" ); | 830 | line.addParameter( "value", "URI" ); |
831 | } | 831 | } |
832 | 832 | ||
833 | return line; | 833 | return line; |
834 | } | 834 | } |
835 | 835 | ||
836 | QStringList VCardTool::splitString( const QChar &sep, const QString &str ) | 836 | QStringList VCardTool::splitString( const QChar &sep, const QString &str ) |
837 | { | 837 | { |
838 | QStringList list; | 838 | QStringList list; |
839 | QString value( str ); | 839 | QString value( str ); |
840 | 840 | ||
841 | int start = 0; | 841 | int start = 0; |
diff --git a/kaddressbook/views/cardview.cpp b/kaddressbook/views/cardview.cpp index 84d3116..b6e053f 100644 --- a/kaddressbook/views/cardview.cpp +++ b/kaddressbook/views/cardview.cpp | |||
@@ -927,42 +927,41 @@ CardViewItem *CardView::findItem(const QString &text, const QString &label, | |||
927 | */ | 927 | */ |
928 | 928 | ||
929 | uint CardView::columnWidth() | 929 | uint CardView::columnWidth() |
930 | { | 930 | { |
931 | return d->mDrawSeparators ? | 931 | return d->mDrawSeparators ? |
932 | d->mItemWidth + ( 2 * d->mItemSpacing ) + d->mSepWidth : | 932 | d->mItemWidth + ( 2 * d->mItemSpacing ) + d->mSepWidth : |
933 | d->mItemWidth + d->mItemSpacing; | 933 | d->mItemWidth + d->mItemSpacing; |
934 | } | 934 | } |
935 | 935 | ||
936 | void CardView::drawContents(QPainter *p, int clipx, int clipy, | 936 | void CardView::drawContents(QPainter *p, int clipx, int clipy, |
937 | int clipw, int cliph) | 937 | int clipw, int cliph) |
938 | { | 938 | { |
939 | QScrollView::drawContents(p, clipx, clipy, clipw, cliph); | 939 | //QScrollView::drawContents(p, clipx, clipy, clipw, cliph); |
940 | |||
941 | if (d->mLayoutDirty) | 940 | if (d->mLayoutDirty) |
942 | calcLayout(); | 941 | calcLayout(); |
943 | 942 | ||
944 | //kdDebug() << "CardView::drawContents: " << clipx << ", " << clipy | 943 | //kdDebug() << "CardView::drawContents: " << clipx << ", " << clipy |
945 | // << ", " << clipw << ", " << cliph << endl; | 944 | // << ", " << clipw << ", " << cliph << endl; |
946 | 945 | ||
947 | QColorGroup cg = viewport()->palette().active(); // allow setting costum colors in the viewport pale | 946 | QColorGroup cg = viewport()->palette().active(); // allow setting costum colors in the viewport pale |
948 | 947 | int cX, cY; | |
948 | contentsToViewport ( clipx, clipy, cX, cY ); | ||
949 | QRect clipRect(clipx, clipy, clipw, cliph); | 949 | QRect clipRect(clipx, clipy, clipw, cliph); |
950 | QRect cardRect; | 950 | QRect cardRect; |
951 | QRect sepRect; | 951 | QRect sepRect; |
952 | CardViewItem *item; | 952 | CardViewItem *item; |
953 | CardViewSeparator *sep; | 953 | CardViewSeparator *sep; |
954 | |||
955 | // make sure the viewport is a pure background | 954 | // make sure the viewport is a pure background |
956 | viewport()->erase(clipRect); | 955 | viewport()->erase( QRect ( cX, cY , clipw, cliph ) ); |
957 | 956 | ||
958 | // Now tell the cards to draw, if they are in the clip region | 957 | // Now tell the cards to draw, if they are in the clip region |
959 | QPtrListIterator<CardViewItem> iter(d->mItemList); | 958 | QPtrListIterator<CardViewItem> iter(d->mItemList); |
960 | for (iter.toFirst(); iter.current(); ++iter) | 959 | for (iter.toFirst(); iter.current(); ++iter) |
961 | { | 960 | { |
962 | item = *iter; | 961 | item = *iter; |
963 | cardRect.setRect( item->d->x, item->d->y, d->mItemWidth, item->height() ); | 962 | cardRect.setRect( item->d->x, item->d->y, d->mItemWidth, item->height() ); |
964 | 963 | ||
965 | if (clipRect.intersects(cardRect) || clipRect.contains(cardRect)) | 964 | if (clipRect.intersects(cardRect) || clipRect.contains(cardRect)) |
966 | { | 965 | { |
967 | //kdDebug() << "\trepainting card at: " << cardRect.x() << ", " | 966 | //kdDebug() << "\trepainting card at: " << cardRect.x() << ", " |
968 | // << cardRect.y() << endl; | 967 | // << cardRect.y() << endl; |