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
@@ -1194,19 +1194,19 @@
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
@@ -1140,40 +1140,46 @@ void KOAgendaView::fillAgenda()
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] --------------
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 2f0fa9e..36a2947 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -370,26 +370,31 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
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()) {
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp
index 3979ed2..f6f7258 100644
--- a/korganizer/koeventviewerdialog.cpp
+++ b/korganizer/koeventviewerdialog.cpp
@@ -212,24 +212,25 @@ void KOEventViewerDialog::showIncidence()
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}
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index 2c45f21..c52f2b3 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -174,27 +174,33 @@ void KIncidenceFormatter::setTodo(Todo *event )
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
@@ -237,24 +243,25 @@ void KIncidenceFormatter::addTag(const QString & tag,const QString & text)
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();
@@ -297,26 +304,29 @@ void KIncidenceFormatter::formatAttendees(Incidence *event)
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
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 3d2de61..7362bdf 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -279,25 +279,28 @@ QString Todo::statusStr() const
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}
@@ -314,24 +317,26 @@ bool 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;