-rw-r--r-- | libkcal/kincidenceformatter.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index f8f40f1..4dfe16a 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp | |||
@@ -37,97 +37,99 @@ KIncidenceFormatter* KIncidenceFormatter::instance() | |||
37 | } | 37 | } |
38 | KIncidenceFormatter::~KIncidenceFormatter() | 38 | KIncidenceFormatter::~KIncidenceFormatter() |
39 | { | 39 | { |
40 | if (mInstance == this) | 40 | if (mInstance == this) |
41 | mInstance = insd.setObject(0); | 41 | mInstance = insd.setObject(0); |
42 | //qDebug("KIncidenceFormatter::~KIncidenceFormatter "); | 42 | //qDebug("KIncidenceFormatter::~KIncidenceFormatter "); |
43 | } | 43 | } |
44 | KIncidenceFormatter::KIncidenceFormatter() | 44 | KIncidenceFormatter::KIncidenceFormatter() |
45 | { | 45 | { |
46 | mColorMode = 0; | 46 | mColorMode = 0; |
47 | } | 47 | } |
48 | void KIncidenceFormatter::setEvent(Event *event) | 48 | void KIncidenceFormatter::setEvent(Event *event) |
49 | { | 49 | { |
50 | int mode = 0; | 50 | int mode = 0; |
51 | mCurrentIncidence = event; | 51 | mCurrentIncidence = event; |
52 | bool shortDate = true; | 52 | bool shortDate = true; |
53 | if ( mode == 0 ) { | 53 | if ( mode == 0 ) { |
54 | addTag("h3",deTag(event->summary())); | 54 | addTag("h3",deTag(event->summary())); |
55 | formatReadOnly(event); | 55 | formatReadOnly(event); |
56 | } | 56 | } |
57 | else { | 57 | else { |
58 | if ( mColorMode == 1 ) { | 58 | if ( mColorMode == 1 ) { |
59 | mText +="<font color=\"#00A000\">"; | 59 | mText +="<font color=\"#00A000\">"; |
60 | } | 60 | } |
61 | if ( mColorMode == 2 ) { | 61 | if ( mColorMode == 2 ) { |
62 | mText +="<font color=\"#C00000\">"; | 62 | mText +="<font color=\"#C00000\">"; |
63 | } | 63 | } |
64 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 64 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
65 | if ( mode == 1 ) { | 65 | if ( mode == 1 ) { |
66 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); | 66 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); |
67 | } else { | 67 | } else { |
68 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); | 68 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); |
69 | } | 69 | } |
70 | formatReadOnly(event); | 70 | formatReadOnly(event); |
71 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 71 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
72 | if ( mColorMode ) | 72 | if ( mColorMode ) |
73 | mText += "</font>"; | 73 | mText += "</font>"; |
74 | } | 74 | } |
75 | if (event->cancelled ()) { | 75 | if (event->cancelled ()) { |
76 | mText +="<font color=\"#B00000\">"; | 76 | mText +="<font color=\"#B00000\">"; |
77 | addTag("i",i18n("This event has been cancelled!")); | 77 | addTag("i",i18n("This event has been cancelled!")); |
78 | mText.append("<br>"); | 78 | mText.append("<br>"); |
79 | mText += "</font>"; | 79 | mText += "</font>"; |
80 | } | 80 | } |
81 | if (event->doesFloat()) { | 81 | if (event->doesFloat()) { |
82 | if (event->isMultiDay()) { | 82 | if (event->isMultiDay()) { |
83 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") | 83 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") |
84 | .arg(event->dtStartDateStr(shortDate)) | 84 | .arg(event->dtStartDateStr(shortDate)) |
85 | .arg(event->dtEndDateStr(shortDate))); | 85 | .arg(event->dtEndDateStr(shortDate))); |
86 | mText.append(i18n("<p><b>Duration:</b> %1 days</p>") | ||
87 | .arg(event->dtStart().daysTo(event->dtEnd())+1)); | ||
86 | } else { | 88 | } else { |
87 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); | 89 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); |
88 | } | 90 | } |
89 | } else { | 91 | } else { |
90 | if (event->isMultiDay()) { | 92 | if (event->isMultiDay()) { |
91 | mText.append(i18n("<p><b>From:</b> %1</p> ") | 93 | mText.append(i18n("<p><b>From:</b> %1</p> ") |
92 | .arg(event->dtStartStr( shortDate))); | 94 | .arg(event->dtStartStr( shortDate))); |
93 | mText.append(i18n("<p><b>To:</b> %1</p>") | 95 | mText.append(i18n("<p><b>To:</b> %1</p>") |
94 | .arg(event->dtEndStr(shortDate))); | 96 | .arg(event->dtEndStr(shortDate))); |
95 | } else { | 97 | } else { |
96 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") | 98 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") |
97 | .arg(event->dtStartTimeStr()) | 99 | .arg(event->dtStartTimeStr()) |
98 | .arg(event->dtEndTimeStr())); | 100 | .arg(event->dtEndTimeStr())); |
99 | mText.append(i18n("<p><b>On:</b> %1</p> ") | 101 | mText.append(i18n("<p><b>On:</b> %1</p> ") |
100 | .arg(event->dtStartDateStr( shortDate ))); | 102 | .arg(event->dtStartDateStr( shortDate ))); |
101 | } | 103 | } |
102 | } | 104 | } |
103 | if (!event->location().isEmpty()) { | 105 | if (!event->location().isEmpty()) { |
104 | addTag("b",i18n("Location: ")); | 106 | addTag("b",i18n("Location: ")); |
105 | mText.append(deTag(event->location())+"<br>"); | 107 | mText.append(deTag(event->location())+"<br>"); |
106 | } | 108 | } |
107 | 109 | ||
108 | if (event->doesRecur()) { | 110 | if (event->doesRecur()) { |
109 | 111 | ||
110 | QString recurText = event->recurrence()->recurrenceText(); | 112 | QString recurText = event->recurrence()->recurrenceText(); |
111 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); | 113 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); |
112 | 114 | ||
113 | bool ok; | 115 | bool ok; |
114 | QDate start = QDate::currentDate(); | 116 | QDate start = QDate::currentDate(); |
115 | QDateTime next; | 117 | QDateTime next; |
116 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); | 118 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); |
117 | if ( ok ) { | 119 | if ( ok ) { |
118 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); | 120 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); |
119 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); | 121 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); |
120 | 122 | ||
121 | } else { | 123 | } else { |
122 | bool last; | 124 | bool last; |
123 | QDate nextd; | 125 | QDate nextd; |
124 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); | 126 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); |
125 | if ( last ) { | 127 | if ( last ) { |
126 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | 128 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); |
127 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); | 129 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); |
128 | } | 130 | } |
129 | } | 131 | } |
130 | } | 132 | } |
131 | 133 | ||
132 | 134 | ||
133 | if (event->isAlarmEnabled()) { | 135 | if (event->isAlarmEnabled()) { |