author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kabc/vcardparser/vcardparser.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
Diffstat (limited to 'kabc/vcardparser/vcardparser.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kabc/vcardparser/vcardparser.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kabc/vcardparser/vcardparser.cpp b/kabc/vcardparser/vcardparser.cpp index 11622a0..a319531 100644 --- a/kabc/vcardparser/vcardparser.cpp +++ b/kabc/vcardparser/vcardparser.cpp | |||
@@ -189,52 +189,52 @@ QString VCardParser::createVCards( const VCard::List& list ) | |||
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).valueString().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(); |
204 | } | 204 | } |
205 | 205 | ||
206 | values = (*lineIt).parameters( *paramIt ); | 206 | values = (*lineIt).parameters( *paramIt ); |
207 | for ( valueIt = values.begin(); valueIt != values.end(); ++valueIt ) { | 207 | for ( valueIt = values.begin(); valueIt != values.end(); ++valueIt ) { |
208 | textLine.append( ";" + (*paramIt).upper() ); | 208 | textLine.append( ";" + (*paramIt).upper() ); |
209 | if ( !(*valueIt).isEmpty() ) | 209 | if ( !(*valueIt).isEmpty() ) |
210 | textLine.append( "=" + (*valueIt) ); | 210 | textLine.append( "=" + (*valueIt) ); |
211 | } | 211 | } |
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, true ); |
222 | textLine.append( ":" + QString( output ) ); | 222 | textLine.append( ":" + QString( output ) ); |
223 | } else | 223 | } else |
224 | textLine.append( ":" + (*lineIt).valueString().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" ); |
237 | } | 237 | } |
238 | 238 | ||
239 | return text; | 239 | return text; |
240 | } | 240 | } |