summaryrefslogtreecommitdiffabout
path: root/korganizer/koeventviewer.cpp
Unidiff
Diffstat (limited to 'korganizer/koeventviewer.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koeventviewer.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index db695f5..976ee2c 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -281,96 +281,98 @@ void KOEventViewer::addTag(const QString & tag,const QString & text)
281 281
282void KOEventViewer::setColorMode( int m ) 282void KOEventViewer::setColorMode( int m )
283{ 283{
284 mColorMode = m; 284 mColorMode = m;
285} 285}
286void KOEventViewer::appendEvent(Event *event, int mode ) 286void KOEventViewer::appendEvent(Event *event, int mode )
287{ 287{
288 mMailSubject = ""; 288 mMailSubject = "";
289 mCurrentIncidence = event; 289 mCurrentIncidence = event;
290 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 290 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
291 bool wideScreen = ( QApplication::desktop()->width() >= 640 ); 291 bool wideScreen = ( QApplication::desktop()->width() >= 640 );
292 topLevelWidget()->setCaption(i18n("Event Viewer")); 292 topLevelWidget()->setCaption(i18n("Event Viewer"));
293 if ( mode == 0 ) { 293 if ( mode == 0 ) {
294 addTag("h2",deTag(event->summary())); 294 addTag("h2",deTag(event->summary()));
295 formatReadOnly(event); 295 formatReadOnly(event);
296 } 296 }
297 else { 297 else {
298 if ( mColorMode == 1 ) { 298 if ( mColorMode == 1 ) {
299 mText +="<font color=\"#00A000\">"; 299 mText +="<font color=\"#00A000\">";
300 } 300 }
301 if ( mColorMode == 2 ) { 301 if ( mColorMode == 2 ) {
302 mText +="<font color=\"#C00000\">"; 302 mText +="<font color=\"#C00000\">";
303 } 303 }
304 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 304 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
305 if ( mode == 1 ) { 305 if ( mode == 1 ) {
306 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 306 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
307 } else { 307 } else {
308 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 308 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
309 } 309 }
310 formatReadOnly(event); 310 formatReadOnly(event);
311 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 311 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
312 if ( mColorMode ) 312 if ( mColorMode )
313 mText += "</font>"; 313 mText += "</font>";
314 } 314 }
315 mMailSubject += i18n( "Meeting " )+ event->summary(); 315 mMailSubject += i18n( "Meeting " )+ event->summary();
316 if (event->cancelled ()) { 316 if (event->cancelled ()) {
317 mText +="<font color=\"#B00000\">"; 317 mText +="<font color=\"#B00000\">";
318 addTag("i",i18n("This event has been cancelled!")); 318 addTag("i",i18n("This event has been cancelled!"));
319 mText.append("<br>"); 319 mText.append("<br>");
320 mText += "</font>"; 320 mText += "</font>";
321 mMailSubject += i18n("(cancelled)"); 321 mMailSubject += i18n("(cancelled)");
322 } 322 }
323 323
324 if (event->doesFloat()) { 324 if (event->doesFloat()) {
325 if (event->isMultiDay()) { 325 if (event->isMultiDay()) {
326 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") 326 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>")
327 .arg(event->dtStartDateStr(shortDate)) 327 .arg(event->dtStartDateStr(shortDate))
328 .arg(event->dtEndDateStr(shortDate))); 328 .arg(event->dtEndDateStr(shortDate)));
329 mText.append(i18n("<p><b>Duration:</b> %1 days</p>")
330 .arg(event->dtStart().daysTo(event->dtEnd())+1));
329 } else { 331 } else {
330 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); 332 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate )));
331 } 333 }
332 } else { 334 } else {
333 if (event->isMultiDay()) { 335 if (event->isMultiDay()) {
334 mText.append(i18n("<p><b>From:</b> %1</p> ") 336 mText.append(i18n("<p><b>From:</b> %1</p> ")
335 .arg(event->dtStartStr( shortDate))); 337 .arg(event->dtStartStr( shortDate)));
336 mText.append(i18n("<p><b>To:</b> %1</p>") 338 mText.append(i18n("<p><b>To:</b> %1</p>")
337 .arg(event->dtEndStr(shortDate))); 339 .arg(event->dtEndStr(shortDate)));
338 } else { 340 } else {
339 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") 341 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>")
340 .arg(event->dtStartTimeStr()) 342 .arg(event->dtStartTimeStr())
341 .arg(event->dtEndTimeStr())); 343 .arg(event->dtEndTimeStr()));
342 mText.append(i18n("<p><b>On:</b> %1</p> ") 344 mText.append(i18n("<p><b>On:</b> %1</p> ")
343 .arg(event->dtStartDateStr( shortDate ))); 345 .arg(event->dtStartDateStr( shortDate )));
344 } 346 }
345 } 347 }
346 if (!event->location().isEmpty()) { 348 if (!event->location().isEmpty()) {
347 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); 349 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) );
348 mMailSubject += i18n(" at ") + event->location(); 350 mMailSubject += i18n(" at ") + event->location();
349 } 351 }
350 if (event->doesRecur()) { 352 if (event->doesRecur()) {
351 353
352 QString recurText = event->recurrenceText(); 354 QString recurText = event->recurrenceText();
353 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); 355 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
354 bool ok; 356 bool ok;
355 QDate start = QDate::currentDate(); 357 QDate start = QDate::currentDate();
356 QDateTime next; 358 QDateTime next;
357 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); 359 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
358 if ( ok ) { 360 if ( ok ) {
359 if ( wideScreen ){ 361 if ( wideScreen ){
360 addTag("p",i18n("<b>Next recurrence is on:</b>") +" " + KGlobal::locale()->formatDate( next.date(), shortDate ) ); 362 addTag("p",i18n("<b>Next recurrence is on:</b>") +" " + KGlobal::locale()->formatDate( next.date(), shortDate ) );
361 } else { 363 } else {
362 addTag("p",i18n("<b>Next recurrence is on:</b>") ); 364 addTag("p",i18n("<b>Next recurrence is on:</b>") );
363 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); 365 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
364 } 366 }
365 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); 367 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true );
366 368
367 } else { 369 } else {
368 bool last; 370 bool last;
369 QDate nextd; 371 QDate nextd;
370 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); 372 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
371 if ( last ) { 373 if ( last ) {
372 if ( wideScreen ){ 374 if ( wideScreen ){
373 addTag("p",i18n("<b>Last recurrence was on:</b>") +" " + KGlobal::locale()->formatDate( nextd, shortDate )); 375 addTag("p",i18n("<b>Last recurrence was on:</b>") +" " + KGlobal::locale()->formatDate( nextd, shortDate ));
374 } else{ 376 } else{
375 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 377 addTag("p",i18n("<b>Last recurrence was on:</b>") );
376 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); 378 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));