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 /libkcal/kincidenceformatter.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 'libkcal/kincidenceformatter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libkcal/kincidenceformatter.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index 733b897..bce68b0 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp | |||
@@ -1,22 +1,24 @@ | |||
1 | #include "kincidenceformatter.h" | 1 | #include "kincidenceformatter.h" |
2 | #include <kstaticdeleter.h> | 2 | #include <kstaticdeleter.h> |
3 | #include <kglobal.h> | 3 | #include <kglobal.h> |
4 | #include <klocale.h> | 4 | #include <klocale.h> |
5 | #ifdef DEKTOP_VERSION | 5 | #ifdef DEKTOP_VERSION |
6 | #include <kabc/stdaddressbook.h> | 6 | #include <kabc/stdaddressbook.h> |
7 | //Added by qt3to4: | ||
8 | #include <Q3PtrList> | ||
7 | #define size count | 9 | #define size count |
8 | #endif | 10 | #endif |
9 | 11 | ||
10 | KIncidenceFormatter* KIncidenceFormatter::mInstance = 0; | 12 | KIncidenceFormatter* KIncidenceFormatter::mInstance = 0; |
11 | static KStaticDeleter<KIncidenceFormatter> insd; | 13 | static KStaticDeleter<KIncidenceFormatter> insd; |
12 | 14 | ||
13 | QString KIncidenceFormatter::getFormattedText( Incidence * inc, bool details, bool created , bool modified ) | 15 | QString KIncidenceFormatter::getFormattedText( Incidence * inc, bool details, bool created , bool modified ) |
14 | { | 16 | { |
15 | // #ifndef QT_NO_INPUTDIALOG | 17 | // #ifndef QT_NO_INPUTDIALOG |
16 | // return QInputDialog::getItem( caption, label, items, current, editable ); | 18 | // return QInputDialog::getItem( caption, label, items, current, editable ); |
17 | // #else | 19 | // #else |
18 | // return QString::null; | 20 | // return QString::null; |
19 | // #endif | 21 | // #endif |
20 | mDetails = details; | 22 | mDetails = details; |
21 | mCreated = created ; | 23 | mCreated = created ; |
22 | mModified = modified; | 24 | mModified = modified; |
@@ -297,85 +299,85 @@ void KIncidenceFormatter::setTodo(Todo *event ) | |||
297 | } | 299 | } |
298 | 300 | ||
299 | void KIncidenceFormatter::setJournal(Journal* ) | 301 | void KIncidenceFormatter::setJournal(Journal* ) |
300 | { | 302 | { |
301 | 303 | ||
302 | } | 304 | } |
303 | 305 | ||
304 | void KIncidenceFormatter::formatCategories(Incidence *event) | 306 | void KIncidenceFormatter::formatCategories(Incidence *event) |
305 | { | 307 | { |
306 | if (!event->categoriesStr().isEmpty()) { | 308 | if (!event->categoriesStr().isEmpty()) { |
307 | addTag("p",i18n("<b>Categories: </b>")+event->categoriesStrWithSpace() ); | 309 | addTag("p",i18n("<b>Categories: </b>")+event->categoriesStrWithSpace() ); |
308 | //mText.append(event->categoriesStr()); | 310 | //mText.append(event->categoriesStr()); |
309 | } | 311 | } |
310 | } | 312 | } |
311 | void KIncidenceFormatter::addTag(const QString & tag,const QString & text) | 313 | void KIncidenceFormatter::addTag(const QString & tag,const QString & text) |
312 | { | 314 | { |
313 | int number=text.contains("\n"); | 315 | int number=text.count("\n"); |
314 | QString str = "<" + tag + ">"; | 316 | QString str = "<" + tag + ">"; |
315 | QString tmpText=text; | 317 | QString tmpText=text; |
316 | QString tmpStr=str; | 318 | QString tmpStr=str; |
317 | if(number !=-1) | 319 | if(number !=-1) |
318 | { | 320 | { |
319 | if (number > 0) { | 321 | if (number > 0) { |
320 | int pos=0; | 322 | int pos=0; |
321 | QString tmp; | 323 | QString tmp; |
322 | for(int i=0;i<=number;i++) { | 324 | for(int i=0;i<=number;i++) { |
323 | pos=tmpText.find("\n"); | 325 | pos=tmpText.find("\n"); |
324 | tmp=tmpText.left(pos); | 326 | tmp=tmpText.left(pos); |
325 | tmpText=tmpText.right(tmpText.length()-pos-1); | 327 | tmpText=tmpText.right(tmpText.length()-pos-1); |
326 | tmpStr+=tmp+"<br>"; | 328 | tmpStr+=tmp+"<br>"; |
327 | } | 329 | } |
328 | } | 330 | } |
329 | else tmpStr += tmpText; | 331 | else tmpStr += tmpText; |
330 | tmpStr+="</" + tag + ">"; | 332 | tmpStr+="</" + tag + ">"; |
331 | mText.append(tmpStr); | 333 | mText.append(tmpStr); |
332 | } | 334 | } |
333 | else | 335 | else |
334 | { | 336 | { |
335 | str += text + "</" + tag + ">"; | 337 | str += text + "</" + tag + ">"; |
336 | mText.append(str); | 338 | mText.append(str); |
337 | } | 339 | } |
338 | } | 340 | } |
339 | 341 | ||
340 | void KIncidenceFormatter::formatAttendees(Incidence *event) | 342 | void KIncidenceFormatter::formatAttendees(Incidence *event) |
341 | { | 343 | { |
342 | QPtrList<Attendee> attendees = event->attendees(); | 344 | Q3PtrList<Attendee> attendees = event->attendees(); |
343 | if (attendees.count()) { | 345 | if (attendees.count()) { |
344 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); | 346 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); |
345 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); | 347 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); |
346 | addTag("h3",i18n("Organizer")); | 348 | addTag("h3",i18n("Organizer")); |
347 | mText.append("<ul><li>"); | 349 | mText.append("<ul><li>"); |
348 | #if 0 | 350 | #if 0 |
349 | //ndef KORG_NOKABC | 351 | //ndef KORG_NOKABC |
350 | 352 | ||
351 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); | 353 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); |
352 | KABC::Addressee::List addressList; | 354 | KABC::Addressee::List addressList; |
353 | addressList = add_book->findByEmail(event->organizer()); | 355 | addressList = add_book->findByEmail(event->organizer()); |
354 | KABC::Addressee o = addressList.first(); | 356 | KABC::Addressee o = addressList.first(); |
355 | if (!o.isEmpty() && addressList.size()<2) { | 357 | if (!o.isEmpty() && addressList.size()<2) { |
356 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 358 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
357 | mText += o.formattedName(); | 359 | mText += o.formattedName(); |
358 | mText += "</a>\n"; | 360 | mText += "</a>\n"; |
359 | } else { | 361 | } else { |
360 | mText.append(event->organizer()); | 362 | mText.append(event->organizer()); |
361 | } | 363 | } |
362 | #else | 364 | #else |
363 | mText.append(event->organizer()); | 365 | mText.append(event->organizer()); |
364 | #endif | 366 | #endif |
365 | if (iconPath) { | 367 | if (!iconPath.isEmpty()) { |
366 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; | 368 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; |
367 | mText += "<IMG src=\"" + iconPath + "\">"; | 369 | mText += "<IMG src=\"" + iconPath + "\">"; |
368 | mText += "</a>\n"; | 370 | mText += "</a>\n"; |
369 | } | 371 | } |
370 | mText.append("</li></ul>"); | 372 | mText.append("</li></ul>"); |
371 | 373 | ||
372 | addTag("h3",i18n("Attendees")); | 374 | addTag("h3",i18n("Attendees")); |
373 | Attendee *a; | 375 | Attendee *a; |
374 | mText.append("<ul>"); | 376 | mText.append("<ul>"); |
375 | for(a=attendees.first();a;a=attendees.next()) { | 377 | for(a=attendees.first();a;a=attendees.next()) { |
376 | #if 0 | 378 | #if 0 |
377 | //ndef KORG_NOKABC | 379 | //ndef KORG_NOKABC |
378 | if (a->name().isEmpty()) { | 380 | if (a->name().isEmpty()) { |
379 | addressList = add_book->findByEmail(a->email()); | 381 | addressList = add_book->findByEmail(a->email()); |
380 | KABC::Addressee o = addressList.first(); | 382 | KABC::Addressee o = addressList.first(); |
381 | if (!o.isEmpty() && addressList.size()<2) { | 383 | if (!o.isEmpty() && addressList.size()<2) { |
@@ -389,33 +391,33 @@ void KIncidenceFormatter::formatAttendees(Incidence *event) | |||
389 | } | 391 | } |
390 | } else { | 392 | } else { |
391 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 393 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
392 | if (!a->name().isEmpty()) mText += a->name(); | 394 | if (!a->name().isEmpty()) mText += a->name(); |
393 | else mText += a->email(); | 395 | else mText += a->email(); |
394 | mText += "</a>\n"; | 396 | mText += "</a>\n"; |
395 | } | 397 | } |
396 | #else | 398 | #else |
397 | //qDebug("nokabc "); | 399 | //qDebug("nokabc "); |
398 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 400 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
399 | if (!a->name().isEmpty()) mText += a->name(); | 401 | if (!a->name().isEmpty()) mText += a->name(); |
400 | else mText += a->email(); | 402 | else mText += a->email(); |
401 | mText += "</a>\n"; | 403 | mText += "</a>\n"; |
402 | #endif | 404 | #endif |
403 | 405 | ||
404 | if (!a->email().isEmpty()) { | 406 | if (!a->email().isEmpty()) { |
405 | if (iconPath) { | 407 | if (!iconPath.isEmpty()) { |
406 | mText += "<a href=\"mailto:" + a->name() +" "+ "<" + a->email() + ">" + "\">"; | 408 | mText += "<a href=\"mailto:" + a->name() +" "+ "<" + a->email() + ">" + "\">"; |
407 | if ( a->RSVP() ) | 409 | if ( a->RSVP() ) |
408 | mText += "<IMG src=\"" + iconPath + "\">"; | 410 | mText += "<IMG src=\"" + iconPath + "\">"; |
409 | else | 411 | else |
410 | mText += "<IMG src=\"" + NOiconPath + "\">"; | 412 | mText += "<IMG src=\"" + NOiconPath + "\">"; |
411 | mText += "</a>\n"; | 413 | mText += "</a>\n"; |
412 | } | 414 | } |
413 | } | 415 | } |
414 | if (a->status() != Attendee::NeedsAction ) | 416 | if (a->status() != Attendee::NeedsAction ) |
415 | mText +="[" + a->statusStr() + "] "; | 417 | mText +="[" + a->statusStr() + "] "; |
416 | if (a->role() == Attendee::Chair ) | 418 | if (a->role() == Attendee::Chair ) |
417 | mText +="(" + a->roleStr().left(1) + ".)"; | 419 | mText +="(" + a->roleStr().left(1) + ".)"; |
418 | } | 420 | } |
419 | mText.append("</li></ul>"); | 421 | mText.append("</li></ul>"); |
420 | } | 422 | } |
421 | } | 423 | } |