author | zautrix <zautrix> | 2005-06-03 23:10:45 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-03 23:10:45 (UTC) |
commit | 858b047efb5627824438cb3877e7bec0cebb3751 (patch) (unidiff) | |
tree | 7b36963344d4f5019f3a1ecb5eb9290f27c3b3c7 | |
parent | 0207d193bdb6c66201562a17e68872e018ec223c (diff) | |
download | kdepimpi-858b047efb5627824438cb3877e7bec0cebb3751.zip kdepimpi-858b047efb5627824438cb3877e7bec0cebb3751.tar.gz kdepimpi-858b047efb5627824438cb3877e7bec0cebb3751.tar.bz2 |
fixxx
-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 4 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 167 | ||||
-rw-r--r-- | korganizer/calendarview.h | 20 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 4 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 6 | ||||
-rw-r--r-- | libkcal/event.cpp | 6 | ||||
-rw-r--r-- | libkcal/event.h | 2 | ||||
-rw-r--r-- | libkcal/incidence.h | 2 | ||||
-rw-r--r-- | libkcal/journal.cpp | 2 | ||||
-rw-r--r-- | libkcal/journal.h | 2 | ||||
-rw-r--r-- | libkcal/todo.cpp | 4 | ||||
-rw-r--r-- | libkcal/todo.h | 2 |
13 files changed, 206 insertions, 17 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index 41868d9..cc8102c 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt | |||
@@ -1245,137 +1245,137 @@ | |||
1245 | { "Local calendar changed!\n","Lokaler Kalender geändert!\n" }, | 1245 | { "Local calendar changed!\n","Lokaler Kalender geändert!\n" }, |
1246 | { "Write back","Schreibe zurück" }, | 1246 | { "Write back","Schreibe zurück" }, |
1247 | { "KO/Pi Synchronization","KO/Pi Synchronisation" }, | 1247 | { "KO/Pi Synchronization","KO/Pi Synchronisation" }, |
1248 | { "Pi-Sync succesful!","Pi-Sync erfolgreich!" }, | 1248 | { "Pi-Sync succesful!","Pi-Sync erfolgreich!" }, |
1249 | { "Received sync request","Sync Anfrage erhalten" }, | 1249 | { "Received sync request","Sync Anfrage erhalten" }, |
1250 | { "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." }, | 1250 | { "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." }, |
1251 | { "Saving Data to temp file ...","Speichere Daten in temp Datei..." }, | 1251 | { "Saving Data to temp file ...","Speichere Daten in temp Datei..." }, |
1252 | { "Data saved to temp file!","Daten in temp Datei gespeichert!" }, | 1252 | { "Data saved to temp file!","Daten in temp Datei gespeichert!" }, |
1253 | { "Sending file...","Sende Datei..." }, | 1253 | { "Sending file...","Sende Datei..." }, |
1254 | { "Waiting for synced file...","Warte auf gesyncte Daten..." }, | 1254 | { "Waiting for synced file...","Warte auf gesyncte Daten..." }, |
1255 | { "Receiving synced file...","Gesyncte Daten erhalten..." }, | 1255 | { "Receiving synced file...","Gesyncte Daten erhalten..." }, |
1256 | { "Received %1 bytes","%1 Bytes erhalten" }, | 1256 | { "Received %1 bytes","%1 Bytes erhalten" }, |
1257 | { "Writing file to disk...","Speichere Datei..." }, | 1257 | { "Writing file to disk...","Speichere Datei..." }, |
1258 | { "Pi-Sync successful!","Pi-Sync erfolgreich!" }, | 1258 | { "Pi-Sync successful!","Pi-Sync erfolgreich!" }, |
1259 | { "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" }, | 1259 | { "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" }, |
1260 | { "Synchronize!","Synchronisiere!" }, | 1260 | { "Synchronize!","Synchronisiere!" }, |
1261 | { "High clock skew!","Großer Uhrzeitunterschied!" }, | 1261 | { "High clock skew!","Großer Uhrzeitunterschied!" }, |
1262 | { "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" }, | 1262 | { "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" }, |
1263 | { "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!" }, | 1263 | { "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!" }, |
1264 | { "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." }, | 1264 | { "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." }, |
1265 | { "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" }, | 1265 | { "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" }, |
1266 | { "List week view","Listenwochenansicht" }, | 1266 | { "List week view","Listenwochenansicht" }, |
1267 | { "List week","Listenwochenansicht" }, | 1267 | { "List week","Listenwochenansicht" }, |
1268 | { "Next Week","Nächste Woche" }, | 1268 | { "Next Week","Nächste Woche" }, |
1269 | { "Previous Week","Vorherige Woche" }, | 1269 | { "Previous Week","Vorherige Woche" }, |
1270 | { "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." }, | 1270 | { "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." }, |
1271 | { "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" }, | 1271 | { "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" }, |
1272 | { "Details","Details" }, | 1272 | { "Details","Details" }, |
1273 | { "Created time","Erstellt Zeit" }, | 1273 | { "Created time","Erstellt Zeit" }, |
1274 | { "Last modified time","Geändert Zeit" }, | 1274 | { "Last modified time","Geändert Zeit" }, |
1275 | { "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" }, | 1275 | { "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" }, |
1276 | { "View Options","Anzeige Optionen" }, | 1276 | { "View Options","Anzeige Optionen" }, |
1277 | { "<b>Created: ","<b>Erstellt am: " }, | 1277 | { "<b>Created: ","<b>Erstellt am: " }, |
1278 | { "<b>Last modified: ","<b>Zuletzt geändert am: " }, | 1278 | { "<b>Last modified: ","<b>Zuletzt geändert am: " }, |
1279 | { "Journal: ","Journal: " }, | 1279 | { "Journal: ","Journal: " }, |
1280 | { "yearly","jährlich" }, | 1280 | { "yearly","jährlich" }, |
1281 | { "(%1) ","%1-" }, | 1281 | { "(%1) ","%1-" }, |
1282 | { "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" }, | 1282 | { "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" }, |
1283 | { "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" }, | 1283 | { "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" }, |
1284 | { "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" }, | 1284 | { "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" }, |
1285 | { "Summary/Loc.","Titel/Ort" }, | 1285 | { "Summary/Loc.","Titel/Ort" }, |
1286 | { "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." }, | 1286 | { "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." }, |
1287 | { "Week Number","Wochennummer" }, | 1287 | { "Week Number","Wochennummer" }, |
1288 | { "Import","Importiere" }, | 1288 | { "Import","Importiere" }, |
1289 | { "Export","Exportiere" }, | 1289 | { "Export","Exportiere" }, |
1290 | { "Beam","Beame" }, | 1290 | { "Beam","Beame" }, |
1291 | { "Export selected","Exportiere Selektierte" }, | 1291 | { "Export selected","Exportiere Selektierte" }, |
1292 | { "As iCal (ics) file...","Als iCal (ics) Datei..." }, | 1292 | { "As iCal (ics) file...","Als iCal (ics) Datei..." }, |
1293 | { "As vCal (vcs) file...","Als vCal (vcs) Datei..." }, | 1293 | { "As vCal (vcs) file...","Als vCal (vcs) Datei..." }, |
1294 | { "Journal/Details...","Journale/Details..." }, | 1294 | { "Journal/Details...","Journale/Details..." }, |
1295 | { "Agenda View","Agenda Ansicht" }, | 1295 | { "Agenda View","Agenda Ansicht" }, |
1296 | { "Show current time","Zeige aktuelle Zeit" }, | 1296 | { "Show current time","Zeige aktuelle Zeit" }, |
1297 | { "Edit new item","Bearbeite neuen Eintrag" }, | 1297 | { "Edit new item","Bearbeite neuen Eintrag" }, |
1298 | { "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" }, | 1298 | { "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" }, |
1299 | { "There is no next alarm.","Es gibt keinen nächsten Alarm." }, | 1299 | { "There is no next alarm.","Es gibt keinen nächsten Alarm." }, |
1300 | { "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" }, | 1300 | { "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" }, |
1301 | { "The next alarm is in:\n","Der nächste Alarm ist in:\n" }, | 1301 | { "The next alarm is in:\n","Der nächste Alarm ist in:\n" }, |
1302 | { "%1 days\n","%1 Tagen\n" }, | 1302 | { "%1 days\n","%1 Tagen\n" }, |
1303 | { "1 day\n","1 Tag\n" }, | 1303 | { "1 day\n","1 Tag\n" }, |
1304 | { "%1 hours\n","%1 Stunden\n" }, | 1304 | { "%1 hours\n","%1 Stunden\n" }, |
1305 | { "1 hour\n","1 Stunde\n" }, | 1305 | { "1 hour\n","1 Stunde\n" }, |
1306 | { "%1 minutes\n","%1 Minuten\n" }, | 1306 | { "%1 minutes\n","%1 Minuten\n" }, |
1307 | { "1 minute\n","1 Minute\n" }, | 1307 | { "1 minute\n","1 Minute\n" }, |
1308 | { "Only one toolbar","Nur eine Toolbar" }, | 1308 | { "Only one toolbar","Nur eine Toolbar" }, |
1309 | { "Print","Drucke" }, | 1309 | { "Print","Drucke" }, |
1310 | { "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." }, | 1310 | { "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." }, |
1311 | { "There is nothing selected!","Es ist nichts ausgewählt!" }, | 1311 | { "There is nothing selected!","Es ist nichts ausgewählt!" }, |
1312 | { "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " }, | 1312 | { "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " }, |
1313 | { "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" }, | 1313 | { "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" }, |
1314 | { "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" }, | 1314 | { "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" }, |
1315 | { "KO/Pi Printout","KO/Pi Ausdruck" }, | 1315 | { "KO/Pi Printout","KO/Pi Ausdruck" }, |
1316 | { "Print unscaled","Drucke unskaliert" }, | 1316 | { "Print unscaled","Drucke unskaliert" }, |
1317 | { "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." }, | 1317 | { "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." }, |
1318 | { "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." }, | 1318 | { "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." }, |
1319 | { "Printout Mode","Druck Modus" }, | 1319 | { "Printout Mode","Druck Modus" }, |
1320 | { "Filter menu icon","Filtermenu Icon" }, | 1320 | { "Filter menu icon","Filtermenu Icon" }, |
1321 | { "<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" }, | 1321 | { "<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" }, |
1322 | { "<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" }, | 1322 | { "<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" }, |
1323 | { "%1d","%1t" }, | 1323 | { "%1d","%1t" }, |
1324 | { "%1h","%1std" }, | 1324 | { "%1h","%1std" }, |
1325 | { "%1min","%1min" }, | 1325 | { "%1min","%1min" }, |
1326 | { "( %1 before )","( %1 vorher )" }, | 1326 | { "( %1 before )","( %1 vorher )" }, |
1327 | { "The next alarm is in\nless than one minute!","Der nächste Alarm kommt in\nweniger als einer Minute!" }, | 1327 | { "The next alarm is in\nless than one minute!","Der nächste Alarm kommt in\nweniger als einer Minute!" }, |
1328 | { "\nThe internal alarm notification is disabled!\n","\nDie interne Alarmbenachrichtigung ist ausgeschaltet!\n" }, | 1328 | { "\nThe internal alarm notification is disabled!\n","\nDie interne Alarmbenachrichtigung ist ausgeschaltet!\n" }, |
1329 | { "Enable it in the settings menu, TAB alarm.","Schalten Sie sie an im Menu Einstellungen, TAB Alarm." }, | 1329 | { "Enable it in the settings menu, TAB alarm.","Schalten Sie sie an im Menu Einstellungen, TAB Alarm." }, |
1330 | { "Show Sync Events","Zeige Sync-Ereignisse" }, | 1330 | { "Show Sync Events","Zeige Sync-Ereignisse" }, |
1331 | { "Use short date in WN+Event view","Zeige Kurzdatum in WN+Terminanzeige" }, | 1331 | { "Use short date in WN+Event view","Zeige Kurzdatum in WN+Terminanzeige" }, |
1332 | { "Number of max.displayed todo prios:","Anzahl max.angezeigter Todo-Prios:" }, | 1332 | { "Number of max.displayed todo prios:","Anzahl max.angezeigter Todo-Prios:" }, |
1333 | { " on "," am " }, | 1333 | { " on "," am " }, |
1334 | { "On: ","Am: " }, | 1334 | { "On: ","Am: " }, |
1335 | { "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" }, | 1335 | { "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" }, |
1336 | { "Start/Stop todo...","Starte/Stoppe Todo..." }, | 1336 | { "Start/Stop todo...","Starte/Stoppe Todo..." }, |
1337 | { "Color for running todos:","Farbe für laufende Todos:" }, | 1337 | { "Color for running todos:","Farbe für laufende Todos:" }, |
1338 | { "The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?","Das Todo\n%1\nist gestartet.\nWollen Sie es\nauf gestoppt setzen?" }, | 1338 | { "The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?","Das Todo\n%1\nist gestartet.\nWollen Sie es\nauf gestoppt setzen?" }, |
1339 | { "Todo is started","Todo ist gestartet" }, | 1339 | { "Todo is started","Todo ist gestartet" }, |
1340 | { "Stop todo","Stoppe Todo" }, | 1340 | { "Stop todo","Stoppe Todo" }, |
1341 | { "Todo is stopped","Todo ist gestoppt" }, | 1341 | { "Todo is stopped","Todo ist gestoppt" }, |
1342 | { "Start todo","Starte Todo" }, | 1342 | { "Start todo","Starte Todo" }, |
1343 | { "The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?","Das Todo\n%1\nist gestoppt.\nWollen Sie es auf\ngestartet setzen?" }, | 1343 | { "The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?","Das Todo\n%1\nist gestoppt.\nWollen Sie es auf\ngestartet setzen?" }, |
1344 | { "The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?","Das Todo\n%1\nwird geklont!\nEs hat Untertodos!\nMöchten Sie alle\nUntertodos auch klonen?" }, | 1344 | { "The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?","Das Todo\n%1\nwird geklont!\nEs hat Untertodos!\nMöchten Sie alle\nUntertodos auch klonen?" }, |
1345 | { "Todo has subtodos","Todo hat Untertodos" }, | 1345 | { "Todo has subtodos","Todo hat Untertodos" }, |
1346 | { "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" }, | 1346 | { "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" }, |
1347 | { "Colors","Farben" }, | 1347 | { "Colors","Farben" }, |
1348 | { "Click on new parent item","Klicke auf neues Übertodo" }, | 1348 | { "Click on new parent item","Klicke auf neues Übertodo" }, |
1349 | { "Reparenting aborted!","Übertodo setzen abgebrochen" }, | 1349 | { "Reparenting aborted!","Übertodo setzen abgebrochen" }, |
1350 | { "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" }, | 1350 | { "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" }, |
1351 | { "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" }, | 1351 | { "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" }, |
1352 | { "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" }, | 1352 | { "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" }, |
1353 | { "Alternating background of list views","Abwechselnder Hintergrund für Listen" }, | 1353 | { "Alternating background of list views","Abwechselnder Hintergrund für Listen" }, |
1354 | { "times","Zeiten" }, | 1354 | { "times","Zeiten" }, |
1355 | { "The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?","Das Todo\n%1\nhat Untertodos!\nMöchten Sie die Kategorien\nauch für alle Untertodos setzen?" }, | 1355 | { "The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?","Das Todo\n%1\nhat Untertodos!\nMöchten Sie die Kategorien\nauch für alle Untertodos setzen?" }, |
1356 | { "Backup enabled","Backup angeschaltet" }, | 1356 | { "Backup enabled","Backup angeschaltet" }, |
1357 | { "Use standard backup dir","Standard Backupverzeichnis" }, | 1357 | { "Use standard backup dir","Standard Backupverzeichnis" }, |
1358 | { "Number of Backups:","Anzahl der Backups" }, | 1358 | { "Number of Backups:","Anzahl der Backups" }, |
1359 | { "Make backup every ","Mache ein Backup alle " }, | 1359 | { "Make backup every ","Mache ein Backup alle " }, |
1360 | { " days"," Tage" }, | 1360 | { " days"," Tage" }, |
1361 | { "Creating backup ... please wait ...","Erzeuge Backup ... bitte warten ..." }, | 1361 | { "Creating backup ... please wait ...","Erzeuge Backup ... bitte warten ..." }, |
1362 | { "Backup Failed!","Backup Problem!" }, | 1362 | { "Backup Failed!","Backup Problem!" }, |
1363 | { "Try again now","Versuche jetzt nochmal" }, | 1363 | { "Try again now","Versuche jetzt nochmal" }, |
1364 | { "Try again later","Versuche später nochmal" }, | 1364 | { "Try again later","Versuche später nochmal" }, |
1365 | { "Try again tomorrow","Versuche morgen nochmal" }, | 1365 | { "Try again tomorrow","Versuche morgen nochmal" }, |
1366 | { "Disable backup","Schalte Backup ab" }, | 1366 | { "Disable backup","Schalte Backup ab" }, |
1367 | { "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" }, | 1367 | { "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" }, |
1368 | { "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" }, | 1368 | { "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" }, |
1369 | { "Choose action","Wähle Aktion" }, | 1369 | { "Choose action","Wähle Aktion" }, |
1370 | { "Comment for todo:","Kommentar zum Todo:" }, | 1370 | { "Comment for todo:","Kommentar zum Todo:" }, |
1371 | { "Stop+note","Stop+Notiz" }, | 1371 | { "Stop+note","Stop+Notiz" }, |
1372 | { "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" }, | 1372 | { "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" }, |
1373 | { "","" }, | 1373 | { "KO/Pi: Missing alarm notification!","KO/Pi: Benachrichtigung über verpasste Alarme!" }, |
1374 | { "","" }, | 1374 | { "You missed the alarms for the following events or todos:","Sie verpassten die Alarme für folgende Termine oder Todos:" }, |
1375 | { "","" }, | 1375 | { "","" }, |
1376 | { "","" }, | 1376 | { "","" }, |
1377 | { "","" }, | 1377 | { "","" }, |
1378 | { "","" }, | 1378 | { "","" }, |
1379 | { "","" }, | 1379 | { "","" }, |
1380 | { "","" }, | 1380 | { "","" }, |
1381 | { "","" }, \ No newline at end of file | 1381 | { "","" }, \ No newline at end of file |
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 503ef12..36db9c4 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -13,256 +13,374 @@ | |||
13 | Copyright (c) 2000, 2001, 2002 | 13 | Copyright (c) 2000, 2001, 2002 |
14 | Cornelius Schumacher <schumacher@kde.org> | 14 | Cornelius Schumacher <schumacher@kde.org> |
15 | 15 | ||
16 | This program is free software; you can redistribute it and/or modify | 16 | This program is free software; you can redistribute it and/or modify |
17 | it under the terms of the GNU General Public License as published by | 17 | it under the terms of the GNU General Public License as published by |
18 | the Free Software Foundation; either version 2 of the License, or | 18 | the Free Software Foundation; either version 2 of the License, or |
19 | (at your option) any later version. | 19 | (at your option) any later version. |
20 | 20 | ||
21 | This program is distributed in the hope that it will be useful, | 21 | This program is distributed in the hope that it will be useful, |
22 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 22 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
24 | GNU General Public License for more details. | 24 | GNU General Public License for more details. |
25 | 25 | ||
26 | You should have received a copy of the GNU General Public License | 26 | You should have received a copy of the GNU General Public License |
27 | along with this program; if not, write to the Free Software | 27 | along with this program; if not, write to the Free Software |
28 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 28 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | 32 | ||
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #include <qradiobutton.h> | 34 | #include <qradiobutton.h> |
35 | #include <qbuttongroup.h> | 35 | #include <qbuttongroup.h> |
36 | #include <qlayout.h> | 36 | #include <qlayout.h> |
37 | #include <qclipboard.h> | 37 | #include <qclipboard.h> |
38 | #include <qcursor.h> | 38 | #include <qcursor.h> |
39 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
40 | #include <qprogressbar.h> | 40 | #include <qprogressbar.h> |
41 | #include <qmultilineedit.h> | 41 | #include <qmultilineedit.h> |
42 | #include <qtimer.h> | 42 | #include <qtimer.h> |
43 | #include <qwidgetstack.h> | 43 | #include <qwidgetstack.h> |
44 | #include <qptrlist.h> | 44 | #include <qptrlist.h> |
45 | #include <qregexp.h> | 45 | #include <qregexp.h> |
46 | #include <qgroupbox.h> | 46 | #include <qgroupbox.h> |
47 | #include <qfile.h> | 47 | #include <qfile.h> |
48 | #include <qdir.h> | 48 | #include <qdir.h> |
49 | #ifndef KORG_NOSPLITTER | 49 | #ifndef KORG_NOSPLITTER |
50 | #include <qsplitter.h> | 50 | #include <qsplitter.h> |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #include <kglobal.h> | 53 | #include <kglobal.h> |
54 | #include <kdebug.h> | 54 | #include <kdebug.h> |
55 | #include <kstandarddirs.h> | 55 | #include <kstandarddirs.h> |
56 | #include <kfiledialog.h> | 56 | #include <kfiledialog.h> |
57 | #include <kmessagebox.h> | 57 | #include <kmessagebox.h> |
58 | #include <knotifyclient.h> | 58 | #include <knotifyclient.h> |
59 | #include <kconfig.h> | 59 | #include <kconfig.h> |
60 | 60 | ||
61 | #include <libkdepim/ksyncprefsdialog.h> | 61 | #include <libkdepim/ksyncprefsdialog.h> |
62 | #include <krun.h> | 62 | #include <krun.h> |
63 | #include <kdirwatch.h> | 63 | #include <kdirwatch.h> |
64 | #include <libkdepim/kdatepicker.h> | 64 | #include <libkdepim/kdatepicker.h> |
65 | #include <libkdepim/ksyncprofile.h> | 65 | #include <libkdepim/ksyncprofile.h> |
66 | #include <libkdepim/kpimglobalprefs.h> | 66 | #include <libkdepim/kpimglobalprefs.h> |
67 | 67 | ||
68 | #include <libkcal/vcaldrag.h> | 68 | #include <libkcal/vcaldrag.h> |
69 | #include <libkcal/icaldrag.h> | 69 | #include <libkcal/icaldrag.h> |
70 | #include <libkcal/icalformat.h> | 70 | #include <libkcal/icalformat.h> |
71 | #include <libkcal/vcalformat.h> | 71 | #include <libkcal/vcalformat.h> |
72 | #include <libkcal/scheduler.h> | 72 | #include <libkcal/scheduler.h> |
73 | #include <libkcal/calendarlocal.h> | 73 | #include <libkcal/calendarlocal.h> |
74 | #include <libkcal/journal.h> | 74 | #include <libkcal/journal.h> |
75 | #include <libkcal/calfilter.h> | 75 | #include <libkcal/calfilter.h> |
76 | #include <libkcal/attendee.h> | 76 | #include <libkcal/attendee.h> |
77 | #include <libkcal/dndfactory.h> | 77 | #include <libkcal/dndfactory.h> |
78 | #include <libkcal/freebusy.h> | 78 | #include <libkcal/freebusy.h> |
79 | #include <libkcal/filestorage.h> | 79 | #include <libkcal/filestorage.h> |
80 | #include <libkcal/calendarresources.h> | 80 | #include <libkcal/calendarresources.h> |
81 | #include <libkcal/qtopiaformat.h> | 81 | #include <libkcal/qtopiaformat.h> |
82 | #include "../kalarmd/alarmdialog.h" | 82 | #include "../kalarmd/alarmdialog.h" |
83 | 83 | ||
84 | #ifndef DESKTOP_VERSION | 84 | #ifndef DESKTOP_VERSION |
85 | #include <libkcal/sharpformat.h> | 85 | #include <libkcal/sharpformat.h> |
86 | #include <externalapphandler.h> | 86 | #include <externalapphandler.h> |
87 | #endif | 87 | #endif |
88 | #include <libkcal/phoneformat.h> | 88 | #include <libkcal/phoneformat.h> |
89 | #ifndef KORG_NOMAIL | 89 | #ifndef KORG_NOMAIL |
90 | #include "komailclient.h" | 90 | #include "komailclient.h" |
91 | #endif | 91 | #endif |
92 | #ifndef KORG_NOPRINTER | 92 | #ifndef KORG_NOPRINTER |
93 | #include "calprinter.h" | 93 | #include "calprinter.h" |
94 | #endif | 94 | #endif |
95 | #ifndef KORG_NOPLUGINS | 95 | #ifndef KORG_NOPLUGINS |
96 | #include "kocore.h" | 96 | #include "kocore.h" |
97 | #endif | 97 | #endif |
98 | #include "koeventeditor.h" | 98 | #include "koeventeditor.h" |
99 | #include "kotodoeditor.h" | 99 | #include "kotodoeditor.h" |
100 | #include "koprefs.h" | 100 | #include "koprefs.h" |
101 | #include "koeventviewerdialog.h" | 101 | #include "koeventviewerdialog.h" |
102 | #include "publishdialog.h" | 102 | #include "publishdialog.h" |
103 | #include "kofilterview.h" | 103 | #include "kofilterview.h" |
104 | #include "koglobals.h" | 104 | #include "koglobals.h" |
105 | #include "koviewmanager.h" | 105 | #include "koviewmanager.h" |
106 | #include "koagendaview.h" | 106 | #include "koagendaview.h" |
107 | #include "kodialogmanager.h" | 107 | #include "kodialogmanager.h" |
108 | #include "outgoingdialog.h" | 108 | #include "outgoingdialog.h" |
109 | #include "incomingdialog.h" | 109 | #include "incomingdialog.h" |
110 | #include "datenavigatorcontainer.h" | 110 | #include "datenavigatorcontainer.h" |
111 | #include "statusdialog.h" | 111 | #include "statusdialog.h" |
112 | #include "kdatenavigator.h" | 112 | #include "kdatenavigator.h" |
113 | #include "kotodoview.h" | 113 | #include "kotodoview.h" |
114 | #include "datenavigator.h" | 114 | #include "datenavigator.h" |
115 | #include "resourceview.h" | 115 | #include "resourceview.h" |
116 | #include "navigatorbar.h" | 116 | #include "navigatorbar.h" |
117 | #include "searchdialog.h" | 117 | #include "searchdialog.h" |
118 | #include "mainwindow.h" | 118 | #include "mainwindow.h" |
119 | 119 | ||
120 | #include "calendarview.h" | 120 | #include "calendarview.h" |
121 | #ifndef DESKTOP_VERSION | 121 | #ifndef DESKTOP_VERSION |
122 | #include <qtopia/alarmserver.h> | 122 | #include <qtopia/alarmserver.h> |
123 | #endif | 123 | #endif |
124 | #ifndef _WIN32_ | 124 | #ifndef _WIN32_ |
125 | #include <stdlib.h> | 125 | #include <stdlib.h> |
126 | #include <stdio.h> | 126 | #include <stdio.h> |
127 | #include <unistd.h> | 127 | #include <unistd.h> |
128 | #else | 128 | #else |
129 | #include <qprocess.h> | 129 | #include <qprocess.h> |
130 | #endif | 130 | #endif |
131 | 131 | ||
132 | #ifdef DESKTOP_VERSION | 132 | #ifdef DESKTOP_VERSION |
133 | #include <kabc/stdaddressbook.h> | 133 | #include <kabc/stdaddressbook.h> |
134 | #endif | 134 | #endif |
135 | using namespace KOrg; | 135 | using namespace KOrg; |
136 | using namespace KCal; | 136 | using namespace KCal; |
137 | extern int globalFlagBlockAgenda; | 137 | extern int globalFlagBlockAgenda; |
138 | extern int globalFlagBlockStartup; | 138 | extern int globalFlagBlockStartup; |
139 | 139 | ||
140 | 140 | ||
141 | MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent) | ||
142 | |||
143 | { | ||
144 | mAlarms = alarms; | ||
145 | setBackgroundColor( QColor( 86, 153, 205 ) ); | ||
146 | QString mText = "<table width=\"100%\">\n"; | ||
147 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; | ||
148 | #ifdef DESKTOP_VERSION | ||
149 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; | ||
150 | #else | ||
151 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; | ||
152 | #endif | ||
153 | // mText += "<img src=\""; | ||
154 | // mText += ipath; | ||
155 | // mText += "\">"; | ||
156 | //mEventDate = QDate::currentDate(); | ||
157 | #ifdef DESKTOP_VERSION | ||
158 | mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h1>"; | ||
159 | #else | ||
160 | mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>"; | ||
161 | #endif | ||
162 | mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; | ||
163 | |||
164 | Incidence * inc = getNextInc( start ); | ||
165 | int time = 0; | ||
166 | mText += "<table>"; | ||
167 | while ( inc ) { | ||
168 | QDateTime dt ; | ||
169 | QString tempText = "<a "; | ||
170 | bool ok; | ||
171 | dt = inc->getNextOccurence( start, &ok ); | ||
172 | if ( !ok ) continue; | ||
173 | if ( inc->type() == "Event" ) { | ||
174 | tempText += "href=\"event:"; | ||
175 | } else if ( inc->type() == "Todo" ) { | ||
176 | tempText += "href=\"todo:"; | ||
177 | } | ||
178 | tempText += inc->uid() + "\">"; | ||
179 | if ( inc->type() == "Todo" ) | ||
180 | tempText += i18n("Todo: "); | ||
181 | if ( inc->summary().length() > 0 ) | ||
182 | tempText += inc->summary(); | ||
183 | else | ||
184 | tempText += i18n("-no summary-"); | ||
185 | QString timestr; | ||
186 | if (!inc->doesFloat()) | ||
187 | timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": "; | ||
188 | else | ||
189 | timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | ||
190 | if ( dt.date() == QDate::currentDate() && time == 0 ) { | ||
191 | time = 1; | ||
192 | mText +="</table>"; | ||
193 | mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>"; | ||
194 | mText += "<table>"; | ||
195 | |||
196 | } | ||
197 | if ( dt.date() > QDate::currentDate() && time != 2 ) { | ||
198 | time = 2; | ||
199 | mText +="</table>"; | ||
200 | mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>"; | ||
201 | mText += "<table>"; | ||
202 | } | ||
203 | mText +="<tr><td><b>"; | ||
204 | mText += timestr; | ||
205 | mText += "</b></td><td>"; | ||
206 | mText += tempText; | ||
207 | mText += "</td></tr>\n"; | ||
208 | inc = getNextInc( start ); | ||
209 | } | ||
210 | mText +="</table>"; | ||
211 | setText( mText ); | ||
212 | } | ||
213 | |||
214 | Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start ) | ||
215 | { | ||
216 | QDateTime dt ; | ||
217 | Incidence * retInc; | ||
218 | Incidence * inc = mAlarms.first(); | ||
219 | if ( inc == 0 ) | ||
220 | return 0; | ||
221 | bool ok; | ||
222 | dt = inc->getNextOccurence( start, &ok ); | ||
223 | if ( ! ok ) return 0; | ||
224 | QDateTime dtn ; | ||
225 | retInc = inc; | ||
226 | inc = mAlarms.next(); | ||
227 | while ( inc ) { | ||
228 | dtn = inc->getNextOccurence( start, &ok ); | ||
229 | if ( ! ok ) return 0; | ||
230 | if ( dtn < dt ) { | ||
231 | dt = dtn; | ||
232 | retInc = inc; | ||
233 | } | ||
234 | inc = mAlarms.next(); | ||
235 | } | ||
236 | mAlarms.remove( retInc ); | ||
237 | return retInc; | ||
238 | |||
239 | } | ||
240 | void MissedAlarmTextBrowser::setSource(const QString & n) | ||
241 | { | ||
242 | if (n.startsWith("event:")) { | ||
243 | #ifdef DESKTOP_VERSION | ||
244 | emit showIncidence(n.mid(8)); | ||
245 | #else | ||
246 | emit showIncidence(n.mid(6)); | ||
247 | #endif | ||
248 | return; | ||
249 | } else if (n.startsWith("todo:")) { | ||
250 | #ifdef DESKTOP_VERSION | ||
251 | emit showIncidence(n.mid(7)); | ||
252 | #else | ||
253 | emit showIncidence(n.mid(5)); | ||
254 | #endif | ||
255 | return; | ||
256 | } | ||
257 | } | ||
258 | |||
141 | 259 | ||
142 | class KOBeamPrefs : public QDialog | 260 | class KOBeamPrefs : public QDialog |
143 | { | 261 | { |
144 | public: | 262 | public: |
145 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : | 263 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : |
146 | QDialog( parent, name, true ) | 264 | QDialog( parent, name, true ) |
147 | { | 265 | { |
148 | setCaption( i18n("Beam Options") ); | 266 | setCaption( i18n("Beam Options") ); |
149 | QVBoxLayout* lay = new QVBoxLayout( this ); | 267 | QVBoxLayout* lay = new QVBoxLayout( this ); |
150 | lay->setSpacing( 3 ); | 268 | lay->setSpacing( 3 ); |
151 | lay->setMargin( 3 ); | 269 | lay->setMargin( 3 ); |
152 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); | 270 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); |
153 | lay->addWidget( format ); | 271 | lay->addWidget( format ); |
154 | format->setExclusive ( true ) ; | 272 | format->setExclusive ( true ) ; |
155 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); | 273 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); |
156 | lay->addWidget( time ); time->setExclusive ( true ) ; | 274 | lay->addWidget( time ); time->setExclusive ( true ) ; |
157 | vcal = new QRadioButton(" vCalendar ", format ); | 275 | vcal = new QRadioButton(" vCalendar ", format ); |
158 | ical = new QRadioButton(" iCalendar ", format ); | 276 | ical = new QRadioButton(" iCalendar ", format ); |
159 | vcal->setChecked( true ); | 277 | vcal->setChecked( true ); |
160 | tz = new QRadioButton(i18n(" With timezone "), time ); | 278 | tz = new QRadioButton(i18n(" With timezone "), time ); |
161 | local = new QRadioButton(i18n(" Local time "), time ); | 279 | local = new QRadioButton(i18n(" Local time "), time ); |
162 | tz->setChecked( true ); | 280 | tz->setChecked( true ); |
163 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); | 281 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); |
164 | lay->addWidget( ok ); | 282 | lay->addWidget( ok ); |
165 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 283 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
166 | lay->addWidget( cancel ); | 284 | lay->addWidget( cancel ); |
167 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 285 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
168 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 286 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
169 | resize( 200, 200 ); | 287 | resize( 200, 200 ); |
170 | } | 288 | } |
171 | 289 | ||
172 | bool beamVcal() { return vcal->isChecked(); } | 290 | bool beamVcal() { return vcal->isChecked(); } |
173 | bool beamLocal() { return local->isChecked(); } | 291 | bool beamLocal() { return local->isChecked(); } |
174 | private: | 292 | private: |
175 | QRadioButton* vcal, *ical, *local, *tz; | 293 | QRadioButton* vcal, *ical, *local, *tz; |
176 | }; | 294 | }; |
177 | class KOCatPrefs : public QDialog | 295 | class KOCatPrefs : public QDialog |
178 | { | 296 | { |
179 | public: | 297 | public: |
180 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : | 298 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : |
181 | QDialog( parent, name, true ) | 299 | QDialog( parent, name, true ) |
182 | { | 300 | { |
183 | setCaption( i18n("Manage new Categories") ); | 301 | setCaption( i18n("Manage new Categories") ); |
184 | QVBoxLayout* lay = new QVBoxLayout( this ); | 302 | QVBoxLayout* lay = new QVBoxLayout( this ); |
185 | lay->setSpacing( 3 ); | 303 | lay->setSpacing( 3 ); |
186 | lay->setMargin( 3 ); | 304 | lay->setMargin( 3 ); |
187 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); | 305 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); |
188 | lay->addWidget( lab ); | 306 | lay->addWidget( lab ); |
189 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 307 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
190 | lay->addWidget( format ); | 308 | lay->addWidget( format ); |
191 | format->setExclusive ( true ) ; | 309 | format->setExclusive ( true ) ; |
192 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 310 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
193 | new QRadioButton(i18n("Remove from Events/Todos"), format ); | 311 | new QRadioButton(i18n("Remove from Events/Todos"), format ); |
194 | addCatBut->setChecked( true ); | 312 | addCatBut->setChecked( true ); |
195 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 313 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
196 | lay->addWidget( ok ); | 314 | lay->addWidget( ok ); |
197 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 315 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
198 | lay->addWidget( cancel ); | 316 | lay->addWidget( cancel ); |
199 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 317 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
200 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 318 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
201 | resize( 200, 200 ); | 319 | resize( 200, 200 ); |
202 | } | 320 | } |
203 | 321 | ||
204 | bool addCat() { return addCatBut->isChecked(); } | 322 | bool addCat() { return addCatBut->isChecked(); } |
205 | private: | 323 | private: |
206 | QRadioButton* addCatBut; | 324 | QRadioButton* addCatBut; |
207 | }; | 325 | }; |
208 | 326 | ||
209 | 327 | ||
210 | 328 | ||
211 | CalendarView::CalendarView( CalendarResources *calendar, | 329 | CalendarView::CalendarView( CalendarResources *calendar, |
212 | QWidget *parent, const char *name ) | 330 | QWidget *parent, const char *name ) |
213 | : CalendarViewBase( parent, name ), | 331 | : CalendarViewBase( parent, name ), |
214 | mCalendar( calendar ), | 332 | mCalendar( calendar ), |
215 | mResourceManager( calendar->resourceManager() ) | 333 | mResourceManager( calendar->resourceManager() ) |
216 | { | 334 | { |
217 | 335 | ||
218 | mEventEditor = 0; | 336 | mEventEditor = 0; |
219 | mTodoEditor = 0; | 337 | mTodoEditor = 0; |
220 | 338 | ||
221 | init(); | 339 | init(); |
222 | } | 340 | } |
223 | 341 | ||
224 | CalendarView::CalendarView( Calendar *calendar, | 342 | CalendarView::CalendarView( Calendar *calendar, |
225 | QWidget *parent, const char *name ) | 343 | QWidget *parent, const char *name ) |
226 | : CalendarViewBase( parent, name ), | 344 | : CalendarViewBase( parent, name ), |
227 | mCalendar( calendar ), | 345 | mCalendar( calendar ), |
228 | mResourceManager( 0 ) | 346 | mResourceManager( 0 ) |
229 | { | 347 | { |
230 | 348 | ||
231 | mEventEditor = 0; | 349 | mEventEditor = 0; |
232 | mTodoEditor = 0; | 350 | mTodoEditor = 0; |
233 | init(); | 351 | init(); |
234 | } | 352 | } |
235 | 353 | ||
236 | void CalendarView::init() | 354 | void CalendarView::init() |
237 | { | 355 | { |
238 | mNextAlarmDateTime = QDateTime::currentDateTime(); | 356 | mNextAlarmDateTime = QDateTime::currentDateTime(); |
239 | setFocusPolicy ( NoFocus ); | 357 | setFocusPolicy ( NoFocus ); |
240 | mViewerCallerIsSearchDialog = false; | 358 | mViewerCallerIsSearchDialog = false; |
241 | mBlockShowDates = false; | 359 | mBlockShowDates = false; |
242 | beamDialog = new KOBeamPrefs(); | 360 | beamDialog = new KOBeamPrefs(); |
243 | mDatePickerMode = 0; | 361 | mDatePickerMode = 0; |
244 | mCurrentSyncDevice = ""; | 362 | mCurrentSyncDevice = ""; |
245 | writeLocale(); | 363 | writeLocale(); |
246 | mViewManager = new KOViewManager( this ); | 364 | mViewManager = new KOViewManager( this ); |
247 | mDialogManager = new KODialogManager( this ); | 365 | mDialogManager = new KODialogManager( this ); |
248 | mEventViewerDialog = 0; | 366 | mEventViewerDialog = 0; |
249 | mModified = false; | 367 | mModified = false; |
250 | mReadOnly = false; | 368 | mReadOnly = false; |
251 | mSelectedIncidence = 0; | 369 | mSelectedIncidence = 0; |
252 | mCalPrinter = 0; | 370 | mCalPrinter = 0; |
253 | mFilters.setAutoDelete(true); | 371 | mFilters.setAutoDelete(true); |
254 | 372 | ||
255 | mCalendar->registerObserver( this ); | 373 | mCalendar->registerObserver( this ); |
256 | // TODO: Make sure that view is updated, when calendar is changed. | 374 | // TODO: Make sure that view is updated, when calendar is changed. |
257 | 375 | ||
258 | mStorage = new FileStorage( mCalendar ); | 376 | mStorage = new FileStorage( mCalendar ); |
259 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 377 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
260 | 378 | ||
261 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 379 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
262 | #ifndef KORG_NOSPLITTER | 380 | #ifndef KORG_NOSPLITTER |
263 | // create the main layout frames. | 381 | // create the main layout frames. |
264 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 382 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
265 | topLayout->addWidget(mPanner); | 383 | topLayout->addWidget(mPanner); |
266 | 384 | ||
267 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 385 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
268 | "CalendarView::LeftFrame"); | 386 | "CalendarView::LeftFrame"); |
@@ -381,257 +499,295 @@ void CalendarView::init() | |||
381 | mNavigator, SLOT( selectPreviousYear() ) ); | 499 | mNavigator, SLOT( selectPreviousYear() ) ); |
382 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 500 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
383 | mNavigator, SLOT( selectNextYear() ) ); | 501 | mNavigator, SLOT( selectNextYear() ) ); |
384 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 502 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
385 | mNavigator, SLOT( selectPreviousMonth() ) ); | 503 | mNavigator, SLOT( selectPreviousMonth() ) ); |
386 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 504 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
387 | mNavigator, SLOT( selectNextMonth() ) ); | 505 | mNavigator, SLOT( selectNextMonth() ) ); |
388 | 506 | ||
389 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 507 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
390 | mNavigator, SLOT( selectPrevious() ) ); | 508 | mNavigator, SLOT( selectPrevious() ) ); |
391 | connect( mDateNavigator, SIGNAL( goNext() ), | 509 | connect( mDateNavigator, SIGNAL( goNext() ), |
392 | mNavigator, SLOT( selectNext() ) ); | 510 | mNavigator, SLOT( selectNext() ) ); |
393 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 511 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
394 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 512 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
395 | 513 | ||
396 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 514 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
397 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 515 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
398 | #if 0 | 516 | #if 0 |
399 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), | 517 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), |
400 | SLOT( incidenceAdded( Incidence *) ) ); | 518 | SLOT( incidenceAdded( Incidence *) ) ); |
401 | #endif | 519 | #endif |
402 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 520 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
403 | 521 | ||
404 | connect( this, SIGNAL( configChanged() ), | 522 | connect( this, SIGNAL( configChanged() ), |
405 | mDateNavigator, SLOT( updateConfig() ) ); | 523 | mDateNavigator, SLOT( updateConfig() ) ); |
406 | 524 | ||
407 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 525 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
408 | SLOT( newTodo() ) ); | 526 | SLOT( newTodo() ) ); |
409 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 527 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
410 | SLOT( newSubTodo( Todo * ) ) ); | 528 | SLOT( newSubTodo( Todo * ) ) ); |
411 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 529 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
412 | SLOT( editTodo( Todo * ) ) ); | 530 | SLOT( editTodo( Todo * ) ) ); |
413 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 531 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
414 | SLOT( showTodo( Todo *) ) ); | 532 | SLOT( showTodo( Todo *) ) ); |
415 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 533 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
416 | SLOT( deleteTodo( Todo *) ) ); | 534 | SLOT( deleteTodo( Todo *) ) ); |
417 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 535 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
418 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 536 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
419 | SLOT( purgeCompleted() ) ); | 537 | SLOT( purgeCompleted() ) ); |
420 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 538 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
421 | SIGNAL( todoModified( Todo *, int ) ) ); | 539 | SIGNAL( todoModified( Todo *, int ) ) ); |
422 | 540 | ||
423 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 541 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
424 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 542 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
425 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 543 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
426 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 544 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
427 | 545 | ||
428 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 546 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
429 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 547 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
430 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 548 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
431 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 549 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
432 | 550 | ||
433 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 551 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
434 | this, SLOT ( todo_unsub( Todo * ) ) ); | 552 | this, SLOT ( todo_unsub( Todo * ) ) ); |
435 | 553 | ||
436 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 554 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
437 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 555 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
438 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 556 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
439 | SLOT( updateTodo( Todo *, int ) ) ); | 557 | SLOT( updateTodo( Todo *, int ) ) ); |
440 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 558 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
441 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 559 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
442 | 560 | ||
443 | 561 | ||
444 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 562 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
445 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 563 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
446 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 564 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
447 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 565 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
448 | 566 | ||
449 | 567 | ||
450 | 568 | ||
451 | 569 | ||
452 | 570 | ||
453 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 571 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
454 | SLOT(checkClipboard())); | 572 | SLOT(checkClipboard())); |
455 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 573 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
456 | SLOT( processTodoListSelection( Incidence * ) ) ); | 574 | SLOT( processTodoListSelection( Incidence * ) ) ); |
457 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 575 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
458 | 576 | ||
459 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 577 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
460 | 578 | ||
461 | mDateFrame = new QVBox(0,0,WType_Popup); | 579 | mDateFrame = new QVBox(0,0,WType_Popup); |
462 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 580 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
463 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 581 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
464 | mDateFrame->setLineWidth(3); | 582 | mDateFrame->setLineWidth(3); |
465 | mDateFrame->hide(); | 583 | mDateFrame->hide(); |
466 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 584 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
467 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 585 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
468 | 586 | ||
469 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 587 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
470 | 588 | ||
471 | mEventEditor = mDialogManager->getEventEditor(); | 589 | mEventEditor = mDialogManager->getEventEditor(); |
472 | mTodoEditor = mDialogManager->getTodoEditor(); | 590 | mTodoEditor = mDialogManager->getTodoEditor(); |
473 | 591 | ||
474 | mFlagEditDescription = false; | 592 | mFlagEditDescription = false; |
475 | 593 | ||
476 | mSuspendTimer = new QTimer( this ); | 594 | mSuspendTimer = new QTimer( this ); |
477 | mAlarmTimer = new QTimer( this ); | 595 | mAlarmTimer = new QTimer( this ); |
478 | mRecheckAlarmTimer = new QTimer( this ); | 596 | mRecheckAlarmTimer = new QTimer( this ); |
479 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 597 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
480 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 598 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
481 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 599 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
482 | mAlarmDialog = new AlarmDialog( this ); | 600 | mAlarmDialog = new AlarmDialog( this ); |
483 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 601 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
484 | mAlarmDialog->setServerNotification( false ); | 602 | mAlarmDialog->setServerNotification( false ); |
485 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 603 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
486 | 604 | ||
487 | 605 | ||
488 | #ifndef DESKTOP_VERSION | 606 | #ifndef DESKTOP_VERSION |
489 | //US listen for arriving address resultsets | 607 | //US listen for arriving address resultsets |
490 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 608 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
491 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 609 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
492 | #endif | 610 | #endif |
493 | mDateNavigator->setCalendar( mCalendar ); | 611 | mDateNavigator->setCalendar( mCalendar ); |
494 | } | 612 | } |
495 | 613 | ||
496 | 614 | ||
497 | CalendarView::~CalendarView() | 615 | CalendarView::~CalendarView() |
498 | { | 616 | { |
499 | // kdDebug() << "~CalendarView()" << endl; | 617 | // kdDebug() << "~CalendarView()" << endl; |
500 | //qDebug("CalendarView::~CalendarView() "); | 618 | //qDebug("CalendarView::~CalendarView() "); |
501 | delete mDialogManager; | 619 | delete mDialogManager; |
502 | delete mViewManager; | 620 | delete mViewManager; |
503 | delete mStorage; | 621 | delete mStorage; |
504 | delete mDateFrame ; | 622 | delete mDateFrame ; |
505 | delete beamDialog; | 623 | delete beamDialog; |
506 | delete mEventViewerDialog; | 624 | delete mEventViewerDialog; |
507 | //kdDebug() << "~CalendarView() done" << endl; | 625 | //kdDebug() << "~CalendarView() done" << endl; |
508 | } | 626 | } |
627 | void CalendarView::checkAlarms() | ||
628 | { | ||
629 | KConfig *config = KOGlobals::config(); | ||
630 | config->setGroup( "AppRun" ); | ||
631 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | ||
632 | int secs = config->readNumEntry( "LatestProgramStop" ) - 30; | ||
633 | //secs -= ( 3600 * 24*3 ); // debug only | ||
634 | QDateTime latest = dt.addSecs ( secs ); | ||
635 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); | ||
636 | QPtrList<Incidence> el = mCalendar->rawIncidences(); | ||
637 | QPtrList<Incidence> al; | ||
638 | Incidence* inL = el.first(); | ||
639 | while ( inL ) { | ||
640 | bool ok = false; | ||
641 | int offset = 0; | ||
642 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; | ||
643 | if ( ok ) { | ||
644 | //qDebug("OK %s",next.toString().latin1()); | ||
645 | if ( next < QDateTime::currentDateTime() ) { | ||
646 | al.append( inL ); | ||
647 | qDebug("found missed alarm: %s ", inL->summary().latin1() ); | ||
648 | } | ||
649 | } | ||
650 | inL = el.next(); | ||
651 | } | ||
652 | if ( al.count() ) { | ||
653 | QDialog dia ( this, "huhu", true ); | ||
654 | dia.setCaption( i18n("KO/Pi: Missing alarm notification!") ); | ||
655 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | ||
656 | lay->setSpacing( 3 ); | ||
657 | lay->setMargin( 3 ); | ||
658 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( &dia, al, latest ); | ||
659 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); | ||
660 | lay->addWidget( matb ); | ||
661 | dia.resize(240,240); | ||
662 | dia.exec(); | ||
509 | 663 | ||
664 | } | ||
665 | } | ||
510 | void CalendarView::showDay( QDate d ) | 666 | void CalendarView::showDay( QDate d ) |
511 | { | 667 | { |
512 | dateNavigator()->blockSignals( true ); | 668 | dateNavigator()->blockSignals( true ); |
513 | dateNavigator()->selectDate( d ); | 669 | dateNavigator()->selectDate( d ); |
514 | dateNavigator()->blockSignals( false ); | 670 | dateNavigator()->blockSignals( false ); |
515 | mViewManager->showDayView(); | 671 | mViewManager->showDayView(); |
516 | //dateNavigator()->selectDate( d ); | 672 | //dateNavigator()->selectDate( d ); |
517 | } | 673 | } |
518 | void CalendarView::timerAlarm() | 674 | void CalendarView::timerAlarm() |
519 | { | 675 | { |
520 | //qDebug("CalendarView::timerAlarm() "); | 676 | //qDebug("CalendarView::timerAlarm() "); |
521 | computeAlarm(mAlarmNotification ); | 677 | computeAlarm(mAlarmNotification ); |
522 | } | 678 | } |
523 | 679 | ||
524 | void CalendarView::suspendAlarm() | 680 | void CalendarView::suspendAlarm() |
525 | { | 681 | { |
526 | //qDebug(" CalendarView::suspendAlarm() "); | 682 | //qDebug(" CalendarView::suspendAlarm() "); |
527 | computeAlarm(mSuspendAlarmNotification ); | 683 | computeAlarm(mSuspendAlarmNotification ); |
528 | 684 | ||
529 | } | 685 | } |
530 | 686 | ||
531 | void CalendarView::startAlarm( QString mess , QString filename) | 687 | void CalendarView::startAlarm( QString mess , QString filename) |
532 | { | 688 | { |
533 | 689 | ||
534 | topLevelWidget()->showNormal(); | 690 | topLevelWidget()->showNormal(); |
535 | topLevelWidget()->setActiveWindow(); | 691 | topLevelWidget()->setActiveWindow(); |
536 | topLevelWidget()->raise(); | 692 | topLevelWidget()->raise(); |
537 | 693 | ||
538 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 694 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
539 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); | 695 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); |
540 | 696 | ||
541 | } | 697 | } |
542 | 698 | ||
543 | void CalendarView::checkNextTimerAlarm() | 699 | void CalendarView::checkNextTimerAlarm() |
544 | { | 700 | { |
545 | mCalendar->checkAlarmForIncidence( 0, true ); | 701 | mCalendar->checkAlarmForIncidence( 0, true ); |
546 | } | 702 | } |
547 | 703 | ||
548 | void CalendarView::computeAlarm( QString msg ) | 704 | void CalendarView::computeAlarm( QString msg ) |
549 | { | 705 | { |
550 | 706 | ||
551 | QString mess = msg; | 707 | QString mess = msg; |
552 | QString mAlarmMessage = mess.mid( 9 ); | 708 | QString mAlarmMessage = mess.mid( 9 ); |
553 | QString filename = MainWindow::resourcePath(); | 709 | QString filename = MainWindow::resourcePath(); |
554 | filename += "koalarm.wav"; | 710 | filename += "koalarm.wav"; |
555 | QString tempfilename; | 711 | QString tempfilename; |
556 | if ( mess.left( 13 ) == "suspend_alarm") { | 712 | if ( mess.left( 13 ) == "suspend_alarm") { |
557 | bool error = false; | 713 | bool error = false; |
558 | int len = mess.mid( 13 ).find("+++"); | 714 | int len = mess.mid( 13 ).find("+++"); |
559 | if ( len < 2 ) | 715 | if ( len < 2 ) |
560 | error = true; | 716 | error = true; |
561 | else { | 717 | else { |
562 | tempfilename = mess.mid( 13, len ); | 718 | tempfilename = mess.mid( 13, len ); |
563 | if ( !QFile::exists( tempfilename ) ) | 719 | if ( !QFile::exists( tempfilename ) ) |
564 | error = true; | 720 | error = true; |
565 | } | 721 | } |
566 | if ( ! error ) { | 722 | if ( ! error ) { |
567 | filename = tempfilename; | 723 | filename = tempfilename; |
568 | } | 724 | } |
569 | mAlarmMessage = mess.mid( 13+len+3 ); | 725 | mAlarmMessage = mess.mid( 13+len+3 ); |
570 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 726 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
571 | startAlarm( mAlarmMessage, filename); | 727 | startAlarm( mAlarmMessage, filename); |
572 | return; | 728 | return; |
573 | } | 729 | } |
574 | if ( mess.left( 11 ) == "timer_alarm") { | 730 | if ( mess.left( 11 ) == "timer_alarm") { |
575 | //mTimerTime = 0; | 731 | //mTimerTime = 0; |
576 | startAlarm( mess.mid( 11 ), filename ); | 732 | startAlarm( mess.mid( 11 ), filename ); |
577 | return; | 733 | return; |
578 | } | 734 | } |
579 | if ( mess.left( 10 ) == "proc_alarm") { | 735 | if ( mess.left( 10 ) == "proc_alarm") { |
580 | bool error = false; | 736 | bool error = false; |
581 | int len = mess.mid( 10 ).find("+++"); | 737 | int len = mess.mid( 10 ).find("+++"); |
582 | if ( len < 2 ) | 738 | if ( len < 2 ) |
583 | error = true; | 739 | error = true; |
584 | else { | 740 | else { |
585 | tempfilename = mess.mid( 10, len ); | 741 | tempfilename = mess.mid( 10, len ); |
586 | if ( !QFile::exists( tempfilename ) ) | 742 | if ( !QFile::exists( tempfilename ) ) |
587 | error = true; | 743 | error = true; |
588 | } | 744 | } |
589 | if ( error ) { | 745 | if ( error ) { |
590 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 746 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
591 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 747 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
592 | } else { | 748 | } else { |
593 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 749 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
594 | //qDebug("-----system command %s ",tempfilename.latin1() ); | 750 | //qDebug("-----system command %s ",tempfilename.latin1() ); |
595 | #ifndef _WIN32_ | 751 | #ifndef _WIN32_ |
596 | if ( vfork () == 0 ) { | 752 | if ( vfork () == 0 ) { |
597 | execl ( tempfilename.latin1(), 0 ); | 753 | execl ( tempfilename.latin1(), 0 ); |
598 | return; | 754 | return; |
599 | } | 755 | } |
600 | #else | 756 | #else |
601 | QProcess* p = new QProcess(); | 757 | QProcess* p = new QProcess(); |
602 | p->addArgument( tempfilename.latin1() ); | 758 | p->addArgument( tempfilename.latin1() ); |
603 | p->start(); | 759 | p->start(); |
604 | return; | 760 | return; |
605 | #endif | 761 | #endif |
606 | 762 | ||
607 | return; | 763 | return; |
608 | } | 764 | } |
609 | 765 | ||
610 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); | 766 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); |
611 | } | 767 | } |
612 | if ( mess.left( 11 ) == "audio_alarm") { | 768 | if ( mess.left( 11 ) == "audio_alarm") { |
613 | bool error = false; | 769 | bool error = false; |
614 | int len = mess.mid( 11 ).find("+++"); | 770 | int len = mess.mid( 11 ).find("+++"); |
615 | if ( len < 2 ) | 771 | if ( len < 2 ) |
616 | error = true; | 772 | error = true; |
617 | else { | 773 | else { |
618 | tempfilename = mess.mid( 11, len ); | 774 | tempfilename = mess.mid( 11, len ); |
619 | if ( !QFile::exists( tempfilename ) ) | 775 | if ( !QFile::exists( tempfilename ) ) |
620 | error = true; | 776 | error = true; |
621 | } | 777 | } |
622 | if ( ! error ) { | 778 | if ( ! error ) { |
623 | filename = tempfilename; | 779 | filename = tempfilename; |
624 | } | 780 | } |
625 | mAlarmMessage = mess.mid( 11+len+3+9 ); | 781 | mAlarmMessage = mess.mid( 11+len+3+9 ); |
626 | //qDebug("audio file command %s ",tempfilename.latin1() ); | 782 | //qDebug("audio file command %s ",tempfilename.latin1() ); |
627 | } | 783 | } |
628 | if ( mess.left( 9 ) == "cal_alarm") { | 784 | if ( mess.left( 9 ) == "cal_alarm") { |
629 | mAlarmMessage = mess.mid( 9 ) ; | 785 | mAlarmMessage = mess.mid( 9 ) ; |
630 | } | 786 | } |
631 | 787 | ||
632 | startAlarm( mAlarmMessage, filename ); | 788 | startAlarm( mAlarmMessage, filename ); |
633 | 789 | ||
634 | 790 | ||
635 | } | 791 | } |
636 | 792 | ||
637 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) | 793 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) |
@@ -1844,257 +2000,259 @@ void CalendarView::readSettings() | |||
1844 | #endif | 2000 | #endif |
1845 | globalFlagBlockAgenda = 1; | 2001 | globalFlagBlockAgenda = 1; |
1846 | mViewManager->showAgendaView(); | 2002 | mViewManager->showAgendaView(); |
1847 | //mViewManager->readSettings( config ); | 2003 | //mViewManager->readSettings( config ); |
1848 | mTodoList->restoreLayout(config,QString("Todo Layout")); | 2004 | mTodoList->restoreLayout(config,QString("Todo Layout")); |
1849 | readFilterSettings(config); | 2005 | readFilterSettings(config); |
1850 | 2006 | ||
1851 | #ifdef DESKTOP_VERSION | 2007 | #ifdef DESKTOP_VERSION |
1852 | config->setGroup("WidgetLayout"); | 2008 | config->setGroup("WidgetLayout"); |
1853 | QStringList list; | 2009 | QStringList list; |
1854 | list = config->readListEntry("MainLayout"); | 2010 | list = config->readListEntry("MainLayout"); |
1855 | int x,y,w,h; | 2011 | int x,y,w,h; |
1856 | if ( ! list.isEmpty() ) { | 2012 | if ( ! list.isEmpty() ) { |
1857 | x = list[0].toInt(); | 2013 | x = list[0].toInt(); |
1858 | y = list[1].toInt(); | 2014 | y = list[1].toInt(); |
1859 | w = list[2].toInt(); | 2015 | w = list[2].toInt(); |
1860 | h = list[3].toInt(); | 2016 | h = list[3].toInt(); |
1861 | KApplication::testCoords( &x,&y,&w,&h ); | 2017 | KApplication::testCoords( &x,&y,&w,&h ); |
1862 | topLevelWidget()->setGeometry(x,y,w,h); | 2018 | topLevelWidget()->setGeometry(x,y,w,h); |
1863 | 2019 | ||
1864 | } else { | 2020 | } else { |
1865 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 2021 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
1866 | } | 2022 | } |
1867 | list = config->readListEntry("EditEventLayout"); | 2023 | list = config->readListEntry("EditEventLayout"); |
1868 | if ( ! list.isEmpty() ) { | 2024 | if ( ! list.isEmpty() ) { |
1869 | x = list[0].toInt(); | 2025 | x = list[0].toInt(); |
1870 | y = list[1].toInt(); | 2026 | y = list[1].toInt(); |
1871 | w = list[2].toInt(); | 2027 | w = list[2].toInt(); |
1872 | h = list[3].toInt(); | 2028 | h = list[3].toInt(); |
1873 | KApplication::testCoords( &x,&y,&w,&h ); | 2029 | KApplication::testCoords( &x,&y,&w,&h ); |
1874 | mEventEditor->setGeometry(x,y,w,h); | 2030 | mEventEditor->setGeometry(x,y,w,h); |
1875 | 2031 | ||
1876 | } | 2032 | } |
1877 | list = config->readListEntry("EditTodoLayout"); | 2033 | list = config->readListEntry("EditTodoLayout"); |
1878 | if ( ! list.isEmpty() ) { | 2034 | if ( ! list.isEmpty() ) { |
1879 | x = list[0].toInt(); | 2035 | x = list[0].toInt(); |
1880 | y = list[1].toInt(); | 2036 | y = list[1].toInt(); |
1881 | w = list[2].toInt(); | 2037 | w = list[2].toInt(); |
1882 | h = list[3].toInt(); | 2038 | h = list[3].toInt(); |
1883 | KApplication::testCoords( &x,&y,&w,&h ); | 2039 | KApplication::testCoords( &x,&y,&w,&h ); |
1884 | mTodoEditor->setGeometry(x,y,w,h); | 2040 | mTodoEditor->setGeometry(x,y,w,h); |
1885 | 2041 | ||
1886 | } | 2042 | } |
1887 | list = config->readListEntry("ViewerLayout"); | 2043 | list = config->readListEntry("ViewerLayout"); |
1888 | if ( ! list.isEmpty() ) { | 2044 | if ( ! list.isEmpty() ) { |
1889 | x = list[0].toInt(); | 2045 | x = list[0].toInt(); |
1890 | y = list[1].toInt(); | 2046 | y = list[1].toInt(); |
1891 | w = list[2].toInt(); | 2047 | w = list[2].toInt(); |
1892 | h = list[3].toInt(); | 2048 | h = list[3].toInt(); |
1893 | KApplication::testCoords( &x,&y,&w,&h ); | 2049 | KApplication::testCoords( &x,&y,&w,&h ); |
1894 | getEventViewerDialog()->setGeometry(x,y,w,h); | 2050 | getEventViewerDialog()->setGeometry(x,y,w,h); |
1895 | } | 2051 | } |
1896 | #endif | 2052 | #endif |
1897 | config->setGroup( "Views" ); | 2053 | config->setGroup( "Views" ); |
1898 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 2054 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
1899 | 2055 | ||
1900 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); | 2056 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); |
1901 | 2057 | ||
1902 | int resetval = 0; | 2058 | int resetval = 0; |
1903 | int maxVal = 0; | 2059 | int maxVal = 0; |
1904 | if (sizes.count() != 3) { | 2060 | if (sizes.count() != 3) { |
1905 | if ( KOPrefs::instance()->mVerticalScreen ) { | 2061 | if ( KOPrefs::instance()->mVerticalScreen ) { |
1906 | resetval = mDateNavigator->sizeHint().width()+2; | 2062 | resetval = mDateNavigator->sizeHint().width()+2; |
1907 | } else { | 2063 | } else { |
1908 | resetval = mDateNavigator->sizeHint().height()+2; | 2064 | resetval = mDateNavigator->sizeHint().height()+2; |
1909 | } | 2065 | } |
1910 | } | 2066 | } |
1911 | if ( resetval ) { | 2067 | if ( resetval ) { |
1912 | sizes.clear(); | 2068 | sizes.clear(); |
1913 | if ( KOPrefs::instance()->mVerticalScreen ) { | 2069 | if ( KOPrefs::instance()->mVerticalScreen ) { |
1914 | maxVal = QApplication::desktop()->width() -10; | 2070 | maxVal = QApplication::desktop()->width() -10; |
1915 | } else { | 2071 | } else { |
1916 | maxVal = QApplication::desktop()->height()-10; | 2072 | maxVal = QApplication::desktop()->height()-10; |
1917 | } | 2073 | } |
1918 | sizes << resetval; | 2074 | sizes << resetval; |
1919 | if ( maxVal < resetval + resetval) | 2075 | if ( maxVal < resetval + resetval) |
1920 | resetval = maxVal - resetval; | 2076 | resetval = maxVal - resetval; |
1921 | sizes << resetval; | 2077 | sizes << resetval; |
1922 | sizes << 100; | 2078 | sizes << 100; |
1923 | } | 2079 | } |
1924 | mLeftFrame->setSizes(sizes); | 2080 | mLeftFrame->setSizes(sizes); |
1925 | sizes = config->readIntListEntry("Main Splitter Frame"); | 2081 | sizes = config->readIntListEntry("Main Splitter Frame"); |
1926 | resetval = 0; | 2082 | resetval = 0; |
1927 | maxVal = 0; | 2083 | maxVal = 0; |
1928 | if (sizes.count() != 2) { | 2084 | if (sizes.count() != 2) { |
1929 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 2085 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
1930 | resetval = mDateNavigator->sizeHint().width()+2; | 2086 | resetval = mDateNavigator->sizeHint().width()+2; |
1931 | } else { | 2087 | } else { |
1932 | resetval = mDateNavigator->sizeHint().height()+2; | 2088 | resetval = mDateNavigator->sizeHint().height()+2; |
1933 | } | 2089 | } |
1934 | } | 2090 | } |
1935 | if ( resetval ) { | 2091 | if ( resetval ) { |
1936 | sizes.clear(); | 2092 | sizes.clear(); |
1937 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 2093 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
1938 | maxVal = QApplication::desktop()->width() -10; | 2094 | maxVal = QApplication::desktop()->width() -10; |
1939 | } else { | 2095 | } else { |
1940 | maxVal = QApplication::desktop()->height()-10; | 2096 | maxVal = QApplication::desktop()->height()-10; |
1941 | } | 2097 | } |
1942 | sizes << resetval; | 2098 | sizes << resetval; |
1943 | if ( maxVal < resetval + resetval) | 2099 | if ( maxVal < resetval + resetval) |
1944 | resetval = maxVal - resetval; | 2100 | resetval = maxVal - resetval; |
1945 | sizes << resetval; | 2101 | sizes << resetval; |
1946 | } | 2102 | } |
1947 | mMainFrame->setSizes(sizes); | 2103 | mMainFrame->setSizes(sizes); |
1948 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 2104 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
1949 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 2105 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
1950 | else mNavigator->selectDates( dateCount ); | 2106 | else mNavigator->selectDates( dateCount ); |
1951 | // mViewManager->readSettings( config ); | 2107 | // mViewManager->readSettings( config ); |
1952 | updateConfig(); | 2108 | updateConfig(); |
1953 | globalFlagBlockAgenda = 2; | 2109 | globalFlagBlockAgenda = 2; |
1954 | mViewManager->readSettings( config ); | 2110 | mViewManager->readSettings( config ); |
1955 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); | 2111 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); |
1956 | } | 2112 | } |
1957 | 2113 | ||
1958 | 2114 | ||
1959 | void CalendarView::writeSettings() | 2115 | void CalendarView::writeSettings() |
1960 | { | 2116 | { |
1961 | // kdDebug() << "CalendarView::writeSettings" << endl; | 2117 | // kdDebug() << "CalendarView::writeSettings" << endl; |
1962 | 2118 | ||
1963 | KConfig *config = KOGlobals::config(); | 2119 | KConfig *config = KOGlobals::config(); |
1964 | 2120 | ||
1965 | mViewManager->writeSettings( config ); | 2121 | mViewManager->writeSettings( config ); |
1966 | mTodoList->saveLayout(config,QString("Todo Layout")); | 2122 | mTodoList->saveLayout(config,QString("Todo Layout")); |
1967 | mDialogManager->writeSettings( config ); | 2123 | mDialogManager->writeSettings( config ); |
1968 | //KOPrefs::instance()->usrWriteConfig(); | 2124 | //KOPrefs::instance()->usrWriteConfig(); |
1969 | KOPrefs::instance()->writeConfig(); | 2125 | KOPrefs::instance()->writeConfig(); |
1970 | 2126 | ||
1971 | writeFilterSettings(config); | 2127 | writeFilterSettings(config); |
1972 | 2128 | config->setGroup( "AppRun" ); | |
2129 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | ||
2130 | config->writeEntry( "LatestProgramStop", dt.secsTo( QDateTime::currentDateTime() ) ); | ||
1973 | config->setGroup( "Views" ); | 2131 | config->setGroup( "Views" ); |
1974 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 2132 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
1975 | 2133 | ||
1976 | QValueList<int> listINT = mLeftFrame->sizes(); | 2134 | QValueList<int> listINT = mLeftFrame->sizes(); |
1977 | config->writeEntry("Left Splitter Frame",listINT); | 2135 | config->writeEntry("Left Splitter Frame",listINT); |
1978 | QValueList<int> listINT2 = mMainFrame->sizes(); | 2136 | QValueList<int> listINT2 = mMainFrame->sizes(); |
1979 | config->writeEntry("Main Splitter Frame",listINT2); | 2137 | config->writeEntry("Main Splitter Frame",listINT2); |
1980 | #ifdef DESKTOP_VERSION | 2138 | #ifdef DESKTOP_VERSION |
1981 | config->setGroup("WidgetLayout"); | 2139 | config->setGroup("WidgetLayout"); |
1982 | QStringList list ;//= config->readListEntry("MainLayout"); | 2140 | QStringList list ;//= config->readListEntry("MainLayout"); |
1983 | int x,y,w,h; | 2141 | int x,y,w,h; |
1984 | QWidget* wid; | 2142 | QWidget* wid; |
1985 | wid = topLevelWidget(); | 2143 | wid = topLevelWidget(); |
1986 | x = wid->geometry().x(); | 2144 | x = wid->geometry().x(); |
1987 | y = wid->geometry().y(); | 2145 | y = wid->geometry().y(); |
1988 | w = wid->width(); | 2146 | w = wid->width(); |
1989 | h = wid->height(); | 2147 | h = wid->height(); |
1990 | list.clear(); | 2148 | list.clear(); |
1991 | list << QString::number( x ); | 2149 | list << QString::number( x ); |
1992 | list << QString::number( y ); | 2150 | list << QString::number( y ); |
1993 | list << QString::number( w ); | 2151 | list << QString::number( w ); |
1994 | list << QString::number( h ); | 2152 | list << QString::number( h ); |
1995 | config->writeEntry("MainLayout",list ); | 2153 | config->writeEntry("MainLayout",list ); |
1996 | 2154 | ||
1997 | wid = mEventEditor; | 2155 | wid = mEventEditor; |
1998 | x = wid->geometry().x(); | 2156 | x = wid->geometry().x(); |
1999 | y = wid->geometry().y(); | 2157 | y = wid->geometry().y(); |
2000 | w = wid->width(); | 2158 | w = wid->width(); |
2001 | h = wid->height(); | 2159 | h = wid->height(); |
2002 | list.clear(); | 2160 | list.clear(); |
2003 | list << QString::number( x ); | 2161 | list << QString::number( x ); |
2004 | list << QString::number( y ); | 2162 | list << QString::number( y ); |
2005 | list << QString::number( w ); | 2163 | list << QString::number( w ); |
2006 | list << QString::number( h ); | 2164 | list << QString::number( h ); |
2007 | config->writeEntry("EditEventLayout",list ); | 2165 | config->writeEntry("EditEventLayout",list ); |
2008 | 2166 | ||
2009 | wid = mTodoEditor; | 2167 | wid = mTodoEditor; |
2010 | x = wid->geometry().x(); | 2168 | x = wid->geometry().x(); |
2011 | y = wid->geometry().y(); | 2169 | y = wid->geometry().y(); |
2012 | w = wid->width(); | 2170 | w = wid->width(); |
2013 | h = wid->height(); | 2171 | h = wid->height(); |
2014 | list.clear(); | 2172 | list.clear(); |
2015 | list << QString::number( x ); | 2173 | list << QString::number( x ); |
2016 | list << QString::number( y ); | 2174 | list << QString::number( y ); |
2017 | list << QString::number( w ); | 2175 | list << QString::number( w ); |
2018 | list << QString::number( h ); | 2176 | list << QString::number( h ); |
2019 | config->writeEntry("EditTodoLayout",list ); | 2177 | config->writeEntry("EditTodoLayout",list ); |
2020 | wid = getEventViewerDialog(); | 2178 | wid = getEventViewerDialog(); |
2021 | x = wid->geometry().x(); | 2179 | x = wid->geometry().x(); |
2022 | y = wid->geometry().y(); | 2180 | y = wid->geometry().y(); |
2023 | w = wid->width(); | 2181 | w = wid->width(); |
2024 | h = wid->height(); | 2182 | h = wid->height(); |
2025 | list.clear(); | 2183 | list.clear(); |
2026 | list << QString::number( x ); | 2184 | list << QString::number( x ); |
2027 | list << QString::number( y ); | 2185 | list << QString::number( y ); |
2028 | list << QString::number( w ); | 2186 | list << QString::number( w ); |
2029 | list << QString::number( h ); | 2187 | list << QString::number( h ); |
2030 | config->writeEntry("ViewerLayout",list ); | 2188 | config->writeEntry("ViewerLayout",list ); |
2031 | wid = mDialogManager->getSearchDialog(); | 2189 | wid = mDialogManager->getSearchDialog(); |
2032 | if ( wid ) { | 2190 | if ( wid ) { |
2033 | x = wid->geometry().x(); | 2191 | x = wid->geometry().x(); |
2034 | y = wid->geometry().y(); | 2192 | y = wid->geometry().y(); |
2035 | w = wid->width(); | 2193 | w = wid->width(); |
2036 | h = wid->height(); | 2194 | h = wid->height(); |
2037 | list.clear(); | 2195 | list.clear(); |
2038 | list << QString::number( x ); | 2196 | list << QString::number( x ); |
2039 | list << QString::number( y ); | 2197 | list << QString::number( y ); |
2040 | list << QString::number( w ); | 2198 | list << QString::number( w ); |
2041 | list << QString::number( h ); | 2199 | list << QString::number( h ); |
2042 | config->writeEntry("SearchLayout",list ); | 2200 | config->writeEntry("SearchLayout",list ); |
2043 | } | 2201 | } |
2044 | #endif | 2202 | #endif |
2045 | 2203 | ||
2046 | 2204 | ||
2047 | config->sync(); | 2205 | config->sync(); |
2048 | } | 2206 | } |
2049 | 2207 | ||
2050 | void CalendarView::readFilterSettings(KConfig *config) | 2208 | void CalendarView::readFilterSettings(KConfig *config) |
2051 | { | 2209 | { |
2052 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 2210 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
2053 | 2211 | ||
2054 | mFilters.clear(); | 2212 | mFilters.clear(); |
2055 | 2213 | ||
2056 | config->setGroup("General"); | 2214 | config->setGroup("General"); |
2057 | QStringList filterList = config->readListEntry("CalendarFilters"); | 2215 | QStringList filterList = config->readListEntry("CalendarFilters"); |
2058 | 2216 | ||
2059 | QStringList::ConstIterator it = filterList.begin(); | 2217 | QStringList::ConstIterator it = filterList.begin(); |
2060 | QStringList::ConstIterator end = filterList.end(); | 2218 | QStringList::ConstIterator end = filterList.end(); |
2061 | while(it != end) { | 2219 | while(it != end) { |
2062 | // kdDebug() << " filter: " << (*it) << endl; | 2220 | // kdDebug() << " filter: " << (*it) << endl; |
2063 | 2221 | ||
2064 | CalFilter *filter; | 2222 | CalFilter *filter; |
2065 | filter = new CalFilter(*it); | 2223 | filter = new CalFilter(*it); |
2066 | config->setGroup("Filter_" + (*it).utf8()); | 2224 | config->setGroup("Filter_" + (*it).utf8()); |
2067 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 2225 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
2068 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 2226 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
2069 | filter->setCategoryList(config->readListEntry("CategoryList")); | 2227 | filter->setCategoryList(config->readListEntry("CategoryList")); |
2070 | mFilters.append(filter); | 2228 | mFilters.append(filter); |
2071 | 2229 | ||
2072 | ++it; | 2230 | ++it; |
2073 | } | 2231 | } |
2074 | 2232 | ||
2075 | if (mFilters.count() == 0) { | 2233 | if (mFilters.count() == 0) { |
2076 | CalFilter *filter = new CalFilter(i18n("Default")); | 2234 | CalFilter *filter = new CalFilter(i18n("Default")); |
2077 | mFilters.append(filter); | 2235 | mFilters.append(filter); |
2078 | } | 2236 | } |
2079 | mFilterView->updateFilters(); | 2237 | mFilterView->updateFilters(); |
2080 | config->setGroup("FilterView"); | 2238 | config->setGroup("FilterView"); |
2081 | 2239 | ||
2082 | mFilterView->blockSignals(true); | 2240 | mFilterView->blockSignals(true); |
2083 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 2241 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
2084 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 2242 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
2085 | mFilterView->blockSignals(false); | 2243 | mFilterView->blockSignals(false); |
2086 | // We do it manually to avoid it being done twice by the above calls | 2244 | // We do it manually to avoid it being done twice by the above calls |
2087 | updateFilter(); | 2245 | updateFilter(); |
2088 | } | 2246 | } |
2089 | 2247 | ||
2090 | void CalendarView::writeFilterSettings(KConfig *config) | 2248 | void CalendarView::writeFilterSettings(KConfig *config) |
2091 | { | 2249 | { |
2092 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 2250 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
2093 | 2251 | ||
2094 | QStringList filterList; | 2252 | QStringList filterList; |
2095 | 2253 | ||
2096 | CalFilter *filter = mFilters.first(); | 2254 | CalFilter *filter = mFilters.first(); |
2097 | while(filter) { | 2255 | while(filter) { |
2098 | // kdDebug() << " fn: " << filter->name() << endl; | 2256 | // kdDebug() << " fn: " << filter->name() << endl; |
2099 | filterList << filter->name(); | 2257 | filterList << filter->name(); |
2100 | config->setGroup("Filter_" + filter->name().utf8()); | 2258 | config->setGroup("Filter_" + filter->name().utf8()); |
@@ -3796,257 +3954,262 @@ QWidgetStack *CalendarView::viewStack() | |||
3796 | { | 3954 | { |
3797 | return mRightFrame; | 3955 | return mRightFrame; |
3798 | } | 3956 | } |
3799 | 3957 | ||
3800 | QWidget *CalendarView::leftFrame() | 3958 | QWidget *CalendarView::leftFrame() |
3801 | { | 3959 | { |
3802 | return ( QWidget *)mLeftFrame; | 3960 | return ( QWidget *)mLeftFrame; |
3803 | } | 3961 | } |
3804 | 3962 | ||
3805 | DateNavigator *CalendarView::dateNavigator() | 3963 | DateNavigator *CalendarView::dateNavigator() |
3806 | { | 3964 | { |
3807 | return mNavigator; | 3965 | return mNavigator; |
3808 | } | 3966 | } |
3809 | 3967 | ||
3810 | KDateNavigator* CalendarView::dateNavigatorWidget() | 3968 | KDateNavigator* CalendarView::dateNavigatorWidget() |
3811 | { | 3969 | { |
3812 | return mDateNavigator->navigatorView(); | 3970 | return mDateNavigator->navigatorView(); |
3813 | } | 3971 | } |
3814 | void CalendarView::toggleDateNavigatorWidget() | 3972 | void CalendarView::toggleDateNavigatorWidget() |
3815 | { | 3973 | { |
3816 | KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; | 3974 | KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; |
3817 | 3975 | ||
3818 | if (!KOPrefs::instance()->mShowDateNavigator ) | 3976 | if (!KOPrefs::instance()->mShowDateNavigator ) |
3819 | mDateNavigator->hide(); | 3977 | mDateNavigator->hide(); |
3820 | else | 3978 | else |
3821 | mDateNavigator->show(); | 3979 | mDateNavigator->show(); |
3822 | } | 3980 | } |
3823 | void CalendarView::addView(KOrg::BaseView *view) | 3981 | void CalendarView::addView(KOrg::BaseView *view) |
3824 | { | 3982 | { |
3825 | mViewManager->addView(view); | 3983 | mViewManager->addView(view); |
3826 | } | 3984 | } |
3827 | 3985 | ||
3828 | void CalendarView::showView(KOrg::BaseView *view) | 3986 | void CalendarView::showView(KOrg::BaseView *view) |
3829 | { | 3987 | { |
3830 | mViewManager->showView(view, mLeftFrame->isVisible()); | 3988 | mViewManager->showView(view, mLeftFrame->isVisible()); |
3831 | } | 3989 | } |
3832 | 3990 | ||
3833 | Incidence *CalendarView::currentSelection() | 3991 | Incidence *CalendarView::currentSelection() |
3834 | { | 3992 | { |
3835 | return mViewManager->currentSelection(); | 3993 | return mViewManager->currentSelection(); |
3836 | } | 3994 | } |
3837 | void CalendarView::toggleAllDaySize() | 3995 | void CalendarView::toggleAllDaySize() |
3838 | { | 3996 | { |
3839 | /* | 3997 | /* |
3840 | if ( KOPrefs::instance()->mAllDaySize > 47 ) | 3998 | if ( KOPrefs::instance()->mAllDaySize > 47 ) |
3841 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; | 3999 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; |
3842 | else | 4000 | else |
3843 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; | 4001 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; |
3844 | */ | 4002 | */ |
3845 | viewManager()->agendaView()->toggleAllDay(); | 4003 | viewManager()->agendaView()->toggleAllDay(); |
3846 | } | 4004 | } |
3847 | void CalendarView::toggleExpand() | 4005 | void CalendarView::toggleExpand() |
3848 | { | 4006 | { |
3849 | // if ( mLeftFrame->isHidden() ) { | 4007 | // if ( mLeftFrame->isHidden() ) { |
3850 | // mLeftFrame->show(); | 4008 | // mLeftFrame->show(); |
3851 | // emit calendarViewExpanded( false ); | 4009 | // emit calendarViewExpanded( false ); |
3852 | // } else { | 4010 | // } else { |
3853 | // mLeftFrame->hide(); | 4011 | // mLeftFrame->hide(); |
3854 | // emit calendarViewExpanded( true ); | 4012 | // emit calendarViewExpanded( true ); |
3855 | // } | 4013 | // } |
3856 | //qDebug(" CalendarView::toggleExpand()"); | 4014 | //qDebug(" CalendarView::toggleExpand()"); |
3857 | globalFlagBlockAgenda = 1; | 4015 | globalFlagBlockAgenda = 1; |
3858 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); | 4016 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); |
3859 | globalFlagBlockAgenda = 5; | 4017 | globalFlagBlockAgenda = 5; |
3860 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); | 4018 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); |
3861 | //mViewManager->showView( 0, true ); | 4019 | //mViewManager->showView( 0, true ); |
3862 | } | 4020 | } |
3863 | 4021 | ||
3864 | void CalendarView::calendarModified( bool modified, Calendar * ) | 4022 | void CalendarView::calendarModified( bool modified, Calendar * ) |
3865 | { | 4023 | { |
3866 | setModified( modified ); | 4024 | setModified( modified ); |
3867 | } | 4025 | } |
3868 | 4026 | ||
3869 | Todo *CalendarView::selectedTodo() | 4027 | Todo *CalendarView::selectedTodo() |
3870 | { | 4028 | { |
3871 | Incidence *incidence = currentSelection(); | 4029 | Incidence *incidence = currentSelection(); |
3872 | if ( incidence && incidence->type() == "Todo" ) { | 4030 | if ( incidence && incidence->type() == "Todo" ) { |
3873 | return static_cast<Todo *>( incidence ); | 4031 | return static_cast<Todo *>( incidence ); |
3874 | } | 4032 | } |
3875 | 4033 | ||
3876 | incidence = mTodoList->selectedIncidences().first(); | 4034 | incidence = mTodoList->selectedIncidences().first(); |
3877 | if ( incidence && incidence->type() == "Todo" ) { | 4035 | if ( incidence && incidence->type() == "Todo" ) { |
3878 | return static_cast<Todo *>( incidence ); | 4036 | return static_cast<Todo *>( incidence ); |
3879 | } | 4037 | } |
3880 | 4038 | ||
3881 | return 0; | 4039 | return 0; |
3882 | } | 4040 | } |
3883 | 4041 | ||
3884 | void CalendarView::dialogClosing(Incidence *in) | 4042 | void CalendarView::dialogClosing(Incidence *in) |
3885 | { | 4043 | { |
3886 | // mDialogList.remove(in); | 4044 | // mDialogList.remove(in); |
3887 | } | 4045 | } |
3888 | 4046 | ||
3889 | void CalendarView::showIncidence() | 4047 | void CalendarView::showIncidence() |
3890 | { | 4048 | { |
3891 | mViewerCallerIsSearchDialog = false; | 4049 | mViewerCallerIsSearchDialog = false; |
3892 | Incidence *incidence = currentSelection(); | 4050 | Incidence *incidence = currentSelection(); |
3893 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 4051 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3894 | if ( incidence ) { | 4052 | if ( incidence ) { |
3895 | ShowIncidenceVisitor v; | 4053 | ShowIncidenceVisitor v; |
3896 | v.act( incidence, this ); | 4054 | v.act( incidence, this ); |
3897 | } | 4055 | } |
3898 | } | 4056 | } |
3899 | void CalendarView::editIncidenceDescription() | 4057 | void CalendarView::editIncidenceDescription() |
3900 | { | 4058 | { |
3901 | mFlagEditDescription = true; | 4059 | mFlagEditDescription = true; |
3902 | editIncidence(); | 4060 | editIncidence(); |
3903 | mFlagEditDescription = false; | 4061 | mFlagEditDescription = false; |
3904 | } | 4062 | } |
3905 | void CalendarView::editIncidence() | 4063 | void CalendarView::editIncidence() |
3906 | { | 4064 | { |
3907 | // qDebug("editIncidence() "); | 4065 | // qDebug("editIncidence() "); |
3908 | Incidence *incidence = currentSelection(); | 4066 | Incidence *incidence = currentSelection(); |
3909 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 4067 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3910 | if ( incidence ) { | 4068 | if ( incidence ) { |
3911 | EditIncidenceVisitor v; | 4069 | EditIncidenceVisitor v; |
3912 | v.act( incidence, this ); | 4070 | v.act( incidence, this ); |
3913 | } | 4071 | } |
3914 | } | 4072 | } |
3915 | 4073 | ||
3916 | void CalendarView::deleteIncidence() | 4074 | void CalendarView::deleteIncidence() |
3917 | { | 4075 | { |
3918 | Incidence *incidence = currentSelection(); | 4076 | Incidence *incidence = currentSelection(); |
3919 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 4077 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3920 | if ( incidence ) { | 4078 | if ( incidence ) { |
3921 | deleteIncidence(incidence); | 4079 | deleteIncidence(incidence); |
3922 | } | 4080 | } |
3923 | } | 4081 | } |
3924 | 4082 | void CalendarView::showIncidence(QString uid) | |
4083 | { | ||
4084 | Incidence *inc = mCalendar->incidence( uid ); | ||
4085 | if ( inc ) | ||
4086 | showIncidence( inc ); | ||
4087 | } | ||
3925 | void CalendarView::showIncidence(Incidence *incidence) | 4088 | void CalendarView::showIncidence(Incidence *incidence) |
3926 | { | 4089 | { |
3927 | mViewerCallerIsSearchDialog = false; | 4090 | mViewerCallerIsSearchDialog = false; |
3928 | //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); | 4091 | //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); |
3929 | if ( sender() && mDialogManager->getSearchDialog() ) { | 4092 | if ( sender() && mDialogManager->getSearchDialog() ) { |
3930 | if ( sender () == mDialogManager->getSearchDialog()->listview() ) { | 4093 | if ( sender () == mDialogManager->getSearchDialog()->listview() ) { |
3931 | mViewerCallerIsSearchDialog = true; | 4094 | mViewerCallerIsSearchDialog = true; |
3932 | } | 4095 | } |
3933 | } | 4096 | } |
3934 | if ( incidence ) { | 4097 | if ( incidence ) { |
3935 | ShowIncidenceVisitor v; | 4098 | ShowIncidenceVisitor v; |
3936 | v.act( incidence, this ); | 4099 | v.act( incidence, this ); |
3937 | } | 4100 | } |
3938 | } | 4101 | } |
3939 | 4102 | ||
3940 | void CalendarView::editIncidence(Incidence *incidence) | 4103 | void CalendarView::editIncidence(Incidence *incidence) |
3941 | { | 4104 | { |
3942 | if ( incidence ) { | 4105 | if ( incidence ) { |
3943 | 4106 | ||
3944 | EditIncidenceVisitor v; | 4107 | EditIncidenceVisitor v; |
3945 | v.act( incidence, this ); | 4108 | v.act( incidence, this ); |
3946 | 4109 | ||
3947 | } | 4110 | } |
3948 | } | 4111 | } |
3949 | 4112 | ||
3950 | void CalendarView::deleteIncidence(Incidence *incidence) | 4113 | void CalendarView::deleteIncidence(Incidence *incidence) |
3951 | { | 4114 | { |
3952 | //qDebug(" CalendarView::deleteIncidence "); | 4115 | //qDebug(" CalendarView::deleteIncidence "); |
3953 | if ( incidence ) { | 4116 | if ( incidence ) { |
3954 | DeleteIncidenceVisitor v; | 4117 | DeleteIncidenceVisitor v; |
3955 | v.act( incidence, this ); | 4118 | v.act( incidence, this ); |
3956 | } | 4119 | } |
3957 | } | 4120 | } |
3958 | 4121 | ||
3959 | 4122 | ||
3960 | void CalendarView::lookForOutgoingMessages() | 4123 | void CalendarView::lookForOutgoingMessages() |
3961 | { | 4124 | { |
3962 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); | 4125 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); |
3963 | ogd->loadMessages(); | 4126 | ogd->loadMessages(); |
3964 | } | 4127 | } |
3965 | 4128 | ||
3966 | void CalendarView::lookForIncomingMessages() | 4129 | void CalendarView::lookForIncomingMessages() |
3967 | { | 4130 | { |
3968 | IncomingDialog *icd = mDialogManager->incomingDialog(); | 4131 | IncomingDialog *icd = mDialogManager->incomingDialog(); |
3969 | icd->retrieve(); | 4132 | icd->retrieve(); |
3970 | } | 4133 | } |
3971 | 4134 | ||
3972 | bool CalendarView::removeCompletedSubTodos( Todo* t ) | 4135 | bool CalendarView::removeCompletedSubTodos( Todo* t ) |
3973 | { | 4136 | { |
3974 | bool deleteTodo = true; | 4137 | bool deleteTodo = true; |
3975 | QPtrList<Incidence> subTodos; | 4138 | QPtrList<Incidence> subTodos; |
3976 | Incidence *aTodo; | 4139 | Incidence *aTodo; |
3977 | subTodos = t->relations(); | 4140 | subTodos = t->relations(); |
3978 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { | 4141 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { |
3979 | if (! removeCompletedSubTodos( (Todo*) aTodo )) | 4142 | if (! removeCompletedSubTodos( (Todo*) aTodo )) |
3980 | deleteTodo = false; | 4143 | deleteTodo = false; |
3981 | } | 4144 | } |
3982 | if ( deleteTodo ) { | 4145 | if ( deleteTodo ) { |
3983 | if ( t->isCompleted() && !t->doesRecur()) { | 4146 | if ( t->isCompleted() && !t->doesRecur()) { |
3984 | checkExternalId( t ); | 4147 | checkExternalId( t ); |
3985 | mCalendar->deleteTodo( t ); | 4148 | mCalendar->deleteTodo( t ); |
3986 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); | 4149 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); |
3987 | } | 4150 | } |
3988 | else | 4151 | else |
3989 | deleteTodo = false; | 4152 | deleteTodo = false; |
3990 | } | 4153 | } |
3991 | return deleteTodo; | 4154 | return deleteTodo; |
3992 | 4155 | ||
3993 | } | 4156 | } |
3994 | void CalendarView::purgeCompleted() | 4157 | void CalendarView::purgeCompleted() |
3995 | { | 4158 | { |
3996 | int result = KMessageBox::warningContinueCancel(this, | 4159 | int result = KMessageBox::warningContinueCancel(this, |
3997 | i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); | 4160 | i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); |
3998 | 4161 | ||
3999 | if (result == KMessageBox::Continue) { | 4162 | if (result == KMessageBox::Continue) { |
4000 | 4163 | ||
4001 | QPtrList<Todo> todoCal; | 4164 | QPtrList<Todo> todoCal; |
4002 | QPtrList<Todo> rootTodos; | 4165 | QPtrList<Todo> rootTodos; |
4003 | //QPtrList<Incidence> rel; | 4166 | //QPtrList<Incidence> rel; |
4004 | Todo *aTodo;//, *rTodo; | 4167 | Todo *aTodo;//, *rTodo; |
4005 | Incidence *rIncidence; | 4168 | Incidence *rIncidence; |
4006 | bool childDelete = false; | 4169 | bool childDelete = false; |
4007 | bool deletedOne = true; | 4170 | bool deletedOne = true; |
4008 | todoCal = calendar()->todos(); | 4171 | todoCal = calendar()->todos(); |
4009 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { | 4172 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { |
4010 | if ( !aTodo->relatedTo() ) | 4173 | if ( !aTodo->relatedTo() ) |
4011 | rootTodos.append( aTodo ); | 4174 | rootTodos.append( aTodo ); |
4012 | } | 4175 | } |
4013 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { | 4176 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { |
4014 | removeCompletedSubTodos( aTodo ); | 4177 | removeCompletedSubTodos( aTodo ); |
4015 | } | 4178 | } |
4016 | 4179 | ||
4017 | updateView(); | 4180 | updateView(); |
4018 | } | 4181 | } |
4019 | } | 4182 | } |
4020 | 4183 | ||
4021 | void CalendarView::slotCalendarChanged() | 4184 | void CalendarView::slotCalendarChanged() |
4022 | { | 4185 | { |
4023 | ; | 4186 | ; |
4024 | } | 4187 | } |
4025 | 4188 | ||
4026 | void CalendarView::keyPressEvent ( QKeyEvent *e) | 4189 | void CalendarView::keyPressEvent ( QKeyEvent *e) |
4027 | { | 4190 | { |
4028 | //qDebug(" alendarView::keyPressEvent "); | 4191 | //qDebug(" alendarView::keyPressEvent "); |
4029 | e->ignore(); | 4192 | e->ignore(); |
4030 | } | 4193 | } |
4031 | 4194 | ||
4032 | 4195 | ||
4033 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) | 4196 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) |
4034 | { | 4197 | { |
4035 | // mSyncManager = manager; | 4198 | // mSyncManager = manager; |
4036 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { | 4199 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { |
4037 | qDebug("KO: SyncKDE request detected!"); | 4200 | qDebug("KO: SyncKDE request detected!"); |
4038 | } | 4201 | } |
4039 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 4202 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
4040 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 4203 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
4041 | return syncCalendar( filename, mode ); | 4204 | return syncCalendar( filename, mode ); |
4042 | } | 4205 | } |
4043 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) | 4206 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) |
4044 | { | 4207 | { |
4045 | //mSyncManager = manager; | 4208 | //mSyncManager = manager; |
4046 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 4209 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
4047 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 4210 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
4048 | if ( resource == "sharp" ) | 4211 | if ( resource == "sharp" ) |
4049 | syncExternal( 0 ); | 4212 | syncExternal( 0 ); |
4050 | if ( resource == "phone" ) | 4213 | if ( resource == "phone" ) |
4051 | syncExternal( 1 ); | 4214 | syncExternal( 1 ); |
4052 | // pending setmodified | 4215 | // pending setmodified |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 05a34b4..1eca905 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -1,370 +1,390 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000, 2001 | 3 | Copyright (c) 2000, 2001 |
4 | Cornelius Schumacher <schumacher@kde.org> | 4 | Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program 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 | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | #ifndef CALENDARVIEW_H | 24 | #ifndef CALENDARVIEW_H |
25 | #define CALENDARVIEW_H | 25 | #define CALENDARVIEW_H |
26 | 26 | ||
27 | #include <qframe.h> | 27 | #include <qframe.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | #include <qptrlist.h> | 30 | #include <qptrlist.h> |
31 | #include <qvbox.h> | 31 | #include <qvbox.h> |
32 | #include <qmap.h> | 32 | #include <qmap.h> |
33 | #ifndef DESKTOP_VERSION | 33 | #ifndef DESKTOP_VERSION |
34 | #include <qtopia/ir.h> | 34 | #include <qtopia/ir.h> |
35 | #else | 35 | #else |
36 | #define Ir char | 36 | #define Ir char |
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendar.h> | 38 | #include <libkcal/calendar.h> |
39 | #include <libkcal/scheduler.h> | 39 | #include <libkcal/scheduler.h> |
40 | #include <libkcal/calendarresources.h> | 40 | #include <libkcal/calendarresources.h> |
41 | #include <libkcal/resourcecalendar.h> | 41 | #include <libkcal/resourcecalendar.h> |
42 | #include <KDGanttMinimizeSplitter.h> | 42 | #include <KDGanttMinimizeSplitter.h> |
43 | 43 | ||
44 | #include <korganizer/calendarviewbase.h> | 44 | #include <korganizer/calendarviewbase.h> |
45 | 45 | ||
46 | #include <ksyncmanager.h> | 46 | #include <ksyncmanager.h> |
47 | 47 | ||
48 | class QWidgetStack; | 48 | class QWidgetStack; |
49 | class QSplitter; | 49 | class QSplitter; |
50 | 50 | ||
51 | class CalPrinter; | 51 | class CalPrinter; |
52 | class KOFilterView; | 52 | class KOFilterView; |
53 | class KOViewManager; | 53 | class KOViewManager; |
54 | class KODialogManager; | 54 | class KODialogManager; |
55 | class KOTodoView; | 55 | class KOTodoView; |
56 | class KDateNavigator; | 56 | class KDateNavigator; |
57 | class DateNavigatorContainer; | 57 | class DateNavigatorContainer; |
58 | class DateNavigator; | 58 | class DateNavigator; |
59 | class KOIncidenceEditor; | 59 | class KOIncidenceEditor; |
60 | class KDatePicker; | 60 | class KDatePicker; |
61 | class ResourceView; | 61 | class ResourceView; |
62 | class KOEventEditor; | 62 | class KOEventEditor; |
63 | class KOTodoEditor ; | 63 | class KOTodoEditor ; |
64 | class KOEventViewerDialog; | 64 | class KOEventViewerDialog; |
65 | class KOBeamPrefs; | 65 | class KOBeamPrefs; |
66 | class KSyncProfile; | 66 | class KSyncProfile; |
67 | class AlarmDialog; | 67 | class AlarmDialog; |
68 | class KCal::Attendee; | 68 | class KCal::Attendee; |
69 | 69 | ||
70 | namespace KCal { class FileStorage; } | 70 | namespace KCal { class FileStorage; } |
71 | 71 | ||
72 | using namespace KCal; | 72 | using namespace KCal; |
73 | 73 | ||
74 | /** | 74 | /** |
75 | This is the main calendar widget. It provides the different vies on t he | 75 | This is the main calendar widget. It provides the different vies on t he |
76 | calendar data as well as the date navigator. It also handles synchronisation | 76 | calendar data as well as the date navigator. It also handles synchronisation |
77 | of the different views and controls the different dialogs like preferences, | 77 | of the different views and controls the different dialogs like preferences, |
78 | event editor, search dialog etc. | 78 | event editor, search dialog etc. |
79 | 79 | ||
80 | @short main calendar view widget | 80 | @short main calendar view widget |
81 | @author Cornelius Schumacher | 81 | @author Cornelius Schumacher |
82 | */ | 82 | */ |
83 | |||
84 | #include <qtextbrowser.h> | ||
85 | #include <qtextcodec.h> | ||
86 | |||
87 | class MissedAlarmTextBrowser : public QTextBrowser { | ||
88 | Q_OBJECT | ||
89 | public: | ||
90 | MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start); | ||
91 | void setSource(const QString & n); | ||
92 | |||
93 | private: | ||
94 | Incidence * getNextInc(QDateTime start ); | ||
95 | QPtrList<Incidence> mAlarms; | ||
96 | signals: | ||
97 | void showIncidence( QString uid); | ||
98 | }; | ||
99 | |||
100 | |||
83 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface | 101 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface |
84 | { | 102 | { |
85 | Q_OBJECT | 103 | Q_OBJECT |
86 | public: | 104 | public: |
87 | /** | 105 | /** |
88 | Constructs a new calendar view widget. | 106 | Constructs a new calendar view widget. |
89 | 107 | ||
90 | @param calendar calendar document | 108 | @param calendar calendar document |
91 | @param parent parent window | 109 | @param parent parent window |
92 | @param name Qt internal widget object name | 110 | @param name Qt internal widget object name |
93 | */ | 111 | */ |
94 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, | 112 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, |
95 | const char *name = 0 ); | 113 | const char *name = 0 ); |
96 | CalendarView( Calendar *calendar, QWidget *parent = 0, | 114 | CalendarView( Calendar *calendar, QWidget *parent = 0, |
97 | const char *name = 0 ); | 115 | const char *name = 0 ); |
98 | virtual ~CalendarView(); | 116 | virtual ~CalendarView(); |
99 | 117 | ||
100 | Calendar *calendar() { return mCalendar; } | 118 | Calendar *calendar() { return mCalendar; } |
101 | 119 | ||
102 | KOViewManager *viewManager(); | 120 | KOViewManager *viewManager(); |
103 | KODialogManager *dialogManager(); | 121 | KODialogManager *dialogManager(); |
104 | 122 | ||
105 | QDate startDate(); | 123 | QDate startDate(); |
106 | QDate endDate(); | 124 | QDate endDate(); |
107 | 125 | ||
108 | QWidgetStack *viewStack(); | 126 | QWidgetStack *viewStack(); |
109 | QWidget *leftFrame(); | 127 | QWidget *leftFrame(); |
110 | 128 | ||
111 | DateNavigator *dateNavigator(); | 129 | DateNavigator *dateNavigator(); |
112 | KDateNavigator *dateNavigatorWidget(); | 130 | KDateNavigator *dateNavigatorWidget(); |
113 | 131 | ||
114 | void addView(KOrg::BaseView *); | 132 | void addView(KOrg::BaseView *); |
115 | void showView(KOrg::BaseView *); | 133 | void showView(KOrg::BaseView *); |
116 | KOEventViewerDialog* getEventViewerDialog(); | 134 | KOEventViewerDialog* getEventViewerDialog(); |
117 | Incidence *currentSelection(); | 135 | Incidence *currentSelection(); |
118 | 136 | ||
119 | signals: | 137 | signals: |
120 | void save (); | 138 | void save (); |
121 | void saveStopTimer (); | 139 | void saveStopTimer (); |
122 | void tempDisableBR(bool); | 140 | void tempDisableBR(bool); |
123 | /** This todo has been modified */ | 141 | /** This todo has been modified */ |
124 | void todoModified(Todo *, int); | 142 | void todoModified(Todo *, int); |
125 | 143 | ||
126 | /** when change is made to options dialog, the topwidget will catch this | 144 | /** when change is made to options dialog, the topwidget will catch this |
127 | * and emit this signal which notifies all widgets which have registered | 145 | * and emit this signal which notifies all widgets which have registered |
128 | * for notification to update their settings. */ | 146 | * for notification to update their settings. */ |
129 | void configChanged(); | 147 | void configChanged(); |
130 | /** emitted when the topwidget is closing down, so that any attached | 148 | /** emitted when the topwidget is closing down, so that any attached |
131 | child windows can also close. */ | 149 | child windows can also close. */ |
132 | void closingDown(); | 150 | void closingDown(); |
133 | /** emitted right before we die */ | 151 | /** emitted right before we die */ |
134 | void closed(QWidget *); | 152 | void closed(QWidget *); |
135 | 153 | ||
136 | /** Emitted when state of modified flag changes */ | 154 | /** Emitted when state of modified flag changes */ |
137 | void modifiedChanged(bool); | 155 | void modifiedChanged(bool); |
138 | void signalmodified(); | 156 | void signalmodified(); |
139 | 157 | ||
140 | /** Emitted when state of read-only flag changes */ | 158 | /** Emitted when state of read-only flag changes */ |
141 | void readOnlyChanged(bool); | 159 | void readOnlyChanged(bool); |
142 | 160 | ||
143 | /** Emitted when the unit of navigation changes */ | 161 | /** Emitted when the unit of navigation changes */ |
144 | void changeNavStringPrev(const QString &); | 162 | void changeNavStringPrev(const QString &); |
145 | void changeNavStringNext(const QString &); | 163 | void changeNavStringNext(const QString &); |
146 | 164 | ||
147 | /** Emitted when state of events selection has changed and user is organizer*/ | 165 | /** Emitted when state of events selection has changed and user is organizer*/ |
148 | void organizerEventsSelected(bool); | 166 | void organizerEventsSelected(bool); |
149 | /** Emitted when state of events selection has changed and user is attendee*/ | 167 | /** Emitted when state of events selection has changed and user is attendee*/ |
150 | void groupEventsSelected(bool); | 168 | void groupEventsSelected(bool); |
151 | /** | 169 | /** |
152 | Emitted when an incidence gets selected. If the selection is cleared the | 170 | Emitted when an incidence gets selected. If the selection is cleared the |
153 | signal is emitted with 0 as argument. | 171 | signal is emitted with 0 as argument. |
154 | */ | 172 | */ |
155 | void incidenceSelected( Incidence * ); | 173 | void incidenceSelected( Incidence * ); |
156 | /** Emitted, when a todoitem is selected or deselected. */ | 174 | /** Emitted, when a todoitem is selected or deselected. */ |
157 | void todoSelected( bool ); | 175 | void todoSelected( bool ); |
158 | 176 | ||
159 | /** | 177 | /** |
160 | Emitted, when clipboard content changes. Parameter indicates if paste | 178 | Emitted, when clipboard content changes. Parameter indicates if paste |
161 | is possible or not. | 179 | is possible or not. |
162 | */ | 180 | */ |
163 | void pasteEnabled(bool); | 181 | void pasteEnabled(bool); |
164 | 182 | ||
165 | /** Emitted, when the number of incoming messages has changed. */ | 183 | /** Emitted, when the number of incoming messages has changed. */ |
166 | void numIncomingChanged(int); | 184 | void numIncomingChanged(int); |
167 | 185 | ||
168 | /** Emitted, when the number of outgoing messages has changed. */ | 186 | /** Emitted, when the number of outgoing messages has changed. */ |
169 | void numOutgoingChanged(int); | 187 | void numOutgoingChanged(int); |
170 | 188 | ||
171 | /** Send status message, which can e.g. be displayed in the status bar. */ | 189 | /** Send status message, which can e.g. be displayed in the status bar. */ |
172 | void statusMessage(const QString &); | 190 | void statusMessage(const QString &); |
173 | 191 | ||
174 | void calendarViewExpanded( bool ); | 192 | void calendarViewExpanded( bool ); |
175 | void updateSearchDialog(); | 193 | void updateSearchDialog(); |
176 | 194 | ||
177 | 195 | ||
178 | public slots: | 196 | public slots: |
197 | void checkAlarms(); | ||
179 | void slotprintSelInc(); | 198 | void slotprintSelInc(); |
180 | void showNextAlarms(); | 199 | void showNextAlarms(); |
181 | void showOpenError(); | 200 | void showOpenError(); |
182 | void watchSavedFile(); | 201 | void watchSavedFile(); |
183 | void recheckTimerAlarm(); | 202 | void recheckTimerAlarm(); |
184 | void checkNextTimerAlarm(); | 203 | void checkNextTimerAlarm(); |
185 | void addAlarm(const QDateTime &qdt, const QString ¬i ); | 204 | void addAlarm(const QDateTime &qdt, const QString ¬i ); |
186 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); | 205 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); |
187 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); | 206 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); |
188 | 207 | ||
189 | /** options dialog made a changed to the configuration. we catch this | 208 | /** options dialog made a changed to the configuration. we catch this |
190 | * and notify all widgets which need to update their configuration. */ | 209 | * and notify all widgets which need to update their configuration. */ |
191 | void updateConfig(); | 210 | void updateConfig(); |
192 | 211 | ||
193 | void insertBirthdays(const QString& uid, const QStringList& birthdayList, | 212 | void insertBirthdays(const QString& uid, const QStringList& birthdayList, |
194 | const QStringList& anniversaryList, const QStringList& realNameList, | 213 | const QStringList& anniversaryList, const QStringList& realNameList, |
195 | const QStringList& emailList, const QStringList& assembledNameList, | 214 | const QStringList& emailList, const QStringList& assembledNameList, |
196 | const QStringList& uidList); | 215 | const QStringList& uidList); |
197 | 216 | ||
198 | /** | 217 | /** |
199 | Load calendar from file \a filename. If \a merge is true, load | 218 | Load calendar from file \a filename. If \a merge is true, load |
200 | calendar into existing one, if it is false, clear calendar, before | 219 | calendar into existing one, if it is false, clear calendar, before |
201 | loading. Return true, if calendar could be successfully loaded. | 220 | loading. Return true, if calendar could be successfully loaded. |
202 | */ | 221 | */ |
203 | bool openCalendar(QString filename, bool merge=false); | 222 | bool openCalendar(QString filename, bool merge=false); |
204 | bool syncCalendar(QString filename,int mode = 0 ); | 223 | bool syncCalendar(QString filename,int mode = 0 ); |
205 | 224 | ||
206 | /** | 225 | /** |
207 | Save calendar data to file. Return true if calendar could be | 226 | Save calendar data to file. Return true if calendar could be |
208 | successfully saved. | 227 | successfully saved. |
209 | */ | 228 | */ |
210 | bool saveCalendar(QString filename); | 229 | bool saveCalendar(QString filename); |
211 | 230 | ||
212 | /** | 231 | /** |
213 | Close calendar. Clear calendar data and reset views to display an empty | 232 | Close calendar. Clear calendar data and reset views to display an empty |
214 | calendar. | 233 | calendar. |
215 | */ | 234 | */ |
216 | void closeCalendar(); | 235 | void closeCalendar(); |
217 | 236 | ||
218 | /** Archive old events of calendar */ | 237 | /** Archive old events of calendar */ |
219 | void archiveCalendar(); | 238 | void archiveCalendar(); |
220 | 239 | ||
221 | void showIncidence(); | 240 | void showIncidence(); |
222 | void editIncidence(); | 241 | void editIncidence(); |
223 | void editIncidenceDescription(); | 242 | void editIncidenceDescription(); |
224 | void deleteIncidence(); | 243 | void deleteIncidence(); |
225 | void cloneIncidence(); | 244 | void cloneIncidence(); |
226 | void moveIncidence(); | 245 | void moveIncidence(); |
227 | void beamIncidence(); | 246 | void beamIncidence(); |
228 | void toggleCancelIncidence(); | 247 | void toggleCancelIncidence(); |
229 | 248 | ||
230 | /** create an editeventwin with supplied date/time, and if bool is true, | 249 | /** create an editeventwin with supplied date/time, and if bool is true, |
231 | * make the event take all day. */ | 250 | * make the event take all day. */ |
232 | void newEvent(QDateTime, QDateTime, bool allDay ); | 251 | void newEvent(QDateTime, QDateTime, bool allDay ); |
233 | void newEvent(QDateTime, QDateTime); | 252 | void newEvent(QDateTime, QDateTime); |
234 | void newEvent(QDateTime fh); | 253 | void newEvent(QDateTime fh); |
235 | void newEvent(QDate dt); | 254 | void newEvent(QDate dt); |
236 | /** create new event without having a date hint. Takes current date as | 255 | /** create new event without having a date hint. Takes current date as |
237 | default hint. */ | 256 | default hint. */ |
238 | void newEvent(); | 257 | void newEvent(); |
239 | void newFloatingEvent(); | 258 | void newFloatingEvent(); |
240 | 259 | ||
241 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ | 260 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ |
242 | void showIncidence(Incidence *); | 261 | void showIncidence(Incidence *); |
262 | void showIncidence(QString uid); | ||
243 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ | 263 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ |
244 | void editIncidence(Incidence *); | 264 | void editIncidence(Incidence *); |
245 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ | 265 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ |
246 | void deleteIncidence(Incidence *); | 266 | void deleteIncidence(Incidence *); |
247 | void cloneIncidence(Incidence *); | 267 | void cloneIncidence(Incidence *); |
248 | void cancelIncidence(Incidence *); | 268 | void cancelIncidence(Incidence *); |
249 | /** Create an editor for the supplied event. */ | 269 | /** Create an editor for the supplied event. */ |
250 | void editEvent(Event *); | 270 | void editEvent(Event *); |
251 | /** Delete the supplied event. */ | 271 | /** Delete the supplied event. */ |
252 | void deleteEvent(Event *); | 272 | void deleteEvent(Event *); |
253 | /** Delete the event with the given unique ID. Returns false, if event wasn't | 273 | /** Delete the event with the given unique ID. Returns false, if event wasn't |
254 | found. */ | 274 | found. */ |
255 | bool deleteEvent(const QString &uid); | 275 | bool deleteEvent(const QString &uid); |
256 | /** Create a read-only viewer dialog for the supplied event. */ | 276 | /** Create a read-only viewer dialog for the supplied event. */ |
257 | void showEvent(Event *); | 277 | void showEvent(Event *); |
258 | 278 | ||
259 | void editJournal(Journal *); | 279 | void editJournal(Journal *); |
260 | void showJournal(Journal *); | 280 | void showJournal(Journal *); |
261 | void deleteJournal(Journal *); | 281 | void deleteJournal(Journal *); |
262 | /** Create an editor dialog for a todo */ | 282 | /** Create an editor dialog for a todo */ |
263 | void editTodo(Todo *); | 283 | void editTodo(Todo *); |
264 | /** Create a read-only viewer dialog for the supplied todo */ | 284 | /** Create a read-only viewer dialog for the supplied todo */ |
265 | void showTodo(Todo *); | 285 | void showTodo(Todo *); |
266 | /** create new todo */ | 286 | /** create new todo */ |
267 | void newTodo(); | 287 | void newTodo(); |
268 | void newTodoDateTime(QDateTime, bool allday); | 288 | void newTodoDateTime(QDateTime, bool allday); |
269 | /** create new todo with a parent todo */ | 289 | /** create new todo with a parent todo */ |
270 | void newSubTodo(); | 290 | void newSubTodo(); |
271 | /** create new todo with a parent todo */ | 291 | /** create new todo with a parent todo */ |
272 | void newSubTodo(Todo *); | 292 | void newSubTodo(Todo *); |
273 | /** Delete todo */ | 293 | /** Delete todo */ |
274 | void deleteTodo(Todo *); | 294 | void deleteTodo(Todo *); |
275 | 295 | ||
276 | 296 | ||
277 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is | 297 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is |
278 | * emitted as result. */ | 298 | * emitted as result. */ |
279 | void checkClipboard(); | 299 | void checkClipboard(); |
280 | 300 | ||
281 | /** using the KConfig associated with the kapp variable, read in the | 301 | /** using the KConfig associated with the kapp variable, read in the |
282 | * settings from the config file. | 302 | * settings from the config file. |
283 | */ | 303 | */ |
284 | void readSettings(); | 304 | void readSettings(); |
285 | 305 | ||
286 | /** write current state to config file. */ | 306 | /** write current state to config file. */ |
287 | void writeSettings(); | 307 | void writeSettings(); |
288 | 308 | ||
289 | /** read settings for calendar filters */ | 309 | /** read settings for calendar filters */ |
290 | void readFilterSettings(KConfig *config); | 310 | void readFilterSettings(KConfig *config); |
291 | 311 | ||
292 | /** write settings for calendar filters */ | 312 | /** write settings for calendar filters */ |
293 | void writeFilterSettings(KConfig *config); | 313 | void writeFilterSettings(KConfig *config); |
294 | 314 | ||
295 | /** passes on the message that an event has changed to the currently | 315 | /** passes on the message that an event has changed to the currently |
296 | * activated view so that it can make appropriate display changes. */ | 316 | * activated view so that it can make appropriate display changes. */ |
297 | void changeEventDisplay(Event *, int); | 317 | void changeEventDisplay(Event *, int); |
298 | void changeIncidenceDisplay(Incidence *, int); | 318 | void changeIncidenceDisplay(Incidence *, int); |
299 | void changeTodoDisplay(Todo *, int); | 319 | void changeTodoDisplay(Todo *, int); |
300 | 320 | ||
301 | void eventAdded(Event *); | 321 | void eventAdded(Event *); |
302 | void eventChanged(Event *); | 322 | void eventChanged(Event *); |
303 | void eventToBeDeleted(Event *); | 323 | void eventToBeDeleted(Event *); |
304 | void eventDeleted(); | 324 | void eventDeleted(); |
305 | 325 | ||
306 | void todoAdded(Todo *); | 326 | void todoAdded(Todo *); |
307 | void todoChanged(Todo *); | 327 | void todoChanged(Todo *); |
308 | void todoToBeDeleted(Todo *); | 328 | void todoToBeDeleted(Todo *); |
309 | void todoDeleted(); | 329 | void todoDeleted(); |
310 | 330 | ||
311 | void updateView(const QDate &start, const QDate &end); | 331 | void updateView(const QDate &start, const QDate &end); |
312 | void updateView(); | 332 | void updateView(); |
313 | 333 | ||
314 | /** Full update of visible todo views */ | 334 | /** Full update of visible todo views */ |
315 | void updateTodoViews(); | 335 | void updateTodoViews(); |
316 | 336 | ||
317 | void updateUnmanagedViews(); | 337 | void updateUnmanagedViews(); |
318 | 338 | ||
319 | /** cut the current appointment to the clipboard */ | 339 | /** cut the current appointment to the clipboard */ |
320 | void edit_cut(); | 340 | void edit_cut(); |
321 | 341 | ||
322 | /** copy the current appointment(s) to the clipboard */ | 342 | /** copy the current appointment(s) to the clipboard */ |
323 | void edit_copy(); | 343 | void edit_copy(); |
324 | 344 | ||
325 | /** paste the current vobject(s) in the clipboard buffer into calendar */ | 345 | /** paste the current vobject(s) in the clipboard buffer into calendar */ |
326 | void edit_paste(); | 346 | void edit_paste(); |
327 | 347 | ||
328 | /** edit viewing and configuration options. */ | 348 | /** edit viewing and configuration options. */ |
329 | void edit_options(); | 349 | void edit_options(); |
330 | /** | 350 | /** |
331 | Functions for printing, previewing a print, and setting up printing | 351 | Functions for printing, previewing a print, and setting up printing |
332 | parameters. | 352 | parameters. |
333 | */ | 353 | */ |
334 | void print(); | 354 | void print(); |
335 | void printSetup(); | 355 | void printSetup(); |
336 | void printPreview(); | 356 | void printPreview(); |
337 | 357 | ||
338 | /** Export as iCalendar file */ | 358 | /** Export as iCalendar file */ |
339 | void exportICalendar(); | 359 | void exportICalendar(); |
340 | 360 | ||
341 | /** Export as vCalendar file */ | 361 | /** Export as vCalendar file */ |
342 | bool exportVCalendar( QString fn); | 362 | bool exportVCalendar( QString fn); |
343 | 363 | ||
344 | /** pop up a dialog to show an existing appointment. */ | 364 | /** pop up a dialog to show an existing appointment. */ |
345 | void appointment_show(); | 365 | void appointment_show(); |
346 | /** | 366 | /** |
347 | * pop up an Appointment Dialog to edit an existing appointment.Get | 367 | * pop up an Appointment Dialog to edit an existing appointment.Get |
348 | * information on the appointment from the list of unique IDs that is | 368 | * information on the appointment from the list of unique IDs that is |
349 | * currently in the View, called currIds. | 369 | * currently in the View, called currIds. |
350 | */ | 370 | */ |
351 | void appointment_edit(); | 371 | void appointment_edit(); |
352 | /** | 372 | /** |
353 | * pop up dialog confirming deletion of currently selected event in the | 373 | * pop up dialog confirming deletion of currently selected event in the |
354 | * View. | 374 | * View. |
355 | */ | 375 | */ |
356 | void appointment_delete(); | 376 | void appointment_delete(); |
357 | 377 | ||
358 | /** mails the currently selected event to a particular user as a vCalendar | 378 | /** mails the currently selected event to a particular user as a vCalendar |
359 | attachment. */ | 379 | attachment. */ |
360 | void action_mail(); | 380 | void action_mail(); |
361 | 381 | ||
362 | /* frees a subtodo from it's relation */ | 382 | /* frees a subtodo from it's relation */ |
363 | void todo_unsub( Todo * ); | 383 | void todo_unsub( Todo * ); |
364 | void todo_resub( Todo * parent, Todo * sub ); | 384 | void todo_resub( Todo * parent, Todo * sub ); |
365 | 385 | ||
366 | /** Take ownership of selected event. */ | 386 | /** Take ownership of selected event. */ |
367 | void takeOverEvent(); | 387 | void takeOverEvent(); |
368 | 388 | ||
369 | /** Take ownership of all events in calendar. */ | 389 | /** Take ownership of all events in calendar. */ |
370 | void takeOverCalendar(); | 390 | void takeOverCalendar(); |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 8fe9999..5aaf360 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -352,258 +352,260 @@ void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) | |||
352 | } | 352 | } |
353 | 353 | ||
354 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 354 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
355 | { | 355 | { |
356 | if (!e) return; | 356 | if (!e) return; |
357 | 357 | ||
358 | QPoint vp = contentsToViewport(e->pos()); | 358 | QPoint vp = contentsToViewport(e->pos()); |
359 | 359 | ||
360 | QListViewItem *item = itemAt(vp); | 360 | QListViewItem *item = itemAt(vp); |
361 | 361 | ||
362 | emit double_Clicked(item); | 362 | emit double_Clicked(item); |
363 | if (!item) return; | 363 | if (!item) return; |
364 | 364 | ||
365 | emit doubleClicked(item,vp,0); | 365 | emit doubleClicked(item,vp,0); |
366 | } | 366 | } |
367 | 367 | ||
368 | ///////////////////////////////////////////////////////////////////////////// | 368 | ///////////////////////////////////////////////////////////////////////////// |
369 | 369 | ||
370 | KOQuickTodo::KOQuickTodo(QWidget *parent) : | 370 | KOQuickTodo::KOQuickTodo(QWidget *parent) : |
371 | QLineEdit(parent) | 371 | QLineEdit(parent) |
372 | { | 372 | { |
373 | setText(i18n("Click to add a new Todo")); | 373 | setText(i18n("Click to add a new Todo")); |
374 | } | 374 | } |
375 | 375 | ||
376 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) | 376 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) |
377 | { | 377 | { |
378 | if ( text()==i18n("Click to add a new Todo") ) | 378 | if ( text()==i18n("Click to add a new Todo") ) |
379 | setText(""); | 379 | setText(""); |
380 | QLineEdit::focusInEvent(ev); | 380 | QLineEdit::focusInEvent(ev); |
381 | } | 381 | } |
382 | 382 | ||
383 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) | 383 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) |
384 | { | 384 | { |
385 | setText(i18n("Click to add a new Todo")); | 385 | setText(i18n("Click to add a new Todo")); |
386 | QLineEdit::focusOutEvent(ev); | 386 | QLineEdit::focusOutEvent(ev); |
387 | } | 387 | } |
388 | 388 | ||
389 | ///////////////////////////////////////////////////////////////////////////// | 389 | ///////////////////////////////////////////////////////////////////////////// |
390 | 390 | ||
391 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | 391 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : |
392 | KOrg::BaseView(calendar,parent,name) | 392 | KOrg::BaseView(calendar,parent,name) |
393 | { | 393 | { |
394 | mPendingUpdateBeforeRepaint = false; | 394 | mPendingUpdateBeforeRepaint = false; |
395 | isFlatDisplay = false; | 395 | isFlatDisplay = false; |
396 | mNavigator = 0; | 396 | mNavigator = 0; |
397 | QBoxLayout *topLayout = new QVBoxLayout(this); | 397 | QBoxLayout *topLayout = new QVBoxLayout(this); |
398 | mName = QString ( name ); | 398 | mName = QString ( name ); |
399 | mBlockUpdate = false; | 399 | mBlockUpdate = false; |
400 | mQuickAdd = new KOQuickTodo(this); | 400 | mQuickAdd = new KOQuickTodo(this); |
401 | topLayout->addWidget(mQuickAdd); | 401 | topLayout->addWidget(mQuickAdd); |
402 | 402 | ||
403 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); | 403 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); |
404 | 404 | ||
405 | mTodoListView = new KOTodoListView(calendar,this, name ); | 405 | mTodoListView = new KOTodoListView(calendar,this, name ); |
406 | topLayout->addWidget(mTodoListView); | 406 | topLayout->addWidget(mTodoListView); |
407 | //mTodoListView->header()->setMaximumHeight(30); | 407 | //mTodoListView->header()->setMaximumHeight(30); |
408 | mTodoListView->setRootIsDecorated(true); | 408 | mTodoListView->setRootIsDecorated(true); |
409 | mTodoListView->setAllColumnsShowFocus(true); | 409 | mTodoListView->setAllColumnsShowFocus(true); |
410 | 410 | ||
411 | mTodoListView->setShowSortIndicator(true); | 411 | mTodoListView->setShowSortIndicator(true); |
412 | 412 | ||
413 | mTodoListView->addColumn(i18n("Todo")); | 413 | mTodoListView->addColumn(i18n("Todo")); |
414 | mTodoListView->addColumn(i18n("Prio")); | 414 | mTodoListView->addColumn(i18n("Prio")); |
415 | mTodoListView->setColumnAlignment(1,AlignHCenter); | 415 | mTodoListView->setColumnAlignment(1,AlignHCenter); |
416 | mTodoListView->addColumn(i18n("Complete")); | 416 | mTodoListView->addColumn(i18n("Complete")); |
417 | mTodoListView->setColumnAlignment(2,AlignCenter); | 417 | mTodoListView->setColumnAlignment(2,AlignCenter); |
418 | 418 | ||
419 | mTodoListView->addColumn(i18n("Due Date")); | 419 | mTodoListView->addColumn(i18n("Due Date")); |
420 | mTodoListView->setColumnAlignment(3,AlignLeft); | 420 | mTodoListView->setColumnAlignment(3,AlignLeft); |
421 | mTodoListView->addColumn(i18n("Due Time")); | 421 | mTodoListView->addColumn(i18n("Due Time")); |
422 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 422 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
423 | 423 | ||
424 | mTodoListView->addColumn(i18n("Start Date")); | 424 | mTodoListView->addColumn(i18n("Start Date")); |
425 | mTodoListView->setColumnAlignment(5,AlignLeft); | 425 | mTodoListView->setColumnAlignment(5,AlignLeft); |
426 | mTodoListView->addColumn(i18n("Start Time")); | 426 | mTodoListView->addColumn(i18n("Start Time")); |
427 | mTodoListView->setColumnAlignment(6,AlignHCenter); | 427 | mTodoListView->setColumnAlignment(6,AlignHCenter); |
428 | 428 | ||
429 | mTodoListView->addColumn(i18n("Cancelled")); | 429 | mTodoListView->addColumn(i18n("Cancelled")); |
430 | mTodoListView->addColumn(i18n("Categories")); | 430 | mTodoListView->addColumn(i18n("Categories")); |
431 | #if 0 | 431 | #if 0 |
432 | mTodoListView->addColumn(i18n("Sort Id")); | 432 | mTodoListView->addColumn(i18n("Sort Id")); |
433 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 433 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
434 | #endif | 434 | #endif |
435 | 435 | ||
436 | mTodoListView->setMinimumHeight( 60 ); | 436 | mTodoListView->setMinimumHeight( 60 ); |
437 | mTodoListView->setItemsRenameable( true ); | 437 | mTodoListView->setItemsRenameable( true ); |
438 | mTodoListView->setRenameable( 0 ); | 438 | mTodoListView->setRenameable( 0 ); |
439 | mTodoListView->setColumnWidth( 0, 120 ); | 439 | mTodoListView->setColumnWidth( 0, 120 ); |
440 | mTodoListView->setColumnWidthMode(0, QListView::Manual); | 440 | mTodoListView->setColumnWidthMode(0, QListView::Manual); |
441 | mTodoListView->setColumnWidthMode(1, QListView::Manual); | 441 | mTodoListView->setColumnWidthMode(1, QListView::Manual); |
442 | mTodoListView->setColumnWidthMode(2, QListView::Manual); | 442 | mTodoListView->setColumnWidthMode(2, QListView::Manual); |
443 | mTodoListView->setColumnWidthMode(3, QListView::Manual); | 443 | mTodoListView->setColumnWidthMode(3, QListView::Manual); |
444 | mTodoListView->setColumnWidthMode(4, QListView::Manual); | 444 | mTodoListView->setColumnWidthMode(4, QListView::Manual); |
445 | mTodoListView->setColumnWidthMode(5, QListView::Manual); | 445 | mTodoListView->setColumnWidthMode(5, QListView::Manual); |
446 | mTodoListView->setColumnWidthMode(6, QListView::Manual); | 446 | mTodoListView->setColumnWidthMode(6, QListView::Manual); |
447 | mTodoListView->setColumnWidthMode(7, QListView::Manual); | 447 | mTodoListView->setColumnWidthMode(7, QListView::Manual); |
448 | mTodoListView->setColumnWidthMode(8, QListView::Manual); | 448 | mTodoListView->setColumnWidthMode(8, QListView::Manual); |
449 | 449 | ||
450 | 450 | ||
451 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); | 451 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); |
452 | 452 | ||
453 | mPriorityPopupMenu = new QPopupMenu(this); | 453 | mPriorityPopupMenu = new QPopupMenu(this); |
454 | for (int i = 1; i <= 5; i++) { | 454 | for (int i = 1; i <= 5; i++) { |
455 | QString label = QString ("%1").arg (i); | 455 | QString label = QString ("%1").arg (i); |
456 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; | 456 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; |
457 | } | 457 | } |
458 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); | 458 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); |
459 | 459 | ||
460 | mPercentageCompletedPopupMenu = new QPopupMenu(this); | 460 | mPercentageCompletedPopupMenu = new QPopupMenu(this); |
461 | for (int i = 0; i <= 100; i+=20) { | 461 | for (int i = 0; i <= 100; i+=20) { |
462 | QString label = QString ("%1 %").arg (i); | 462 | QString label = QString ("%1 %").arg (i); |
463 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; | 463 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; |
464 | } | 464 | } |
465 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); | 465 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); |
466 | 466 | ||
467 | 467 | ||
468 | 468 | ||
469 | mItemPopupMenu = new QPopupMenu(this); | 469 | mItemPopupMenu = new QPopupMenu(this); |
470 | mItemPopupMenu->insertItem(i18n("Show..."), this, | 470 | mItemPopupMenu->insertItem(i18n("Show..."), this, |
471 | SLOT (showTodo())); | 471 | SLOT (showTodo())); |
472 | mItemPopupMenu->insertItem(i18n("Edit..."), this, | 472 | mItemPopupMenu->insertItem(i18n("Edit..."), this, |
473 | SLOT (editTodo())); | 473 | SLOT (editTodo())); |
474 | mItemPopupMenu->insertItem( i18n("Delete"), this, | 474 | mItemPopupMenu->insertItem( i18n("Delete"), this, |
475 | SLOT (deleteTodo())); | 475 | SLOT (deleteTodo())); |
476 | mItemPopupMenu->insertItem( i18n("Clone..."), this, | 476 | mItemPopupMenu->insertItem( i18n("Clone..."), this, |
477 | SLOT (cloneTodo())); | 477 | SLOT (cloneTodo())); |
478 | mItemPopupMenu->insertItem( i18n("Move..."), this, | 478 | mItemPopupMenu->insertItem( i18n("Move..."), this, |
479 | SLOT (moveTodo())); | 479 | SLOT (moveTodo())); |
480 | #ifndef DESKTOP_VERSION | ||
480 | mItemPopupMenu->insertItem( i18n("Beam..."), this, | 481 | mItemPopupMenu->insertItem( i18n("Beam..."), this, |
481 | SLOT (beamTodo())); | 482 | SLOT (beamTodo())); |
483 | #endif | ||
482 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, | 484 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, |
483 | SLOT (cancelTodo())); | 485 | SLOT (cancelTodo())); |
484 | mItemPopupMenu->insertSeparator(); | 486 | mItemPopupMenu->insertSeparator(); |
485 | mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, | 487 | mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, |
486 | SLOT (toggleRunningItem())); | 488 | SLOT (toggleRunningItem())); |
487 | mItemPopupMenu->insertSeparator(); | 489 | mItemPopupMenu->insertSeparator(); |
488 | /* | 490 | /* |
489 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, | 491 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, |
490 | SLOT (newTodo())); | 492 | SLOT (newTodo())); |
491 | */ | 493 | */ |
492 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, | 494 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, |
493 | SLOT (newSubTodo())); | 495 | SLOT (newSubTodo())); |
494 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, | 496 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, |
495 | SLOT (unparentTodo()),0,21); | 497 | SLOT (unparentTodo()),0,21); |
496 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, | 498 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, |
497 | SLOT (reparentTodo()),0,22); | 499 | SLOT (reparentTodo()),0,22); |
498 | mItemPopupMenu->insertSeparator(); | 500 | mItemPopupMenu->insertSeparator(); |
499 | #if 0 | 501 | #if 0 |
500 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), | 502 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), |
501 | this, SLOT( purgeCompleted() ) ); | 503 | this, SLOT( purgeCompleted() ) ); |
502 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), | 504 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), |
503 | this, SLOT( toggleCompleted() ),0, 33 ); | 505 | this, SLOT( toggleCompleted() ),0, 33 ); |
504 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 506 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
505 | this, SLOT( toggleQuickTodo() ),0, 34 ); | 507 | this, SLOT( toggleQuickTodo() ),0, 34 ); |
506 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 508 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
507 | this, SLOT( toggleRunning() ),0, 35 ); | 509 | this, SLOT( toggleRunning() ),0, 35 ); |
508 | 510 | ||
509 | #endif | 511 | #endif |
510 | mPopupMenu = new QPopupMenu(this); | 512 | mPopupMenu = new QPopupMenu(this); |
511 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, | 513 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, |
512 | SLOT (newTodo()),0,1); | 514 | SLOT (newTodo()),0,1); |
513 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), | 515 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), |
514 | this, SLOT(purgeCompleted()),0,2); | 516 | this, SLOT(purgeCompleted()),0,2); |
515 | mPopupMenu->insertItem(i18n("Show Completed"), | 517 | mPopupMenu->insertItem(i18n("Show Completed"), |
516 | this, SLOT( toggleCompleted() ),0,3 ); | 518 | this, SLOT( toggleCompleted() ),0,3 ); |
517 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 519 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
518 | this, SLOT( toggleRunning() ),0,5 ); | 520 | this, SLOT( toggleRunning() ),0,5 ); |
519 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), | 521 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), |
520 | this, SLOT( setAllOpen() ),0,6 ); | 522 | this, SLOT( setAllOpen() ),0,6 ); |
521 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), | 523 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), |
522 | this, SLOT( setAllClose() ),0,7 ); | 524 | this, SLOT( setAllClose() ),0,7 ); |
523 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), | 525 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), |
524 | this, SLOT( setAllFlat() ),0,8 ); | 526 | this, SLOT( setAllFlat() ),0,8 ); |
525 | mPopupMenu->insertSeparator(); | 527 | mPopupMenu->insertSeparator(); |
526 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 528 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
527 | this, SLOT( toggleQuickTodo() ),0,4 ); | 529 | this, SLOT( toggleQuickTodo() ),0,4 ); |
528 | mDocPrefs = new DocPrefs( name ); | 530 | mDocPrefs = new DocPrefs( name ); |
529 | 531 | ||
530 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); | 532 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); |
531 | mPopupMenu->setCheckable( true ); | 533 | mPopupMenu->setCheckable( true ); |
532 | mItemPopupMenu->setCheckable( true ); | 534 | mItemPopupMenu->setCheckable( true ); |
533 | 535 | ||
534 | 536 | ||
535 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 537 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
536 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 538 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
537 | 539 | ||
538 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 540 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
539 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 541 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
540 | 542 | ||
541 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 543 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
542 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 544 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
543 | 545 | ||
544 | 546 | ||
545 | // Double clicking conflicts with opening/closing the subtree | 547 | // Double clicking conflicts with opening/closing the subtree |
546 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), | 548 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), |
547 | SLOT( editItem( QListViewItem *) ) ); | 549 | SLOT( editItem( QListViewItem *) ) ); |
548 | /* | 550 | /* |
549 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, | 551 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, |
550 | const QPoint &,int ) ), | 552 | const QPoint &,int ) ), |
551 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 553 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
552 | */ | 554 | */ |
553 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, | 555 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, |
554 | const QPoint &,int ) ), | 556 | const QPoint &,int ) ), |
555 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 557 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
556 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), | 558 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), |
557 | SLOT( itemClicked( QListViewItem * ) ) ); | 559 | SLOT( itemClicked( QListViewItem * ) ) ); |
558 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), | 560 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), |
559 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); | 561 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); |
560 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 562 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
561 | SLOT( updateView() ) ); | 563 | SLOT( updateView() ) ); |
562 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 564 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
563 | SLOT( todoModified(Todo *, int) ) ); | 565 | SLOT( todoModified(Todo *, int) ) ); |
564 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), | 566 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), |
565 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 567 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
566 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), | 568 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), |
567 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 569 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
568 | connect( mTodoListView, SIGNAL( paintNeeded() ), | 570 | connect( mTodoListView, SIGNAL( paintNeeded() ), |
569 | SLOT( paintNeeded()) ); | 571 | SLOT( paintNeeded()) ); |
570 | 572 | ||
571 | #if 0 | 573 | #if 0 |
572 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), | 574 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), |
573 | SLOT(selectionChanged(QListViewItem *))); | 575 | SLOT(selectionChanged(QListViewItem *))); |
574 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), | 576 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), |
575 | SLOT(selectionChanged(QListViewItem *))); | 577 | SLOT(selectionChanged(QListViewItem *))); |
576 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), | 578 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), |
577 | SLOT(selectionChanged(QListViewItem *))); | 579 | SLOT(selectionChanged(QListViewItem *))); |
578 | #endif | 580 | #endif |
579 | 581 | ||
580 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); | 582 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); |
581 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); | 583 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); |
582 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); | 584 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); |
583 | 585 | ||
584 | connect( mTodoListView, SIGNAL(selectionChanged() ), | 586 | connect( mTodoListView, SIGNAL(selectionChanged() ), |
585 | SLOT( processSelectionChange() ) ); | 587 | SLOT( processSelectionChange() ) ); |
586 | connect( mQuickAdd, SIGNAL( returnPressed () ), | 588 | connect( mQuickAdd, SIGNAL( returnPressed () ), |
587 | SLOT( addQuickTodo() ) ); | 589 | SLOT( addQuickTodo() ) ); |
588 | 590 | ||
589 | } | 591 | } |
590 | 592 | ||
591 | KOTodoView::~KOTodoView() | 593 | KOTodoView::~KOTodoView() |
592 | { | 594 | { |
593 | 595 | ||
594 | #if QT_VERSION >= 0x030000 | 596 | #if QT_VERSION >= 0x030000 |
595 | 597 | ||
596 | #else | 598 | #else |
597 | delete mKOTodoViewWhatsThis; | 599 | delete mKOTodoViewWhatsThis; |
598 | #endif | 600 | #endif |
599 | 601 | ||
600 | delete mDocPrefs; | 602 | delete mDocPrefs; |
601 | } | 603 | } |
602 | QString KOTodoView::getWhatsThisText(QPoint p) | 604 | QString KOTodoView::getWhatsThisText(QPoint p) |
603 | { | 605 | { |
604 | KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); | 606 | KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); |
605 | if ( item ) | 607 | if ( item ) |
606 | return KIncidenceFormatter::instance()->getFormattedText( item->todo(), | 608 | return KIncidenceFormatter::instance()->getFormattedText( item->todo(), |
607 | KOPrefs::instance()->mWTshowDetails, | 609 | KOPrefs::instance()->mWTshowDetails, |
608 | KOPrefs::instance()->mWTshowCreated, | 610 | KOPrefs::instance()->mWTshowCreated, |
609 | KOPrefs::instance()->mWTshowChanged); | 611 | KOPrefs::instance()->mWTshowChanged); |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 94d7293..1320231 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -247,256 +247,258 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
247 | addToolBar (navigatorToolBar , tbd ); | 247 | addToolBar (navigatorToolBar , tbd ); |
248 | } | 248 | } |
249 | 249 | ||
250 | 250 | ||
251 | 251 | ||
252 | mCalendarModifiedFlag = false; | 252 | mCalendarModifiedFlag = false; |
253 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 253 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
254 | splash->setAlignment ( AlignCenter ); | 254 | splash->setAlignment ( AlignCenter ); |
255 | setCentralWidget( splash ); | 255 | setCentralWidget( splash ); |
256 | #ifndef DESKTOP_VERSION | 256 | #ifndef DESKTOP_VERSION |
257 | showMaximized(); | 257 | showMaximized(); |
258 | #endif | 258 | #endif |
259 | 259 | ||
260 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 260 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
261 | setDefaultPreferences(); | 261 | setDefaultPreferences(); |
262 | mCalendar = new CalendarLocal(); | 262 | mCalendar = new CalendarLocal(); |
263 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 263 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
264 | mView->hide(); | 264 | mView->hide(); |
265 | //mView->resize(splash->size() ); | 265 | //mView->resize(splash->size() ); |
266 | initActions(); | 266 | initActions(); |
267 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 267 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
268 | mSyncManager->setBlockSave(false); | 268 | mSyncManager->setBlockSave(false); |
269 | mView->setSyncManager(mSyncManager); | 269 | mView->setSyncManager(mSyncManager); |
270 | #ifndef DESKTOP_VERSION | 270 | #ifndef DESKTOP_VERSION |
271 | iconToolBar->show(); | 271 | iconToolBar->show(); |
272 | qApp->processEvents(); | 272 | qApp->processEvents(); |
273 | #endif | 273 | #endif |
274 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 274 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
275 | int vh = height() ; | 275 | int vh = height() ; |
276 | int vw = width(); | 276 | int vw = width(); |
277 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 277 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
278 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 278 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
279 | vh -= iconToolBar->height(); | 279 | vh -= iconToolBar->height(); |
280 | } else { | 280 | } else { |
281 | vw -= iconToolBar->height(); | 281 | vw -= iconToolBar->height(); |
282 | } | 282 | } |
283 | //mView->setMaximumSize( splash->size() ); | 283 | //mView->setMaximumSize( splash->size() ); |
284 | //mView->resize( splash->size() ); | 284 | //mView->resize( splash->size() ); |
285 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 285 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
286 | mView->readSettings(); | 286 | mView->readSettings(); |
287 | bool newFile = false; | 287 | bool newFile = false; |
288 | if( !QFile::exists( defaultFileName() ) ) { | 288 | if( !QFile::exists( defaultFileName() ) ) { |
289 | QFileInfo finfo ( defaultFileName() ); | 289 | QFileInfo finfo ( defaultFileName() ); |
290 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 290 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
291 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 291 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
292 | finfo.setFile( oldFile ); | 292 | finfo.setFile( oldFile ); |
293 | if (finfo.exists() ) { | 293 | if (finfo.exists() ) { |
294 | KMessageBox::information( this, message); | 294 | KMessageBox::information( this, message); |
295 | mView->openCalendar( oldFile ); | 295 | mView->openCalendar( oldFile ); |
296 | qApp->processEvents(); | 296 | qApp->processEvents(); |
297 | } else { | 297 | } else { |
298 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 298 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
299 | finfo.setFile( oldFile ); | 299 | finfo.setFile( oldFile ); |
300 | if (finfo.exists() ) { | 300 | if (finfo.exists() ) { |
301 | KMessageBox::information( this, message); | 301 | KMessageBox::information( this, message); |
302 | mView->openCalendar( oldFile ); | 302 | mView->openCalendar( oldFile ); |
303 | qApp->processEvents(); | 303 | qApp->processEvents(); |
304 | } | 304 | } |
305 | } | 305 | } |
306 | mView->saveCalendar( defaultFileName() ); | 306 | mView->saveCalendar( defaultFileName() ); |
307 | newFile = true; | 307 | newFile = true; |
308 | } | 308 | } |
309 | 309 | ||
310 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 310 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
311 | mView->openCalendar( defaultFileName() ); | 311 | mView->openCalendar( defaultFileName() ); |
312 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 312 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
313 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 313 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
314 | 314 | ||
315 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 315 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
316 | KOPrefs::instance()->setAllDefaults(); | 316 | KOPrefs::instance()->setAllDefaults(); |
317 | int count = mView->addCategories(); | 317 | int count = mView->addCategories(); |
318 | } | 318 | } |
319 | processIncidenceSelection( 0 ); | 319 | processIncidenceSelection( 0 ); |
320 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 320 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
321 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 321 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
322 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 322 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
323 | SLOT( slotModifiedChanged( bool ) ) ); | 323 | SLOT( slotModifiedChanged( bool ) ) ); |
324 | 324 | ||
325 | 325 | ||
326 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 326 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
327 | SLOT( disableBR(bool) ) ); | 327 | SLOT( disableBR(bool) ) ); |
328 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 328 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
329 | mView->setModified( false ); | 329 | mView->setModified( false ); |
330 | mBlockAtStartup = false; | 330 | mBlockAtStartup = false; |
331 | mView->setModified( false ); | 331 | mView->setModified( false ); |
332 | setCentralWidget( mView ); | 332 | setCentralWidget( mView ); |
333 | globalFlagBlockStartup = 0; | 333 | globalFlagBlockStartup = 0; |
334 | mView->show(); | 334 | mView->show(); |
335 | delete splash; | 335 | delete splash; |
336 | if ( newFile ) | 336 | if ( newFile ) |
337 | mView->updateConfig(); | 337 | mView->updateConfig(); |
338 | // qApp->processEvents(); | 338 | // qApp->processEvents(); |
339 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 339 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
340 | //fillSyncMenu(); | 340 | //fillSyncMenu(); |
341 | 341 | ||
342 | 342 | ||
343 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 343 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
344 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 344 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
345 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 345 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
346 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 346 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
347 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 347 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
348 | mSyncManager->setDefaultFileName( sentSyncFile()); | 348 | mSyncManager->setDefaultFileName( sentSyncFile()); |
349 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 349 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
350 | mSyncManager->fillSyncMenu(); | 350 | mSyncManager->fillSyncMenu(); |
351 | 351 | ||
352 | 352 | ||
353 | 353 | ||
354 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 354 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
355 | if ( showWarning ) { | 355 | if ( showWarning ) { |
356 | KMessageBox::information( this, | 356 | KMessageBox::information( this, |
357 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 357 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
358 | qApp->processEvents(); | 358 | qApp->processEvents(); |
359 | mView->dialogManager()->showSyncOptions(); | 359 | mView->dialogManager()->showSyncOptions(); |
360 | } | 360 | } |
361 | 361 | ||
362 | //US listen for result adressed from Ka/Pi | 362 | //US listen for result adressed from Ka/Pi |
363 | #ifndef DESKTOP_VERSION | 363 | #ifndef DESKTOP_VERSION |
364 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 364 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
365 | #endif | 365 | #endif |
366 | #ifndef DESKTOP_VERSION | 366 | #ifndef DESKTOP_VERSION |
367 | infrared = 0; | 367 | infrared = 0; |
368 | #endif | 368 | #endif |
369 | updateFilterToolbar(); | 369 | updateFilterToolbar(); |
370 | updateWeek( mView->startDate() ); | 370 | updateWeek( mView->startDate() ); |
371 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 371 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
372 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 372 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
373 | mBRdisabled = false; | 373 | mBRdisabled = false; |
374 | //toggleBeamReceive(); | 374 | //toggleBeamReceive(); |
375 | |||
376 | QTimer::singleShot( 1000, mView, SLOT ( checkAlarms() )); | ||
375 | } | 377 | } |
376 | MainWindow::~MainWindow() | 378 | MainWindow::~MainWindow() |
377 | { | 379 | { |
378 | //qDebug("MainWindow::~MainWindow() "); | 380 | //qDebug("MainWindow::~MainWindow() "); |
379 | //save toolbar location | 381 | //save toolbar location |
380 | delete mCalendar; | 382 | delete mCalendar; |
381 | delete mSyncManager; | 383 | delete mSyncManager; |
382 | #ifndef DESKTOP_VERSION | 384 | #ifndef DESKTOP_VERSION |
383 | if ( infrared ) | 385 | if ( infrared ) |
384 | delete infrared; | 386 | delete infrared; |
385 | #endif | 387 | #endif |
386 | 388 | ||
387 | 389 | ||
388 | } | 390 | } |
389 | 391 | ||
390 | void MainWindow::disableBR(bool b) | 392 | void MainWindow::disableBR(bool b) |
391 | { | 393 | { |
392 | #ifndef DESKTOP_VERSION | 394 | #ifndef DESKTOP_VERSION |
393 | if ( b ) { | 395 | if ( b ) { |
394 | if ( infrared ) { | 396 | if ( infrared ) { |
395 | toggleBeamReceive(); | 397 | toggleBeamReceive(); |
396 | mBRdisabled = true; | 398 | mBRdisabled = true; |
397 | } | 399 | } |
398 | mBRdisabled = true; | 400 | mBRdisabled = true; |
399 | } else { | 401 | } else { |
400 | if ( mBRdisabled ) { | 402 | if ( mBRdisabled ) { |
401 | mBRdisabled = false; | 403 | mBRdisabled = false; |
402 | //makes no sense,because other cal ap is probably running | 404 | //makes no sense,because other cal ap is probably running |
403 | // toggleBeamReceive(); | 405 | // toggleBeamReceive(); |
404 | } | 406 | } |
405 | } | 407 | } |
406 | #endif | 408 | #endif |
407 | 409 | ||
408 | } | 410 | } |
409 | bool MainWindow::beamReceiveEnabled() | 411 | bool MainWindow::beamReceiveEnabled() |
410 | { | 412 | { |
411 | #ifndef DESKTOP_VERSION | 413 | #ifndef DESKTOP_VERSION |
412 | return ( infrared != 0 ); | 414 | return ( infrared != 0 ); |
413 | #endif | 415 | #endif |
414 | return false; | 416 | return false; |
415 | } | 417 | } |
416 | 418 | ||
417 | void MainWindow::toggleBeamReceive() | 419 | void MainWindow::toggleBeamReceive() |
418 | { | 420 | { |
419 | if ( mBRdisabled ) | 421 | if ( mBRdisabled ) |
420 | return; | 422 | return; |
421 | #ifndef DESKTOP_VERSION | 423 | #ifndef DESKTOP_VERSION |
422 | if ( infrared ) { | 424 | if ( infrared ) { |
423 | qDebug("KO: Disable BeamReceive "); | 425 | qDebug("KO: Disable BeamReceive "); |
424 | delete infrared; | 426 | delete infrared; |
425 | infrared = 0; | 427 | infrared = 0; |
426 | brAction->setOn(false); | 428 | brAction->setOn(false); |
427 | return; | 429 | return; |
428 | } | 430 | } |
429 | qDebug("KO: Enable BeamReceive "); | 431 | qDebug("KO: Enable BeamReceive "); |
430 | brAction->setOn(true); | 432 | brAction->setOn(true); |
431 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 433 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
432 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 434 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
433 | #endif | 435 | #endif |
434 | } | 436 | } |
435 | void MainWindow::showMaximized () | 437 | void MainWindow::showMaximized () |
436 | { | 438 | { |
437 | #ifndef DESKTOP_VERSION | 439 | #ifndef DESKTOP_VERSION |
438 | if ( ! globalFlagBlockStartup ) | 440 | if ( ! globalFlagBlockStartup ) |
439 | if ( mClosed ) | 441 | if ( mClosed ) |
440 | mView->goToday(); | 442 | mView->goToday(); |
441 | #endif | 443 | #endif |
442 | QWidget::showMaximized () ; | 444 | QWidget::showMaximized () ; |
443 | mClosed = false; | 445 | mClosed = false; |
444 | } | 446 | } |
445 | void MainWindow::closeEvent( QCloseEvent* ce ) | 447 | void MainWindow::closeEvent( QCloseEvent* ce ) |
446 | { | 448 | { |
447 | 449 | ||
448 | 450 | ||
449 | 451 | ||
450 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 452 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
451 | saveOnClose(); | 453 | saveOnClose(); |
452 | mClosed = true; | 454 | mClosed = true; |
453 | ce->accept(); | 455 | ce->accept(); |
454 | return; | 456 | return; |
455 | 457 | ||
456 | } | 458 | } |
457 | 459 | ||
458 | switch( QMessageBox::information( this, "KO/Pi", | 460 | switch( QMessageBox::information( this, "KO/Pi", |
459 | i18n("Do you really want\nto close KO/Pi?"), | 461 | i18n("Do you really want\nto close KO/Pi?"), |
460 | i18n("Close"), i18n("No"), | 462 | i18n("Close"), i18n("No"), |
461 | 0, 0 ) ) { | 463 | 0, 0 ) ) { |
462 | case 0: | 464 | case 0: |
463 | saveOnClose(); | 465 | saveOnClose(); |
464 | mClosed = true; | 466 | mClosed = true; |
465 | ce->accept(); | 467 | ce->accept(); |
466 | break; | 468 | break; |
467 | case 1: | 469 | case 1: |
468 | ce->ignore(); | 470 | ce->ignore(); |
469 | break; | 471 | break; |
470 | case 2: | 472 | case 2: |
471 | 473 | ||
472 | default: | 474 | default: |
473 | break; | 475 | break; |
474 | } | 476 | } |
475 | 477 | ||
476 | 478 | ||
477 | } | 479 | } |
478 | 480 | ||
479 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 481 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
480 | { | 482 | { |
481 | QDataStream stream( data, IO_ReadOnly ); | 483 | QDataStream stream( data, IO_ReadOnly ); |
482 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 484 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
483 | //QString datamess; | 485 | //QString datamess; |
484 | //qDebug("message "); | 486 | //qDebug("message "); |
485 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 487 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
486 | 488 | ||
487 | if ( cmsg == "setDocument(QString)" ) { | 489 | if ( cmsg == "setDocument(QString)" ) { |
488 | QDataStream stream( data, IO_ReadOnly ); | 490 | QDataStream stream( data, IO_ReadOnly ); |
489 | QString fileName; | 491 | QString fileName; |
490 | stream >> fileName; | 492 | stream >> fileName; |
491 | //qDebug("filename %s ", fileName.latin1()); | 493 | //qDebug("filename %s ", fileName.latin1()); |
492 | showMaximized(); | 494 | showMaximized(); |
493 | raise(); | 495 | raise(); |
494 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 496 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
495 | mSyncManager->slotSyncMenu( 1002 ); | 497 | mSyncManager->slotSyncMenu( 1002 ); |
496 | return; | 498 | return; |
497 | } | 499 | } |
498 | 500 | ||
499 | if ( cmsg == "-writeFile" ) { | 501 | if ( cmsg == "-writeFile" ) { |
500 | // I made from the "-writeFile" an "-writeAlarm" | 502 | // I made from the "-writeFile" an "-writeAlarm" |
501 | mView->viewManager()->showWhatsNextView(); | 503 | mView->viewManager()->showWhatsNextView(); |
502 | mCalendar->checkAlarmForIncidence( 0, true); | 504 | mCalendar->checkAlarmForIncidence( 0, true); |
@@ -672,256 +674,258 @@ void MainWindow::initActions() | |||
672 | icon = mWeekPixmap; | 674 | icon = mWeekPixmap; |
673 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); | 675 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); |
674 | if ( p-> mShowIconWeekNum ) | 676 | if ( p-> mShowIconWeekNum ) |
675 | mWeekAction->addTo( iconToolBar ); | 677 | mWeekAction->addTo( iconToolBar ); |
676 | mWeekFont = font(); | 678 | mWeekFont = font(); |
677 | 679 | ||
678 | int fontPoint = mWeekFont.pointSize(); | 680 | int fontPoint = mWeekFont.pointSize(); |
679 | QFontMetrics f( mWeekFont ); | 681 | QFontMetrics f( mWeekFont ); |
680 | int fontWid = f.width( "30" ); | 682 | int fontWid = f.width( "30" ); |
681 | while ( fontWid > pixWid ) { | 683 | while ( fontWid > pixWid ) { |
682 | --fontPoint; | 684 | --fontPoint; |
683 | mWeekFont.setPointSize( fontPoint ); | 685 | mWeekFont.setPointSize( fontPoint ); |
684 | QFontMetrics f( mWeekFont ); | 686 | QFontMetrics f( mWeekFont ); |
685 | fontWid = f.width( "30" ); | 687 | fontWid = f.width( "30" ); |
686 | //qDebug("dec-- "); | 688 | //qDebug("dec-- "); |
687 | } | 689 | } |
688 | 690 | ||
689 | connect( mWeekAction, SIGNAL( activated() ), | 691 | connect( mWeekAction, SIGNAL( activated() ), |
690 | this, SLOT( weekAction() ) ); | 692 | this, SLOT( weekAction() ) ); |
691 | 693 | ||
692 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); | 694 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); |
693 | if ( p->mShowIconFilterview ) { | 695 | if ( p->mShowIconFilterview ) { |
694 | icon = loadPixmap( pathString + "filter" ); | 696 | icon = loadPixmap( pathString + "filter" ); |
695 | actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); | 697 | actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); |
696 | connect( actionFilterMenuTB, SIGNAL( activated() ), | 698 | connect( actionFilterMenuTB, SIGNAL( activated() ), |
697 | this, SLOT( fillFilterMenuTB() ) ); | 699 | this, SLOT( fillFilterMenuTB() ) ); |
698 | actionFilterMenuTB->addTo( iconToolBar ); | 700 | actionFilterMenuTB->addTo( iconToolBar ); |
699 | selectFilterMenuTB = new QPopupMenu( this ); | 701 | selectFilterMenuTB = new QPopupMenu( this ); |
700 | selectFilterMenuTB->setCheckable( true ); | 702 | selectFilterMenuTB->setCheckable( true ); |
701 | connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 703 | connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
702 | } | 704 | } |
703 | 705 | ||
704 | //#endif | 706 | //#endif |
705 | // ****************** | 707 | // ****************** |
706 | QAction *action; | 708 | QAction *action; |
707 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 709 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
708 | configureToolBarMenu->setCheckable( true ); | 710 | configureToolBarMenu->setCheckable( true ); |
709 | 711 | ||
710 | 712 | ||
711 | configureAgendaMenu->setCheckable( true ); | 713 | configureAgendaMenu->setCheckable( true ); |
712 | int iii ; | 714 | int iii ; |
713 | for ( iii = 1;iii<= 10 ;++iii ){ | 715 | for ( iii = 1;iii<= 10 ;++iii ){ |
714 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); | 716 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
715 | } | 717 | } |
716 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 718 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
717 | 719 | ||
718 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), | 720 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), |
719 | this, SLOT( showConfigureAgenda( ) ) ); | 721 | this, SLOT( showConfigureAgenda( ) ) ); |
720 | 722 | ||
721 | icon = loadPixmap( pathString + "configure" ); | 723 | icon = loadPixmap( pathString + "configure" ); |
722 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 724 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
723 | action->addTo( actionMenu ); | 725 | action->addTo( actionMenu ); |
724 | connect( action, SIGNAL( activated() ), | 726 | connect( action, SIGNAL( activated() ), |
725 | mView, SLOT( edit_options() ) ); | 727 | mView, SLOT( edit_options() ) ); |
726 | actionMenu->insertSeparator(); | 728 | actionMenu->insertSeparator(); |
727 | 729 | ||
728 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 730 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
729 | action->addTo( actionMenu ); | 731 | action->addTo( actionMenu ); |
730 | connect( action, SIGNAL( activated() ), | 732 | connect( action, SIGNAL( activated() ), |
731 | mView, SLOT( undo_delete() ) ); | 733 | mView, SLOT( undo_delete() ) ); |
732 | actionMenu->insertSeparator(); | 734 | actionMenu->insertSeparator(); |
733 | 735 | ||
734 | icon = loadPixmap( pathString + "newevent" ); | 736 | icon = loadPixmap( pathString + "newevent" ); |
735 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 737 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
736 | configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); | 738 | configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); |
737 | configureToolBarMenu->insertSeparator(); | 739 | configureToolBarMenu->insertSeparator(); |
738 | configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); | 740 | configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); |
739 | configureToolBarMenu->insertSeparator(); | 741 | configureToolBarMenu->insertSeparator(); |
740 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); | 742 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); |
741 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 743 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
742 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 744 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
743 | ne_action->addTo( actionMenu ); | 745 | ne_action->addTo( actionMenu ); |
744 | connect( ne_action, SIGNAL( activated() ), | 746 | connect( ne_action, SIGNAL( activated() ), |
745 | mView, SLOT( newEvent() ) ); | 747 | mView, SLOT( newEvent() ) ); |
746 | icon = loadPixmap( pathString + "newtodo" ); | 748 | icon = loadPixmap( pathString + "newtodo" ); |
747 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 749 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
748 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 750 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
749 | nt_action->addTo( actionMenu ); | 751 | nt_action->addTo( actionMenu ); |
750 | connect( nt_action, SIGNAL( activated() ), | 752 | connect( nt_action, SIGNAL( activated() ), |
751 | mView, SLOT( newTodo() ) ); | 753 | mView, SLOT( newTodo() ) ); |
752 | 754 | ||
753 | icon = loadPixmap( pathString + "today" ); | 755 | icon = loadPixmap( pathString + "today" ); |
754 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 756 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
755 | today_action->addTo( viewMenu ); | 757 | today_action->addTo( viewMenu ); |
756 | connect( today_action, SIGNAL( activated() ), | 758 | connect( today_action, SIGNAL( activated() ), |
757 | mView, SLOT( goToday() ) ); | 759 | mView, SLOT( goToday() ) ); |
758 | viewMenu->insertSeparator(); | 760 | viewMenu->insertSeparator(); |
759 | 761 | ||
760 | // *********************** | 762 | // *********************** |
761 | if ( KOPrefs::instance()->mVerticalScreen ) { | 763 | if ( KOPrefs::instance()->mVerticalScreen ) { |
762 | icon = SmallIcon( "1updownarrow" ); | 764 | icon = SmallIcon( "1updownarrow" ); |
763 | } else { | 765 | } else { |
764 | icon = SmallIcon("1leftrightarrow" ); | 766 | icon = SmallIcon("1leftrightarrow" ); |
765 | } | 767 | } |
766 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); | 768 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); |
767 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); | 769 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); |
768 | FSaction->addTo( viewMenu ); | 770 | FSaction->addTo( viewMenu ); |
769 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); | 771 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); |
770 | 772 | ||
771 | icon = loadPixmap( pathString + "navi" ); | 773 | icon = loadPixmap( pathString + "navi" ); |
772 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); | 774 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); |
773 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 775 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
774 | action->addTo( viewMenu ); | 776 | action->addTo( viewMenu ); |
775 | connect( action, SIGNAL( activated() ), | 777 | connect( action, SIGNAL( activated() ), |
776 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 778 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
777 | mToggleNav = action ; | 779 | mToggleNav = action ; |
778 | icon = loadPixmap( pathString + "filter" ); | 780 | icon = loadPixmap( pathString + "filter" ); |
779 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); | 781 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); |
780 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); | 782 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); |
781 | action->addTo( viewMenu ); | 783 | action->addTo( viewMenu ); |
782 | connect( action, SIGNAL( activated() ), | 784 | connect( action, SIGNAL( activated() ), |
783 | mView, SLOT( toggleFilter() ) ); | 785 | mView, SLOT( toggleFilter() ) ); |
784 | mToggleFilter = action; | 786 | mToggleFilter = action; |
785 | icon = loadPixmap( pathString + "allday" ); | 787 | icon = loadPixmap( pathString + "allday" ); |
786 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); | 788 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); |
787 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); | 789 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); |
788 | action->addTo( viewMenu ); | 790 | action->addTo( viewMenu ); |
789 | connect( action, SIGNAL( activated() ), | 791 | connect( action, SIGNAL( activated() ), |
790 | mView, SLOT( toggleAllDaySize() ) ); | 792 | mView, SLOT( toggleAllDaySize() ) ); |
791 | mToggleAllday = action; | 793 | mToggleAllday = action; |
792 | 794 | ||
793 | 795 | ||
794 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 796 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
795 | mToggleNav, SLOT( setEnabled ( bool ) ) ); | 797 | mToggleNav, SLOT( setEnabled ( bool ) ) ); |
796 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 798 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
797 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); | 799 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); |
798 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 800 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
799 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); | 801 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); |
802 | // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | ||
803 | // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); | ||
800 | 804 | ||
801 | viewMenu->insertSeparator(); | 805 | viewMenu->insertSeparator(); |
802 | icon = loadPixmap( pathString + "picker" ); | 806 | icon = loadPixmap( pathString + "picker" ); |
803 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); | 807 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); |
804 | action->addTo( viewMenu ); | 808 | action->addTo( viewMenu ); |
805 | connect( action, SIGNAL( activated() ), | 809 | connect( action, SIGNAL( activated() ), |
806 | mView, SLOT( showDatePicker() ) ); | 810 | mView, SLOT( showDatePicker() ) ); |
807 | action->addTo( iconToolBar ); | 811 | action->addTo( iconToolBar ); |
808 | viewMenu->insertSeparator(); | 812 | viewMenu->insertSeparator(); |
809 | 813 | ||
810 | if ( p-> mShowIconToggleFull ) | 814 | if ( p-> mShowIconToggleFull ) |
811 | FSaction->addTo( iconToolBar ); | 815 | FSaction->addTo( iconToolBar ); |
812 | if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); | 816 | if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); |
813 | 817 | ||
814 | //******************** | 818 | //******************** |
815 | if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); | 819 | if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); |
816 | 820 | ||
817 | 821 | ||
818 | icon = loadPixmap( pathString + "whatsnext" ); | 822 | icon = loadPixmap( pathString + "whatsnext" ); |
819 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); | 823 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); |
820 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 824 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
821 | whatsnext_action->addTo( viewMenu ); | 825 | whatsnext_action->addTo( viewMenu ); |
822 | connect( whatsnext_action, SIGNAL( activated() ), | 826 | connect( whatsnext_action, SIGNAL( activated() ), |
823 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 827 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
824 | 828 | ||
825 | icon = loadPixmap( pathString + "xdays" ); | 829 | icon = loadPixmap( pathString + "xdays" ); |
826 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); | 830 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); |
827 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 831 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
828 | xdays_action->addTo( viewMenu ); | 832 | xdays_action->addTo( viewMenu ); |
829 | connect( xdays_action, SIGNAL( activated() ), | 833 | connect( xdays_action, SIGNAL( activated() ), |
830 | mView->viewManager(), SLOT( showNextXView() ) ); | 834 | mView->viewManager(), SLOT( showNextXView() ) ); |
831 | 835 | ||
832 | 836 | ||
833 | icon = loadPixmap( pathString + "journal" ); | 837 | icon = loadPixmap( pathString + "journal" ); |
834 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 838 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
835 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 839 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
836 | viewjournal_action->addTo( viewMenu ); | 840 | viewjournal_action->addTo( viewMenu ); |
837 | connect( viewjournal_action, SIGNAL( activated() ), | 841 | connect( viewjournal_action, SIGNAL( activated() ), |
838 | mView->viewManager(), SLOT( showJournalView() ) ); | 842 | mView->viewManager(), SLOT( showJournalView() ) ); |
839 | 843 | ||
840 | 844 | ||
841 | icon = loadPixmap( pathString + "day" ); | 845 | icon = loadPixmap( pathString + "day" ); |
842 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 846 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
843 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 847 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
844 | day1_action->addTo( viewMenu ); | 848 | day1_action->addTo( viewMenu ); |
845 | // action->addTo( toolBar ); | 849 | // action->addTo( toolBar ); |
846 | connect( day1_action, SIGNAL( activated() ), | 850 | connect( day1_action, SIGNAL( activated() ), |
847 | mView->viewManager(), SLOT( showDayView() ) ); | 851 | mView->viewManager(), SLOT( showDayView() ) ); |
848 | 852 | ||
849 | icon = loadPixmap( pathString + "workweek" ); | 853 | icon = loadPixmap( pathString + "workweek" ); |
850 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 854 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
851 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 855 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
852 | day5_action->addTo( viewMenu ); | 856 | day5_action->addTo( viewMenu ); |
853 | connect( day5_action, SIGNAL( activated() ), | 857 | connect( day5_action, SIGNAL( activated() ), |
854 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 858 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
855 | 859 | ||
856 | icon = loadPixmap( pathString + "week" ); | 860 | icon = loadPixmap( pathString + "week" ); |
857 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 861 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
858 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 862 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
859 | day7_action->addTo( viewMenu ); | 863 | day7_action->addTo( viewMenu ); |
860 | connect( day7_action, SIGNAL( activated() ), | 864 | connect( day7_action, SIGNAL( activated() ), |
861 | mView->viewManager(), SLOT( showWeekView() ) ); | 865 | mView->viewManager(), SLOT( showWeekView() ) ); |
862 | 866 | ||
863 | icon = loadPixmap( pathString + "workweek2" ); | 867 | icon = loadPixmap( pathString + "workweek2" ); |
864 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); | 868 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); |
865 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); | 869 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); |
866 | day6_action->addTo( viewMenu ); | 870 | day6_action->addTo( viewMenu ); |
867 | connect( day6_action, SIGNAL( activated() ), | 871 | connect( day6_action, SIGNAL( activated() ), |
868 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); | 872 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); |
869 | 873 | ||
870 | icon = loadPixmap( pathString + "month" ); | 874 | icon = loadPixmap( pathString + "month" ); |
871 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 875 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
872 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 876 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
873 | month_action->addTo( viewMenu ); | 877 | month_action->addTo( viewMenu ); |
874 | connect( month_action, SIGNAL( activated() ), | 878 | connect( month_action, SIGNAL( activated() ), |
875 | mView->viewManager(), SLOT( showMonthView() ) ); | 879 | mView->viewManager(), SLOT( showMonthView() ) ); |
876 | 880 | ||
877 | icon = loadPixmap( pathString + "list" ); | 881 | icon = loadPixmap( pathString + "list" ); |
878 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 882 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
879 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 883 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
880 | showlist_action->addTo( viewMenu ); | 884 | showlist_action->addTo( viewMenu ); |
881 | connect( showlist_action, SIGNAL( activated() ), | 885 | connect( showlist_action, SIGNAL( activated() ), |
882 | mView->viewManager(), SLOT( showListView() ) ); | 886 | mView->viewManager(), SLOT( showListView() ) ); |
883 | 887 | ||
884 | icon = loadPixmap( pathString + "todo" ); | 888 | icon = loadPixmap( pathString + "todo" ); |
885 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 889 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
886 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 890 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
887 | todoview_action->addTo( viewMenu ); | 891 | todoview_action->addTo( viewMenu ); |
888 | connect( todoview_action, SIGNAL( activated() ), | 892 | connect( todoview_action, SIGNAL( activated() ), |
889 | mView->viewManager(), SLOT( showTodoView() ) ); | 893 | mView->viewManager(), SLOT( showTodoView() ) ); |
890 | 894 | ||
891 | 895 | ||
892 | 896 | ||
893 | #if 0 | 897 | #if 0 |
894 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 898 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
895 | action->addTo( viewMenu ); | 899 | action->addTo( viewMenu ); |
896 | connect( action, SIGNAL( activated() ), | 900 | connect( action, SIGNAL( activated() ), |
897 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 901 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
898 | #endif | 902 | #endif |
899 | 903 | ||
900 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 904 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
901 | this ); | 905 | this ); |
902 | mNewSubTodoAction->addTo( actionMenu ); | 906 | mNewSubTodoAction->addTo( actionMenu ); |
903 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 907 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
904 | mView, SLOT( newSubTodo() ) ); | 908 | mView, SLOT( newSubTodo() ) ); |
905 | 909 | ||
906 | actionMenu->insertSeparator(); | 910 | actionMenu->insertSeparator(); |
907 | 911 | ||
908 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); | 912 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); |
909 | mShowAction->addTo( actionMenu ); | 913 | mShowAction->addTo( actionMenu ); |
910 | connect( mShowAction, SIGNAL( activated() ), | 914 | connect( mShowAction, SIGNAL( activated() ), |
911 | mView, SLOT( showIncidence() ) ); | 915 | mView, SLOT( showIncidence() ) ); |
912 | 916 | ||
913 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 917 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
914 | mEditAction->addTo( actionMenu ); | 918 | mEditAction->addTo( actionMenu ); |
915 | connect( mEditAction, SIGNAL( activated() ), | 919 | connect( mEditAction, SIGNAL( activated() ), |
916 | mView, SLOT( editIncidence() ) ); | 920 | mView, SLOT( editIncidence() ) ); |
917 | 921 | ||
918 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 922 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
919 | mDeleteAction->addTo( actionMenu ); | 923 | mDeleteAction->addTo( actionMenu ); |
920 | connect( mDeleteAction, SIGNAL( activated() ), | 924 | connect( mDeleteAction, SIGNAL( activated() ), |
921 | mView, SLOT( deleteIncidence() ) ); | 925 | mView, SLOT( deleteIncidence() ) ); |
922 | 926 | ||
923 | 927 | ||
924 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 928 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
925 | mCloneAction->addTo( actionMenu ); | 929 | mCloneAction->addTo( actionMenu ); |
926 | connect( mCloneAction, SIGNAL( activated() ), | 930 | connect( mCloneAction, SIGNAL( activated() ), |
927 | mView, SLOT( cloneIncidence() ) ); | 931 | mView, SLOT( cloneIncidence() ) ); |
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index e75df70..bc76c0b 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -181,385 +181,385 @@ bool CalendarLocal::addTodoNoDup( Todo *todo ) | |||
181 | { | 181 | { |
182 | Todo * eve; | 182 | Todo * eve; |
183 | for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) { | 183 | for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) { |
184 | if ( *eve == *todo ) { | 184 | if ( *eve == *todo ) { |
185 | //qDebug("duplicate todo found! not inserted! "); | 185 | //qDebug("duplicate todo found! not inserted! "); |
186 | return false; | 186 | return false; |
187 | } | 187 | } |
188 | } | 188 | } |
189 | return addTodo( todo ); | 189 | return addTodo( todo ); |
190 | } | 190 | } |
191 | bool CalendarLocal::addTodo( Todo *todo ) | 191 | bool CalendarLocal::addTodo( Todo *todo ) |
192 | { | 192 | { |
193 | mTodoList.append( todo ); | 193 | mTodoList.append( todo ); |
194 | 194 | ||
195 | todo->registerObserver( this ); | 195 | todo->registerObserver( this ); |
196 | 196 | ||
197 | // Set up subtask relations | 197 | // Set up subtask relations |
198 | setupRelations( todo ); | 198 | setupRelations( todo ); |
199 | 199 | ||
200 | setModified( true ); | 200 | setModified( true ); |
201 | 201 | ||
202 | return true; | 202 | return true; |
203 | } | 203 | } |
204 | 204 | ||
205 | void CalendarLocal::deleteTodo( Todo *todo ) | 205 | void CalendarLocal::deleteTodo( Todo *todo ) |
206 | { | 206 | { |
207 | // Handle orphaned children | 207 | // Handle orphaned children |
208 | if ( mUndoIncidence ) delete mUndoIncidence; | 208 | if ( mUndoIncidence ) delete mUndoIncidence; |
209 | removeRelations( todo ); | 209 | removeRelations( todo ); |
210 | mUndoIncidence = todo->clone(); | 210 | mUndoIncidence = todo->clone(); |
211 | 211 | ||
212 | if ( mTodoList.removeRef( todo ) ) { | 212 | if ( mTodoList.removeRef( todo ) ) { |
213 | setModified( true ); | 213 | setModified( true ); |
214 | } | 214 | } |
215 | } | 215 | } |
216 | 216 | ||
217 | QPtrList<Todo> CalendarLocal::rawTodos() | 217 | QPtrList<Todo> CalendarLocal::rawTodos() |
218 | { | 218 | { |
219 | return mTodoList; | 219 | return mTodoList; |
220 | } | 220 | } |
221 | Todo *CalendarLocal::todo( QString syncProf, QString id ) | 221 | Todo *CalendarLocal::todo( QString syncProf, QString id ) |
222 | { | 222 | { |
223 | Todo *todo; | 223 | Todo *todo; |
224 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 224 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
225 | if ( todo->getID( syncProf ) == id ) return todo; | 225 | if ( todo->getID( syncProf ) == id ) return todo; |
226 | } | 226 | } |
227 | 227 | ||
228 | return 0; | 228 | return 0; |
229 | } | 229 | } |
230 | void CalendarLocal::removeSyncInfo( QString syncProfile) | 230 | void CalendarLocal::removeSyncInfo( QString syncProfile) |
231 | { | 231 | { |
232 | QPtrList<Incidence> all = rawIncidences() ; | 232 | QPtrList<Incidence> all = rawIncidences() ; |
233 | Incidence *inc; | 233 | Incidence *inc; |
234 | for ( inc = all.first(); inc; inc = all.next() ) { | 234 | for ( inc = all.first(); inc; inc = all.next() ) { |
235 | inc->removeID( syncProfile ); | 235 | inc->removeID( syncProfile ); |
236 | } | 236 | } |
237 | if ( syncProfile.isEmpty() ) { | 237 | if ( syncProfile.isEmpty() ) { |
238 | QPtrList<Event> el; | 238 | QPtrList<Event> el; |
239 | Event *todo; | 239 | Event *todo; |
240 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | 240 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { |
241 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) | 241 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) |
242 | el.append( todo ); | 242 | el.append( todo ); |
243 | } | 243 | } |
244 | for ( todo = el.first(); todo; todo = el.next() ) { | 244 | for ( todo = el.first(); todo; todo = el.next() ) { |
245 | deleteIncidence ( todo ); | 245 | deleteIncidence ( todo ); |
246 | } | 246 | } |
247 | } else { | 247 | } else { |
248 | Event *lse = event( "last-syncEvent-"+ syncProfile); | 248 | Event *lse = event( "last-syncEvent-"+ syncProfile); |
249 | if ( lse ) | 249 | if ( lse ) |
250 | deleteIncidence ( lse ); | 250 | deleteIncidence ( lse ); |
251 | } | 251 | } |
252 | } | 252 | } |
253 | QPtrList<Event> CalendarLocal::getExternLastSyncEvents() | 253 | QPtrList<Event> CalendarLocal::getExternLastSyncEvents() |
254 | { | 254 | { |
255 | QPtrList<Event> el; | 255 | QPtrList<Event> el; |
256 | Event *todo; | 256 | Event *todo; |
257 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | 257 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { |
258 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) | 258 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) |
259 | if ( todo->summary().left(3) == "E: " ) | 259 | if ( todo->summary().left(3) == "E: " ) |
260 | el.append( todo ); | 260 | el.append( todo ); |
261 | } | 261 | } |
262 | 262 | ||
263 | return el; | 263 | return el; |
264 | 264 | ||
265 | } | 265 | } |
266 | Event *CalendarLocal::event( QString syncProf, QString id ) | 266 | Event *CalendarLocal::event( QString syncProf, QString id ) |
267 | { | 267 | { |
268 | Event *todo; | 268 | Event *todo; |
269 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | 269 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { |
270 | if ( todo->getID( syncProf ) == id ) return todo; | 270 | if ( todo->getID( syncProf ) == id ) return todo; |
271 | } | 271 | } |
272 | 272 | ||
273 | return 0; | 273 | return 0; |
274 | } | 274 | } |
275 | Todo *CalendarLocal::todo( const QString &uid ) | 275 | Todo *CalendarLocal::todo( const QString &uid ) |
276 | { | 276 | { |
277 | Todo *todo; | 277 | Todo *todo; |
278 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 278 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
279 | if ( todo->uid() == uid ) return todo; | 279 | if ( todo->uid() == uid ) return todo; |
280 | } | 280 | } |
281 | 281 | ||
282 | return 0; | 282 | return 0; |
283 | } | 283 | } |
284 | QString CalendarLocal::nextSummary() const | 284 | QString CalendarLocal::nextSummary() const |
285 | { | 285 | { |
286 | return mNextSummary; | 286 | return mNextSummary; |
287 | } | 287 | } |
288 | QDateTime CalendarLocal::nextAlarmEventDateTime() const | 288 | QDateTime CalendarLocal::nextAlarmEventDateTime() const |
289 | { | 289 | { |
290 | return mNextAlarmEventDateTime; | 290 | return mNextAlarmEventDateTime; |
291 | } | 291 | } |
292 | void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted) | 292 | void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted) |
293 | { | 293 | { |
294 | //mNextAlarmIncidence | 294 | //mNextAlarmIncidence |
295 | //mNextAlarmDateTime | 295 | //mNextAlarmDateTime |
296 | //return mNextSummary; | 296 | //return mNextSummary; |
297 | //return mNextAlarmEventDateTime; | 297 | //return mNextAlarmEventDateTime; |
298 | bool newNextAlarm = false; | 298 | bool newNextAlarm = false; |
299 | bool computeNextAlarm = false; | 299 | bool computeNextAlarm = false; |
300 | bool ok; | 300 | bool ok; |
301 | int offset; | 301 | int offset; |
302 | QDateTime nextA; | 302 | QDateTime nextA; |
303 | // QString nextSum; | 303 | // QString nextSum; |
304 | //QDateTime nextEvent; | 304 | //QDateTime nextEvent; |
305 | if ( mNextAlarmIncidence == 0 || incidence == 0 ) { | 305 | if ( mNextAlarmIncidence == 0 || incidence == 0 ) { |
306 | computeNextAlarm = true; | 306 | computeNextAlarm = true; |
307 | } else { | 307 | } else { |
308 | if ( ! deleted ) { | 308 | if ( ! deleted ) { |
309 | nextA = incidence->getNextAlarmDateTime(& ok, &offset ) ; | 309 | nextA = incidence->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; |
310 | if ( ok ) { | 310 | if ( ok ) { |
311 | if ( nextA < mNextAlarmDateTime ) { | 311 | if ( nextA < mNextAlarmDateTime ) { |
312 | deRegisterAlarm(); | 312 | deRegisterAlarm(); |
313 | mNextAlarmDateTime = nextA; | 313 | mNextAlarmDateTime = nextA; |
314 | mNextSummary = incidence->summary(); | 314 | mNextSummary = incidence->summary(); |
315 | mNextAlarmEventDateTime = nextA.addSecs(offset ) ; | 315 | mNextAlarmEventDateTime = nextA.addSecs(offset ) ; |
316 | mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); | 316 | mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); |
317 | newNextAlarm = true; | 317 | newNextAlarm = true; |
318 | mNextAlarmIncidence = incidence; | 318 | mNextAlarmIncidence = incidence; |
319 | } else { | 319 | } else { |
320 | if ( incidence == mNextAlarmIncidence ) { | 320 | if ( incidence == mNextAlarmIncidence ) { |
321 | computeNextAlarm = true; | 321 | computeNextAlarm = true; |
322 | } | 322 | } |
323 | } | 323 | } |
324 | } else { | 324 | } else { |
325 | if ( mNextAlarmIncidence == incidence ) { | 325 | if ( mNextAlarmIncidence == incidence ) { |
326 | computeNextAlarm = true; | 326 | computeNextAlarm = true; |
327 | } | 327 | } |
328 | } | 328 | } |
329 | } else { // deleted | 329 | } else { // deleted |
330 | if ( incidence == mNextAlarmIncidence ) { | 330 | if ( incidence == mNextAlarmIncidence ) { |
331 | computeNextAlarm = true; | 331 | computeNextAlarm = true; |
332 | } | 332 | } |
333 | } | 333 | } |
334 | } | 334 | } |
335 | if ( computeNextAlarm ) { | 335 | if ( computeNextAlarm ) { |
336 | deRegisterAlarm(); | 336 | deRegisterAlarm(); |
337 | nextA = nextAlarm( 1000 ); | 337 | nextA = nextAlarm( 1000 ); |
338 | if (! mNextAlarmIncidence ) { | 338 | if (! mNextAlarmIncidence ) { |
339 | return; | 339 | return; |
340 | } | 340 | } |
341 | newNextAlarm = true; | 341 | newNextAlarm = true; |
342 | } | 342 | } |
343 | if ( newNextAlarm ) | 343 | if ( newNextAlarm ) |
344 | registerAlarm(); | 344 | registerAlarm(); |
345 | } | 345 | } |
346 | QString CalendarLocal:: getAlarmNotification() | 346 | QString CalendarLocal:: getAlarmNotification() |
347 | { | 347 | { |
348 | QString ret; | 348 | QString ret; |
349 | // this should not happen | 349 | // this should not happen |
350 | if (! mNextAlarmIncidence ) | 350 | if (! mNextAlarmIncidence ) |
351 | return "cal_alarm"+ mNextSummary.left( 25 )+"\n"+mNextAlarmEventDateTimeString; | 351 | return "cal_alarm"+ mNextSummary.left( 25 )+"\n"+mNextAlarmEventDateTimeString; |
352 | Alarm* alarm = mNextAlarmIncidence->alarms().first(); | 352 | Alarm* alarm = mNextAlarmIncidence->alarms().first(); |
353 | if ( alarm->type() == Alarm::Procedure ) { | 353 | if ( alarm->type() == Alarm::Procedure ) { |
354 | ret = "proc_alarm" + alarm->programFile()+"+++"; | 354 | ret = "proc_alarm" + alarm->programFile()+"+++"; |
355 | } else { | 355 | } else { |
356 | ret = "audio_alarm" +alarm->audioFile() +"+++"; | 356 | ret = "audio_alarm" +alarm->audioFile() +"+++"; |
357 | } | 357 | } |
358 | ret += "cal_alarm"+ mNextSummary.left( 25 ); | 358 | ret += "cal_alarm"+ mNextSummary.left( 25 ); |
359 | if ( mNextSummary.length() > 25 ) | 359 | if ( mNextSummary.length() > 25 ) |
360 | ret += "\n" + mNextSummary.mid(25, 25 ); | 360 | ret += "\n" + mNextSummary.mid(25, 25 ); |
361 | ret+= "\n"+mNextAlarmEventDateTimeString; | 361 | ret+= "\n"+mNextAlarmEventDateTimeString; |
362 | return ret; | 362 | return ret; |
363 | } | 363 | } |
364 | void CalendarLocal::registerAlarm() | 364 | void CalendarLocal::registerAlarm() |
365 | { | 365 | { |
366 | mLastAlarmNotificationString = getAlarmNotification(); | 366 | mLastAlarmNotificationString = getAlarmNotification(); |
367 | // qDebug("++ register Alarm %s %s",mNextAlarmDateTime.toString().latin1(), mLastAlarmNotificationString.latin1() ); | 367 | // qDebug("++ register Alarm %s %s",mNextAlarmDateTime.toString().latin1(), mLastAlarmNotificationString.latin1() ); |
368 | emit addAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString ); | 368 | emit addAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString ); |
369 | // #ifndef DESKTOP_VERSION | 369 | // #ifndef DESKTOP_VERSION |
370 | // AlarmServer::addAlarm ( mNextAlarmDateTime,"koalarm", mLastAlarmNotificationString.latin1() ); | 370 | // AlarmServer::addAlarm ( mNextAlarmDateTime,"koalarm", mLastAlarmNotificationString.latin1() ); |
371 | // #endif | 371 | // #endif |
372 | } | 372 | } |
373 | void CalendarLocal::deRegisterAlarm() | 373 | void CalendarLocal::deRegisterAlarm() |
374 | { | 374 | { |
375 | if ( mLastAlarmNotificationString.isNull() ) | 375 | if ( mLastAlarmNotificationString.isNull() ) |
376 | return; | 376 | return; |
377 | //qDebug("-- deregister Alarm %s ", mLastAlarmNotificationString.latin1() ); | 377 | //qDebug("-- deregister Alarm %s ", mLastAlarmNotificationString.latin1() ); |
378 | 378 | ||
379 | emit removeAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString ); | 379 | emit removeAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString ); |
380 | mNextAlarmEventDateTime = QDateTime(); | 380 | mNextAlarmEventDateTime = QDateTime(); |
381 | // #ifndef DESKTOP_VERSION | 381 | // #ifndef DESKTOP_VERSION |
382 | // AlarmServer::deleteAlarm (mNextAlarmDateTime ,"koalarm" ,mLastAlarmNotificationString.latin1() ); | 382 | // AlarmServer::deleteAlarm (mNextAlarmDateTime ,"koalarm" ,mLastAlarmNotificationString.latin1() ); |
383 | // #endif | 383 | // #endif |
384 | } | 384 | } |
385 | 385 | ||
386 | QPtrList<Todo> CalendarLocal::todos( const QDate &date ) | 386 | QPtrList<Todo> CalendarLocal::todos( const QDate &date ) |
387 | { | 387 | { |
388 | QPtrList<Todo> todos; | 388 | QPtrList<Todo> todos; |
389 | 389 | ||
390 | Todo *todo; | 390 | Todo *todo; |
391 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 391 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
392 | if ( todo->hasDueDate() && todo->dtDue().date() == date ) { | 392 | if ( todo->hasDueDate() && todo->dtDue().date() == date ) { |
393 | todos.append( todo ); | 393 | todos.append( todo ); |
394 | } | 394 | } |
395 | } | 395 | } |
396 | 396 | ||
397 | filter()->apply( &todos ); | 397 | filter()->apply( &todos ); |
398 | return todos; | 398 | return todos; |
399 | } | 399 | } |
400 | void CalendarLocal::reInitAlarmSettings() | 400 | void CalendarLocal::reInitAlarmSettings() |
401 | { | 401 | { |
402 | if ( !mNextAlarmIncidence ) { | 402 | if ( !mNextAlarmIncidence ) { |
403 | nextAlarm( 1000 ); | 403 | nextAlarm( 1000 ); |
404 | } | 404 | } |
405 | deRegisterAlarm(); | 405 | deRegisterAlarm(); |
406 | mNextAlarmIncidence = 0; | 406 | mNextAlarmIncidence = 0; |
407 | checkAlarmForIncidence( 0, false ); | 407 | checkAlarmForIncidence( 0, false ); |
408 | 408 | ||
409 | } | 409 | } |
410 | 410 | ||
411 | 411 | ||
412 | 412 | ||
413 | QDateTime CalendarLocal::nextAlarm( int daysTo ) | 413 | QDateTime CalendarLocal::nextAlarm( int daysTo ) |
414 | { | 414 | { |
415 | QDateTime nextA = QDateTime::currentDateTime().addDays( daysTo ); | 415 | QDateTime nextA = QDateTime::currentDateTime().addDays( daysTo ); |
416 | QDateTime start = QDateTime::currentDateTime().addSecs( 30 ); | 416 | QDateTime start = QDateTime::currentDateTime().addSecs( 30 ); |
417 | QDateTime next; | 417 | QDateTime next; |
418 | Event *e; | 418 | Event *e; |
419 | bool ok; | 419 | bool ok; |
420 | bool found = false; | 420 | bool found = false; |
421 | int offset; | 421 | int offset; |
422 | mNextAlarmIncidence = 0; | 422 | mNextAlarmIncidence = 0; |
423 | for( e = mEventList.first(); e; e = mEventList.next() ) { | 423 | for( e = mEventList.first(); e; e = mEventList.next() ) { |
424 | next = e->getNextAlarmDateTime(& ok, &offset ) ; | 424 | next = e->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; |
425 | if ( ok ) { | 425 | if ( ok ) { |
426 | if ( next < nextA ) { | 426 | if ( next < nextA ) { |
427 | nextA = next; | 427 | nextA = next; |
428 | found = true; | 428 | found = true; |
429 | mNextSummary = e->summary(); | 429 | mNextSummary = e->summary(); |
430 | mNextAlarmEventDateTime = next.addSecs(offset ) ; | 430 | mNextAlarmEventDateTime = next.addSecs(offset ) ; |
431 | mNextAlarmIncidence = (Incidence *) e; | 431 | mNextAlarmIncidence = (Incidence *) e; |
432 | } | 432 | } |
433 | } | 433 | } |
434 | } | 434 | } |
435 | Todo *t; | 435 | Todo *t; |
436 | for( t = mTodoList.first(); t; t = mTodoList.next() ) { | 436 | for( t = mTodoList.first(); t; t = mTodoList.next() ) { |
437 | next = t->getNextAlarmDateTime(& ok, &offset ) ; | 437 | next = t->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; |
438 | if ( ok ) { | 438 | if ( ok ) { |
439 | if ( next < nextA ) { | 439 | if ( next < nextA ) { |
440 | nextA = next; | 440 | nextA = next; |
441 | found = true; | 441 | found = true; |
442 | mNextSummary = t->summary(); | 442 | mNextSummary = t->summary(); |
443 | mNextAlarmEventDateTime = next.addSecs(offset ); | 443 | mNextAlarmEventDateTime = next.addSecs(offset ); |
444 | mNextAlarmIncidence = (Incidence *) t; | 444 | mNextAlarmIncidence = (Incidence *) t; |
445 | } | 445 | } |
446 | } | 446 | } |
447 | } | 447 | } |
448 | if ( mNextAlarmIncidence ) { | 448 | if ( mNextAlarmIncidence ) { |
449 | mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); | 449 | mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); |
450 | mNextAlarmDateTime = nextA; | 450 | mNextAlarmDateTime = nextA; |
451 | } | 451 | } |
452 | return nextA; | 452 | return nextA; |
453 | } | 453 | } |
454 | Alarm::List CalendarLocal::alarmsTo( const QDateTime &to ) | 454 | Alarm::List CalendarLocal::alarmsTo( const QDateTime &to ) |
455 | { | 455 | { |
456 | return alarms( QDateTime( QDate( 1900, 1, 1 ) ), to ); | 456 | return alarms( QDateTime( QDate( 1900, 1, 1 ) ), to ); |
457 | } | 457 | } |
458 | 458 | ||
459 | Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to ) | 459 | Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to ) |
460 | { | 460 | { |
461 | kdDebug(5800) << "CalendarLocal::alarms(" << from.toString() << " - " | 461 | kdDebug(5800) << "CalendarLocal::alarms(" << from.toString() << " - " |
462 | << to.toString() << ")\n"; | 462 | << to.toString() << ")\n"; |
463 | 463 | ||
464 | Alarm::List alarms; | 464 | Alarm::List alarms; |
465 | 465 | ||
466 | Event *e; | 466 | Event *e; |
467 | 467 | ||
468 | for( e = mEventList.first(); e; e = mEventList.next() ) { | 468 | for( e = mEventList.first(); e; e = mEventList.next() ) { |
469 | if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to ); | 469 | if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to ); |
470 | else appendAlarms( alarms, e, from, to ); | 470 | else appendAlarms( alarms, e, from, to ); |
471 | } | 471 | } |
472 | 472 | ||
473 | Todo *t; | 473 | Todo *t; |
474 | for( t = mTodoList.first(); t; t = mTodoList.next() ) { | 474 | for( t = mTodoList.first(); t; t = mTodoList.next() ) { |
475 | appendAlarms( alarms, t, from, to ); | 475 | appendAlarms( alarms, t, from, to ); |
476 | } | 476 | } |
477 | 477 | ||
478 | return alarms; | 478 | return alarms; |
479 | } | 479 | } |
480 | 480 | ||
481 | void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence, | 481 | void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence, |
482 | const QDateTime &from, const QDateTime &to ) | 482 | const QDateTime &from, const QDateTime &to ) |
483 | { | 483 | { |
484 | QPtrList<Alarm> alarmList = incidence->alarms(); | 484 | QPtrList<Alarm> alarmList = incidence->alarms(); |
485 | Alarm *alarm; | 485 | Alarm *alarm; |
486 | for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { | 486 | for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { |
487 | // kdDebug(5800) << "CalendarLocal::appendAlarms() '" << alarm->text() | 487 | // kdDebug(5800) << "CalendarLocal::appendAlarms() '" << alarm->text() |
488 | // << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl; | 488 | // << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl; |
489 | if ( alarm->enabled() ) { | 489 | if ( alarm->enabled() ) { |
490 | if ( alarm->time() >= from && alarm->time() <= to ) { | 490 | if ( alarm->time() >= from && alarm->time() <= to ) { |
491 | kdDebug(5800) << "CalendarLocal::appendAlarms() '" << incidence->summary() | 491 | kdDebug(5800) << "CalendarLocal::appendAlarms() '" << incidence->summary() |
492 | << "': " << alarm->time().toString() << endl; | 492 | << "': " << alarm->time().toString() << endl; |
493 | alarms.append( alarm ); | 493 | alarms.append( alarm ); |
494 | } | 494 | } |
495 | } | 495 | } |
496 | } | 496 | } |
497 | } | 497 | } |
498 | 498 | ||
499 | void CalendarLocal::appendRecurringAlarms( Alarm::List &alarms, | 499 | void CalendarLocal::appendRecurringAlarms( Alarm::List &alarms, |
500 | Incidence *incidence, | 500 | Incidence *incidence, |
501 | const QDateTime &from, | 501 | const QDateTime &from, |
502 | const QDateTime &to ) | 502 | const QDateTime &to ) |
503 | { | 503 | { |
504 | 504 | ||
505 | QPtrList<Alarm> alarmList = incidence->alarms(); | 505 | QPtrList<Alarm> alarmList = incidence->alarms(); |
506 | Alarm *alarm; | 506 | Alarm *alarm; |
507 | QDateTime qdt; | 507 | QDateTime qdt; |
508 | for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { | 508 | for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { |
509 | if (incidence->recursOn(from.date())) { | 509 | if (incidence->recursOn(from.date())) { |
510 | qdt.setTime(alarm->time().time()); | 510 | qdt.setTime(alarm->time().time()); |
511 | qdt.setDate(from.date()); | 511 | qdt.setDate(from.date()); |
512 | } | 512 | } |
513 | else qdt = alarm->time(); | 513 | else qdt = alarm->time(); |
514 | // qDebug("1 %s %s %s", qdt.toString().latin1(), from.toString().latin1(), to.toString().latin1()); | 514 | // qDebug("1 %s %s %s", qdt.toString().latin1(), from.toString().latin1(), to.toString().latin1()); |
515 | if ( alarm->enabled() ) { | 515 | if ( alarm->enabled() ) { |
516 | if ( qdt >= from && qdt <= to ) { | 516 | if ( qdt >= from && qdt <= to ) { |
517 | alarms.append( alarm ); | 517 | alarms.append( alarm ); |
518 | } | 518 | } |
519 | } | 519 | } |
520 | } | 520 | } |
521 | } | 521 | } |
522 | 522 | ||
523 | 523 | ||
524 | /****************************** PROTECTED METHODS ****************************/ | 524 | /****************************** PROTECTED METHODS ****************************/ |
525 | 525 | ||
526 | // after changes are made to an event, this should be called. | 526 | // after changes are made to an event, this should be called. |
527 | void CalendarLocal::update( IncidenceBase *incidence ) | 527 | void CalendarLocal::update( IncidenceBase *incidence ) |
528 | { | 528 | { |
529 | incidence->setSyncStatus( Event::SYNCMOD ); | 529 | incidence->setSyncStatus( Event::SYNCMOD ); |
530 | incidence->setLastModified( QDateTime::currentDateTime() ); | 530 | incidence->setLastModified( QDateTime::currentDateTime() ); |
531 | // we should probably update the revision number here, | 531 | // we should probably update the revision number here, |
532 | // or internally in the Event itself when certain things change. | 532 | // or internally in the Event itself when certain things change. |
533 | // need to verify with ical documentation. | 533 | // need to verify with ical documentation. |
534 | 534 | ||
535 | setModified( true ); | 535 | setModified( true ); |
536 | } | 536 | } |
537 | 537 | ||
538 | void CalendarLocal::insertEvent( Event *event ) | 538 | void CalendarLocal::insertEvent( Event *event ) |
539 | { | 539 | { |
540 | if ( mEventList.findRef( event ) < 0 ) mEventList.append( event ); | 540 | if ( mEventList.findRef( event ) < 0 ) mEventList.append( event ); |
541 | } | 541 | } |
542 | 542 | ||
543 | 543 | ||
544 | QPtrList<Event> CalendarLocal::rawEventsForDate( const QDate &qd, bool sorted ) | 544 | QPtrList<Event> CalendarLocal::rawEventsForDate( const QDate &qd, bool sorted ) |
545 | { | 545 | { |
546 | QPtrList<Event> eventList; | 546 | QPtrList<Event> eventList; |
547 | 547 | ||
548 | Event *event; | 548 | Event *event; |
549 | for( event = mEventList.first(); event; event = mEventList.next() ) { | 549 | for( event = mEventList.first(); event; event = mEventList.next() ) { |
550 | if ( event->doesRecur() ) { | 550 | if ( event->doesRecur() ) { |
551 | if ( event->isMultiDay() ) { | 551 | if ( event->isMultiDay() ) { |
552 | int extraDays = event->dtStart().date().daysTo( event->dtEnd().date() ); | 552 | int extraDays = event->dtStart().date().daysTo( event->dtEnd().date() ); |
553 | int i; | 553 | int i; |
554 | for ( i = 0; i <= extraDays; i++ ) { | 554 | for ( i = 0; i <= extraDays; i++ ) { |
555 | if ( event->recursOn( qd.addDays( -i ) ) ) { | 555 | if ( event->recursOn( qd.addDays( -i ) ) ) { |
556 | eventList.append( event ); | 556 | eventList.append( event ); |
557 | break; | 557 | break; |
558 | } | 558 | } |
559 | } | 559 | } |
560 | } else { | 560 | } else { |
561 | if ( event->recursOn( qd ) ) | 561 | if ( event->recursOn( qd ) ) |
562 | eventList.append( event ); | 562 | eventList.append( event ); |
563 | } | 563 | } |
564 | } else { | 564 | } else { |
565 | if ( event->dtStart().date() <= qd && event->dtEnd().date() >= qd ) { | 565 | if ( event->dtStart().date() <= qd && event->dtEnd().date() >= qd ) { |
diff --git a/libkcal/event.cpp b/libkcal/event.cpp index de8dceb..9b99855 100644 --- a/libkcal/event.cpp +++ b/libkcal/event.cpp | |||
@@ -46,176 +46,176 @@ Incidence *Event::clone() | |||
46 | { | 46 | { |
47 | return new Event(*this); | 47 | return new Event(*this); |
48 | } | 48 | } |
49 | 49 | ||
50 | bool KCal::operator==( const Event& e1, const Event& e2 ) | 50 | bool KCal::operator==( const Event& e1, const Event& e2 ) |
51 | { | 51 | { |
52 | return operator==( (const Incidence&)e1, (const Incidence&)e2 ) && | 52 | return operator==( (const Incidence&)e1, (const Incidence&)e2 ) && |
53 | e1.dtEnd() == e2.dtEnd() && | 53 | e1.dtEnd() == e2.dtEnd() && |
54 | e1.hasEndDate() == e2.hasEndDate() && | 54 | e1.hasEndDate() == e2.hasEndDate() && |
55 | e1.transparency() == e2.transparency(); | 55 | e1.transparency() == e2.transparency(); |
56 | } | 56 | } |
57 | 57 | ||
58 | 58 | ||
59 | bool Event::contains ( Event* from ) | 59 | bool Event::contains ( Event* from ) |
60 | { | 60 | { |
61 | 61 | ||
62 | if ( !from->summary().isEmpty() ) | 62 | if ( !from->summary().isEmpty() ) |
63 | if ( !summary().startsWith( from->summary() )) | 63 | if ( !summary().startsWith( from->summary() )) |
64 | return false; | 64 | return false; |
65 | if ( from->dtStart().isValid() ) | 65 | if ( from->dtStart().isValid() ) |
66 | if (dtStart() != from->dtStart() ) | 66 | if (dtStart() != from->dtStart() ) |
67 | return false; | 67 | return false; |
68 | if ( from->dtEnd().isValid() ) | 68 | if ( from->dtEnd().isValid() ) |
69 | if ( dtEnd() != from->dtEnd() ) | 69 | if ( dtEnd() != from->dtEnd() ) |
70 | return false; | 70 | return false; |
71 | if ( !from->location().isEmpty() ) | 71 | if ( !from->location().isEmpty() ) |
72 | if ( !location().startsWith( from->location() ) ) | 72 | if ( !location().startsWith( from->location() ) ) |
73 | return false; | 73 | return false; |
74 | if ( !from->description().isEmpty() ) | 74 | if ( !from->description().isEmpty() ) |
75 | if ( !description().startsWith( from->description() )) | 75 | if ( !description().startsWith( from->description() )) |
76 | return false; | 76 | return false; |
77 | if ( from->alarms().count() ) { | 77 | if ( from->alarms().count() ) { |
78 | Alarm *a = from->alarms().first(); | 78 | Alarm *a = from->alarms().first(); |
79 | if ( a->enabled() ){ | 79 | if ( a->enabled() ){ |
80 | if ( !alarms().count() ) | 80 | if ( !alarms().count() ) |
81 | return false; | 81 | return false; |
82 | Alarm *b = alarms().first(); | 82 | Alarm *b = alarms().first(); |
83 | if( ! b->enabled() ) | 83 | if( ! b->enabled() ) |
84 | return false; | 84 | return false; |
85 | if ( ! (a->offset() == b->offset() )) | 85 | if ( ! (a->offset() == b->offset() )) |
86 | return false; | 86 | return false; |
87 | } | 87 | } |
88 | } | 88 | } |
89 | QStringList cat = categories(); | 89 | QStringList cat = categories(); |
90 | QStringList catFrom = from->categories(); | 90 | QStringList catFrom = from->categories(); |
91 | QString nCat; | 91 | QString nCat; |
92 | unsigned int iii; | 92 | unsigned int iii; |
93 | for ( iii = 0; iii < catFrom.count();++iii ) { | 93 | for ( iii = 0; iii < catFrom.count();++iii ) { |
94 | nCat = catFrom[iii]; | 94 | nCat = catFrom[iii]; |
95 | if ( !nCat.isEmpty() ) | 95 | if ( !nCat.isEmpty() ) |
96 | if ( !cat.contains( nCat )) { | 96 | if ( !cat.contains( nCat )) { |
97 | return false; | 97 | return false; |
98 | } | 98 | } |
99 | } | 99 | } |
100 | if ( from->doesRecur() ) | 100 | if ( from->doesRecur() ) |
101 | if ( from->doesRecur() != doesRecur() && ! (from->doesRecur()== Recurrence::rYearlyMonth && doesRecur()== Recurrence::rYearlyDay) ) | 101 | if ( from->doesRecur() != doesRecur() && ! (from->doesRecur()== Recurrence::rYearlyMonth && doesRecur()== Recurrence::rYearlyDay) ) |
102 | return false; | 102 | return false; |
103 | return true; | 103 | return true; |
104 | } | 104 | } |
105 | 105 | ||
106 | void Event::setDtEnd(const QDateTime &dtEnd) | 106 | void Event::setDtEnd(const QDateTime &dtEnd) |
107 | { | 107 | { |
108 | if (mReadOnly) return; | 108 | if (mReadOnly) return; |
109 | 109 | ||
110 | mDtEnd = getEvenTime( dtEnd ); | 110 | mDtEnd = getEvenTime( dtEnd ); |
111 | 111 | ||
112 | setHasEndDate(true); | 112 | setHasEndDate(true); |
113 | setHasDuration(false); | 113 | setHasDuration(false); |
114 | 114 | ||
115 | updated(); | 115 | updated(); |
116 | } | 116 | } |
117 | 117 | ||
118 | QDateTime Event::dtEnd() const | 118 | QDateTime Event::dtEnd() const |
119 | { | 119 | { |
120 | if (hasEndDate()) return mDtEnd; | 120 | if (hasEndDate()) return mDtEnd; |
121 | if (hasDuration()) return dtStart().addSecs(duration()); | 121 | if (hasDuration()) return dtStart().addSecs(duration()); |
122 | 122 | ||
123 | return dtStart(); | 123 | return dtStart(); |
124 | } | 124 | } |
125 | 125 | ||
126 | QString Event::dtEndTimeStr() const | 126 | QString Event::dtEndTimeStr() const |
127 | { | 127 | { |
128 | return KGlobal::locale()->formatTime(mDtEnd.time()); | 128 | return KGlobal::locale()->formatTime(mDtEnd.time()); |
129 | } | 129 | } |
130 | 130 | ||
131 | QString Event::dtEndDateStr(bool shortfmt) const | 131 | QString Event::dtEndDateStr(bool shortfmt) const |
132 | { | 132 | { |
133 | return KGlobal::locale()->formatDate(mDtEnd.date(),shortfmt); | 133 | return KGlobal::locale()->formatDate(mDtEnd.date(),shortfmt); |
134 | } | 134 | } |
135 | 135 | ||
136 | QString Event::dtEndStr(bool shortfmt) const | 136 | QString Event::dtEndStr(bool shortfmt) const |
137 | { | 137 | { |
138 | return KGlobal::locale()->formatDateTime(mDtEnd, shortfmt); | 138 | return KGlobal::locale()->formatDateTime(mDtEnd, shortfmt); |
139 | } | 139 | } |
140 | 140 | ||
141 | void Event::setHasEndDate(bool b) | 141 | void Event::setHasEndDate(bool b) |
142 | { | 142 | { |
143 | mHasEndDate = b; | 143 | mHasEndDate = b; |
144 | } | 144 | } |
145 | 145 | ||
146 | bool Event::hasEndDate() const | 146 | bool Event::hasEndDate() const |
147 | { | 147 | { |
148 | return mHasEndDate; | 148 | return mHasEndDate; |
149 | } | 149 | } |
150 | 150 | ||
151 | bool Event::isMultiDay() const | 151 | bool Event::isMultiDay() const |
152 | { | 152 | { |
153 | bool multi = !(dtStart().date() == dtEnd().date()); | 153 | bool multi = !(dtStart().date() == dtEnd().date()); |
154 | return multi; | 154 | return multi; |
155 | } | 155 | } |
156 | 156 | ||
157 | void Event::setTransparency(Event::Transparency transparency) | 157 | void Event::setTransparency(Event::Transparency transparency) |
158 | { | 158 | { |
159 | if (mReadOnly) return; | 159 | if (mReadOnly) return; |
160 | mTransparency = transparency; | 160 | mTransparency = transparency; |
161 | updated(); | 161 | updated(); |
162 | } | 162 | } |
163 | 163 | ||
164 | Event::Transparency Event::transparency() const | 164 | Event::Transparency Event::transparency() const |
165 | { | 165 | { |
166 | return mTransparency; | 166 | return mTransparency; |
167 | } | 167 | } |
168 | 168 | ||
169 | void Event::setDuration(int seconds) | 169 | void Event::setDuration(int seconds) |
170 | { | 170 | { |
171 | setHasEndDate(false); | 171 | setHasEndDate(false); |
172 | Incidence::setDuration(seconds); | 172 | Incidence::setDuration(seconds); |
173 | } | 173 | } |
174 | QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset ) const | 174 | QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const |
175 | { | 175 | { |
176 | 176 | ||
177 | bool yes; | 177 | bool yes; |
178 | QDateTime incidenceStart = getNextOccurence( QDateTime::currentDateTime(), &yes ); | 178 | QDateTime incidenceStart = getNextOccurence( start_dt, &yes ); |
179 | if ( ! yes || cancelled() ) { | 179 | if ( ! yes || cancelled() ) { |
180 | *ok = false; | 180 | *ok = false; |
181 | return QDateTime (); | 181 | return QDateTime (); |
182 | } | 182 | } |
183 | 183 | ||
184 | bool enabled = false; | 184 | bool enabled = false; |
185 | Alarm* alarm; | 185 | Alarm* alarm; |
186 | int off = 0; | 186 | int off = 0; |
187 | QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; | 187 | QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; |
188 | // if ( QDateTime::currentDateTime() > incidenceStart ){ | 188 | // if ( QDateTime::currentDateTime() > incidenceStart ){ |
189 | // *ok = false; | 189 | // *ok = false; |
190 | // return incidenceStart; | 190 | // return incidenceStart; |
191 | // } | 191 | // } |
192 | for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { | 192 | for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { |
193 | if (alarm->enabled()) { | 193 | if (alarm->enabled()) { |
194 | if ( alarm->hasTime () ) { | 194 | if ( alarm->hasTime () ) { |
195 | if ( alarm->time() < alarmStart ) { | 195 | if ( alarm->time() < alarmStart ) { |
196 | alarmStart = alarm->time(); | 196 | alarmStart = alarm->time(); |
197 | enabled = true; | 197 | enabled = true; |
198 | off = alarmStart.secsTo( incidenceStart ); | 198 | off = alarmStart.secsTo( incidenceStart ); |
199 | } | 199 | } |
200 | 200 | ||
201 | } else { | 201 | } else { |
202 | int secs = alarm->startOffset().asSeconds(); | 202 | int secs = alarm->startOffset().asSeconds(); |
203 | if ( incidenceStart.addSecs( secs ) < alarmStart ) { | 203 | if ( incidenceStart.addSecs( secs ) < alarmStart ) { |
204 | alarmStart = incidenceStart.addSecs( secs ); | 204 | alarmStart = incidenceStart.addSecs( secs ); |
205 | enabled = true; | 205 | enabled = true; |
206 | off = -secs; | 206 | off = -secs; |
207 | } | 207 | } |
208 | } | 208 | } |
209 | } | 209 | } |
210 | } | 210 | } |
211 | if ( enabled ) { | 211 | if ( enabled ) { |
212 | if ( alarmStart > QDateTime::currentDateTime() ) { | 212 | if ( alarmStart > start_dt ) { |
213 | *ok = true; | 213 | *ok = true; |
214 | * offset = off; | 214 | * offset = off; |
215 | return alarmStart; | 215 | return alarmStart; |
216 | } | 216 | } |
217 | } | 217 | } |
218 | *ok = false; | 218 | *ok = false; |
219 | return QDateTime (); | 219 | return QDateTime (); |
220 | 220 | ||
221 | } | 221 | } |
diff --git a/libkcal/event.h b/libkcal/event.h index 3bc8adc..8729956 100644 --- a/libkcal/event.h +++ b/libkcal/event.h | |||
@@ -1,90 +1,90 @@ | |||
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 EVENT_H | 21 | #ifndef EVENT_H |
22 | #define EVENT_H | 22 | #define EVENT_H |
23 | // | 23 | // |
24 | // Event component, representing a VEVENT object | 24 | // Event component, representing a VEVENT object |
25 | // | 25 | // |
26 | 26 | ||
27 | #include "incidence.h" | 27 | #include "incidence.h" |
28 | namespace KCal { | 28 | namespace KCal { |
29 | 29 | ||
30 | /** | 30 | /** |
31 | This class provides an Event in the sense of RFC2445. | 31 | This class provides an Event in the sense of RFC2445. |
32 | */ | 32 | */ |
33 | class Event : public Incidence | 33 | class Event : public Incidence |
34 | { | 34 | { |
35 | public: | 35 | public: |
36 | enum Transparency { Opaque, Transparent }; | 36 | enum Transparency { Opaque, Transparent }; |
37 | typedef ListBase<Event> List; | 37 | typedef ListBase<Event> List; |
38 | Event(); | 38 | Event(); |
39 | Event(const Event &); | 39 | Event(const Event &); |
40 | ~Event(); | 40 | ~Event(); |
41 | 41 | ||
42 | QCString type() const { return "Event"; } | 42 | QCString type() const { return "Event"; } |
43 | 43 | ||
44 | Incidence *clone(); | 44 | Incidence *clone(); |
45 | QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const; | 45 | QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const; |
46 | 46 | ||
47 | /** for setting an event's ending date/time with a QDateTime. */ | 47 | /** for setting an event's ending date/time with a QDateTime. */ |
48 | void setDtEnd(const QDateTime &dtEnd); | 48 | void setDtEnd(const QDateTime &dtEnd); |
49 | /** Return the event's ending date/time as a QDateTime. */ | 49 | /** Return the event's ending date/time as a QDateTime. */ |
50 | virtual QDateTime dtEnd() const; | 50 | virtual QDateTime dtEnd() const; |
51 | /** returns an event's end time as a string formatted according to the | 51 | /** returns an event's end time as a string formatted according to the |
52 | users locale settings */ | 52 | users locale settings */ |
53 | QString dtEndTimeStr() const; | 53 | QString dtEndTimeStr() const; |
54 | /** returns an event's end date as a string formatted according to the | 54 | /** returns an event's end date as a string formatted according to the |
55 | users locale settings */ | 55 | users locale settings */ |
56 | QString dtEndDateStr(bool shortfmt=true) const; | 56 | QString dtEndDateStr(bool shortfmt=true) const; |
57 | /** returns an event's end date and time as a string formatted according | 57 | /** returns an event's end date and time as a string formatted according |
58 | to the users locale settings */ | 58 | to the users locale settings */ |
59 | QString dtEndStr(bool shortfmt=true) const; | 59 | QString dtEndStr(bool shortfmt=true) const; |
60 | void setHasEndDate(bool); | 60 | void setHasEndDate(bool); |
61 | /** Return whether the event has an end date/time. */ | 61 | /** Return whether the event has an end date/time. */ |
62 | bool hasEndDate() const; | 62 | bool hasEndDate() const; |
63 | 63 | ||
64 | /** Return true if the event spans multiple days, otherwise return false. */ | 64 | /** Return true if the event spans multiple days, otherwise return false. */ |
65 | bool isMultiDay() const; | 65 | bool isMultiDay() const; |
66 | 66 | ||
67 | /** set the event's time transparency level. */ | 67 | /** set the event's time transparency level. */ |
68 | void setTransparency(Transparency transparency); | 68 | void setTransparency(Transparency transparency); |
69 | /** get the event's time transparency level. */ | 69 | /** get the event's time transparency level. */ |
70 | Transparency transparency() const; | 70 | Transparency transparency() const; |
71 | 71 | ||
72 | void setDuration(int seconds); | 72 | void setDuration(int seconds); |
73 | 73 | ||
74 | bool contains ( Event*); | 74 | bool contains ( Event*); |
75 | 75 | ||
76 | private: | 76 | private: |
77 | bool accept(Visitor &v) { return v.visit(this); } | 77 | bool accept(Visitor &v) { return v.visit(this); } |
78 | 78 | ||
79 | QDateTime mDtEnd; | 79 | QDateTime mDtEnd; |
80 | bool mHasEndDate; | 80 | bool mHasEndDate; |
81 | Transparency mTransparency; | 81 | Transparency mTransparency; |
82 | }; | 82 | }; |
83 | 83 | ||
84 | bool operator==( const Event&, const Event& ); | 84 | bool operator==( const Event&, const Event& ); |
85 | 85 | ||
86 | 86 | ||
87 | } | 87 | } |
88 | 88 | ||
89 | 89 | ||
90 | #endif | 90 | #endif |
diff --git a/libkcal/incidence.h b/libkcal/incidence.h index ebd50d0..aa51e84 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h | |||
@@ -1,245 +1,245 @@ | |||
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 | #ifndef INCIDENCE_H | 20 | #ifndef INCIDENCE_H |
21 | #define INCIDENCE_H | 21 | #define INCIDENCE_H |
22 | // | 22 | // |
23 | // Incidence - base class of calendaring components | 23 | // Incidence - base class of calendaring components |
24 | // | 24 | // |
25 | 25 | ||
26 | #include <qdatetime.h> | 26 | #include <qdatetime.h> |
27 | #include <qstringlist.h> | 27 | #include <qstringlist.h> |
28 | #include <qvaluelist.h> | 28 | #include <qvaluelist.h> |
29 | 29 | ||
30 | #include "recurrence.h" | 30 | #include "recurrence.h" |
31 | #include "alarm.h" | 31 | #include "alarm.h" |
32 | #include "attachment.h" | 32 | #include "attachment.h" |
33 | #include "listbase.h" | 33 | #include "listbase.h" |
34 | #include "incidencebase.h" | 34 | #include "incidencebase.h" |
35 | 35 | ||
36 | namespace KCal { | 36 | namespace KCal { |
37 | 37 | ||
38 | class Event; | 38 | class Event; |
39 | class Todo; | 39 | class Todo; |
40 | class Journal; | 40 | class Journal; |
41 | 41 | ||
42 | /** | 42 | /** |
43 | This class provides the base class common to all calendar components. | 43 | This class provides the base class common to all calendar components. |
44 | */ | 44 | */ |
45 | class Incidence : public IncidenceBase | 45 | class Incidence : public IncidenceBase |
46 | { | 46 | { |
47 | public: | 47 | public: |
48 | /** | 48 | /** |
49 | This class provides the interface for a visitor of calendar components. It | 49 | This class provides the interface for a visitor of calendar components. It |
50 | serves as base class for concrete visitors, which implement certain actions on | 50 | serves as base class for concrete visitors, which implement certain actions on |
51 | calendar components. It allows to add functions, which operate on the concrete | 51 | calendar components. It allows to add functions, which operate on the concrete |
52 | types of calendar components, without changing the calendar component classes. | 52 | types of calendar components, without changing the calendar component classes. |
53 | */ | 53 | */ |
54 | class Visitor | 54 | class Visitor |
55 | { | 55 | { |
56 | public: | 56 | public: |
57 | /** Destruct Incidence::Visitor */ | 57 | /** Destruct Incidence::Visitor */ |
58 | virtual ~Visitor() {} | 58 | virtual ~Visitor() {} |
59 | 59 | ||
60 | /** | 60 | /** |
61 | Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions | 61 | Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions |
62 | on an Event object. | 62 | on an Event object. |
63 | */ | 63 | */ |
64 | virtual bool visit(Event *) { return false; } | 64 | virtual bool visit(Event *) { return false; } |
65 | /** | 65 | /** |
66 | Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions | 66 | Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions |
67 | on an Todo object. | 67 | on an Todo object. |
68 | */ | 68 | */ |
69 | virtual bool visit(Todo *) { return false; } | 69 | virtual bool visit(Todo *) { return false; } |
70 | /** | 70 | /** |
71 | Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions | 71 | Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions |
72 | on an Journal object. | 72 | on an Journal object. |
73 | */ | 73 | */ |
74 | virtual bool visit(Journal *) { return false; } | 74 | virtual bool visit(Journal *) { return false; } |
75 | 75 | ||
76 | protected: | 76 | protected: |
77 | /** Constructor is protected to prevent direct creation of visitor base class. */ | 77 | /** Constructor is protected to prevent direct creation of visitor base class. */ |
78 | Visitor() {} | 78 | Visitor() {} |
79 | }; | 79 | }; |
80 | 80 | ||
81 | /** | 81 | /** |
82 | This class implements a visitor for adding an Incidence to a resource | 82 | This class implements a visitor for adding an Incidence to a resource |
83 | supporting addEvent(), addTodo() and addJournal() calls. | 83 | supporting addEvent(), addTodo() and addJournal() calls. |
84 | */ | 84 | */ |
85 | template<class T> | 85 | template<class T> |
86 | class AddVisitor : public Visitor | 86 | class AddVisitor : public Visitor |
87 | { | 87 | { |
88 | public: | 88 | public: |
89 | AddVisitor( T *r ) : mResource( r ) {} | 89 | AddVisitor( T *r ) : mResource( r ) {} |
90 | bool visit( Event *e ) { return mResource->addEvent( e ); } | 90 | bool visit( Event *e ) { return mResource->addEvent( e ); } |
91 | bool visit( Todo *t ) { return mResource->addTodo( t ); } | 91 | bool visit( Todo *t ) { return mResource->addTodo( t ); } |
92 | bool visit( Journal *j ) { return mResource->addJournal( j ); } | 92 | bool visit( Journal *j ) { return mResource->addJournal( j ); } |
93 | 93 | ||
94 | private: | 94 | private: |
95 | T *mResource; | 95 | T *mResource; |
96 | }; | 96 | }; |
97 | 97 | ||
98 | /** enumeration for describing an event's secrecy. */ | 98 | /** enumeration for describing an event's secrecy. */ |
99 | enum { SecrecyPublic = 0, SecrecyPrivate = 1, SecrecyConfidential = 2 }; | 99 | enum { SecrecyPublic = 0, SecrecyPrivate = 1, SecrecyConfidential = 2 }; |
100 | typedef ListBase<Incidence> List; | 100 | typedef ListBase<Incidence> List; |
101 | Incidence(); | 101 | Incidence(); |
102 | Incidence(const Incidence &); | 102 | Incidence(const Incidence &); |
103 | ~Incidence(); | 103 | ~Incidence(); |
104 | 104 | ||
105 | /** | 105 | /** |
106 | Accept IncidenceVisitor. A class taking part in the visitor mechanism has to | 106 | Accept IncidenceVisitor. A class taking part in the visitor mechanism has to |
107 | provide this implementation: | 107 | provide this implementation: |
108 | <pre> | 108 | <pre> |
109 | bool accept(Visitor &v) { return v.visit(this); } | 109 | bool accept(Visitor &v) { return v.visit(this); } |
110 | </pre> | 110 | </pre> |
111 | */ | 111 | */ |
112 | virtual bool accept(Visitor &) { return false; } | 112 | virtual bool accept(Visitor &) { return false; } |
113 | 113 | ||
114 | virtual Incidence *clone() = 0; | 114 | virtual Incidence *clone() = 0; |
115 | virtual void cloneRelations( Incidence * ); | 115 | virtual void cloneRelations( Incidence * ); |
116 | 116 | ||
117 | virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const = 0; | 117 | virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const = 0; |
118 | void setReadOnly( bool ); | 118 | void setReadOnly( bool ); |
119 | 119 | ||
120 | /** | 120 | /** |
121 | Recreate event. The event is made a new unique event, but already stored | 121 | Recreate event. The event is made a new unique event, but already stored |
122 | event information is preserved. Sets uniquie id, creation date, last | 122 | event information is preserved. Sets uniquie id, creation date, last |
123 | modification date and revision number. | 123 | modification date and revision number. |
124 | */ | 124 | */ |
125 | void recreate(); | 125 | void recreate(); |
126 | Incidence* recreateCloneException(QDate); | 126 | Incidence* recreateCloneException(QDate); |
127 | 127 | ||
128 | /** set creation date */ | 128 | /** set creation date */ |
129 | void setCreated(QDateTime); | 129 | void setCreated(QDateTime); |
130 | /** return time and date of creation. */ | 130 | /** return time and date of creation. */ |
131 | QDateTime created() const; | 131 | QDateTime created() const; |
132 | 132 | ||
133 | /** set the number of revisions this event has seen */ | 133 | /** set the number of revisions this event has seen */ |
134 | void setRevision(int rev); | 134 | void setRevision(int rev); |
135 | /** return the number of revisions this event has seen */ | 135 | /** return the number of revisions this event has seen */ |
136 | int revision() const; | 136 | int revision() const; |
137 | 137 | ||
138 | /** Set starting date/time. */ | 138 | /** Set starting date/time. */ |
139 | virtual void setDtStart(const QDateTime &dtStart); | 139 | virtual void setDtStart(const QDateTime &dtStart); |
140 | /** Return the incidence's ending date/time as a QDateTime. */ | 140 | /** Return the incidence's ending date/time as a QDateTime. */ |
141 | virtual QDateTime dtEnd() const { return QDateTime(); } | 141 | virtual QDateTime dtEnd() const { return QDateTime(); } |
142 | 142 | ||
143 | /** sets the event's lengthy description. */ | 143 | /** sets the event's lengthy description. */ |
144 | void setDescription(const QString &description); | 144 | void setDescription(const QString &description); |
145 | /** returns a reference to the event's description. */ | 145 | /** returns a reference to the event's description. */ |
146 | QString description() const; | 146 | QString description() const; |
147 | 147 | ||
148 | /** sets the event's short summary. */ | 148 | /** sets the event's short summary. */ |
149 | void setSummary(const QString &summary); | 149 | void setSummary(const QString &summary); |
150 | /** returns a reference to the event's summary. */ | 150 | /** returns a reference to the event's summary. */ |
151 | QString summary() const; | 151 | QString summary() const; |
152 | 152 | ||
153 | /** set event's applicable categories */ | 153 | /** set event's applicable categories */ |
154 | void setCategories(const QStringList &categories, bool setForRelations = false); | 154 | void setCategories(const QStringList &categories, bool setForRelations = false); |
155 | void addCategories(const QStringList &categories, bool addToRelations = false); | 155 | void addCategories(const QStringList &categories, bool addToRelations = false); |
156 | /** set event's categories based on a comma delimited string */ | 156 | /** set event's categories based on a comma delimited string */ |
157 | void setCategories(const QString &catStr); | 157 | void setCategories(const QString &catStr); |
158 | /** return categories in a list */ | 158 | /** return categories in a list */ |
159 | QStringList categories() const; | 159 | QStringList categories() const; |
160 | /** return categories as a comma separated string */ | 160 | /** return categories as a comma separated string */ |
161 | QString categoriesStr(); | 161 | QString categoriesStr(); |
162 | QString categoriesStrWithSpace(); | 162 | QString categoriesStrWithSpace(); |
163 | 163 | ||
164 | /** point at some other event to which the event relates. This function should | 164 | /** point at some other event to which the event relates. This function should |
165 | * only be used when constructing a calendar before the related Event | 165 | * only be used when constructing a calendar before the related Event |
166 | * exists. */ | 166 | * exists. */ |
167 | void setRelatedToUid(const QString &); | 167 | void setRelatedToUid(const QString &); |
168 | /** what event does this one relate to? This function should | 168 | /** what event does this one relate to? This function should |
169 | * only be used when constructing a calendar before the related Event | 169 | * only be used when constructing a calendar before the related Event |
170 | * exists. */ | 170 | * exists. */ |
171 | QString relatedToUid() const; | 171 | QString relatedToUid() const; |
172 | /** point at some other event to which the event relates */ | 172 | /** point at some other event to which the event relates */ |
173 | void setRelatedTo(Incidence *relatedTo); | 173 | void setRelatedTo(Incidence *relatedTo); |
174 | /** what event does this one relate to? */ | 174 | /** what event does this one relate to? */ |
175 | Incidence *relatedTo() const; | 175 | Incidence *relatedTo() const; |
176 | /** All events that are related to this event */ | 176 | /** All events that are related to this event */ |
177 | QPtrList<Incidence> relations() const; | 177 | QPtrList<Incidence> relations() const; |
178 | /** Add an event which is related to this event */ | 178 | /** Add an event which is related to this event */ |
179 | void addRelation(Incidence *); | 179 | void addRelation(Incidence *); |
180 | /** Remove event that is related to this event */ | 180 | /** Remove event that is related to this event */ |
181 | void removeRelation(Incidence *); | 181 | void removeRelation(Incidence *); |
182 | 182 | ||
183 | /** returns the list of dates which are exceptions to the recurrence rule */ | 183 | /** returns the list of dates which are exceptions to the recurrence rule */ |
184 | DateList exDates() const; | 184 | DateList exDates() const; |
185 | /** sets the list of dates which are exceptions to the recurrence rule */ | 185 | /** sets the list of dates which are exceptions to the recurrence rule */ |
186 | void setExDates(const DateList &_exDates); | 186 | void setExDates(const DateList &_exDates); |
187 | void setExDates(const char *dates); | 187 | void setExDates(const char *dates); |
188 | /** Add a date to the list of exceptions of the recurrence rule. */ | 188 | /** Add a date to the list of exceptions of the recurrence rule. */ |
189 | void addExDate(const QDate &date); | 189 | void addExDate(const QDate &date); |
190 | 190 | ||
191 | /** returns true if there is an exception for this date in the recurrence | 191 | /** returns true if there is an exception for this date in the recurrence |
192 | rule set, or false otherwise. */ | 192 | rule set, or false otherwise. */ |
193 | bool isException(const QDate &qd) const; | 193 | bool isException(const QDate &qd) const; |
194 | 194 | ||
195 | /** add attachment to this event */ | 195 | /** add attachment to this event */ |
196 | void addAttachment(Attachment *attachment); | 196 | void addAttachment(Attachment *attachment); |
197 | /** remove and delete a specific attachment */ | 197 | /** remove and delete a specific attachment */ |
198 | void deleteAttachment(Attachment *attachment); | 198 | void deleteAttachment(Attachment *attachment); |
199 | /** remove and delete all attachments with this mime type */ | 199 | /** remove and delete all attachments with this mime type */ |
200 | void deleteAttachments(const QString& mime); | 200 | void deleteAttachments(const QString& mime); |
201 | /** return list of all associated attachments */ | 201 | /** return list of all associated attachments */ |
202 | QPtrList<Attachment> attachments() const; | 202 | QPtrList<Attachment> attachments() const; |
203 | /** find a list of attachments with this mime type */ | 203 | /** find a list of attachments with this mime type */ |
204 | QPtrList<Attachment> attachments(const QString& mime) const; | 204 | QPtrList<Attachment> attachments(const QString& mime) const; |
205 | 205 | ||
206 | /** sets the event's status the value specified. See the enumeration | 206 | /** sets the event's status the value specified. See the enumeration |
207 | * above for possible values. */ | 207 | * above for possible values. */ |
208 | void setSecrecy(int); | 208 | void setSecrecy(int); |
209 | /** return the event's secrecy. */ | 209 | /** return the event's secrecy. */ |
210 | int secrecy() const; | 210 | int secrecy() const; |
211 | /** return the event's secrecy in string format. */ | 211 | /** return the event's secrecy in string format. */ |
212 | QString secrecyStr() const; | 212 | QString secrecyStr() const; |
213 | /** return list of all availbale secrecy classes */ | 213 | /** return list of all availbale secrecy classes */ |
214 | static QStringList secrecyList(); | 214 | static QStringList secrecyList(); |
215 | /** return human-readable name of secrecy class */ | 215 | /** return human-readable name of secrecy class */ |
216 | static QString secrecyName(int); | 216 | static QString secrecyName(int); |
217 | 217 | ||
218 | /** returns TRUE if the date specified is one on which the event will | 218 | /** returns TRUE if the date specified is one on which the event will |
219 | * recur. */ | 219 | * recur. */ |
220 | bool recursOn(const QDate &qd) const; | 220 | bool recursOn(const QDate &qd) const; |
221 | 221 | ||
222 | // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?): | 222 | // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?): |
223 | 223 | ||
224 | /** set resources used, such as Office, Car, etc. */ | 224 | /** set resources used, such as Office, Car, etc. */ |
225 | void setResources(const QStringList &resources); | 225 | void setResources(const QStringList &resources); |
226 | /** return list of current resources */ | 226 | /** return list of current resources */ |
227 | QStringList resources() const; | 227 | QStringList resources() const; |
228 | 228 | ||
229 | /** set the event's priority, 0 is undefined, 1 highest (decreasing order) */ | 229 | /** set the event's priority, 0 is undefined, 1 highest (decreasing order) */ |
230 | void setPriority(int priority); | 230 | void setPriority(int priority); |
231 | /** get the event's priority */ | 231 | /** get the event's priority */ |
232 | int priority() const; | 232 | int priority() const; |
233 | 233 | ||
234 | /** All alarms that are associated with this incidence */ | 234 | /** All alarms that are associated with this incidence */ |
235 | QPtrList<Alarm> alarms() const; | 235 | QPtrList<Alarm> alarms() const; |
236 | /** Create a new alarm which is associated with this incidence */ | 236 | /** Create a new alarm which is associated with this incidence */ |
237 | Alarm* newAlarm(); | 237 | Alarm* newAlarm(); |
238 | /** Add an alarm which is associated with this incidence */ | 238 | /** Add an alarm which is associated with this incidence */ |
239 | void addAlarm(Alarm*); | 239 | void addAlarm(Alarm*); |
240 | /** Remove an alarm that is associated with this incidence */ | 240 | /** Remove an alarm that is associated with this incidence */ |
241 | void removeAlarm(Alarm*); | 241 | void removeAlarm(Alarm*); |
242 | /** Remove all alarms that are associated with this incidence */ | 242 | /** Remove all alarms that are associated with this incidence */ |
243 | void clearAlarms(); | 243 | void clearAlarms(); |
244 | /** return whether any alarm associated with this incidence is enabled */ | 244 | /** return whether any alarm associated with this incidence is enabled */ |
245 | bool isAlarmEnabled() const; | 245 | bool isAlarmEnabled() const; |
diff --git a/libkcal/journal.cpp b/libkcal/journal.cpp index 351fb32..859161f 100644 --- a/libkcal/journal.cpp +++ b/libkcal/journal.cpp | |||
@@ -1,49 +1,49 @@ | |||
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 | #include "journal.h" | 21 | #include "journal.h" |
22 | 22 | ||
23 | using namespace KCal; | 23 | using namespace KCal; |
24 | 24 | ||
25 | Journal::Journal() | 25 | Journal::Journal() |
26 | { | 26 | { |
27 | } | 27 | } |
28 | 28 | ||
29 | Journal::~Journal() | 29 | Journal::~Journal() |
30 | { | 30 | { |
31 | } | 31 | } |
32 | 32 | ||
33 | Incidence *Journal::clone() | 33 | Incidence *Journal::clone() |
34 | { | 34 | { |
35 | return new Journal(*this); | 35 | return new Journal(*this); |
36 | } | 36 | } |
37 | 37 | ||
38 | 38 | ||
39 | bool KCal::operator==( const Journal& j1, const Journal& j2 ) | 39 | bool KCal::operator==( const Journal& j1, const Journal& j2 ) |
40 | { | 40 | { |
41 | return operator==( (const Incidence&)j1, (const Incidence&)j2 ); | 41 | return operator==( (const Incidence&)j1, (const Incidence&)j2 ); |
42 | } | 42 | } |
43 | 43 | ||
44 | 44 | ||
45 | QDateTime Journal::getNextAlarmDateTime( bool * ok, int * offset ) const | 45 | QDateTime Journal::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const |
46 | { | 46 | { |
47 | *ok = false; | 47 | *ok = false; |
48 | return QDateTime (); | 48 | return QDateTime (); |
49 | } | 49 | } |
diff --git a/libkcal/journal.h b/libkcal/journal.h index cb90c7a..2c1d7ea 100644 --- a/libkcal/journal.h +++ b/libkcal/journal.h | |||
@@ -1,50 +1,50 @@ | |||
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 | #ifndef JOURNAL_H | 20 | #ifndef JOURNAL_H |
21 | #define JOURNAL_H | 21 | #define JOURNAL_H |
22 | // | 22 | // |
23 | // Journal component, representing a VJOURNAL object | 23 | // Journal component, representing a VJOURNAL object |
24 | // | 24 | // |
25 | 25 | ||
26 | #include "incidence.h" | 26 | #include "incidence.h" |
27 | 27 | ||
28 | namespace KCal { | 28 | namespace KCal { |
29 | 29 | ||
30 | /** | 30 | /** |
31 | This class provides a Journal in the sense of RFC2445. | 31 | This class provides a Journal in the sense of RFC2445. |
32 | */ | 32 | */ |
33 | class Journal : public Incidence | 33 | class Journal : public Incidence |
34 | { | 34 | { |
35 | public: | 35 | public: |
36 | Journal(); | 36 | Journal(); |
37 | ~Journal(); | 37 | ~Journal(); |
38 | 38 | ||
39 | QCString type() const { return "Journal"; } | 39 | QCString type() const { return "Journal"; } |
40 | 40 | ||
41 | Incidence *clone(); | 41 | Incidence *clone(); |
42 | QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const; | 42 | QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const; |
43 | private: | 43 | private: |
44 | bool accept(Visitor &v) { return v.visit(this); } | 44 | bool accept(Visitor &v) { return v.visit(this); } |
45 | }; | 45 | }; |
46 | 46 | ||
47 | bool operator==( const Journal&, const Journal& ); | 47 | bool operator==( const Journal&, const Journal& ); |
48 | } | 48 | } |
49 | 49 | ||
50 | #endif | 50 | #endif |
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index d7431c7..473247a 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -390,188 +390,188 @@ void Todo::setStatus(int status) | |||
390 | if (mReadOnly) return; | 390 | if (mReadOnly) return; |
391 | mStatus = status; | 391 | mStatus = status; |
392 | updated(); | 392 | updated(); |
393 | } | 393 | } |
394 | 394 | ||
395 | int Todo::status() const | 395 | int Todo::status() const |
396 | { | 396 | { |
397 | return mStatus; | 397 | return mStatus; |
398 | } | 398 | } |
399 | 399 | ||
400 | QString Todo::statusStr() const | 400 | QString Todo::statusStr() const |
401 | { | 401 | { |
402 | switch(mStatus) { | 402 | switch(mStatus) { |
403 | case NEEDS_ACTION: | 403 | case NEEDS_ACTION: |
404 | return QString("NEEDS ACTION"); | 404 | return QString("NEEDS ACTION"); |
405 | break; | 405 | break; |
406 | case ACCEPTED: | 406 | case ACCEPTED: |
407 | return QString("ACCEPTED"); | 407 | return QString("ACCEPTED"); |
408 | break; | 408 | break; |
409 | case SENT: | 409 | case SENT: |
410 | return QString("SENT"); | 410 | return QString("SENT"); |
411 | break; | 411 | break; |
412 | case TENTATIVE: | 412 | case TENTATIVE: |
413 | return QString("TENTATIVE"); | 413 | return QString("TENTATIVE"); |
414 | break; | 414 | break; |
415 | case CONFIRMED: | 415 | case CONFIRMED: |
416 | return QString("CONFIRMED"); | 416 | return QString("CONFIRMED"); |
417 | break; | 417 | break; |
418 | case DECLINED: | 418 | case DECLINED: |
419 | return QString("DECLINED"); | 419 | return QString("DECLINED"); |
420 | break; | 420 | break; |
421 | case COMPLETED: | 421 | case COMPLETED: |
422 | return QString("COMPLETED"); | 422 | return QString("COMPLETED"); |
423 | break; | 423 | break; |
424 | case DELEGATED: | 424 | case DELEGATED: |
425 | return QString("DELEGATED"); | 425 | return QString("DELEGATED"); |
426 | break; | 426 | break; |
427 | } | 427 | } |
428 | return QString(""); | 428 | return QString(""); |
429 | } | 429 | } |
430 | #endif | 430 | #endif |
431 | 431 | ||
432 | bool Todo::isCompleted() const | 432 | bool Todo::isCompleted() const |
433 | { | 433 | { |
434 | if (mPercentComplete == 100) { | 434 | if (mPercentComplete == 100) { |
435 | return true; | 435 | return true; |
436 | } | 436 | } |
437 | else return false; | 437 | else return false; |
438 | } | 438 | } |
439 | 439 | ||
440 | void Todo::setCompleted(bool completed) | 440 | void Todo::setCompleted(bool completed) |
441 | { | 441 | { |
442 | if ( mHasRecurrenceID && completed && mPercentComplete != 100 ) { | 442 | if ( mHasRecurrenceID && completed && mPercentComplete != 100 ) { |
443 | if ( !setRecurDates() ) | 443 | if ( !setRecurDates() ) |
444 | completed = false; | 444 | completed = false; |
445 | } | 445 | } |
446 | if (completed) mPercentComplete = 100; | 446 | if (completed) mPercentComplete = 100; |
447 | else { | 447 | else { |
448 | mPercentComplete = 0; | 448 | mPercentComplete = 0; |
449 | mHasCompletedDate = false; | 449 | mHasCompletedDate = false; |
450 | } | 450 | } |
451 | updated(); | 451 | updated(); |
452 | } | 452 | } |
453 | 453 | ||
454 | QDateTime Todo::completed() const | 454 | QDateTime Todo::completed() const |
455 | { | 455 | { |
456 | return mCompleted; | 456 | return mCompleted; |
457 | } | 457 | } |
458 | 458 | ||
459 | QString Todo::completedStr( bool shortF ) const | 459 | QString Todo::completedStr( bool shortF ) const |
460 | { | 460 | { |
461 | return KGlobal::locale()->formatDateTime(mCompleted, shortF); | 461 | return KGlobal::locale()->formatDateTime(mCompleted, shortF); |
462 | } | 462 | } |
463 | 463 | ||
464 | void Todo::setCompleted(const QDateTime &completed) | 464 | void Todo::setCompleted(const QDateTime &completed) |
465 | { | 465 | { |
466 | //qDebug("Todo::setCompleted "); | 466 | //qDebug("Todo::setCompleted "); |
467 | if ( mHasCompletedDate ) { | 467 | if ( mHasCompletedDate ) { |
468 | // qDebug("has completed data - return "); | 468 | // qDebug("has completed data - return "); |
469 | return; | 469 | return; |
470 | } | 470 | } |
471 | mHasCompletedDate = true; | 471 | mHasCompletedDate = true; |
472 | mPercentComplete = 100; | 472 | mPercentComplete = 100; |
473 | mCompleted = getEvenTime(completed); | 473 | mCompleted = getEvenTime(completed); |
474 | updated(); | 474 | updated(); |
475 | } | 475 | } |
476 | 476 | ||
477 | bool Todo::hasCompletedDate() const | 477 | bool Todo::hasCompletedDate() const |
478 | { | 478 | { |
479 | return mHasCompletedDate; | 479 | return mHasCompletedDate; |
480 | } | 480 | } |
481 | 481 | ||
482 | int Todo::percentComplete() const | 482 | int Todo::percentComplete() const |
483 | { | 483 | { |
484 | return mPercentComplete; | 484 | return mPercentComplete; |
485 | } | 485 | } |
486 | bool Todo::setRecurDates() | 486 | bool Todo::setRecurDates() |
487 | { | 487 | { |
488 | if ( !mHasRecurrenceID ) | 488 | if ( !mHasRecurrenceID ) |
489 | return true; | 489 | return true; |
490 | int secs = mDtStart.secsTo( dtDue() ); | 490 | int secs = mDtStart.secsTo( dtDue() ); |
491 | bool ok; | 491 | bool ok; |
492 | qDebug("T:setRecurDates() "); | 492 | qDebug("T:setRecurDates() "); |
493 | //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); | 493 | //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); |
494 | QDateTime next = getNextOccurence( mRecurrenceID, &ok ); | 494 | QDateTime next = getNextOccurence( mRecurrenceID, &ok ); |
495 | if ( ok ) { | 495 | if ( ok ) { |
496 | mRecurrenceID = next; | 496 | mRecurrenceID = next; |
497 | mDtStart = next; | 497 | mDtStart = next; |
498 | setDtDue( next.addSecs( secs ) ); | 498 | setDtDue( next.addSecs( secs ) ); |
499 | if ( QDateTime::currentDateTime() > next) | 499 | if ( QDateTime::currentDateTime() > next) |
500 | return false; | 500 | return false; |
501 | } else { | 501 | } else { |
502 | setHasRecurrenceID( false ); | 502 | setHasRecurrenceID( false ); |
503 | recurrence()->unsetRecurs(); | 503 | recurrence()->unsetRecurs(); |
504 | } | 504 | } |
505 | return true; | 505 | return true; |
506 | } | 506 | } |
507 | void Todo::setPercentComplete(int v) | 507 | void Todo::setPercentComplete(int v) |
508 | { | 508 | { |
509 | if ( mHasRecurrenceID && v == 100 && mPercentComplete != 100 ) { | 509 | if ( mHasRecurrenceID && v == 100 && mPercentComplete != 100 ) { |
510 | if ( !setRecurDates() ) | 510 | if ( !setRecurDates() ) |
511 | v = 0; | 511 | v = 0; |
512 | } | 512 | } |
513 | mPercentComplete = v; | 513 | mPercentComplete = v; |
514 | if ( v != 100 ) | 514 | if ( v != 100 ) |
515 | mHasCompletedDate = false; | 515 | mHasCompletedDate = false; |
516 | updated(); | 516 | updated(); |
517 | } | 517 | } |
518 | QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const | 518 | QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const |
519 | { | 519 | { |
520 | if ( isCompleted() || ! hasDueDate() || cancelled() ) { | 520 | if ( isCompleted() || ! hasDueDate() || cancelled() ) { |
521 | *ok = false; | 521 | *ok = false; |
522 | return QDateTime (); | 522 | return QDateTime (); |
523 | } | 523 | } |
524 | QDateTime incidenceStart; | 524 | QDateTime incidenceStart; |
525 | incidenceStart = dtDue(); | 525 | incidenceStart = dtDue(); |
526 | bool enabled = false; | 526 | bool enabled = false; |
527 | Alarm* alarm; | 527 | Alarm* alarm; |
528 | int off = 0; | 528 | int off = 0; |
529 | QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; | 529 | QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; |
530 | // if ( QDateTime::currentDateTime() > incidenceStart ){ | 530 | // if ( QDateTime::currentDateTime() > incidenceStart ){ |
531 | // *ok = false; | 531 | // *ok = false; |
532 | // return incidenceStart; | 532 | // return incidenceStart; |
533 | // } | 533 | // } |
534 | for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { | 534 | for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { |
535 | if (alarm->enabled()) { | 535 | if (alarm->enabled()) { |
536 | if ( alarm->hasTime () ) { | 536 | if ( alarm->hasTime () ) { |
537 | if ( alarm->time() < alarmStart ) { | 537 | if ( alarm->time() < alarmStart ) { |
538 | alarmStart = alarm->time(); | 538 | alarmStart = alarm->time(); |
539 | enabled = true; | 539 | enabled = true; |
540 | off = alarmStart.secsTo( incidenceStart ); | 540 | off = alarmStart.secsTo( incidenceStart ); |
541 | } | 541 | } |
542 | 542 | ||
543 | } else { | 543 | } else { |
544 | int secs = alarm->startOffset().asSeconds(); | 544 | int secs = alarm->startOffset().asSeconds(); |
545 | if ( incidenceStart.addSecs( secs ) < alarmStart ) { | 545 | if ( incidenceStart.addSecs( secs ) < alarmStart ) { |
546 | alarmStart = incidenceStart.addSecs( secs ); | 546 | alarmStart = incidenceStart.addSecs( secs ); |
547 | enabled = true; | 547 | enabled = true; |
548 | off = -secs; | 548 | off = -secs; |
549 | } | 549 | } |
550 | } | 550 | } |
551 | } | 551 | } |
552 | } | 552 | } |
553 | if ( enabled ) { | 553 | if ( enabled ) { |
554 | if ( alarmStart > QDateTime::currentDateTime() ) { | 554 | if ( alarmStart > start_dt ) { |
555 | *ok = true; | 555 | *ok = true; |
556 | * offset = off; | 556 | * offset = off; |
557 | return alarmStart; | 557 | return alarmStart; |
558 | } | 558 | } |
559 | } | 559 | } |
560 | *ok = false; | 560 | *ok = false; |
561 | return QDateTime (); | 561 | return QDateTime (); |
562 | 562 | ||
563 | } | 563 | } |
564 | 564 | ||
565 | void Todo::checkSetCompletedFalse() | 565 | void Todo::checkSetCompletedFalse() |
566 | { | 566 | { |
567 | if ( !hasRecurrenceID() ) { | 567 | if ( !hasRecurrenceID() ) { |
568 | qDebug("ERROR 1 in Todo::checkSetCompletedFalse"); | 568 | qDebug("ERROR 1 in Todo::checkSetCompletedFalse"); |
569 | } | 569 | } |
570 | // qDebug("Todo::checkSetCompletedFalse()"); | 570 | // qDebug("Todo::checkSetCompletedFalse()"); |
571 | //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); | 571 | //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); |
572 | if ( mPercentComplete == 100 && mDtStart == mRecurrenceID && QDateTime::currentDateTime() > mDtStart) { | 572 | if ( mPercentComplete == 100 && mDtStart == mRecurrenceID && QDateTime::currentDateTime() > mDtStart) { |
573 | qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); | 573 | qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); |
574 | setCompleted( false ); | 574 | setCompleted( false ); |
575 | qDebug("Todo::checkSetCompletedFalse "); | 575 | qDebug("Todo::checkSetCompletedFalse "); |
576 | } | 576 | } |
577 | } | 577 | } |
diff --git a/libkcal/todo.h b/libkcal/todo.h index a5354ce..ab8fdf1 100644 --- a/libkcal/todo.h +++ b/libkcal/todo.h | |||
@@ -1,150 +1,150 @@ | |||
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 | #ifndef TODO_H | 20 | #ifndef TODO_H |
21 | #define TODO_H | 21 | #define TODO_H |
22 | // | 22 | // |
23 | // Todo component, representing a VTODO object | 23 | // Todo component, representing a VTODO object |
24 | // | 24 | // |
25 | 25 | ||
26 | #include "incidence.h" | 26 | #include "incidence.h" |
27 | 27 | ||
28 | #include <qtimer.h> | 28 | #include <qtimer.h> |
29 | 29 | ||
30 | namespace KCal { | 30 | namespace KCal { |
31 | 31 | ||
32 | /** | 32 | /** |
33 | This class provides a Todo in the sense of RFC2445. | 33 | This class provides a Todo in the sense of RFC2445. |
34 | */ | 34 | */ |
35 | class Todo : public QObject,public Incidence | 35 | class Todo : public QObject,public Incidence |
36 | { | 36 | { |
37 | Q_OBJECT | 37 | Q_OBJECT |
38 | public: | 38 | public: |
39 | Todo(); | 39 | Todo(); |
40 | Todo(const Todo &); | 40 | Todo(const Todo &); |
41 | ~Todo(); | 41 | ~Todo(); |
42 | typedef ListBase<Todo> List; | 42 | typedef ListBase<Todo> List; |
43 | QCString type() const { return "Todo"; } | 43 | QCString type() const { return "Todo"; } |
44 | 44 | ||
45 | /** Return an exact copy of this todo. */ | 45 | /** Return an exact copy of this todo. */ |
46 | Incidence *clone(); | 46 | Incidence *clone(); |
47 | QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const; | 47 | QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const; |
48 | 48 | ||
49 | /** for setting the todo's due date/time with a QDateTime. */ | 49 | /** for setting the todo's due date/time with a QDateTime. */ |
50 | void setDtDue(const QDateTime &dtDue); | 50 | void setDtDue(const QDateTime &dtDue); |
51 | /** returns an event's Due date/time as a QDateTime. */ | 51 | /** returns an event's Due date/time as a QDateTime. */ |
52 | QDateTime dtDue() const; | 52 | QDateTime dtDue() const; |
53 | /** returns an event's due time as a string formatted according to the | 53 | /** returns an event's due time as a string formatted according to the |
54 | users locale settings */ | 54 | users locale settings */ |
55 | QString dtDueTimeStr() const; | 55 | QString dtDueTimeStr() const; |
56 | /** returns an event's due date as a string formatted according to the | 56 | /** returns an event's due date as a string formatted according to the |
57 | users locale settings */ | 57 | users locale settings */ |
58 | QString dtDueDateStr(bool shortfmt=true) const; | 58 | QString dtDueDateStr(bool shortfmt=true) const; |
59 | /** returns an event's due date and time as a string formatted according | 59 | /** returns an event's due date and time as a string formatted according |
60 | to the users locale settings */ | 60 | to the users locale settings */ |
61 | QString dtDueStr(bool shortfmt=true) const; | 61 | QString dtDueStr(bool shortfmt=true) const; |
62 | 62 | ||
63 | /** returns TRUE or FALSE depending on whether the todo has a due date */ | 63 | /** returns TRUE or FALSE depending on whether the todo has a due date */ |
64 | bool hasDueDate() const; | 64 | bool hasDueDate() const; |
65 | /** sets the event's hasDueDate value. */ | 65 | /** sets the event's hasDueDate value. */ |
66 | void setHasDueDate(bool f); | 66 | void setHasDueDate(bool f); |
67 | 67 | ||
68 | /* | 68 | /* |
69 | Looks for a subtodo (including itself ) which is not complete and is | 69 | Looks for a subtodo (including itself ) which is not complete and is |
70 | - overdue, or | 70 | - overdue, or |
71 | - due today. | 71 | - due today. |
72 | It returns 0 for nothing found, | 72 | It returns 0 for nothing found, |
73 | 1 for found a todo which is due today and no overdue found | 73 | 1 for found a todo which is due today and no overdue found |
74 | 2 for found a overdue todo | 74 | 2 for found a overdue todo |
75 | */ | 75 | */ |
76 | int hasDueSubTodo( bool checkSubtodos = true ); | 76 | int hasDueSubTodo( bool checkSubtodos = true ); |
77 | /* same as above, but a specific date can be specified*/ | 77 | /* same as above, but a specific date can be specified*/ |
78 | int hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ); | 78 | int hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ); |
79 | 79 | ||
80 | 80 | ||
81 | /** sets the event's status to the string specified. The string | 81 | /** sets the event's status to the string specified. The string |
82 | * must be a recognized value for the status field, i.e. a string | 82 | * must be a recognized value for the status field, i.e. a string |
83 | * equivalent of the possible status enumerations previously described. */ | 83 | * equivalent of the possible status enumerations previously described. */ |
84 | // void setStatus(const QString &statStr); | 84 | // void setStatus(const QString &statStr); |
85 | /** sets the event's status to the value specified. See the enumeration | 85 | /** sets the event's status to the value specified. See the enumeration |
86 | * above for possible values. */ | 86 | * above for possible values. */ |
87 | // void setStatus(int); | 87 | // void setStatus(int); |
88 | /** return the event's status. */ | 88 | /** return the event's status. */ |
89 | // int status() const; | 89 | // int status() const; |
90 | /** return the event's status in string format. */ | 90 | /** return the event's status in string format. */ |
91 | // QString statusStr() const; | 91 | // QString statusStr() const; |
92 | 92 | ||
93 | /** return, if this todo is completed */ | 93 | /** return, if this todo is completed */ |
94 | bool isCompleted() const; | 94 | bool isCompleted() const; |
95 | /** set completed state of this todo */ | 95 | /** set completed state of this todo */ |
96 | void setCompleted(bool); | 96 | void setCompleted(bool); |
97 | 97 | ||
98 | /** | 98 | /** |
99 | Return how many percent of the task are completed. Returns a value | 99 | Return how many percent of the task are completed. Returns a value |
100 | between 0 and 100. | 100 | between 0 and 100. |
101 | */ | 101 | */ |
102 | int percentComplete() const; | 102 | int percentComplete() const; |
103 | /** | 103 | /** |
104 | Set how many percent of the task are completed. Valid values are in the | 104 | Set how many percent of the task are completed. Valid values are in the |
105 | range from 0 to 100. | 105 | range from 0 to 100. |
106 | */ | 106 | */ |
107 | void setPercentComplete(int); | 107 | void setPercentComplete(int); |
108 | 108 | ||
109 | /** return date and time when todo was completed */ | 109 | /** return date and time when todo was completed */ |
110 | QDateTime completed() const; | 110 | QDateTime completed() const; |
111 | QString completedStr(bool shortF = true) const; | 111 | QString completedStr(bool shortF = true) const; |
112 | /** set date and time of completion */ | 112 | /** set date and time of completion */ |
113 | void setCompleted(const QDateTime &completed); | 113 | void setCompleted(const QDateTime &completed); |
114 | 114 | ||
115 | /** Return true, if todo has a date associated with completion */ | 115 | /** Return true, if todo has a date associated with completion */ |
116 | bool hasCompletedDate() const; | 116 | bool hasCompletedDate() const; |
117 | bool contains ( Todo*); | 117 | bool contains ( Todo*); |
118 | void checkSetCompletedFalse(); | 118 | void checkSetCompletedFalse(); |
119 | bool setRecurDates(); | 119 | bool setRecurDates(); |
120 | bool isRunning() {return mRunning;} | 120 | bool isRunning() {return mRunning;} |
121 | bool hasRunningSub(); | 121 | bool hasRunningSub(); |
122 | void setRunning( bool ); | 122 | void setRunning( bool ); |
123 | void setRunningFalse( QString ); | 123 | void setRunningFalse( QString ); |
124 | int runTime(); | 124 | int runTime(); |
125 | QDateTime runStart () const { return mRunStart;} | 125 | QDateTime runStart () const { return mRunStart;} |
126 | public slots: | 126 | public slots: |
127 | void saveRunningInfoToFile( QString st = QString::null ); | 127 | void saveRunningInfoToFile( QString st = QString::null ); |
128 | void saveParents(); | 128 | void saveParents(); |
129 | private: | 129 | private: |
130 | bool mRunning; | 130 | bool mRunning; |
131 | QTimer * mRunSaveTimer; | 131 | QTimer * mRunSaveTimer; |
132 | QDateTime mRunStart; | 132 | QDateTime mRunStart; |
133 | bool accept(Visitor &v) { return v.visit(this); } | 133 | bool accept(Visitor &v) { return v.visit(this); } |
134 | 134 | ||
135 | QDateTime mDtDue; // due date of todo | 135 | QDateTime mDtDue; // due date of todo |
136 | 136 | ||
137 | bool mHasDueDate; // if todo has associated due date | 137 | bool mHasDueDate; // if todo has associated due date |
138 | 138 | ||
139 | // int mStatus; // confirmed/delegated/tentative/etc | 139 | // int mStatus; // confirmed/delegated/tentative/etc |
140 | 140 | ||
141 | QDateTime mCompleted; | 141 | QDateTime mCompleted; |
142 | bool mHasCompletedDate; | 142 | bool mHasCompletedDate; |
143 | 143 | ||
144 | int mPercentComplete; | 144 | int mPercentComplete; |
145 | }; | 145 | }; |
146 | 146 | ||
147 | bool operator==( const Todo&, const Todo& ); | 147 | bool operator==( const Todo&, const Todo& ); |
148 | } | 148 | } |
149 | 149 | ||
150 | #endif | 150 | #endif |