Diffstat (limited to 'libkcal/kincidenceformatter.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libkcal/kincidenceformatter.cpp | 63 |
1 files changed, 41 insertions, 22 deletions
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index d67ad52..8ae5b46 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp | |||
@@ -73,16 +73,12 @@ void KIncidenceFormatter::setEvent(Event *event) | |||
73 | if (event->cancelled ()) { | 73 | if (event->cancelled ()) { |
74 | mText +="<font color=\"#B00000\">"; | 74 | mText +="<font color=\"#B00000\">"; |
75 | addTag("i",i18n("This event has been cancelled!")); | 75 | addTag("i",i18n("This event has been cancelled!")); |
76 | mText.append("<br>"); | 76 | mText.append("<br>"); |
77 | mText += "</font>"; | 77 | mText += "</font>"; |
78 | } | 78 | } |
79 | if (!event->location().isEmpty()) { | ||
80 | addTag("b",i18n("Location: ")); | ||
81 | mText.append(deTag(event->location())+"<br>"); | ||
82 | } | ||
83 | if (event->doesFloat()) { | 79 | if (event->doesFloat()) { |
84 | if (event->isMultiDay()) { | 80 | if (event->isMultiDay()) { |
85 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") | 81 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") |
86 | .arg(event->dtStartDateStr(shortDate)) | 82 | .arg(event->dtStartDateStr(shortDate)) |
87 | .arg(event->dtEndDateStr(shortDate))); | 83 | .arg(event->dtEndDateStr(shortDate))); |
88 | } else { | 84 | } else { |
@@ -92,19 +88,23 @@ void KIncidenceFormatter::setEvent(Event *event) | |||
92 | if (event->isMultiDay()) { | 88 | if (event->isMultiDay()) { |
93 | mText.append(i18n("<p><b>From:</b> %1</p> ") | 89 | mText.append(i18n("<p><b>From:</b> %1</p> ") |
94 | .arg(event->dtStartStr( shortDate))); | 90 | .arg(event->dtStartStr( shortDate))); |
95 | mText.append(i18n("<p><b>To:</b> %1</p>") | 91 | mText.append(i18n("<p><b>To:</b> %1</p>") |
96 | .arg(event->dtEndStr(shortDate))); | 92 | .arg(event->dtEndStr(shortDate))); |
97 | } else { | 93 | } else { |
98 | mText.append(i18n("<p><b>On:</b> %1</p> ") | ||
99 | .arg(event->dtStartDateStr( shortDate ))); | ||
100 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") | 94 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") |
101 | .arg(event->dtStartTimeStr()) | 95 | .arg(event->dtStartTimeStr()) |
102 | .arg(event->dtEndTimeStr())); | 96 | .arg(event->dtEndTimeStr())); |
97 | mText.append(i18n("<p><b>On:</b> %1</p> ") | ||
98 | .arg(event->dtStartDateStr( shortDate ))); | ||
103 | } | 99 | } |
104 | } | 100 | } |
101 | if (!event->location().isEmpty()) { | ||
102 | addTag("b",i18n("Location: ")); | ||
103 | mText.append(deTag(event->location())+"<br>"); | ||
104 | } | ||
105 | 105 | ||
106 | if (event->recurrence()->doesRecur()) { | 106 | if (event->recurrence()->doesRecur()) { |
107 | 107 | ||
108 | QString recurText = event->recurrence()->recurrenceText(); | 108 | QString recurText = event->recurrence()->recurrenceText(); |
109 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); | 109 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); |
110 | 110 | ||
@@ -139,32 +139,40 @@ void KIncidenceFormatter::setEvent(Event *event) | |||
139 | 139 | ||
140 | 140 | ||
141 | 141 | ||
142 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); | 142 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); |
143 | // mText.append(event->secrecyStr()+"<br>"); | 143 | // mText.append(event->secrecyStr()+"<br>"); |
144 | formatCategories(event); | 144 | formatCategories(event); |
145 | if ( mDetails ) { | ||
146 | if (!event->description().isEmpty()) { | ||
147 | addTag("p",i18n("<b>Details: </b>")); | ||
148 | addTag("p",deTag(event->description())); | ||
149 | } | ||
150 | } | ||
151 | 145 | ||
152 | formatReadOnly(event); | 146 | formatReadOnly(event); |
153 | formatAttendees(event); | 147 | formatAttendees(event); |
154 | 148 | ||
155 | if ( mCreated ) { | 149 | if ( mCreated ) { |
150 | #ifdef DESKTOP_VERSION | ||
151 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); | ||
152 | #else | ||
156 | addTag("p",i18n("<b>Created: ") +" </b>"); | 153 | addTag("p",i18n("<b>Created: ") +" </b>"); |
157 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 154 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
155 | #endif | ||
158 | 156 | ||
159 | } | 157 | } |
160 | if ( mModified ) { | 158 | if ( mModified ) { |
159 | #ifdef DESKTOP_VERSION | ||
160 | addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | ||
161 | #else | ||
161 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | 162 | addTag("p",i18n("<b>Last modified: ") +" </b>"); |
162 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 163 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
164 | #endif | ||
163 | 165 | ||
164 | } | 166 | } |
167 | if ( mDetails ) { | ||
168 | if (!event->description().isEmpty()) { | ||
169 | addTag("p",i18n("<b>Details: </b>")); | ||
170 | addTag("p",deTag(event->description())); | ||
171 | } | ||
172 | } | ||
165 | 173 | ||
166 | } | 174 | } |
167 | 175 | ||
168 | void KIncidenceFormatter::setTodo(Todo *event ) | 176 | void KIncidenceFormatter::setTodo(Todo *event ) |
169 | { | 177 | { |
170 | int mode = 0; | 178 | int mode = 0; |
@@ -200,16 +208,12 @@ void KIncidenceFormatter::setTodo(Todo *event ) | |||
200 | mText +="<font color=\"#B00000\">"; | 208 | mText +="<font color=\"#B00000\">"; |
201 | addTag("i",i18n("This todo has been cancelled!")); | 209 | addTag("i",i18n("This todo has been cancelled!")); |
202 | mText.append("<br>"); | 210 | mText.append("<br>"); |
203 | mText += "</font>"; | 211 | mText += "</font>"; |
204 | } | 212 | } |
205 | 213 | ||
206 | if (!event->location().isEmpty()) { | ||
207 | addTag("b",i18n("Location: ")); | ||
208 | mText.append(deTag(event->location())+"<br>"); | ||
209 | } | ||
210 | 214 | ||
211 | if (event->recurrence()->doesRecur()) { | 215 | if (event->recurrence()->doesRecur()) { |
212 | 216 | ||
213 | QString recurText = event->recurrence()->recurrenceText(); | 217 | QString recurText = event->recurrence()->recurrenceText(); |
214 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); | 218 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); |
215 | } | 219 | } |
@@ -219,12 +223,18 @@ void KIncidenceFormatter::setTodo(Todo *event ) | |||
219 | } | 223 | } |
220 | 224 | ||
221 | 225 | ||
222 | if (event->hasDueDate()) { | 226 | if (event->hasDueDate()) { |
223 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); | 227 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); |
224 | } | 228 | } |
229 | |||
230 | if (!event->location().isEmpty()) { | ||
231 | addTag("b",i18n("Location: ")); | ||
232 | mText.append(deTag(event->location())+"<br>"); | ||
233 | } | ||
234 | |||
225 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 235 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
226 | .arg(QString::number(event->priority()))); | 236 | .arg(QString::number(event->priority()))); |
227 | 237 | ||
228 | if (event->isAlarmEnabled()) { | 238 | if (event->isAlarmEnabled()) { |
229 | Alarm *alarm =event->alarms().first() ; | 239 | Alarm *alarm =event->alarms().first() ; |
230 | QDateTime t = alarm->time(); | 240 | QDateTime t = alarm->time(); |
@@ -233,30 +243,39 @@ void KIncidenceFormatter::setTodo(Todo *event ) | |||
233 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 243 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
234 | //addTag("p",s); | 244 | //addTag("p",s); |
235 | } | 245 | } |
236 | 246 | ||
237 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); | 247 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); |
238 | formatCategories(event); | 248 | formatCategories(event); |
239 | if ( mDetails ) { | 249 | |
240 | if (!event->description().isEmpty()) { | ||
241 | addTag("p",i18n("<b>Details: </b>")); | ||
242 | addTag("p",deTag(event->description())); | ||
243 | } | ||
244 | } | ||
245 | formatReadOnly(event); | 250 | formatReadOnly(event); |
246 | formatAttendees(event); | 251 | formatAttendees(event); |
247 | if ( mCreated ) { | 252 | if ( mCreated ) { |
253 | #ifdef DESKTOP_VERSION | ||
254 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); | ||
255 | #else | ||
248 | addTag("p",i18n("<b>Created: ") +" </b>"); | 256 | addTag("p",i18n("<b>Created: ") +" </b>"); |
249 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 257 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
258 | #endif | ||
250 | 259 | ||
251 | } | 260 | } |
252 | if ( mModified ) { | 261 | if ( mModified ) { |
262 | #ifdef DESKTOP_VERSION | ||
263 | addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | ||
264 | #else | ||
253 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | 265 | addTag("p",i18n("<b>Last modified: ") +" </b>"); |
254 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 266 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
267 | #endif | ||
255 | 268 | ||
256 | } | 269 | } |
270 | if ( mDetails ) { | ||
271 | if (!event->description().isEmpty()) { | ||
272 | addTag("p",i18n("<b>Details: </b>")); | ||
273 | addTag("p",deTag(event->description())); | ||
274 | } | ||
275 | } | ||
257 | } | 276 | } |
258 | 277 | ||
259 | void KIncidenceFormatter::setJournal(Journal* ) | 278 | void KIncidenceFormatter::setJournal(Journal* ) |
260 | { | 279 | { |
261 | 280 | ||
262 | } | 281 | } |