summaryrefslogtreecommitdiffabout
path: root/libkcal/kincidenceformatter.cpp
Unidiff
Diffstat (limited to 'libkcal/kincidenceformatter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/kincidenceformatter.cpp10
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,14 +1,16 @@
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
10KIncidenceFormatter* KIncidenceFormatter::mInstance = 0; 12KIncidenceFormatter* KIncidenceFormatter::mInstance = 0;
11static KStaticDeleter<KIncidenceFormatter> insd; 13static KStaticDeleter<KIncidenceFormatter> insd;
12 14
13QString KIncidenceFormatter::getFormattedText( Incidence * inc, bool details, bool created , bool modified ) 15QString KIncidenceFormatter::getFormattedText( Incidence * inc, bool details, bool created , bool modified )
14{ 16{
@@ -305,17 +307,17 @@ 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}
311void KIncidenceFormatter::addTag(const QString & tag,const QString & text) 313void 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;
@@ -334,17 +336,17 @@ void KIncidenceFormatter::addTag(const QString & tag,const QString & text)
334 { 336 {
335 str += text + "</" + tag + ">"; 337 str += text + "</" + tag + ">";
336 mText.append(str); 338 mText.append(str);
337 } 339 }
338} 340}
339 341
340void KIncidenceFormatter::formatAttendees(Incidence *event) 342void 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
@@ -357,17 +359,17 @@ void KIncidenceFormatter::formatAttendees(Incidence *event)
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;
@@ -397,17 +399,17 @@ void KIncidenceFormatter::formatAttendees(Incidence *event)
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 }