-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 10 | ||||
-rw-r--r-- | korganizer/koeventviewer.cpp | 14 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 14 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 26 | ||||
-rw-r--r-- | libkcal/alarm.cpp | 24 | ||||
-rw-r--r-- | libkcal/alarm.h | 1 | ||||
-rw-r--r-- | libkcal/kincidenceformatter.cpp | 14 |
7 files changed, 83 insertions, 20 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index fbab7dd..6b739ba 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt | |||
@@ -1235,109 +1235,109 @@ | |||
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 | { "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." }, | 1272 | { "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." }, |
1273 | { "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" }, | 1273 | { "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" }, |
1274 | { "List week view","Listenwochenansicht" }, | 1274 | { "List week view","Listenwochenansicht" }, |
1275 | { "List week","Listenwochenansicht" }, | 1275 | { "List week","Listenwochenansicht" }, |
1276 | { "Next Week","Nächste Woche" }, | 1276 | { "Next Week","Nächste Woche" }, |
1277 | { "Previous Week","Vorherige Woche" }, | 1277 | { "Previous Week","Vorherige Woche" }, |
1278 | { "No items were found matching\nyour search expression.\nUse the wildcard characters\n'*' and '?' where needed.","Keine Einträge gefunden die\ndem Suchausdruck entsprechen.\nBenutze Platzhalter Zeichen\n'*' und '?' wo benötigt." }, | 1278 | { "No items were found matching\nyour search expression.\nUse the wildcard characters\n'*' and '?' where needed.","Keine Einträge gefunden die\ndem Suchausdruck entsprechen.\nBenutze Platzhalter Zeichen\n'*' und '?' wo benötigt." }, |
1279 | { "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" }, | 1279 | { "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" }, |
1280 | { "Details","Details" }, | 1280 | { "Details","Details" }, |
1281 | { "Created time","Erstellt Zeit" }, | 1281 | { "Created time","Erstellt Zeit" }, |
1282 | { "Last modified time","Geändert Zeit" }, | 1282 | { "Last modified time","Geändert Zeit" }, |
1283 | { "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" }, | 1283 | { "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" }, |
1284 | { "View Options","Anzeige Optionen" }, | 1284 | { "View Options","Anzeige Optionen" }, |
1285 | { "<b>Created: ","<b>Erstellt am: " }, | 1285 | { "<b>Created: ","<b>Erstellt am: " }, |
1286 | { "<b>Last modified: ","<b>Zuletzt geändert am: " }, | 1286 | { "<b>Last modified: ","<b>Zuletzt geändert am: " }, |
1287 | { "Journal: ","Journal: " }, | 1287 | { "Journal: ","Journal: " }, |
1288 | { "yearly","jährlich" }, | 1288 | { "yearly","jährlich" }, |
1289 | { "(%1) ","%1-" }, | 1289 | { "(%1) ","%1-" }, |
1290 | { "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" }, | 1290 | { "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" }, |
1291 | { "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" }, | 1291 | { "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" }, |
1292 | { "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" }, | 1292 | { "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" }, |
1293 | { "Summary/Loc.","Titel/Ort" }, | 1293 | { "Summary/Loc.","Titel/Ort" }, |
1294 | { "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." }, | 1294 | { "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." }, |
1295 | { "Week Number","Wochennummer" }, | 1295 | { "Week Number","Wochennummer" }, |
1296 | { "Import","Importiere" }, | 1296 | { "Import","Importiere" }, |
1297 | { "Export","Exportiere" }, | 1297 | { "Export","Exportiere" }, |
1298 | { "Beam","Beame" }, | 1298 | { "Beam","Beame" }, |
1299 | { "Export selected","Exportiere Selektierte" }, | 1299 | { "Export selected","Exportiere Selektierte" }, |
1300 | { "As iCal (ics) file...","Als iCal (ics) Datei..." }, | 1300 | { "As iCal (ics) file...","Als iCal (ics) Datei..." }, |
1301 | { "As vCal (vcs) file...","Als vCal (vcs) Datei..." }, | 1301 | { "As vCal (vcs) file...","Als vCal (vcs) Datei..." }, |
1302 | { "Journal/Details...","Journale/Details..." }, | 1302 | { "Journal/Details...","Journale/Details..." }, |
1303 | { "Agenda View","Agenda Ansicht" }, | 1303 | { "Agenda View","Agenda Ansicht" }, |
1304 | { "Show current time","Zeige aktuelle Zeit" }, | 1304 | { "Show current time","Zeige aktuelle Zeit" }, |
1305 | { "Edit new item","Bearbeite neuen Eintrag" }, | 1305 | { "Edit new item","Bearbeite neuen Eintrag" }, |
1306 | { "Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals","Bitte wählen Sie mindestens\neinen dieser Typen\num darin zu suchen:\n\nTermine\nTodos\nJournale" }, | 1306 | { "Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals","Bitte wählen Sie mindestens\neinen dieser Typen\num darin zu suchen:\n\nTermine\nTodos\nJournale" }, |
1307 | { "There is no next alarm.","Es gibt keinen nächsten Alarm." }, | 1307 | { "There is no next alarm.","Es gibt keinen nächsten Alarm." }, |
1308 | { "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" }, | 1308 | { "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" }, |
1309 | { "The next alarm is in:\n","Der nächste Alarm ist in:\n" }, | 1309 | { "The next alarm is in:\n","Der nächste Alarm ist in:\n" }, |
1310 | { "%1 days\n","%1 Tagen\n" }, | 1310 | { "%1 days\n","%1 Tagen\n" }, |
1311 | { "1 day\n","1 Tag\n" }, | 1311 | { "1 day\n","1 Tag\n" }, |
1312 | { "%1 hours\n","%1 Stunden\n" }, | 1312 | { "%1 hours\n","%1 Stunden\n" }, |
1313 | { "1 hour\n","1 Stunde\n" }, | 1313 | { "1 hour\n","1 Stunde\n" }, |
1314 | { "%1 minutes\n","%1 Minuten\n" }, | 1314 | { "%1 minutes\n","%1 Minuten\n" }, |
1315 | { "1 minute\n","1 Minute\n" }, | 1315 | { "1 minute\n","1 Minute\n" }, |
1316 | { "Only one toolbar","Nur eine Toolbar" }, | 1316 | { "Only one toolbar","Nur eine Toolbar" }, |
1317 | { "Print","Drucke" }, | 1317 | { "Print","Drucke" }, |
1318 | { "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." }, | 1318 | { "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." }, |
1319 | { "There is nothing selected!","Es ist nichts ausgewählt!" }, | 1319 | { "There is nothing selected!","Es ist nichts ausgewählt!" }, |
1320 | { "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " }, | 1320 | { "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " }, |
1321 | { "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" }, | 1321 | { "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" }, |
1322 | { "This prints the view as you see it.\n(With the complete content, of course.)\nYou may change the print layout by resizing the view.\nPrint unscaled may print several pages\ndepending on the amount of data.\nPrint scaled down will print all on one page.\nPrint scaled up/down will print all on one page,\nbut will scale up the text to page boundaries,\nif the text is smaller than the page.\nYou can select page geometry setup in the next dialog.\n","Dies druckt die Ansicht wie man sie sieht.\n(Mit dem kompletten Inhalt natürlich.)\nMan kann das Layout ändern durch ändern der Fenstergröße.\nDrucke unskaliert druckt ggf. mehrere Seiten\nabhängig von der Menge der Daten.\nDrucke runterskaliert um auf eine Seite zu passen\ndruckt alles auf eine Seite.\nDrucke hoch/runterskaliert um genau auf eine Seite zu passen\nvergrößert den Text gegebenenfalls.\nDas Seitenlayout kann im nächsten Dialog gewählt werden.\n" }, | 1322 | { "This prints the view as you see it.\n(With the complete content, of course.)\nYou may change the print layout by resizing the view.\nPrint unscaled may print several pages\ndepending on the amount of data.\nPrint scaled down will print all on one page.\nPrint scaled up/down will print all on one page,\nbut will scale up the text to page boundaries,\nif the text is smaller than the page.\nYou can select page geometry setup in the next dialog.\n","Dies druckt die Ansicht wie man sie sieht.\n(Mit dem kompletten Inhalt natürlich.)\nMan kann das Layout ändern durch ändern der Fenstergröße.\nDrucke unskaliert druckt ggf. mehrere Seiten\nabhängig von der Menge der Daten.\nDrucke runterskaliert um auf eine Seite zu passen\ndruckt alles auf eine Seite.\nDrucke hoch/runterskaliert um genau auf eine Seite zu passen\nvergrößert den Text gegebenenfalls.\nDas Seitenlayout kann im nächsten Dialog gewählt werden.\n" }, |
1323 | { "KO/Pi Printout","KO/Pi Ausdruck" }, | 1323 | { "KO/Pi Printout","KO/Pi Ausdruck" }, |
1324 | { "Print unscaled","Drucke unskaliert" }, | 1324 | { "Print unscaled","Drucke unskaliert" }, |
1325 | { "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." }, | 1325 | { "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." }, |
1326 | { "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." }, | 1326 | { "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." }, |
1327 | { "Printout Mode","Druck Modus" }, | 1327 | { "Printout Mode","Druck Modus" }, |
1328 | { "Filter menu icon","Filtermenu Icon" }, | 1328 | { "Filter menu icon","Filtermenu Icon" }, |
1329 | { "<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n","<p><b>A+(shift oder ctrl)</b>: Zeige Zeit bis zum nächsten Alarm</p>\n" }, | 1329 | { "<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n","<p><b>A+(shift oder ctrl)</b>: Zeige Zeit bis zum nächsten Alarm</p>\n" }, |
1330 | { "<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n","<p><b>N</b>: Wechsle zur nächsten Ansicht, die ein Icon in der Toolbar hat</p>\n" }, | 1330 | { "<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n","<p><b>N</b>: Wechsle zur nächsten Ansicht, die ein Icon in der Toolbar hat</p>\n" }, |
1331 | { "%1d","%1t" }, | ||
1332 | { "%1h","%1std" }, | ||
1333 | { "%1min","%1min" }, | ||
1334 | { "( %1 before )","( %1 vorher )" }, | ||
1331 | { "","" }, | 1335 | { "","" }, |
1332 | { "","" }, | 1336 | { "","" }, |
1333 | { "","" }, | 1337 | { "","" }, |
1334 | { "","" }, | 1338 | { "","" }, |
1335 | { "","" }, | 1339 | { "","" }, |
1336 | { "","" }, | 1340 | { "","" }, |
1337 | { "","" }, | 1341 | { "","" }, |
1338 | { "","" }, | 1342 | { "","" }, |
1339 | { "","" }, | 1343 | { "","" } \ No newline at end of file |
1340 | { "","" }, | ||
1341 | { "","" }, | ||
1342 | { "","" }, | ||
1343 | { "","" }, \ No newline at end of file | ||
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index dbe0668..bdad248 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -277,291 +277,301 @@ void KOEventViewer::setColorMode( int m ) | |||
277 | { | 277 | { |
278 | mColorMode = m; | 278 | mColorMode = m; |
279 | } | 279 | } |
280 | void KOEventViewer::appendEvent(Event *event, int mode ) | 280 | void KOEventViewer::appendEvent(Event *event, int mode ) |
281 | { | 281 | { |
282 | mMailSubject = ""; | 282 | mMailSubject = ""; |
283 | mCurrentIncidence = event; | 283 | mCurrentIncidence = event; |
284 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 284 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
285 | topLevelWidget()->setCaption(i18n("Event Viewer")); | 285 | topLevelWidget()->setCaption(i18n("Event Viewer")); |
286 | if ( mode == 0 ) { | 286 | if ( mode == 0 ) { |
287 | addTag("h2",deTag(event->summary())); | 287 | addTag("h2",deTag(event->summary())); |
288 | } | 288 | } |
289 | else { | 289 | else { |
290 | if ( mColorMode == 1 ) { | 290 | if ( mColorMode == 1 ) { |
291 | mText +="<font color=\"#00A000\">"; | 291 | mText +="<font color=\"#00A000\">"; |
292 | } | 292 | } |
293 | if ( mColorMode == 2 ) { | 293 | if ( mColorMode == 2 ) { |
294 | mText +="<font color=\"#C00000\">"; | 294 | mText +="<font color=\"#C00000\">"; |
295 | } | 295 | } |
296 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 296 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
297 | if ( mode == 1 ) { | 297 | if ( mode == 1 ) { |
298 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); | 298 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); |
299 | } else { | 299 | } else { |
300 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); | 300 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); |
301 | } | 301 | } |
302 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 302 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
303 | if ( mColorMode ) | 303 | if ( mColorMode ) |
304 | mText += "</font>"; | 304 | mText += "</font>"; |
305 | } | 305 | } |
306 | mMailSubject += i18n( "Meeting " )+ event->summary(); | 306 | mMailSubject += i18n( "Meeting " )+ event->summary(); |
307 | if (event->cancelled ()) { | 307 | if (event->cancelled ()) { |
308 | mText +="<font color=\"#B00000\">"; | 308 | mText +="<font color=\"#B00000\">"; |
309 | addTag("i",i18n("This event has been cancelled!")); | 309 | addTag("i",i18n("This event has been cancelled!")); |
310 | mText.append("<br>"); | 310 | mText.append("<br>"); |
311 | mText += "</font>"; | 311 | mText += "</font>"; |
312 | mMailSubject += i18n("(cancelled)"); | 312 | mMailSubject += i18n("(cancelled)"); |
313 | } | 313 | } |
314 | if (!event->location().isEmpty()) { | 314 | if (!event->location().isEmpty()) { |
315 | addTag("b",i18n("Location: ")); | 315 | addTag("b",i18n("Location: ")); |
316 | mText.append(deTag(event->location())+"<br>"); | 316 | mText.append(deTag(event->location())+"<br>"); |
317 | mMailSubject += i18n(" at ") + event->location(); | 317 | mMailSubject += i18n(" at ") + event->location(); |
318 | } | 318 | } |
319 | if (event->doesFloat()) { | 319 | if (event->doesFloat()) { |
320 | if (event->isMultiDay()) { | 320 | if (event->isMultiDay()) { |
321 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") | 321 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") |
322 | .arg(event->dtStartDateStr(shortDate)) | 322 | .arg(event->dtStartDateStr(shortDate)) |
323 | .arg(event->dtEndDateStr(shortDate))); | 323 | .arg(event->dtEndDateStr(shortDate))); |
324 | } else { | 324 | } else { |
325 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); | 325 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); |
326 | } | 326 | } |
327 | } else { | 327 | } else { |
328 | if (event->isMultiDay()) { | 328 | if (event->isMultiDay()) { |
329 | mText.append(i18n("<p><b>From:</b> %1</p> ") | 329 | mText.append(i18n("<p><b>From:</b> %1</p> ") |
330 | .arg(event->dtStartStr( shortDate))); | 330 | .arg(event->dtStartStr( shortDate))); |
331 | mText.append(i18n("<p><b>To:</b> %1</p>") | 331 | mText.append(i18n("<p><b>To:</b> %1</p>") |
332 | .arg(event->dtEndStr(shortDate))); | 332 | .arg(event->dtEndStr(shortDate))); |
333 | } else { | 333 | } else { |
334 | mText.append(i18n("<p><b>On:</b> %1</p> ") | 334 | mText.append(i18n("<p><b>On:</b> %1</p> ") |
335 | .arg(event->dtStartDateStr( shortDate ))); | 335 | .arg(event->dtStartDateStr( shortDate ))); |
336 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") | 336 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") |
337 | .arg(event->dtStartTimeStr()) | 337 | .arg(event->dtStartTimeStr()) |
338 | .arg(event->dtEndTimeStr())); | 338 | .arg(event->dtEndTimeStr())); |
339 | } | 339 | } |
340 | } | 340 | } |
341 | 341 | ||
342 | if (event->recurrence()->doesRecur()) { | 342 | if (event->recurrence()->doesRecur()) { |
343 | 343 | ||
344 | QString recurText = event->recurrence()->recurrenceText(); | 344 | QString recurText = event->recurrence()->recurrenceText(); |
345 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); | 345 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); |
346 | bool ok; | 346 | bool ok; |
347 | QDate start = QDate::currentDate(); | 347 | QDate start = QDate::currentDate(); |
348 | QDateTime next; | 348 | QDateTime next; |
349 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); | 349 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); |
350 | if ( ok ) { | 350 | if ( ok ) { |
351 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); | 351 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); |
352 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); | 352 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); |
353 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); | 353 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); |
354 | 354 | ||
355 | } else { | 355 | } else { |
356 | bool last; | 356 | bool last; |
357 | QDate nextd; | 357 | QDate nextd; |
358 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); | 358 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); |
359 | if ( last ) { | 359 | if ( last ) { |
360 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | 360 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); |
361 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); | 361 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); |
362 | } | 362 | } |
363 | } | 363 | } |
364 | } else { | 364 | } else { |
365 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); | 365 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); |
366 | 366 | ||
367 | } | 367 | } |
368 | 368 | ||
369 | 369 | ||
370 | if (event->isAlarmEnabled()) { | 370 | if (event->isAlarmEnabled()) { |
371 | Alarm *alarm =event->alarms().first() ; | 371 | Alarm *alarm =event->alarms().first() ; |
372 | QDateTime t = alarm->time(); | 372 | QDateTime t = alarm->time(); |
373 | int min = t.secsTo( event->dtStart() )/60; | 373 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); |
374 | QString s =i18n("( %1 min before )").arg( min ); | ||
375 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | 374 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); |
376 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 375 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
377 | //addTag("p",s); | 376 | //addTag("p",s); |
378 | } | 377 | } |
379 | 378 | ||
380 | addTag("b",i18n("Access: ")); | 379 | addTag("b",i18n("Access: ")); |
381 | mText.append(event->secrecyStr()+"<br>"); | 380 | mText.append(event->secrecyStr()+"<br>"); |
382 | 381 | ||
383 | 382 | ||
384 | if ( KOPrefs::instance()->mEVshowDetails ) { | 383 | if ( KOPrefs::instance()->mEVshowDetails ) { |
385 | if (!event->description().isEmpty()) { | 384 | if (!event->description().isEmpty()) { |
386 | addTag("p",i18n("<b>Details: </b>")); | 385 | addTag("p",i18n("<b>Details: </b>")); |
387 | addTag("p",deTag(event->description())); | 386 | addTag("p",deTag(event->description())); |
388 | } | 387 | } |
389 | } | 388 | } |
390 | formatCategories(event); | 389 | formatCategories(event); |
391 | 390 | ||
392 | formatReadOnly(event); | 391 | formatReadOnly(event); |
393 | formatAttendees(event); | 392 | formatAttendees(event); |
394 | 393 | ||
395 | if ( KOPrefs::instance()->mEVshowCreated ) { | 394 | if ( KOPrefs::instance()->mEVshowCreated ) { |
396 | addTag("p",i18n("<b>Created: ") +" </b>"); | 395 | addTag("p",i18n("<b>Created: ") +" </b>"); |
397 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 396 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
398 | 397 | ||
399 | } | 398 | } |
400 | if ( KOPrefs::instance()->mEVshowChanged ) { | 399 | if ( KOPrefs::instance()->mEVshowChanged ) { |
401 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | 400 | addTag("p",i18n("<b>Last modified: ") +" </b>"); |
402 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 401 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
403 | 402 | ||
404 | } | 403 | } |
405 | setText(mText); | 404 | setText(mText); |
406 | //QWhatsThis::add(this,mText); | 405 | //QWhatsThis::add(this,mText); |
407 | 406 | ||
408 | } | 407 | } |
409 | 408 | ||
410 | void KOEventViewer::appendTodo(Todo *event, int mode ) | 409 | void KOEventViewer::appendTodo(Todo *event, int mode ) |
411 | { | 410 | { |
412 | mMailSubject = ""; | 411 | mMailSubject = ""; |
413 | mCurrentIncidence = event; | 412 | mCurrentIncidence = event; |
414 | topLevelWidget()->setCaption(i18n("Todo Viewer")); | 413 | topLevelWidget()->setCaption(i18n("Todo Viewer")); |
415 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 414 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
416 | if (mode == 0 ) | 415 | if (mode == 0 ) |
417 | addTag("h2",deTag(event->summary())); | 416 | addTag("h2",deTag(event->summary())); |
418 | else { | 417 | else { |
419 | if ( mColorMode == 1 ) { | 418 | if ( mColorMode == 1 ) { |
420 | mText +="<font color=\"#00A000\">"; | 419 | mText +="<font color=\"#00A000\">"; |
421 | } | 420 | } |
422 | if ( mColorMode == 2 ) { | 421 | if ( mColorMode == 2 ) { |
423 | mText +="<font color=\"#B00000\">"; | 422 | mText +="<font color=\"#B00000\">"; |
424 | } | 423 | } |
425 | if ( mode == 1 ) { | 424 | if ( mode == 1 ) { |
426 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); | 425 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); |
427 | } else { | 426 | } else { |
428 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); | 427 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); |
429 | } | 428 | } |
430 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 429 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
431 | if ( mColorMode ) | 430 | if ( mColorMode ) |
432 | mText += "</font>"; | 431 | mText += "</font>"; |
433 | } | 432 | } |
434 | mMailSubject += i18n( "Todo " )+ event->summary(); | 433 | mMailSubject += i18n( "Todo " )+ event->summary(); |
435 | 434 | ||
436 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { | 435 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { |
437 | mText +="<font color=\"#B00000\">"; | 436 | mText +="<font color=\"#B00000\">"; |
438 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); | 437 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); |
439 | mText += "</font>"; | 438 | mText += "</font>"; |
440 | } else { | 439 | } else { |
441 | mText.append(i18n("<p><i>%1 % completed</i></p>") | 440 | mText.append(i18n("<p><i>%1 % completed</i></p>") |
442 | .arg(event->percentComplete())); | 441 | .arg(event->percentComplete())); |
443 | } | 442 | } |
444 | 443 | ||
445 | if (event->cancelled ()) { | 444 | if (event->cancelled ()) { |
446 | mText +="<font color=\"#B00000\">"; | 445 | mText +="<font color=\"#B00000\">"; |
447 | addTag("i",i18n("This todo has been cancelled!")); | 446 | addTag("i",i18n("This todo has been cancelled!")); |
448 | mText.append("<br>"); | 447 | mText.append("<br>"); |
449 | mText += "</font>"; | 448 | mText += "</font>"; |
450 | mMailSubject += i18n("(cancelled)"); | 449 | mMailSubject += i18n("(cancelled)"); |
451 | } | 450 | } |
452 | 451 | ||
453 | if (!event->location().isEmpty()) { | 452 | if (!event->location().isEmpty()) { |
454 | addTag("b",i18n("Location: ")); | 453 | addTag("b",i18n("Location: ")); |
455 | mText.append(deTag(event->location())+"<br>"); | 454 | mText.append(deTag(event->location())+"<br>"); |
456 | mMailSubject += i18n(" at ") + event->location(); | 455 | mMailSubject += i18n(" at ") + event->location(); |
457 | } | 456 | } |
458 | 457 | ||
459 | if (event->recurrence()->doesRecur()) { | 458 | if (event->recurrence()->doesRecur()) { |
460 | 459 | ||
461 | QString recurText = event->recurrence()->recurrenceText(); | 460 | QString recurText = event->recurrence()->recurrenceText(); |
462 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); | 461 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); |
463 | 462 | ||
464 | } | 463 | } |
465 | if (event->hasStartDate()) { | 464 | if (event->hasStartDate()) { |
466 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); | 465 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); |
467 | } | 466 | } |
468 | if (event->hasDueDate()) { | 467 | if (event->hasDueDate()) { |
469 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); | 468 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); |
470 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); | 469 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); |
471 | } | 470 | } |
471 | |||
472 | |||
473 | if (event->isAlarmEnabled()) { | ||
474 | Alarm *alarm =event->alarms().first() ; | ||
475 | QDateTime t = alarm->time(); | ||
476 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); | ||
477 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | ||
478 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | ||
479 | //addTag("p",s); | ||
480 | } | ||
481 | |||
472 | addTag("b",i18n("Access: ")); | 482 | addTag("b",i18n("Access: ")); |
473 | mText.append(event->secrecyStr()+"<br>"); | 483 | mText.append(event->secrecyStr()+"<br>"); |
474 | if ( KOPrefs::instance()->mEVshowDetails ) { | 484 | if ( KOPrefs::instance()->mEVshowDetails ) { |
475 | if (!event->description().isEmpty()) { | 485 | if (!event->description().isEmpty()) { |
476 | addTag("p",i18n("<b>Details: </b>")); | 486 | addTag("p",i18n("<b>Details: </b>")); |
477 | addTag("p",deTag(event->description())); | 487 | addTag("p",deTag(event->description())); |
478 | } | 488 | } |
479 | } | 489 | } |
480 | 490 | ||
481 | formatCategories(event); | 491 | formatCategories(event); |
482 | 492 | ||
483 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 493 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
484 | .arg(QString::number(event->priority()))); | 494 | .arg(QString::number(event->priority()))); |
485 | 495 | ||
486 | formatReadOnly(event); | 496 | formatReadOnly(event); |
487 | formatAttendees(event); | 497 | formatAttendees(event); |
488 | if ( event->relatedTo() ) { | 498 | if ( event->relatedTo() ) { |
489 | addTag("b",i18n("Parent todo:<br>")); | 499 | addTag("b",i18n("Parent todo:<br>")); |
490 | mText.append(deTag(event->relatedTo()->summary())+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); | 500 | mText.append(deTag(event->relatedTo()->summary())+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); |
491 | } | 501 | } |
492 | QPtrList<Incidence> Relations = event->relations(); | 502 | QPtrList<Incidence> Relations = event->relations(); |
493 | Incidence *to; | 503 | Incidence *to; |
494 | if ( Relations.first() ) | 504 | if ( Relations.first() ) |
495 | addTag("b",i18n("Sub todos:<br>")); | 505 | addTag("b",i18n("Sub todos:<br>")); |
496 | for (to=Relations.first();to;to=Relations.next()) { | 506 | for (to=Relations.first();to;to=Relations.next()) { |
497 | mText.append( deTag(to->summary())+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); | 507 | mText.append( deTag(to->summary())+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); |
498 | 508 | ||
499 | } | 509 | } |
500 | if ( KOPrefs::instance()->mEVshowCreated ) { | 510 | if ( KOPrefs::instance()->mEVshowCreated ) { |
501 | addTag("p",i18n("<b>Created: ") +" </b>"); | 511 | addTag("p",i18n("<b>Created: ") +" </b>"); |
502 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 512 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
503 | 513 | ||
504 | } | 514 | } |
505 | if ( KOPrefs::instance()->mEVshowChanged ) { | 515 | if ( KOPrefs::instance()->mEVshowChanged ) { |
506 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | 516 | addTag("p",i18n("<b>Last modified: ") +" </b>"); |
507 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 517 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
508 | 518 | ||
509 | } | 519 | } |
510 | setText(mText); | 520 | setText(mText); |
511 | } | 521 | } |
512 | 522 | ||
513 | void KOEventViewer::formatCategories(Incidence *event) | 523 | void KOEventViewer::formatCategories(Incidence *event) |
514 | { | 524 | { |
515 | if (!event->categoriesStr().isEmpty()) { | 525 | if (!event->categoriesStr().isEmpty()) { |
516 | if (event->categories().count() == 1) { | 526 | if (event->categories().count() == 1) { |
517 | addTag("h3",i18n("Category")); | 527 | addTag("h3",i18n("Category")); |
518 | } else { | 528 | } else { |
519 | addTag("h3",i18n("Categories")); | 529 | addTag("h3",i18n("Categories")); |
520 | } | 530 | } |
521 | addTag("p",event->categoriesStr()); | 531 | addTag("p",event->categoriesStr()); |
522 | } | 532 | } |
523 | } | 533 | } |
524 | void KOEventViewer::formatAttendees(Incidence *event) | 534 | void KOEventViewer::formatAttendees(Incidence *event) |
525 | { | 535 | { |
526 | QPtrList<Attendee> attendees = event->attendees(); | 536 | QPtrList<Attendee> attendees = event->attendees(); |
527 | if (attendees.count()) { | 537 | if (attendees.count()) { |
528 | 538 | ||
529 | 539 | ||
530 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); | 540 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); |
531 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); | 541 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); |
532 | addTag("h3",i18n("Organizer")); | 542 | addTag("h3",i18n("Organizer")); |
533 | mText.append("<ul><li>"); | 543 | mText.append("<ul><li>"); |
534 | #ifndef KORG_NOKABC | 544 | #ifndef KORG_NOKABC |
535 | 545 | ||
536 | #ifdef DESKTOP_VERSION | 546 | #ifdef DESKTOP_VERSION |
537 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); | 547 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); |
538 | KABC::Addressee::List addressList; | 548 | KABC::Addressee::List addressList; |
539 | addressList = add_book->findByEmail(event->organizer()); | 549 | addressList = add_book->findByEmail(event->organizer()); |
540 | KABC::Addressee o = addressList.first(); | 550 | KABC::Addressee o = addressList.first(); |
541 | if (!o.isEmpty() && addressList.size()<2) { | 551 | if (!o.isEmpty() && addressList.size()<2) { |
542 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 552 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
543 | mText += o.formattedName(); | 553 | mText += o.formattedName(); |
544 | mText += "</a>\n"; | 554 | mText += "</a>\n"; |
545 | } else { | 555 | } else { |
546 | mText.append(event->organizer()); | 556 | mText.append(event->organizer()); |
547 | } | 557 | } |
548 | #else //DESKTOP_VERSION | 558 | #else //DESKTOP_VERSION |
549 | mText += "<a href=\"uid:organizer\">"; | 559 | mText += "<a href=\"uid:organizer\">"; |
550 | mText += event->organizer(); | 560 | mText += event->organizer(); |
551 | mText += "</a>\n"; | 561 | mText += "</a>\n"; |
552 | #endif //DESKTOP_VERSION | 562 | #endif //DESKTOP_VERSION |
553 | 563 | ||
554 | 564 | ||
555 | #else | 565 | #else |
556 | mText.append(event->organizer()); | 566 | mText.append(event->organizer()); |
557 | #endif | 567 | #endif |
558 | 568 | ||
559 | if (iconPath) { | 569 | if (iconPath) { |
560 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; | 570 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; |
561 | mText += "<IMG src=\"" + iconPath + "\">"; | 571 | mText += "<IMG src=\"" + iconPath + "\">"; |
562 | mText += "</a>\n"; | 572 | mText += "</a>\n"; |
563 | } | 573 | } |
564 | mText.append("</li></ul>"); | 574 | mText.append("</li></ul>"); |
565 | 575 | ||
566 | addTag("h3",i18n("Attendees")); | 576 | addTag("h3",i18n("Attendees")); |
567 | Attendee *a; | 577 | Attendee *a; |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 15e094d..e0e138e 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -27,228 +27,236 @@ | |||
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qpopupmenu.h> | 28 | #include <qpopupmenu.h> |
29 | #include <qprogressbar.h> | 29 | #include <qprogressbar.h> |
30 | #include <qfileinfo.h> | 30 | #include <qfileinfo.h> |
31 | #include <qmessagebox.h> | 31 | #include <qmessagebox.h> |
32 | #include <qdialog.h> | 32 | #include <qdialog.h> |
33 | #include <qtextstream.h> | 33 | #include <qtextstream.h> |
34 | #include <qdir.h> | 34 | #include <qdir.h> |
35 | #include <qwhatsthis.h> | 35 | #include <qwhatsthis.h> |
36 | #include <qregexp.h> | 36 | #include <qregexp.h> |
37 | 37 | ||
38 | #include <klocale.h> | 38 | #include <klocale.h> |
39 | #include <kdebug.h> | 39 | #include <kdebug.h> |
40 | #include <kiconloader.h> | 40 | #include <kiconloader.h> |
41 | #include <kglobal.h> | 41 | #include <kglobal.h> |
42 | 42 | ||
43 | #include <libkdepim/kpimglobalprefs.h> | 43 | #include <libkdepim/kpimglobalprefs.h> |
44 | #include <libkcal/calendar.h> | 44 | #include <libkcal/calendar.h> |
45 | #include <libkcal/calendarlocal.h> | 45 | #include <libkcal/calendarlocal.h> |
46 | #include <libkcal/icalformat.h> | 46 | #include <libkcal/icalformat.h> |
47 | #include <libkcal/vcalformat.h> | 47 | #include <libkcal/vcalformat.h> |
48 | #include <libkcal/recurrence.h> | 48 | #include <libkcal/recurrence.h> |
49 | #include <libkcal/filestorage.h> | 49 | #include <libkcal/filestorage.h> |
50 | #include <libkdepim/categoryselectdialog.h> | 50 | #include <libkdepim/categoryselectdialog.h> |
51 | #include <libkcal/kincidenceformatter.h> | 51 | #include <libkcal/kincidenceformatter.h> |
52 | #ifndef DESKTOP_VERSION | 52 | #ifndef DESKTOP_VERSION |
53 | #include <qpe/qpeapplication.h> | 53 | #include <qpe/qpeapplication.h> |
54 | #else | 54 | #else |
55 | #include <qapplication.h> | 55 | #include <qapplication.h> |
56 | #endif | 56 | #endif |
57 | 57 | ||
58 | #ifndef KORG_NOPRINTER | 58 | #ifndef KORG_NOPRINTER |
59 | #include "calprinter.h" | 59 | #include "calprinter.h" |
60 | #endif | 60 | #endif |
61 | #include "koglobals.h" | 61 | #include "koglobals.h" |
62 | #include "koprefs.h" | 62 | #include "koprefs.h" |
63 | #include "kfiledialog.h" | 63 | #include "kfiledialog.h" |
64 | 64 | ||
65 | #include "kolistview.h" | 65 | #include "kolistview.h" |
66 | 66 | ||
67 | 67 | ||
68 | 68 | ||
69 | 69 | ||
70 | class KOListViewWhatsThis :public QWhatsThis | 70 | class KOListViewWhatsThis :public QWhatsThis |
71 | { | 71 | { |
72 | public: | 72 | public: |
73 | KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; | 73 | KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; |
74 | 74 | ||
75 | protected: | 75 | protected: |
76 | virtual QString text( const QPoint& p) | 76 | virtual QString text( const QPoint& p) |
77 | { | 77 | { |
78 | return _view->getWhatsThisText(p) ; | 78 | return _view->getWhatsThisText(p) ; |
79 | } | 79 | } |
80 | private: | 80 | private: |
81 | QWidget* _wid; | 81 | QWidget* _wid; |
82 | KOListView * _view; | 82 | KOListView * _view; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | 85 | ||
86 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) | 86 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) |
87 | { | 87 | { |
88 | mItem = item; | 88 | mItem = item; |
89 | mDate = date; | 89 | mDate = date; |
90 | } | 90 | } |
91 | 91 | ||
92 | ListItemVisitor::~ListItemVisitor() | 92 | ListItemVisitor::~ListItemVisitor() |
93 | { | 93 | { |
94 | } | 94 | } |
95 | 95 | ||
96 | bool ListItemVisitor::visit(Event *e) | 96 | bool ListItemVisitor::visit(Event *e) |
97 | { | 97 | { |
98 | 98 | ||
99 | bool ok = false; | 99 | bool ok = false; |
100 | QString start, end; | 100 | QString start, end; |
101 | QDate ds, de; | 101 | QDate ds, de; |
102 | if ( e->doesRecur() ) { | 102 | if ( e->doesRecur() ) { |
103 | ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); | 103 | ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); |
104 | if ( ok ) { | 104 | if ( ok ) { |
105 | int days = e->dtStart().date().daysTo(e->dtEnd().date() ); | 105 | int days = e->dtStart().date().daysTo(e->dtEnd().date() ); |
106 | start = KGlobal::locale()->formatDate(ds,true); | 106 | start = KGlobal::locale()->formatDate(ds,true); |
107 | de = ds.addDays( days); | 107 | de = ds.addDays( days); |
108 | end = KGlobal::locale()->formatDate(de,true); | 108 | end = KGlobal::locale()->formatDate(de,true); |
109 | } | 109 | } |
110 | 110 | ||
111 | } | 111 | } |
112 | if ( ! ok ) { | 112 | if ( ! ok ) { |
113 | start =e->dtStartDateStr(); | 113 | start =e->dtStartDateStr(); |
114 | end = e->dtEndDateStr(); | 114 | end = e->dtEndDateStr(); |
115 | ds = e->dtStart().date(); | 115 | ds = e->dtStart().date(); |
116 | de = e->dtEnd().date(); | 116 | de = e->dtEnd().date(); |
117 | } | 117 | } |
118 | mItem->setText(0,e->summary()); | 118 | mItem->setText(0,e->summary()); |
119 | mItem->setText(1,start); | 119 | mItem->setText(1,start); |
120 | mItem->setText(2,e->dtStartTimeStr()); | 120 | mItem->setText(2,e->dtStartTimeStr()); |
121 | mItem->setText(3,end); | 121 | mItem->setText(3,end); |
122 | mItem->setText(4,e->dtEndTimeStr()); | 122 | mItem->setText(4,e->dtEndTimeStr()); |
123 | mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No")); | 123 | if ( e->isAlarmEnabled() ) { |
124 | mItem->setText(5,e->alarms().first()->offsetText() ); | ||
125 | } else { | ||
126 | mItem->setText(5, i18n("No")); | ||
127 | } | ||
124 | mItem->setText(6, e->recurrence()->recurrenceText()); | 128 | mItem->setText(6, e->recurrence()->recurrenceText()); |
125 | mItem->setText(7,"---"); | 129 | mItem->setText(7,"---"); |
126 | mItem->setText(8,"---"); | 130 | mItem->setText(8,"---"); |
127 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); | 131 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); |
128 | mItem->setText(10,e->categoriesStr()); | 132 | mItem->setText(10,e->categoriesStr()); |
129 | 133 | ||
130 | QString key; | 134 | QString key; |
131 | QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); | 135 | QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); |
132 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); | 136 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); |
133 | mItem->setSortKey(1,key); | 137 | mItem->setSortKey(1,key); |
134 | 138 | ||
135 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); | 139 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); |
136 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); | 140 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); |
137 | mItem->setSortKey(3,key); | 141 | mItem->setSortKey(3,key); |
138 | 142 | ||
139 | return true; | 143 | return true; |
140 | } | 144 | } |
141 | 145 | ||
142 | bool ListItemVisitor::visit(Todo *t) | 146 | bool ListItemVisitor::visit(Todo *t) |
143 | { | 147 | { |
144 | mItem->setText(0,i18n("Todo: %1").arg(t->summary())); | 148 | mItem->setText(0,i18n("Todo: %1").arg(t->summary())); |
145 | if (t->hasStartDate()) { | 149 | if (t->hasStartDate()) { |
146 | mItem->setText(1,t->dtStartDateStr()); | 150 | mItem->setText(1,t->dtStartDateStr()); |
147 | if (t->doesFloat()) { | 151 | if (t->doesFloat()) { |
148 | mItem->setText(2,"---"); | 152 | mItem->setText(2,"---"); |
149 | } else { | 153 | } else { |
150 | mItem->setText(2,t->dtStartTimeStr()); | 154 | mItem->setText(2,t->dtStartTimeStr()); |
151 | } | 155 | } |
152 | } else { | 156 | } else { |
153 | mItem->setText(1,"---"); | 157 | mItem->setText(1,"---"); |
154 | mItem->setText(2,"---"); | 158 | mItem->setText(2,"---"); |
155 | } | 159 | } |
156 | mItem->setText(3,"---"); | 160 | mItem->setText(3,"---"); |
157 | mItem->setText(4,"---"); | 161 | mItem->setText(4,"---"); |
158 | mItem->setText(5,t->isAlarmEnabled() ? i18n("Yes") : i18n("No")); | 162 | if ( t->isAlarmEnabled() ) { |
163 | mItem->setText(5,t->alarms().first()->offsetText() ); | ||
164 | } else { | ||
165 | mItem->setText(5, i18n("No")); | ||
166 | } | ||
159 | mItem->setText(6, t->recurrence()->recurrenceText()); | 167 | mItem->setText(6, t->recurrence()->recurrenceText()); |
160 | if (t->hasDueDate()) { | 168 | if (t->hasDueDate()) { |
161 | mItem->setText(7,t->dtDueDateStr()); | 169 | mItem->setText(7,t->dtDueDateStr()); |
162 | if (t->doesFloat()) { | 170 | if (t->doesFloat()) { |
163 | mItem->setText(8,"---"); | 171 | mItem->setText(8,"---"); |
164 | } else { | 172 | } else { |
165 | mItem->setText(8,t->dtDueTimeStr()); | 173 | mItem->setText(8,t->dtDueTimeStr()); |
166 | } | 174 | } |
167 | } else { | 175 | } else { |
168 | mItem->setText(7,"---"); | 176 | mItem->setText(7,"---"); |
169 | mItem->setText(8,"---"); | 177 | mItem->setText(8,"---"); |
170 | } | 178 | } |
171 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); | 179 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); |
172 | mItem->setText(10,t->categoriesStr()); | 180 | mItem->setText(10,t->categoriesStr()); |
173 | 181 | ||
174 | QString key; | 182 | QString key; |
175 | QDate d; | 183 | QDate d; |
176 | if (t->hasDueDate()) { | 184 | if (t->hasDueDate()) { |
177 | d = t->dtDue().date(); | 185 | d = t->dtDue().date(); |
178 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); | 186 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); |
179 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 187 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
180 | mItem->setSortKey(7,key); | 188 | mItem->setSortKey(7,key); |
181 | } | 189 | } |
182 | if ( t->hasStartDate() ) { | 190 | if ( t->hasStartDate() ) { |
183 | d = t->dtStart().date(); | 191 | d = t->dtStart().date(); |
184 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); | 192 | 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()); | 193 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
186 | mItem->setSortKey(1,key); | 194 | mItem->setSortKey(1,key); |
187 | } | 195 | } |
188 | return true; | 196 | return true; |
189 | } | 197 | } |
190 | 198 | ||
191 | bool ListItemVisitor::visit(Journal * j) | 199 | bool ListItemVisitor::visit(Journal * j) |
192 | { | 200 | { |
193 | QString des = j->description().left(30); | 201 | QString des = j->description().left(30); |
194 | des = des.simplifyWhiteSpace (); | 202 | des = des.simplifyWhiteSpace (); |
195 | des.replace (QRegExp ("\\n"),"" ); | 203 | des.replace (QRegExp ("\\n"),"" ); |
196 | des.replace (QRegExp ("\\r"),"" ); | 204 | des.replace (QRegExp ("\\r"),"" ); |
197 | mItem->setText(0,i18n("Journal: ")+des.left(25)); | 205 | mItem->setText(0,i18n("Journal: ")+des.left(25)); |
198 | mItem->setText(1,j->dtStartDateStr()); | 206 | mItem->setText(1,j->dtStartDateStr()); |
199 | mItem->setText(2,"---"); | 207 | mItem->setText(2,"---"); |
200 | mItem->setText(3,"---"); | 208 | mItem->setText(3,"---"); |
201 | mItem->setText(4,"---"); | 209 | mItem->setText(4,"---"); |
202 | mItem->setText(5,"---"); | 210 | mItem->setText(5,"---"); |
203 | mItem->setText(6,"---"); | 211 | mItem->setText(6,"---"); |
204 | mItem->setText(7,j->dtStartDateStr()); | 212 | mItem->setText(7,j->dtStartDateStr()); |
205 | mItem->setText(8,"---"); | 213 | mItem->setText(8,"---"); |
206 | mItem->setText(9,"---"); | 214 | mItem->setText(9,"---"); |
207 | mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); | 215 | mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); |
208 | 216 | ||
209 | QString key; | 217 | QString key; |
210 | QDate d = j->dtStart().date(); | 218 | QDate d = j->dtStart().date(); |
211 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 219 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
212 | mItem->setSortKey(1,key); | 220 | mItem->setSortKey(1,key); |
213 | mItem->setSortKey(7,key); | 221 | mItem->setSortKey(7,key); |
214 | 222 | ||
215 | return true; | 223 | return true; |
216 | } | 224 | } |
217 | 225 | ||
218 | KOListView::KOListView(Calendar *calendar, QWidget *parent, | 226 | KOListView::KOListView(Calendar *calendar, QWidget *parent, |
219 | const char *name) | 227 | const char *name) |
220 | : KOEventView(calendar, parent, name) | 228 | : KOEventView(calendar, parent, name) |
221 | { | 229 | { |
222 | mActiveItem = 0; | 230 | mActiveItem = 0; |
223 | mListView = new KOListViewListView(this); | 231 | mListView = new KOListViewListView(this); |
224 | mListView->addColumn(i18n("Summary")); | 232 | mListView->addColumn(i18n("Summary")); |
225 | mListView->addColumn(i18n("Start Date")); | 233 | mListView->addColumn(i18n("Start Date")); |
226 | mListView->addColumn(i18n("Start Time")); | 234 | mListView->addColumn(i18n("Start Time")); |
227 | mListView->addColumn(i18n("End Date")); | 235 | mListView->addColumn(i18n("End Date")); |
228 | mListView->addColumn(i18n("End Time")); | 236 | mListView->addColumn(i18n("End Time")); |
229 | mListView->addColumn(i18n("Alarm")); // alarm set? | 237 | mListView->addColumn(i18n("Alarm")); // alarm set? |
230 | mListView->addColumn(i18n("Recurs")); // recurs? | 238 | mListView->addColumn(i18n("Recurs")); // recurs? |
231 | mListView->addColumn(i18n("Due Date")); | 239 | mListView->addColumn(i18n("Due Date")); |
232 | mListView->addColumn(i18n("Due Time")); | 240 | mListView->addColumn(i18n("Due Time")); |
233 | mListView->addColumn(i18n("Cancelled")); | 241 | mListView->addColumn(i18n("Cancelled")); |
234 | mListView->addColumn(i18n("Categories")); | 242 | mListView->addColumn(i18n("Categories")); |
235 | 243 | ||
236 | mListView->setColumnAlignment(0,AlignLeft); | 244 | mListView->setColumnAlignment(0,AlignLeft); |
237 | mListView->setColumnAlignment(1,AlignLeft); | 245 | mListView->setColumnAlignment(1,AlignLeft); |
238 | mListView->setColumnAlignment(2,AlignHCenter); | 246 | mListView->setColumnAlignment(2,AlignHCenter); |
239 | mListView->setColumnAlignment(3,AlignLeft); | 247 | mListView->setColumnAlignment(3,AlignLeft); |
240 | mListView->setColumnAlignment(4,AlignHCenter); | 248 | mListView->setColumnAlignment(4,AlignHCenter); |
241 | mListView->setColumnAlignment(5,AlignLeft); | 249 | mListView->setColumnAlignment(5,AlignLeft); |
242 | mListView->setColumnAlignment(6,AlignLeft); | 250 | mListView->setColumnAlignment(6,AlignLeft); |
243 | mListView->setColumnAlignment(7,AlignLeft); | 251 | mListView->setColumnAlignment(7,AlignLeft); |
244 | mListView->setColumnAlignment(8,AlignLeft); | 252 | mListView->setColumnAlignment(8,AlignLeft); |
245 | mListView->setColumnAlignment(9,AlignLeft); | 253 | mListView->setColumnAlignment(9,AlignLeft); |
246 | mListView->setColumnAlignment(10,AlignLeft); | 254 | mListView->setColumnAlignment(10,AlignLeft); |
247 | mListView->setColumnWidthMode(10, QListView::Manual); | 255 | mListView->setColumnWidthMode(10, QListView::Manual); |
248 | new KOListViewWhatsThis(mListView->viewport(),this); | 256 | new KOListViewWhatsThis(mListView->viewport(),this); |
249 | 257 | ||
250 | int iii = 0; | 258 | int iii = 0; |
251 | for ( iii = 0; iii< 10 ; ++iii ) | 259 | for ( iii = 0; iii< 10 ; ++iii ) |
252 | mListView->setColumnWidthMode( iii, QListView::Manual ); | 260 | mListView->setColumnWidthMode( iii, QListView::Manual ); |
253 | 261 | ||
254 | QBoxLayout *layoutTop = new QVBoxLayout(this); | 262 | QBoxLayout *layoutTop = new QVBoxLayout(this); |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 0a315cb..01cf0ff 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -125,196 +125,198 @@ void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) | |||
125 | void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) | 125 | void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) |
126 | { | 126 | { |
127 | #ifndef KORG_NODND | 127 | #ifndef KORG_NODND |
128 | // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; | 128 | // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; |
129 | 129 | ||
130 | setCurrentItem(mOldCurrent); | 130 | setCurrentItem(mOldCurrent); |
131 | setSelected(mOldCurrent,true); | 131 | setSelected(mOldCurrent,true); |
132 | #endif | 132 | #endif |
133 | } | 133 | } |
134 | 134 | ||
135 | void KOTodoListView::contentsDropEvent(QDropEvent *e) | 135 | void KOTodoListView::contentsDropEvent(QDropEvent *e) |
136 | { | 136 | { |
137 | #ifndef KORG_NODND | 137 | #ifndef KORG_NODND |
138 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; | 138 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; |
139 | 139 | ||
140 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 140 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
141 | !QTextDrag::canDecode( e ) ) { | 141 | !QTextDrag::canDecode( e ) ) { |
142 | e->ignore(); | 142 | e->ignore(); |
143 | return; | 143 | return; |
144 | } | 144 | } |
145 | 145 | ||
146 | DndFactory factory( mCalendar ); | 146 | DndFactory factory( mCalendar ); |
147 | Todo *todo = factory.createDropTodo(e); | 147 | Todo *todo = factory.createDropTodo(e); |
148 | 148 | ||
149 | if (todo) { | 149 | if (todo) { |
150 | e->acceptAction(); | 150 | e->acceptAction(); |
151 | 151 | ||
152 | KOTodoViewItem *destination = | 152 | KOTodoViewItem *destination = |
153 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); | 153 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); |
154 | Todo *destinationEvent = 0; | 154 | Todo *destinationEvent = 0; |
155 | if (destination) destinationEvent = destination->todo(); | 155 | if (destination) destinationEvent = destination->todo(); |
156 | 156 | ||
157 | Todo *existingTodo = mCalendar->todo(todo->uid()); | 157 | Todo *existingTodo = mCalendar->todo(todo->uid()); |
158 | 158 | ||
159 | if(existingTodo) { | 159 | if(existingTodo) { |
160 | Incidence *to = destinationEvent; | 160 | Incidence *to = destinationEvent; |
161 | while(to) { | 161 | while(to) { |
162 | if (to->uid() == todo->uid()) { | 162 | if (to->uid() == todo->uid()) { |
163 | KMessageBox::sorry(this, | 163 | KMessageBox::sorry(this, |
164 | i18n("Cannot move To-Do to itself\nor a child of itself"), | 164 | i18n("Cannot move To-Do to itself\nor a child of itself"), |
165 | i18n("Drop To-Do")); | 165 | i18n("Drop To-Do")); |
166 | delete todo; | 166 | delete todo; |
167 | return; | 167 | return; |
168 | } | 168 | } |
169 | to = to->relatedTo(); | 169 | to = to->relatedTo(); |
170 | } | 170 | } |
171 | internalDrop = true; | 171 | internalDrop = true; |
172 | if ( destinationEvent ) | 172 | if ( destinationEvent ) |
173 | reparentTodoSignal( destinationEvent, existingTodo ); | 173 | reparentTodoSignal( destinationEvent, existingTodo ); |
174 | else | 174 | else |
175 | unparentTodoSignal(existingTodo); | 175 | unparentTodoSignal(existingTodo); |
176 | delete todo; | 176 | delete todo; |
177 | } else { | 177 | } else { |
178 | mCalendar->addTodo(todo); | 178 | mCalendar->addTodo(todo); |
179 | emit todoDropped(todo, KOGlobals::EVENTADDED); | 179 | emit todoDropped(todo, KOGlobals::EVENTADDED); |
180 | if ( destinationEvent ) | 180 | if ( destinationEvent ) |
181 | reparentTodoSignal( destinationEvent, todo ); | 181 | reparentTodoSignal( destinationEvent, todo ); |
182 | } | 182 | } |
183 | } | 183 | } |
184 | else { | 184 | else { |
185 | QString text; | 185 | QString text; |
186 | if (QTextDrag::decode(e,text)) { | 186 | if (QTextDrag::decode(e,text)) { |
187 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); | 187 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); |
188 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); | 188 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); |
189 | qDebug("Dropped : " + text); | 189 | qDebug("Dropped : " + text); |
190 | QStringList emails = QStringList::split(",",text); | 190 | QStringList emails = QStringList::split(",",text); |
191 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { | 191 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { |
192 | int pos = (*it).find("<"); | 192 | int pos = (*it).find("<"); |
193 | QString name = (*it).left(pos); | 193 | QString name = (*it).left(pos); |
194 | QString email = (*it).mid(pos); | 194 | QString email = (*it).mid(pos); |
195 | if (!email.isEmpty() && todoi) { | 195 | if (!email.isEmpty() && todoi) { |
196 | todoi->todo()->addAttendee(new Attendee(name,email)); | 196 | todoi->todo()->addAttendee(new Attendee(name,email)); |
197 | } | 197 | } |
198 | } | 198 | } |
199 | } | 199 | } |
200 | else { | 200 | else { |
201 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); | 201 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); |
202 | e->ignore(); | 202 | e->ignore(); |
203 | } | 203 | } |
204 | } | 204 | } |
205 | #endif | 205 | #endif |
206 | } | 206 | } |
207 | 207 | ||
208 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) | 208 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) |
209 | { | 209 | { |
210 | 210 | ||
211 | QPoint p(contentsToViewport(e->pos())); | 211 | QPoint p(contentsToViewport(e->pos())); |
212 | QListViewItem *i = itemAt(p); | 212 | QListViewItem *i = itemAt(p); |
213 | bool rootClicked = true; | 213 | bool rootClicked = true; |
214 | if (i) { | 214 | if (i) { |
215 | // if the user clicked into the root decoration of the item, don't | 215 | // if the user clicked into the root decoration of the item, don't |
216 | // try to start a drag! | 216 | // try to start a drag! |
217 | int X = p.x(); | 217 | int X = p.x(); |
218 | //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); | 218 | //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); |
219 | if (X > header()->sectionPos(0) + | 219 | if (X > header()->sectionPos(0) + |
220 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + | 220 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + |
221 | itemMargin() || | 221 | itemMargin() +i->height()|| |
222 | X < header()->sectionPos(0)) { | 222 | X < header()->sectionPos(0)) { |
223 | rootClicked = false; | 223 | rootClicked = false; |
224 | } | 224 | } |
225 | } else { | ||
226 | rootClicked = false; | ||
225 | } | 227 | } |
226 | #ifndef KORG_NODND | 228 | #ifndef KORG_NODND |
227 | mMousePressed = false; | 229 | mMousePressed = false; |
228 | if (! rootClicked ) { | 230 | if (! rootClicked ) { |
229 | mPressPos = e->pos(); | 231 | mPressPos = e->pos(); |
230 | mMousePressed = true; | 232 | mMousePressed = true; |
231 | } | 233 | } |
232 | #endif | 234 | #endif |
233 | //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); | 235 | //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); |
234 | #ifndef DESKTOP_VERSION | 236 | #ifndef DESKTOP_VERSION |
235 | if (!( e->button() == RightButton && rootClicked) ) | 237 | if (!( e->button() == RightButton && rootClicked) ) |
236 | QListView::contentsMousePressEvent(e); | 238 | QListView::contentsMousePressEvent(e); |
237 | #else | 239 | #else |
238 | QListView::contentsMousePressEvent(e); | 240 | QListView::contentsMousePressEvent(e); |
239 | #endif | 241 | #endif |
240 | } | 242 | } |
241 | void KOTodoListView::paintEvent(QPaintEvent* e) | 243 | void KOTodoListView::paintEvent(QPaintEvent* e) |
242 | { | 244 | { |
243 | emit paintNeeded(); | 245 | emit paintNeeded(); |
244 | QListView::paintEvent( e); | 246 | QListView::paintEvent( e); |
245 | } | 247 | } |
246 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) | 248 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) |
247 | { | 249 | { |
248 | 250 | ||
249 | #ifndef KORG_NODND | 251 | #ifndef KORG_NODND |
250 | //QListView::contentsMouseMoveEvent(e); | 252 | //QListView::contentsMouseMoveEvent(e); |
251 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > | 253 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > |
252 | QApplication::startDragDistance()*3) { | 254 | QApplication::startDragDistance()*3) { |
253 | mMousePressed = false; | 255 | mMousePressed = false; |
254 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); | 256 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); |
255 | if (item) { | 257 | if (item) { |
256 | DndFactory factory( mCalendar ); | 258 | DndFactory factory( mCalendar ); |
257 | ICalDrag *vd = factory.createDrag( | 259 | ICalDrag *vd = factory.createDrag( |
258 | ((KOTodoViewItem *)item)->todo(),viewport()); | 260 | ((KOTodoViewItem *)item)->todo(),viewport()); |
259 | internalDrop = false; | 261 | internalDrop = false; |
260 | // we cannot do any senseful here, because the DnD is still broken in Qt | 262 | // we cannot do any senseful here, because the DnD is still broken in Qt |
261 | if (vd->drag()) { | 263 | if (vd->drag()) { |
262 | if ( !internalDrop ) { | 264 | if ( !internalDrop ) { |
263 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); | 265 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); |
264 | qDebug("Dnd: External move: Delete drag source "); | 266 | qDebug("Dnd: External move: Delete drag source "); |
265 | } else | 267 | } else |
266 | qDebug("Dnd: Internal move "); | 268 | qDebug("Dnd: Internal move "); |
267 | 269 | ||
268 | } else { | 270 | } else { |
269 | if ( !internalDrop ) { | 271 | if ( !internalDrop ) { |
270 | qDebug("Dnd: External Copy"); | 272 | qDebug("Dnd: External Copy"); |
271 | } else | 273 | } else |
272 | qDebug("DnD: Internal copy: Copy pending"); | 274 | qDebug("DnD: Internal copy: Copy pending"); |
273 | } | 275 | } |
274 | } | 276 | } |
275 | } | 277 | } |
276 | #endif | 278 | #endif |
277 | } | 279 | } |
278 | void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) | 280 | void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) |
279 | { | 281 | { |
280 | if ( !e->isAutoRepeat() ) { | 282 | if ( !e->isAutoRepeat() ) { |
281 | mFlagKeyPressed = false; | 283 | mFlagKeyPressed = false; |
282 | } | 284 | } |
283 | } | 285 | } |
284 | 286 | ||
285 | 287 | ||
286 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) | 288 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) |
287 | { | 289 | { |
288 | qApp->processEvents(); | 290 | qApp->processEvents(); |
289 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 291 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
290 | e->ignore(); | 292 | e->ignore(); |
291 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 293 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
292 | return; | 294 | return; |
293 | } | 295 | } |
294 | if (! e->isAutoRepeat() ) | 296 | if (! e->isAutoRepeat() ) |
295 | mFlagKeyPressed = true; | 297 | mFlagKeyPressed = true; |
296 | QListViewItem* cn; | 298 | QListViewItem* cn; |
297 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { | 299 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { |
298 | cn = currentItem(); | 300 | cn = currentItem(); |
299 | if ( cn ) { | 301 | if ( cn ) { |
300 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 302 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
301 | if ( ci ){ | 303 | if ( ci ){ |
302 | if ( e->state() == ShiftButton ) | 304 | if ( e->state() == ShiftButton ) |
303 | ci->setOn( false ); | 305 | ci->setOn( false ); |
304 | else | 306 | else |
305 | ci->setOn( true ); | 307 | ci->setOn( true ); |
306 | cn = cn->itemBelow(); | 308 | cn = cn->itemBelow(); |
307 | if ( cn ) { | 309 | if ( cn ) { |
308 | setCurrentItem ( cn ); | 310 | setCurrentItem ( cn ); |
309 | ensureItemVisible ( cn ); | 311 | ensureItemVisible ( cn ); |
310 | } | 312 | } |
311 | 313 | ||
312 | } | 314 | } |
313 | } | 315 | } |
314 | 316 | ||
315 | return; | 317 | return; |
316 | } | 318 | } |
317 | 319 | ||
318 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { | 320 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { |
319 | switch ( e->key() ) { | 321 | switch ( e->key() ) { |
320 | case Qt::Key_Down: | 322 | case Qt::Key_Down: |
@@ -637,225 +639,225 @@ void KOTodoView::updateView() | |||
637 | 639 | ||
638 | mTodoListView->clear(); | 640 | mTodoListView->clear(); |
639 | if ( mName == "todolistsmall" ) { | 641 | if ( mName == "todolistsmall" ) { |
640 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { | 642 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { |
641 | int ps = fo.pointSize() -2; | 643 | int ps = fo.pointSize() -2; |
642 | if ( ps > 12 ) | 644 | if ( ps > 12 ) |
643 | ps -= 2; | 645 | ps -= 2; |
644 | fo.setPointSize( ps ); | 646 | fo.setPointSize( ps ); |
645 | } | 647 | } |
646 | } | 648 | } |
647 | 649 | ||
648 | mTodoListView->setFont( fo ); | 650 | mTodoListView->setFont( fo ); |
649 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); | 651 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); |
650 | //mTodoListView->header()->setMaximumHeight(fm.height()); | 652 | //mTodoListView->header()->setMaximumHeight(fm.height()); |
651 | QPtrList<Todo> todoList = calendar()->todos(); | 653 | QPtrList<Todo> todoList = calendar()->todos(); |
652 | 654 | ||
653 | /* | 655 | /* |
654 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; | 656 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; |
655 | Event *t; | 657 | Event *t; |
656 | for(t = todoList.first(); t; t = todoList.next()) { | 658 | for(t = todoList.first(); t; t = todoList.next()) { |
657 | kdDebug() << " " << t->getSummary() << endl; | 659 | kdDebug() << " " << t->getSummary() << endl; |
658 | 660 | ||
659 | if (t->getRelatedTo()) { | 661 | if (t->getRelatedTo()) { |
660 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; | 662 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; |
661 | } | 663 | } |
662 | 664 | ||
663 | QPtrList<Event> l = t->getRelations(); | 665 | QPtrList<Event> l = t->getRelations(); |
664 | Event *c; | 666 | Event *c; |
665 | for(c=l.first();c;c=l.next()) { | 667 | for(c=l.first();c;c=l.next()) { |
666 | kdDebug() << " - relation: " << c->getSummary() << endl; | 668 | kdDebug() << " - relation: " << c->getSummary() << endl; |
667 | } | 669 | } |
668 | } | 670 | } |
669 | */ | 671 | */ |
670 | 672 | ||
671 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a | 673 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a |
672 | // specific order of events. That means that we have to generate parent items | 674 | // specific order of events. That means that we have to generate parent items |
673 | // recursively for proper hierarchical display of Todos. | 675 | // recursively for proper hierarchical display of Todos. |
674 | mTodoMap.clear(); | 676 | mTodoMap.clear(); |
675 | Todo *todo; | 677 | Todo *todo; |
676 | todo = todoList.first();// todo; todo = todoList.next()) { | 678 | todo = todoList.first();// todo; todo = todoList.next()) { |
677 | while ( todo ) { | 679 | while ( todo ) { |
678 | bool next = true; | 680 | bool next = true; |
679 | // qDebug("todo %s ", todo->summary().latin1()); | 681 | // qDebug("todo %s ", todo->summary().latin1()); |
680 | Incidence *incidence = todo->relatedTo(); | 682 | Incidence *incidence = todo->relatedTo(); |
681 | while ( incidence ) { | 683 | while ( incidence ) { |
682 | if ( incidence->type() == "Todo") { | 684 | if ( incidence->type() == "Todo") { |
683 | //qDebug("related %s ",incidence->summary().latin1() ); | 685 | //qDebug("related %s ",incidence->summary().latin1() ); |
684 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { | 686 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { |
685 | //qDebug("related not found "); | 687 | //qDebug("related not found "); |
686 | todoList.remove( ); | 688 | todoList.remove( ); |
687 | todo = todoList.current(); | 689 | todo = todoList.current(); |
688 | next = false; | 690 | next = false; |
689 | incidence = 0; | 691 | incidence = 0; |
690 | 692 | ||
691 | } else { | 693 | } else { |
692 | //qDebug("related found "); | 694 | //qDebug("related found "); |
693 | incidence = incidence->relatedTo(); | 695 | incidence = incidence->relatedTo(); |
694 | } | 696 | } |
695 | } else | 697 | } else |
696 | incidence = 0; | 698 | incidence = 0; |
697 | } | 699 | } |
698 | if ( next ) | 700 | if ( next ) |
699 | todo = todoList.next(); | 701 | todo = todoList.next(); |
700 | } | 702 | } |
701 | // qDebug("again .... "); | 703 | // qDebug("again .... "); |
702 | // for(todo = todoList.first(); todo; todo = todoList.next()) { | 704 | // for(todo = todoList.first(); todo; todo = todoList.next()) { |
703 | 705 | ||
704 | // qDebug("yytodo %s ", todo->summary().latin1()); | 706 | // qDebug("yytodo %s ", todo->summary().latin1()); |
705 | // } | 707 | // } |
706 | //qDebug("for "); | 708 | //qDebug("for "); |
707 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 709 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
708 | if (!mTodoMap.contains(todo) && checkTodo( todo ) ) | 710 | if (!mTodoMap.contains(todo) && checkTodo( todo ) ) |
709 | { | 711 | { |
710 | insertTodoItem(todo); | 712 | insertTodoItem(todo); |
711 | } | 713 | } |
712 | } | 714 | } |
713 | //qDebug("for end "); | 715 | //qDebug("for end "); |
714 | // Restore opened/closed state | 716 | // Restore opened/closed state |
715 | mTodoListView->blockSignals( true ); | 717 | mTodoListView->blockSignals( true ); |
716 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); | 718 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); |
717 | mTodoListView->blockSignals( false ); | 719 | mTodoListView->blockSignals( false ); |
718 | resetCurrentItem(); | 720 | resetCurrentItem(); |
719 | processSelectionChange(); | 721 | processSelectionChange(); |
720 | } | 722 | } |
721 | 723 | ||
722 | void KOTodoView::storeCurrentItem() | 724 | void KOTodoView::storeCurrentItem() |
723 | { | 725 | { |
724 | mCurItem = 0; | 726 | mCurItem = 0; |
725 | mCurItemRootParent = 0; | 727 | mCurItemRootParent = 0; |
726 | mCurItemAbove = 0; | 728 | mCurItemAbove = 0; |
727 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 729 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
728 | if (mActiveItem) { | 730 | if (mActiveItem) { |
729 | mCurItem = mActiveItem->todo(); | 731 | mCurItem = mActiveItem->todo(); |
730 | KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); | 732 | KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); |
731 | if ( activeItemAbove ) | 733 | if ( activeItemAbove ) |
732 | mCurItemAbove = activeItemAbove->todo(); | 734 | mCurItemAbove = activeItemAbove->todo(); |
733 | while ( mActiveItem->parent() != 0 ) | 735 | mCurItemRootParent = mCurItem; |
734 | mActiveItem = (KOTodoViewItem*)mActiveItem->parent(); | 736 | while ( mCurItemRootParent->relatedTo() != 0 ) |
735 | mCurItemRootParent = mActiveItem->todo(); | 737 | mCurItemRootParent = mCurItemRootParent->relatedTo(); |
736 | } | 738 | } |
737 | mActiveItem = 0; | 739 | mActiveItem = 0; |
738 | } | 740 | } |
739 | 741 | ||
740 | void KOTodoView::resetCurrentItem() | 742 | void KOTodoView::resetCurrentItem() |
741 | { | 743 | { |
742 | mTodoListView->setFocus(); | 744 | mTodoListView->setFocus(); |
743 | KOTodoViewItem* foundItem = 0; | 745 | KOTodoViewItem* foundItem = 0; |
744 | KOTodoViewItem* foundItemRoot = 0; | 746 | KOTodoViewItem* foundItemRoot = 0; |
745 | KOTodoViewItem* foundItemAbove = 0; | 747 | KOTodoViewItem* foundItemAbove = 0; |
746 | if ( mTodoListView->firstChild () ) { | 748 | if ( mTodoListView->firstChild () ) { |
747 | if ( mCurItem ) { | 749 | if ( mCurItem ) { |
748 | KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); | 750 | KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); |
749 | while ( item ) { | 751 | while ( item ) { |
750 | if ( item->todo() == mCurItem ) { | 752 | if ( item->todo() == mCurItem ) { |
751 | foundItem = item; | 753 | foundItem = item; |
752 | break; | 754 | break; |
753 | } else if ( item->todo() == mCurItemAbove ) { | 755 | } else if ( item->todo() == mCurItemAbove ) { |
754 | foundItemAbove = item; | 756 | foundItemAbove = item; |
755 | 757 | ||
756 | } else if ( item->todo() == mCurItemRootParent ) { | 758 | } else if ( item->todo() == mCurItemRootParent ) { |
757 | foundItemRoot = item; | 759 | foundItemRoot = item; |
758 | } | 760 | } |
759 | item = (KOTodoViewItem*)item->itemBelow(); | 761 | item = (KOTodoViewItem*)item->itemBelow(); |
760 | } | 762 | } |
761 | if ( ! foundItem ) { | 763 | if ( ! foundItem ) { |
762 | if ( foundItemAbove ) | 764 | if ( foundItemRoot ) |
763 | foundItem = foundItemAbove; | ||
764 | else | ||
765 | foundItem = foundItemRoot; | 765 | foundItem = foundItemRoot; |
766 | else | ||
767 | foundItem = foundItemAbove; | ||
766 | } | 768 | } |
767 | } | 769 | } |
768 | if ( foundItem ) { | 770 | if ( foundItem ) { |
769 | mTodoListView->setCurrentItem( foundItem ); | 771 | mTodoListView->setCurrentItem( foundItem ); |
770 | mTodoListView->ensureItemVisible( foundItem ); | 772 | mTodoListView->ensureItemVisible( foundItem ); |
771 | } else { | 773 | } else { |
772 | mTodoListView->setCurrentItem( mTodoListView->firstChild () ); | 774 | mTodoListView->setCurrentItem( mTodoListView->firstChild () ); |
773 | } | 775 | } |
774 | } | 776 | } |
775 | mTodoListView->setFocus(); | 777 | mTodoListView->setFocus(); |
776 | } | 778 | } |
777 | //Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; | 779 | //Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; |
778 | bool KOTodoView::checkTodo( Todo * todo ) | 780 | bool KOTodoView::checkTodo( Todo * todo ) |
779 | { | 781 | { |
780 | 782 | ||
781 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) | 783 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) |
782 | return false; | 784 | return false; |
783 | if ( !todo->isCompleted() ) { | 785 | if ( !todo->isCompleted() ) { |
784 | if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) | 786 | if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) |
785 | return true; | 787 | return true; |
786 | } | 788 | } |
787 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { | 789 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { |
788 | if ( todo->hasStartDate() ) | 790 | if ( todo->hasStartDate() ) |
789 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) | 791 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) |
790 | return false; | 792 | return false; |
791 | if ( todo->hasDueDate() ) | 793 | if ( todo->hasDueDate() ) |
792 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) | 794 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) |
793 | return false; | 795 | return false; |
794 | } | 796 | } |
795 | return true; | 797 | return true; |
796 | } | 798 | } |
797 | 799 | ||
798 | void KOTodoView::restoreItemState( QListViewItem *item ) | 800 | void KOTodoView::restoreItemState( QListViewItem *item ) |
799 | { | 801 | { |
800 | pendingSubtodo = 0; | 802 | pendingSubtodo = 0; |
801 | while( item ) { | 803 | while( item ) { |
802 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 804 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
803 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); | 805 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); |
804 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); | 806 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); |
805 | item = item->nextSibling(); | 807 | item = item->nextSibling(); |
806 | } | 808 | } |
807 | } | 809 | } |
808 | 810 | ||
809 | 811 | ||
810 | QMap<Todo *,KOTodoViewItem *>::ConstIterator | 812 | QMap<Todo *,KOTodoViewItem *>::ConstIterator |
811 | KOTodoView::insertTodoItem(Todo *todo) | 813 | KOTodoView::insertTodoItem(Todo *todo) |
812 | { | 814 | { |
813 | 815 | ||
814 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; | 816 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; |
815 | // TODO: Check, if dynmaic cast is necessary | 817 | // TODO: Check, if dynmaic cast is necessary |
816 | 818 | ||
817 | pendingSubtodo = 0; | 819 | pendingSubtodo = 0; |
818 | Incidence *incidence = todo->relatedTo(); | 820 | Incidence *incidence = todo->relatedTo(); |
819 | if (incidence && incidence->type() == "Todo") { | 821 | if (incidence && incidence->type() == "Todo") { |
820 | Todo *relatedTodo = static_cast<Todo *>(incidence); | 822 | Todo *relatedTodo = static_cast<Todo *>(incidence); |
821 | 823 | ||
822 | // kdDebug() << " has Related" << endl; | 824 | // kdDebug() << " has Related" << endl; |
823 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 825 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
824 | itemIterator = mTodoMap.find(relatedTodo); | 826 | itemIterator = mTodoMap.find(relatedTodo); |
825 | if (itemIterator == mTodoMap.end()) { | 827 | if (itemIterator == mTodoMap.end()) { |
826 | // kdDebug() << " related not yet in list" << endl; | 828 | // kdDebug() << " related not yet in list" << endl; |
827 | itemIterator = insertTodoItem (relatedTodo); | 829 | itemIterator = insertTodoItem (relatedTodo); |
828 | } | 830 | } |
829 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem | 831 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem |
830 | // and one into the map. Sure finding is more easy but why? -zecke | 832 | // and one into the map. Sure finding is more easy but why? -zecke |
831 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); | 833 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); |
832 | return mTodoMap.insert(todo,todoItem); | 834 | return mTodoMap.insert(todo,todoItem); |
833 | } else { | 835 | } else { |
834 | // kdDebug() << " no Related" << endl; | 836 | // kdDebug() << " no Related" << endl; |
835 | // see above -zecke | 837 | // see above -zecke |
836 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 838 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
837 | return mTodoMap.insert(todo,todoItem); | 839 | return mTodoMap.insert(todo,todoItem); |
838 | } | 840 | } |
839 | } | 841 | } |
840 | 842 | ||
841 | 843 | ||
842 | void KOTodoView::updateConfig() | 844 | void KOTodoView::updateConfig() |
843 | { | 845 | { |
844 | updateView(); | 846 | updateView(); |
845 | mTodoListView->repaintContents(); | 847 | mTodoListView->repaintContents(); |
846 | } | 848 | } |
847 | 849 | ||
848 | QPtrList<Incidence> KOTodoView::selectedIncidences() | 850 | QPtrList<Incidence> KOTodoView::selectedIncidences() |
849 | { | 851 | { |
850 | QPtrList<Incidence> selected; | 852 | QPtrList<Incidence> selected; |
851 | 853 | ||
852 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 854 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
853 | // if (!item) item = mActiveItem; | 855 | // if (!item) item = mActiveItem; |
854 | if (item) selected.append(item->todo()); | 856 | if (item) selected.append(item->todo()); |
855 | 857 | ||
856 | return selected; | 858 | return selected; |
857 | } | 859 | } |
858 | 860 | ||
859 | QPtrList<Todo> KOTodoView::selectedTodos() | 861 | QPtrList<Todo> KOTodoView::selectedTodos() |
860 | { | 862 | { |
861 | QPtrList<Todo> selected; | 863 | QPtrList<Todo> selected; |
@@ -1112,243 +1114,251 @@ void KOTodoView::itemClicked(QListViewItem *item) | |||
1112 | } | 1114 | } |
1113 | par = par->parent(); | 1115 | par = par->parent(); |
1114 | } | 1116 | } |
1115 | if ( !allowReparent ) { | 1117 | if ( !allowReparent ) { |
1116 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); | 1118 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); |
1117 | qDebug("Recursive reparenting not possible "); | 1119 | qDebug("Recursive reparenting not possible "); |
1118 | pendingSubtodo = 0; | 1120 | pendingSubtodo = 0; |
1119 | } else { | 1121 | } else { |
1120 | Todo* newParent = todoItem->todo(); | 1122 | Todo* newParent = todoItem->todo(); |
1121 | Todo* newSub = pendingSubtodo->todo(); | 1123 | Todo* newSub = pendingSubtodo->todo(); |
1122 | pendingSubtodo = 0; | 1124 | pendingSubtodo = 0; |
1123 | emit reparentTodoSignal( newParent,newSub ); | 1125 | emit reparentTodoSignal( newParent,newSub ); |
1124 | return; | 1126 | return; |
1125 | } | 1127 | } |
1126 | } | 1128 | } |
1127 | #if 0 | 1129 | #if 0 |
1128 | // handled by the item itself | 1130 | // handled by the item itself |
1129 | bool completed = todoItem->todo()->isCompleted(); // Completed or not? | 1131 | bool completed = todoItem->todo()->isCompleted(); // Completed or not? |
1130 | qDebug("com %d ",completed ); | 1132 | qDebug("com %d ",completed ); |
1131 | qDebug("itemclicked "); | 1133 | qDebug("itemclicked "); |
1132 | if (todoItem->isOn()) { | 1134 | if (todoItem->isOn()) { |
1133 | qDebug("on "); | 1135 | qDebug("on "); |
1134 | if (!completed) { | 1136 | if (!completed) { |
1135 | qDebug("set true "); | 1137 | qDebug("set true "); |
1136 | todoItem->todo()->setCompleted(QDateTime::currentDateTime()); | 1138 | todoItem->todo()->setCompleted(QDateTime::currentDateTime()); |
1137 | } | 1139 | } |
1138 | } else { | 1140 | } else { |
1139 | qDebug("not on "); | 1141 | qDebug("not on "); |
1140 | if (completed) { | 1142 | if (completed) { |
1141 | qDebug("set false "); | 1143 | qDebug("set false "); |
1142 | todoItem->todo()->setCompleted(false); | 1144 | todoItem->todo()->setCompleted(false); |
1143 | } | 1145 | } |
1144 | } | 1146 | } |
1145 | #endif | 1147 | #endif |
1146 | } | 1148 | } |
1147 | 1149 | ||
1148 | void KOTodoView::setDocumentId( const QString &id ) | 1150 | void KOTodoView::setDocumentId( const QString &id ) |
1149 | { | 1151 | { |
1150 | kdDebug() << "KOTodoView::setDocumentId()" << endl; | 1152 | kdDebug() << "KOTodoView::setDocumentId()" << endl; |
1151 | 1153 | ||
1152 | mDocPrefs->setDoc( id ); | 1154 | mDocPrefs->setDoc( id ); |
1153 | } | 1155 | } |
1154 | 1156 | ||
1155 | void KOTodoView::itemStateChanged( QListViewItem *item ) | 1157 | void KOTodoView::itemStateChanged( QListViewItem *item ) |
1156 | { | 1158 | { |
1157 | if (!item) return; | 1159 | if (!item) return; |
1158 | 1160 | ||
1159 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1161 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1160 | 1162 | ||
1161 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; | 1163 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; |
1162 | 1164 | ||
1163 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); | 1165 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); |
1164 | } | 1166 | } |
1165 | 1167 | ||
1166 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const | 1168 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const |
1167 | { | 1169 | { |
1168 | mTodoListView->saveLayout(config,group); | 1170 | mTodoListView->saveLayout(config,group); |
1169 | } | 1171 | } |
1170 | 1172 | ||
1171 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) | 1173 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) |
1172 | { | 1174 | { |
1173 | mTodoListView->restoreLayout(config,group); | 1175 | mTodoListView->restoreLayout(config,group); |
1174 | } | 1176 | } |
1175 | 1177 | ||
1176 | void KOTodoView::processSelectionChange() | 1178 | void KOTodoView::processSelectionChange() |
1177 | { | 1179 | { |
1178 | // kdDebug() << "KOTodoView::processSelectionChange()" << endl; | 1180 | // kdDebug() << "KOTodoView::processSelectionChange()" << endl; |
1179 | 1181 | ||
1180 | KOTodoViewItem *item = | 1182 | KOTodoViewItem *item = |
1181 | static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); | 1183 | static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); |
1182 | 1184 | ||
1183 | if ( !item ) { | 1185 | if ( !item ) { |
1184 | emit incidenceSelected( 0 ); | 1186 | emit incidenceSelected( 0 ); |
1185 | } else { | 1187 | } else { |
1186 | emit incidenceSelected( item->todo() ); | 1188 | emit incidenceSelected( item->todo() ); |
1187 | } | 1189 | } |
1188 | } | 1190 | } |
1189 | 1191 | ||
1190 | void KOTodoView::modified(bool b) | 1192 | void KOTodoView::modified(bool b) |
1191 | { | 1193 | { |
1192 | emit isModified(b); | 1194 | emit isModified(b); |
1193 | } | 1195 | } |
1194 | void KOTodoView::setTodoModified( Todo* todo ) | 1196 | void KOTodoView::setTodoModified( Todo* todo ) |
1195 | { | 1197 | { |
1196 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); | 1198 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); |
1197 | } | 1199 | } |
1198 | void KOTodoView::clearSelection() | 1200 | void KOTodoView::clearSelection() |
1199 | { | 1201 | { |
1200 | mTodoListView->selectAll( false ); | 1202 | mTodoListView->selectAll( false ); |
1201 | } | 1203 | } |
1202 | void KOTodoView::setAllOpen() | 1204 | void KOTodoView::setAllOpen() |
1203 | { | 1205 | { |
1204 | if ( isFlatDisplay ) { | 1206 | if ( isFlatDisplay ) { |
1205 | isFlatDisplay = false; | 1207 | isFlatDisplay = false; |
1206 | mPopupMenu->setItemChecked( 8,false ); | 1208 | mPopupMenu->setItemChecked( 8,false ); |
1207 | updateView(); | 1209 | updateView(); |
1210 | } else { | ||
1211 | storeCurrentItem(); | ||
1208 | } | 1212 | } |
1209 | setOpen(mTodoListView->firstChild(), true); | 1213 | setOpen(mTodoListView->firstChild(), true); |
1214 | resetCurrentItem(); | ||
1210 | } | 1215 | } |
1211 | void KOTodoView::setAllClose() | 1216 | void KOTodoView::setAllClose() |
1212 | { | 1217 | { |
1213 | if ( isFlatDisplay ) { | 1218 | if ( isFlatDisplay ) { |
1214 | isFlatDisplay = false; | 1219 | isFlatDisplay = false; |
1215 | mPopupMenu->setItemChecked( 8,false ); | 1220 | mPopupMenu->setItemChecked( 8,false ); |
1216 | updateView(); | 1221 | updateView(); |
1222 | } else { | ||
1223 | storeCurrentItem(); | ||
1217 | } | 1224 | } |
1218 | setOpen(mTodoListView->firstChild(), false); | 1225 | setOpen(mTodoListView->firstChild(), false); |
1226 | resetCurrentItem(); | ||
1219 | } | 1227 | } |
1220 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) | 1228 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) |
1221 | { | 1229 | { |
1222 | 1230 | ||
1223 | while ( item ) { | 1231 | while ( item ) { |
1224 | setOpen( item->firstChild(), setOpenI ); | 1232 | setOpen( item->firstChild(), setOpenI ); |
1225 | item->setOpen( setOpenI ); | 1233 | item->setOpen( setOpenI ); |
1226 | item = item->nextSibling(); | 1234 | item = item->nextSibling(); |
1227 | } | 1235 | } |
1228 | } | 1236 | } |
1229 | 1237 | ||
1230 | void KOTodoView::displayAllFlat() | 1238 | void KOTodoView::displayAllFlat() |
1231 | { | 1239 | { |
1232 | pendingSubtodo = 0; | 1240 | pendingSubtodo = 0; |
1233 | if ( mBlockUpdate ) { | 1241 | if ( mBlockUpdate ) { |
1234 | return; | 1242 | return; |
1235 | } | 1243 | } |
1236 | mPopupMenu->setItemChecked( 8,true ); | 1244 | mPopupMenu->setItemChecked( 8,true ); |
1237 | isFlatDisplay = true; | 1245 | isFlatDisplay = true; |
1238 | QPtrList<Todo> todoList = calendar()->todos(); | 1246 | QPtrList<Todo> todoList = calendar()->todos(); |
1239 | mTodoMap.clear(); | 1247 | mTodoMap.clear(); |
1240 | mTodoListView->clear(); | 1248 | mTodoListView->clear(); |
1241 | Todo *todo; | 1249 | Todo *todo; |
1242 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 1250 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
1243 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 1251 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
1244 | mTodoMap.insert(todo,todoItem); | 1252 | mTodoMap.insert(todo,todoItem); |
1245 | } | 1253 | } |
1246 | mTodoListView->setFocus(); | 1254 | mTodoListView->setFocus(); |
1247 | processSelectionChange(); | 1255 | processSelectionChange(); |
1248 | } | 1256 | } |
1249 | 1257 | ||
1250 | void KOTodoView::setAllFlat() | 1258 | void KOTodoView::setAllFlat() |
1251 | { | 1259 | { |
1252 | if ( isFlatDisplay ) { | 1260 | if ( isFlatDisplay ) { |
1253 | isFlatDisplay = false; | 1261 | isFlatDisplay = false; |
1254 | mPopupMenu->setItemChecked( 8,false ); | 1262 | mPopupMenu->setItemChecked( 8,false ); |
1255 | updateView(); | 1263 | updateView(); |
1256 | return; | 1264 | return; |
1257 | } | 1265 | } |
1266 | storeCurrentItem(); | ||
1258 | displayAllFlat(); | 1267 | displayAllFlat(); |
1268 | resetCurrentItem(); | ||
1259 | } | 1269 | } |
1260 | 1270 | ||
1261 | void KOTodoView::purgeCompleted() | 1271 | void KOTodoView::purgeCompleted() |
1262 | { | 1272 | { |
1263 | emit purgeCompletedSignal(); | 1273 | emit purgeCompletedSignal(); |
1264 | } | 1274 | } |
1265 | void KOTodoView::toggleQuickTodo() | 1275 | void KOTodoView::toggleQuickTodo() |
1266 | { | 1276 | { |
1267 | if ( mQuickAdd->isVisible() ) { | 1277 | if ( mQuickAdd->isVisible() ) { |
1268 | mQuickAdd->hide(); | 1278 | mQuickAdd->hide(); |
1269 | KOPrefs::instance()->mEnableQuickTodo = false; | 1279 | KOPrefs::instance()->mEnableQuickTodo = false; |
1270 | } | 1280 | } |
1271 | else { | 1281 | else { |
1272 | mQuickAdd->show(); | 1282 | mQuickAdd->show(); |
1273 | KOPrefs::instance()->mEnableQuickTodo = true; | 1283 | KOPrefs::instance()->mEnableQuickTodo = true; |
1274 | } | 1284 | } |
1275 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 1285 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
1276 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 1286 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
1277 | } | 1287 | } |
1278 | 1288 | ||
1279 | void KOTodoView::toggleRunning() | 1289 | void KOTodoView::toggleRunning() |
1280 | { | 1290 | { |
1281 | KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; | 1291 | KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; |
1282 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 1292 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
1283 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 1293 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
1284 | updateView(); | 1294 | updateView(); |
1285 | } | 1295 | } |
1286 | 1296 | ||
1287 | void KOTodoView::toggleCompleted() | 1297 | void KOTodoView::toggleCompleted() |
1288 | { | 1298 | { |
1289 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; | 1299 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; |
1290 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 1300 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
1291 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 1301 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
1292 | updateView(); | 1302 | updateView(); |
1293 | } | 1303 | } |
1294 | 1304 | ||
1295 | void KOTodoView::addQuickTodo() | 1305 | void KOTodoView::addQuickTodo() |
1296 | { | 1306 | { |
1297 | Todo *todo = new Todo(); | 1307 | Todo *todo = new Todo(); |
1298 | todo->setSummary(mQuickAdd->text()); | 1308 | todo->setSummary(mQuickAdd->text()); |
1299 | todo->setOrganizer(KOPrefs::instance()->email()); | 1309 | todo->setOrganizer(KOPrefs::instance()->email()); |
1300 | CalFilter * cf = mCalendar->filter(); | 1310 | CalFilter * cf = mCalendar->filter(); |
1301 | if ( cf ) { | 1311 | if ( cf ) { |
1302 | if ( cf->isEnabled()&& cf->showCategories()) { | 1312 | if ( cf->isEnabled()&& cf->showCategories()) { |
1303 | todo->setCategories(cf->categoryList()); | 1313 | todo->setCategories(cf->categoryList()); |
1304 | } | 1314 | } |
1305 | if ( cf->isEnabled() ) | 1315 | if ( cf->isEnabled() ) |
1306 | todo->setSecrecy( cf->getSecrecy()); | 1316 | todo->setSecrecy( cf->getSecrecy()); |
1307 | } | 1317 | } |
1308 | mCalendar->addTodo(todo); | 1318 | mCalendar->addTodo(todo); |
1309 | mQuickAdd->setText(""); | 1319 | mQuickAdd->setText(""); |
1310 | todoModified (todo, KOGlobals::EVENTADDED ); | 1320 | todoModified (todo, KOGlobals::EVENTADDED ); |
1311 | updateView(); | 1321 | updateView(); |
1312 | } | 1322 | } |
1313 | 1323 | ||
1314 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) | 1324 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) |
1315 | { | 1325 | { |
1316 | // e->ignore(); | 1326 | // e->ignore(); |
1317 | //return; | 1327 | //return; |
1318 | //qDebug("KOTodoView::keyPressEvent "); | 1328 | //qDebug("KOTodoView::keyPressEvent "); |
1319 | switch ( e->key() ) { | 1329 | switch ( e->key() ) { |
1320 | case Qt::Key_Down: | 1330 | case Qt::Key_Down: |
1321 | case Qt::Key_Up: | 1331 | case Qt::Key_Up: |
1322 | QWidget::keyPressEvent ( e ); | 1332 | QWidget::keyPressEvent ( e ); |
1323 | break; | 1333 | break; |
1324 | 1334 | ||
1325 | case Qt::Key_Q: | 1335 | case Qt::Key_Q: |
1326 | toggleQuickTodo(); | 1336 | toggleQuickTodo(); |
1327 | break; | 1337 | break; |
1328 | case Qt::Key_U: | 1338 | case Qt::Key_U: |
1329 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { | 1339 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { |
1330 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1340 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1331 | unparentTodo(); | 1341 | unparentTodo(); |
1332 | e->accept(); | 1342 | e->accept(); |
1333 | } else | 1343 | } else |
1334 | e->ignore(); | 1344 | e->ignore(); |
1335 | break; | 1345 | break; |
1336 | case Qt::Key_S: | 1346 | case Qt::Key_S: |
1337 | if ( e->state() == Qt::ControlButton ) { | 1347 | if ( e->state() == Qt::ControlButton ) { |
1338 | e->ignore(); | 1348 | e->ignore(); |
1339 | break; | 1349 | break; |
1340 | } | 1350 | } |
1341 | if ( e->state() == Qt::ShiftButton ) { | 1351 | if ( e->state() == Qt::ShiftButton ) { |
1342 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1352 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1343 | reparentTodo(); | 1353 | reparentTodo(); |
1344 | e->accept(); | 1354 | e->accept(); |
1345 | } else | 1355 | } else |
1346 | e->ignore(); | 1356 | e->ignore(); |
1347 | break; | 1357 | break; |
1348 | case Qt::Key_P: | 1358 | case Qt::Key_P: |
1349 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { | 1359 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { |
1350 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1360 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1351 | if ( pendingSubtodo ) | 1361 | if ( pendingSubtodo ) |
1352 | itemClicked(mActiveItem); | 1362 | itemClicked(mActiveItem); |
1353 | e->accept(); | 1363 | e->accept(); |
1354 | } else | 1364 | } else |
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp index 1fc7169..d8f15b5 100644 --- a/libkcal/alarm.cpp +++ b/libkcal/alarm.cpp | |||
@@ -1,118 +1,119 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 1998 Preston Brown | 3 | Copyright (c) 1998 Preston Brown |
4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <kdebug.h> | 22 | #include <kdebug.h> |
23 | #include <klocale.h> | ||
23 | 24 | ||
24 | #include "incidence.h" | 25 | #include "incidence.h" |
25 | #include "todo.h" | 26 | #include "todo.h" |
26 | 27 | ||
27 | #include "alarm.h" | 28 | #include "alarm.h" |
28 | 29 | ||
29 | using namespace KCal; | 30 | using namespace KCal; |
30 | #include <qwidget.h> | 31 | #include <qwidget.h> |
31 | Alarm::Alarm(Incidence *parent) | 32 | Alarm::Alarm(Incidence *parent) |
32 | : mParent(parent), | 33 | : mParent(parent), |
33 | mType(Audio), | 34 | mType(Audio), |
34 | mDescription(""), // to make operator==() not fail | 35 | mDescription(""), // to make operator==() not fail |
35 | mFile(""), // to make operator==() not fail | 36 | mFile(""), // to make operator==() not fail |
36 | mMailSubject(""), // to make operator==() not fail | 37 | mMailSubject(""), // to make operator==() not fail |
37 | mAlarmSnoozeTime(5), | 38 | mAlarmSnoozeTime(5), |
38 | mAlarmRepeatCount(0), | 39 | mAlarmRepeatCount(0), |
39 | mEndOffset(false), | 40 | mEndOffset(false), |
40 | mHasTime(false), | 41 | mHasTime(false), |
41 | mAlarmEnabled(false) | 42 | mAlarmEnabled(false) |
42 | { | 43 | { |
43 | 44 | ||
44 | } | 45 | } |
45 | 46 | ||
46 | Alarm::~Alarm() | 47 | Alarm::~Alarm() |
47 | { | 48 | { |
48 | } | 49 | } |
49 | 50 | ||
50 | bool Alarm::operator==( const Alarm& rhs ) const | 51 | bool Alarm::operator==( const Alarm& rhs ) const |
51 | { | 52 | { |
52 | 53 | ||
53 | if ( mType != rhs.mType || | 54 | if ( mType != rhs.mType || |
54 | mAlarmSnoozeTime != rhs.mAlarmSnoozeTime || | 55 | mAlarmSnoozeTime != rhs.mAlarmSnoozeTime || |
55 | mAlarmRepeatCount != rhs.mAlarmRepeatCount || | 56 | mAlarmRepeatCount != rhs.mAlarmRepeatCount || |
56 | mAlarmEnabled != rhs.mAlarmEnabled || | 57 | mAlarmEnabled != rhs.mAlarmEnabled || |
57 | mHasTime != rhs.mHasTime) | 58 | mHasTime != rhs.mHasTime) |
58 | return false; | 59 | return false; |
59 | 60 | ||
60 | #if 0 | 61 | #if 0 |
61 | if ( mType != rhs.mType ) { | 62 | if ( mType != rhs.mType ) { |
62 | 63 | ||
63 | qDebug("aaa1 "); | 64 | qDebug("aaa1 "); |
64 | return false; | 65 | return false; |
65 | } | 66 | } |
66 | 67 | ||
67 | if ( mAlarmSnoozeTime != rhs.mAlarmSnoozeTime ) { | 68 | if ( mAlarmSnoozeTime != rhs.mAlarmSnoozeTime ) { |
68 | 69 | ||
69 | qDebug("aaa2 "); | 70 | qDebug("aaa2 "); |
70 | return false; | 71 | return false; |
71 | } | 72 | } |
72 | 73 | ||
73 | 74 | ||
74 | if ( mAlarmRepeatCount != rhs.mAlarmRepeatCount ) { | 75 | if ( mAlarmRepeatCount != rhs.mAlarmRepeatCount ) { |
75 | 76 | ||
76 | qDebug("aaa3 "); | 77 | qDebug("aaa3 "); |
77 | return false; | 78 | return false; |
78 | } | 79 | } |
79 | 80 | ||
80 | if ( mAlarmEnabled != rhs.mAlarmEnabled ) { | 81 | if ( mAlarmEnabled != rhs.mAlarmEnabled ) { |
81 | 82 | ||
82 | qDebug("aaa4 "); | 83 | qDebug("aaa4 "); |
83 | return false; | 84 | return false; |
84 | } | 85 | } |
85 | 86 | ||
86 | if ( mHasTime != rhs.mHasTime ) { | 87 | if ( mHasTime != rhs.mHasTime ) { |
87 | 88 | ||
88 | qDebug("aaa5 "); | 89 | qDebug("aaa5 "); |
89 | return false; | 90 | return false; |
90 | } | 91 | } |
91 | #endif | 92 | #endif |
92 | 93 | ||
93 | 94 | ||
94 | if (mHasTime) { | 95 | if (mHasTime) { |
95 | if (mAlarmTime != rhs.mAlarmTime) | 96 | if (mAlarmTime != rhs.mAlarmTime) |
96 | return false; | 97 | return false; |
97 | } else { | 98 | } else { |
98 | if (mOffset != rhs.mOffset || | 99 | if (mOffset != rhs.mOffset || |
99 | mEndOffset != rhs.mEndOffset) | 100 | mEndOffset != rhs.mEndOffset) |
100 | return false; | 101 | return false; |
101 | } | 102 | } |
102 | switch (mType) { | 103 | switch (mType) { |
103 | case Display: | 104 | case Display: |
104 | return mDescription == rhs.mDescription; | 105 | return mDescription == rhs.mDescription; |
105 | 106 | ||
106 | case Email: | 107 | case Email: |
107 | return mDescription == rhs.mDescription && | 108 | return mDescription == rhs.mDescription && |
108 | mMailAttachFiles == rhs.mMailAttachFiles && | 109 | mMailAttachFiles == rhs.mMailAttachFiles && |
109 | mMailAddresses == rhs.mMailAddresses && | 110 | mMailAddresses == rhs.mMailAddresses && |
110 | mMailSubject == rhs.mMailSubject; | 111 | mMailSubject == rhs.mMailSubject; |
111 | 112 | ||
112 | case Procedure: | 113 | case Procedure: |
113 | return mFile == rhs.mFile && | 114 | return mFile == rhs.mFile && |
114 | mDescription == rhs.mDescription; | 115 | mDescription == rhs.mDescription; |
115 | 116 | ||
116 | case Audio: | 117 | case Audio: |
117 | return mFile == rhs.mFile; | 118 | return mFile == rhs.mFile; |
118 | 119 | ||
@@ -256,192 +257,215 @@ void Alarm::setMailSubject(const QString &mailAlarmSubject) | |||
256 | if (mType == Email) { | 257 | if (mType == Email) { |
257 | mMailSubject = mailAlarmSubject; | 258 | mMailSubject = mailAlarmSubject; |
258 | mParent->updated(); | 259 | mParent->updated(); |
259 | } | 260 | } |
260 | } | 261 | } |
261 | 262 | ||
262 | QString Alarm::mailSubject() const | 263 | QString Alarm::mailSubject() const |
263 | { | 264 | { |
264 | return (mType == Email) ? mMailSubject : QString::null; | 265 | return (mType == Email) ? mMailSubject : QString::null; |
265 | } | 266 | } |
266 | 267 | ||
267 | void Alarm::setMailAttachment(const QString &mailAttachFile) | 268 | void Alarm::setMailAttachment(const QString &mailAttachFile) |
268 | { | 269 | { |
269 | if (mType == Email) { | 270 | if (mType == Email) { |
270 | mMailAttachFiles.clear(); | 271 | mMailAttachFiles.clear(); |
271 | mMailAttachFiles += mailAttachFile; | 272 | mMailAttachFiles += mailAttachFile; |
272 | mParent->updated(); | 273 | mParent->updated(); |
273 | } | 274 | } |
274 | } | 275 | } |
275 | 276 | ||
276 | void Alarm::setMailAttachments(const QStringList &mailAttachFiles) | 277 | void Alarm::setMailAttachments(const QStringList &mailAttachFiles) |
277 | { | 278 | { |
278 | if (mType == Email) { | 279 | if (mType == Email) { |
279 | mMailAttachFiles = mailAttachFiles; | 280 | mMailAttachFiles = mailAttachFiles; |
280 | mParent->updated(); | 281 | mParent->updated(); |
281 | } | 282 | } |
282 | } | 283 | } |
283 | 284 | ||
284 | void Alarm::addMailAttachment(const QString &mailAttachFile) | 285 | void Alarm::addMailAttachment(const QString &mailAttachFile) |
285 | { | 286 | { |
286 | if (mType == Email) { | 287 | if (mType == Email) { |
287 | mMailAttachFiles += mailAttachFile; | 288 | mMailAttachFiles += mailAttachFile; |
288 | mParent->updated(); | 289 | mParent->updated(); |
289 | } | 290 | } |
290 | } | 291 | } |
291 | 292 | ||
292 | QStringList Alarm::mailAttachments() const | 293 | QStringList Alarm::mailAttachments() const |
293 | { | 294 | { |
294 | return (mType == Email) ? mMailAttachFiles : QStringList(); | 295 | return (mType == Email) ? mMailAttachFiles : QStringList(); |
295 | } | 296 | } |
296 | 297 | ||
297 | void Alarm::setMailText(const QString &text) | 298 | void Alarm::setMailText(const QString &text) |
298 | { | 299 | { |
299 | if (mType == Email) { | 300 | if (mType == Email) { |
300 | mDescription = text; | 301 | mDescription = text; |
301 | mParent->updated(); | 302 | mParent->updated(); |
302 | } | 303 | } |
303 | } | 304 | } |
304 | 305 | ||
305 | QString Alarm::mailText() const | 306 | QString Alarm::mailText() const |
306 | { | 307 | { |
307 | return (mType == Email) ? mDescription : QString::null; | 308 | return (mType == Email) ? mDescription : QString::null; |
308 | } | 309 | } |
309 | 310 | ||
310 | void Alarm::setDisplayAlarm(const QString &text) | 311 | void Alarm::setDisplayAlarm(const QString &text) |
311 | { | 312 | { |
312 | mType = Display; | 313 | mType = Display; |
313 | mDescription = text; | 314 | mDescription = text; |
314 | mParent->updated(); | 315 | mParent->updated(); |
315 | } | 316 | } |
316 | 317 | ||
317 | void Alarm::setText(const QString &text) | 318 | void Alarm::setText(const QString &text) |
318 | { | 319 | { |
319 | if (mType == Display) { | 320 | if (mType == Display) { |
320 | mDescription = text; | 321 | mDescription = text; |
321 | mParent->updated(); | 322 | mParent->updated(); |
322 | } | 323 | } |
323 | } | 324 | } |
324 | 325 | ||
325 | QString Alarm::text() const | 326 | QString Alarm::text() const |
326 | { | 327 | { |
327 | return (mType == Display) ? mDescription : QString::null; | 328 | return (mType == Display) ? mDescription : QString::null; |
328 | } | 329 | } |
329 | 330 | ||
330 | void Alarm::setTime(const QDateTime &alarmTime) | 331 | void Alarm::setTime(const QDateTime &alarmTime) |
331 | { | 332 | { |
332 | mAlarmTime = alarmTime; | 333 | mAlarmTime = alarmTime; |
333 | mHasTime = true; | 334 | mHasTime = true; |
334 | 335 | ||
335 | mParent->updated(); | 336 | mParent->updated(); |
336 | } | 337 | } |
337 | int Alarm::offset() | 338 | int Alarm::offset() |
338 | { | 339 | { |
339 | if ( hasTime() ) { | 340 | if ( hasTime() ) { |
340 | if (mParent->type()=="Todo") { | 341 | if (mParent->type()=="Todo") { |
341 | Todo *t = static_cast<Todo*>(mParent); | 342 | Todo *t = static_cast<Todo*>(mParent); |
342 | return t->dtDue().secsTo( mAlarmTime ) ; | 343 | return t->dtDue().secsTo( mAlarmTime ) ; |
343 | } else | 344 | } else |
344 | return mParent->dtStart().secsTo( mAlarmTime ) ; | 345 | return mParent->dtStart().secsTo( mAlarmTime ) ; |
345 | } | 346 | } |
346 | else | 347 | else |
347 | { | 348 | { |
348 | return mOffset.asSeconds(); | 349 | return mOffset.asSeconds(); |
349 | } | 350 | } |
350 | 351 | ||
351 | } | 352 | } |
353 | QString Alarm::offsetText() | ||
354 | { | ||
355 | int min = -offset()/60; | ||
356 | int hours = min /60; | ||
357 | min = min % 60; | ||
358 | int days = hours /24; | ||
359 | hours = hours % 24; | ||
360 | QString message; | ||
361 | qDebug("%d %d %d ", days, hours, min ); | ||
362 | if ( days > 0 ) | ||
363 | message += i18n("%1d").arg( days ); | ||
364 | if ( hours > 0 ) { | ||
365 | if ( !message.isEmpty() ) message += "/"; | ||
366 | message += i18n("%1h").arg( hours ); | ||
367 | } | ||
368 | if ( min > 0 ) { | ||
369 | if ( !message.isEmpty() ) message += "/"; | ||
370 | message += i18n("%1min").arg( min ); | ||
371 | } | ||
372 | if ( message.isEmpty() ) | ||
373 | message = i18n("%1min").arg( 0 ); | ||
374 | return message; | ||
375 | } | ||
352 | 376 | ||
353 | 377 | ||
354 | QDateTime Alarm::time() const | 378 | QDateTime Alarm::time() const |
355 | { | 379 | { |
356 | if ( hasTime() ) | 380 | if ( hasTime() ) |
357 | return mAlarmTime; | 381 | return mAlarmTime; |
358 | else | 382 | else |
359 | { | 383 | { |
360 | if (mParent->type()=="Todo") { | 384 | if (mParent->type()=="Todo") { |
361 | Todo *t = static_cast<Todo*>(mParent); | 385 | Todo *t = static_cast<Todo*>(mParent); |
362 | return mOffset.end( t->dtDue() ); | 386 | return mOffset.end( t->dtDue() ); |
363 | } else if (mEndOffset) { | 387 | } else if (mEndOffset) { |
364 | return mOffset.end( mParent->dtEnd() ); | 388 | return mOffset.end( mParent->dtEnd() ); |
365 | } else { | 389 | } else { |
366 | return mOffset.end( mParent->dtStart() ); | 390 | return mOffset.end( mParent->dtStart() ); |
367 | } | 391 | } |
368 | } | 392 | } |
369 | } | 393 | } |
370 | 394 | ||
371 | bool Alarm::hasTime() const | 395 | bool Alarm::hasTime() const |
372 | { | 396 | { |
373 | return mHasTime; | 397 | return mHasTime; |
374 | } | 398 | } |
375 | 399 | ||
376 | void Alarm::setSnoozeTime(int alarmSnoozeTime) | 400 | void Alarm::setSnoozeTime(int alarmSnoozeTime) |
377 | { | 401 | { |
378 | mAlarmSnoozeTime = alarmSnoozeTime; | 402 | mAlarmSnoozeTime = alarmSnoozeTime; |
379 | mParent->updated(); | 403 | mParent->updated(); |
380 | } | 404 | } |
381 | 405 | ||
382 | int Alarm::snoozeTime() const | 406 | int Alarm::snoozeTime() const |
383 | { | 407 | { |
384 | return mAlarmSnoozeTime; | 408 | return mAlarmSnoozeTime; |
385 | } | 409 | } |
386 | 410 | ||
387 | void Alarm::setRepeatCount(int alarmRepeatCount) | 411 | void Alarm::setRepeatCount(int alarmRepeatCount) |
388 | { | 412 | { |
389 | kdDebug(5800) << "Alarm::setRepeatCount(): " << alarmRepeatCount << endl; | 413 | kdDebug(5800) << "Alarm::setRepeatCount(): " << alarmRepeatCount << endl; |
390 | 414 | ||
391 | mAlarmRepeatCount = alarmRepeatCount; | 415 | mAlarmRepeatCount = alarmRepeatCount; |
392 | mParent->updated(); | 416 | mParent->updated(); |
393 | } | 417 | } |
394 | 418 | ||
395 | int Alarm::repeatCount() const | 419 | int Alarm::repeatCount() const |
396 | { | 420 | { |
397 | kdDebug(5800) << "Alarm::repeatCount(): " << mAlarmRepeatCount << endl; | 421 | kdDebug(5800) << "Alarm::repeatCount(): " << mAlarmRepeatCount << endl; |
398 | return mAlarmRepeatCount; | 422 | return mAlarmRepeatCount; |
399 | } | 423 | } |
400 | 424 | ||
401 | void Alarm::toggleAlarm() | 425 | void Alarm::toggleAlarm() |
402 | { | 426 | { |
403 | mAlarmEnabled = !mAlarmEnabled; | 427 | mAlarmEnabled = !mAlarmEnabled; |
404 | mParent->updated(); | 428 | mParent->updated(); |
405 | } | 429 | } |
406 | 430 | ||
407 | void Alarm::setEnabled(bool enable) | 431 | void Alarm::setEnabled(bool enable) |
408 | { | 432 | { |
409 | mAlarmEnabled = enable; | 433 | mAlarmEnabled = enable; |
410 | mParent->updated(); | 434 | mParent->updated(); |
411 | } | 435 | } |
412 | 436 | ||
413 | bool Alarm::enabled() const | 437 | bool Alarm::enabled() const |
414 | { | 438 | { |
415 | return mAlarmEnabled; | 439 | return mAlarmEnabled; |
416 | } | 440 | } |
417 | 441 | ||
418 | void Alarm::setStartOffset( const Duration &offset ) | 442 | void Alarm::setStartOffset( const Duration &offset ) |
419 | { | 443 | { |
420 | mOffset = offset; | 444 | mOffset = offset; |
421 | mEndOffset = false; | 445 | mEndOffset = false; |
422 | mHasTime = false; | 446 | mHasTime = false; |
423 | mParent->updated(); | 447 | mParent->updated(); |
424 | } | 448 | } |
425 | 449 | ||
426 | Duration Alarm::startOffset() const | 450 | Duration Alarm::startOffset() const |
427 | { | 451 | { |
428 | return (mHasTime || mEndOffset) ? 0 : mOffset; | 452 | return (mHasTime || mEndOffset) ? 0 : mOffset; |
429 | } | 453 | } |
430 | 454 | ||
431 | bool Alarm::hasStartOffset() const | 455 | bool Alarm::hasStartOffset() const |
432 | { | 456 | { |
433 | return !mHasTime && !mEndOffset; | 457 | return !mHasTime && !mEndOffset; |
434 | } | 458 | } |
435 | 459 | ||
436 | bool Alarm::hasEndOffset() const | 460 | bool Alarm::hasEndOffset() const |
437 | { | 461 | { |
438 | return !mHasTime && mEndOffset; | 462 | return !mHasTime && mEndOffset; |
439 | } | 463 | } |
440 | 464 | ||
441 | void Alarm::setEndOffset( const Duration &offset ) | 465 | void Alarm::setEndOffset( const Duration &offset ) |
442 | { | 466 | { |
443 | mOffset = offset; | 467 | mOffset = offset; |
444 | mEndOffset = true; | 468 | mEndOffset = true; |
445 | mHasTime = false; | 469 | mHasTime = false; |
446 | mParent->updated(); | 470 | mParent->updated(); |
447 | } | 471 | } |
diff --git a/libkcal/alarm.h b/libkcal/alarm.h index 682b626..ac6ea0d 100644 --- a/libkcal/alarm.h +++ b/libkcal/alarm.h | |||
@@ -1,157 +1,158 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef KCAL_ALARM_H | 21 | #ifndef KCAL_ALARM_H |
22 | #define KCAL_ALARM_H | 22 | #define KCAL_ALARM_H |
23 | 23 | ||
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | #include <qvaluelist.h> | 25 | #include <qvaluelist.h> |
26 | 26 | ||
27 | #include "customproperties.h" | 27 | #include "customproperties.h" |
28 | #include "duration.h" | 28 | #include "duration.h" |
29 | #include "person.h" | 29 | #include "person.h" |
30 | 30 | ||
31 | namespace KCal { | 31 | namespace KCal { |
32 | 32 | ||
33 | class Incidence; | 33 | class Incidence; |
34 | 34 | ||
35 | /** | 35 | /** |
36 | This class represents an alarm notification. | 36 | This class represents an alarm notification. |
37 | */ | 37 | */ |
38 | class Alarm : public CustomProperties | 38 | class Alarm : public CustomProperties |
39 | { | 39 | { |
40 | public: | 40 | public: |
41 | enum Type { Invalid, Display, Procedure, Email, Audio }; | 41 | enum Type { Invalid, Display, Procedure, Email, Audio }; |
42 | typedef QValueList<Alarm *> List; | 42 | typedef QValueList<Alarm *> List; |
43 | 43 | ||
44 | /** Construct a new alarm with variables initialized to "sane" values. */ | 44 | /** Construct a new alarm with variables initialized to "sane" values. */ |
45 | explicit Alarm(Incidence *parent); | 45 | explicit Alarm(Incidence *parent); |
46 | /** Destruct Alarm object. */ | 46 | /** Destruct Alarm object. */ |
47 | ~Alarm(); | 47 | ~Alarm(); |
48 | 48 | ||
49 | /** Compare this alarm with another one. */ | 49 | /** Compare this alarm with another one. */ |
50 | bool operator==(const Alarm &) const; | 50 | bool operator==(const Alarm &) const; |
51 | bool operator!=(const Alarm &a) const { return !operator==(a); } | 51 | bool operator!=(const Alarm &a) const { return !operator==(a); } |
52 | 52 | ||
53 | /** Set the type of the alarm. | 53 | /** Set the type of the alarm. |
54 | If the specified type is different from the current type of the alarm, | 54 | If the specified type is different from the current type of the alarm, |
55 | the alarm's type-specific properties are initialised to null. | 55 | the alarm's type-specific properties are initialised to null. |
56 | @param type type of alarm. | 56 | @param type type of alarm. |
57 | */ | 57 | */ |
58 | void setType(Type type); | 58 | void setType(Type type); |
59 | /** Return the type of the alarm */ | 59 | /** Return the type of the alarm */ |
60 | Type type() const; | 60 | Type type() const; |
61 | int offset(); | 61 | int offset(); |
62 | QString offsetText(); | ||
62 | /** Set the alarm to be a display alarm. | 63 | /** Set the alarm to be a display alarm. |
63 | @param text text to display when the alarm is triggered. | 64 | @param text text to display when the alarm is triggered. |
64 | */ | 65 | */ |
65 | void setDisplayAlarm(const QString &text); | 66 | void setDisplayAlarm(const QString &text); |
66 | /** Set the text to be displayed when the alarm is triggered. | 67 | /** Set the text to be displayed when the alarm is triggered. |
67 | Ignored if the alarm is not a display alarm. | 68 | Ignored if the alarm is not a display alarm. |
68 | */ | 69 | */ |
69 | void setText(const QString &text); | 70 | void setText(const QString &text); |
70 | /** Return the text string that displays when the alarm is triggered. */ | 71 | /** Return the text string that displays when the alarm is triggered. */ |
71 | QString text() const; | 72 | QString text() const; |
72 | 73 | ||
73 | /** Set the alarm to be an audio alarm. | 74 | /** Set the alarm to be an audio alarm. |
74 | @param audioFile optional file to play when the alarm is triggered. | 75 | @param audioFile optional file to play when the alarm is triggered. |
75 | */ | 76 | */ |
76 | void setAudioAlarm(const QString &audioFile = QString::null); | 77 | void setAudioAlarm(const QString &audioFile = QString::null); |
77 | /** Set the file to play when the audio alarm is triggered. | 78 | /** Set the file to play when the audio alarm is triggered. |
78 | Ignored if the alarm is not an audio alarm. | 79 | Ignored if the alarm is not an audio alarm. |
79 | */ | 80 | */ |
80 | void setAudioFile(const QString &audioFile); | 81 | void setAudioFile(const QString &audioFile); |
81 | /** Return the name of the audio file for the alarm. | 82 | /** Return the name of the audio file for the alarm. |
82 | @return The audio file for the alarm, or QString::null if not an audio alarm. | 83 | @return The audio file for the alarm, or QString::null if not an audio alarm. |
83 | */ | 84 | */ |
84 | QString audioFile() const; | 85 | QString audioFile() const; |
85 | 86 | ||
86 | /** Set the alarm to be a procedure alarm. | 87 | /** Set the alarm to be a procedure alarm. |
87 | @param programFile program to execute when the alarm is triggered. | 88 | @param programFile program to execute when the alarm is triggered. |
88 | @param arguments arguments to supply to programFile. | 89 | @param arguments arguments to supply to programFile. |
89 | */ | 90 | */ |
90 | void setProcedureAlarm(const QString &programFile, const QString &arguments = QString::null); | 91 | void setProcedureAlarm(const QString &programFile, const QString &arguments = QString::null); |
91 | /** Set the program file to execute when the alarm is triggered. | 92 | /** Set the program file to execute when the alarm is triggered. |
92 | Ignored if the alarm is not a procedure alarm. | 93 | Ignored if the alarm is not a procedure alarm. |
93 | */ | 94 | */ |
94 | void setProgramFile(const QString &programFile); | 95 | void setProgramFile(const QString &programFile); |
95 | /** Return the name of the program file to execute when the alarm is triggered. | 96 | /** Return the name of the program file to execute when the alarm is triggered. |
96 | @return the program file name, or QString::null if not a procedure alarm. | 97 | @return the program file name, or QString::null if not a procedure alarm. |
97 | */ | 98 | */ |
98 | QString programFile() const; | 99 | QString programFile() const; |
99 | /** Set the arguments to the program to execute when the alarm is triggered. | 100 | /** Set the arguments to the program to execute when the alarm is triggered. |
100 | Ignored if the alarm is not a procedure alarm. | 101 | Ignored if the alarm is not a procedure alarm. |
101 | */ | 102 | */ |
102 | void setProgramArguments(const QString &arguments); | 103 | void setProgramArguments(const QString &arguments); |
103 | /** Return the arguments to the program to run when the alarm is triggered. | 104 | /** Return the arguments to the program to run when the alarm is triggered. |
104 | @return the program arguments, or QString::null if not a procedure alarm. | 105 | @return the program arguments, or QString::null if not a procedure alarm. |
105 | */ | 106 | */ |
106 | QString programArguments() const; | 107 | QString programArguments() const; |
107 | 108 | ||
108 | /** Set the alarm to be an email alarm. | 109 | /** Set the alarm to be an email alarm. |
109 | @param subject subject line of email. | 110 | @param subject subject line of email. |
110 | @param text body of email. | 111 | @param text body of email. |
111 | @param addressees email addresses of recipient(s). | 112 | @param addressees email addresses of recipient(s). |
112 | @param attachments optional names of files to attach to the email. | 113 | @param attachments optional names of files to attach to the email. |
113 | */ | 114 | */ |
114 | void setEmailAlarm(const QString &subject, const QString &text, const QValueList<Person> &addressees, | 115 | void setEmailAlarm(const QString &subject, const QString &text, const QValueList<Person> &addressees, |
115 | const QStringList &attachments = QStringList()); | 116 | const QStringList &attachments = QStringList()); |
116 | 117 | ||
117 | /** Send mail to this address when the alarm is triggered. | 118 | /** Send mail to this address when the alarm is triggered. |
118 | Ignored if the alarm is not an email alarm. | 119 | Ignored if the alarm is not an email alarm. |
119 | */ | 120 | */ |
120 | void setMailAddress(const Person &mailAlarmAddress); | 121 | void setMailAddress(const Person &mailAlarmAddress); |
121 | /** Send mail to these addresses when the alarm is triggered. | 122 | /** Send mail to these addresses when the alarm is triggered. |
122 | Ignored if the alarm is not an email alarm. | 123 | Ignored if the alarm is not an email alarm. |
123 | */ | 124 | */ |
124 | void setMailAddresses(const QValueList<Person> &mailAlarmAddresses); | 125 | void setMailAddresses(const QValueList<Person> &mailAlarmAddresses); |
125 | /** Add this address to the list of addresses to send mail to when the alarm is triggered. | 126 | /** Add this address to the list of addresses to send mail to when the alarm is triggered. |
126 | Ignored if the alarm is not an email alarm. | 127 | Ignored if the alarm is not an email alarm. |
127 | */ | 128 | */ |
128 | void addMailAddress(const Person &mailAlarmAddress); | 129 | void addMailAddress(const Person &mailAlarmAddress); |
129 | /** return the addresses to send mail to when an alarm goes off */ | 130 | /** return the addresses to send mail to when an alarm goes off */ |
130 | QValueList<Person> mailAddresses() const; | 131 | QValueList<Person> mailAddresses() const; |
131 | 132 | ||
132 | /** Set the subject line of the mail. | 133 | /** Set the subject line of the mail. |
133 | Ignored if the alarm is not an email alarm. | 134 | Ignored if the alarm is not an email alarm. |
134 | */ | 135 | */ |
135 | void setMailSubject(const QString &mailAlarmSubject); | 136 | void setMailSubject(const QString &mailAlarmSubject); |
136 | /** return the subject line of the mail */ | 137 | /** return the subject line of the mail */ |
137 | QString mailSubject() const; | 138 | QString mailSubject() const; |
138 | 139 | ||
139 | /** Attach this filename to the email. | 140 | /** Attach this filename to the email. |
140 | Ignored if the alarm is not an email alarm. | 141 | Ignored if the alarm is not an email alarm. |
141 | */ | 142 | */ |
142 | void setMailAttachment(const QString &mailAttachFile); | 143 | void setMailAttachment(const QString &mailAttachFile); |
143 | /** Attach these filenames to the email. | 144 | /** Attach these filenames to the email. |
144 | Ignored if the alarm is not an email alarm. | 145 | Ignored if the alarm is not an email alarm. |
145 | */ | 146 | */ |
146 | void setMailAttachments(const QStringList &mailAttachFiles); | 147 | void setMailAttachments(const QStringList &mailAttachFiles); |
147 | /** Add this filename to the list of files to attach to the email. | 148 | /** Add this filename to the list of files to attach to the email. |
148 | Ignored if the alarm is not an email alarm. | 149 | Ignored if the alarm is not an email alarm. |
149 | */ | 150 | */ |
150 | void addMailAttachment(const QString &mailAttachFile); | 151 | void addMailAttachment(const QString &mailAttachFile); |
151 | /** return the filenames to attach to the email */ | 152 | /** return the filenames to attach to the email */ |
152 | QStringList mailAttachments() const; | 153 | QStringList mailAttachments() const; |
153 | 154 | ||
154 | /** Set the email body text. | 155 | /** Set the email body text. |
155 | Ignored if the alarm is not an email alarm. | 156 | Ignored if the alarm is not an email alarm. |
156 | */ | 157 | */ |
157 | void setMailText(const QString &text); | 158 | void setMailText(const QString &text); |
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index e506a96..d67ad52 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp | |||
@@ -38,285 +38,295 @@ KIncidenceFormatter* KIncidenceFormatter::instance() | |||
38 | KIncidenceFormatter::~KIncidenceFormatter() | 38 | KIncidenceFormatter::~KIncidenceFormatter() |
39 | { | 39 | { |
40 | if (mInstance == this) | 40 | if (mInstance == this) |
41 | mInstance = insd.setObject(0); | 41 | mInstance = insd.setObject(0); |
42 | //qDebug("KIncidenceFormatter::~KIncidenceFormatter "); | 42 | //qDebug("KIncidenceFormatter::~KIncidenceFormatter "); |
43 | } | 43 | } |
44 | KIncidenceFormatter::KIncidenceFormatter() | 44 | KIncidenceFormatter::KIncidenceFormatter() |
45 | { | 45 | { |
46 | mColorMode = 0; | 46 | mColorMode = 0; |
47 | } | 47 | } |
48 | void KIncidenceFormatter::setEvent(Event *event) | 48 | void KIncidenceFormatter::setEvent(Event *event) |
49 | { | 49 | { |
50 | int mode = 0; | 50 | int mode = 0; |
51 | mCurrentIncidence = event; | 51 | mCurrentIncidence = event; |
52 | bool shortDate = true; | 52 | bool shortDate = true; |
53 | if ( mode == 0 ) { | 53 | if ( mode == 0 ) { |
54 | addTag("h3",deTag(event->summary())); | 54 | addTag("h3",deTag(event->summary())); |
55 | } | 55 | } |
56 | else { | 56 | else { |
57 | if ( mColorMode == 1 ) { | 57 | if ( mColorMode == 1 ) { |
58 | mText +="<font color=\"#00A000\">"; | 58 | mText +="<font color=\"#00A000\">"; |
59 | } | 59 | } |
60 | if ( mColorMode == 2 ) { | 60 | if ( mColorMode == 2 ) { |
61 | mText +="<font color=\"#C00000\">"; | 61 | mText +="<font color=\"#C00000\">"; |
62 | } | 62 | } |
63 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 63 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
64 | if ( mode == 1 ) { | 64 | if ( mode == 1 ) { |
65 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); | 65 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); |
66 | } else { | 66 | } else { |
67 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); | 67 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); |
68 | } | 68 | } |
69 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 69 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
70 | if ( mColorMode ) | 70 | if ( mColorMode ) |
71 | mText += "</font>"; | 71 | mText += "</font>"; |
72 | } | 72 | } |
73 | if (event->cancelled ()) { | 73 | if (event->cancelled ()) { |
74 | mText +="<font color=\"#B00000\">"; | 74 | mText +="<font color=\"#B00000\">"; |
75 | addTag("i",i18n("This event has been cancelled!")); | 75 | addTag("i",i18n("This event has been cancelled!")); |
76 | mText.append("<br>"); | 76 | mText.append("<br>"); |
77 | mText += "</font>"; | 77 | mText += "</font>"; |
78 | } | 78 | } |
79 | if (!event->location().isEmpty()) { | 79 | if (!event->location().isEmpty()) { |
80 | addTag("b",i18n("Location: ")); | 80 | addTag("b",i18n("Location: ")); |
81 | mText.append(deTag(event->location())+"<br>"); | 81 | mText.append(deTag(event->location())+"<br>"); |
82 | } | 82 | } |
83 | if (event->doesFloat()) { | 83 | if (event->doesFloat()) { |
84 | if (event->isMultiDay()) { | 84 | if (event->isMultiDay()) { |
85 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") | 85 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") |
86 | .arg(event->dtStartDateStr(shortDate)) | 86 | .arg(event->dtStartDateStr(shortDate)) |
87 | .arg(event->dtEndDateStr(shortDate))); | 87 | .arg(event->dtEndDateStr(shortDate))); |
88 | } else { | 88 | } else { |
89 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); | 89 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); |
90 | } | 90 | } |
91 | } else { | 91 | } else { |
92 | if (event->isMultiDay()) { | 92 | if (event->isMultiDay()) { |
93 | mText.append(i18n("<p><b>From:</b> %1</p> ") | 93 | mText.append(i18n("<p><b>From:</b> %1</p> ") |
94 | .arg(event->dtStartStr( shortDate))); | 94 | .arg(event->dtStartStr( shortDate))); |
95 | mText.append(i18n("<p><b>To:</b> %1</p>") | 95 | mText.append(i18n("<p><b>To:</b> %1</p>") |
96 | .arg(event->dtEndStr(shortDate))); | 96 | .arg(event->dtEndStr(shortDate))); |
97 | } else { | 97 | } else { |
98 | mText.append(i18n("<p><b>On:</b> %1</p> ") | 98 | mText.append(i18n("<p><b>On:</b> %1</p> ") |
99 | .arg(event->dtStartDateStr( shortDate ))); | 99 | .arg(event->dtStartDateStr( shortDate ))); |
100 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") | 100 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") |
101 | .arg(event->dtStartTimeStr()) | 101 | .arg(event->dtStartTimeStr()) |
102 | .arg(event->dtEndTimeStr())); | 102 | .arg(event->dtEndTimeStr())); |
103 | } | 103 | } |
104 | } | 104 | } |
105 | 105 | ||
106 | if (event->recurrence()->doesRecur()) { | 106 | if (event->recurrence()->doesRecur()) { |
107 | 107 | ||
108 | QString recurText = event->recurrence()->recurrenceText(); | 108 | QString recurText = event->recurrence()->recurrenceText(); |
109 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); | 109 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); |
110 | 110 | ||
111 | bool ok; | 111 | bool ok; |
112 | QDate start = QDate::currentDate(); | 112 | QDate start = QDate::currentDate(); |
113 | QDateTime next; | 113 | QDateTime next; |
114 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); | 114 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); |
115 | if ( ok ) { | 115 | if ( ok ) { |
116 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); | 116 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); |
117 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); | 117 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); |
118 | 118 | ||
119 | } else { | 119 | } else { |
120 | bool last; | 120 | bool last; |
121 | QDate nextd; | 121 | QDate nextd; |
122 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); | 122 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); |
123 | if ( last ) { | 123 | if ( last ) { |
124 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | 124 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); |
125 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); | 125 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); |
126 | } | 126 | } |
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
130 | 130 | ||
131 | if (event->isAlarmEnabled()) { | 131 | if (event->isAlarmEnabled()) { |
132 | Alarm *alarm =event->alarms().first() ; | 132 | Alarm *alarm =event->alarms().first() ; |
133 | QDateTime t = alarm->time(); | 133 | QDateTime t = alarm->time(); |
134 | int min = t.secsTo( event->dtStart() )/60; | 134 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); |
135 | QString s =i18n("(%1 min before)").arg( min ); | ||
136 | addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate )); | 135 | addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate )); |
137 | //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 136 | //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
138 | //addTag("p",s); | 137 | //addTag("p",s); |
139 | } | 138 | } |
140 | 139 | ||
140 | |||
141 | |||
141 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); | 142 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); |
142 | // mText.append(event->secrecyStr()+"<br>"); | 143 | // mText.append(event->secrecyStr()+"<br>"); |
143 | formatCategories(event); | 144 | formatCategories(event); |
144 | if ( mDetails ) { | 145 | if ( mDetails ) { |
145 | if (!event->description().isEmpty()) { | 146 | if (!event->description().isEmpty()) { |
146 | addTag("p",i18n("<b>Details: </b>")); | 147 | addTag("p",i18n("<b>Details: </b>")); |
147 | addTag("p",deTag(event->description())); | 148 | addTag("p",deTag(event->description())); |
148 | } | 149 | } |
149 | } | 150 | } |
150 | 151 | ||
151 | formatReadOnly(event); | 152 | formatReadOnly(event); |
152 | formatAttendees(event); | 153 | formatAttendees(event); |
153 | 154 | ||
154 | if ( mCreated ) { | 155 | if ( mCreated ) { |
155 | addTag("p",i18n("<b>Created: ") +" </b>"); | 156 | addTag("p",i18n("<b>Created: ") +" </b>"); |
156 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 157 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
157 | 158 | ||
158 | } | 159 | } |
159 | if ( mModified ) { | 160 | if ( mModified ) { |
160 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | 161 | addTag("p",i18n("<b>Last modified: ") +" </b>"); |
161 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 162 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
162 | 163 | ||
163 | } | 164 | } |
164 | 165 | ||
165 | } | 166 | } |
166 | 167 | ||
167 | void KIncidenceFormatter::setTodo(Todo *event ) | 168 | void KIncidenceFormatter::setTodo(Todo *event ) |
168 | { | 169 | { |
169 | int mode = 0; | 170 | int mode = 0; |
170 | mCurrentIncidence = event; | 171 | mCurrentIncidence = event; |
171 | bool shortDate = true; | 172 | bool shortDate = true; |
172 | if (mode == 0 ) | 173 | if (mode == 0 ) |
173 | addTag("h3",deTag(event->summary())); | 174 | addTag("h3",deTag(event->summary())); |
174 | else { | 175 | else { |
175 | if ( mColorMode == 1 ) { | 176 | if ( mColorMode == 1 ) { |
176 | mText +="<font color=\"#00A000\">"; | 177 | mText +="<font color=\"#00A000\">"; |
177 | } | 178 | } |
178 | if ( mColorMode == 2 ) { | 179 | if ( mColorMode == 2 ) { |
179 | mText +="<font color=\"#B00000\">"; | 180 | mText +="<font color=\"#B00000\">"; |
180 | } | 181 | } |
181 | if ( mode == 1 ) { | 182 | if ( mode == 1 ) { |
182 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); | 183 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); |
183 | } else { | 184 | } else { |
184 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); | 185 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); |
185 | } | 186 | } |
186 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 187 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
187 | if ( mColorMode ) | 188 | if ( mColorMode ) |
188 | mText += "</font>"; | 189 | mText += "</font>"; |
189 | } | 190 | } |
190 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { | 191 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { |
191 | mText +="<font color=\"#B00000\">"; | 192 | mText +="<font color=\"#B00000\">"; |
192 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) ); | 193 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) ); |
193 | mText += "</font>"; | 194 | mText += "</font>"; |
194 | } else { | 195 | } else { |
195 | mText.append(i18n("<p><i>%1 % completed</i></p>") | 196 | mText.append(i18n("<p><i>%1 % completed</i></p>") |
196 | .arg(event->percentComplete())); | 197 | .arg(event->percentComplete())); |
197 | } | 198 | } |
198 | if (event->cancelled ()) { | 199 | if (event->cancelled ()) { |
199 | mText +="<font color=\"#B00000\">"; | 200 | mText +="<font color=\"#B00000\">"; |
200 | addTag("i",i18n("This todo has been cancelled!")); | 201 | addTag("i",i18n("This todo has been cancelled!")); |
201 | mText.append("<br>"); | 202 | mText.append("<br>"); |
202 | mText += "</font>"; | 203 | mText += "</font>"; |
203 | } | 204 | } |
204 | 205 | ||
205 | if (!event->location().isEmpty()) { | 206 | if (!event->location().isEmpty()) { |
206 | addTag("b",i18n("Location: ")); | 207 | addTag("b",i18n("Location: ")); |
207 | mText.append(deTag(event->location())+"<br>"); | 208 | mText.append(deTag(event->location())+"<br>"); |
208 | } | 209 | } |
209 | 210 | ||
210 | if (event->recurrence()->doesRecur()) { | 211 | if (event->recurrence()->doesRecur()) { |
211 | 212 | ||
212 | QString recurText = event->recurrence()->recurrenceText(); | 213 | QString recurText = event->recurrence()->recurrenceText(); |
213 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); | 214 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); |
214 | } | 215 | } |
215 | 216 | ||
216 | if (event->hasStartDate()) { | 217 | if (event->hasStartDate()) { |
217 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate))); | 218 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate))); |
218 | } | 219 | } |
219 | 220 | ||
220 | 221 | ||
221 | if (event->hasDueDate()) { | 222 | if (event->hasDueDate()) { |
222 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); | 223 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); |
223 | } | 224 | } |
224 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 225 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
225 | .arg(QString::number(event->priority()))); | 226 | .arg(QString::number(event->priority()))); |
226 | 227 | ||
228 | if (event->isAlarmEnabled()) { | ||
229 | Alarm *alarm =event->alarms().first() ; | ||
230 | QDateTime t = alarm->time(); | ||
231 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); | ||
232 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | ||
233 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | ||
234 | //addTag("p",s); | ||
235 | } | ||
236 | |||
227 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); | 237 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); |
228 | formatCategories(event); | 238 | formatCategories(event); |
229 | if ( mDetails ) { | 239 | if ( mDetails ) { |
230 | if (!event->description().isEmpty()) { | 240 | if (!event->description().isEmpty()) { |
231 | addTag("p",i18n("<b>Details: </b>")); | 241 | addTag("p",i18n("<b>Details: </b>")); |
232 | addTag("p",deTag(event->description())); | 242 | addTag("p",deTag(event->description())); |
233 | } | 243 | } |
234 | } | 244 | } |
235 | formatReadOnly(event); | 245 | formatReadOnly(event); |
236 | formatAttendees(event); | 246 | formatAttendees(event); |
237 | if ( mCreated ) { | 247 | if ( mCreated ) { |
238 | addTag("p",i18n("<b>Created: ") +" </b>"); | 248 | addTag("p",i18n("<b>Created: ") +" </b>"); |
239 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 249 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
240 | 250 | ||
241 | } | 251 | } |
242 | if ( mModified ) { | 252 | if ( mModified ) { |
243 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | 253 | addTag("p",i18n("<b>Last modified: ") +" </b>"); |
244 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 254 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
245 | 255 | ||
246 | } | 256 | } |
247 | } | 257 | } |
248 | 258 | ||
249 | void KIncidenceFormatter::setJournal(Journal* ) | 259 | void KIncidenceFormatter::setJournal(Journal* ) |
250 | { | 260 | { |
251 | 261 | ||
252 | } | 262 | } |
253 | 263 | ||
254 | void KIncidenceFormatter::formatCategories(Incidence *event) | 264 | void KIncidenceFormatter::formatCategories(Incidence *event) |
255 | { | 265 | { |
256 | if (!event->categoriesStr().isEmpty()) { | 266 | if (!event->categoriesStr().isEmpty()) { |
257 | addTag("p",i18n("<b>Categories: </b>")+event->categoriesStr() ); | 267 | addTag("p",i18n("<b>Categories: </b>")+event->categoriesStr() ); |
258 | //mText.append(event->categoriesStr()); | 268 | //mText.append(event->categoriesStr()); |
259 | } | 269 | } |
260 | } | 270 | } |
261 | void KIncidenceFormatter::addTag(const QString & tag,const QString & text) | 271 | void KIncidenceFormatter::addTag(const QString & tag,const QString & text) |
262 | { | 272 | { |
263 | int number=text.contains("\n"); | 273 | int number=text.contains("\n"); |
264 | QString str = "<" + tag + ">"; | 274 | QString str = "<" + tag + ">"; |
265 | QString tmpText=text; | 275 | QString tmpText=text; |
266 | QString tmpStr=str; | 276 | QString tmpStr=str; |
267 | if(number !=-1) | 277 | if(number !=-1) |
268 | { | 278 | { |
269 | if (number > 0) { | 279 | if (number > 0) { |
270 | int pos=0; | 280 | int pos=0; |
271 | QString tmp; | 281 | QString tmp; |
272 | for(int i=0;i<=number;i++) { | 282 | for(int i=0;i<=number;i++) { |
273 | pos=tmpText.find("\n"); | 283 | pos=tmpText.find("\n"); |
274 | tmp=tmpText.left(pos); | 284 | tmp=tmpText.left(pos); |
275 | tmpText=tmpText.right(tmpText.length()-pos-1); | 285 | tmpText=tmpText.right(tmpText.length()-pos-1); |
276 | tmpStr+=tmp+"<br>"; | 286 | tmpStr+=tmp+"<br>"; |
277 | } | 287 | } |
278 | } | 288 | } |
279 | else tmpStr += tmpText; | 289 | else tmpStr += tmpText; |
280 | tmpStr+="</" + tag + ">"; | 290 | tmpStr+="</" + tag + ">"; |
281 | mText.append(tmpStr); | 291 | mText.append(tmpStr); |
282 | } | 292 | } |
283 | else | 293 | else |
284 | { | 294 | { |
285 | str += text + "</" + tag + ">"; | 295 | str += text + "</" + tag + ">"; |
286 | mText.append(str); | 296 | mText.append(str); |
287 | } | 297 | } |
288 | } | 298 | } |
289 | 299 | ||
290 | void KIncidenceFormatter::formatAttendees(Incidence *event) | 300 | void KIncidenceFormatter::formatAttendees(Incidence *event) |
291 | { | 301 | { |
292 | QPtrList<Attendee> attendees = event->attendees(); | 302 | QPtrList<Attendee> attendees = event->attendees(); |
293 | if (attendees.count()) { | 303 | if (attendees.count()) { |
294 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); | 304 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); |
295 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); | 305 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); |
296 | addTag("h3",i18n("Organizer")); | 306 | addTag("h3",i18n("Organizer")); |
297 | mText.append("<ul><li>"); | 307 | mText.append("<ul><li>"); |
298 | #if 0 | 308 | #if 0 |
299 | //ndef KORG_NOKABC | 309 | //ndef KORG_NOKABC |
300 | 310 | ||
301 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); | 311 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); |
302 | KABC::Addressee::List addressList; | 312 | KABC::Addressee::List addressList; |
303 | addressList = add_book->findByEmail(event->organizer()); | 313 | addressList = add_book->findByEmail(event->organizer()); |
304 | KABC::Addressee o = addressList.first(); | 314 | KABC::Addressee o = addressList.first(); |
305 | if (!o.isEmpty() && addressList.size()<2) { | 315 | if (!o.isEmpty() && addressList.size()<2) { |
306 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 316 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
307 | mText += o.formattedName(); | 317 | mText += o.formattedName(); |
308 | mText += "</a>\n"; | 318 | mText += "</a>\n"; |
309 | } else { | 319 | } else { |
310 | mText.append(event->organizer()); | 320 | mText.append(event->organizer()); |
311 | } | 321 | } |
312 | #else | 322 | #else |
313 | mText.append(event->organizer()); | 323 | mText.append(event->organizer()); |
314 | #endif | 324 | #endif |
315 | if (iconPath) { | 325 | if (iconPath) { |
316 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; | 326 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; |
317 | mText += "<IMG src=\"" + iconPath + "\">"; | 327 | mText += "<IMG src=\"" + iconPath + "\">"; |
318 | mText += "</a>\n"; | 328 | mText += "</a>\n"; |
319 | } | 329 | } |
320 | mText.append("</li></ul>"); | 330 | mText.append("</li></ul>"); |
321 | 331 | ||
322 | addTag("h3",i18n("Attendees")); | 332 | addTag("h3",i18n("Attendees")); |