Diffstat (limited to 'kmicromail/libmailwrapper/mailtypes.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kmicromail/libmailwrapper/mailtypes.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/kmicromail/libmailwrapper/mailtypes.cpp b/kmicromail/libmailwrapper/mailtypes.cpp index 70a0ab5..84ccf9f 100644 --- a/kmicromail/libmailwrapper/mailtypes.cpp +++ b/kmicromail/libmailwrapper/mailtypes.cpp | |||
@@ -1,69 +1,71 @@ | |||
1 | #include "mailtypes.h" | 1 | #include "mailtypes.h" |
2 | 2 | ||
3 | //#include <opie2/odebug.h> | 3 | //#include <opie2/odebug.h> |
4 | 4 | ||
5 | #include <stdlib.h> | 5 | #include <stdlib.h> |
6 | //Added by qt3to4: | ||
7 | #include <Q3ValueList> | ||
6 | 8 | ||
7 | using namespace Opie::Core; | 9 | using namespace Opie::Core; |
8 | RecMail::RecMail() | 10 | RecMail::RecMail() |
9 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) | 11 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) |
10 | { | 12 | { |
11 | init(); | 13 | init(); |
12 | } | 14 | } |
13 | 15 | ||
14 | RecMail::RecMail(const RecMail&old) | 16 | RecMail::RecMail(const RecMail&old) |
15 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) | 17 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) |
16 | { | 18 | { |
17 | init(); | 19 | init(); |
18 | copy_old(old); | 20 | copy_old(old); |
19 | // odebug << "Copy constructor RecMail" << oendl; | 21 | // odebug << "Copy constructor RecMail" << oendl; |
20 | } | 22 | } |
21 | 23 | ||
22 | RecMail::~RecMail() | 24 | RecMail::~RecMail() |
23 | { | 25 | { |
24 | wrapper = 0; | 26 | wrapper = 0; |
25 | } | 27 | } |
26 | static bool stringCompareRec( const QString& s1, const QString& s2 ) | 28 | static bool stringCompareRec( const QString& s1, const QString& s2 ) |
27 | { | 29 | { |
28 | if ( s1.isEmpty() && s2.isEmpty() ) | 30 | if ( s1.isEmpty() && s2.isEmpty() ) |
29 | return true; | 31 | return true; |
30 | return s1 == s2; | 32 | return s1 == s2; |
31 | } | 33 | } |
32 | #if 0 | 34 | #if 0 |
33 | QString RecMail::MsgsizeString() const | 35 | QString RecMail::MsgsizeString() const |
34 | { | 36 | { |
35 | 37 | ||
36 | double s = msg_size; | 38 | double s = msg_size; |
37 | int w = 0; | 39 | int w = 0; |
38 | s/=1024; | 40 | s/=1024; |
39 | if (s>999.0) { | 41 | if (s>999.0) { |
40 | s/=1024.0; | 42 | s/=1024.0; |
41 | ++w; | 43 | ++w; |
42 | } | 44 | } |
43 | QString fsize = QString::number( s, 'f', 2 ); | 45 | QString fsize = QString::number( s, 'f', 2 ); |
44 | if ( w == 0 ) { | 46 | if ( w == 0 ) { |
45 | fsize += "kB" ; | 47 | fsize += "kB" ; |
46 | } else | 48 | } else |
47 | fsize += "MB" ; | 49 | fsize += "MB" ; |
48 | return fsize; | 50 | return fsize; |
49 | } | 51 | } |
50 | #endif | 52 | #endif |
51 | bool RecMail::isEqual( RecMail* r1 ) | 53 | bool RecMail::isEqual( RecMail* r1 ) |
52 | { | 54 | { |
53 | if ( !stringCompareRec( isodate, r1->isodate ) ) { | 55 | if ( !stringCompareRec( isodate, r1->isodate ) ) { |
54 | //qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1()); | 56 | //qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1()); |
55 | return false; | 57 | return false; |
56 | } | 58 | } |
57 | if ( !stringCompareRec( subject.left(40), r1->subject.left(40) ) ) { | 59 | if ( !stringCompareRec( subject.left(40), r1->subject.left(40) ) ) { |
58 | //qDebug("sub *%s* *%s*", subject.latin1(), r1->subject.latin1()); | 60 | //qDebug("sub *%s* *%s*", subject.latin1(), r1->subject.latin1()); |
59 | return false; | 61 | return false; |
60 | } | 62 | } |
61 | 63 | ||
62 | //qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1()); | 64 | //qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1()); |
63 | if ( !stringCompareRec( from.left(40), r1->from.left(40)) ) { | 65 | if ( !stringCompareRec( from.left(40), r1->from.left(40)) ) { |
64 | if ( r1->from.find ( from ) < 0 ) { | 66 | if ( r1->from.find ( from ) < 0 ) { |
65 | if ( !stringCompareRec( from.simplifyWhiteSpace ().left(40), r1->from.simplifyWhiteSpace ().left(40)) ) { | 67 | if ( !stringCompareRec( from.simplifyWhiteSpace ().left(40), r1->from.simplifyWhiteSpace ().left(40)) ) { |
66 | //qDebug("from *%s* *%s* ", from.left(40).latin1(), r1->from.left(20).latin1()); | 68 | //qDebug("from *%s* *%s* ", from.left(40).latin1(), r1->from.left(20).latin1()); |
67 | return false; | 69 | return false; |
68 | } | 70 | } |
69 | } | 71 | } |
@@ -222,175 +224,175 @@ const QString& RecPart::Subtype()const | |||
222 | { | 224 | { |
223 | return m_subtype; | 225 | return m_subtype; |
224 | } | 226 | } |
225 | 227 | ||
226 | void RecPart::setSubtype(const QString&subtype) | 228 | void RecPart::setSubtype(const QString&subtype) |
227 | { | 229 | { |
228 | m_subtype = subtype; | 230 | m_subtype = subtype; |
229 | } | 231 | } |
230 | 232 | ||
231 | const QString& RecPart::Identifier()const | 233 | const QString& RecPart::Identifier()const |
232 | { | 234 | { |
233 | return m_identifier; | 235 | return m_identifier; |
234 | } | 236 | } |
235 | 237 | ||
236 | void RecPart::setIdentifier(const QString&identifier) | 238 | void RecPart::setIdentifier(const QString&identifier) |
237 | { | 239 | { |
238 | m_identifier = identifier; | 240 | m_identifier = identifier; |
239 | } | 241 | } |
240 | 242 | ||
241 | const QString& RecPart::Encoding()const | 243 | const QString& RecPart::Encoding()const |
242 | { | 244 | { |
243 | return m_encoding; | 245 | return m_encoding; |
244 | } | 246 | } |
245 | 247 | ||
246 | void RecPart::setEncoding(const QString&encoding) | 248 | void RecPart::setEncoding(const QString&encoding) |
247 | { | 249 | { |
248 | m_encoding = encoding; | 250 | m_encoding = encoding; |
249 | } | 251 | } |
250 | 252 | ||
251 | const QString& RecPart::Description()const | 253 | const QString& RecPart::Description()const |
252 | { | 254 | { |
253 | return m_description; | 255 | return m_description; |
254 | } | 256 | } |
255 | 257 | ||
256 | void RecPart::setDescription(const QString&desc) | 258 | void RecPart::setDescription(const QString&desc) |
257 | { | 259 | { |
258 | m_description = desc; | 260 | m_description = desc; |
259 | } | 261 | } |
260 | 262 | ||
261 | void RecPart::setParameters(const part_plist_t&list) | 263 | void RecPart::setParameters(const part_plist_t&list) |
262 | { | 264 | { |
263 | m_Parameters = list; | 265 | m_Parameters = list; |
264 | } | 266 | } |
265 | 267 | ||
266 | const part_plist_t& RecPart::Parameters()const | 268 | const part_plist_t& RecPart::Parameters()const |
267 | { | 269 | { |
268 | return m_Parameters; | 270 | return m_Parameters; |
269 | } | 271 | } |
270 | 272 | ||
271 | void RecPart::addParameter(const QString&key,const QString&value) | 273 | void RecPart::addParameter(const QString&key,const QString&value) |
272 | { | 274 | { |
273 | m_Parameters[key]=value; | 275 | m_Parameters[key]=value; |
274 | } | 276 | } |
275 | 277 | ||
276 | const QString RecPart::searchParamter(const QString&key)const | 278 | const QString RecPart::searchParamter(const QString&key)const |
277 | { | 279 | { |
278 | QString value(""); | 280 | QString value(""); |
279 | part_plist_t::ConstIterator it = m_Parameters.find(key); | 281 | part_plist_t::ConstIterator it = m_Parameters.find(key); |
280 | if (it != m_Parameters.end()) { | 282 | if (it != m_Parameters.end()) { |
281 | value = it.data(); | 283 | value = it.data(); |
282 | } | 284 | } |
283 | return value; | 285 | return value; |
284 | } | 286 | } |
285 | 287 | ||
286 | void RecPart::setPositionlist(const QValueList<int>&poslist) | 288 | void RecPart::setPositionlist(const Q3ValueList<int>&poslist) |
287 | { | 289 | { |
288 | m_poslist = poslist; | 290 | m_poslist = poslist; |
289 | } | 291 | } |
290 | 292 | ||
291 | const QValueList<int>& RecPart::Positionlist()const | 293 | const Q3ValueList<int>& RecPart::Positionlist()const |
292 | { | 294 | { |
293 | return m_poslist; | 295 | return m_poslist; |
294 | } | 296 | } |
295 | 297 | ||
296 | RecBody::RecBody() | 298 | RecBody::RecBody() |
297 | : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart()) | 299 | : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart()) |
298 | { | 300 | { |
299 | m_PartsList.clear(); | 301 | m_PartsList.clear(); |
300 | } | 302 | } |
301 | 303 | ||
302 | RecBody::RecBody(const RecBody&old) | 304 | RecBody::RecBody(const RecBody&old) |
303 | :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart()) | 305 | :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart()) |
304 | { | 306 | { |
305 | m_BodyText = old.m_BodyText; | 307 | m_BodyText = old.m_BodyText; |
306 | m_PartsList = old.m_PartsList; | 308 | m_PartsList = old.m_PartsList; |
307 | m_description = old.m_description; | 309 | m_description = old.m_description; |
308 | mCharset = old.mCharset; | 310 | mCharset = old.mCharset; |
309 | // odebug << "Recbody copy constructor" << oendl; | 311 | // odebug << "Recbody copy constructor" << oendl; |
310 | } | 312 | } |
311 | 313 | ||
312 | RecBody::~RecBody() | 314 | RecBody::~RecBody() |
313 | { | 315 | { |
314 | } | 316 | } |
315 | 317 | ||
316 | void RecBody::setBodytext(const QString&bodyText) | 318 | void RecBody::setBodytext(const QString&bodyText) |
317 | { | 319 | { |
318 | m_BodyText = bodyText; | 320 | m_BodyText = bodyText; |
319 | } | 321 | } |
320 | 322 | ||
321 | const QString& RecBody::Bodytext()const | 323 | const QString& RecBody::Bodytext()const |
322 | { | 324 | { |
323 | return m_BodyText; | 325 | return m_BodyText; |
324 | } | 326 | } |
325 | 327 | ||
326 | void RecBody::setParts(const QValueList<RecPartP>&parts) | 328 | void RecBody::setParts(const Q3ValueList<RecPartP>&parts) |
327 | { | 329 | { |
328 | m_PartsList.clear(); | 330 | m_PartsList.clear(); |
329 | m_PartsList = parts; | 331 | m_PartsList = parts; |
330 | } | 332 | } |
331 | 333 | ||
332 | const QValueList<RecPartP>& RecBody::Parts()const | 334 | const Q3ValueList<RecPartP>& RecBody::Parts()const |
333 | { | 335 | { |
334 | return m_PartsList; | 336 | return m_PartsList; |
335 | } | 337 | } |
336 | 338 | ||
337 | void RecBody::addPart(const RecPartP& part) | 339 | void RecBody::addPart(const RecPartP& part) |
338 | { | 340 | { |
339 | m_PartsList.append(part); | 341 | m_PartsList.append(part); |
340 | } | 342 | } |
341 | 343 | ||
342 | void RecBody::setDescription(const RecPartP&des) | 344 | void RecBody::setDescription(const RecPartP&des) |
343 | { | 345 | { |
344 | m_description = des; | 346 | m_description = des; |
345 | } | 347 | } |
346 | 348 | ||
347 | const RecPartP& RecBody::Description()const | 349 | const RecPartP& RecBody::Description()const |
348 | { | 350 | { |
349 | return m_description; | 351 | return m_description; |
350 | } | 352 | } |
351 | 353 | ||
352 | void RecBody::setCharset(const QString& str) | 354 | void RecBody::setCharset(const QString& str) |
353 | { | 355 | { |
354 | mCharset = str; | 356 | mCharset = str; |
355 | } | 357 | } |
356 | 358 | ||
357 | QString RecBody::getCharset()const | 359 | QString RecBody::getCharset()const |
358 | { | 360 | { |
359 | return mCharset; | 361 | return mCharset; |
360 | } | 362 | } |
361 | 363 | ||
362 | /* handling encoded content */ | 364 | /* handling encoded content */ |
363 | encodedString::encodedString() | 365 | encodedString::encodedString() |
364 | { | 366 | { |
365 | init(); | 367 | init(); |
366 | } | 368 | } |
367 | 369 | ||
368 | encodedString::encodedString(const char*nContent,unsigned int nSize) | 370 | encodedString::encodedString(const char*nContent,unsigned int nSize) |
369 | { | 371 | { |
370 | init(); | 372 | init(); |
371 | setContent(nContent,nSize); | 373 | setContent(nContent,nSize); |
372 | } | 374 | } |
373 | 375 | ||
374 | encodedString::encodedString(char*nContent,unsigned int nSize) | 376 | encodedString::encodedString(char*nContent,unsigned int nSize) |
375 | { | 377 | { |
376 | init(); | 378 | init(); |
377 | setContent(nContent,nSize); | 379 | setContent(nContent,nSize); |
378 | } | 380 | } |
379 | 381 | ||
380 | encodedString::encodedString(const encodedString&old) | 382 | encodedString::encodedString(const encodedString&old) |
381 | { | 383 | { |
382 | init(); | 384 | init(); |
383 | copy_old(old); | 385 | copy_old(old); |
384 | // odebug << "encodedeString: copy constructor!" << oendl; | 386 | // odebug << "encodedeString: copy constructor!" << oendl; |
385 | } | 387 | } |
386 | 388 | ||
387 | encodedString& encodedString::operator=(const encodedString&old) | 389 | encodedString& encodedString::operator=(const encodedString&old) |
388 | { | 390 | { |
389 | init(); | 391 | init(); |
390 | copy_old(old); | 392 | copy_old(old); |
391 | // odebug << "encodedString: assign operator!" << oendl; | 393 | // odebug << "encodedString: assign operator!" << oendl; |
392 | return *this; | 394 | return *this; |
393 | } | 395 | } |
394 | 396 | ||
395 | encodedString::~encodedString() | 397 | encodedString::~encodedString() |
396 | { | 398 | { |