summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt4
-rw-r--r--korganizer/calendarview.cpp14
-rw-r--r--korganizer/koagendaview.cpp15
-rw-r--r--korganizer/koeventviewer.cpp7
-rw-r--r--korganizer/kolistview.cpp2
-rw-r--r--korganizer/komonthview.cpp3
-rw-r--r--korganizer/kowhatsnextview.cpp6
-rw-r--r--libkcal/icalformatimpl.cpp2
-rw-r--r--libkcal/incidence.cpp8
-rw-r--r--libkcal/kincidenceformatter.cpp12
-rw-r--r--libkcal/todo.cpp4
11 files changed, 69 insertions, 8 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index c85ca35..2d4cb74 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1224,61 +1224,61 @@
1224{ "Sub todos:<br>","Unter Todos:<br>" }, 1224{ "Sub todos:<br>","Unter Todos:<br>" },
1225{ "Parent todo:<br>","Über Todo:<br>" }, 1225{ "Parent todo:<br>","Über Todo:<br>" },
1226{ "Set current as color category","Setze Gewählte als Farbkategorie" }, 1226{ "Set current as color category","Setze Gewählte als Farbkategorie" },
1227{ " completed"," erledigt" }, 1227{ " completed"," erledigt" },
1228{ "(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.net --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!","(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi basiert auf KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) und das KDE Team.\nKOrganizer/Pi ist lizensiert unter der GPL.\nKO/Pi kann kompiliert werden für\nLinux, Zaurus-PDA und Windows\nwww.pi-sync.net --- www.korganizer.org\nBesonderen Dank an Michael und Ben\nfür intensives Testen!" }, 1228{ "(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.net --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!","(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi basiert auf KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) und das KDE Team.\nKOrganizer/Pi ist lizensiert unter der GPL.\nKO/Pi kann kompiliert werden für\nLinux, Zaurus-PDA und Windows\nwww.pi-sync.net --- www.korganizer.org\nBesonderen Dank an Michael und Ben\nfür intensives Testen!" },
1229{ "Syncing aborted. Nothing synced.","Syncing abgebrochen.Nichts wurde gesynct." }, 1229{ "Syncing aborted. Nothing synced.","Syncing abgebrochen.Nichts wurde gesynct." },
1230{ "Connected! Sending request for remote file ...","Verbunden! Sende Daten Anfrage..." }, 1230{ "Connected! Sending request for remote file ...","Verbunden! Sende Daten Anfrage..." },
1231{ "Trying to connect to remote...","Versuche mit Gegenstelle zu verbinden..." }, 1231{ "Trying to connect to remote...","Versuche mit Gegenstelle zu verbinden..." },
1232{ "Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?","Verbindungsversuch wegen\nZeitüberschreitung gescheitert!\nWurde vergessen Pi-Sync auf\nder Gegenstelle anzuschalten?" }, 1232{ "Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?","Verbindungsversuch wegen\nZeitüberschreitung gescheitert!\nWurde vergessen Pi-Sync auf\nder Gegenstelle anzuschalten?" },
1233{ "ERROR: Receiving remote file failed.","FEHLER: Empfang der entfernten Daten fehlgeschlagen." }, 1233{ "ERROR: Receiving remote file failed.","FEHLER: Empfang der entfernten Daten fehlgeschlagen." },
1234{ "Error","Fehler" }, 1234{ "Error","Fehler" },
1235{ ""You entered an invalid date!\n Date changed to current date.","Ungültiges Datum eingegeben.\nSetze heutiges Datum." }, 1235{ ""You entered an invalid date!\n Date changed to current date.","Ungültiges Datum eingegeben.\nSetze heutiges Datum." },
1236{ "You entered an invalid date!\n Will use current date instead.","Ungültiges Datum eingegeben.\nSetze stattdessen heutiges Datum." }, 1236{ "You entered an invalid date!\n Will use current date instead.","Ungültiges Datum eingegeben.\nSetze stattdessen heutiges Datum." },
1237{ "Warning","Warnung" }, 1237{ "Warning","Warnung" },
1238{ "Select week number","Wähle Wochen Nummer" }, 1238{ "Select week number","Wähle Wochen Nummer" },
1239{ "Februar","Februar" }, 1239{ "Februar","Februar" },
1240{ "Click on the week number to\nshow week zoomed","Klicke auf die Wochennummer\num die Woche groß zu zeigen" }, 1240{ "Click on the week number to\nshow week zoomed","Klicke auf die Wochennummer\num die Woche groß zu zeigen" },
1241{ "W","W" }, 1241{ "W","W" },
1242{ "Click on this to\nselect week number","Klicke hierauf um\ndie Woche auszuwählen" }, 1242{ "Click on this to\nselect week number","Klicke hierauf um\ndie Woche auszuwählen" },
1243{ "T: %1","T: %1" }, 1243{ "T: %1","T: %1" },
1244{ "Start: ","Start: " }, 1244{ "Start: ","Start: " },
1245{ "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " }, 1245{ "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " },
1246{ "Password for remote access:","Passwort für fernen Zugriff:" }, 1246{ "Password for remote access:","Passwort für fernen Zugriff:" },
1247{ "Remote IP address:","Ferne IP Adresse:" }, 1247{ "Remote IP address:","Ferne IP Adresse:" },
1248{ "Remote port number:","Ferne Port Nummer:" }, 1248{ "Remote port number:","Ferne Port Nummer:" },
1249{ "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." }, 1249{ "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." },
1250{ "Remote from: ","Fern von: " }, 1250{ "Remote from: ","Fern von: " },
1251{ "Local from: ","Lokal von: " }, 1251{ "Local from: ","Lokal von: " },
1252{ "Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n","Synchronisationsübersicht:\n\n %d lokal hinzugefügt\n %d fern hinzugefügt\n %d lokal geändert\n %d fern geändert\n %d lokal gelöscht\n %d fern gelöscht\n %d eingehende ausgefiltert\n %d ausgehende ausgefiltert\n" }, 1252{ "Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n","Synchronisationsübersicht:\n\n %d lokal hinzugefügt\n %d fern hinzugefügt\n %d lokal geändert\n %d fern geändert\n %d lokal gelöscht\n %d fern gelöscht\n %d eingehende ausgefiltert\n %d ausgehende ausgefiltert\n" },
1253{ "Local calendar changed!\n","Lokaler Kalender geändert!\n" }, 1253{ "Local calendar changed!\n","Lokaler Kalender geändert!\n" },
1254{ "Write back","Schreibe zurück" }, 1254{ "Write back","Schreibe zurück" },
1255{ "KO/Pi Synchronization","KO/Pi Synchronisation" }, 1255{ "KO/Pi Synchronization","KO/Pi Synchronisation" },
1256{ "Pi-Sync succesful!","Pi-Sync erfolgreich!" }, 1256{ "Pi-Sync succesful!","Pi-Sync erfolgreich!" },
1257{ "Received sync request","Sync Anfrage erhalten" }, 1257{ "Received sync request","Sync Anfrage erhalten" },
1258{ "Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog.","Ferne Synchronisation ...\n\nBenutze diese Anwendung nicht!\n\nWenn das Syncen fehlschlägt kann\ndieser Dialog geschlossen werden." }, 1258{ "Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog.","Ferne Synchronisation ...\n\nBenutze diese Anwendung nicht!\n\nWenn das Syncen fehlschlägt kann\ndieser Dialog geschlossen werden." },
1259{ "Saving Data to temp file ...","Speichere Daten in temp Datei..." }, 1259{ "Saving Data to temp file ...","Speichere Daten in temp Datei..." },
1260{ "Data saved to temp file!","Daten in temp Datei gespeichert!" }, 1260{ "Data saved to temp file!","Daten in temp Datei gespeichert!" },
1261{ "Sending file...","Sende Datei..." }, 1261{ "Sending file...","Sende Datei..." },
1262{ "Waiting for synced file...","Warte auf gesyncte Daten..." }, 1262{ "Waiting for synced file...","Warte auf gesyncte Daten..." },
1263{ "Receiving synced file...","Gesyncte Daten erhalten..." }, 1263{ "Receiving synced file...","Gesyncte Daten erhalten..." },
1264{ "Received %1 bytes","%1 Bytes erhalten" }, 1264{ "Received %1 bytes","%1 Bytes erhalten" },
1265{ "Writing file to disk...","Speichere Datei..." }, 1265{ "Writing file to disk...","Speichere Datei..." },
1266{ "Pi-Sync successful!","Pi-Sync erfolgreich!" }, 1266{ "Pi-Sync successful!","Pi-Sync erfolgreich!" },
1267{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" }, 1267{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" },
1268{ "Synchronize!","Synchronisiere!" }, 1268{ "Synchronize!","Synchronisiere!" },
1269{ "High clock skew!","Großer Uhrzeitunterschied!" }, 1269{ "High clock skew!","Großer Uhrzeitunterschied!" },
1270{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" }, 1270{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" },
1271{ "The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!","Die Uhren der syncenden Geräte\nhaben einen Unterschied von\nmehr als 5 Minuten. Bitte die\nUhrzeiten anpassen. Sie können\nfalsche Sync-Resultate erhalten!\nBitte das Syncen bestätigen!" }, 1271{ "The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!","Die Uhren der syncenden Geräte\nhaben einen Unterschied von\nmehr als 5 Minuten. Bitte die\nUhrzeiten anpassen. Sie können\nfalsche Sync-Resultate erhalten!\nBitte das Syncen bestätigen!" },
1272{ "","" }, 1272{ "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." },
1273{ "","" }, 1273{ "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" },
1274{ "","" }, 1274{ "","" },
1275{ "","" }, 1275{ "","" },
1276{ "","" }, 1276{ "","" },
1277{ "","" }, 1277{ "","" },
1278{ "","" }, 1278{ "","" },
1279{ "","" }, 1279{ "","" },
1280{ "","" }, 1280{ "","" },
1281{ "","" }, 1281{ "","" },
1282{ "","" }, 1282{ "","" },
1283{ "","" }, 1283{ "","" },
1284{ "","" }, \ No newline at end of file 1284{ "","" }, \ No newline at end of file
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 7c8316f..3dac20b 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2218,105 +2218,117 @@ void CalendarView::edit_copy()
2218 return; 2218 return;
2219 } 2219 }
2220 DndFactory factory( mCalendar ); 2220 DndFactory factory( mCalendar );
2221 factory.copyIncidence(anEvent); 2221 factory.copyIncidence(anEvent);
2222} 2222}
2223 2223
2224void CalendarView::edit_paste() 2224void CalendarView::edit_paste()
2225{ 2225{
2226 QDate date = mNavigator->selectedDates().first(); 2226 QDate date = mNavigator->selectedDates().first();
2227 2227
2228 DndFactory factory( mCalendar ); 2228 DndFactory factory( mCalendar );
2229 Event *pastedEvent = (Event *)factory.pasteIncidence( date ); 2229 Event *pastedEvent = (Event *)factory.pasteIncidence( date );
2230 2230
2231 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2231 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2232} 2232}
2233 2233
2234void CalendarView::edit_options() 2234void CalendarView::edit_options()
2235{ 2235{
2236 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; 2236 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId;
2237 emit save(); 2237 emit save();
2238 emit saveStopTimer(); 2238 emit saveStopTimer();
2239 mDialogManager->showOptionsDialog(); 2239 mDialogManager->showOptionsDialog();
2240 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { 2240 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) {
2241 emit saveStopTimer(); 2241 emit saveStopTimer();
2242 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), 2242 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"),
2243 i18n("Timezone settings"),i18n("Reload"))) { 2243 i18n("Timezone settings"),i18n("Reload"))) {
2244 qDebug("KO: TZ reload cancelled "); 2244 qDebug("KO: TZ reload cancelled ");
2245 return; 2245 return;
2246 } 2246 }
2247 qDebug("KO: Timezone change "); 2247 qDebug("KO: Timezone change ");
2248 openCalendar( MainWindow::defaultFileName() ); 2248 openCalendar( MainWindow::defaultFileName() );
2249 setModified(true); 2249 setModified(true);
2250 } 2250 }
2251 else 2251 else
2252 qDebug("KO: No tz change "); 2252 qDebug("KO: No tz change ");
2253 2253
2254} 2254}
2255 2255
2256 2256
2257void CalendarView::slotSelectPickerDate( QDate d) 2257void CalendarView::slotSelectPickerDate( QDate d)
2258{ 2258{
2259 mDateFrame->hide(); 2259 mDateFrame->hide();
2260 if ( mDatePickerMode == 1 ) { 2260 if ( mDatePickerMode == 1 ) {
2261 mNavigator->slotDaySelect( d ); 2261 mNavigator->slotDaySelect( d );
2262 } else if ( mDatePickerMode == 2 ) { 2262 } else if ( mDatePickerMode == 2 ) {
2263 if ( mMoveIncidence->type() == "Todo" ) { 2263 if ( mMoveIncidence->type() == "Todo" ) {
2264 Todo * to = (Todo *) mMoveIncidence; 2264 Todo * to = (Todo *) mMoveIncidence;
2265 QTime tim; 2265 QTime tim;
2266 int len = 0;
2267 if ( to->hasStartDate() && to->hasDueDate() )
2268 len = to->dtStart().secsTo( to->dtDue());
2266 if ( to->hasDueDate() ) 2269 if ( to->hasDueDate() )
2267 tim = to->dtDue().time(); 2270 tim = to->dtDue().time();
2268 else { 2271 else {
2269 tim = QTime ( 0,0,0 ); 2272 tim = QTime ( 0,0,0 );
2270 to->setFloats( true ); 2273 to->setFloats( true );
2271 to->setHasDueDate( true ); 2274 to->setHasDueDate( true );
2272 } 2275 }
2273 QDateTime dt ( d,tim ); 2276 QDateTime dt ( d,tim );
2274 to->setDtDue( dt ); 2277 to->setDtDue( dt );
2278
2279 if ( to->hasStartDate() ) {
2280 if ( len>0 )
2281 to->setDtStart(to->dtDue().addSecs( -len ));
2282 else
2283 if (to->dtStart() > to->dtDue() )
2284 to->setDtStart(to->dtDue().addDays( -3 ));
2285 }
2286
2275 todoChanged( to ); 2287 todoChanged( to );
2276 } else { 2288 } else {
2277 if ( mMoveIncidence->doesRecur() ) { 2289 if ( mMoveIncidence->doesRecur() ) {
2278#if 0 2290#if 0
2279 // PENDING implement this 2291 // PENDING implement this
2280 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); 2292 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate );
2281 mCalendar()->addIncidence( newInc ); 2293 mCalendar()->addIncidence( newInc );
2282 if ( mMoveIncidence->type() == "Todo" ) 2294 if ( mMoveIncidence->type() == "Todo" )
2283 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); 2295 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
2284 else 2296 else
2285 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); 2297 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED);
2286 mMoveIncidence = newInc; 2298 mMoveIncidence = newInc;
2287 2299
2288#endif 2300#endif
2289 } 2301 }
2290 QTime tim = mMoveIncidence->dtStart().time(); 2302 QTime tim = mMoveIncidence->dtStart().time();
2291 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2303 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2292 QDateTime dt ( d,tim ); 2304 QDateTime dt ( d,tim );
2293 mMoveIncidence->setDtStart( dt ); 2305 mMoveIncidence->setDtStart( dt );
2294 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2306 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2295 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2307 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2296 } 2308 }
2297 2309
2298 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2310 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2299 } 2311 }
2300} 2312}
2301 2313
2302void CalendarView::removeCategories() 2314void CalendarView::removeCategories()
2303{ 2315{
2304 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2316 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2305 QStringList catList = KOPrefs::instance()->mCustomCategories; 2317 QStringList catList = KOPrefs::instance()->mCustomCategories;
2306 QStringList catIncList; 2318 QStringList catIncList;
2307 QStringList newCatList; 2319 QStringList newCatList;
2308 Incidence* inc = incList.first(); 2320 Incidence* inc = incList.first();
2309 int i; 2321 int i;
2310 int count = 0; 2322 int count = 0;
2311 while ( inc ) { 2323 while ( inc ) {
2312 newCatList.clear(); 2324 newCatList.clear();
2313 catIncList = inc->categories() ; 2325 catIncList = inc->categories() ;
2314 for( i = 0; i< catIncList.count(); ++i ) { 2326 for( i = 0; i< catIncList.count(); ++i ) {
2315 if ( catList.contains (catIncList[i])) 2327 if ( catList.contains (catIncList[i]))
2316 newCatList.append( catIncList[i] ); 2328 newCatList.append( catIncList[i] );
2317 } 2329 }
2318 newCatList.sort(); 2330 newCatList.sort();
2319 inc->setCategories( newCatList.join(",") ); 2331 inc->setCategories( newCatList.join(",") );
2320 inc = incList.next(); 2332 inc = incList.next();
2321 } 2333 }
2322} 2334}
@@ -3765,97 +3777,97 @@ void CalendarView::showIncidence(Incidence *incidence)
3765 ShowIncidenceVisitor v; 3777 ShowIncidenceVisitor v;
3766 v.act( incidence, this ); 3778 v.act( incidence, this );
3767 } 3779 }
3768} 3780}
3769 3781
3770void CalendarView::editIncidence(Incidence *incidence) 3782void CalendarView::editIncidence(Incidence *incidence)
3771{ 3783{
3772 if ( incidence ) { 3784 if ( incidence ) {
3773 3785
3774 EditIncidenceVisitor v; 3786 EditIncidenceVisitor v;
3775 v.act( incidence, this ); 3787 v.act( incidence, this );
3776 3788
3777 } 3789 }
3778} 3790}
3779 3791
3780void CalendarView::deleteIncidence(Incidence *incidence) 3792void CalendarView::deleteIncidence(Incidence *incidence)
3781{ 3793{
3782 //qDebug(" CalendarView::deleteIncidence "); 3794 //qDebug(" CalendarView::deleteIncidence ");
3783 if ( incidence ) { 3795 if ( incidence ) {
3784 DeleteIncidenceVisitor v; 3796 DeleteIncidenceVisitor v;
3785 v.act( incidence, this ); 3797 v.act( incidence, this );
3786 } 3798 }
3787} 3799}
3788 3800
3789 3801
3790void CalendarView::lookForOutgoingMessages() 3802void CalendarView::lookForOutgoingMessages()
3791{ 3803{
3792 OutgoingDialog *ogd = mDialogManager->outgoingDialog(); 3804 OutgoingDialog *ogd = mDialogManager->outgoingDialog();
3793 ogd->loadMessages(); 3805 ogd->loadMessages();
3794} 3806}
3795 3807
3796void CalendarView::lookForIncomingMessages() 3808void CalendarView::lookForIncomingMessages()
3797{ 3809{
3798 IncomingDialog *icd = mDialogManager->incomingDialog(); 3810 IncomingDialog *icd = mDialogManager->incomingDialog();
3799 icd->retrieve(); 3811 icd->retrieve();
3800} 3812}
3801 3813
3802bool CalendarView::removeCompletedSubTodos( Todo* t ) 3814bool CalendarView::removeCompletedSubTodos( Todo* t )
3803{ 3815{
3804 bool deleteTodo = true; 3816 bool deleteTodo = true;
3805 QPtrList<Incidence> subTodos; 3817 QPtrList<Incidence> subTodos;
3806 Incidence *aTodo; 3818 Incidence *aTodo;
3807 subTodos = t->relations(); 3819 subTodos = t->relations();
3808 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 3820 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
3809 if (! removeCompletedSubTodos( (Todo*) aTodo )) 3821 if (! removeCompletedSubTodos( (Todo*) aTodo ))
3810 deleteTodo = false; 3822 deleteTodo = false;
3811 } 3823 }
3812 if ( deleteTodo ) { 3824 if ( deleteTodo ) {
3813 if ( t->isCompleted() ) { 3825 if ( t->isCompleted() && !t->doesRecur()) {
3814 checkExternalId( t ); 3826 checkExternalId( t );
3815 mCalendar->deleteTodo( t ); 3827 mCalendar->deleteTodo( t );
3816 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 3828 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
3817 } 3829 }
3818 else 3830 else
3819 deleteTodo = false; 3831 deleteTodo = false;
3820 } 3832 }
3821 return deleteTodo; 3833 return deleteTodo;
3822 3834
3823} 3835}
3824void CalendarView::purgeCompleted() 3836void CalendarView::purgeCompleted()
3825{ 3837{
3826 int result = KMessageBox::warningContinueCancel(this, 3838 int result = KMessageBox::warningContinueCancel(this,
3827 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); 3839 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge"));
3828 3840
3829 if (result == KMessageBox::Continue) { 3841 if (result == KMessageBox::Continue) {
3830 3842
3831 QPtrList<Todo> todoCal; 3843 QPtrList<Todo> todoCal;
3832 QPtrList<Todo> rootTodos; 3844 QPtrList<Todo> rootTodos;
3833 //QPtrList<Incidence> rel; 3845 //QPtrList<Incidence> rel;
3834 Todo *aTodo;//, *rTodo; 3846 Todo *aTodo;//, *rTodo;
3835 Incidence *rIncidence; 3847 Incidence *rIncidence;
3836 bool childDelete = false; 3848 bool childDelete = false;
3837 bool deletedOne = true; 3849 bool deletedOne = true;
3838 todoCal = calendar()->todos(); 3850 todoCal = calendar()->todos();
3839 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 3851 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
3840 if ( !aTodo->relatedTo() ) 3852 if ( !aTodo->relatedTo() )
3841 rootTodos.append( aTodo ); 3853 rootTodos.append( aTodo );
3842 } 3854 }
3843 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 3855 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
3844 removeCompletedSubTodos( aTodo ); 3856 removeCompletedSubTodos( aTodo );
3845 } 3857 }
3846 3858
3847 updateView(); 3859 updateView();
3848 } 3860 }
3849} 3861}
3850 3862
3851void CalendarView::slotCalendarChanged() 3863void CalendarView::slotCalendarChanged()
3852{ 3864{
3853 ; 3865 ;
3854} 3866}
3855 3867
3856void CalendarView::keyPressEvent ( QKeyEvent *e) 3868void CalendarView::keyPressEvent ( QKeyEvent *e)
3857{ 3869{
3858 //qDebug(" alendarView::keyPressEvent "); 3870 //qDebug(" alendarView::keyPressEvent ");
3859 e->ignore(); 3871 e->ignore();
3860} 3872}
3861 3873
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 13d8398..4ff6899 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -954,97 +954,110 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type)
954 } else { 954 } else {
955 if (item->cellX() < 0) { 955 if (item->cellX() < 0) {
956 startDate = (mSelectedDates.first()).addDays(item->cellX()); 956 startDate = (mSelectedDates.first()).addDays(item->cellX());
957 } else { 957 } else {
958 startDate = mSelectedDates[item->cellX()]; 958 startDate = mSelectedDates[item->cellX()];
959 } 959 }
960 } 960 }
961 startDt.setDate(startDate); 961 startDt.setDate(startDate);
962 962
963 if (item->incidence()->doesFloat()) { 963 if (item->incidence()->doesFloat()) {
964 endDt.setDate(startDate.addDays(item->cellWidth() - 1)); 964 endDt.setDate(startDate.addDays(item->cellWidth() - 1));
965 } else { 965 } else {
966 if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) 966 if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE )
967 startDt.setTime(mAgenda->gyToTime(item->cellYTop())); 967 startDt.setTime(mAgenda->gyToTime(item->cellYTop()));
968 if ( item->incidence()->type() == "Event" ) { 968 if ( item->incidence()->type() == "Event" ) {
969 if ( type == KOAgenda::MOVE ) { 969 if ( type == KOAgenda::MOVE ) {
970 endDt = startDt.addSecs(lenInSecs); 970 endDt = startDt.addSecs(lenInSecs);
971 971
972 } else if ( type == KOAgenda::RESIZEBOTTOM ) { 972 } else if ( type == KOAgenda::RESIZEBOTTOM ) {
973 if (item->lastMultiItem()) { 973 if (item->lastMultiItem()) {
974 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); 974 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1));
975 endDt.setDate(startDate. 975 endDt.setDate(startDate.
976 addDays(item->lastMultiItem()->cellX() - item->cellX())); 976 addDays(item->lastMultiItem()->cellX() - item->cellX()));
977 } else { 977 } else {
978 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); 978 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1));
979 endDt.setDate(startDate); 979 endDt.setDate(startDate);
980 } 980 }
981 } 981 }
982 } else { 982 } else {
983 // todo 983 // todo
984 if (item->lastMultiItem()) { 984 if (item->lastMultiItem()) {
985 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); 985 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1));
986 endDt.setDate(startDate. 986 endDt.setDate(startDate.
987 addDays(item->lastMultiItem()->cellX() - item->cellX())); 987 addDays(item->lastMultiItem()->cellX() - item->cellX()));
988 } else { 988 } else {
989 //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); 989 //qDebug("tem->cellYBottom() %d",item->cellYBottom() );
990 if ( item->cellYBottom() > 0 ) 990 if ( item->cellYBottom() > 0 )
991 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); 991 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1));
992 else 992 else
993 endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); 993 endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time());
994 endDt.setDate(startDate); 994 endDt.setDate(startDate);
995 } 995 }
996 } 996 }
997 } 997 }
998 if ( item->incidence()->type() == "Event" ) { 998 if ( item->incidence()->type() == "Event" ) {
999 item->incidence()->setDtStart(startDt); 999 item->incidence()->setDtStart(startDt);
1000 (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); 1000 (static_cast<Event*>(item->incidence()))->setDtEnd(endDt);
1001 } else if ( item->incidence()->type() == "Todo" ) { 1001 } else if ( item->incidence()->type() == "Todo" ) {
1002 (static_cast<Todo*>(item->incidence()))->setDtDue(endDt); 1002 Todo* to = static_cast<Todo*>(item->incidence());
1003
1004 int len = 0;
1005 if ( to->hasStartDate() && to->hasDueDate() )
1006 len = to->dtStart().secsTo( to->dtDue());
1007 to->setDtDue(endDt);
1008 if ( to->hasStartDate() ) {
1009 if ( len>0 )
1010 to->setDtStart(to->dtDue().addSecs( -len ));
1011 else
1012 if (to->dtStart() > to->dtDue() )
1013 to->setDtStart(to->dtDue().addDays( -3 ));
1014 }
1015
1003 } 1016 }
1004 //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); 1017 //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() );
1005 item->incidence()->setRevision(item->incidence()->revision()+1); 1018 item->incidence()->setRevision(item->incidence()->revision()+1);
1006 item->setItemDate(startDt.date()); 1019 item->setItemDate(startDt.date());
1007 //item->updateItem(); 1020 //item->updateItem();
1008 if ( item->incidence()->type() == "Todo" ) { 1021 if ( item->incidence()->type() == "Todo" ) {
1009 emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); 1022 emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED );
1010 1023
1011 } 1024 }
1012 else 1025 else
1013 emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); 1026 emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED);
1014 item->updateItem(); 1027 item->updateItem();
1015} 1028}
1016 1029
1017void KOAgendaView::showDates( const QDate &start, const QDate &end ) 1030void KOAgendaView::showDates( const QDate &start, const QDate &end )
1018{ 1031{
1019 // kdDebug() << "KOAgendaView::selectDates" << endl; 1032 // kdDebug() << "KOAgendaView::selectDates" << endl;
1020 1033
1021 mSelectedDates.clear(); 1034 mSelectedDates.clear();
1022 // qDebug("KOAgendaView::showDates "); 1035 // qDebug("KOAgendaView::showDates ");
1023 QDate d = start; 1036 QDate d = start;
1024 while (d <= end) { 1037 while (d <= end) {
1025 mSelectedDates.append(d); 1038 mSelectedDates.append(d);
1026 d = d.addDays( 1 ); 1039 d = d.addDays( 1 );
1027 } 1040 }
1028 1041
1029 // and update the view 1042 // and update the view
1030 fillAgenda(); 1043 fillAgenda();
1031} 1044}
1032 1045
1033 1046
1034void KOAgendaView::showEvents(QPtrList<Event>) 1047void KOAgendaView::showEvents(QPtrList<Event>)
1035{ 1048{
1036 kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; 1049 kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl;
1037} 1050}
1038 1051
1039void KOAgendaView::changeEventDisplay(Event *, int) 1052void KOAgendaView::changeEventDisplay(Event *, int)
1040{ 1053{
1041 // qDebug("KOAgendaView::changeEventDisplay "); 1054 // qDebug("KOAgendaView::changeEventDisplay ");
1042 // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; 1055 // kdDebug() << "KOAgendaView::changeEventDisplay" << endl;
1043 // this should be re-written to be MUCH smarter. Right now we 1056 // this should be re-written to be MUCH smarter. Right now we
1044 // are just playing dumb. 1057 // are just playing dumb.
1045 fillAgenda(); 1058 fillAgenda();
1046} 1059}
1047 1060
1048void KOAgendaView::fillAgenda(const QDate &) 1061void KOAgendaView::fillAgenda(const QDate &)
1049{ 1062{
1050 // qDebug("KOAgendaView::fillAgenda "); 1063 // qDebug("KOAgendaView::fillAgenda ");
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 39921a0..f6c9624 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -357,96 +357,103 @@ void KOEventViewer::appendEvent(Event *event, int mode )
357void KOEventViewer::appendTodo(Todo *event, int mode ) 357void KOEventViewer::appendTodo(Todo *event, int mode )
358{ 358{
359 mMailSubject = ""; 359 mMailSubject = "";
360 mCurrentIncidence = event; 360 mCurrentIncidence = event;
361 topLevelWidget()->setCaption(i18n("Todo Viewer")); 361 topLevelWidget()->setCaption(i18n("Todo Viewer"));
362 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 362 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
363 if (mode == 0 ) 363 if (mode == 0 )
364 addTag("h2",event->summary()); 364 addTag("h2",event->summary());
365 else { 365 else {
366 if ( mColorMode == 1 ) { 366 if ( mColorMode == 1 ) {
367 mText +="<font color=\"#00A000\">"; 367 mText +="<font color=\"#00A000\">";
368 } 368 }
369 if ( mColorMode == 2 ) { 369 if ( mColorMode == 2 ) {
370 mText +="<font color=\"#B00000\">"; 370 mText +="<font color=\"#B00000\">";
371 } 371 }
372 if ( mode == 1 ) { 372 if ( mode == 1 ) {
373 addTag("h2",i18n( "Local: " ) +event->summary()); 373 addTag("h2",i18n( "Local: " ) +event->summary());
374 } else { 374 } else {
375 addTag("h2",i18n( "Remote: " ) +event->summary()); 375 addTag("h2",i18n( "Remote: " ) +event->summary());
376 } 376 }
377 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 377 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
378 if ( mColorMode ) 378 if ( mColorMode )
379 mText += "</font>"; 379 mText += "</font>";
380 } 380 }
381 mMailSubject += i18n( "Todo " )+ event->summary(); 381 mMailSubject += i18n( "Todo " )+ event->summary();
382 382
383 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { 383 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
384 mText +="<font color=\"#B00000\">"; 384 mText +="<font color=\"#B00000\">";
385 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); 385 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) );
386 mText += "</font>"; 386 mText += "</font>";
387 } else { 387 } else {
388 mText.append(i18n("<p><i>%1 % completed</i></p>") 388 mText.append(i18n("<p><i>%1 % completed</i></p>")
389 .arg(event->percentComplete())); 389 .arg(event->percentComplete()));
390 } 390 }
391 391
392 if (event->cancelled ()) { 392 if (event->cancelled ()) {
393 mText +="<font color=\"#B00000\">"; 393 mText +="<font color=\"#B00000\">";
394 addTag("i",i18n("This todo has been cancelled!")); 394 addTag("i",i18n("This todo has been cancelled!"));
395 mText.append("<br>"); 395 mText.append("<br>");
396 mText += "</font>"; 396 mText += "</font>";
397 mMailSubject += i18n("(cancelled)"); 397 mMailSubject += i18n("(cancelled)");
398 } 398 }
399 399
400 if (!event->location().isEmpty()) { 400 if (!event->location().isEmpty()) {
401 addTag("b",i18n("Location: ")); 401 addTag("b",i18n("Location: "));
402 mText.append(event->location()+"<br>"); 402 mText.append(event->location()+"<br>");
403 mMailSubject += i18n(" at ") + event->location(); 403 mMailSubject += i18n(" at ") + event->location();
404 } 404 }
405
406 if (event->recurrence()->doesRecur()) {
407
408 QString recurText = event->recurrence()->recurrenceText();
409 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
410
411 }
405 if (event->hasStartDate()) { 412 if (event->hasStartDate()) {
406 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); 413 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer)));
407 } 414 }
408 if (event->hasDueDate()) { 415 if (event->hasDueDate()) {
409 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); 416 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer)));
410 mMailSubject += i18n(" - " )+event->dtDueStr( true ); 417 mMailSubject += i18n(" - " )+event->dtDueStr( true );
411 } 418 }
412 addTag("b",i18n("Access: ")); 419 addTag("b",i18n("Access: "));
413 mText.append(event->secrecyStr()+"<br>"); 420 mText.append(event->secrecyStr()+"<br>");
414 if (!event->description().isEmpty()) { 421 if (!event->description().isEmpty()) {
415 addTag("p",i18n("<b>Details: </b>")); 422 addTag("p",i18n("<b>Details: </b>"));
416 addTag("p",event->description()); 423 addTag("p",event->description());
417 } 424 }
418 425
419 formatCategories(event); 426 formatCategories(event);
420 427
421 mText.append(i18n("<p><b>Priority:</b> %2</p>") 428 mText.append(i18n("<p><b>Priority:</b> %2</p>")
422 .arg(QString::number(event->priority()))); 429 .arg(QString::number(event->priority())));
423 430
424 formatReadOnly(event); 431 formatReadOnly(event);
425 formatAttendees(event); 432 formatAttendees(event);
426 if ( event->relatedTo() ) { 433 if ( event->relatedTo() ) {
427 addTag("b",i18n("Parent todo:<br>")); 434 addTag("b",i18n("Parent todo:<br>"));
428 mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); 435 mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>");
429 } 436 }
430 QPtrList<Incidence> Relations = event->relations(); 437 QPtrList<Incidence> Relations = event->relations();
431 Incidence *to; 438 Incidence *to;
432 if ( Relations.first() ) 439 if ( Relations.first() )
433 addTag("b",i18n("Sub todos:<br>")); 440 addTag("b",i18n("Sub todos:<br>"));
434 for (to=Relations.first();to;to=Relations.next()) { 441 for (to=Relations.first();to;to=Relations.next()) {
435 mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); 442 mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>");
436 443
437 } 444 }
438 setText(mText); 445 setText(mText);
439} 446}
440 447
441void KOEventViewer::formatCategories(Incidence *event) 448void KOEventViewer::formatCategories(Incidence *event)
442{ 449{
443 if (!event->categoriesStr().isEmpty()) { 450 if (!event->categoriesStr().isEmpty()) {
444 if (event->categories().count() == 1) { 451 if (event->categories().count() == 1) {
445 addTag("h3",i18n("Category")); 452 addTag("h3",i18n("Category"));
446 } else { 453 } else {
447 addTag("h3",i18n("Categories")); 454 addTag("h3",i18n("Categories"));
448 } 455 }
449 addTag("p",event->categoriesStr()); 456 addTag("p",event->categoriesStr());
450 } 457 }
451} 458}
452void KOEventViewer::formatAttendees(Incidence *event) 459void KOEventViewer::formatAttendees(Incidence *event)
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index acd9265..d8e940b 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -111,97 +111,97 @@ bool ListItemVisitor::visit(Event *e)
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 mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No"));
124 mItem->setText(6, e->recurrence()->recurrenceText()); 124 mItem->setText(6, e->recurrence()->recurrenceText());
125 mItem->setText(7,"---"); 125 mItem->setText(7,"---");
126 mItem->setText(8,"---"); 126 mItem->setText(8,"---");
127 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); 127 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No"));
128 mItem->setText(10,e->categoriesStr()); 128 mItem->setText(10,e->categoriesStr());
129 129
130 QString key; 130 QString key;
131 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); 131 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()); 132 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute());
133 mItem->setSortKey(1,key); 133 mItem->setSortKey(1,key);
134 134
135 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); 135 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()); 136 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute());
137 mItem->setSortKey(3,key); 137 mItem->setSortKey(3,key);
138 138
139 return true; 139 return true;
140} 140}
141 141
142bool ListItemVisitor::visit(Todo *t) 142bool ListItemVisitor::visit(Todo *t)
143{ 143{
144 mItem->setText(0,i18n("To-Do: %1").arg(t->summary())); 144 mItem->setText(0,i18n("To-Do: %1").arg(t->summary()));
145 if (t->hasStartDate()) { 145 if (t->hasStartDate()) {
146 mItem->setText(1,t->dtStartDateStr()); 146 mItem->setText(1,t->dtStartDateStr());
147 if (t->doesFloat()) { 147 if (t->doesFloat()) {
148 mItem->setText(2,"---"); 148 mItem->setText(2,"---");
149 } else { 149 } else {
150 mItem->setText(2,t->dtStartTimeStr()); 150 mItem->setText(2,t->dtStartTimeStr());
151 } 151 }
152 } else { 152 } else {
153 mItem->setText(1,"---"); 153 mItem->setText(1,"---");
154 mItem->setText(2,"---"); 154 mItem->setText(2,"---");
155 } 155 }
156 mItem->setText(3,"---"); 156 mItem->setText(3,"---");
157 mItem->setText(4,"---"); 157 mItem->setText(4,"---");
158 mItem->setText(5,t->isAlarmEnabled() ? i18n("Yes") : i18n("No")); 158 mItem->setText(5,t->isAlarmEnabled() ? i18n("Yes") : i18n("No"));
159 mItem->setText(6,"---"); 159 mItem->setText(6, t->recurrence()->recurrenceText());
160 if (t->hasDueDate()) { 160 if (t->hasDueDate()) {
161 mItem->setText(7,t->dtDueDateStr()); 161 mItem->setText(7,t->dtDueDateStr());
162 if (t->doesFloat()) { 162 if (t->doesFloat()) {
163 mItem->setText(8,"---"); 163 mItem->setText(8,"---");
164 } else { 164 } else {
165 mItem->setText(8,t->dtDueTimeStr()); 165 mItem->setText(8,t->dtDueTimeStr());
166 } 166 }
167 } else { 167 } else {
168 mItem->setText(7,"---"); 168 mItem->setText(7,"---");
169 mItem->setText(8,"---"); 169 mItem->setText(8,"---");
170 } 170 }
171 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); 171 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No"));
172 mItem->setText(10,t->categoriesStr()); 172 mItem->setText(10,t->categoriesStr());
173 173
174 QString key; 174 QString key;
175 QDate d; 175 QDate d;
176 if (t->hasDueDate()) { 176 if (t->hasDueDate()) {
177 d = t->dtDue().date(); 177 d = t->dtDue().date();
178 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); 178 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()); 179 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
180 mItem->setSortKey(7,key); 180 mItem->setSortKey(7,key);
181 } 181 }
182 if ( t->hasStartDate() ) { 182 if ( t->hasStartDate() ) {
183 d = t->dtStart().date(); 183 d = t->dtStart().date();
184 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); 184 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time();
185 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 185 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
186 mItem->setSortKey(1,key); 186 mItem->setSortKey(1,key);
187 } 187 }
188 return true; 188 return true;
189} 189}
190 190
191bool ListItemVisitor::visit(Journal * j) 191bool ListItemVisitor::visit(Journal * j)
192{ 192{
193 QString des = j->description().left(50); 193 QString des = j->description().left(50);
194 des = des.simplifyWhiteSpace (); 194 des = des.simplifyWhiteSpace ();
195 des.replace (QRegExp ("\\n"),"" ); 195 des.replace (QRegExp ("\\n"),"" );
196 des.replace (QRegExp ("\\r"),"" ); 196 des.replace (QRegExp ("\\r"),"" );
197 mItem->setText(0,i18n("Journal")+": "+des.left(25)); 197 mItem->setText(0,i18n("Journal")+": "+des.left(25));
198 mItem->setText(1,j->dtStartDateStr()); 198 mItem->setText(1,j->dtStartDateStr());
199 mItem->setText(2,"---"); 199 mItem->setText(2,"---");
200 mItem->setText(3,"---"); 200 mItem->setText(3,"---");
201 mItem->setText(4,"---"); 201 mItem->setText(4,"---");
202 mItem->setText(5,"---"); 202 mItem->setText(5,"---");
203 mItem->setText(6,"---"); 203 mItem->setText(6,"---");
204 mItem->setText(7,j->dtStartDateStr()); 204 mItem->setText(7,j->dtStartDateStr());
205 mItem->setText(8,"---"); 205 mItem->setText(8,"---");
206 mItem->setText(9,"---"); 206 mItem->setText(9,"---");
207 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); 207 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) );
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index f595d35..d0380e3 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -536,96 +536,99 @@ void MonthViewCell::insertEvent(Event *event)
536 if ( me->status() == Attendee::NeedsAction && me->RSVP()) 536 if ( me->status() == Attendee::NeedsAction && me->RSVP())
537 item->setReply(true); 537 item->setReply(true);
538 else 538 else
539 item->setReply(false); 539 item->setReply(false);
540 } else 540 } else
541 item->setReply(false); 541 item->setReply(false);
542#endif 542#endif
543 mItemList->insertItem( item ); 543 mItemList->insertItem( item );
544 mToolTip += "\n"; 544 mToolTip += "\n";
545} 545}
546void MonthViewCell::insertTodo(Todo *todo) 546void MonthViewCell::insertTodo(Todo *todo)
547{ 547{
548 mItemList->setFocusPolicy(WheelFocus); 548 mItemList->setFocusPolicy(WheelFocus);
549 QString text; 549 QString text;
550 if (todo->hasDueDate()) { 550 if (todo->hasDueDate()) {
551 if (!todo->doesFloat()) { 551 if (!todo->doesFloat()) {
552 text += KGlobal::locale()->formatTime(todo->dtDue().time()); 552 text += KGlobal::locale()->formatTime(todo->dtDue().time());
553 text += " "; 553 text += " ";
554 } 554 }
555 } 555 }
556 text += i18n("T: %1").arg(todo->summary()); 556 text += i18n("T: %1").arg(todo->summary());
557 557
558 MonthViewItem *item = new MonthViewItem( todo, mDate, text ); 558 MonthViewItem *item = new MonthViewItem( todo, mDate, text );
559 //item->setPalette( mStandardPalette ); 559 //item->setPalette( mStandardPalette );
560 QPalette pal; 560 QPalette pal;
561 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 561 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
562 QStringList categories = todo->categories(); 562 QStringList categories = todo->categories();
563 QString cat = categories.first(); 563 QString cat = categories.first();
564 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 564 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
565 pal = getPalette(); 565 pal = getPalette();
566 if (cat.isEmpty()) { 566 if (cat.isEmpty()) {
567 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 567 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
568 } else { 568 } else {
569 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 569 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
570 } 570 }
571 571
572 } else { 572 } else {
573 if (cat.isEmpty()) { 573 if (cat.isEmpty()) {
574 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 574 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
575 } else { 575 } else {
576 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 576 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
577 } 577 }
578 } 578 }
579 579
580 } else { 580 } else {
581 pal = mStandardPalette ; 581 pal = mStandardPalette ;
582 } 582 }
583 item->setPalette( pal ); 583 item->setPalette( pal );
584 item->setRecur( todo->recurrence()->doesRecur() );
585 item->setAlarm( todo->isAlarmEnabled() );
586 item->setMoreInfo( todo->description().length() > 0 );
584 mItemList->insertItem( item ); 587 mItemList->insertItem( item );
585 mToolTip += text+"\n"; 588 mToolTip += text+"\n";
586} 589}
587void MonthViewCell::finishUpdateCell() 590void MonthViewCell::finishUpdateCell()
588{ 591{
589#ifdef DESKTOP_VERSION 592#ifdef DESKTOP_VERSION
590 if (mToolTip != "") 593 if (mToolTip != "")
591 QToolTip::add(this,mToolTip,toolTipGroup(),""); 594 QToolTip::add(this,mToolTip,toolTipGroup(),"");
592#endif 595#endif
593 mItemList->sort(); 596 mItemList->sort();
594 //setMyPalette(); 597 //setMyPalette();
595 setMyPalette(); 598 setMyPalette();
596 QString text; 599 QString text;
597 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; 600 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog;
598 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { 601 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) {
599 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; 602 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " ";
600 mLabel->resize( mLabelBigSize ); 603 mLabel->resize( mLabelBigSize );
601 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 604 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
602 } else { 605 } else {
603 mLabel->resize( mLabelSize ); 606 mLabel->resize( mLabelSize );
604 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 607 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
605 } 608 }
606 609
607 mLabel->setText( text ); 610 mLabel->setText( text );
608 resizeEvent( 0 ); 611 resizeEvent( 0 );
609} 612}
610void MonthViewCell::updateCell() 613void MonthViewCell::updateCell()
611{ 614{
612 qDebug("MonthViewCell::updateCell() "); 615 qDebug("MonthViewCell::updateCell() ");
613 if ( !mMonthView->isUpdatePossible() ) 616 if ( !mMonthView->isUpdatePossible() )
614 return; 617 return;
615 startUpdateCell(); 618 startUpdateCell();
616 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 619 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
617 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); 620 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true );
618 Event *event; 621 Event *event;
619 for( event = events.first(); event; event = events.next() ) { // for event 622 for( event = events.first(); event; event = events.next() ) { // for event
620 insertEvent(event); 623 insertEvent(event);
621 } 624 }
622 // insert due todos 625 // insert due todos
623 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); 626 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate );
624 Todo *todo; 627 Todo *todo;
625 for(todo = todos.first(); todo; todo = todos.next()) { 628 for(todo = todos.first(); todo; todo = todos.next()) {
626 insertTodo( todo ); 629 insertTodo( todo );
627 } 630 }
628 finishUpdateCell(); 631 finishUpdateCell();
629 // if ( isVisible()) 632 // if ( isVisible())
630 //qApp->processEvents(); 633 //qApp->processEvents();
631} 634}
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 391b3bb..18dc656 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -623,96 +623,102 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
623 tempText += i18n(" (%1 y.)"). arg( years ); 623 tempText += i18n(" (%1 y.)"). arg( years );
624 } 624 }
625 } 625 }
626 626
627 tempText += "</a>"; 627 tempText += "</a>";
628 if ( KOPrefs::instance()->mWNViewShowLocation ) 628 if ( KOPrefs::instance()->mWNViewShowLocation )
629 if ( !ev->location().isEmpty() ) 629 if ( !ev->location().isEmpty() )
630 tempText += " ("+ev->location() +")"; 630 tempText += " ("+ev->location() +")";
631 if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) 631 if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents)
632 tempText += " ["+ev->relatedTo()->summary() +"]"; 632 tempText += " ["+ev->relatedTo()->summary() +"]";
633 tempText += "</td></tr>\n"; 633 tempText += "</td></tr>\n";
634 mText += tempText; 634 mText += tempText;
635 return true; 635 return true;
636} 636}
637 637
638bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) 638bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
639{ 639{
640 if ( mTodos.find( ev ) != mTodos.end() ) return false; 640 if ( mTodos.find( ev ) != mTodos.end() ) return false;
641 641
642 mTodos.append( ev ); 642 mTodos.append( ev );
643 if ( !isSub ) 643 if ( !isSub )
644 mText += "<p>"; 644 mText += "<p>";
645 else 645 else
646 mText += "<li>"; 646 mText += "<li>";
647 mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; 647 mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] ";
648 648
649 649
650 mText += ind; 650 mText += ind;
651 bool needClose = false; 651 bool needClose = false;
652 if ( ev->cancelled() ) { 652 if ( ev->cancelled() ) {
653 mText += "<font color=\"#F00000\">[c"; 653 mText += "<font color=\"#F00000\">[c";
654 needClose =true; 654 needClose =true;
655 655
656 } 656 }
657 if ( ev->isAlarmEnabled() ) { 657 if ( ev->isAlarmEnabled() ) {
658 if ( !needClose) 658 if ( !needClose)
659 mText +="["; 659 mText +="[";
660 mText += "a"; 660 mText += "a";
661 needClose =true; 661 needClose =true;
662 662
663 } 663 }
664 664
665 if ( ev->description().length() > 0 ) { 665 if ( ev->description().length() > 0 ) {
666 if ( !needClose) 666 if ( !needClose)
667 mText +="["; 667 mText +="[";
668 mText += "i"; 668 mText += "i";
669 needClose =true; 669 needClose =true;
670 } 670 }
671 if ( ev->doesRecur() ) {
672 if ( !needClose)
673 mText +="[";
674 mText += "r";
675 needClose =true;
676 }
671 // if ( ev->recurrence()->doesRecur() ) { 677 // if ( ev->recurrence()->doesRecur() ) {
672 // if ( !needClose) 678 // if ( !needClose)
673 // mText +="("; 679 // mText +="(";
674 // mText += "r"; 680 // mText += "r";
675 // needClose =true; 681 // needClose =true;
676 // } 682 // }
677 if ( needClose ) 683 if ( needClose )
678 mText += "] "; 684 mText += "] ";
679 if ( ev->cancelled() ) 685 if ( ev->cancelled() )
680 mText += "</font>"; 686 mText += "</font>";
681 mText += "<a href=\"todo:" + ev->uid() + "\">"; 687 mText += "<a href=\"todo:" + ev->uid() + "\">";
682 if ( ev->summary().length() > 0 ) 688 if ( ev->summary().length() > 0 )
683 mText += ev->summary(); 689 mText += ev->summary();
684 else 690 else
685 mText += i18n("-no summary-"); 691 mText += i18n("-no summary-");
686 mText += "</a>"; 692 mText += "</a>";
687 if ( ((Todo*)ev)->hasDueDate () ) { 693 if ( ((Todo*)ev)->hasDueDate () ) {
688 QString year = ""; 694 QString year = "";
689 int ye = ((Todo*)ev)->dtDue().date().year(); 695 int ye = ((Todo*)ev)->dtDue().date().year();
690 if ( QDateTime::currentDateTime().date().year() != ye ) 696 if ( QDateTime::currentDateTime().date().year() != ye )
691 year = QString::number( ye ); 697 year = QString::number( ye );
692 QString dfs = KGlobal::locale()->dateFormatShort(); 698 QString dfs = KGlobal::locale()->dateFormatShort();
693 KGlobal::locale()->setDateFormatShort("%d.%b"); 699 KGlobal::locale()->setDateFormatShort("%d.%b");
694 mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>"; 700 mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>";
695 KGlobal::locale()->setDateFormatShort(dfs); 701 KGlobal::locale()->setDateFormatShort(dfs);
696 } 702 }
697 if ( KOPrefs::instance()->mWNViewShowLocation ) 703 if ( KOPrefs::instance()->mWNViewShowLocation )
698 if ( !ev->location().isEmpty() ) 704 if ( !ev->location().isEmpty() )
699 mText += " ("+ev->location() +")"; 705 mText += " ("+ev->location() +")";
700 if ( !isSub ) { 706 if ( !isSub ) {
701 if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) 707 if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents)
702 mText += " ["+ev->relatedTo()->summary() +"]"; 708 mText += " ["+ev->relatedTo()->summary() +"]";
703 mText += "</p>\n"; 709 mText += "</p>\n";
704 } 710 }
705 else { 711 else {
706 ind += "-"; 712 ind += "-";
707 mText += "</li>\n"; 713 mText += "</li>\n";
708 } 714 }
709 QPtrList<Incidence> Relations = ev->relations(); 715 QPtrList<Incidence> Relations = ev->relations();
710 Incidence *to; 716 Incidence *to;
711 for (to=Relations.first();to;to=Relations.next()) { 717 for (to=Relations.first();to;to=Relations.next()) {
712 if (!((Todo*)to)->isCompleted()) 718 if (!((Todo*)to)->isCompleted())
713 appendTodo( to, ind , true ); 719 appendTodo( to, ind , true );
714 } 720 }
715 721
716 return true; 722 return true;
717} 723}
718 724
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp
index bb9cb29..2e38ae3 100644
--- a/libkcal/icalformatimpl.cpp
+++ b/libkcal/icalformatimpl.cpp
@@ -1165,97 +1165,97 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence)
1165 break; 1165 break;
1166 1166
1167 case ICAL_LASTMODIFIED_PROPERTY: // last modification date 1167 case ICAL_LASTMODIFIED_PROPERTY: // last modification date
1168 icaltime = icalproperty_get_lastmodified(p); 1168 icaltime = icalproperty_get_lastmodified(p);
1169 incidence->setLastModified(readICalDateTime(icaltime)); 1169 incidence->setLastModified(readICalDateTime(icaltime));
1170 break; 1170 break;
1171 1171
1172 case ICAL_DTSTART_PROPERTY: // start date and time 1172 case ICAL_DTSTART_PROPERTY: // start date and time
1173 icaltime = icalproperty_get_dtstart(p); 1173 icaltime = icalproperty_get_dtstart(p);
1174 if (icaltime.is_date) { 1174 if (icaltime.is_date) {
1175 incidence->setDtStart(QDateTime(readICalDate(icaltime),QTime(0,0,0))); 1175 incidence->setDtStart(QDateTime(readICalDate(icaltime),QTime(0,0,0)));
1176 incidence->setFloats(true); 1176 incidence->setFloats(true);
1177 } else { 1177 } else {
1178 incidence->setDtStart(readICalDateTime(icaltime)); 1178 incidence->setDtStart(readICalDateTime(icaltime));
1179 } 1179 }
1180 break; 1180 break;
1181 1181
1182 case ICAL_DURATION_PROPERTY: // start date and time 1182 case ICAL_DURATION_PROPERTY: // start date and time
1183 icalduration = icalproperty_get_duration(p); 1183 icalduration = icalproperty_get_duration(p);
1184 incidence->setDuration(readICalDuration(icalduration)); 1184 incidence->setDuration(readICalDuration(icalduration));
1185 break; 1185 break;
1186 1186
1187 case ICAL_DESCRIPTION_PROPERTY: // description 1187 case ICAL_DESCRIPTION_PROPERTY: // description
1188 text = icalproperty_get_description(p); 1188 text = icalproperty_get_description(p);
1189 incidence->setDescription(QString::fromUtf8(text)); 1189 incidence->setDescription(QString::fromUtf8(text));
1190 break; 1190 break;
1191 1191
1192 case ICAL_SUMMARY_PROPERTY: // summary 1192 case ICAL_SUMMARY_PROPERTY: // summary
1193 { 1193 {
1194 text = icalproperty_get_summary(p); 1194 text = icalproperty_get_summary(p);
1195 incidence->setSummary(QString::fromUtf8(text)); 1195 incidence->setSummary(QString::fromUtf8(text));
1196 } 1196 }
1197 break; 1197 break;
1198 case ICAL_STATUS_PROPERTY: // summary 1198 case ICAL_STATUS_PROPERTY: // summary
1199 { 1199 {
1200 if ( ICAL_STATUS_CANCELLED == icalproperty_get_status(p) ) 1200 if ( ICAL_STATUS_CANCELLED == icalproperty_get_status(p) )
1201 incidence->setCancelled( true ); 1201 incidence->setCancelled( true );
1202 } 1202 }
1203 break; 1203 break;
1204 1204
1205 case ICAL_LOCATION_PROPERTY: // location 1205 case ICAL_LOCATION_PROPERTY: // location
1206 text = icalproperty_get_location(p); 1206 text = icalproperty_get_location(p);
1207 incidence->setLocation(QString::fromUtf8(text)); 1207 incidence->setLocation(QString::fromUtf8(text));
1208 break; 1208 break;
1209 1209
1210 case ICAL_RECURRENCEID_PROPERTY: 1210 case ICAL_RECURRENCEID_PROPERTY:
1211 icaltime = icalproperty_get_recurrenceid(p); 1211 icaltime = icalproperty_get_recurrenceid(p);
1212 incidence->setRecurrenceID( readICalDateTime(icaltime) ); 1212 incidence->setRecurrenceID( readICalDateTime(icaltime) );
1213 qDebug(" RecurrenceID %s",incidence->recurrenceID().toString().latin1() ); 1213 //qDebug(" RecurrenceID %s",incidence->recurrenceID().toString().latin1() );
1214 break; 1214 break;
1215#if 0 1215#if 0
1216 // status 1216 // status
1217 if ((vo = isAPropertyOf(vincidence, VCStatusProp)) != 0) { 1217 if ((vo = isAPropertyOf(vincidence, VCStatusProp)) != 0) {
1218 incidence->setStatus(s = fakeCString(vObjectUStringZValue(vo))); 1218 incidence->setStatus(s = fakeCString(vObjectUStringZValue(vo)));
1219 deleteStr(s); 1219 deleteStr(s);
1220 } 1220 }
1221 else 1221 else
1222 incidence->setStatus("NEEDS ACTION"); 1222 incidence->setStatus("NEEDS ACTION");
1223#endif 1223#endif
1224 1224
1225 case ICAL_PRIORITY_PROPERTY: // priority 1225 case ICAL_PRIORITY_PROPERTY: // priority
1226 intvalue = icalproperty_get_priority(p); 1226 intvalue = icalproperty_get_priority(p);
1227 incidence->setPriority(intvalue); 1227 incidence->setPriority(intvalue);
1228 break; 1228 break;
1229 1229
1230 case ICAL_CATEGORIES_PROPERTY: // categories 1230 case ICAL_CATEGORIES_PROPERTY: // categories
1231 text = icalproperty_get_categories(p); 1231 text = icalproperty_get_categories(p);
1232 categories.append(QString::fromUtf8(text)); 1232 categories.append(QString::fromUtf8(text));
1233 break; 1233 break;
1234 //******************************************* 1234 //*******************************************
1235 case ICAL_RRULE_PROPERTY: 1235 case ICAL_RRULE_PROPERTY:
1236 // we do need (maybe )start datetime of incidence for recurrence 1236 // we do need (maybe )start datetime of incidence for recurrence
1237 // such that we can read recurrence only after we read incidence completely 1237 // such that we can read recurrence only after we read incidence completely
1238 readrec = true; 1238 readrec = true;
1239 rectype = icalproperty_get_rrule(p); 1239 rectype = icalproperty_get_rrule(p);
1240 break; 1240 break;
1241 1241
1242 case ICAL_EXDATE_PROPERTY: 1242 case ICAL_EXDATE_PROPERTY:
1243 icaltime = icalproperty_get_exdate(p); 1243 icaltime = icalproperty_get_exdate(p);
1244 incidence->addExDate(readICalDate(icaltime)); 1244 incidence->addExDate(readICalDate(icaltime));
1245 break; 1245 break;
1246 1246
1247 case ICAL_CLASS_PROPERTY: { 1247 case ICAL_CLASS_PROPERTY: {
1248 int inttext = icalproperty_get_class(p); 1248 int inttext = icalproperty_get_class(p);
1249 if (inttext == ICAL_CLASS_PUBLIC ) { 1249 if (inttext == ICAL_CLASS_PUBLIC ) {
1250 incidence->setSecrecy(Incidence::SecrecyPublic); 1250 incidence->setSecrecy(Incidence::SecrecyPublic);
1251 } else if (inttext == ICAL_CLASS_CONFIDENTIAL ) { 1251 } else if (inttext == ICAL_CLASS_CONFIDENTIAL ) {
1252 incidence->setSecrecy(Incidence::SecrecyConfidential); 1252 incidence->setSecrecy(Incidence::SecrecyConfidential);
1253 } else { 1253 } else {
1254 incidence->setSecrecy(Incidence::SecrecyPrivate); 1254 incidence->setSecrecy(Incidence::SecrecyPrivate);
1255 } 1255 }
1256 } 1256 }
1257 break; 1257 break;
1258 1258
1259 case ICAL_ATTACH_PROPERTY: // attachments 1259 case ICAL_ATTACH_PROPERTY: // attachments
1260 incidence->addAttachment(readAttachment(p)); 1260 incidence->addAttachment(readAttachment(p));
1261 break; 1261 break;
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 0684af2..708ee6b 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -168,100 +168,108 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 )
168 if ( i1.hasRecurrenceID() == i2.hasRecurrenceID() ) { 168 if ( i1.hasRecurrenceID() == i2.hasRecurrenceID() ) {
169 if ( i1.hasRecurrenceID() ) { 169 if ( i1.hasRecurrenceID() ) {
170 if ( i1.recurrenceID() != i2.recurrenceID() ) 170 if ( i1.recurrenceID() != i2.recurrenceID() )
171 return false; 171 return false;
172 } 172 }
173 173
174 } else { 174 } else {
175 return false; 175 return false;
176 } 176 }
177 177
178 if ( ! operator==( (const IncidenceBase&)i1, (const IncidenceBase&)i2 ) ) 178 if ( ! operator==( (const IncidenceBase&)i1, (const IncidenceBase&)i2 ) )
179 return false; 179 return false;
180 if ( i1.hasStartDate() == i2.hasStartDate() ) { 180 if ( i1.hasStartDate() == i2.hasStartDate() ) {
181 if ( i1.hasStartDate() ) { 181 if ( i1.hasStartDate() ) {
182 if ( i1.dtStart() != i2.dtStart() ) 182 if ( i1.dtStart() != i2.dtStart() )
183 return false; 183 return false;
184 } 184 }
185 } else { 185 } else {
186 return false; 186 return false;
187 } 187 }
188 if (!( *i1.recurrence() == *i2.recurrence()) ) { 188 if (!( *i1.recurrence() == *i2.recurrence()) ) {
189 qDebug("recurrence is NOT equal "); 189 qDebug("recurrence is NOT equal ");
190 return false; 190 return false;
191 } 191 }
192 return 192 return
193 // i1.created() == i2.created() && 193 // i1.created() == i2.created() &&
194 stringCompare( i1.description(), i2.description() ) && 194 stringCompare( i1.description(), i2.description() ) &&
195 stringCompare( i1.summary(), i2.summary() ) && 195 stringCompare( i1.summary(), i2.summary() ) &&
196 i1.categories() == i2.categories() && 196 i1.categories() == i2.categories() &&
197 // no need to compare mRelatedTo 197 // no need to compare mRelatedTo
198 stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && 198 stringCompare( i1.relatedToUid(), i2.relatedToUid() ) &&
199 // i1.relations() == i2.relations() && 199 // i1.relations() == i2.relations() &&
200 i1.exDates() == i2.exDates() && 200 i1.exDates() == i2.exDates() &&
201 i1.attachments() == i2.attachments() && 201 i1.attachments() == i2.attachments() &&
202 i1.resources() == i2.resources() && 202 i1.resources() == i2.resources() &&
203 i1.secrecy() == i2.secrecy() && 203 i1.secrecy() == i2.secrecy() &&
204 i1.priority() == i2.priority() && 204 i1.priority() == i2.priority() &&
205 i1.cancelled() == i2.cancelled() && 205 i1.cancelled() == i2.cancelled() &&
206 stringCompare( i1.location(), i2.location() ); 206 stringCompare( i1.location(), i2.location() );
207} 207}
208 208
209Incidence* Incidence::recreateCloneException( QDate d ) 209Incidence* Incidence::recreateCloneException( QDate d )
210{ 210{
211 Incidence* newInc = clone(); 211 Incidence* newInc = clone();
212 newInc->recreate(); 212 newInc->recreate();
213 if ( doesRecur() ) { 213 if ( doesRecur() ) {
214 addExDate( d ); 214 addExDate( d );
215 newInc->recurrence()->unsetRecurs(); 215 newInc->recurrence()->unsetRecurs();
216 if ( type() == "Event") {
216 int len = dtStart().secsTo( ((Event*)this)->dtEnd()); 217 int len = dtStart().secsTo( ((Event*)this)->dtEnd());
217 QTime tim = dtStart().time(); 218 QTime tim = dtStart().time();
218 newInc->setDtStart( QDateTime(d, tim) ); 219 newInc->setDtStart( QDateTime(d, tim) );
219 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); 220 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) );
221 } else {
222 int len = dtStart().secsTo( ((Todo*)this)->dtDue());
223 QTime tim = ((Todo*)this)->dtDue().time();
224 ((Todo*)newInc)->setDtDue( QDateTime(d, tim) );
225 ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) );
226 ((Todo*)this)->setRecurDates();
227 }
220 } 228 }
221 return newInc; 229 return newInc;
222} 230}
223 231
224void Incidence::recreate() 232void Incidence::recreate()
225{ 233{
226 setCreated(QDateTime::currentDateTime()); 234 setCreated(QDateTime::currentDateTime());
227 235
228 setUid(CalFormat::createUniqueId()); 236 setUid(CalFormat::createUniqueId());
229 237
230 setRevision(0); 238 setRevision(0);
231 setIDStr( ":" ); 239 setIDStr( ":" );
232 setLastModified(QDateTime::currentDateTime()); 240 setLastModified(QDateTime::currentDateTime());
233} 241}
234 242
235void Incidence::setReadOnly( bool readOnly ) 243void Incidence::setReadOnly( bool readOnly )
236{ 244{
237 IncidenceBase::setReadOnly( readOnly ); 245 IncidenceBase::setReadOnly( readOnly );
238 recurrence()->setRecurReadOnly( readOnly); 246 recurrence()->setRecurReadOnly( readOnly);
239} 247}
240 248
241void Incidence::setCreated(QDateTime created) 249void Incidence::setCreated(QDateTime created)
242{ 250{
243 if (mReadOnly) return; 251 if (mReadOnly) return;
244 mCreated = getEvenTime(created); 252 mCreated = getEvenTime(created);
245} 253}
246 254
247QDateTime Incidence::created() const 255QDateTime Incidence::created() const
248{ 256{
249 return mCreated; 257 return mCreated;
250} 258}
251 259
252void Incidence::setRevision(int rev) 260void Incidence::setRevision(int rev)
253{ 261{
254 if (mReadOnly) return; 262 if (mReadOnly) return;
255 mRevision = rev; 263 mRevision = rev;
256 264
257 updated(); 265 updated();
258} 266}
259 267
260int Incidence::revision() const 268int Incidence::revision() const
261{ 269{
262 return mRevision; 270 return mRevision;
263} 271}
264 272
265void Incidence::setDtStart(const QDateTime &dtStart) 273void Incidence::setDtStart(const QDateTime &dtStart)
266{ 274{
267 275
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index 0d9c3f4..cc3088a 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -147,96 +147,108 @@ void KIncidenceFormatter::setEvent(Event *event)
147 formatReadOnly(event); 147 formatReadOnly(event);
148 formatAttendees(event); 148 formatAttendees(event);
149 149
150 150
151} 151}
152 152
153void KIncidenceFormatter::setTodo(Todo *event ) 153void KIncidenceFormatter::setTodo(Todo *event )
154{ 154{
155 int mode = 0; 155 int mode = 0;
156 mCurrentIncidence = event; 156 mCurrentIncidence = event;
157 bool shortDate = true; 157 bool shortDate = true;
158 if (mode == 0 ) 158 if (mode == 0 )
159 addTag("h3",event->summary()); 159 addTag("h3",event->summary());
160 else { 160 else {
161 if ( mColorMode == 1 ) { 161 if ( mColorMode == 1 ) {
162 mText +="<font color=\"#00A000\">"; 162 mText +="<font color=\"#00A000\">";
163 } 163 }
164 if ( mColorMode == 2 ) { 164 if ( mColorMode == 2 ) {
165 mText +="<font color=\"#B00000\">"; 165 mText +="<font color=\"#B00000\">";
166 } 166 }
167 if ( mode == 1 ) { 167 if ( mode == 1 ) {
168 addTag("h2",i18n( "Local: " ) +event->summary()); 168 addTag("h2",i18n( "Local: " ) +event->summary());
169 } else { 169 } else {
170 addTag("h2",i18n( "Remote: " ) +event->summary()); 170 addTag("h2",i18n( "Remote: " ) +event->summary());
171 } 171 }
172 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 172 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
173 if ( mColorMode ) 173 if ( mColorMode )
174 mText += "</font>"; 174 mText += "</font>";
175 } 175 }
176 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { 176 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
177 mText +="<font color=\"#B00000\">"; 177 mText +="<font color=\"#B00000\">";
178 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) ); 178 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) );
179 mText += "</font>"; 179 mText += "</font>";
180 } else { 180 } else {
181 mText.append(i18n("<p><i>%1 % completed</i></p>") 181 mText.append(i18n("<p><i>%1 % completed</i></p>")
182 .arg(event->percentComplete())); 182 .arg(event->percentComplete()));
183 } 183 }
184 if (event->cancelled ()) { 184 if (event->cancelled ()) {
185 mText +="<font color=\"#B00000\">"; 185 mText +="<font color=\"#B00000\">";
186 addTag("i",i18n("This todo has been cancelled!")); 186 addTag("i",i18n("This todo has been cancelled!"));
187 mText.append("<br>"); 187 mText.append("<br>");
188 mText += "</font>"; 188 mText += "</font>";
189 } 189 }
190 190
191 if (!event->location().isEmpty()) { 191 if (!event->location().isEmpty()) {
192 addTag("b",i18n("Location: ")); 192 addTag("b",i18n("Location: "));
193 mText.append(event->location()+"<br>"); 193 mText.append(event->location()+"<br>");
194 } 194 }
195
196 if (event->recurrence()->doesRecur()) {
197
198 QString recurText = event->recurrence()->recurrenceText();
199 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
200 }
201
202 if (event->hasStartDate()) {
203 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate)));
204 }
205
206
195 if (event->hasDueDate()) { 207 if (event->hasDueDate()) {
196 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); 208 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate)));
197 } 209 }
198 mText.append(i18n("<p><b>Priority:</b> %2</p>") 210 mText.append(i18n("<p><b>Priority:</b> %2</p>")
199 .arg(QString::number(event->priority()))); 211 .arg(QString::number(event->priority())));
200 212
201 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); 213 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
202 formatCategories(event); 214 formatCategories(event);
203 if (!event->description().isEmpty()) { 215 if (!event->description().isEmpty()) {
204 addTag("p",i18n("<b>Details: </b>")); 216 addTag("p",i18n("<b>Details: </b>"));
205 addTag("p",event->description()); 217 addTag("p",event->description());
206 } 218 }
207 219
208 220
209 221
210 formatReadOnly(event); 222 formatReadOnly(event);
211 formatAttendees(event); 223 formatAttendees(event);
212 224
213} 225}
214 226
215void KIncidenceFormatter::setJournal(Journal* ) 227void KIncidenceFormatter::setJournal(Journal* )
216{ 228{
217 229
218} 230}
219 231
220void KIncidenceFormatter::formatCategories(Incidence *event) 232void KIncidenceFormatter::formatCategories(Incidence *event)
221{ 233{
222 if (!event->categoriesStr().isEmpty()) { 234 if (!event->categoriesStr().isEmpty()) {
223 addTag("p",i18n("<b>Categories: </b>")+event->categoriesStr() ); 235 addTag("p",i18n("<b>Categories: </b>")+event->categoriesStr() );
224 //mText.append(event->categoriesStr()); 236 //mText.append(event->categoriesStr());
225 } 237 }
226} 238}
227void KIncidenceFormatter::addTag(const QString & tag,const QString & text) 239void KIncidenceFormatter::addTag(const QString & tag,const QString & text)
228{ 240{
229 int number=text.contains("\n"); 241 int number=text.contains("\n");
230 QString str = "<" + tag + ">"; 242 QString str = "<" + tag + ">";
231 QString tmpText=text; 243 QString tmpText=text;
232 QString tmpStr=str; 244 QString tmpStr=str;
233 if(number !=-1) 245 if(number !=-1)
234 { 246 {
235 if (number > 0) { 247 if (number > 0) {
236 int pos=0; 248 int pos=0;
237 QString tmp; 249 QString tmp;
238 for(int i=0;i<=number;i++) { 250 for(int i=0;i<=number;i++) {
239 pos=tmpText.find("\n"); 251 pos=tmpText.find("\n");
240 tmp=tmpText.left(pos); 252 tmp=tmpText.left(pos);
241 tmpText=tmpText.right(tmpText.length()-pos-1); 253 tmpText=tmpText.right(tmpText.length()-pos-1);
242 tmpStr+=tmp+"<br>"; 254 tmpStr+=tmp+"<br>";
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 1f54c2f..39d16b6 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -324,134 +324,134 @@ void Todo::setCompleted(bool completed)
324 completed = false; 324 completed = false;
325 } 325 }
326 if (completed) mPercentComplete = 100; 326 if (completed) mPercentComplete = 100;
327 else { 327 else {
328 mPercentComplete = 0; 328 mPercentComplete = 0;
329 mHasCompletedDate = false; 329 mHasCompletedDate = false;
330 } 330 }
331 updated(); 331 updated();
332} 332}
333 333
334QDateTime Todo::completed() const 334QDateTime Todo::completed() const
335{ 335{
336 return mCompleted; 336 return mCompleted;
337} 337}
338 338
339QString Todo::completedStr( bool shortF ) const 339QString Todo::completedStr( bool shortF ) const
340{ 340{
341 return KGlobal::locale()->formatDateTime(mCompleted, shortF); 341 return KGlobal::locale()->formatDateTime(mCompleted, shortF);
342} 342}
343 343
344void Todo::setCompleted(const QDateTime &completed) 344void Todo::setCompleted(const QDateTime &completed)
345{ 345{
346 //qDebug("Todo::setCompleted "); 346 //qDebug("Todo::setCompleted ");
347 if ( mHasCompletedDate ) { 347 if ( mHasCompletedDate ) {
348 // qDebug("has completed data - return "); 348 // qDebug("has completed data - return ");
349 return; 349 return;
350 } 350 }
351 mHasCompletedDate = true; 351 mHasCompletedDate = true;
352 mPercentComplete = 100; 352 mPercentComplete = 100;
353 mCompleted = getEvenTime(completed); 353 mCompleted = getEvenTime(completed);
354 updated(); 354 updated();
355} 355}
356 356
357bool Todo::hasCompletedDate() const 357bool Todo::hasCompletedDate() const
358{ 358{
359 return mHasCompletedDate; 359 return mHasCompletedDate;
360} 360}
361 361
362int Todo::percentComplete() const 362int Todo::percentComplete() const
363{ 363{
364 return mPercentComplete; 364 return mPercentComplete;
365} 365}
366bool Todo::setRecurDates() 366bool Todo::setRecurDates()
367{ 367{
368 if ( !mHasRecurrenceID ) 368 if ( !mHasRecurrenceID )
369 return true; 369 return true;
370 int secs = mDtStart.secsTo( dtDue() ); 370 int secs = mDtStart.secsTo( dtDue() );
371 bool ok; 371 bool ok;
372 qDebug("--------------------setRecurDates() "); 372 qDebug("T:setRecurDates() ");
373 //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); 373 //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() );
374 QDateTime next = getNextOccurence( mRecurrenceID, &ok ); 374 QDateTime next = getNextOccurence( mRecurrenceID, &ok );
375 if ( ok ) { 375 if ( ok ) {
376 mRecurrenceID = next; 376 mRecurrenceID = next;
377 mDtStart = next; 377 mDtStart = next;
378 setDtDue( next.addSecs( secs ) ); 378 setDtDue( next.addSecs( secs ) );
379 if ( QDateTime::currentDateTime() > next) 379 if ( QDateTime::currentDateTime() > next)
380 return false; 380 return false;
381 } else { 381 } else {
382 setHasRecurrenceID( false ); 382 setHasRecurrenceID( false );
383 recurrence()->unsetRecurs(); 383 recurrence()->unsetRecurs();
384 } 384 }
385 return true; 385 return true;
386} 386}
387void Todo::setPercentComplete(int v) 387void Todo::setPercentComplete(int v)
388{ 388{
389 if ( mHasRecurrenceID && v == 100 && mPercentComplete != 100 ) { 389 if ( mHasRecurrenceID && v == 100 && mPercentComplete != 100 ) {
390 if ( !setRecurDates() ) 390 if ( !setRecurDates() )
391 v = 0; 391 v = 0;
392 } 392 }
393 mPercentComplete = v; 393 mPercentComplete = v;
394 if ( v != 100 ) 394 if ( v != 100 )
395 mHasCompletedDate = false; 395 mHasCompletedDate = false;
396 updated(); 396 updated();
397} 397}
398QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const 398QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const
399{ 399{
400 if ( isCompleted() || ! hasDueDate() || cancelled() ) { 400 if ( isCompleted() || ! hasDueDate() || cancelled() ) {
401 *ok = false; 401 *ok = false;
402 return QDateTime (); 402 return QDateTime ();
403 } 403 }
404 QDateTime incidenceStart; 404 QDateTime incidenceStart;
405 incidenceStart = dtDue(); 405 incidenceStart = dtDue();
406 bool enabled = false; 406 bool enabled = false;
407 Alarm* alarm; 407 Alarm* alarm;
408 int off = 0; 408 int off = 0;
409 QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; 409 QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );;
410 // if ( QDateTime::currentDateTime() > incidenceStart ){ 410 // if ( QDateTime::currentDateTime() > incidenceStart ){
411// *ok = false; 411// *ok = false;
412// return incidenceStart; 412// return incidenceStart;
413// } 413// }
414 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { 414 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
415 if (alarm->enabled()) { 415 if (alarm->enabled()) {
416 if ( alarm->hasTime () ) { 416 if ( alarm->hasTime () ) {
417 if ( alarm->time() < alarmStart ) { 417 if ( alarm->time() < alarmStart ) {
418 alarmStart = alarm->time(); 418 alarmStart = alarm->time();
419 enabled = true; 419 enabled = true;
420 off = alarmStart.secsTo( incidenceStart ); 420 off = alarmStart.secsTo( incidenceStart );
421 } 421 }
422 422
423 } else { 423 } else {
424 int secs = alarm->startOffset().asSeconds(); 424 int secs = alarm->startOffset().asSeconds();
425 if ( incidenceStart.addSecs( secs ) < alarmStart ) { 425 if ( incidenceStart.addSecs( secs ) < alarmStart ) {
426 alarmStart = incidenceStart.addSecs( secs ); 426 alarmStart = incidenceStart.addSecs( secs );
427 enabled = true; 427 enabled = true;
428 off = -secs; 428 off = -secs;
429 } 429 }
430 } 430 }
431 } 431 }
432 } 432 }
433 if ( enabled ) { 433 if ( enabled ) {
434 if ( alarmStart > QDateTime::currentDateTime() ) { 434 if ( alarmStart > QDateTime::currentDateTime() ) {
435 *ok = true; 435 *ok = true;
436 * offset = off; 436 * offset = off;
437 return alarmStart; 437 return alarmStart;
438 } 438 }
439 } 439 }
440 *ok = false; 440 *ok = false;
441 return QDateTime (); 441 return QDateTime ();
442 442
443} 443}
444 444
445void Todo::checkSetCompletedFalse() 445void Todo::checkSetCompletedFalse()
446{ 446{
447 if ( !hasRecurrenceID() ) { 447 if ( !hasRecurrenceID() ) {
448 qDebug("ERROR 1 in Todo::checkSetCompletedFalse"); 448 qDebug("ERROR 1 in Todo::checkSetCompletedFalse");
449 } 449 }
450 // qDebug("Todo::checkSetCompletedFalse()"); 450 // qDebug("Todo::checkSetCompletedFalse()");
451 //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); 451 //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() );
452 if ( mPercentComplete == 100 && mDtStart == mRecurrenceID && QDateTime::currentDateTime() > mDtStart) { 452 if ( mPercentComplete == 100 && mDtStart == mRecurrenceID && QDateTime::currentDateTime() > mDtStart) {
453 qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); 453 qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() );
454 setCompleted( false ); 454 setCompleted( false );
455 qDebug("Todo::checkSetCompletedFalse++++++++++++++++++++++++++++ "); 455 qDebug("Todo::checkSetCompletedFalse ");
456 } 456 }
457} 457}