summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-04-02 14:07:31 (UTC)
committer zautrix <zautrix>2005-04-02 14:07:31 (UTC)
commitb0d17f8f2ef9b09b7d8b8aa0f6cc34f400f8fddd (patch) (unidiff)
tree942bcf89b35cf165e9147c1e4a5efa817c48007f
parent997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe (diff)
downloadkdepimpi-b0d17f8f2ef9b09b7d8b8aa0f6cc34f400f8fddd.zip
kdepimpi-b0d17f8f2ef9b09b7d8b8aa0f6cc34f400f8fddd.tar.gz
kdepimpi-b0d17f8f2ef9b09b7d8b8aa0f6cc34f400f8fddd.tar.bz2
fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt10
-rw-r--r--korganizer/koeventviewer.cpp14
-rw-r--r--korganizer/kolistview.cpp14
-rw-r--r--korganizer/kotodoview.cpp26
-rw-r--r--libkcal/alarm.cpp24
-rw-r--r--libkcal/alarm.h1
-rw-r--r--libkcal/kincidenceformatter.cpp14
7 files changed, 83 insertions, 20 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index fbab7dd..6b739ba 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1307,37 +1307,37 @@
1307{ "There is no next alarm.","Es gibt keinen nächsten Alarm." }, 1307{ "There is no next alarm.","Es gibt keinen nächsten Alarm." },
1308{ "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" }, 1308{ "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" },
1309{ "The next alarm is in:\n","Der nächste Alarm ist in:\n" }, 1309{ "The next alarm is in:\n","Der nächste Alarm ist in:\n" },
1310{ "%1 days\n","%1 Tagen\n" }, 1310{ "%1 days\n","%1 Tagen\n" },
1311{ "1 day\n","1 Tag\n" }, 1311{ "1 day\n","1 Tag\n" },
1312{ "%1 hours\n","%1 Stunden\n" }, 1312{ "%1 hours\n","%1 Stunden\n" },
1313{ "1 hour\n","1 Stunde\n" }, 1313{ "1 hour\n","1 Stunde\n" },
1314{ "%1 minutes\n","%1 Minuten\n" }, 1314{ "%1 minutes\n","%1 Minuten\n" },
1315{ "1 minute\n","1 Minute\n" }, 1315{ "1 minute\n","1 Minute\n" },
1316{ "Only one toolbar","Nur eine Toolbar" }, 1316{ "Only one toolbar","Nur eine Toolbar" },
1317{ "Print","Drucke" }, 1317{ "Print","Drucke" },
1318{ "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." }, 1318{ "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." },
1319{ "There is nothing selected!","Es ist nichts ausgewählt!" }, 1319{ "There is nothing selected!","Es ist nichts ausgewählt!" },
1320{ "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " }, 1320{ "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " },
1321{ "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" }, 1321{ "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" },
1322{ "This prints the view as you see it.\n(With the complete content, of course.)\nYou may change the print layout by resizing the view.\nPrint unscaled may print several pages\ndepending on the amount of data.\nPrint scaled down will print all on one page.\nPrint scaled up/down will print all on one page,\nbut will scale up the text to page boundaries,\nif the text is smaller than the page.\nYou can select page geometry setup in the next dialog.\n","Dies druckt die Ansicht wie man sie sieht.\n(Mit dem kompletten Inhalt natürlich.)\nMan kann das Layout ändern durch ändern der Fenstergröße.\nDrucke unskaliert druckt ggf. mehrere Seiten\nabhängig von der Menge der Daten.\nDrucke runterskaliert um auf eine Seite zu passen\ndruckt alles auf eine Seite.\nDrucke hoch/runterskaliert um genau auf eine Seite zu passen\nvergrößert den Text gegebenenfalls.\nDas Seitenlayout kann im nächsten Dialog gewählt werden.\n" }, 1322{ "This prints the view as you see it.\n(With the complete content, of course.)\nYou may change the print layout by resizing the view.\nPrint unscaled may print several pages\ndepending on the amount of data.\nPrint scaled down will print all on one page.\nPrint scaled up/down will print all on one page,\nbut will scale up the text to page boundaries,\nif the text is smaller than the page.\nYou can select page geometry setup in the next dialog.\n","Dies druckt die Ansicht wie man sie sieht.\n(Mit dem kompletten Inhalt natürlich.)\nMan kann das Layout ändern durch ändern der Fenstergröße.\nDrucke unskaliert druckt ggf. mehrere Seiten\nabhängig von der Menge der Daten.\nDrucke runterskaliert um auf eine Seite zu passen\ndruckt alles auf eine Seite.\nDrucke hoch/runterskaliert um genau auf eine Seite zu passen\nvergrößert den Text gegebenenfalls.\nDas Seitenlayout kann im nächsten Dialog gewählt werden.\n" },
1323{ "KO/Pi Printout","KO/Pi Ausdruck" }, 1323{ "KO/Pi Printout","KO/Pi Ausdruck" },
1324{ "Print unscaled","Drucke unskaliert" }, 1324{ "Print unscaled","Drucke unskaliert" },
1325{ "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." }, 1325{ "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." },
1326{ "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." }, 1326{ "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." },
1327{ "Printout Mode","Druck Modus" }, 1327{ "Printout Mode","Druck Modus" },
1328{ "Filter menu icon","Filtermenu Icon" }, 1328{ "Filter menu icon","Filtermenu Icon" },
1329{ "<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n","<p><b>A+(shift oder ctrl)</b>: Zeige Zeit bis zum nächsten Alarm</p>\n" }, 1329{ "<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n","<p><b>A+(shift oder ctrl)</b>: Zeige Zeit bis zum nächsten Alarm</p>\n" },
1330{ "<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n","<p><b>N</b>: Wechsle zur nächsten Ansicht, die ein Icon in der Toolbar hat</p>\n" }, 1330{ "<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n","<p><b>N</b>: Wechsle zur nächsten Ansicht, die ein Icon in der Toolbar hat</p>\n" },
1331{ "%1d","%1t" },
1332{ "%1h","%1std" },
1333{ "%1min","%1min" },
1334{ "( %1 before )","( %1 vorher )" },
1331{ "","" }, 1335{ "","" },
1332{ "","" }, 1336{ "","" },
1333{ "","" }, 1337{ "","" },
1334{ "","" }, 1338{ "","" },
1335{ "","" }, 1339{ "","" },
1336{ "","" }, 1340{ "","" },
1337{ "","" }, 1341{ "","" },
1338{ "","" }, 1342{ "","" },
1339{ "","" }, 1343{ "","" } \ No newline at end of file
1340{ "","" },
1341{ "","" },
1342{ "","" },
1343{ "","" }, \ No newline at end of file
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index dbe0668..bdad248 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -349,50 +349,49 @@ void KOEventViewer::appendEvent(Event *event, int mode )
349 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); 349 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
350 if ( ok ) { 350 if ( ok ) {
351 addTag("p",i18n("<b>Next recurrence is on:</b>") ); 351 addTag("p",i18n("<b>Next recurrence is on:</b>") );
352 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); 352 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
353 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); 353 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true );
354 354
355 } else { 355 } else {
356 bool last; 356 bool last;
357 QDate nextd; 357 QDate nextd;
358 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); 358 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
359 if ( last ) { 359 if ( last ) {
360 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 360 addTag("p",i18n("<b>Last recurrence was on:</b>") );
361 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); 361 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
362 } 362 }
363 } 363 }
364 } else { 364 } else {
365 mMailSubject += i18n(" - " )+event->dtStartStr( true ); 365 mMailSubject += i18n(" - " )+event->dtStartStr( true );
366 366
367 } 367 }
368 368
369 369
370 if (event->isAlarmEnabled()) { 370 if (event->isAlarmEnabled()) {
371 Alarm *alarm =event->alarms().first() ; 371 Alarm *alarm =event->alarms().first() ;
372 QDateTime t = alarm->time(); 372 QDateTime t = alarm->time();
373 int min = t.secsTo( event->dtStart() )/60; 373 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
374 QString s =i18n("( %1 min before )").arg( min );
375 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 374 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
376 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 375 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
377 //addTag("p",s); 376 //addTag("p",s);
378 } 377 }
379 378
380 addTag("b",i18n("Access: ")); 379 addTag("b",i18n("Access: "));
381 mText.append(event->secrecyStr()+"<br>"); 380 mText.append(event->secrecyStr()+"<br>");
382 381
383 382
384 if ( KOPrefs::instance()->mEVshowDetails ) { 383 if ( KOPrefs::instance()->mEVshowDetails ) {
385 if (!event->description().isEmpty()) { 384 if (!event->description().isEmpty()) {
386 addTag("p",i18n("<b>Details: </b>")); 385 addTag("p",i18n("<b>Details: </b>"));
387 addTag("p",deTag(event->description())); 386 addTag("p",deTag(event->description()));
388 } 387 }
389 } 388 }
390 formatCategories(event); 389 formatCategories(event);
391 390
392 formatReadOnly(event); 391 formatReadOnly(event);
393 formatAttendees(event); 392 formatAttendees(event);
394 393
395 if ( KOPrefs::instance()->mEVshowCreated ) { 394 if ( KOPrefs::instance()->mEVshowCreated ) {
396 addTag("p",i18n("<b>Created: ") +" </b>"); 395 addTag("p",i18n("<b>Created: ") +" </b>");
397 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 396 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
398 397
@@ -448,48 +447,59 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
448 mText.append("<br>"); 447 mText.append("<br>");
449 mText += "</font>"; 448 mText += "</font>";
450 mMailSubject += i18n("(cancelled)"); 449 mMailSubject += i18n("(cancelled)");
451 } 450 }
452 451
453 if (!event->location().isEmpty()) { 452 if (!event->location().isEmpty()) {
454 addTag("b",i18n("Location: ")); 453 addTag("b",i18n("Location: "));
455 mText.append(deTag(event->location())+"<br>"); 454 mText.append(deTag(event->location())+"<br>");
456 mMailSubject += i18n(" at ") + event->location(); 455 mMailSubject += i18n(" at ") + event->location();
457 } 456 }
458 457
459 if (event->recurrence()->doesRecur()) { 458 if (event->recurrence()->doesRecur()) {
460 459
461 QString recurText = event->recurrence()->recurrenceText(); 460 QString recurText = event->recurrence()->recurrenceText();
462 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); 461 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
463 462
464 } 463 }
465 if (event->hasStartDate()) { 464 if (event->hasStartDate()) {
466 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); 465 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer)));
467 } 466 }
468 if (event->hasDueDate()) { 467 if (event->hasDueDate()) {
469 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); 468 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer)));
470 mMailSubject += i18n(" - " )+event->dtDueStr( true ); 469 mMailSubject += i18n(" - " )+event->dtDueStr( true );
471 } 470 }
471
472
473 if (event->isAlarmEnabled()) {
474 Alarm *alarm =event->alarms().first() ;
475 QDateTime t = alarm->time();
476 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
477 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
478 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
479 //addTag("p",s);
480 }
481
472 addTag("b",i18n("Access: ")); 482 addTag("b",i18n("Access: "));
473 mText.append(event->secrecyStr()+"<br>"); 483 mText.append(event->secrecyStr()+"<br>");
474 if ( KOPrefs::instance()->mEVshowDetails ) { 484 if ( KOPrefs::instance()->mEVshowDetails ) {
475 if (!event->description().isEmpty()) { 485 if (!event->description().isEmpty()) {
476 addTag("p",i18n("<b>Details: </b>")); 486 addTag("p",i18n("<b>Details: </b>"));
477 addTag("p",deTag(event->description())); 487 addTag("p",deTag(event->description()));
478 } 488 }
479 } 489 }
480 490
481 formatCategories(event); 491 formatCategories(event);
482 492
483 mText.append(i18n("<p><b>Priority:</b> %2</p>") 493 mText.append(i18n("<p><b>Priority:</b> %2</p>")
484 .arg(QString::number(event->priority()))); 494 .arg(QString::number(event->priority())));
485 495
486 formatReadOnly(event); 496 formatReadOnly(event);
487 formatAttendees(event); 497 formatAttendees(event);
488 if ( event->relatedTo() ) { 498 if ( event->relatedTo() ) {
489 addTag("b",i18n("Parent todo:<br>")); 499 addTag("b",i18n("Parent todo:<br>"));
490 mText.append(deTag(event->relatedTo()->summary())+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); 500 mText.append(deTag(event->relatedTo()->summary())+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>");
491 } 501 }
492 QPtrList<Incidence> Relations = event->relations(); 502 QPtrList<Incidence> Relations = event->relations();
493 Incidence *to; 503 Incidence *to;
494 if ( Relations.first() ) 504 if ( Relations.first() )
495 addTag("b",i18n("Sub todos:<br>")); 505 addTag("b",i18n("Sub todos:<br>"));
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 15e094d..e0e138e 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -99,84 +99,92 @@ bool ListItemVisitor::visit(Event *e)
99 bool ok = false; 99 bool ok = false;
100 QString start, end; 100 QString start, end;
101 QDate ds, de; 101 QDate ds, de;
102 if ( e->doesRecur() ) { 102 if ( e->doesRecur() ) {
103 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); 103 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date();
104 if ( ok ) { 104 if ( ok ) {
105 int days = e->dtStart().date().daysTo(e->dtEnd().date() ); 105 int days = e->dtStart().date().daysTo(e->dtEnd().date() );
106 start = KGlobal::locale()->formatDate(ds,true); 106 start = KGlobal::locale()->formatDate(ds,true);
107 de = ds.addDays( days); 107 de = ds.addDays( days);
108 end = KGlobal::locale()->formatDate(de,true); 108 end = KGlobal::locale()->formatDate(de,true);
109 } 109 }
110 110
111 } 111 }
112 if ( ! ok ) { 112 if ( ! ok ) {
113 start =e->dtStartDateStr(); 113 start =e->dtStartDateStr();
114 end = e->dtEndDateStr(); 114 end = e->dtEndDateStr();
115 ds = e->dtStart().date(); 115 ds = e->dtStart().date();
116 de = e->dtEnd().date(); 116 de = e->dtEnd().date();
117 } 117 }
118 mItem->setText(0,e->summary()); 118 mItem->setText(0,e->summary());
119 mItem->setText(1,start); 119 mItem->setText(1,start);
120 mItem->setText(2,e->dtStartTimeStr()); 120 mItem->setText(2,e->dtStartTimeStr());
121 mItem->setText(3,end); 121 mItem->setText(3,end);
122 mItem->setText(4,e->dtEndTimeStr()); 122 mItem->setText(4,e->dtEndTimeStr());
123 mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No")); 123 if ( e->isAlarmEnabled() ) {
124 mItem->setText(5,e->alarms().first()->offsetText() );
125 } else {
126 mItem->setText(5, i18n("No"));
127 }
124 mItem->setText(6, e->recurrence()->recurrenceText()); 128 mItem->setText(6, e->recurrence()->recurrenceText());
125 mItem->setText(7,"---"); 129 mItem->setText(7,"---");
126 mItem->setText(8,"---"); 130 mItem->setText(8,"---");
127 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); 131 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No"));
128 mItem->setText(10,e->categoriesStr()); 132 mItem->setText(10,e->categoriesStr());
129 133
130 QString key; 134 QString key;
131 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); 135 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time();
132 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); 136 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute());
133 mItem->setSortKey(1,key); 137 mItem->setSortKey(1,key);
134 138
135 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); 139 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time();
136 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); 140 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute());
137 mItem->setSortKey(3,key); 141 mItem->setSortKey(3,key);
138 142
139 return true; 143 return true;
140} 144}
141 145
142bool ListItemVisitor::visit(Todo *t) 146bool ListItemVisitor::visit(Todo *t)
143{ 147{
144 mItem->setText(0,i18n("Todo: %1").arg(t->summary())); 148 mItem->setText(0,i18n("Todo: %1").arg(t->summary()));
145 if (t->hasStartDate()) { 149 if (t->hasStartDate()) {
146 mItem->setText(1,t->dtStartDateStr()); 150 mItem->setText(1,t->dtStartDateStr());
147 if (t->doesFloat()) { 151 if (t->doesFloat()) {
148 mItem->setText(2,"---"); 152 mItem->setText(2,"---");
149 } else { 153 } else {
150 mItem->setText(2,t->dtStartTimeStr()); 154 mItem->setText(2,t->dtStartTimeStr());
151 } 155 }
152 } else { 156 } else {
153 mItem->setText(1,"---"); 157 mItem->setText(1,"---");
154 mItem->setText(2,"---"); 158 mItem->setText(2,"---");
155 } 159 }
156 mItem->setText(3,"---"); 160 mItem->setText(3,"---");
157 mItem->setText(4,"---"); 161 mItem->setText(4,"---");
158 mItem->setText(5,t->isAlarmEnabled() ? i18n("Yes") : i18n("No")); 162 if ( t->isAlarmEnabled() ) {
163 mItem->setText(5,t->alarms().first()->offsetText() );
164 } else {
165 mItem->setText(5, i18n("No"));
166 }
159 mItem->setText(6, t->recurrence()->recurrenceText()); 167 mItem->setText(6, t->recurrence()->recurrenceText());
160 if (t->hasDueDate()) { 168 if (t->hasDueDate()) {
161 mItem->setText(7,t->dtDueDateStr()); 169 mItem->setText(7,t->dtDueDateStr());
162 if (t->doesFloat()) { 170 if (t->doesFloat()) {
163 mItem->setText(8,"---"); 171 mItem->setText(8,"---");
164 } else { 172 } else {
165 mItem->setText(8,t->dtDueTimeStr()); 173 mItem->setText(8,t->dtDueTimeStr());
166 } 174 }
167 } else { 175 } else {
168 mItem->setText(7,"---"); 176 mItem->setText(7,"---");
169 mItem->setText(8,"---"); 177 mItem->setText(8,"---");
170 } 178 }
171 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); 179 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No"));
172 mItem->setText(10,t->categoriesStr()); 180 mItem->setText(10,t->categoriesStr());
173 181
174 QString key; 182 QString key;
175 QDate d; 183 QDate d;
176 if (t->hasDueDate()) { 184 if (t->hasDueDate()) {
177 d = t->dtDue().date(); 185 d = t->dtDue().date();
178 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); 186 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time();
179 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 187 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
180 mItem->setSortKey(7,key); 188 mItem->setSortKey(7,key);
181 } 189 }
182 if ( t->hasStartDate() ) { 190 if ( t->hasStartDate() ) {
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 0a315cb..01cf0ff 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -197,52 +197,54 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e)
197 } 197 }
198 } 198 }
199 } 199 }
200 else { 200 else {
201 qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); 201 qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable ");
202 e->ignore(); 202 e->ignore();
203 } 203 }
204 } 204 }
205#endif 205#endif
206} 206}
207 207
208void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) 208void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
209{ 209{
210 210
211 QPoint p(contentsToViewport(e->pos())); 211 QPoint p(contentsToViewport(e->pos()));
212 QListViewItem *i = itemAt(p); 212 QListViewItem *i = itemAt(p);
213 bool rootClicked = true; 213 bool rootClicked = true;
214 if (i) { 214 if (i) {
215 // if the user clicked into the root decoration of the item, don't 215 // if the user clicked into the root decoration of the item, don't
216 // try to start a drag! 216 // try to start a drag!
217 int X = p.x(); 217 int X = p.x();
218 //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); 218 //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() );
219 if (X > header()->sectionPos(0) + 219 if (X > header()->sectionPos(0) +
220 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + 220 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) +
221 itemMargin() || 221 itemMargin() +i->height()||
222 X < header()->sectionPos(0)) { 222 X < header()->sectionPos(0)) {
223 rootClicked = false; 223 rootClicked = false;
224 } 224 }
225 } else {
226 rootClicked = false;
225 } 227 }
226#ifndef KORG_NODND 228#ifndef KORG_NODND
227 mMousePressed = false; 229 mMousePressed = false;
228 if (! rootClicked ) { 230 if (! rootClicked ) {
229 mPressPos = e->pos(); 231 mPressPos = e->pos();
230 mMousePressed = true; 232 mMousePressed = true;
231 } 233 }
232#endif 234#endif
233 //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); 235 //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked);
234#ifndef DESKTOP_VERSION 236#ifndef DESKTOP_VERSION
235 if (!( e->button() == RightButton && rootClicked) ) 237 if (!( e->button() == RightButton && rootClicked) )
236 QListView::contentsMousePressEvent(e); 238 QListView::contentsMousePressEvent(e);
237#else 239#else
238 QListView::contentsMousePressEvent(e); 240 QListView::contentsMousePressEvent(e);
239#endif 241#endif
240} 242}
241void KOTodoListView::paintEvent(QPaintEvent* e) 243void KOTodoListView::paintEvent(QPaintEvent* e)
242{ 244{
243 emit paintNeeded(); 245 emit paintNeeded();
244 QListView::paintEvent( e); 246 QListView::paintEvent( e);
245} 247}
246void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) 248void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e)
247{ 249{
248 250
@@ -709,81 +711,81 @@ void KOTodoView::updateView()
709 { 711 {
710 insertTodoItem(todo); 712 insertTodoItem(todo);
711 } 713 }
712 } 714 }
713 //qDebug("for end "); 715 //qDebug("for end ");
714 // Restore opened/closed state 716 // Restore opened/closed state
715 mTodoListView->blockSignals( true ); 717 mTodoListView->blockSignals( true );
716 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); 718 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() );
717 mTodoListView->blockSignals( false ); 719 mTodoListView->blockSignals( false );
718 resetCurrentItem(); 720 resetCurrentItem();
719 processSelectionChange(); 721 processSelectionChange();
720} 722}
721 723
722void KOTodoView::storeCurrentItem() 724void KOTodoView::storeCurrentItem()
723{ 725{
724 mCurItem = 0; 726 mCurItem = 0;
725 mCurItemRootParent = 0; 727 mCurItemRootParent = 0;
726 mCurItemAbove = 0; 728 mCurItemAbove = 0;
727 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 729 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
728 if (mActiveItem) { 730 if (mActiveItem) {
729 mCurItem = mActiveItem->todo(); 731 mCurItem = mActiveItem->todo();
730 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); 732 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove ();
731 if ( activeItemAbove ) 733 if ( activeItemAbove )
732 mCurItemAbove = activeItemAbove->todo(); 734 mCurItemAbove = activeItemAbove->todo();
733 while ( mActiveItem->parent() != 0 ) 735 mCurItemRootParent = mCurItem;
734 mActiveItem = (KOTodoViewItem*)mActiveItem->parent(); 736 while ( mCurItemRootParent->relatedTo() != 0 )
735 mCurItemRootParent = mActiveItem->todo(); 737 mCurItemRootParent = mCurItemRootParent->relatedTo();
736 } 738 }
737 mActiveItem = 0; 739 mActiveItem = 0;
738} 740}
739 741
740void KOTodoView::resetCurrentItem() 742void KOTodoView::resetCurrentItem()
741{ 743{
742 mTodoListView->setFocus(); 744 mTodoListView->setFocus();
743 KOTodoViewItem* foundItem = 0; 745 KOTodoViewItem* foundItem = 0;
744 KOTodoViewItem* foundItemRoot = 0; 746 KOTodoViewItem* foundItemRoot = 0;
745 KOTodoViewItem* foundItemAbove = 0; 747 KOTodoViewItem* foundItemAbove = 0;
746 if ( mTodoListView->firstChild () ) { 748 if ( mTodoListView->firstChild () ) {
747 if ( mCurItem ) { 749 if ( mCurItem ) {
748 KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); 750 KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild ();
749 while ( item ) { 751 while ( item ) {
750 if ( item->todo() == mCurItem ) { 752 if ( item->todo() == mCurItem ) {
751 foundItem = item; 753 foundItem = item;
752 break; 754 break;
753 } else if ( item->todo() == mCurItemAbove ) { 755 } else if ( item->todo() == mCurItemAbove ) {
754 foundItemAbove = item; 756 foundItemAbove = item;
755 757
756 } else if ( item->todo() == mCurItemRootParent ) { 758 } else if ( item->todo() == mCurItemRootParent ) {
757 foundItemRoot = item; 759 foundItemRoot = item;
758 } 760 }
759 item = (KOTodoViewItem*)item->itemBelow(); 761 item = (KOTodoViewItem*)item->itemBelow();
760 } 762 }
761 if ( ! foundItem ) { 763 if ( ! foundItem ) {
762 if ( foundItemAbove ) 764 if ( foundItemRoot )
763 foundItem = foundItemAbove;
764 else
765 foundItem = foundItemRoot; 765 foundItem = foundItemRoot;
766 else
767 foundItem = foundItemAbove;
766 } 768 }
767 } 769 }
768 if ( foundItem ) { 770 if ( foundItem ) {
769 mTodoListView->setCurrentItem( foundItem ); 771 mTodoListView->setCurrentItem( foundItem );
770 mTodoListView->ensureItemVisible( foundItem ); 772 mTodoListView->ensureItemVisible( foundItem );
771 } else { 773 } else {
772 mTodoListView->setCurrentItem( mTodoListView->firstChild () ); 774 mTodoListView->setCurrentItem( mTodoListView->firstChild () );
773 } 775 }
774 } 776 }
775 mTodoListView->setFocus(); 777 mTodoListView->setFocus();
776} 778}
777//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; 779//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove;
778bool KOTodoView::checkTodo( Todo * todo ) 780bool KOTodoView::checkTodo( Todo * todo )
779{ 781{
780 782
781 if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) 783 if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() )
782 return false; 784 return false;
783 if ( !todo->isCompleted() ) { 785 if ( !todo->isCompleted() ) {
784 if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) 786 if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() )
785 return true; 787 return true;
786 } 788 }
787 if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { 789 if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) {
788 if ( todo->hasStartDate() ) 790 if ( todo->hasStartDate() )
789 if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) 791 if ( mNavigator->selectedDates().last() < todo->dtStart().date() )
@@ -1184,99 +1186,107 @@ void KOTodoView::processSelectionChange()
1184 emit incidenceSelected( 0 ); 1186 emit incidenceSelected( 0 );
1185 } else { 1187 } else {
1186 emit incidenceSelected( item->todo() ); 1188 emit incidenceSelected( item->todo() );
1187 } 1189 }
1188} 1190}
1189 1191
1190void KOTodoView::modified(bool b) 1192void KOTodoView::modified(bool b)
1191{ 1193{
1192 emit isModified(b); 1194 emit isModified(b);
1193} 1195}
1194void KOTodoView::setTodoModified( Todo* todo ) 1196void KOTodoView::setTodoModified( Todo* todo )
1195{ 1197{
1196 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); 1198 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED );
1197} 1199}
1198void KOTodoView::clearSelection() 1200void KOTodoView::clearSelection()
1199{ 1201{
1200 mTodoListView->selectAll( false ); 1202 mTodoListView->selectAll( false );
1201} 1203}
1202void KOTodoView::setAllOpen() 1204void KOTodoView::setAllOpen()
1203{ 1205{
1204 if ( isFlatDisplay ) { 1206 if ( isFlatDisplay ) {
1205 isFlatDisplay = false; 1207 isFlatDisplay = false;
1206 mPopupMenu->setItemChecked( 8,false ); 1208 mPopupMenu->setItemChecked( 8,false );
1207 updateView(); 1209 updateView();
1210 } else {
1211 storeCurrentItem();
1208 } 1212 }
1209 setOpen(mTodoListView->firstChild(), true); 1213 setOpen(mTodoListView->firstChild(), true);
1214 resetCurrentItem();
1210} 1215}
1211void KOTodoView::setAllClose() 1216void KOTodoView::setAllClose()
1212{ 1217{
1213 if ( isFlatDisplay ) { 1218 if ( isFlatDisplay ) {
1214 isFlatDisplay = false; 1219 isFlatDisplay = false;
1215 mPopupMenu->setItemChecked( 8,false ); 1220 mPopupMenu->setItemChecked( 8,false );
1216 updateView(); 1221 updateView();
1222 } else {
1223 storeCurrentItem();
1217 } 1224 }
1218 setOpen(mTodoListView->firstChild(), false); 1225 setOpen(mTodoListView->firstChild(), false);
1226 resetCurrentItem();
1219} 1227}
1220void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) 1228void KOTodoView::setOpen( QListViewItem* item, bool setOpenI)
1221{ 1229{
1222 1230
1223 while ( item ) { 1231 while ( item ) {
1224 setOpen( item->firstChild(), setOpenI ); 1232 setOpen( item->firstChild(), setOpenI );
1225 item->setOpen( setOpenI ); 1233 item->setOpen( setOpenI );
1226 item = item->nextSibling(); 1234 item = item->nextSibling();
1227 } 1235 }
1228} 1236}
1229 1237
1230void KOTodoView::displayAllFlat() 1238void KOTodoView::displayAllFlat()
1231{ 1239{
1232 pendingSubtodo = 0; 1240 pendingSubtodo = 0;
1233 if ( mBlockUpdate ) { 1241 if ( mBlockUpdate ) {
1234 return; 1242 return;
1235 } 1243 }
1236 mPopupMenu->setItemChecked( 8,true ); 1244 mPopupMenu->setItemChecked( 8,true );
1237 isFlatDisplay = true; 1245 isFlatDisplay = true;
1238 QPtrList<Todo> todoList = calendar()->todos(); 1246 QPtrList<Todo> todoList = calendar()->todos();
1239 mTodoMap.clear(); 1247 mTodoMap.clear();
1240 mTodoListView->clear(); 1248 mTodoListView->clear();
1241 Todo *todo; 1249 Todo *todo;
1242 for(todo = todoList.first(); todo; todo = todoList.next()) { 1250 for(todo = todoList.first(); todo; todo = todoList.next()) {
1243 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); 1251 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
1244 mTodoMap.insert(todo,todoItem); 1252 mTodoMap.insert(todo,todoItem);
1245 } 1253 }
1246 mTodoListView->setFocus(); 1254 mTodoListView->setFocus();
1247 processSelectionChange(); 1255 processSelectionChange();
1248} 1256}
1249 1257
1250void KOTodoView::setAllFlat() 1258void KOTodoView::setAllFlat()
1251{ 1259{
1252 if ( isFlatDisplay ) { 1260 if ( isFlatDisplay ) {
1253 isFlatDisplay = false; 1261 isFlatDisplay = false;
1254 mPopupMenu->setItemChecked( 8,false ); 1262 mPopupMenu->setItemChecked( 8,false );
1255 updateView(); 1263 updateView();
1256 return; 1264 return;
1257 } 1265 }
1266 storeCurrentItem();
1258 displayAllFlat(); 1267 displayAllFlat();
1268 resetCurrentItem();
1259} 1269}
1260 1270
1261void KOTodoView::purgeCompleted() 1271void KOTodoView::purgeCompleted()
1262{ 1272{
1263 emit purgeCompletedSignal(); 1273 emit purgeCompletedSignal();
1264} 1274}
1265void KOTodoView::toggleQuickTodo() 1275void KOTodoView::toggleQuickTodo()
1266{ 1276{
1267 if ( mQuickAdd->isVisible() ) { 1277 if ( mQuickAdd->isVisible() ) {
1268 mQuickAdd->hide(); 1278 mQuickAdd->hide();
1269 KOPrefs::instance()->mEnableQuickTodo = false; 1279 KOPrefs::instance()->mEnableQuickTodo = false;
1270 } 1280 }
1271 else { 1281 else {
1272 mQuickAdd->show(); 1282 mQuickAdd->show();
1273 KOPrefs::instance()->mEnableQuickTodo = true; 1283 KOPrefs::instance()->mEnableQuickTodo = true;
1274 } 1284 }
1275 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); 1285 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo);
1276 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); 1286 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo );
1277} 1287}
1278 1288
1279void KOTodoView::toggleRunning() 1289void KOTodoView::toggleRunning()
1280{ 1290{
1281 KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; 1291 KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos;
1282 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); 1292 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp
index 1fc7169..d8f15b5 100644
--- a/libkcal/alarm.cpp
+++ b/libkcal/alarm.cpp
@@ -1,46 +1,47 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 1998 Preston Brown 3 Copyright (c) 1998 Preston Brown
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version. 9 version 2 of the License, or (at your option) any later version.
10 10
11 This library is distributed in the hope that it will be useful, 11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details. 14 Library General Public License for more details.
15 15
16 You should have received a copy of the GNU Library General Public License 16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to 17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. 19 Boston, MA 02111-1307, USA.
20*/ 20*/
21 21
22#include <kdebug.h> 22#include <kdebug.h>
23#include <klocale.h>
23 24
24#include "incidence.h" 25#include "incidence.h"
25#include "todo.h" 26#include "todo.h"
26 27
27#include "alarm.h" 28#include "alarm.h"
28 29
29using namespace KCal; 30using namespace KCal;
30#include <qwidget.h> 31#include <qwidget.h>
31Alarm::Alarm(Incidence *parent) 32Alarm::Alarm(Incidence *parent)
32 : mParent(parent), 33 : mParent(parent),
33 mType(Audio), 34 mType(Audio),
34 mDescription(""), // to make operator==() not fail 35 mDescription(""), // to make operator==() not fail
35 mFile(""), // to make operator==() not fail 36 mFile(""), // to make operator==() not fail
36 mMailSubject(""), // to make operator==() not fail 37 mMailSubject(""), // to make operator==() not fail
37 mAlarmSnoozeTime(5), 38 mAlarmSnoozeTime(5),
38 mAlarmRepeatCount(0), 39 mAlarmRepeatCount(0),
39 mEndOffset(false), 40 mEndOffset(false),
40 mHasTime(false), 41 mHasTime(false),
41 mAlarmEnabled(false) 42 mAlarmEnabled(false)
42{ 43{
43 44
44} 45}
45 46
46Alarm::~Alarm() 47Alarm::~Alarm()
@@ -328,48 +329,71 @@ QString Alarm::text() const
328} 329}
329 330
330void Alarm::setTime(const QDateTime &alarmTime) 331void Alarm::setTime(const QDateTime &alarmTime)
331{ 332{
332 mAlarmTime = alarmTime; 333 mAlarmTime = alarmTime;
333 mHasTime = true; 334 mHasTime = true;
334 335
335 mParent->updated(); 336 mParent->updated();
336} 337}
337int Alarm::offset() 338int Alarm::offset()
338{ 339{
339 if ( hasTime() ) { 340 if ( hasTime() ) {
340 if (mParent->type()=="Todo") { 341 if (mParent->type()=="Todo") {
341 Todo *t = static_cast<Todo*>(mParent); 342 Todo *t = static_cast<Todo*>(mParent);
342 return t->dtDue().secsTo( mAlarmTime ) ; 343 return t->dtDue().secsTo( mAlarmTime ) ;
343 } else 344 } else
344 return mParent->dtStart().secsTo( mAlarmTime ) ; 345 return mParent->dtStart().secsTo( mAlarmTime ) ;
345 } 346 }
346 else 347 else
347 { 348 {
348 return mOffset.asSeconds(); 349 return mOffset.asSeconds();
349 } 350 }
350 351
351} 352}
353QString Alarm::offsetText()
354{
355 int min = -offset()/60;
356 int hours = min /60;
357 min = min % 60;
358 int days = hours /24;
359 hours = hours % 24;
360 QString message;
361 qDebug("%d %d %d ", days, hours, min );
362 if ( days > 0 )
363 message += i18n("%1d").arg( days );
364 if ( hours > 0 ) {
365 if ( !message.isEmpty() ) message += "/";
366 message += i18n("%1h").arg( hours );
367 }
368 if ( min > 0 ) {
369 if ( !message.isEmpty() ) message += "/";
370 message += i18n("%1min").arg( min );
371 }
372 if ( message.isEmpty() )
373 message = i18n("%1min").arg( 0 );
374 return message;
375}
352 376
353 377
354QDateTime Alarm::time() const 378QDateTime Alarm::time() const
355{ 379{
356 if ( hasTime() ) 380 if ( hasTime() )
357 return mAlarmTime; 381 return mAlarmTime;
358 else 382 else
359 { 383 {
360 if (mParent->type()=="Todo") { 384 if (mParent->type()=="Todo") {
361 Todo *t = static_cast<Todo*>(mParent); 385 Todo *t = static_cast<Todo*>(mParent);
362 return mOffset.end( t->dtDue() ); 386 return mOffset.end( t->dtDue() );
363 } else if (mEndOffset) { 387 } else if (mEndOffset) {
364 return mOffset.end( mParent->dtEnd() ); 388 return mOffset.end( mParent->dtEnd() );
365 } else { 389 } else {
366 return mOffset.end( mParent->dtStart() ); 390 return mOffset.end( mParent->dtStart() );
367 } 391 }
368 } 392 }
369} 393}
370 394
371bool Alarm::hasTime() const 395bool Alarm::hasTime() const
372{ 396{
373 return mHasTime; 397 return mHasTime;
374} 398}
375 399
diff --git a/libkcal/alarm.h b/libkcal/alarm.h
index 682b626..ac6ea0d 100644
--- a/libkcal/alarm.h
+++ b/libkcal/alarm.h
@@ -38,48 +38,49 @@ class Incidence;
38class Alarm : public CustomProperties 38class Alarm : public CustomProperties
39{ 39{
40 public: 40 public:
41 enum Type { Invalid, Display, Procedure, Email, Audio }; 41 enum Type { Invalid, Display, Procedure, Email, Audio };
42 typedef QValueList<Alarm *> List; 42 typedef QValueList<Alarm *> List;
43 43
44 /** Construct a new alarm with variables initialized to "sane" values. */ 44 /** Construct a new alarm with variables initialized to "sane" values. */
45 explicit Alarm(Incidence *parent); 45 explicit Alarm(Incidence *parent);
46 /** Destruct Alarm object. */ 46 /** Destruct Alarm object. */
47 ~Alarm(); 47 ~Alarm();
48 48
49 /** Compare this alarm with another one. */ 49 /** Compare this alarm with another one. */
50 bool operator==(const Alarm &) const; 50 bool operator==(const Alarm &) const;
51 bool operator!=(const Alarm &a) const { return !operator==(a); } 51 bool operator!=(const Alarm &a) const { return !operator==(a); }
52 52
53 /** Set the type of the alarm. 53 /** Set the type of the alarm.
54 If the specified type is different from the current type of the alarm, 54 If the specified type is different from the current type of the alarm,
55 the alarm's type-specific properties are initialised to null. 55 the alarm's type-specific properties are initialised to null.
56 @param type type of alarm. 56 @param type type of alarm.
57 */ 57 */
58 void setType(Type type); 58 void setType(Type type);
59 /** Return the type of the alarm */ 59 /** Return the type of the alarm */
60 Type type() const; 60 Type type() const;
61 int offset(); 61 int offset();
62 QString offsetText();
62 /** Set the alarm to be a display alarm. 63 /** Set the alarm to be a display alarm.
63 @param text text to display when the alarm is triggered. 64 @param text text to display when the alarm is triggered.
64 */ 65 */
65 void setDisplayAlarm(const QString &text); 66 void setDisplayAlarm(const QString &text);
66 /** Set the text to be displayed when the alarm is triggered. 67 /** Set the text to be displayed when the alarm is triggered.
67 Ignored if the alarm is not a display alarm. 68 Ignored if the alarm is not a display alarm.
68 */ 69 */
69 void setText(const QString &text); 70 void setText(const QString &text);
70 /** Return the text string that displays when the alarm is triggered. */ 71 /** Return the text string that displays when the alarm is triggered. */
71 QString text() const; 72 QString text() const;
72 73
73 /** Set the alarm to be an audio alarm. 74 /** Set the alarm to be an audio alarm.
74 @param audioFile optional file to play when the alarm is triggered. 75 @param audioFile optional file to play when the alarm is triggered.
75 */ 76 */
76 void setAudioAlarm(const QString &audioFile = QString::null); 77 void setAudioAlarm(const QString &audioFile = QString::null);
77 /** Set the file to play when the audio alarm is triggered. 78 /** Set the file to play when the audio alarm is triggered.
78 Ignored if the alarm is not an audio alarm. 79 Ignored if the alarm is not an audio alarm.
79 */ 80 */
80 void setAudioFile(const QString &audioFile); 81 void setAudioFile(const QString &audioFile);
81 /** Return the name of the audio file for the alarm. 82 /** Return the name of the audio file for the alarm.
82 @return The audio file for the alarm, or QString::null if not an audio alarm. 83 @return The audio file for the alarm, or QString::null if not an audio alarm.
83 */ 84 */
84 QString audioFile() const; 85 QString audioFile() const;
85 86
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index e506a96..d67ad52 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -110,55 +110,56 @@ void KIncidenceFormatter::setEvent(Event *event)
110 110
111 bool ok; 111 bool ok;
112 QDate start = QDate::currentDate(); 112 QDate start = QDate::currentDate();
113 QDateTime next; 113 QDateTime next;
114 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); 114 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
115 if ( ok ) { 115 if ( ok ) {
116 addTag("p",i18n("<b>Next recurrence is on:</b>") ); 116 addTag("p",i18n("<b>Next recurrence is on:</b>") );
117 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); 117 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
118 118
119 } else { 119 } else {
120 bool last; 120 bool last;
121 QDate nextd; 121 QDate nextd;
122 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); 122 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
123 if ( last ) { 123 if ( last ) {
124 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 124 addTag("p",i18n("<b>Last recurrence was on:</b>") );
125 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); 125 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
126 } 126 }
127 } 127 }
128 } 128 }
129 129
130 130
131 if (event->isAlarmEnabled()) { 131 if (event->isAlarmEnabled()) {
132 Alarm *alarm =event->alarms().first() ; 132 Alarm *alarm =event->alarms().first() ;
133 QDateTime t = alarm->time(); 133 QDateTime t = alarm->time();
134 int min = t.secsTo( event->dtStart() )/60; 134 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
135 QString s =i18n("(%1 min before)").arg( min );
136 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate )); 135 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate ));
137 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 136 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
138 //addTag("p",s); 137 //addTag("p",s);
139 } 138 }
140 139
140
141
141 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); 142 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
142 // mText.append(event->secrecyStr()+"<br>"); 143 // mText.append(event->secrecyStr()+"<br>");
143 formatCategories(event); 144 formatCategories(event);
144 if ( mDetails ) { 145 if ( mDetails ) {
145 if (!event->description().isEmpty()) { 146 if (!event->description().isEmpty()) {
146 addTag("p",i18n("<b>Details: </b>")); 147 addTag("p",i18n("<b>Details: </b>"));
147 addTag("p",deTag(event->description())); 148 addTag("p",deTag(event->description()));
148 } 149 }
149 } 150 }
150 151
151 formatReadOnly(event); 152 formatReadOnly(event);
152 formatAttendees(event); 153 formatAttendees(event);
153 154
154 if ( mCreated ) { 155 if ( mCreated ) {
155 addTag("p",i18n("<b>Created: ") +" </b>"); 156 addTag("p",i18n("<b>Created: ") +" </b>");
156 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 157 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
157 158
158 } 159 }
159 if ( mModified ) { 160 if ( mModified ) {
160 addTag("p",i18n("<b>Last modified: ") +" </b>"); 161 addTag("p",i18n("<b>Last modified: ") +" </b>");
161 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 162 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
162 163
163 } 164 }
164 165
@@ -203,48 +204,57 @@ void KIncidenceFormatter::setTodo(Todo *event )
203 } 204 }
204 205
205 if (!event->location().isEmpty()) { 206 if (!event->location().isEmpty()) {
206 addTag("b",i18n("Location: ")); 207 addTag("b",i18n("Location: "));
207 mText.append(deTag(event->location())+"<br>"); 208 mText.append(deTag(event->location())+"<br>");
208 } 209 }
209 210
210 if (event->recurrence()->doesRecur()) { 211 if (event->recurrence()->doesRecur()) {
211 212
212 QString recurText = event->recurrence()->recurrenceText(); 213 QString recurText = event->recurrence()->recurrenceText();
213 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); 214 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
214 } 215 }
215 216
216 if (event->hasStartDate()) { 217 if (event->hasStartDate()) {
217 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate))); 218 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate)));
218 } 219 }
219 220
220 221
221 if (event->hasDueDate()) { 222 if (event->hasDueDate()) {
222 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); 223 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate)));
223 } 224 }
224 mText.append(i18n("<p><b>Priority:</b> %2</p>") 225 mText.append(i18n("<p><b>Priority:</b> %2</p>")
225 .arg(QString::number(event->priority()))); 226 .arg(QString::number(event->priority())));
226 227
228 if (event->isAlarmEnabled()) {
229 Alarm *alarm =event->alarms().first() ;
230 QDateTime t = alarm->time();
231 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
232 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
233 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
234 //addTag("p",s);
235 }
236
227 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); 237 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
228 formatCategories(event); 238 formatCategories(event);
229 if ( mDetails ) { 239 if ( mDetails ) {
230 if (!event->description().isEmpty()) { 240 if (!event->description().isEmpty()) {
231 addTag("p",i18n("<b>Details: </b>")); 241 addTag("p",i18n("<b>Details: </b>"));
232 addTag("p",deTag(event->description())); 242 addTag("p",deTag(event->description()));
233 } 243 }
234 } 244 }
235 formatReadOnly(event); 245 formatReadOnly(event);
236 formatAttendees(event); 246 formatAttendees(event);
237 if ( mCreated ) { 247 if ( mCreated ) {
238 addTag("p",i18n("<b>Created: ") +" </b>"); 248 addTag("p",i18n("<b>Created: ") +" </b>");
239 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 249 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
240 250
241 } 251 }
242 if ( mModified ) { 252 if ( mModified ) {
243 addTag("p",i18n("<b>Last modified: ") +" </b>"); 253 addTag("p",i18n("<b>Last modified: ") +" </b>");
244 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 254 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
245 255
246 } 256 }
247} 257}
248 258
249void KIncidenceFormatter::setJournal(Journal* ) 259void KIncidenceFormatter::setJournal(Journal* )
250{ 260{