summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt2
-rw-r--r--korganizer/koagendaview.cpp16
-rw-r--r--korganizer/koeventviewer.cpp5
-rw-r--r--korganizer/koeventviewerdialog.cpp1
-rw-r--r--libkcal/kincidenceformatter.cpp16
-rw-r--r--libkcal/todo.cpp7
6 files changed, 37 insertions, 10 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index 0538511..eec0b38 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1174,39 +1174,39 @@
1174{ "FilterEditor","FilterEditor" }, 1174{ "FilterEditor","FilterEditor" },
1175{ "Include","Inclusive" }, 1175{ "Include","Inclusive" },
1176{ "Exclude","Exclusive" }, 1176{ "Exclude","Exclusive" },
1177{ "Edit Selection...","Editiere Auswahl" }, 1177{ "Edit Selection...","Editiere Auswahl" },
1178{ "recurring events","wiederholende Termine" }, 1178{ "recurring events","wiederholende Termine" },
1179{ "recurr. events","wiederh.Termine" }, 1179{ "recurr. events","wiederh.Termine" },
1180{ "completed to-dos","erledigte Todos" }, 1180{ "completed to-dos","erledigte Todos" },
1181{ "events","Termine" }, 1181{ "events","Termine" },
1182{ "todos","Todos" }, 1182{ "todos","Todos" },
1183{ "journals","Journale" }, 1183{ "journals","Journale" },
1184{ "public","öffentl." }, 1184{ "public","öffentl." },
1185{ "private","privat" }, 1185{ "private","privat" },
1186{ "confidential","vertraul." }, 1186{ "confidential","vertraul." },
1187{ "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Unter-Todos.\nAlle erledigten Unter-Todos\nwerden auch gelöscht!" }, 1187{ "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Unter-Todos.\nAlle erledigten Unter-Todos\nwerden auch gelöscht!" },
1188{ "Yesterday","Gestern" }, 1188{ "Yesterday","Gestern" },
1189{ "Day after tomorrow","Übermorgen" }, 1189{ "Day after tomorrow","Übermorgen" },
1190{ "Tomorrow","Morgen" }, 1190{ "Tomorrow","Morgen" },
1191{ "Day before yesterday","Vorgestern" }, 1191{ "Day before yesterday","Vorgestern" },
1192{ "Size %1","Größe %1" }, 1192{ "Size %1","Größe %1" },
1193{ "New Agendasize: %1","Neue Agendagröße: %1" }, 1193{ "New Agendasize: %1","Neue Agendagröße: %1" },
1194{ " (%1 y.)"," (%1 J.)" }, 1194{ " (%1 y.)"," (%1 J.)" },
1195{ "Allday:","Ganztägig:" }, 1195{ "Allday:","Ganztägig:" },
1196{ "compl.todos","erled.Todos" }, 1196{ "compl.todos","erled.Todos" },
1197{ "Day view","Tagesansicht" }, 1197{ "Day view","Tagesansicht" },
1198{ "Next days","Nächste Tage" }, 1198{ "Next days","Nächste Tage" },
1199{ "Next week","Nächste Woche" }, 1199{ "Next week","Nächste Woche" },
1200{ "Next two weeks","Nächste zwei Wochen" }, 1200{ "Next two weeks","Nächste zwei Wochen" },
1201{ "Next month","Nächster Monat" }, 1201{ "Next month","Nächster Monat" },
1202{ "Journal view","Journal" }, 1202{ "Journal view","Journal" },
1203{ "Display all opened","Zeige alle geöffnet" }, 1203{ "Display all opened","Zeige alle geöffnet" },
1204{ "Display all closed","Zeige alle geschlossen" }, 1204{ "Display all closed","Zeige alle geschlossen" },
1205{ "Display all flat","Zeige alle flach" }, 1205{ "Display all flat","Zeige alle flach" },
1206{ "","" }, 1206{ "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" },
1207{ "","" }, 1207{ "","" },
1208{ "","" }, 1208{ "","" },
1209{ "","" }, 1209{ "","" },
1210{ "","" }, 1210{ "","" },
1211{ "","" }, 1211{ "","" },
1212{ "","" }, 1212{ "","" },
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index e0a1a21..1864e22 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -1120,80 +1120,86 @@ void KOAgendaView::fillAgenda()
1120 } 1120 }
1121 int startY = mAgenda->timeToY(event->dtStart().time()); 1121 int startY = mAgenda->timeToY(event->dtStart().time());
1122 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; 1122 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1;
1123 //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); 1123 //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol );
1124 if ((beginX <= 0 && curCol == 0) || beginX == curCol) { 1124 if ((beginX <= 0 && curCol == 0) || beginX == curCol) {
1125 //qDebug("insert!!! "); 1125 //qDebug("insert!!! ");
1126 mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); 1126 mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY);
1127 } 1127 }
1128 if (beginX == curCol) { 1128 if (beginX == curCol) {
1129 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); 1129 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59));
1130 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1130 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1131 } else if (endX == curCol) { 1131 } else if (endX == curCol) {
1132 mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); 1132 mMinY[curCol] = mAgenda->timeToY(QTime(0,0));
1133 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1133 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1134 } else { 1134 } else {
1135 mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); 1135 mMinY[curCol] = mAgenda->timeToY(QTime(0,0));
1136 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); 1136 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59));
1137 } 1137 }
1138 } else { 1138 } else {
1139 int startY = mAgenda->timeToY(event->dtStart().time()); 1139 int startY = mAgenda->timeToY(event->dtStart().time());
1140 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; 1140 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1;
1141 if (endY < startY) endY = startY; 1141 if (endY < startY) endY = startY;
1142 mAgenda->insertItem(event,currentDate,curCol,startY,endY); 1142 mAgenda->insertItem(event,currentDate,curCol,startY,endY);
1143 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1143 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1144 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1144 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1145 } 1145 }
1146 } 1146 }
1147 // ---------- [display Todos -------------- 1147 // ---------- [display Todos --------------
1148 unsigned int numTodo; 1148 unsigned int numTodo;
1149 for (numTodo = 0; numTodo < todos.count(); ++numTodo) { 1149 for (numTodo = 0; numTodo < todos.count(); ++numTodo) {
1150 Todo *todo = todos.at(numTodo); 1150 Todo *todo = todos.at(numTodo);
1151 1151
1152 if ( ! todo->hasDueDate() ) continue; // todo shall not be displayed if it has no date 1152 if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date
1153 1153
1154 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. 1154 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
1155 // Already completed items can be displayed on their original due date 1155 // Already completed items can be displayed on their original due date
1156 //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda 1156 //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda
1157 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; 1157 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda;
1158 1158
1159 if ( ((todo->dtDue().date() == currentDate) && !overdue) || 1159 if ( ((todo->dtDue().date() == currentDate) && !overdue) || ( todo->hasCompletedDate() && todo->completed().date() == currentDate )||
1160 ((currentDate == today) && overdue) ) { 1160 ((currentDate == today) && overdue) ) {
1161 if ( todo->doesFloat() || overdue ) { // Todo has no due-time set or is already overdue 1161 if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue
1162 if ( KOPrefs::instance()->mShowTodoInAgenda ) 1162 if ( KOPrefs::instance()->mShowTodoInAgenda )
1163 mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); 1163 mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol);
1164 } 1164 }
1165 else { 1165 else {
1166 1166 QDateTime dt;
1167 int endY = mAgenda->timeToY(todo->dtDue().time()) - 1; 1167 if ( todo->hasCompletedDate() )
1168 dt = todo->completed();
1169 else
1170 dt = todo->dtDue();;
1171
1172
1173 int endY = mAgenda->timeToY(dt.time()) - 1;
1168 int hi = (18/KOPrefs::instance()->mHourSize); 1174 int hi = (18/KOPrefs::instance()->mHourSize);
1169 //qDebug("hei %d ",KOPrefs::instance()->mHourSize); 1175 //qDebug("hei %d ",KOPrefs::instance()->mHourSize);
1170 int startY = endY -hi; 1176 int startY = endY -hi;
1171 1177
1172 mAgenda->insertItem(todo,currentDate,curCol,startY,endY); 1178 mAgenda->insertItem(todo,currentDate,curCol,startY,endY);
1173 1179
1174 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1180 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1175 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1181 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1176 } 1182 }
1177 } 1183 }
1178 } 1184 }
1179 // ---------- display Todos] -------------- 1185 // ---------- display Todos] --------------
1180 1186
1181 ++curCol; 1187 ++curCol;
1182 } 1188 }
1183 mAgenda->hideUnused(); 1189 mAgenda->hideUnused();
1184 mAllDayAgenda->hideUnused(); 1190 mAllDayAgenda->hideUnused();
1185 mAgenda->checkScrollBoundaries(); 1191 mAgenda->checkScrollBoundaries();
1186 1192
1187 deleteSelectedDateTime(); 1193 deleteSelectedDateTime();
1188 1194
1189 createDayLabels(); 1195 createDayLabels();
1190 emit incidenceSelected( 0 ); 1196 emit incidenceSelected( 0 );
1191 1197
1192 if ( globalFlagBlockAgenda == 2 ) { 1198 if ( globalFlagBlockAgenda == 2 ) {
1193 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 1199 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
1194 setStartHour( KOPrefs::instance()->mDayBegins ); 1200 setStartHour( KOPrefs::instance()->mDayBegins );
1195 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 1201 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
1196 setStartHour( QTime::currentTime ().hour() ); 1202 setStartHour( QTime::currentTime ().hour() );
1197 // qApp->processEvents(); 1203 // qApp->processEvents();
1198 } 1204 }
1199 qApp->processEvents(); 1205 qApp->processEvents();
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 2f0fa9e..36a2947 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -350,66 +350,71 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
350 if (event->cancelled ()) { 350 if (event->cancelled ()) {
351 mText +="<font color=\"#B00000\">"; 351 mText +="<font color=\"#B00000\">";
352 addTag("i",i18n("This todo has been cancelled!")); 352 addTag("i",i18n("This todo has been cancelled!"));
353 mText.append("<br>"); 353 mText.append("<br>");
354 mText += "</font>"; 354 mText += "</font>";
355 mMailSubject += i18n("(cancelled)"); 355 mMailSubject += i18n("(cancelled)");
356 } 356 }
357 357
358 if (!event->location().isEmpty()) { 358 if (!event->location().isEmpty()) {
359 addTag("b",i18n("Location: ")); 359 addTag("b",i18n("Location: "));
360 mText.append(event->location()+"<br>"); 360 mText.append(event->location()+"<br>");
361 mMailSubject += i18n(" at ") + event->location(); 361 mMailSubject += i18n(" at ") + event->location();
362 } 362 }
363 if (event->hasStartDate()) { 363 if (event->hasStartDate()) {
364 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); 364 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer)));
365 } 365 }
366 if (event->hasDueDate()) { 366 if (event->hasDueDate()) {
367 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); 367 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer)));
368 mMailSubject += i18n(" - " )+event->dtDueStr( true ); 368 mMailSubject += i18n(" - " )+event->dtDueStr( true );
369 } 369 }
370 addTag("b",i18n("Access: ")); 370 addTag("b",i18n("Access: "));
371 mText.append(event->secrecyStr()+"<br>"); 371 mText.append(event->secrecyStr()+"<br>");
372 if (!event->description().isEmpty()) { 372 if (!event->description().isEmpty()) {
373 addTag("p",i18n("<b>Details: </b>")); 373 addTag("p",i18n("<b>Details: </b>"));
374 addTag("p",event->description()); 374 addTag("p",event->description());
375 } 375 }
376 376
377 formatCategories(event); 377 formatCategories(event);
378 378
379 mText.append(i18n("<p><b>Priority:</b> %2</p>") 379 mText.append(i18n("<p><b>Priority:</b> %2</p>")
380 .arg(QString::number(event->priority()))); 380 .arg(QString::number(event->priority())));
381 381
382 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
383 mText.append(i18n("<p><i>Completed on %1</i></p>")
384 .arg( event->completedStr() ));
385 } else {
382 mText.append(i18n("<p><i>%1 % completed</i></p>") 386 mText.append(i18n("<p><i>%1 % completed</i></p>")
383 .arg(event->percentComplete())); 387 .arg(event->percentComplete()));
388 }
384 389
385 formatReadOnly(event); 390 formatReadOnly(event);
386 formatAttendees(event); 391 formatAttendees(event);
387 if ( event->relatedTo() ) { 392 if ( event->relatedTo() ) {
388 addTag("b",i18n("Parent todo: ")); 393 addTag("b",i18n("Parent todo: "));
389 mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); 394 mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>");
390 } 395 }
391 QPtrList<Incidence> Relations = event->relations(); 396 QPtrList<Incidence> Relations = event->relations();
392 Incidence *to; 397 Incidence *to;
393 if ( Relations.first() ) 398 if ( Relations.first() )
394 addTag("b",i18n("Sub todos:<br>")); 399 addTag("b",i18n("Sub todos:<br>"));
395 for (to=Relations.first();to;to=Relations.next()) { 400 for (to=Relations.first();to;to=Relations.next()) {
396 mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); 401 mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>");
397 402
398 } 403 }
399 setText(mText); 404 setText(mText);
400} 405}
401 406
402void KOEventViewer::formatCategories(Incidence *event) 407void KOEventViewer::formatCategories(Incidence *event)
403{ 408{
404 if (!event->categoriesStr().isEmpty()) { 409 if (!event->categoriesStr().isEmpty()) {
405 if (event->categories().count() == 1) { 410 if (event->categories().count() == 1) {
406 addTag("h3",i18n("Category")); 411 addTag("h3",i18n("Category"));
407 } else { 412 } else {
408 addTag("h3",i18n("Categories")); 413 addTag("h3",i18n("Categories"));
409 } 414 }
410 addTag("p",event->categoriesStr()); 415 addTag("p",event->categoriesStr());
411 } 416 }
412} 417}
413void KOEventViewer::formatAttendees(Incidence *event) 418void KOEventViewer::formatAttendees(Incidence *event)
414{ 419{
415 QPtrList<Attendee> attendees = event->attendees(); 420 QPtrList<Attendee> attendees = event->attendees();
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp
index 3979ed2..f6f7258 100644
--- a/korganizer/koeventviewerdialog.cpp
+++ b/korganizer/koeventviewerdialog.cpp
@@ -192,64 +192,65 @@ void KOEventViewerDialog::editIncidence()
192 if ( mIncidence ){ 192 if ( mIncidence ){
193#ifndef DESKTOP_VERSION 193#ifndef DESKTOP_VERSION
194 hide(); 194 hide();
195#endif 195#endif
196 emit editIncidence( mIncidence ); 196 emit editIncidence( mIncidence );
197 } 197 }
198} 198}
199void KOEventViewerDialog::showIncidence() 199void KOEventViewerDialog::showIncidence()
200{ 200{
201 201
202 if ( mSyncMode ) { 202 if ( mSyncMode ) {
203 mSyncResult = 1; 203 mSyncResult = 1;
204 accept(); 204 accept();
205 return; 205 return;
206 } 206 }
207 207
208 if ( mIncidence ){ 208 if ( mIncidence ){
209#ifndef DESKTOP_VERSION 209#ifndef DESKTOP_VERSION
210 hide(); 210 hide();
211#endif 211#endif
212 QDate date; 212 QDate date;
213 if ( mIncidence->type() == "Todo" ) { 213 if ( mIncidence->type() == "Todo" ) {
214 /* 214 /*
215 if ( ((Todo*)mIncidence)->hasDueDate() ) 215 if ( ((Todo*)mIncidence)->hasDueDate() )
216 date = ((Todo*)mIncidence)->dtDue().date(); 216 date = ((Todo*)mIncidence)->dtDue().date();
217 else { 217 else {
218 globalFlagBlockAgenda = 2; 218 globalFlagBlockAgenda = 2;
219 emit showAgendaView( false ); 219 emit showAgendaView( false );
220 return; 220 return;
221 } 221 }
222 */ 222 */
223 ((Todo*)mIncidence)->setCompleted( true ); 223 ((Todo*)mIncidence)->setCompleted( true );
224 ((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() );
224 hide(); 225 hide();
225 emit todoCompleted(((Todo*)mIncidence)); 226 emit todoCompleted(((Todo*)mIncidence));
226 return; 227 return;
227 228
228 } else 229 } else
229 date = mIncidence->dtStart().date(); 230 date = mIncidence->dtStart().date();
230 globalFlagBlockAgenda = 1; 231 globalFlagBlockAgenda = 1;
231 emit showAgendaView( false ); 232 emit showAgendaView( false );
232 globalFlagBlockAgenda = 2; 233 globalFlagBlockAgenda = 2;
233 emit jumpToTime( date ); 234 emit jumpToTime( date );
234 } 235 }
235} 236}
236void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) 237void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e )
237{ 238{
238 switch ( e->key() ) { 239 switch ( e->key() ) {
239 240
240 case Qt::Key_A : 241 case Qt::Key_A :
241 case Qt::Key_L : 242 case Qt::Key_L :
242 showIncidence(); 243 showIncidence();
243 break; 244 break;
244 case Qt::Key_E : 245 case Qt::Key_E :
245 case Qt::Key_R : 246 case Qt::Key_R :
246 editIncidence(); 247 editIncidence();
247 break; 248 break;
248 case Qt::Key_C: 249 case Qt::Key_C:
249 case Qt::Key_Escape: 250 case Qt::Key_Escape:
250 close(); 251 close();
251 break; 252 break;
252 case Qt::Key_I: 253 case Qt::Key_I:
253 accept(); 254 accept();
254 break; 255 break;
255 default: 256 default:
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index 2c45f21..c52f2b3 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -154,175 +154,185 @@ void KIncidenceFormatter::setTodo(Todo *event )
154 else { 154 else {
155 if ( mColorMode == 1 ) { 155 if ( mColorMode == 1 ) {
156 mText +="<font color=\"#00A000\">"; 156 mText +="<font color=\"#00A000\">";
157 } 157 }
158 if ( mColorMode == 2 ) { 158 if ( mColorMode == 2 ) {
159 mText +="<font color=\"#B00000\">"; 159 mText +="<font color=\"#B00000\">";
160 } 160 }
161 if ( mode == 1 ) { 161 if ( mode == 1 ) {
162 addTag("h2",i18n( "Local: " ) +event->summary()); 162 addTag("h2",i18n( "Local: " ) +event->summary());
163 } else { 163 } else {
164 addTag("h2",i18n( "Remote: " ) +event->summary()); 164 addTag("h2",i18n( "Remote: " ) +event->summary());
165 } 165 }
166 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 166 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
167 if ( mColorMode ) 167 if ( mColorMode )
168 mText += "</font>"; 168 mText += "</font>";
169 } 169 }
170 if (event->cancelled ()) { 170 if (event->cancelled ()) {
171 mText +="<font color=\"#B00000\">"; 171 mText +="<font color=\"#B00000\">";
172 addTag("i",i18n("This todo has been cancelled!")); 172 addTag("i",i18n("This todo has been cancelled!"));
173 mText.append("<br>"); 173 mText.append("<br>");
174 mText += "</font>"; 174 mText += "</font>";
175 } 175 }
176 176
177 if (!event->location().isEmpty()) { 177 if (!event->location().isEmpty()) {
178 addTag("b",i18n("Location: ")); 178 addTag("b",i18n("Location: "));
179 mText.append(event->location()+"<br>"); 179 mText.append(event->location()+"<br>");
180 } 180 }
181 if (event->hasDueDate()) { 181 if (event->hasDueDate()) {
182 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); 182 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate)));
183 } 183 }
184 mText.append(i18n("<p><b>Priority:</b> %2</p>") 184 mText.append(i18n("<p><b>Priority:</b> %2</p>")
185 .arg(QString::number(event->priority()))); 185 .arg(QString::number(event->priority())));
186 186
187 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
188 mText.append(i18n("<p><i>Completed on %1</i></p>")
189 .arg( event->completedStr() ));
190 } else {
187 mText.append(i18n("<p><i>%1 % completed</i></p>") 191 mText.append(i18n("<p><i>%1 % completed</i></p>")
188 .arg(event->percentComplete())); 192 .arg(event->percentComplete()));
193 }
194
189 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); 195 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
190 formatCategories(event); 196 formatCategories(event);
191 if (!event->description().isEmpty()) { 197 if (!event->description().isEmpty()) {
192 addTag("p",i18n("<b>Details: </b>")); 198 addTag("p",i18n("<b>Details: </b>"));
193 addTag("p",event->description()); 199 addTag("p",event->description());
194 } 200 }
195 201
196 202
197 203
198 formatReadOnly(event); 204 formatReadOnly(event);
199 formatAttendees(event); 205 formatAttendees(event);
200 206
201} 207}
202 208
203void KIncidenceFormatter::setJournal(Journal* ) 209void KIncidenceFormatter::setJournal(Journal* )
204{ 210{
205 211
206} 212}
207 213
208void KIncidenceFormatter::formatCategories(Incidence *event) 214void KIncidenceFormatter::formatCategories(Incidence *event)
209{ 215{
210 if (!event->categoriesStr().isEmpty()) { 216 if (!event->categoriesStr().isEmpty()) {
211 addTag("p",i18n("<b>Categories: </b>")+event->categoriesStr() ); 217 addTag("p",i18n("<b>Categories: </b>")+event->categoriesStr() );
212 //mText.append(event->categoriesStr()); 218 //mText.append(event->categoriesStr());
213 } 219 }
214} 220}
215void KIncidenceFormatter::addTag(const QString & tag,const QString & text) 221void KIncidenceFormatter::addTag(const QString & tag,const QString & text)
216{ 222{
217 int number=text.contains("\n"); 223 int number=text.contains("\n");
218 QString str = "<" + tag + ">"; 224 QString str = "<" + tag + ">";
219 QString tmpText=text; 225 QString tmpText=text;
220 QString tmpStr=str; 226 QString tmpStr=str;
221 if(number !=-1) 227 if(number !=-1)
222 { 228 {
223 if (number > 0) { 229 if (number > 0) {
224 int pos=0; 230 int pos=0;
225 QString tmp; 231 QString tmp;
226 for(int i=0;i<=number;i++) { 232 for(int i=0;i<=number;i++) {
227 pos=tmpText.find("\n"); 233 pos=tmpText.find("\n");
228 tmp=tmpText.left(pos); 234 tmp=tmpText.left(pos);
229 tmpText=tmpText.right(tmpText.length()-pos-1); 235 tmpText=tmpText.right(tmpText.length()-pos-1);
230 tmpStr+=tmp+"<br>"; 236 tmpStr+=tmp+"<br>";
231 } 237 }
232 } 238 }
233 else tmpStr += tmpText; 239 else tmpStr += tmpText;
234 tmpStr+="</" + tag + ">"; 240 tmpStr+="</" + tag + ">";
235 mText.append(tmpStr); 241 mText.append(tmpStr);
236 } 242 }
237 else 243 else
238 { 244 {
239 str += text + "</" + tag + ">"; 245 str += text + "</" + tag + ">";
240 mText.append(str); 246 mText.append(str);
241 } 247 }
242} 248}
243 249
244void KIncidenceFormatter::formatAttendees(Incidence *event) 250void KIncidenceFormatter::formatAttendees(Incidence *event)
245{ 251{
246 QPtrList<Attendee> attendees = event->attendees(); 252 QPtrList<Attendee> attendees = event->attendees();
247 if (attendees.count()) { 253 if (attendees.count()) {
248 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); 254 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
255 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small);
249 addTag("h3",i18n("Organizer")); 256 addTag("h3",i18n("Organizer"));
250 mText.append("<ul><li>"); 257 mText.append("<ul><li>");
251#if 0 258#if 0
252 //ndef KORG_NOKABC 259 //ndef KORG_NOKABC
253 260
254 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 261 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
255 KABC::Addressee::List addressList; 262 KABC::Addressee::List addressList;
256 addressList = add_book->findByEmail(event->organizer()); 263 addressList = add_book->findByEmail(event->organizer());
257 KABC::Addressee o = addressList.first(); 264 KABC::Addressee o = addressList.first();
258 if (!o.isEmpty() && addressList.size()<2) { 265 if (!o.isEmpty() && addressList.size()<2) {
259 mText += "<a href=\"uid:" + o.uid() + "\">"; 266 mText += "<a href=\"uid:" + o.uid() + "\">";
260 mText += o.formattedName(); 267 mText += o.formattedName();
261 mText += "</a>\n"; 268 mText += "</a>\n";
262 } else { 269 } else {
263 mText.append(event->organizer()); 270 mText.append(event->organizer());
264 } 271 }
265#else 272#else
266 mText.append(event->organizer()); 273 mText.append(event->organizer());
267#endif 274#endif
268 if (iconPath) { 275 if (iconPath) {
269 mText += " <a href=\"mailto:" + event->organizer() + "\">"; 276 mText += " <a href=\"mailto:" + event->organizer() + "\">";
270 mText += "<IMG src=\"" + iconPath + "\">"; 277 mText += "<IMG src=\"" + iconPath + "\">";
271 mText += "</a>\n"; 278 mText += "</a>\n";
272 } 279 }
273 mText.append("</li></ul>"); 280 mText.append("</li></ul>");
274 281
275 addTag("h3",i18n("Attendees")); 282 addTag("h3",i18n("Attendees"));
276 Attendee *a; 283 Attendee *a;
277 mText.append("<ul>"); 284 mText.append("<ul>");
278 for(a=attendees.first();a;a=attendees.next()) { 285 for(a=attendees.first();a;a=attendees.next()) {
279#if 0 286#if 0
280//ndef KORG_NOKABC 287//ndef KORG_NOKABC
281 if (a->name().isEmpty()) { 288 if (a->name().isEmpty()) {
282 addressList = add_book->findByEmail(a->email()); 289 addressList = add_book->findByEmail(a->email());
283 KABC::Addressee o = addressList.first(); 290 KABC::Addressee o = addressList.first();
284 if (!o.isEmpty() && addressList.size()<2) { 291 if (!o.isEmpty() && addressList.size()<2) {
285 mText += "<a href=\"uid:" + o.uid() + "\">"; 292 mText += "<a href=\"uid:" + o.uid() + "\">";
286 mText += o.formattedName(); 293 mText += o.formattedName();
287 mText += "</a>\n"; 294 mText += "</a>\n";
288 } else { 295 } else {
289 mText += "<li>"; 296 mText += "<li>";
290 mText.append(a->email()); 297 mText.append(a->email());
291 mText += "\n"; 298 mText += "\n";
292 } 299 }
293 } else { 300 } else {
294 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 301 mText += "<li><a href=\"uid:" + a->uid() + "\">";
295 if (!a->name().isEmpty()) mText += a->name(); 302 if (!a->name().isEmpty()) mText += a->name();
296 else mText += a->email(); 303 else mText += a->email();
297 mText += "</a>\n"; 304 mText += "</a>\n";
298 } 305 }
299#else 306#else
300 //qDebug("nokabc "); 307 //qDebug("nokabc ");
301 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 308 mText += "<li><a href=\"uid:" + a->uid() + "\">";
302 if (!a->name().isEmpty()) mText += a->name(); 309 if (!a->name().isEmpty()) mText += a->name();
303 else mText += a->email(); 310 else mText += a->email();
304 mText += "</a>\n"; 311 mText += "</a>\n";
305#endif 312#endif
306 313
307 if (!a->email().isEmpty()) { 314 if (!a->email().isEmpty()) {
308 if (iconPath) { 315 if (iconPath) {
309 mText += "<a href=\"mailto:" + a->name() +" "+ "<" + a->email() + ">" + "\">"; 316 mText += "<a href=\"mailto:" + a->name() +" "+ "<" + a->email() + ">" + "\">";
310 mText += "<IMG src=\"" + iconPath + "\">"; 317 if ( a->RSVP() )
318 mText += "<IMG src=\"" + iconPath + "\">";
319 else
320 mText += "<IMG src=\"" + NOiconPath + "\">";
311 mText += "</a>\n"; 321 mText += "</a>\n";
312 } 322 }
313 } 323 }
314 if (a->status() != Attendee::NeedsAction ) 324 if (a->status() != Attendee::NeedsAction )
315 mText +="[" + a->statusStr() + "] "; 325 mText +="[" + a->statusStr() + "] ";
316 if (a->role() == Attendee::Chair ) 326 if (a->role() == Attendee::Chair )
317 mText +="(" + a->roleStr().left(1) + ".)"; 327 mText +="(" + a->roleStr().left(1) + ".)";
318 } 328 }
319 mText.append("</li></ul>"); 329 mText.append("</li></ul>");
320 } 330 }
321} 331}
322 332
323void KIncidenceFormatter::formatReadOnly(Incidence *event) 333void KIncidenceFormatter::formatReadOnly(Incidence *event)
324{ 334{
325 if (event->isReadOnly()) { 335 if (event->isReadOnly()) {
326 addTag("p","<em>(" + i18n("read-only") + ")</em>"); 336 addTag("p","<em>(" + i18n("read-only") + ")</em>");
327 } 337 }
328} 338}
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 3d2de61..7362bdf 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -259,99 +259,104 @@ QString Todo::statusStr() const
259 case SENT: 259 case SENT:
260 return QString("SENT"); 260 return QString("SENT");
261 break; 261 break;
262 case TENTATIVE: 262 case TENTATIVE:
263 return QString("TENTATIVE"); 263 return QString("TENTATIVE");
264 break; 264 break;
265 case CONFIRMED: 265 case CONFIRMED:
266 return QString("CONFIRMED"); 266 return QString("CONFIRMED");
267 break; 267 break;
268 case DECLINED: 268 case DECLINED:
269 return QString("DECLINED"); 269 return QString("DECLINED");
270 break; 270 break;
271 case COMPLETED: 271 case COMPLETED:
272 return QString("COMPLETED"); 272 return QString("COMPLETED");
273 break; 273 break;
274 case DELEGATED: 274 case DELEGATED:
275 return QString("DELEGATED"); 275 return QString("DELEGATED");
276 break; 276 break;
277 } 277 }
278 return QString(""); 278 return QString("");
279} 279}
280#endif 280#endif
281 281
282bool Todo::isCompleted() const 282bool Todo::isCompleted() const
283{ 283{
284 if (mPercentComplete == 100) return true; 284 if (mPercentComplete == 100) return true;
285 else return false; 285 else return false;
286} 286}
287 287
288void Todo::setCompleted(bool completed) 288void Todo::setCompleted(bool completed)
289{ 289{
290 if (completed) mPercentComplete = 100; 290 if (completed) mPercentComplete = 100;
291 else mPercentComplete = 0; 291 else {
292 mPercentComplete = 0;
293 mHasCompletedDate = false;
294 }
292 updated(); 295 updated();
293} 296}
294 297
295QDateTime Todo::completed() const 298QDateTime Todo::completed() const
296{ 299{
297 return mCompleted; 300 return mCompleted;
298} 301}
299 302
300QString Todo::completedStr() const 303QString Todo::completedStr() const
301{ 304{
302 return KGlobal::locale()->formatDateTime(mCompleted); 305 return KGlobal::locale()->formatDateTime(mCompleted);
303} 306}
304 307
305void Todo::setCompleted(const QDateTime &completed) 308void Todo::setCompleted(const QDateTime &completed)
306{ 309{
307 mHasCompletedDate = true; 310 mHasCompletedDate = true;
308 mPercentComplete = 100; 311 mPercentComplete = 100;
309 mCompleted = getEvenTime(completed); 312 mCompleted = getEvenTime(completed);
310 updated(); 313 updated();
311} 314}
312 315
313bool Todo::hasCompletedDate() const 316bool Todo::hasCompletedDate() const
314{ 317{
315 return mHasCompletedDate; 318 return mHasCompletedDate;
316} 319}
317 320
318int Todo::percentComplete() const 321int Todo::percentComplete() const
319{ 322{
320 return mPercentComplete; 323 return mPercentComplete;
321} 324}
322 325
323void Todo::setPercentComplete(int v) 326void Todo::setPercentComplete(int v)
324{ 327{
325 mPercentComplete = v; 328 mPercentComplete = v;
329 if ( v != 100 )
330 mHasCompletedDate = false;
326 updated(); 331 updated();
327} 332}
328QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const 333QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const
329{ 334{
330 if ( isCompleted() || ! hasDueDate() || cancelled() ) { 335 if ( isCompleted() || ! hasDueDate() || cancelled() ) {
331 *ok = false; 336 *ok = false;
332 return QDateTime (); 337 return QDateTime ();
333 } 338 }
334 QDateTime incidenceStart; 339 QDateTime incidenceStart;
335 incidenceStart = dtDue(); 340 incidenceStart = dtDue();
336 bool enabled = false; 341 bool enabled = false;
337 Alarm* alarm; 342 Alarm* alarm;
338 int off; 343 int off;
339 QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; 344 QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );;
340 // if ( QDateTime::currentDateTime() > incidenceStart ){ 345 // if ( QDateTime::currentDateTime() > incidenceStart ){
341// *ok = false; 346// *ok = false;
342// return incidenceStart; 347// return incidenceStart;
343// } 348// }
344 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { 349 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
345 if (alarm->enabled()) { 350 if (alarm->enabled()) {
346 if ( alarm->hasTime () ) { 351 if ( alarm->hasTime () ) {
347 if ( alarm->time() < alarmStart ) { 352 if ( alarm->time() < alarmStart ) {
348 alarmStart = alarm->time(); 353 alarmStart = alarm->time();
349 enabled = true; 354 enabled = true;
350 off = alarmStart.secsTo( incidenceStart ); 355 off = alarmStart.secsTo( incidenceStart );
351 } 356 }
352 357
353 } else { 358 } else {
354 int secs = alarm->startOffset().asSeconds(); 359 int secs = alarm->startOffset().asSeconds();
355 if ( incidenceStart.addSecs( secs ) < alarmStart ) { 360 if ( incidenceStart.addSecs( secs ) < alarmStart ) {
356 alarmStart = incidenceStart.addSecs( secs ); 361 alarmStart = incidenceStart.addSecs( secs );
357 enabled = true; 362 enabled = true;