summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt3
-rw-r--r--korganizer/kotodoview.cpp60
-rw-r--r--korganizer/kotodoview.h14
-rw-r--r--libkcal/calendar.h1
-rw-r--r--libkcal/calendarlocal.cpp6
-rw-r--r--libkcal/calendarlocal.h1
-rw-r--r--libkcal/todo.cpp4
7 files changed, 78 insertions, 11 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index 01c707e..6ac79ad 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1268,197 +1268,200 @@
1268{ "Previous Week","Vorherige Woche" }, 1268{ "Previous Week","Vorherige Woche" },
1269{ "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." }, 1269{ "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{ "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" }, 1270{ "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" },
1271{ "Details","Details" }, 1271{ "Details","Details" },
1272{ "Created time","Erstellt Zeit" }, 1272{ "Created time","Erstellt Zeit" },
1273{ "Last modified time","Geändert Zeit" }, 1273{ "Last modified time","Geändert Zeit" },
1274{ "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" }, 1274{ "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" },
1275{ "View Options","Anzeige Optionen" }, 1275{ "View Options","Anzeige Optionen" },
1276{ "<b>Created: ","<b>Erstellt am: " }, 1276{ "<b>Created: ","<b>Erstellt am: " },
1277{ "<b>Last modified: ","<b>Zuletzt geändert am: " }, 1277{ "<b>Last modified: ","<b>Zuletzt geändert am: " },
1278{ "Journal: ","Journal: " }, 1278{ "Journal: ","Journal: " },
1279{ "yearly","jährlich" }, 1279{ "yearly","jährlich" },
1280{ "(%1) ","%1-" }, 1280{ "(%1) ","%1-" },
1281{ "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" }, 1281{ "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" },
1282{ "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" }, 1282{ "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" },
1283{ "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" }, 1283{ "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" },
1284{ "Summary/Loc.","Titel/Ort" }, 1284{ "Summary/Loc.","Titel/Ort" },
1285{ "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." }, 1285{ "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." },
1286{ "Week Number","Wochennummer" }, 1286{ "Week Number","Wochennummer" },
1287{ "Import","Importiere" }, 1287{ "Import","Importiere" },
1288{ "Export","Exportiere" }, 1288{ "Export","Exportiere" },
1289{ "Beam","Beame" }, 1289{ "Beam","Beame" },
1290{ "Export selected","Exportiere Selektierte" }, 1290{ "Export selected","Exportiere Selektierte" },
1291{ "As iCal (ics) file...","Als iCal (ics) Datei..." }, 1291{ "As iCal (ics) file...","Als iCal (ics) Datei..." },
1292{ "As vCal (vcs) file...","Als vCal (vcs) Datei..." }, 1292{ "As vCal (vcs) file...","Als vCal (vcs) Datei..." },
1293{ "Journal/Details...","Journale/Details..." }, 1293{ "Journal/Details...","Journale/Details..." },
1294{ "Agenda View","Agenda Ansicht" }, 1294{ "Agenda View","Agenda Ansicht" },
1295{ "Show current time","Zeige aktuelle Zeit" }, 1295{ "Show current time","Zeige aktuelle Zeit" },
1296{ "Edit new item","Bearbeite neuen Eintrag" }, 1296{ "Edit new item","Bearbeite neuen Eintrag" },
1297{ "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" }, 1297{ "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{ "There is no next alarm.","Es gibt keinen nächsten Alarm." }, 1298{ "There is no next alarm.","Es gibt keinen nächsten Alarm." },
1299{ "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" }, 1299{ "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" },
1300{ "The next alarm is in:\n","Der nächste Alarm ist in:\n" }, 1300{ "The next alarm is in:\n","Der nächste Alarm ist in:\n" },
1301{ "%1 days\n","%1 Tagen\n" }, 1301{ "%1 days\n","%1 Tagen\n" },
1302{ "1 day\n","1 Tag\n" }, 1302{ "1 day\n","1 Tag\n" },
1303{ "%1 hours\n","%1 Stunden\n" }, 1303{ "%1 hours\n","%1 Stunden\n" },
1304{ "1 hour\n","1 Stunde\n" }, 1304{ "1 hour\n","1 Stunde\n" },
1305{ "%1 minutes\n","%1 Minuten\n" }, 1305{ "%1 minutes\n","%1 Minuten\n" },
1306{ "1 minute\n","1 Minute\n" }, 1306{ "1 minute\n","1 Minute\n" },
1307{ "Only one toolbar","Nur eine Toolbar" }, 1307{ "Only one toolbar","Nur eine Toolbar" },
1308{ "Print","Drucke" }, 1308{ "Print","Drucke" },
1309{ "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." }, 1309{ "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." },
1310{ "There is nothing selected!","Es ist nichts ausgewählt!" }, 1310{ "There is nothing selected!","Es ist nichts ausgewählt!" },
1311{ "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " }, 1311{ "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " },
1312{ "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" }, 1312{ "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" },
1313{ "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" }, 1313{ "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{ "KO/Pi Printout","KO/Pi Ausdruck" }, 1314{ "KO/Pi Printout","KO/Pi Ausdruck" },
1315{ "Print unscaled","Drucke unskaliert" }, 1315{ "Print unscaled","Drucke unskaliert" },
1316{ "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." }, 1316{ "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." },
1317{ "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." }, 1317{ "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." },
1318{ "Printout Mode","Druck Modus" }, 1318{ "Printout Mode","Druck Modus" },
1319{ "Filter menu icon","Filtermenu Icon" }, 1319{ "Filter menu icon","Filtermenu Icon" },
1320{ "<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" }, 1320{ "<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>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" }, 1321{ "<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{ "%1d","%1t" }, 1322{ "%1d","%1t" },
1323{ "%1h","%1std" }, 1323{ "%1h","%1std" },
1324{ "%1min","%1min" }, 1324{ "%1min","%1min" },
1325{ "( %1 before )","( %1 vorher )" }, 1325{ "( %1 before )","( %1 vorher )" },
1326{ "The next alarm is in\nless than one minute!","Der nächste Alarm kommt in\nweniger als einer Minute!" }, 1326{ "The next alarm is in\nless than one minute!","Der nächste Alarm kommt in\nweniger als einer Minute!" },
1327{ "\nThe internal alarm notification is disabled!\n","\nDie interne Alarmbenachrichtigung ist ausgeschaltet!\n" }, 1327{ "\nThe internal alarm notification is disabled!\n","\nDie interne Alarmbenachrichtigung ist ausgeschaltet!\n" },
1328{ "Enable it in the settings menu, TAB alarm.","Schalten Sie sie an im Menu Einstellungen, TAB Alarm." }, 1328{ "Enable it in the settings menu, TAB alarm.","Schalten Sie sie an im Menu Einstellungen, TAB Alarm." },
1329{ "Show Sync Events","Zeige Sync-Ereignisse" }, 1329{ "Show Sync Events","Zeige Sync-Ereignisse" },
1330{ "Use short date in WN+Event view","Zeige Kurzdatum in WN+Terminanzeige" }, 1330{ "Use short date in WN+Event view","Zeige Kurzdatum in WN+Terminanzeige" },
1331{ "Number of max.displayed todo prios:","Anzahl max.angezeigter Todo-Prios:" }, 1331{ "Number of max.displayed todo prios:","Anzahl max.angezeigter Todo-Prios:" },
1332{ " on "," am " }, 1332{ " on "," am " },
1333{ "On: ","Am: " }, 1333{ "On: ","Am: " },
1334{ "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" }, 1334{ "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" },
1335{ "Start/Stop todo...","Starte/Stoppe Todo..." }, 1335{ "Start/Stop todo...","Starte/Stoppe Todo..." },
1336{ "Color for running todos:","Farbe für laufende Todos:" }, 1336{ "Color for running todos:","Farbe für laufende Todos:" },
1337{ "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?" }, 1337{ "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{ "Todo is started","Todo ist gestartet" }, 1338{ "Todo is started","Todo ist gestartet" },
1339{ "Stop todo","Stoppe Todo" }, 1339{ "Stop todo","Stoppe Todo" },
1340{ "Todo is stopped","Todo ist gestoppt" }, 1340{ "Todo is stopped","Todo ist gestoppt" },
1341{ "Start todo","Starte Todo" }, 1341{ "Start todo","Starte Todo" },
1342{ "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?" }, 1342{ "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\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?" }, 1343{ "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{ "Todo has subtodos","Todo hat Untertodos" }, 1344{ "Todo has subtodos","Todo hat Untertodos" },
1345{ "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" }, 1345{ "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" },
1346{ "Colors","Farben" }, 1346{ "Colors","Farben" },
1347{ "Click on new parent item","Klicke auf neues Übertodo" }, 1347{ "Click on new parent item","Klicke auf neues Übertodo" },
1348{ "Reparenting aborted!","Übertodo setzen abgebrochen" }, 1348{ "Reparenting aborted!","Übertodo setzen abgebrochen" },
1349{ "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" }, 1349{ "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" },
1350{ "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" }, 1350{ "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" },
1351{ "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" }, 1351{ "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{ "Alternating background of list views","Abwechselnder Hintergrund für Listen" }, 1352{ "Alternating background of list views","Abwechselnder Hintergrund für Listen" },
1353{ "times","Zeiten" }, 1353{ "times","Zeiten" },
1354{ "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?" }, 1354{ "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{ "Backup enabled","Backup angeschaltet" }, 1355{ "Backup enabled","Backup angeschaltet" },
1356{ "Use standard backup dir","Standard Backupverzeichnis" }, 1356{ "Use standard backup dir","Standard Backupverzeichnis" },
1357{ "Number of Backups:","Anzahl der Backups" }, 1357{ "Number of Backups:","Anzahl der Backups" },
1358{ "Make backup every ","Mache ein Backup alle " }, 1358{ "Make backup every ","Mache ein Backup alle " },
1359{ " days"," Tage" }, 1359{ " days"," Tage" },
1360{ "Creating backup ... please wait ...","Erstelle Backup ... bitte warten ..." }, 1360{ "Creating backup ... please wait ...","Erstelle Backup ... bitte warten ..." },
1361{ "Backup Failed!","Backup Problem!" }, 1361{ "Backup Failed!","Backup Problem!" },
1362{ "Try again now","Versuche jetzt nochmal" }, 1362{ "Try again now","Versuche jetzt nochmal" },
1363{ "Try again later","Versuche später nochmal" }, 1363{ "Try again later","Versuche später nochmal" },
1364{ "Try again tomorrow","Versuche morgen nochmal" }, 1364{ "Try again tomorrow","Versuche morgen nochmal" },
1365{ "Disable backup","Schalte Backup ab" }, 1365{ "Disable backup","Schalte Backup ab" },
1366{ "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" }, 1366{ "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" },
1367{ "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" }, 1367{ "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" },
1368{ "Choose action","Wähle Aktion" }, 1368{ "Choose action","Wähle Aktion" },
1369{ "Comment for todo:","Kommentar zum Todo:" }, 1369{ "Comment for todo:","Kommentar zum Todo:" },
1370{ "Stop+note","Stop+Notiz" }, 1370{ "Stop+note","Stop+Notiz" },
1371{ "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" }, 1371{ "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" },
1372{ "KO/Pi: Missing alarms!","KO/Pi: Verpasste Alarme!" }, 1372{ "KO/Pi: Missing alarms!","KO/Pi: Verpasste Alarme!" },
1373{ "You missed the alarms for the following events or todos:","Sie verpassten die Alarme für folgende Termine oder Todos:" }, 1373{ "You missed the alarms for the following events or todos:","Sie verpassten die Alarme für folgende Termine oder Todos:" },
1374{ "Print complete list","Drucke komplette Liste" }, 1374{ "Print complete list","Drucke komplette Liste" },
1375{ "Hide all selected","Verstecke Selektierte" }, 1375{ "Hide all selected","Verstecke Selektierte" },
1376{ "Add items","hinzufügen" }, 1376{ "Add items","hinzufügen" },
1377{ "One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?","Ein (oder mehrere) ausgewähltes\nTodo hat Untertodos!\nMöchten Sie der Auswahlliste\nalle Untertodos von allen\nausgewählten Todos hinzufügen?" }, 1377{ "One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?","Ein (oder mehrere) ausgewähltes\nTodo hat Untertodos!\nMöchten Sie der Auswahlliste\nalle Untertodos von allen\nausgewählten Todos hinzufügen?" },
1378{ "Print List View...","Drucke Listenansicht..." }, 1378{ "Print List View...","Drucke Listenansicht..." },
1379{ "You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items.","Sie können die <b>Listenansicht</b> und die Listenansicht im <b>Suchdialog</b> ausdrucken! Um das zu machen gehen Sie bitte zur <b>Listenansicht</b> oder zum <b>Suchdialog</b>. Rechtsklicken Sie auf die Liste. Wählen Sie im Popupmenu den Eintrag <b>Drucke komplette Liste</b>. Das druckt die Liste so, wie man sie sieht. Sie können Listeneinträge entfernen ohne die korrespondierenden Ereignisse/Todos zu löschen! Selektieren sie einfach alle Einträge, die sie nicht ausdrucken möchten. Dann Rechtsklicken Sie auf einen Eintrag und wählen <b>Verstecke Selektierte</b>. Danach können Sie die Liste ohne diese Einträge ausdrucken." }, 1379{ "You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items.","Sie können die <b>Listenansicht</b> und die Listenansicht im <b>Suchdialog</b> ausdrucken! Um das zu machen gehen Sie bitte zur <b>Listenansicht</b> oder zum <b>Suchdialog</b>. Rechtsklicken Sie auf die Liste. Wählen Sie im Popupmenu den Eintrag <b>Drucke komplette Liste</b>. Das druckt die Liste so, wie man sie sieht. Sie können Listeneinträge entfernen ohne die korrespondierenden Ereignisse/Todos zu löschen! Selektieren sie einfach alle Einträge, die sie nicht ausdrucken möchten. Dann Rechtsklicken Sie auf einen Eintrag und wählen <b>Verstecke Selektierte</b>. Danach können Sie die Liste ohne diese Einträge ausdrucken." },
1380{ "Configure KO/Pi...","Konfiguriere KO/Pi..." }, 1380{ "Configure KO/Pi...","Konfiguriere KO/Pi..." },
1381{ "Global Settings...","Globale Einstellungen..." }, 1381{ "Global Settings...","Globale Einstellungen..." },
1382{ "<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n","<p><b>R</b>: Zeige Resource Ansicht | <b>F</b>: Editiere Filter </p>\n" }, 1382{ "<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n","<p><b>R</b>: Zeige Resource Ansicht | <b>F</b>: Editiere Filter </p>\n" },
1383{ "(disabled)","(abgeschaltet)" }, 1383{ "(disabled)","(abgeschaltet)" },
1384{ "New Calendar","Neuer Kalender" }, 1384{ "New Calendar","Neuer Kalender" },
1385{ "Calendar","Kalender" }, 1385{ "Calendar","Kalender" },
1386{ "Filter selector","Filterauswahl" }, 1386{ "Filter selector","Filterauswahl" },
1387{ "Filtermenu","Filtermenu" }, 1387{ "Filtermenu","Filtermenu" },
1388{ "Toggle Fullscreen","Vollbild umschalten" }, 1388{ "Toggle Fullscreen","Vollbild umschalten" },
1389{ "Toggle Resource View","Resourcenansicht umschalten" }, 1389{ "Toggle Resource View","Resourcenansicht umschalten" },
1390{ "Storage HowTo...","Speicherort HowTo..." }, 1390{ "Storage HowTo...","Speicherort HowTo..." },
1391{ "Timetracking HowTo...","Timetracking HowTo..." }, 1391{ "Timetracking HowTo...","Timetracking HowTo..." },
1392{ "Juni","Juni" }, 1392{ "Juni","Juni" },
1393{ "Juli","Juli" }, 1393{ "Juli","Juli" },
1394{ "ToDo:","ToDo:" }, 1394{ "ToDo:","ToDo:" },
1395{ "Set Calendar","Setze Kalender" }, 1395{ "Set Calendar","Setze Kalender" },
1396{ "Todo: %1","Todo: %1" }, 1396{ "Todo: %1","Todo: %1" },
1397{ ": (Prio ",": (Prio " }, 1397{ ": (Prio ",": (Prio " },
1398{ "Todos","Todos" }, 1398{ "Todos","Todos" },
1399{ "Todo Viewer","Todo Viewer" }, 1399{ "Todo Viewer","Todo Viewer" },
1400{ "Todo ","Todo " }, 1400{ "Todo ","Todo " },
1401{ " Calendar \n Resource "," Kalender \n Resource " }, 1401{ " Calendar \n Resource "," Kalender \n Resource " },
1402{ " Color "," Farbe " }, 1402{ " Color "," Farbe " },
1403{ "The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)","Der Kalender <b>%1</b> zeigt die Datei <b>%2</b>. Möchten Sie diesen Kalender aus KO/Pi entfernen? (Die Datei wird dabei nicht gelöscht!)" }, 1403{ "The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)","Der Kalender <b>%1</b> zeigt die Datei <b>%2</b>. Möchten Sie diesen Kalender aus KO/Pi entfernen? (Die Datei wird dabei nicht gelöscht!)" },
1404{ "The calendar <b>%1</b> is displaying file <b>%2</b>","Der Kalender <b>%1</b> zeigt die Datei <b>%2</b>" }, 1404{ "The calendar <b>%1</b> is displaying file <b>%2</b>","Der Kalender <b>%1</b> zeigt die Datei <b>%2</b>" },
1405{ "Add new Calendar","Füge Kalender hinzu" }, 1405{ "Add new Calendar","Füge Kalender hinzu" },
1406{ "<b>Name of new calendar:</b>","<b>Name des Kalenders:</b>" }, 1406{ "<b>Name of new calendar:</b>","<b>Name des Kalenders:</b>" },
1407{ "<b>Local ical (*.ics) file:</b>","<b>Lokale ical (*.ics) Datei:</b>" }, 1407{ "<b>Local ical (*.ics) file:</b>","<b>Lokale ical (*.ics) Datei:</b>" },
1408{ "Sorry, the calendar name is empty!","Sorry, der Kalendername ist leer!" }, 1408{ "Sorry, the calendar name is empty!","Sorry, der Kalendername ist leer!" },
1409{ "Sorry, the file name is empty!","Sorry, der Dateiname ist leer!" }, 1409{ "Sorry, the file name is empty!","Sorry, der Dateiname ist leer!" },
1410{ "Error loading calendar file\n%1.","Fehler beim Laden der Kalenderdatei\n%1." }, 1410{ "Error loading calendar file\n%1.","Fehler beim Laden der Kalenderdatei\n%1." },
1411{ "The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>","Der Kalender <b>%1</b> ist nicht geladen! Das Laden der Datei <b>%2</b> schlug fehl! <b>Soll erneut versucht werden den Kalender zu laden?</b>" }, 1411{ "The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>","Der Kalender <b>%1</b> ist nicht geladen! Das Laden der Datei <b>%2</b> schlug fehl! <b>Soll erneut versucht werden den Kalender zu laden?</b>" },
1412{ "Global application font for all apps:","Globale Schriftart:" }, 1412{ "Global application font for all apps:","Globale Schriftart:" },
1413{ "Application Font","Applikationsschriftart" }, 1413{ "Application Font","Applikationsschriftart" },
1414{ "Kx/Pi","Kx/Pi" }, 1414{ "Kx/Pi","Kx/Pi" },
1415{ "Backup","Backup" }, 1415{ "Backup","Backup" },
1416{ "KDE-Pim Global Settings","KDE-Pim Globale Einstellungen" }, 1416{ "KDE-Pim Global Settings","KDE-Pim Globale Einstellungen" },
1417{ "Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!","Sorry, der Kalendername \n%1\nist schon in Benutzung!\nBitte wählen Sie einen anderen!" }, 1417{ "Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!","Sorry, der Kalendername \n%1\nist schon in Benutzung!\nBitte wählen Sie einen anderen!" },
1418{ "Sorry, the file \n%1\nis already loaded!\nPlease choose another file!","Sorry, die Datei \n%1\nist schon geladen!\nBitte wählen Sie eine andere!" }, 1418{ "Sorry, the file \n%1\nis already loaded!\nPlease choose another file!","Sorry, die Datei \n%1\nist schon geladen!\nBitte wählen Sie eine andere!" },
1419{ "Choose Color","Wähle Farbe" }, 1419{ "Choose Color","Wähle Farbe" },
1420{ " OK "," OK " }, 1420{ " OK "," OK " },
1421{ " Cancel "," Abbrechen " }, 1421{ " Cancel "," Abbrechen " },
1422{ "Matching items will be added to list","Passende werden zur Liste hinzugefügt" }, 1422{ "Matching items will be added to list","Passende werden zur Liste hinzugefügt" },
1423{ "Matching items will be removed from list","Passende werden von der Liste entfernt" }, 1423{ "Matching items will be removed from list","Passende werden von der Liste entfernt" },
1424{ "Search on displayed list only","Suche auf der dargestellten Liste" }, 1424{ "Search on displayed list only","Suche auf der dargestellten Liste" },
1425{ "List will be cleared before search","Liste wird vor der Suche gelöscht" }, 1425{ "List will be cleared before search","Liste wird vor der Suche gelöscht" },
1426{ "<center>%1</center> <center>is not running. Do you want to set\nthe state to running?</center>","<center>%1</center> <center>ist nicht am Laufen. Möchten Sie den Zustand auf "laufend" setzen?</center>" }, 1426{ "<center>%1</center> <center>is not running. Do you want to set\nthe state to running?</center>","<center>%1</center> <center>ist nicht am Laufen. Möchten Sie den Zustand auf "laufend" setzen?</center>" },
1427{ "%1\nis running!","%1\nist am Laufen!" }, 1427{ "%1\nis running!","%1\nist am Laufen!" },
1428{ "Additional Comment:","Zusätzlicher Kommentar:" }, 1428{ "Additional Comment:","Zusätzlicher Kommentar:" },
1429{ "Stop and save","Stopp und Speichern" }, 1429{ "Stop and save","Stopp und Speichern" },
1430{ "Continue running","Weiter laufen lassen" }, 1430{ "Continue running","Weiter laufen lassen" },
1431{ "Stop - do not save","Stopp - nicht Speichern" }, 1431{ "Stop - do not save","Stopp - nicht Speichern" },
1432{ "Do you really want to set\nthe state to stopped\nwithout saving the data?","Möchten sie den Zustand\nwirklich auf gestoppt setzen\nohne die Daten abzuspeichern?" }, 1432{ "Do you really want to set\nthe state to stopped\nwithout saving the data?","Möchten sie den Zustand\nwirklich auf gestoppt setzen\nohne die Daten abzuspeichern?" },
1433{ "Time mismatch!","Zeiten stimmen nicht!" }, 1433{ "Time mismatch!","Zeiten stimmen nicht!" },
1434{ "The start time is\nafter the end time!","Die Startzeit ist\nhinter der Endzeit!" }, 1434{ "The start time is\nafter the end time!","Die Startzeit ist\nhinter der Endzeit!" },
1435{ "Yes, stop todo","Ja, stoppe Todo" }, 1435{ "Yes, stop todo","Ja, stoppe Todo" },
1436{ "Todo stopped - no data saved because runtime was < 15 sec!","Todo gestoppt - nichts gespeichert da Laufzeit < 15 sec!" }, 1436{ "Todo stopped - no data saved because runtime was < 15 sec!","Todo gestoppt - nichts gespeichert da Laufzeit < 15 sec!" },
1437{ "Todo started! Double click again to stop!","Todo gestartet! Doppelklicke um es zu stoppen!" }, 1437{ "Todo started! Double click again to stop!","Todo gestartet! Doppelklicke um es zu stoppen!" },
1438{ "Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.","Bitte wählen Sie den <b>Default-Kalender</b> in dieser Spalte. Neu angelegte oder importierte Einträge werden dem Default-Kalender hinzugefügt." }, 1438{ "Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.","Bitte wählen Sie den <b>Default-Kalender</b> in dieser Spalte. Neu angelegte oder importierte Einträge werden dem Default-Kalender hinzugefügt." },
1439{ "Spouse","Ehegatte" }, 1439{ "Spouse","Ehegatte" },
1440{ "Notes","Notizen" }, 1440{ "Notes","Notizen" },
1441{ "Messanger","Messanger" }, 1441{ "Messanger","Messanger" },
1442{ "Assistant","Assistent" }, 1442{ "Assistant","Assistent" },
1443{ "Manager","Manager" }, 1443{ "Manager","Manager" },
1444{ "Secrecy","Sichtbar" }, 1444{ "Secrecy","Sichtbar" },
1445{ "male","männlich" }, 1445{ "male","männlich" },
1446{ "female","weiblich" }, 1446{ "female","weiblich" },
1447{ "Hide!","Verbergen!" }, 1447{ "Hide!","Verbergen!" },
1448{ "Show!","Anzeigen!" }, 1448{ "Show!","Anzeigen!" },
1449{ "Details","Details" }, 1449{ "Details","Details" },
1450{ "Profession","Beruf" }, 1450{ "Profession","Beruf" },
1451{ "Children","Kinder" }, 1451{ "Children","Kinder" },
1452{ "Department","Abteilung" }, 1452{ "Department","Abteilung" },
1453{ "Backup cancelled","Backup abgebrochen" }, 1453{ "Backup cancelled","Backup abgebrochen" },
1454{ "Backup globally disabled","Backup global abgeschaltet" }, 1454{ "Backup globally disabled","Backup global abgeschaltet" },
1455{ "Backup succesfully finished","Backup erfolgreich beendet" }, 1455{ "Backup succesfully finished","Backup erfolgreich beendet" },
1456{ "(Hint: You can enable automatic backup in the global settings!)","(Hinweis: Sie können ein automatisches Backup in den globalen Einstellungen konfigurieren!)" }, 1456{ "(Hint: You can enable automatic backup in the global settings!)","(Hinweis: Sie können ein automatisches Backup in den globalen Einstellungen konfigurieren!)" },
1457{ "This will <b>backup all calendar files</b> to the directory %1 %2","Das schreibt ein <b>Backup aller Kalenderdateien</b> in das Verzeichnis %1 %2" }, 1457{ "This will <b>backup all calendar files</b> to the directory %1 %2","Das schreibt ein <b>Backup aller Kalenderdateien</b> in das Verzeichnis %1 %2" },
1458{ "Birthdays","Geburtstage" }, 1458{ "Birthdays","Geburtstage" },
1459{ "KO/Pi import information!","KO/Pi Import Information!" }, 1459{ "KO/Pi import information!","KO/Pi Import Information!" },
1460{ "Start this todo\nand stop all running","Starte dieses Todo\nund stoppe alle Laufenden" },
1461{ "Cancel - do not start"," Abbrechen - Todo nicht starten" },
1462{ "","" },
1460{ "","" }, 1463{ "","" },
1461{ "","" }, 1464{ "","" },
1462{ "","" }, 1465{ "","" },
1463{ "","" }, 1466{ "","" },
1464{ "","" }, \ No newline at end of file 1467{ "","" }, \ No newline at end of file
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 7349d20..1bfdef9 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -1,257 +1,287 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program 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 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qheader.h> 25#include <qheader.h>
26#include <qcursor.h> 26#include <qcursor.h>
27#include <qwhatsthis.h> 27#include <qwhatsthis.h>
28#include <qdialog.h> 28#include <qdialog.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31 31
32#include <qinputdialog.h> 32#include <qinputdialog.h>
33 33
34#include <qvbox.h> 34#include <qvbox.h>
35#include <kdebug.h> 35#include <kdebug.h>
36#include "koprefs.h" 36#include "koprefs.h"
37#include <klocale.h> 37#include <klocale.h>
38#include <kglobal.h> 38#include <kglobal.h>
39#include <kdateedit.h> 39#include <kdateedit.h>
40#include "ktimeedit.h" 40#include "ktimeedit.h"
41#include <kiconloader.h> 41#include <kiconloader.h>
42#include <kmessagebox.h> 42#include <kmessagebox.h>
43 43
44#include <libkcal/icaldrag.h> 44#include <libkcal/icaldrag.h>
45#include <libkcal/vcaldrag.h> 45#include <libkcal/vcaldrag.h>
46#include <libkcal/calfilter.h> 46#include <libkcal/calfilter.h>
47#include <libkcal/dndfactory.h> 47#include <libkcal/dndfactory.h>
48#include <libkcal/calendarresources.h> 48#include <libkcal/calendarresources.h>
49#include <libkcal/resourcecalendar.h> 49#include <libkcal/resourcecalendar.h>
50#include <kresources/resourceselectdialog.h> 50#include <kresources/resourceselectdialog.h>
51#include <libkcal/kincidenceformatter.h> 51#include <libkcal/kincidenceformatter.h>
52#ifndef DESKTOP_VERSION 52#ifndef DESKTOP_VERSION
53#include <qpe/qpeapplication.h> 53#include <qpe/qpeapplication.h>
54#else 54#else
55#include <qapplication.h> 55#include <qapplication.h>
56#endif 56#endif
57#ifndef KORG_NOPRINTER 57#ifndef KORG_NOPRINTER
58#include "calprinter.h" 58#include "calprinter.h"
59#endif 59#endif
60#include "docprefs.h" 60#include "docprefs.h"
61 61
62#include "kotodoview.h" 62#include "kotodoview.h"
63using namespace KOrg; 63using namespace KOrg;
64 64
65 65
66KOStartTodoPrefs::KOStartTodoPrefs( QString sum, QWidget *parent, const char *name ) :
67 QDialog( parent, name, true )
68{
69 mStopAll = true;
70 setCaption( i18n("Start todo") );
71 QVBoxLayout* lay = new QVBoxLayout( this );
72 lay->setSpacing( 3 );
73 lay->setMargin( 3 );
74 QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( sum ), this );
75 lay->addWidget( lab );
76 lab->setAlignment( AlignCenter );
77
78 QPushButton * ok = new QPushButton( i18n("Start this todo\nand stop all running"), this );
79 lay->addWidget( ok );
80 ok->setDefault( true );
81 QPushButton * start = new QPushButton( i18n("Start todo"), this );
82 lay->addWidget( start );
83 QPushButton * cancel = new QPushButton( i18n("Cancel - do not start"), this );
84 lay->addWidget( cancel );
85 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
86 connect ( start,SIGNAL(clicked() ),this , SLOT ( doStop() ) );
87 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
88 resize( sizeHint() );
89
90}
91void KOStartTodoPrefs::doStop()
92{
93 mStopAll = false;
94 accept();
95}
66KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) : 96KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) :
67 QDialog( parent, name, true ) 97 QDialog( parent, name, true )
68{ 98{
69 mTodo = todo; 99 mTodo = todo;
70 setCaption( i18n("Stop todo") ); 100 setCaption( i18n("Stop todo") );
71 QVBoxLayout* lay = new QVBoxLayout( this ); 101 QVBoxLayout* lay = new QVBoxLayout( this );
72 lay->setSpacing( 3 ); 102 lay->setSpacing( 3 );
73 lay->setMargin( 3 ); 103 lay->setMargin( 3 );
74 QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( todo->summary() ), this ); 104 QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( todo->summary() ), this );
75 lay->addWidget( lab ); 105 lay->addWidget( lab );
76 lab->setAlignment( AlignHCenter ); 106 lab->setAlignment( AlignHCenter );
77 lab = new QLabel( i18n("Additional Comment:"), this ); 107 lab = new QLabel( i18n("Additional Comment:"), this );
78 lay->addWidget( lab ); 108 lay->addWidget( lab );
79 mComment = new QLineEdit( this ); 109 mComment = new QLineEdit( this );
80 lay->addWidget( mComment ); 110 lay->addWidget( mComment );
81 QHBox * start = new QHBox ( this ); 111 QHBox * start = new QHBox ( this );
82 lay->addWidget( start ); 112 lay->addWidget( start );
83 lab = new QLabel( i18n("Start:"), start ); 113 lab = new QLabel( i18n("Start:"), start );
84 QHBox * end = new QHBox ( this ); 114 QHBox * end = new QHBox ( this );
85 lay->addWidget( end ); 115 lay->addWidget( end );
86 lab = new QLabel( i18n("End:"), end ); 116 lab = new QLabel( i18n("End:"), end );
87 sde = new KDateEdit( start ); 117 sde = new KDateEdit( start );
88 ste = new KOTimeEdit( start ); 118 ste = new KOTimeEdit( start );
89 connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) ); 119 connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) );
90 ede = new KDateEdit( end ); 120 ede = new KDateEdit( end );
91 ete = new KOTimeEdit(end ); 121 ete = new KOTimeEdit(end );
92 connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) ); 122 connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) );
93 sde->setDate( mTodo->runStart().date() ); 123 sde->setDate( mTodo->runStart().date() );
94 ste->setTime( mTodo->runStart().time() ); 124 ste->setTime( mTodo->runStart().time() );
95 ede->setDate( QDate::currentDate()); 125 ede->setDate( QDate::currentDate());
96 ete->setTime( QTime::currentTime() ); 126 ete->setTime( QTime::currentTime() );
97 QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); 127 QPushButton * ok = new QPushButton( i18n("Stop and save"), this );
98 lay->addWidget( ok ); 128 lay->addWidget( ok );
99 ok->setDefault( true ); 129 ok->setDefault( true );
100 QPushButton * cancel = new QPushButton( i18n("Continue running"), this ); 130 QPushButton * cancel = new QPushButton( i18n("Continue running"), this );
101 lay->addWidget( cancel ); 131 lay->addWidget( cancel );
102 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 132 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
103 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 133 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
104 ok = new QPushButton( i18n("Stop - do not save"), this ); 134 ok = new QPushButton( i18n("Stop - do not save"), this );
105 connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) ); 135 connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) );
106 lay->addWidget( ok ); 136 lay->addWidget( ok );
107 if (QApplication::desktop()->width() < 320 ) 137 if (QApplication::desktop()->width() < 320 )
108 resize( 240, sizeHint().height() ); 138 resize( 240, sizeHint().height() );
109 else 139 else
110 resize( 320, sizeHint().height() ); 140 resize( 320, sizeHint().height() );
111 141
112} 142}
113 143
114void KOStopTodoPrefs::accept() 144void KOStopTodoPrefs::accept()
115{ 145{
116 QDateTime start = QDateTime( sde->date(), ste->getTime() ); 146 QDateTime start = QDateTime( sde->date(), ste->getTime() );
117 QDateTime stop = QDateTime( ede->date(), ete->getTime() ); 147 QDateTime stop = QDateTime( ede->date(), ete->getTime() );
118 if ( start > stop ) { 148 if ( start > stop ) {
119 KMessageBox::sorry(this, 149 KMessageBox::sorry(this,
120 i18n("The start time is\nafter the end time!"), 150 i18n("The start time is\nafter the end time!"),
121 i18n("Time mismatch!")); 151 i18n("Time mismatch!"));
122 return; 152 return;
123 } 153 }
124 mTodo->saveRunningInfo( mComment->text(), start, stop ); 154 mTodo->saveRunningInfo( mComment->text(), start, stop );
125 QDialog::accept(); 155 QDialog::accept();
126} 156}
127void KOStopTodoPrefs::doNotSave() 157void KOStopTodoPrefs::doNotSave()
128{ 158{
129 int result = KMessageBox::warningContinueCancel(this, 159 int result = KMessageBox::warningContinueCancel(this,
130 i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary(),i18n("Yes, stop todo") ); 160 i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary(),i18n("Yes, stop todo") );
131 if (result != KMessageBox::Continue) return; 161 if (result != KMessageBox::Continue) return;
132 mTodo->stopRunning(); 162 mTodo->stopRunning();
133 QDialog::accept(); 163 QDialog::accept();
134} 164}
135 165
136 166
137class KOTodoViewWhatsThis :public QWhatsThis 167class KOTodoViewWhatsThis :public QWhatsThis
138{ 168{
139public: 169public:
140 KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; 170 KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { };
141 171
142protected: 172protected:
143 virtual QString text( const QPoint& p) 173 virtual QString text( const QPoint& p)
144 { 174 {
145 return _view->getWhatsThisText(p) ; 175 return _view->getWhatsThisText(p) ;
146 } 176 }
147private: 177private:
148 QWidget* _wid; 178 QWidget* _wid;
149 KOTodoView * _view; 179 KOTodoView * _view;
150}; 180};
151 181
152KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, 182KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent,
153 const char *name) : 183 const char *name) :
154 KListView(parent,name) 184 KListView(parent,name)
155{ 185{
156 mName = QString ( name ); 186 mName = QString ( name );
157 mCalendar = calendar; 187 mCalendar = calendar;
158#ifndef DESKTOP_VERSION 188#ifndef DESKTOP_VERSION
159 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); 189 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
160#endif 190#endif
161 mOldCurrent = 0; 191 mOldCurrent = 0;
162 mMousePressed = false; 192 mMousePressed = false;
163 193
164 setAcceptDrops(true); 194 setAcceptDrops(true);
165 viewport()->setAcceptDrops(true); 195 viewport()->setAcceptDrops(true);
166 int size = 16; 196 int size = 16;
167 if (qApp->desktop()->width() < 300 ) 197 if (qApp->desktop()->width() < 300 )
168 size = 12; 198 size = 12;
169 setTreeStepSize( size + 6 ); 199 setTreeStepSize( size + 6 );
170 200
171} 201}
172 202
173void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) 203void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e)
174{ 204{
175#ifndef KORG_NODND 205#ifndef KORG_NODND
176// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; 206// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl;
177 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 207 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
178 !QTextDrag::canDecode( e ) ) { 208 !QTextDrag::canDecode( e ) ) {
179 e->ignore(); 209 e->ignore();
180 return; 210 return;
181 } 211 }
182 212
183 mOldCurrent = currentItem(); 213 mOldCurrent = currentItem();
184#endif 214#endif
185} 215}
186 216
187 217
188void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) 218void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e)
189{ 219{
190#ifndef KORG_NODND 220#ifndef KORG_NODND
191// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; 221// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl;
192 222
193 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 223 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
194 !QTextDrag::canDecode( e ) ) { 224 !QTextDrag::canDecode( e ) ) {
195 e->ignore(); 225 e->ignore();
196 return; 226 return;
197 } 227 }
198 228
199 e->accept(); 229 e->accept();
200#endif 230#endif
201} 231}
202 232
203void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) 233void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *)
204{ 234{
205#ifndef KORG_NODND 235#ifndef KORG_NODND
206// kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; 236// kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl;
207 237
208 setCurrentItem(mOldCurrent); 238 setCurrentItem(mOldCurrent);
209 setSelected(mOldCurrent,true); 239 setSelected(mOldCurrent,true);
210#endif 240#endif
211} 241}
212 242
213void KOTodoListView::contentsDropEvent(QDropEvent *e) 243void KOTodoListView::contentsDropEvent(QDropEvent *e)
214{ 244{
215#ifndef KORG_NODND 245#ifndef KORG_NODND
216// kdDebug() << "KOTodoListView::contentsDropEvent" << endl; 246// kdDebug() << "KOTodoListView::contentsDropEvent" << endl;
217 247
218 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 248 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
219 !QTextDrag::canDecode( e ) ) { 249 !QTextDrag::canDecode( e ) ) {
220 e->ignore(); 250 e->ignore();
221 return; 251 return;
222 } 252 }
223 253
224 DndFactory factory( mCalendar ); 254 DndFactory factory( mCalendar );
225 Todo *todo = factory.createDropTodo(e); 255 Todo *todo = factory.createDropTodo(e);
226 256
227 if (todo) { 257 if (todo) {
228 e->acceptAction(); 258 e->acceptAction();
229 259
230 KOTodoViewItem *destination = 260 KOTodoViewItem *destination =
231 (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); 261 (KOTodoViewItem *)itemAt(contentsToViewport(e->pos()));
232 Todo *destinationEvent = 0; 262 Todo *destinationEvent = 0;
233 if (destination) destinationEvent = destination->todo(); 263 if (destination) destinationEvent = destination->todo();
234 264
235 Todo *existingTodo = mCalendar->todo(todo->uid()); 265 Todo *existingTodo = mCalendar->todo(todo->uid());
236 266
237 if(existingTodo) { 267 if(existingTodo) {
238 Incidence *to = destinationEvent; 268 Incidence *to = destinationEvent;
239 while(to) { 269 while(to) {
240 if (to->uid() == todo->uid()) { 270 if (to->uid() == todo->uid()) {
241 KMessageBox::sorry(this, 271 KMessageBox::sorry(this,
242 i18n("Cannot move Todo to itself\nor a child of itself"), 272 i18n("Cannot move Todo to itself\nor a child of itself"),
243 i18n("Drop Todo")); 273 i18n("Drop Todo"));
244 delete todo; 274 delete todo;
245 return; 275 return;
246 } 276 }
247 to = to->relatedTo(); 277 to = to->relatedTo();
248 } 278 }
249 internalDrop = true; 279 internalDrop = true;
250 if ( destinationEvent ) 280 if ( destinationEvent )
251 reparentTodoSignal( destinationEvent, existingTodo ); 281 reparentTodoSignal( destinationEvent, existingTodo );
252 else 282 else
253 unparentTodoSignal(existingTodo); 283 unparentTodoSignal(existingTodo);
254 delete todo; 284 delete todo;
255 } else { 285 } else {
256 mCalendar->addTodo(todo); 286 mCalendar->addTodo(todo);
257 emit todoDropped(todo, KOGlobals::EVENTADDED); 287 emit todoDropped(todo, KOGlobals::EVENTADDED);
@@ -1010,419 +1040,431 @@ void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column)
1010 mPriorityPopupMenu->popup(QCursor::pos ()); break; 1040 mPriorityPopupMenu->popup(QCursor::pos ()); break;
1011 case 2: 1041 case 2:
1012 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; 1042 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break;
1013 case 3: 1043 case 3:
1014 moveTodo(); 1044 moveTodo();
1015 break; 1045 break;
1016 case 8: 1046 case 8:
1017 getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; 1047 getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break;
1018 default: 1048 default:
1019 mItemPopupMenu->popup(QCursor::pos()); 1049 mItemPopupMenu->popup(QCursor::pos());
1020 } 1050 }
1021 } else mPopupMenu->popup(QCursor::pos()); 1051 } else mPopupMenu->popup(QCursor::pos());
1022} 1052}
1023void KOTodoView::newTodo() 1053void KOTodoView::newTodo()
1024{ 1054{
1025 emit newTodoSignal(); 1055 emit newTodoSignal();
1026} 1056}
1027 1057
1028void KOTodoView::newSubTodo() 1058void KOTodoView::newSubTodo()
1029{ 1059{
1030 if (mActiveItem) { 1060 if (mActiveItem) {
1031 emit newSubTodoSignal(mActiveItem->todo()); 1061 emit newSubTodoSignal(mActiveItem->todo());
1032 } 1062 }
1033} 1063}
1034void KOTodoView::unparentTodo() 1064void KOTodoView::unparentTodo()
1035{ 1065{
1036 if (mActiveItem) { 1066 if (mActiveItem) {
1037 emit unparentTodoSignal(mActiveItem->todo()); 1067 emit unparentTodoSignal(mActiveItem->todo());
1038 } 1068 }
1039} 1069}
1040 1070
1041void KOTodoView::reparentTodo() 1071void KOTodoView::reparentTodo()
1042{ 1072{
1043 if (mActiveItem) { 1073 if (mActiveItem) {
1044 topLevelWidget()->setCaption(i18n("Click on new parent item")); 1074 topLevelWidget()->setCaption(i18n("Click on new parent item"));
1045 pendingSubtodo = mActiveItem; 1075 pendingSubtodo = mActiveItem;
1046 } 1076 }
1047} 1077}
1048void KOTodoView::editTodo() 1078void KOTodoView::editTodo()
1049{ 1079{
1050 if (mActiveItem) { 1080 if (mActiveItem) {
1051 emit editTodoSignal(mActiveItem->todo()); 1081 emit editTodoSignal(mActiveItem->todo());
1052 } 1082 }
1053} 1083}
1054void KOTodoView::cloneTodo() 1084void KOTodoView::cloneTodo()
1055{ 1085{
1056 if (mActiveItem) { 1086 if (mActiveItem) {
1057 emit cloneTodoSignal((Incidence*)mActiveItem->todo()); 1087 emit cloneTodoSignal((Incidence*)mActiveItem->todo());
1058 } 1088 }
1059} 1089}
1060void KOTodoView::cancelTodo() 1090void KOTodoView::cancelTodo()
1061{ 1091{
1062 if (mActiveItem) { 1092 if (mActiveItem) {
1063 emit cancelTodoSignal((Incidence*)mActiveItem->todo()); 1093 emit cancelTodoSignal((Incidence*)mActiveItem->todo());
1064 } 1094 }
1065} 1095}
1066void KOTodoView::moveTodo() 1096void KOTodoView::moveTodo()
1067{ 1097{
1068 if (mActiveItem) { 1098 if (mActiveItem) {
1069 emit moveTodoSignal((Incidence*)mActiveItem->todo()); 1099 emit moveTodoSignal((Incidence*)mActiveItem->todo());
1070 } 1100 }
1071} 1101}
1072void KOTodoView::beamTodo() 1102void KOTodoView::beamTodo()
1073{ 1103{
1074 if (mActiveItem) { 1104 if (mActiveItem) {
1075 emit beamTodoSignal((Incidence*)mActiveItem->todo()); 1105 emit beamTodoSignal((Incidence*)mActiveItem->todo());
1076 } 1106 }
1077} 1107}
1078 1108
1079 1109
1080void KOTodoView::showTodo() 1110void KOTodoView::showTodo()
1081{ 1111{
1082 if (mActiveItem) { 1112 if (mActiveItem) {
1083 emit showTodoSignal(mActiveItem->todo()); 1113 emit showTodoSignal(mActiveItem->todo());
1084 } 1114 }
1085} 1115}
1086 1116
1087void KOTodoView::deleteTodo() 1117void KOTodoView::deleteTodo()
1088{ 1118{
1089 if (mActiveItem) { 1119 if (mActiveItem) {
1090 emit deleteTodoSignal(mActiveItem->todo()); 1120 emit deleteTodoSignal(mActiveItem->todo());
1091 } 1121 }
1092} 1122}
1093 1123
1094void KOTodoView::setNewPriority(int index) 1124void KOTodoView::setNewPriority(int index)
1095{ 1125{
1096 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1126 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1097 mActiveItem->todo()->setPriority(mPriority[index]); 1127 mActiveItem->todo()->setPriority(mPriority[index]);
1098 mActiveItem->construct(); 1128 mActiveItem->construct();
1099 todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); 1129 todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED);
1100 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1130 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1101 } 1131 }
1102} 1132}
1103 1133
1104void KOTodoView::setNewPercentage(int index) 1134void KOTodoView::setNewPercentage(int index)
1105{ 1135{
1106 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1136 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1107 1137
1108 if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { 1138 if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) {
1109 mActiveItem->setOn( true ); 1139 mActiveItem->setOn( true );
1110 return; 1140 return;
1111 } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { 1141 } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) {
1112 KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); 1142 KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent()));
1113 if ( par && par->isOn() ) 1143 if ( par && par->isOn() )
1114 par->setOn( false ); 1144 par->setOn( false );
1115 } 1145 }
1116 if (mPercentage[index] == 100) { 1146 if (mPercentage[index] == 100) {
1117 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); 1147 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime());
1118 } else { 1148 } else {
1119 mActiveItem->todo()->setCompleted(false); 1149 mActiveItem->todo()->setCompleted(false);
1120 } 1150 }
1121 mActiveItem->todo()->setPercentComplete(mPercentage[index]); 1151 mActiveItem->todo()->setPercentComplete(mPercentage[index]);
1122 mActiveItem->construct(); 1152 mActiveItem->construct();
1123 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); 1153 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED);
1124 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1154 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1125 } 1155 }
1126} 1156}
1127 1157
1128 1158
1129QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) 1159QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem)
1130{ 1160{
1131 QPopupMenu* tempMenu = new QPopupMenu (this); 1161 QPopupMenu* tempMenu = new QPopupMenu (this);
1132 QStringList checkedCategories = todoItem->todo()->categories (); 1162 QStringList checkedCategories = todoItem->todo()->categories ();
1133 1163
1134 tempMenu->setCheckable (true); 1164 tempMenu->setCheckable (true);
1135 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); 1165 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
1136 it != KOPrefs::instance()->mCustomCategories.end (); 1166 it != KOPrefs::instance()->mCustomCategories.end ();
1137 ++it) { 1167 ++it) {
1138 int index = tempMenu->insertItem (*it); 1168 int index = tempMenu->insertItem (*it);
1139 mCategory[index] = *it; 1169 mCategory[index] = *it;
1140 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); 1170 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true);
1141 } 1171 }
1142 1172
1143 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); 1173 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int)));
1144 return tempMenu; 1174 return tempMenu;
1145 1175
1146 1176
1147} 1177}
1148void KOTodoView::changedCategories(int index) 1178void KOTodoView::changedCategories(int index)
1149{ 1179{
1150 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1180 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1151 QStringList categories = mActiveItem->todo()->categories (); 1181 QStringList categories = mActiveItem->todo()->categories ();
1152 QString colcat = categories.first(); 1182 QString colcat = categories.first();
1153 if (categories.find (mCategory[index]) != categories.end ()) 1183 if (categories.find (mCategory[index]) != categories.end ())
1154 categories.remove (mCategory[index]); 1184 categories.remove (mCategory[index]);
1155 else 1185 else
1156 categories.insert (categories.end(), mCategory[index]); 1186 categories.insert (categories.end(), mCategory[index]);
1157 categories.sort (); 1187 categories.sort ();
1158 if ( !colcat.isEmpty() ) { 1188 if ( !colcat.isEmpty() ) {
1159 if ( categories.find ( colcat ) != categories.end () ) { 1189 if ( categories.find ( colcat ) != categories.end () ) {
1160 categories.remove( colcat ); 1190 categories.remove( colcat );
1161 categories.prepend( colcat ); 1191 categories.prepend( colcat );
1162 } 1192 }
1163 } 1193 }
1164 mActiveItem->todo()->setCategories (categories); 1194 mActiveItem->todo()->setCategories (categories);
1165 mActiveItem->construct(); 1195 mActiveItem->construct();
1166 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1196 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1167 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); 1197 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED);
1168 } 1198 }
1169} 1199}
1170void KOTodoView::itemDoubleClicked(QListViewItem *item) 1200void KOTodoView::itemDoubleClicked(QListViewItem *item)
1171{ 1201{
1172 if ( pendingSubtodo != 0 ) { 1202 if ( pendingSubtodo != 0 ) {
1173 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1203 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1174 } 1204 }
1175 pendingSubtodo = 0; 1205 pendingSubtodo = 0;
1176 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); 1206 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() );
1177 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); 1207 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() );
1178 //qDebug("ROW %d ", row); 1208 //qDebug("ROW %d ", row);
1179 if (!item) { 1209 if (!item) {
1180 newTodo(); 1210 newTodo();
1181 return; 1211 return;
1182 } else { 1212 } else {
1183 if ( row == 1 ) { 1213 if ( row == 1 ) {
1184 mActiveItem = (KOTodoViewItem *) item; 1214 mActiveItem = (KOTodoViewItem *) item;
1185 newSubTodo(); 1215 newSubTodo();
1186 return; 1216 return;
1187 } 1217 }
1188 if ( row == 5 || row == 6 || row == 2) { 1218 if ( row == 5 || row == 6 || row == 2) {
1189 mActiveItem = (KOTodoViewItem *) item; 1219 mActiveItem = (KOTodoViewItem *) item;
1190 Todo * t = mActiveItem->todo(); 1220 Todo * t = mActiveItem->todo();
1191 if ( t->isRunning() ) { 1221 if ( t->isRunning() ) {
1192 if ( t->runTime() < 15) { 1222 if ( t->runTime() < 15) {
1193 t->stopRunning(); 1223 t->stopRunning();
1194 mActiveItem->construct(); 1224 mActiveItem->construct();
1195 topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!")); 1225 topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!"));
1196 return; 1226 return;
1197 } 1227 }
1198 else 1228 else
1199 toggleRunningItem(); 1229 toggleRunningItem();
1200 return; 1230 return;
1201 } else { 1231 } else {
1202 t->setRunning( true ); 1232 t->setRunning( true );
1203 mActiveItem->construct(); 1233 mActiveItem->construct();
1204 topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!")); 1234 topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!"));
1205 return; 1235 return;
1206 } 1236 }
1207 } 1237 }
1208 } 1238 }
1209 if ( KOPrefs::instance()->mEditOnDoubleClick ) 1239 if ( KOPrefs::instance()->mEditOnDoubleClick )
1210 editItem( item ); 1240 editItem( item );
1211 else 1241 else
1212 showItem( item , QPoint(), 0 ); 1242 showItem( item , QPoint(), 0 );
1213} 1243}
1214void KOTodoView::toggleRunningItem() 1244void KOTodoView::toggleRunningItem()
1215{ 1245{
1216 // qDebug("KOTodoView::toggleRunning() "); 1246 // qDebug("KOTodoView::toggleRunning() ");
1217 if ( ! mActiveItem ) 1247 if ( ! mActiveItem )
1218 return; 1248 return;
1219 Todo * t = mActiveItem->todo(); 1249 Todo * t = mActiveItem->todo();
1220 if ( t->isRunning() ) { 1250 if ( t->isRunning() ) {
1221 KOStopTodoPrefs tp ( t, this ); 1251 KOStopTodoPrefs tp ( t, this );
1222 if (QApplication::desktop()->width() < 800 ){ 1252 if (QApplication::desktop()->width() <= 800 ){
1223 int wid = tp.width(); 1253 int wid = tp.width();
1224 int hei = tp.height(); 1254 int hei = tp.height();
1225 int xx = (QApplication::desktop()->width()-wid)/2; 1255 int xx = (QApplication::desktop()->width()-wid)/2;
1226 int yy = (QApplication::desktop()->height()-hei)/2; 1256 int yy = (QApplication::desktop()->height()-hei)/2;
1227 tp.setGeometry( xx,yy,wid,hei ); 1257 tp.setGeometry( xx,yy,wid,hei );
1228 } 1258 }
1229 tp.exec(); 1259 tp.exec();
1230 mActiveItem->construct(); 1260 mActiveItem->construct();
1231 } else { 1261 } else {
1232 int result = KMessageBox::warningContinueCancel(this, 1262 KOStartTodoPrefs tp ( t->summary(), this );
1233 i18n("<center>%1</center> <center>is not running. Do you want to set\nthe state to running?</center>").arg(mActiveItem->text(0).left( 25 ) ),i18n("Start todo"),i18n("Start todo"),i18n("Cancel"), true); 1263 if (QApplication::desktop()->width() <= 800 ){
1234 if (result != KMessageBox::Continue) return; 1264 int wid = tp.width();
1235 t->setRunning( true ); 1265 int hei = tp.height();
1236 mActiveItem->construct(); 1266 int xx = (QApplication::desktop()->width()-wid)/2;
1267 int yy = (QApplication::desktop()->height()-hei)/2;
1268 tp.setGeometry( xx,yy,wid,hei );
1269 }
1270 if ( !tp.exec() ) return;
1271 if ( tp.stopAll() ) {
1272 mCalendar->stopAllTodos();
1273 t->setRunning( true );
1274 updateView();
1275 } else {
1276 t->setRunning( true );
1277 mActiveItem->construct();
1278 }
1237 } 1279 }
1238} 1280}
1239 1281
1240void KOTodoView::itemClicked(QListViewItem *item) 1282void KOTodoView::itemClicked(QListViewItem *item)
1241{ 1283{
1242 //qDebug("KOTodoView::itemClicked %d", item); 1284 //qDebug("KOTodoView::itemClicked %d", item);
1243 if (!item) { 1285 if (!item) {
1244 if ( pendingSubtodo != 0 ) { 1286 if ( pendingSubtodo != 0 ) {
1245 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1287 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1246 } 1288 }
1247 pendingSubtodo = 0; 1289 pendingSubtodo = 0;
1248 return; 1290 return;
1249 } 1291 }
1250 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1292 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1251 if ( pendingSubtodo != 0 ) { 1293 if ( pendingSubtodo != 0 ) {
1252 bool allowReparent = true; 1294 bool allowReparent = true;
1253 QListViewItem *par = item; 1295 QListViewItem *par = item;
1254 while ( par ) { 1296 while ( par ) {
1255 if ( par == pendingSubtodo ) { 1297 if ( par == pendingSubtodo ) {
1256 allowReparent = false; 1298 allowReparent = false;
1257 break; 1299 break;
1258 } 1300 }
1259 par = par->parent(); 1301 par = par->parent();
1260 } 1302 }
1261 if ( !allowReparent ) { 1303 if ( !allowReparent ) {
1262 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); 1304 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
1263 pendingSubtodo = 0; 1305 pendingSubtodo = 0;
1264 } else { 1306 } else {
1265 Todo* newParent = todoItem->todo(); 1307 Todo* newParent = todoItem->todo();
1266 Todo* newSub = pendingSubtodo->todo(); 1308 Todo* newSub = pendingSubtodo->todo();
1267 pendingSubtodo = 0; 1309 pendingSubtodo = 0;
1268 emit reparentTodoSignal( newParent,newSub ); 1310 emit reparentTodoSignal( newParent,newSub );
1269 return; 1311 return;
1270 } 1312 }
1271 } 1313 }
1272 1314
1273} 1315}
1274 1316
1275void KOTodoView::setDocumentId( const QString &id ) 1317void KOTodoView::setDocumentId( const QString &id )
1276{ 1318{
1277 1319
1278 mDocPrefs->setDoc( id ); 1320 mDocPrefs->setDoc( id );
1279} 1321}
1280 1322
1281void KOTodoView::itemStateChanged( QListViewItem *item ) 1323void KOTodoView::itemStateChanged( QListViewItem *item )
1282{ 1324{
1283 if (!item) return; 1325 if (!item) return;
1284 1326
1285 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1327 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1286 1328
1287// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; 1329// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl;
1288 1330
1289 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); 1331 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() );
1290} 1332}
1291 1333
1292void KOTodoView::saveLayout(KConfig *config, const QString &group) const 1334void KOTodoView::saveLayout(KConfig *config, const QString &group) const
1293{ 1335{
1294 mTodoListView->saveLayout(config,group); 1336 mTodoListView->saveLayout(config,group);
1295} 1337}
1296 1338
1297void KOTodoView::restoreLayout(KConfig *config, const QString &group) 1339void KOTodoView::restoreLayout(KConfig *config, const QString &group)
1298{ 1340{
1299 mTodoListView->restoreLayout(config,group); 1341 mTodoListView->restoreLayout(config,group);
1300} 1342}
1301 1343
1302void KOTodoView::processSelectionChange() 1344void KOTodoView::processSelectionChange()
1303{ 1345{
1304// kdDebug() << "KOTodoView::processSelectionChange()" << endl; 1346// kdDebug() << "KOTodoView::processSelectionChange()" << endl;
1305 1347
1306 KOTodoViewItem *item = 1348 KOTodoViewItem *item =
1307 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); 1349 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() );
1308 1350
1309 if ( !item ) { 1351 if ( !item ) {
1310 emit incidenceSelected( 0 ); 1352 emit incidenceSelected( 0 );
1311 } else { 1353 } else {
1312 emit incidenceSelected( item->todo() ); 1354 emit incidenceSelected( item->todo() );
1313 } 1355 }
1314} 1356}
1315 1357
1316void KOTodoView::modified(bool b) 1358void KOTodoView::modified(bool b)
1317{ 1359{
1318 emit isModified(b); 1360 emit isModified(b);
1319} 1361}
1320void KOTodoView::setTodoModified( Todo* todo ) 1362void KOTodoView::setTodoModified( Todo* todo )
1321{ 1363{
1322 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); 1364 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED );
1323} 1365}
1324void KOTodoView::clearSelection() 1366void KOTodoView::clearSelection()
1325{ 1367{
1326 mTodoListView->selectAll( false ); 1368 mTodoListView->selectAll( false );
1327} 1369}
1328void KOTodoView::setAllOpen() 1370void KOTodoView::setAllOpen()
1329{ 1371{
1330 if ( isFlatDisplay ) { 1372 if ( isFlatDisplay ) {
1331 isFlatDisplay = false; 1373 isFlatDisplay = false;
1332 mPopupMenu->setItemChecked( 8,false ); 1374 mPopupMenu->setItemChecked( 8,false );
1333 updateView(); 1375 updateView();
1334 } else { 1376 } else {
1335 storeCurrentItem(); 1377 storeCurrentItem();
1336 } 1378 }
1337 setOpen(mTodoListView->firstChild(), true); 1379 setOpen(mTodoListView->firstChild(), true);
1338 resetCurrentItem(); 1380 resetCurrentItem();
1339} 1381}
1340void KOTodoView::setAllClose() 1382void KOTodoView::setAllClose()
1341{ 1383{
1342 if ( isFlatDisplay ) { 1384 if ( isFlatDisplay ) {
1343 isFlatDisplay = false; 1385 isFlatDisplay = false;
1344 mPopupMenu->setItemChecked( 8,false ); 1386 mPopupMenu->setItemChecked( 8,false );
1345 updateView(); 1387 updateView();
1346 } else { 1388 } else {
1347 storeCurrentItem(); 1389 storeCurrentItem();
1348 } 1390 }
1349 setOpen(mTodoListView->firstChild(), false); 1391 setOpen(mTodoListView->firstChild(), false);
1350 resetCurrentItem(); 1392 resetCurrentItem();
1351} 1393}
1352void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) 1394void KOTodoView::setOpen( QListViewItem* item, bool setOpenI)
1353{ 1395{
1354 1396
1355 while ( item ) { 1397 while ( item ) {
1356 setOpen( item->firstChild(), setOpenI ); 1398 setOpen( item->firstChild(), setOpenI );
1357 item->setOpen( setOpenI ); 1399 item->setOpen( setOpenI );
1358 item = item->nextSibling(); 1400 item = item->nextSibling();
1359 } 1401 }
1360} 1402}
1361 1403
1362void KOTodoView::displayAllFlat() 1404void KOTodoView::displayAllFlat()
1363{ 1405{
1364 pendingSubtodo = 0; 1406 pendingSubtodo = 0;
1365 if ( mBlockUpdate ) { 1407 if ( mBlockUpdate ) {
1366 return; 1408 return;
1367 } 1409 }
1368 mPopupMenu->setItemChecked( 8,true ); 1410 mPopupMenu->setItemChecked( 8,true );
1369 isFlatDisplay = true; 1411 isFlatDisplay = true;
1370 QPtrList<Todo> todoList = calendar()->todos(); 1412 QPtrList<Todo> todoList = calendar()->todos();
1371 mTodoMap.clear(); 1413 mTodoMap.clear();
1372 mTodoListView->clear(); 1414 mTodoListView->clear();
1373 Todo *todo; 1415 Todo *todo;
1374 for(todo = todoList.first(); todo; todo = todoList.next()) { 1416 for(todo = todoList.first(); todo; todo = todoList.next()) {
1375 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); 1417 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
1376 mTodoMap.insert(todo,todoItem); 1418 mTodoMap.insert(todo,todoItem);
1377 } 1419 }
1378 mTodoListView->setFocus(); 1420 mTodoListView->setFocus();
1379 processSelectionChange(); 1421 processSelectionChange();
1380} 1422}
1381 1423
1382void KOTodoView::setAllFlat() 1424void KOTodoView::setAllFlat()
1383{ 1425{
1384 if ( isFlatDisplay ) { 1426 if ( isFlatDisplay ) {
1385 isFlatDisplay = false; 1427 isFlatDisplay = false;
1386 mPopupMenu->setItemChecked( 8,false ); 1428 mPopupMenu->setItemChecked( 8,false );
1387 updateView(); 1429 updateView();
1388 return; 1430 return;
1389 } 1431 }
1390 storeCurrentItem(); 1432 storeCurrentItem();
1391 displayAllFlat(); 1433 displayAllFlat();
1392 resetCurrentItem(); 1434 resetCurrentItem();
1393} 1435}
1394 1436
1395void KOTodoView::purgeCompleted() 1437void KOTodoView::purgeCompleted()
1396{ 1438{
1397 emit purgeCompletedSignal(); 1439 emit purgeCompletedSignal();
1398 1440
1399} 1441}
1400void KOTodoView::toggleQuickTodo() 1442void KOTodoView::toggleQuickTodo()
1401{ 1443{
1402 if ( mQuickAdd->isVisible() ) { 1444 if ( mQuickAdd->isVisible() ) {
1403 mQuickAdd->hide(); 1445 mQuickAdd->hide();
1404 KOPrefs::instance()->mEnableQuickTodo = false; 1446 KOPrefs::instance()->mEnableQuickTodo = false;
1405 } 1447 }
1406 else { 1448 else {
1407 mQuickAdd->show(); 1449 mQuickAdd->show();
1408 KOPrefs::instance()->mEnableQuickTodo = true; 1450 KOPrefs::instance()->mEnableQuickTodo = true;
1409 } 1451 }
1410 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); 1452 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo);
1411 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); 1453 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo );
1412} 1454}
1413 1455
1414void KOTodoView::toggleRunning() 1456void KOTodoView::toggleRunning()
1415{ 1457{
1416 KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; 1458 KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos;
1417 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); 1459 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
1418 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); 1460 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos );
1419 updateView(); 1461 updateView();
1420} 1462}
1421 1463
1422void KOTodoView::toggleCompleted() 1464void KOTodoView::toggleCompleted()
1423{ 1465{
1424 KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; 1466 KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo;
1425 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); 1467 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo );
1426 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); 1468 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo );
1427 updateView(); 1469 updateView();
1428} 1470}
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index 8f0c99e..1b31d0d 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -1,270 +1,284 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program 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 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KOTODOVIEW_H 23#ifndef KOTODOVIEW_H
24#define KOTODOVIEW_H 24#define KOTODOVIEW_H
25 25
26#include <qfont.h> 26#include <qfont.h>
27#include <qfontmetrics.h> 27#include <qfontmetrics.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29#include <qptrlist.h> 29#include <qptrlist.h>
30#include <qstrlist.h> 30#include <qstrlist.h>
31#include <qlistbox.h> 31#include <qlistbox.h>
32#include <qpopupmenu.h> 32#include <qpopupmenu.h>
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qmap.h> 34#include <qmap.h>
35#include <qdialog.h> 35#include <qdialog.h>
36#include <qlabel.h> 36#include <qlabel.h>
37#include <qlistview.h> 37#include <qlistview.h>
38#include <klistview.h> 38#include <klistview.h>
39 39
40#include <libkcal/calendar.h> 40#include <libkcal/calendar.h>
41#include <libkcal/todo.h> 41#include <libkcal/todo.h>
42 42
43#include <korganizer/baseview.h> 43#include <korganizer/baseview.h>
44 44
45#include "kotodoviewitem.h" 45#include "kotodoviewitem.h"
46#include "koprefs.h" 46#include "koprefs.h"
47#include "koglobals.h" 47#include "koglobals.h"
48#include "datenavigator.h" 48#include "datenavigator.h"
49 49
50class QDragEnterEvent; 50class QDragEnterEvent;
51class QDragMoveEvent; 51class QDragMoveEvent;
52class QDragLeaveEvent; 52class QDragLeaveEvent;
53class QDropEvent; 53class QDropEvent;
54class KOTodoViewWhatsThis; 54class KOTodoViewWhatsThis;
55class KDateEdit; 55class KDateEdit;
56class KOTimeEdit; 56class KOTimeEdit;
57 57
58class DocPrefs; 58class DocPrefs;
59 59
60 60
61class KOStopTodoPrefs : public QDialog 61class KOStopTodoPrefs : public QDialog
62{ 62{
63 Q_OBJECT 63 Q_OBJECT
64 public: 64 public:
65 KOStopTodoPrefs( Todo* todo, QWidget *parent=0, const char *name=0 ) ; 65 KOStopTodoPrefs( Todo* todo, QWidget *parent=0, const char *name=0 ) ;
66 66
67 67
68private slots: 68private slots:
69 void doNotSave(); 69 void doNotSave();
70 void accept(); 70 void accept();
71private: 71private:
72 Todo* mTodo; 72 Todo* mTodo;
73 QLineEdit* mComment; 73 QLineEdit* mComment;
74 KDateEdit *sde, *ede; 74 KDateEdit *sde, *ede;
75 KOTimeEdit *ste, *ete; 75 KOTimeEdit *ste, *ete;
76 76
77}; 77};
78 78
79class KOStartTodoPrefs : public QDialog
80{
81 Q_OBJECT
82 public:
83 KOStartTodoPrefs( QString sum, QWidget *parent=0, const char *name=0 ) ;
84
85 bool stopAll() { return mStopAll; }
86private slots:
87 void doStop();
88private:
89 bool mStopAll;
90
91};
92
79class KOTodoListView : public KListView 93class KOTodoListView : public KListView
80{ 94{
81 Q_OBJECT 95 Q_OBJECT
82 public: 96 public:
83 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); 97 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0);
84 virtual ~KOTodoListView() {} 98 virtual ~KOTodoListView() {}
85 99
86 signals: 100 signals:
87 void paintNeeded(); 101 void paintNeeded();
88 void todoDropped(Todo *, int); 102 void todoDropped(Todo *, int);
89 void double_Clicked(QListViewItem *item); 103 void double_Clicked(QListViewItem *item);
90 void reparentTodoSignal( Todo *,Todo * ); 104 void reparentTodoSignal( Todo *,Todo * );
91 void unparentTodoSignal(Todo *); 105 void unparentTodoSignal(Todo *);
92 void deleteTodo( Todo * ); 106 void deleteTodo( Todo * );
93 protected: 107 protected:
94 void wheelEvent (QWheelEvent *e); 108 void wheelEvent (QWheelEvent *e);
95 void contentsDragEnterEvent(QDragEnterEvent *); 109 void contentsDragEnterEvent(QDragEnterEvent *);
96 void contentsDragMoveEvent(QDragMoveEvent *); 110 void contentsDragMoveEvent(QDragMoveEvent *);
97 void contentsDragLeaveEvent(QDragLeaveEvent *); 111 void contentsDragLeaveEvent(QDragLeaveEvent *);
98 void contentsDropEvent(QDropEvent *); 112 void contentsDropEvent(QDropEvent *);
99 113
100 void contentsMousePressEvent(QMouseEvent *); 114 void contentsMousePressEvent(QMouseEvent *);
101 void contentsMouseMoveEvent(QMouseEvent *); 115 void contentsMouseMoveEvent(QMouseEvent *);
102 void contentsMouseReleaseEvent(QMouseEvent *); 116 void contentsMouseReleaseEvent(QMouseEvent *);
103 void contentsMouseDoubleClickEvent(QMouseEvent *); 117 void contentsMouseDoubleClickEvent(QMouseEvent *);
104 118
105 private: 119 private:
106 void paintEvent(QPaintEvent * pevent); 120 void paintEvent(QPaintEvent * pevent);
107 bool internalDrop; 121 bool internalDrop;
108 QString mName; 122 QString mName;
109 Calendar *mCalendar; 123 Calendar *mCalendar;
110 QPoint mPressPos; 124 QPoint mPressPos;
111 bool mMousePressed; 125 bool mMousePressed;
112 QListViewItem *mOldCurrent; 126 QListViewItem *mOldCurrent;
113 bool mFlagKeyPressed; 127 bool mFlagKeyPressed;
114 void keyPressEvent ( QKeyEvent * ) ; 128 void keyPressEvent ( QKeyEvent * ) ;
115 void keyReleaseEvent ( QKeyEvent * ) ; 129 void keyReleaseEvent ( QKeyEvent * ) ;
116}; 130};
117 131
118 132
119/** 133/**
120 This is the line-edit on top of the todoview for fast addition of new todos 134 This is the line-edit on top of the todoview for fast addition of new todos
121*/ 135*/
122class KOQuickTodo : public QLineEdit 136class KOQuickTodo : public QLineEdit
123{ 137{
124 public: 138 public:
125 KOQuickTodo(QWidget *parent=0); 139 KOQuickTodo(QWidget *parent=0);
126 protected: 140 protected:
127 void focusInEvent(QFocusEvent *ev); 141 void focusInEvent(QFocusEvent *ev);
128 void focusOutEvent(QFocusEvent *ev); 142 void focusOutEvent(QFocusEvent *ev);
129}; 143};
130 144
131 145
132/** 146/**
133 This class provides a multi-column list view of todo events. 147 This class provides a multi-column list view of todo events.
134 148
135 @short multi-column list view of todo events. 149 @short multi-column list view of todo events.
136 @author Cornelius Schumacher <schumacher@kde.org> 150 @author Cornelius Schumacher <schumacher@kde.org>
137*/ 151*/
138class KOTodoView : public KOrg::BaseView 152class KOTodoView : public KOrg::BaseView
139{ 153{
140 Q_OBJECT 154 Q_OBJECT
141 public: 155 public:
142 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); 156 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 );
143 ~KOTodoView(); 157 ~KOTodoView();
144 158
145 QPtrList<Incidence> selectedIncidences(); 159 QPtrList<Incidence> selectedIncidences();
146 QPtrList<Todo> selectedTodos(); 160 QPtrList<Todo> selectedTodos();
147 161
148 DateList selectedDates() 162 DateList selectedDates()
149 {DateList q; 163 {DateList q;
150 return q;} 164 return q;}
151 165
152 /** Return number of shown dates. TodoView does not show dates, */ 166 /** Return number of shown dates. TodoView does not show dates, */
153 int currentDateCount() { return 0; } 167 int currentDateCount() { return 0; }
154 168
155 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); 169 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td);
156 170
157 void setDocumentId( const QString & ); 171 void setDocumentId( const QString & );
158 172
159 void saveLayout(KConfig *config, const QString &group) const; 173 void saveLayout(KConfig *config, const QString &group) const;
160 void restoreLayout(KConfig *config, const QString &group); 174 void restoreLayout(KConfig *config, const QString &group);
161 /** Create a popup menu to set categories */ 175 /** Create a popup menu to set categories */
162 QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem); 176 QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem);
163 void setNavigator( DateNavigator* nav ) {mNavigator = nav;} 177 void setNavigator( DateNavigator* nav ) {mNavigator = nav;}
164 QString getWhatsThisText(QPoint p); 178 QString getWhatsThisText(QPoint p);
165 void clearList() {mTodoListView->clear(); } 179 void clearList() {mTodoListView->clear(); }
166 180
167 public slots: 181 public slots:
168 void updateView(); 182 void updateView();
169 void updateConfig(); 183 void updateConfig();
170 184
171 void changeEventDisplay(Event *, int); 185 void changeEventDisplay(Event *, int);
172 186
173 void showDates(const QDate &start, const QDate &end); 187 void showDates(const QDate &start, const QDate &end);
174 void showEvents(QPtrList<Event> eventList); 188 void showEvents(QPtrList<Event> eventList);
175 189
176 void clearSelection(); 190 void clearSelection();
177 void jumpToDate (); 191 void jumpToDate ();
178 192
179 void editItem(QListViewItem *item); 193 void editItem(QListViewItem *item);
180 void showItem(QListViewItem *item,const QPoint &,int); 194 void showItem(QListViewItem *item,const QPoint &,int);
181 void popupMenu(QListViewItem *item,const QPoint &,int); 195 void popupMenu(QListViewItem *item,const QPoint &,int);
182 void newTodo(); 196 void newTodo();
183 void newSubTodo(); 197 void newSubTodo();
184 void unparentTodo(); 198 void unparentTodo();
185 void reparentTodo(); 199 void reparentTodo();
186 void showTodo(); 200 void showTodo();
187 void editTodo(); 201 void editTodo();
188 void cloneTodo(); 202 void cloneTodo();
189 void cancelTodo(); 203 void cancelTodo();
190 void moveTodo(); 204 void moveTodo();
191 void beamTodo(); 205 void beamTodo();
192 void deleteTodo(); 206 void deleteTodo();
193 207
194 void setNewPriority(int); 208 void setNewPriority(int);
195 void setNewPercentage(int); 209 void setNewPercentage(int);
196 void changedCategories(int); 210 void changedCategories(int);
197 211
198 void setAllOpen(); 212 void setAllOpen();
199 void setAllClose(); 213 void setAllClose();
200 void setAllFlat(); 214 void setAllFlat();
201 void displayAllFlat(); 215 void displayAllFlat();
202 216
203 void purgeCompleted(); 217 void purgeCompleted();
204 void toggleCompleted(); 218 void toggleCompleted();
205 void toggleRunning(); 219 void toggleRunning();
206 void toggleQuickTodo(); 220 void toggleQuickTodo();
207 void updateTodo( Todo *, int ); 221 void updateTodo( Todo *, int );
208 222
209 void itemClicked(QListViewItem *); 223 void itemClicked(QListViewItem *);
210 void itemStateChanged(QListViewItem *); 224 void itemStateChanged(QListViewItem *);
211 void modified(bool); 225 void modified(bool);
212 void itemDoubleClicked(QListViewItem *item); 226 void itemDoubleClicked(QListViewItem *item);
213 227
214 signals: 228 signals:
215 void newTodoSignal(); 229 void newTodoSignal();
216 void newSubTodoSignal(Todo *); 230 void newSubTodoSignal(Todo *);
217 void unparentTodoSignal(Todo *); 231 void unparentTodoSignal(Todo *);
218 void reparentTodoSignal( Todo *,Todo * ); 232 void reparentTodoSignal( Todo *,Todo * );
219 void showTodoSignal(Todo *); 233 void showTodoSignal(Todo *);
220 234
221 void editTodoSignal(Todo *); 235 void editTodoSignal(Todo *);
222 void deleteTodoSignal(Todo *); 236 void deleteTodoSignal(Todo *);
223 void todoModifiedSignal (Todo *, int); 237 void todoModifiedSignal (Todo *, int);
224 238
225 void isModified(bool); 239 void isModified(bool);
226 void cloneTodoSignal( Incidence * ); 240 void cloneTodoSignal( Incidence * );
227 void cancelTodoSignal( Incidence * ); 241 void cancelTodoSignal( Incidence * );
228 void moveTodoSignal( Incidence * ); 242 void moveTodoSignal( Incidence * );
229 void beamTodoSignal( Incidence * ); 243 void beamTodoSignal( Incidence * );
230 void purgeCompletedSignal(); 244 void purgeCompletedSignal();
231 245
232 protected slots: 246 protected slots:
233 void toggleRunningItem(); 247 void toggleRunningItem();
234 void paintNeeded(); 248 void paintNeeded();
235 void processSelectionChange(); 249 void processSelectionChange();
236 void addQuickTodo(); 250 void addQuickTodo();
237 void setTodoModified( Todo* ); 251 void setTodoModified( Todo* );
238 void todoModified(Todo *, int ); 252 void todoModified(Todo *, int );
239 253
240 private: 254 private:
241 /* 255 /*
242 * the TodoEditor approach is rather unscaling in the long 256 * the TodoEditor approach is rather unscaling in the long
243 * run. 257 * run.
244 * Korganizer keeps it in memory and we need to update 258 * Korganizer keeps it in memory and we need to update
245 * 1. make KOTodoViewItem a QObject again? 259 * 1. make KOTodoViewItem a QObject again?
246 * 2. add a public method for setting one todo modified? 260 * 2. add a public method for setting one todo modified?
247 * 3. add a private method for setting a todo modified + friend here? 261 * 3. add a private method for setting a todo modified + friend here?
248 * -- zecke 2002-07-08 262 * -- zecke 2002-07-08
249 */ 263 */
250 KOTodoViewWhatsThis* mKOTodoViewWhatsThis; 264 KOTodoViewWhatsThis* mKOTodoViewWhatsThis;
251 friend class KOTodoListView; 265 friend class KOTodoListView;
252 void paintEvent(QPaintEvent * pevent); 266 void paintEvent(QPaintEvent * pevent);
253 bool mPendingUpdateBeforeRepaint; 267 bool mPendingUpdateBeforeRepaint;
254 friend class KOTodoViewItem; 268 friend class KOTodoViewItem;
255 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); 269 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo);
256 void restoreItemState( QListViewItem * ); 270 void restoreItemState( QListViewItem * );
257 271
258 bool checkTodo( Todo * ); 272 bool checkTodo( Todo * );
259 bool isFlatDisplay; 273 bool isFlatDisplay;
260 void setOpen( QListViewItem*, bool setOpen); 274 void setOpen( QListViewItem*, bool setOpen);
261 KOTodoListView *mTodoListView; 275 KOTodoListView *mTodoListView;
262 QPopupMenu *mItemPopupMenu; 276 QPopupMenu *mItemPopupMenu;
263 QPopupMenu *mPopupMenu; 277 QPopupMenu *mPopupMenu;
264 QPopupMenu *mPriorityPopupMenu; 278 QPopupMenu *mPriorityPopupMenu;
265 QPopupMenu *mPercentageCompletedPopupMenu; 279 QPopupMenu *mPercentageCompletedPopupMenu;
266 QPopupMenu *mCategoryPopupMenu; 280 QPopupMenu *mCategoryPopupMenu;
267 281
268 QMap<int, int> mPercentage; 282 QMap<int, int> mPercentage;
269 QMap<int, int> mPriority; 283 QMap<int, int> mPriority;
270 QMap<int, QString> mCategory; 284 QMap<int, QString> mCategory;
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index 3b7b183..2efa355 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -1,271 +1,272 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 1998 Preston Brown 3 Copyright (c) 1998 Preston Brown
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version. 9 version 2 of the License, or (at your option) any later version.
10 10
11 This library is distributed in the hope that it will be useful, 11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details. 14 Library General Public License for more details.
15 15
16 You should have received a copy of the GNU Library General Public License 16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to 17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. 19 Boston, MA 02111-1307, USA.
20*/ 20*/
21 21
22#ifndef CALENDAR_H 22#ifndef CALENDAR_H
23#define CALENDAR_H 23#define CALENDAR_H
24 24
25#include <qobject.h> 25#include <qobject.h>
26#include <qstring.h> 26#include <qstring.h>
27#include <qdatetime.h> 27#include <qdatetime.h>
28#include <qptrlist.h> 28#include <qptrlist.h>
29#include <qdict.h> 29#include <qdict.h>
30 30
31#include "customproperties.h" 31#include "customproperties.h"
32#include "event.h" 32#include "event.h"
33#include "todo.h" 33#include "todo.h"
34#include "journal.h" 34#include "journal.h"
35#include "calfilter.h" 35#include "calfilter.h"
36 36
37//#define _TIME_ZONE "-0500" /* hardcoded, overridden in config file. */ 37//#define _TIME_ZONE "-0500" /* hardcoded, overridden in config file. */
38 38
39class KConfig; 39class KConfig;
40 40
41namespace KCal { 41namespace KCal {
42 42
43 43
44/** 44/**
45 This is the main "calendar" object class for KOrganizer. It holds 45 This is the main "calendar" object class for KOrganizer. It holds
46 information like all appointments/events, user information, etc. etc. 46 information like all appointments/events, user information, etc. etc.
47 one calendar is associated with each CalendarView (@see calendarview.h). 47 one calendar is associated with each CalendarView (@see calendarview.h).
48 This is an abstract base class defining the interface to a calendar. It is 48 This is an abstract base class defining the interface to a calendar. It is
49 implemented by subclasses like @see CalendarLocal, which use different 49 implemented by subclasses like @see CalendarLocal, which use different
50 methods to store and access the data. 50 methods to store and access the data.
51 51
52 Ownership of events etc. is handled by the following policy: As soon as an 52 Ownership of events etc. is handled by the following policy: As soon as an
53 event (or any other subclass of IncidenceBase) object is added to the 53 event (or any other subclass of IncidenceBase) object is added to the
54 Calendar by addEvent() it is owned by the Calendar object. The Calendar takes 54 Calendar by addEvent() it is owned by the Calendar object. The Calendar takes
55 care of deleting it. All Events returned by the query functions are returned 55 care of deleting it. All Events returned by the query functions are returned
56 as pointers, that means all changes to the returned events are immediately 56 as pointers, that means all changes to the returned events are immediately
57 visible in the Calendar. You shouldn't delete any Event object you get from 57 visible in the Calendar. You shouldn't delete any Event object you get from
58 Calendar. 58 Calendar.
59*/ 59*/
60class Calendar : public QObject, public CustomProperties, 60class Calendar : public QObject, public CustomProperties,
61 public IncidenceBase::Observer 61 public IncidenceBase::Observer
62{ 62{
63 Q_OBJECT 63 Q_OBJECT
64public: 64public:
65 Calendar(); 65 Calendar();
66 Calendar(const QString &timeZoneId); 66 Calendar(const QString &timeZoneId);
67 virtual ~Calendar(); 67 virtual ~Calendar();
68 Incidence * undoIncidence() { return mUndoIncidence; }; 68 Incidence * undoIncidence() { return mUndoIncidence; };
69 bool undoDeleteIncidence(); 69 bool undoDeleteIncidence();
70 void deleteIncidence(Incidence *in); 70 void deleteIncidence(Incidence *in);
71 void resetTempSyncStat(); 71 void resetTempSyncStat();
72 void resetPilotStat(int id); 72 void resetPilotStat(int id);
73 /** 73 /**
74 Clears out the current calendar, freeing all used memory etc. 74 Clears out the current calendar, freeing all used memory etc.
75 */ 75 */
76 virtual void close() = 0; 76 virtual void close() = 0;
77 virtual void addCalendar( Calendar* ) = 0; 77 virtual void addCalendar( Calendar* ) = 0;
78 virtual bool addCalendarFile( QString name, int id ) = 0; 78 virtual bool addCalendarFile( QString name, int id ) = 0;
79 virtual void setSyncEventsReadOnly() = 0; 79 virtual void setSyncEventsReadOnly() = 0;
80 virtual void stopAllTodos() = 0;
80 81
81 /** 82 /**
82 Sync changes in memory to persistant storage. 83 Sync changes in memory to persistant storage.
83 */ 84 */
84 virtual void save() = 0; 85 virtual void save() = 0;
85 virtual QPtrList<Event> getExternLastSyncEvents() = 0; 86 virtual QPtrList<Event> getExternLastSyncEvents() = 0;
86 virtual void removeSyncInfo( QString syncProfile) = 0; 87 virtual void removeSyncInfo( QString syncProfile) = 0;
87 virtual bool isSaving() { return false; } 88 virtual bool isSaving() { return false; }
88 89
89 /** 90 /**
90 Return the owner of the calendar's full name. 91 Return the owner of the calendar's full name.
91 */ 92 */
92 const QString &getOwner() const; 93 const QString &getOwner() const;
93 /** 94 /**
94 Set the owner of the calendar. Should be owner's full name. 95 Set the owner of the calendar. Should be owner's full name.
95 */ 96 */
96 void setOwner( const QString &os ); 97 void setOwner( const QString &os );
97 /** 98 /**
98 Return the email address of the calendar owner. 99 Return the email address of the calendar owner.
99 */ 100 */
100 const QString &getEmail(); 101 const QString &getEmail();
101 /** 102 /**
102 Set the email address of the calendar owner. 103 Set the email address of the calendar owner.
103 */ 104 */
104 void setEmail( const QString & ); 105 void setEmail( const QString & );
105 106
106 /** 107 /**
107 Set time zone from a timezone string (e.g. -2:00) 108 Set time zone from a timezone string (e.g. -2:00)
108 */ 109 */
109 void setTimeZone( const QString &tz ); 110 void setTimeZone( const QString &tz );
110 /** 111 /**
111 Set time zone from a minutes value (e.g. -60) 112 Set time zone from a minutes value (e.g. -60)
112 */ 113 */
113 void setTimeZone( int tz ); 114 void setTimeZone( int tz );
114 /** 115 /**
115 Return time zone as offest in minutes. 116 Return time zone as offest in minutes.
116 */ 117 */
117 int getTimeZone() const; 118 int getTimeZone() const;
118 /** 119 /**
119 Compute an ISO 8601 format string from the time zone. 120 Compute an ISO 8601 format string from the time zone.
120 */ 121 */
121 QString getTimeZoneStr() const; 122 QString getTimeZoneStr() const;
122 /** 123 /**
123 Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal 124 Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal
124 values). 125 values).
125 */ 126 */
126 void setTimeZoneId( const QString & ); 127 void setTimeZoneId( const QString & );
127 /** 128 /**
128 Return time zone id. 129 Return time zone id.
129 */ 130 */
130 QString timeZoneId() const; 131 QString timeZoneId() const;
131 /** 132 /**
132 Use local time, not UTC or a time zone. 133 Use local time, not UTC or a time zone.
133 */ 134 */
134 void setLocalTime(); 135 void setLocalTime();
135 /** 136 /**
136 Return whether local time is being used. 137 Return whether local time is being used.
137 */ 138 */
138 bool isLocalTime() const; 139 bool isLocalTime() const;
139 140
140 /** 141 /**
141 Add an incidence to calendar. 142 Add an incidence to calendar.
142 143
143 @return true on success, false on error. 144 @return true on success, false on error.
144 */ 145 */
145 virtual bool addIncidence( Incidence * ); 146 virtual bool addIncidence( Incidence * );
146 147
147 // Adds an incidence and all relatedto incidences to the cal 148 // Adds an incidence and all relatedto incidences to the cal
148 void addIncidenceBranch( Incidence * ); 149 void addIncidenceBranch( Incidence * );
149 /** 150 /**
150 Return filtered list of all incidences of this calendar. 151 Return filtered list of all incidences of this calendar.
151 */ 152 */
152 virtual QPtrList<Incidence> incidences(); 153 virtual QPtrList<Incidence> incidences();
153 154
154 /** 155 /**
155 Return unfiltered list of all incidences of this calendar. 156 Return unfiltered list of all incidences of this calendar.
156 */ 157 */
157 virtual QPtrList<Incidence> rawIncidences(); 158 virtual QPtrList<Incidence> rawIncidences();
158 159
159 /** 160 /**
160 Adds a Event to this calendar object. 161 Adds a Event to this calendar object.
161 @param anEvent a pointer to the event to add 162 @param anEvent a pointer to the event to add
162 163
163 @return true on success, false on error. 164 @return true on success, false on error.
164 */ 165 */
165 virtual bool addEventNoDup( Event *event ) = 0; 166 virtual bool addEventNoDup( Event *event ) = 0;
166 virtual bool addAnniversaryNoDup( Event *event ) = 0; 167 virtual bool addAnniversaryNoDup( Event *event ) = 0;
167 virtual bool addEvent( Event *anEvent ) = 0; 168 virtual bool addEvent( Event *anEvent ) = 0;
168 /** 169 /**
169 Delete event from calendar. 170 Delete event from calendar.
170 */ 171 */
171 virtual void deleteEvent( Event * ) = 0; 172 virtual void deleteEvent( Event * ) = 0;
172 /** 173 /**
173 Retrieves an event on the basis of the unique string ID. 174 Retrieves an event on the basis of the unique string ID.
174 */ 175 */
175 virtual Event *event( const QString &UniqueStr ) = 0; 176 virtual Event *event( const QString &UniqueStr ) = 0;
176 virtual Event *event( QString, QString ) = 0; 177 virtual Event *event( QString, QString ) = 0;
177 /** 178 /**
178 Builds and then returns a list of all events that match for the 179 Builds and then returns a list of all events that match for the
179 date specified. useful for dayView, etc. etc. 180 date specified. useful for dayView, etc. etc.
180 The calendar filter is applied. 181 The calendar filter is applied.
181 */ 182 */
182 QPtrList<Event> events( const QDate &date, bool sorted = false); 183 QPtrList<Event> events( const QDate &date, bool sorted = false);
183 /** 184 /**
184 Get events, which occur on the given date. 185 Get events, which occur on the given date.
185 The calendar filter is applied. 186 The calendar filter is applied.
186 */ 187 */
187 QPtrList<Event> events( const QDateTime &qdt ); 188 QPtrList<Event> events( const QDateTime &qdt );
188 /** 189 /**
189 Get events in a range of dates. If inclusive is set to true, only events 190 Get events in a range of dates. If inclusive is set to true, only events
190 are returned, which are completely included in the range. 191 are returned, which are completely included in the range.
191 The calendar filter is applied. 192 The calendar filter is applied.
192 */ 193 */
193 QPtrList<Event> events( const QDate &start, const QDate &end, 194 QPtrList<Event> events( const QDate &start, const QDate &end,
194 bool inclusive = false); 195 bool inclusive = false);
195 /** 196 /**
196 Return filtered list of all events in calendar. 197 Return filtered list of all events in calendar.
197 */ 198 */
198 virtual QPtrList<Event> events(); 199 virtual QPtrList<Event> events();
199 /** 200 /**
200 Return unfiltered list of all events in calendar. 201 Return unfiltered list of all events in calendar.
201 */ 202 */
202 virtual QPtrList<Event> rawEvents() = 0; 203 virtual QPtrList<Event> rawEvents() = 0;
203 204
204 /** 205 /**
205 Add a todo to the todolist. 206 Add a todo to the todolist.
206 207
207 @return true on success, false on error. 208 @return true on success, false on error.
208 */ 209 */
209 virtual bool addTodo( Todo *todo ) = 0; 210 virtual bool addTodo( Todo *todo ) = 0;
210 virtual bool addTodoNoDup( Todo *todo ) = 0; 211 virtual bool addTodoNoDup( Todo *todo ) = 0;
211 /** 212 /**
212 Remove a todo from the todolist. 213 Remove a todo from the todolist.
213 */ 214 */
214 virtual void deleteTodo( Todo * ) = 0; 215 virtual void deleteTodo( Todo * ) = 0;
215 virtual void deleteJournal( Journal * ) = 0; 216 virtual void deleteJournal( Journal * ) = 0;
216 /** 217 /**
217 Return filterd list of todos. 218 Return filterd list of todos.
218 */ 219 */
219 virtual QPtrList<Todo> todos(); 220 virtual QPtrList<Todo> todos();
220 /** 221 /**
221 Searches todolist for an event with this unique string identifier, 222 Searches todolist for an event with this unique string identifier,
222 returns a pointer or null. 223 returns a pointer or null.
223 */ 224 */
224 virtual Todo *todo( const QString &uid ) = 0; 225 virtual Todo *todo( const QString &uid ) = 0;
225 virtual Todo *todo( QString, QString ) = 0; 226 virtual Todo *todo( QString, QString ) = 0;
226 /** 227 /**
227 Returns list of todos due on the specified date. 228 Returns list of todos due on the specified date.
228 */ 229 */
229 virtual QPtrList<Todo> todos( const QDate &date ) = 0; 230 virtual QPtrList<Todo> todos( const QDate &date ) = 0;
230 /** 231 /**
231 Return unfiltered list of todos. 232 Return unfiltered list of todos.
232 */ 233 */
233 virtual QPtrList<Todo> rawTodos() = 0; 234 virtual QPtrList<Todo> rawTodos() = 0;
234 235
235 /** 236 /**
236 Add a Journal entry to calendar. 237 Add a Journal entry to calendar.
237 238
238 @return true on success, false on error. 239 @return true on success, false on error.
239 */ 240 */
240 virtual bool addJournal( Journal * ) = 0; 241 virtual bool addJournal( Journal * ) = 0;
241 /** 242 /**
242 Return Journal for given date. 243 Return Journal for given date.
243 */ 244 */
244 virtual Journal *journal( const QDate & ) = 0; 245 virtual Journal *journal( const QDate & ) = 0;
245 /** 246 /**
246 Return Journal with given UID. 247 Return Journal with given UID.
247 */ 248 */
248 virtual Journal *journal( const QString &UID ) = 0; 249 virtual Journal *journal( const QString &UID ) = 0;
249 /** 250 /**
250 Return list of all Journal entries. 251 Return list of all Journal entries.
251 */ 252 */
252 virtual QPtrList<Journal> journals() = 0; 253 virtual QPtrList<Journal> journals() = 0;
253 254
254 /** 255 /**
255 Searches all incidence types for an incidence with this unique 256 Searches all incidence types for an incidence with this unique
256 string identifier, returns a pointer or null. 257 string identifier, returns a pointer or null.
257 */ 258 */
258 Incidence* incidence( const QString&UID ); 259 Incidence* incidence( const QString&UID );
259 260
260 /** 261 /**
261 Setup relations for an incidence. 262 Setup relations for an incidence.
262 */ 263 */
263 virtual void setupRelations( Incidence * ); 264 virtual void setupRelations( Incidence * );
264 /** 265 /**
265 Remove all relations to an incidence 266 Remove all relations to an incidence
266 */ 267 */
267 virtual void removeRelations( Incidence * ); 268 virtual void removeRelations( Incidence * );
268 269
269 /** 270 /**
270 Set calendar filter, which filters events for the events() functions. 271 Set calendar filter, which filters events for the events() functions.
271 The Filter object is owned by the caller. 272 The Filter object is owned by the caller.
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 8c4dde1..18f1af8 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -1,341 +1,347 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 3
4 Copyright (c) 1998 Preston Brown 4 Copyright (c) 1998 Preston Brown
5 Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org> 5 Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org>
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
11 11
12 This library is distributed in the hope that it will be useful, 12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details. 15 Library General Public License for more details.
16 16
17 You should have received a copy of the GNU Library General Public License 17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to 18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
21*/ 21*/
22 22
23#include <qdatetime.h> 23#include <qdatetime.h>
24#include <qstring.h> 24#include <qstring.h>
25#include <qptrlist.h> 25#include <qptrlist.h>
26 26
27#include <kdebug.h> 27#include <kdebug.h>
28#include <kconfig.h> 28#include <kconfig.h>
29#include <kglobal.h> 29#include <kglobal.h>
30#include <klocale.h> 30#include <klocale.h>
31 31
32#include "vcaldrag.h" 32#include "vcaldrag.h"
33#include "vcalformat.h" 33#include "vcalformat.h"
34#include "icalformat.h" 34#include "icalformat.h"
35#include "exceptions.h" 35#include "exceptions.h"
36#include "incidence.h" 36#include "incidence.h"
37#include "journal.h" 37#include "journal.h"
38#include "filestorage.h" 38#include "filestorage.h"
39#include "calfilter.h" 39#include "calfilter.h"
40 40
41#include "calendarlocal.h" 41#include "calendarlocal.h"
42 42
43// #ifndef DESKTOP_VERSION 43// #ifndef DESKTOP_VERSION
44// #include <qtopia/alarmserver.h> 44// #include <qtopia/alarmserver.h>
45// #endif 45// #endif
46using namespace KCal; 46using namespace KCal;
47 47
48CalendarLocal::CalendarLocal() 48CalendarLocal::CalendarLocal()
49 : Calendar() 49 : Calendar()
50{ 50{
51 init(); 51 init();
52} 52}
53 53
54CalendarLocal::CalendarLocal(const QString &timeZoneId) 54CalendarLocal::CalendarLocal(const QString &timeZoneId)
55 : Calendar(timeZoneId) 55 : Calendar(timeZoneId)
56{ 56{
57 init(); 57 init();
58} 58}
59 59
60void CalendarLocal::init() 60void CalendarLocal::init()
61{ 61{
62 mNextAlarmIncidence = 0; 62 mNextAlarmIncidence = 0;
63} 63}
64 64
65 65
66CalendarLocal::~CalendarLocal() 66CalendarLocal::~CalendarLocal()
67{ 67{
68 if ( mDeleteIncidencesOnClose ) 68 if ( mDeleteIncidencesOnClose )
69 close(); 69 close();
70} 70}
71bool CalendarLocal::addCalendarFile( QString name, int id ) 71bool CalendarLocal::addCalendarFile( QString name, int id )
72{ 72{
73 CalendarLocal calendar( timeZoneId() ); 73 CalendarLocal calendar( timeZoneId() );
74 calendar.setDefaultCalendar( id ); 74 calendar.setDefaultCalendar( id );
75 if ( calendar.load( name ) ) { 75 if ( calendar.load( name ) ) {
76 addCalendar( &calendar ); 76 addCalendar( &calendar );
77 return true; 77 return true;
78 } 78 }
79 return false; 79 return false;
80} 80}
81void CalendarLocal::setSyncEventsReadOnly() 81void CalendarLocal::setSyncEventsReadOnly()
82{ 82{
83 Event * ev; 83 Event * ev;
84 ev = mEventList.first(); 84 ev = mEventList.first();
85 while ( ev ) { 85 while ( ev ) {
86 if ( ev->uid().left(15) == QString("last-syncEvent-") ) 86 if ( ev->uid().left(15) == QString("last-syncEvent-") )
87 ev->setReadOnly( true ); 87 ev->setReadOnly( true );
88 ev = mEventList.next(); 88 ev = mEventList.next();
89 } 89 }
90} 90}
91void CalendarLocal::addCalendar( Calendar* cal ) 91void CalendarLocal::addCalendar( Calendar* cal )
92{ 92{
93 cal->setDontDeleteIncidencesOnClose(); 93 cal->setDontDeleteIncidencesOnClose();
94 { 94 {
95 QPtrList<Event> EventList = cal->rawEvents(); 95 QPtrList<Event> EventList = cal->rawEvents();
96 Event * ev = EventList.first(); 96 Event * ev = EventList.first();
97 while ( ev ) { 97 while ( ev ) {
98 ev->unRegisterObserver( cal ); 98 ev->unRegisterObserver( cal );
99 ev->registerObserver( this ); 99 ev->registerObserver( this );
100 mEventList.append( ev ); 100 mEventList.append( ev );
101 ev = EventList.next(); 101 ev = EventList.next();
102 } 102 }
103 } 103 }
104 { 104 {
105 105
106 QPtrList<Todo> TodoList = cal->rawTodos(); 106 QPtrList<Todo> TodoList = cal->rawTodos();
107 Todo * ev = TodoList.first(); 107 Todo * ev = TodoList.first();
108 while ( ev ) { 108 while ( ev ) {
109 QString rel = ev->relatedToUid(); 109 QString rel = ev->relatedToUid();
110 if ( !rel.isEmpty() ){ 110 if ( !rel.isEmpty() ){
111 ev->setRelatedTo ( 0 ); 111 ev->setRelatedTo ( 0 );
112 ev->setRelatedToUid( rel ); 112 ev->setRelatedToUid( rel );
113 } 113 }
114 ev = TodoList.next(); 114 ev = TodoList.next();
115 } 115 }
116 //TodoList = cal->rawTodos(); 116 //TodoList = cal->rawTodos();
117 ev = TodoList.first(); 117 ev = TodoList.first();
118 while ( ev ) { 118 while ( ev ) {
119 ev->unRegisterObserver( cal ); 119 ev->unRegisterObserver( cal );
120 ev->registerObserver( this ); 120 ev->registerObserver( this );
121 mTodoList.append( ev ); 121 mTodoList.append( ev );
122 setupRelations( ev ); 122 setupRelations( ev );
123 ev = TodoList.next(); 123 ev = TodoList.next();
124 } 124 }
125 } 125 }
126 { 126 {
127 QPtrList<Journal> JournalList = cal->journals(); 127 QPtrList<Journal> JournalList = cal->journals();
128 Journal * ev = JournalList.first(); 128 Journal * ev = JournalList.first();
129 while ( ev ) { 129 while ( ev ) {
130 ev->unRegisterObserver( cal ); 130 ev->unRegisterObserver( cal );
131 ev->registerObserver( this ); 131 ev->registerObserver( this );
132 mJournalList.append( ev ); 132 mJournalList.append( ev );
133 ev = JournalList.next(); 133 ev = JournalList.next();
134 } 134 }
135 } 135 }
136 setModified( true ); 136 setModified( true );
137} 137}
138bool CalendarLocal::load( const QString &fileName ) 138bool CalendarLocal::load( const QString &fileName )
139{ 139{
140 FileStorage storage( this, fileName ); 140 FileStorage storage( this, fileName );
141 return storage.load(); 141 return storage.load();
142} 142}
143 143
144bool CalendarLocal::save( const QString &fileName, CalFormat *format ) 144bool CalendarLocal::save( const QString &fileName, CalFormat *format )
145{ 145{
146 FileStorage storage( this, fileName, format ); 146 FileStorage storage( this, fileName, format );
147 return storage.save(); 147 return storage.save();
148} 148}
149 149
150void CalendarLocal::stopAllTodos()
151{
152 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
153 it->setRunning( false );
154
155}
150void CalendarLocal::close() 156void CalendarLocal::close()
151{ 157{
152 158
153 Todo * i; 159 Todo * i;
154 for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false); 160 for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false);
155 161
156 mEventList.setAutoDelete( true ); 162 mEventList.setAutoDelete( true );
157 mTodoList.setAutoDelete( true ); 163 mTodoList.setAutoDelete( true );
158 mJournalList.setAutoDelete( false ); 164 mJournalList.setAutoDelete( false );
159 165
160 mEventList.clear(); 166 mEventList.clear();
161 mTodoList.clear(); 167 mTodoList.clear();
162 mJournalList.clear(); 168 mJournalList.clear();
163 169
164 mEventList.setAutoDelete( false ); 170 mEventList.setAutoDelete( false );
165 mTodoList.setAutoDelete( false ); 171 mTodoList.setAutoDelete( false );
166 mJournalList.setAutoDelete( false ); 172 mJournalList.setAutoDelete( false );
167 173
168 setModified( false ); 174 setModified( false );
169} 175}
170 176
171bool CalendarLocal::addAnniversaryNoDup( Event *event ) 177bool CalendarLocal::addAnniversaryNoDup( Event *event )
172{ 178{
173 QString cat; 179 QString cat;
174 bool isBirthday = true; 180 bool isBirthday = true;
175 if( event->categoriesStr() == i18n( "Anniversary" ) ) { 181 if( event->categoriesStr() == i18n( "Anniversary" ) ) {
176 isBirthday = false; 182 isBirthday = false;
177 cat = i18n( "Anniversary" ); 183 cat = i18n( "Anniversary" );
178 } else if( event->categoriesStr() == i18n( "Birthday" ) ) { 184 } else if( event->categoriesStr() == i18n( "Birthday" ) ) {
179 isBirthday = true; 185 isBirthday = true;
180 cat = i18n( "Birthday" ); 186 cat = i18n( "Birthday" );
181 } else { 187 } else {
182 qDebug("addAnniversaryNoDup called without fitting category! "); 188 qDebug("addAnniversaryNoDup called without fitting category! ");
183 return false; 189 return false;
184 } 190 }
185 Event * eve; 191 Event * eve;
186 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { 192 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) {
187 if ( !(eve->categories().contains( cat ) )) 193 if ( !(eve->categories().contains( cat ) ))
188 continue; 194 continue;
189 // now we have an event with fitting category 195 // now we have an event with fitting category
190 if ( eve->dtStart().date() != event->dtStart().date() ) 196 if ( eve->dtStart().date() != event->dtStart().date() )
191 continue; 197 continue;
192 // now we have an event with fitting category+date 198 // now we have an event with fitting category+date
193 if ( eve->summary() != event->summary() ) 199 if ( eve->summary() != event->summary() )
194 continue; 200 continue;
195 // now we have an event with fitting category+date+summary 201 // now we have an event with fitting category+date+summary
196 return false; 202 return false;
197 } 203 }
198 return addEvent( event ); 204 return addEvent( event );
199 205
200} 206}
201bool CalendarLocal::addEventNoDup( Event *event ) 207bool CalendarLocal::addEventNoDup( Event *event )
202{ 208{
203 Event * eve; 209 Event * eve;
204 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { 210 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) {
205 if ( *eve == *event ) { 211 if ( *eve == *event ) {
206 //qDebug("CalendarLocal::Duplicate event found! Not inserted! "); 212 //qDebug("CalendarLocal::Duplicate event found! Not inserted! ");
207 return false; 213 return false;
208 } 214 }
209 } 215 }
210 return addEvent( event ); 216 return addEvent( event );
211} 217}
212 218
213bool CalendarLocal::addEvent( Event *event ) 219bool CalendarLocal::addEvent( Event *event )
214{ 220{
215 insertEvent( event ); 221 insertEvent( event );
216 222
217 event->registerObserver( this ); 223 event->registerObserver( this );
218 224
219 setModified( true ); 225 setModified( true );
220 event->setCalID( mDefaultCalendar ); 226 event->setCalID( mDefaultCalendar );
221 event->setCalEnabled( true ); 227 event->setCalEnabled( true );
222 228
223 return true; 229 return true;
224} 230}
225 231
226void CalendarLocal::deleteEvent( Event *event ) 232void CalendarLocal::deleteEvent( Event *event )
227{ 233{
228 if ( mUndoIncidence ) delete mUndoIncidence; 234 if ( mUndoIncidence ) delete mUndoIncidence;
229 mUndoIncidence = event->clone(); 235 mUndoIncidence = event->clone();
230 if ( mEventList.removeRef( event ) ) { 236 if ( mEventList.removeRef( event ) ) {
231 setModified( true ); 237 setModified( true );
232 } 238 }
233} 239}
234 240
235 241
236Event *CalendarLocal::event( const QString &uid ) 242Event *CalendarLocal::event( const QString &uid )
237{ 243{
238 Event *event; 244 Event *event;
239 Event *retVal = 0; 245 Event *retVal = 0;
240 for ( event = mEventList.first(); event; event = mEventList.next() ) { 246 for ( event = mEventList.first(); event; event = mEventList.next() ) {
241 if ( event->calEnabled() && event->uid() == uid ) { 247 if ( event->calEnabled() && event->uid() == uid ) {
242 if ( retVal ) { 248 if ( retVal ) {
243 if ( retVal->calID() > event->calID() ) { 249 if ( retVal->calID() > event->calID() ) {
244 retVal = event; 250 retVal = event;
245 } 251 }
246 } else { 252 } else {
247 retVal = event; 253 retVal = event;
248 } 254 }
249 } 255 }
250 } 256 }
251 return retVal; 257 return retVal;
252} 258}
253bool CalendarLocal::addTodoNoDup( Todo *todo ) 259bool CalendarLocal::addTodoNoDup( Todo *todo )
254{ 260{
255 Todo * eve; 261 Todo * eve;
256 for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) { 262 for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) {
257 if ( *eve == *todo ) { 263 if ( *eve == *todo ) {
258 //qDebug("duplicate todo found! not inserted! "); 264 //qDebug("duplicate todo found! not inserted! ");
259 return false; 265 return false;
260 } 266 }
261 } 267 }
262 return addTodo( todo ); 268 return addTodo( todo );
263} 269}
264bool CalendarLocal::addTodo( Todo *todo ) 270bool CalendarLocal::addTodo( Todo *todo )
265{ 271{
266 mTodoList.append( todo ); 272 mTodoList.append( todo );
267 273
268 todo->registerObserver( this ); 274 todo->registerObserver( this );
269 275
270 // Set up subtask relations 276 // Set up subtask relations
271 setupRelations( todo ); 277 setupRelations( todo );
272 278
273 setModified( true ); 279 setModified( true );
274 todo->setCalID( mDefaultCalendar ); 280 todo->setCalID( mDefaultCalendar );
275 todo->setCalEnabled( true ); 281 todo->setCalEnabled( true );
276 return true; 282 return true;
277} 283}
278 284
279void CalendarLocal::deleteTodo( Todo *todo ) 285void CalendarLocal::deleteTodo( Todo *todo )
280{ 286{
281 // Handle orphaned children 287 // Handle orphaned children
282 if ( mUndoIncidence ) delete mUndoIncidence; 288 if ( mUndoIncidence ) delete mUndoIncidence;
283 removeRelations( todo ); 289 removeRelations( todo );
284 mUndoIncidence = todo->clone(); 290 mUndoIncidence = todo->clone();
285 291
286 if ( mTodoList.removeRef( todo ) ) { 292 if ( mTodoList.removeRef( todo ) ) {
287 setModified( true ); 293 setModified( true );
288 } 294 }
289} 295}
290 296
291QPtrList<Todo> CalendarLocal::rawTodos() 297QPtrList<Todo> CalendarLocal::rawTodos()
292{ 298{
293 QPtrList<Todo> el; 299 QPtrList<Todo> el;
294 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) 300 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
295 if ( it->calEnabled() ) el.append( it ); 301 if ( it->calEnabled() ) el.append( it );
296 return el; 302 return el;
297} 303}
298Todo *CalendarLocal::todo( QString syncProf, QString id ) 304Todo *CalendarLocal::todo( QString syncProf, QString id )
299{ 305{
300 Todo *todo; 306 Todo *todo;
301 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { 307 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
302 if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo; 308 if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo;
303 } 309 }
304 310
305 return 0; 311 return 0;
306} 312}
307void CalendarLocal::removeSyncInfo( QString syncProfile) 313void CalendarLocal::removeSyncInfo( QString syncProfile)
308{ 314{
309 QPtrList<Incidence> all = rawIncidences() ; 315 QPtrList<Incidence> all = rawIncidences() ;
310 Incidence *inc; 316 Incidence *inc;
311 for ( inc = all.first(); inc; inc = all.next() ) { 317 for ( inc = all.first(); inc; inc = all.next() ) {
312 inc->removeID( syncProfile ); 318 inc->removeID( syncProfile );
313 } 319 }
314 if ( syncProfile.isEmpty() ) { 320 if ( syncProfile.isEmpty() ) {
315 QPtrList<Event> el; 321 QPtrList<Event> el;
316 Event *todo; 322 Event *todo;
317 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { 323 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
318 if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) 324 if ( todo->uid().left( 15 ) == QString("last-syncEvent-") )
319 el.append( todo ); 325 el.append( todo );
320 } 326 }
321 for ( todo = el.first(); todo; todo = el.next() ) { 327 for ( todo = el.first(); todo; todo = el.next() ) {
322 deleteIncidence ( todo ); 328 deleteIncidence ( todo );
323 } 329 }
324 } else { 330 } else {
325 Event *lse = event( "last-syncEvent-"+ syncProfile); 331 Event *lse = event( "last-syncEvent-"+ syncProfile);
326 if ( lse ) 332 if ( lse )
327 deleteIncidence ( lse ); 333 deleteIncidence ( lse );
328 } 334 }
329} 335}
330QPtrList<Event> CalendarLocal::getExternLastSyncEvents() 336QPtrList<Event> CalendarLocal::getExternLastSyncEvents()
331{ 337{
332 QPtrList<Event> el; 338 QPtrList<Event> el;
333 Event *todo; 339 Event *todo;
334 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { 340 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
335 if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) 341 if ( todo->uid().left( 15 ) == QString("last-syncEvent-") )
336 if ( todo->summary().left(3) == "E: " ) 342 if ( todo->summary().left(3) == "E: " )
337 el.append( todo ); 343 el.append( todo );
338 } 344 }
339 345
340 return el; 346 return el;
341 347
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index 0286b48..d32597f 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -1,225 +1,226 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 3
4 Copyright (c) 1998 Preston Brown 4 Copyright (c) 1998 Preston Brown
5 Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org> 5 Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org>
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
11 11
12 This library is distributed in the hope that it will be useful, 12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details. 15 Library General Public License for more details.
16 16
17 You should have received a copy of the GNU Library General Public License 17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to 18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
21*/ 21*/
22#ifndef KCAL_CALENDARLOCAL_H 22#ifndef KCAL_CALENDARLOCAL_H
23#define KCAL_CALENDARLOCAL_H 23#define KCAL_CALENDARLOCAL_H
24 24
25#include "calendar.h" 25#include "calendar.h"
26 26
27namespace KCal { 27namespace KCal {
28 28
29class CalFormat; 29class CalFormat;
30 30
31/** 31/**
32 This class provides a calendar stored as a local file. 32 This class provides a calendar stored as a local file.
33*/ 33*/
34class CalendarLocal : public Calendar 34class CalendarLocal : public Calendar
35{ 35{
36 public: 36 public:
37 /** 37 /**
38 Constructs a new calendar, with variables initialized to sane values. 38 Constructs a new calendar, with variables initialized to sane values.
39 */ 39 */
40 CalendarLocal(); 40 CalendarLocal();
41 /** 41 /**
42 Constructs a new calendar, with variables initialized to sane values. 42 Constructs a new calendar, with variables initialized to sane values.
43 */ 43 */
44 CalendarLocal( const QString &timeZoneId ); 44 CalendarLocal( const QString &timeZoneId );
45 ~CalendarLocal(); 45 ~CalendarLocal();
46 void addCalendar( Calendar* ); 46 void addCalendar( Calendar* );
47 bool addCalendarFile( QString name, int id ); 47 bool addCalendarFile( QString name, int id );
48 void setSyncEventsReadOnly(); 48 void setSyncEventsReadOnly();
49 void stopAllTodos();
49 /** 50 /**
50 Loads a calendar on disk in vCalendar or iCalendar format into the current 51 Loads a calendar on disk in vCalendar or iCalendar format into the current
51 calendar. Any information already present is lost. 52 calendar. Any information already present is lost.
52 @return true, if successfull, false on error. 53 @return true, if successfull, false on error.
53 @param fileName the name of the calendar on disk. 54 @param fileName the name of the calendar on disk.
54 */ 55 */
55 bool load( const QString &fileName ); 56 bool load( const QString &fileName );
56 /** 57 /**
57 Writes out the calendar to disk in the specified \a format. 58 Writes out the calendar to disk in the specified \a format.
58 CalendarLocal takes ownership of the CalFormat object. 59 CalendarLocal takes ownership of the CalFormat object.
59 @return true, if successfull, false on error. 60 @return true, if successfull, false on error.
60 @param fileName the name of the file 61 @param fileName the name of the file
61 */ 62 */
62 bool save( const QString &fileName, CalFormat *format = 0 ); 63 bool save( const QString &fileName, CalFormat *format = 0 );
63 64
64 /** 65 /**
65 Clears out the current calendar, freeing all used memory etc. etc. 66 Clears out the current calendar, freeing all used memory etc. etc.
66 */ 67 */
67 void close(); 68 void close();
68 69
69 void save() {} 70 void save() {}
70 71
71 /** 72 /**
72 Add Event to calendar. 73 Add Event to calendar.
73 */ 74 */
74 void removeSyncInfo( QString syncProfile); 75 void removeSyncInfo( QString syncProfile);
75 bool addAnniversaryNoDup( Event *event ); 76 bool addAnniversaryNoDup( Event *event );
76 bool addEventNoDup( Event *event ); 77 bool addEventNoDup( Event *event );
77 bool addEvent( Event *event ); 78 bool addEvent( Event *event );
78 /** 79 /**
79 Deletes an event from this calendar. 80 Deletes an event from this calendar.
80 */ 81 */
81 void deleteEvent( Event *event ); 82 void deleteEvent( Event *event );
82 83
83 /** 84 /**
84 Retrieves an event on the basis of the unique string ID. 85 Retrieves an event on the basis of the unique string ID.
85 */ 86 */
86 Event *event( const QString &uid ); 87 Event *event( const QString &uid );
87 /** 88 /**
88 Return unfiltered list of all events in calendar. 89 Return unfiltered list of all events in calendar.
89 */ 90 */
90 QPtrList<Event> rawEvents(); 91 QPtrList<Event> rawEvents();
91 QPtrList<Event> getExternLastSyncEvents(); 92 QPtrList<Event> getExternLastSyncEvents();
92 /** 93 /**
93 Add a todo to the todolist. 94 Add a todo to the todolist.
94 */ 95 */
95 bool addTodo( Todo *todo ); 96 bool addTodo( Todo *todo );
96 bool addTodoNoDup( Todo *todo ); 97 bool addTodoNoDup( Todo *todo );
97 /** 98 /**
98 Remove a todo from the todolist. 99 Remove a todo from the todolist.
99 */ 100 */
100 void deleteTodo( Todo * ); 101 void deleteTodo( Todo * );
101 /** 102 /**
102 Searches todolist for an event with this unique string identifier, 103 Searches todolist for an event with this unique string identifier,
103 returns a pointer or null. 104 returns a pointer or null.
104 */ 105 */
105 Todo *todo( const QString &uid ); 106 Todo *todo( const QString &uid );
106 /** 107 /**
107 Return list of all todos. 108 Return list of all todos.
108 */ 109 */
109 QPtrList<Todo> rawTodos(); 110 QPtrList<Todo> rawTodos();
110 /** 111 /**
111 Returns list of todos due on the specified date. 112 Returns list of todos due on the specified date.
112 */ 113 */
113 QPtrList<Todo> todos( const QDate &date ); 114 QPtrList<Todo> todos( const QDate &date );
114 /** 115 /**
115 Return list of all todos. 116 Return list of all todos.
116 117
117 Workaround because compiler does not recognize function of base class. 118 Workaround because compiler does not recognize function of base class.
118 */ 119 */
119 QPtrList<Todo> todos() { return Calendar::todos(); } 120 QPtrList<Todo> todos() { return Calendar::todos(); }
120 121
121 /** 122 /**
122 Add a Journal entry to calendar. 123 Add a Journal entry to calendar.
123 */ 124 */
124 bool addJournal( Journal * ); 125 bool addJournal( Journal * );
125 /** 126 /**
126 Remove a Journal from the calendar. 127 Remove a Journal from the calendar.
127 */ 128 */
128 void deleteJournal( Journal * ); 129 void deleteJournal( Journal * );
129 /** 130 /**
130 Return Journal for given date. 131 Return Journal for given date.
131 */ 132 */
132 Journal *journal( const QDate & ); 133 Journal *journal( const QDate & );
133 /** 134 /**
134 Return Journal with given UID. 135 Return Journal with given UID.
135 */ 136 */
136 Journal *journal( const QString &uid ); 137 Journal *journal( const QString &uid );
137 /** 138 /**
138 Return list of all Journals stored in calendar. 139 Return list of all Journals stored in calendar.
139 */ 140 */
140 QPtrList<Journal> journals(); 141 QPtrList<Journal> journals();
141 142
142 /** 143 /**
143 Return all alarms, which ocur in the given time interval. 144 Return all alarms, which ocur in the given time interval.
144 */ 145 */
145 Alarm::List alarms( const QDateTime &from, const QDateTime &to ); 146 Alarm::List alarms( const QDateTime &from, const QDateTime &to );
146 147
147 /** 148 /**
148 Return all alarms, which ocur before given date. 149 Return all alarms, which ocur before given date.
149 */ 150 */
150 Alarm::List alarmsTo( const QDateTime &to ); 151 Alarm::List alarmsTo( const QDateTime &to );
151 152
152 QDateTime nextAlarm( int daysTo ) ; 153 QDateTime nextAlarm( int daysTo ) ;
153 QDateTime nextAlarmEventDateTime() const; 154 QDateTime nextAlarmEventDateTime() const;
154 void checkAlarmForIncidence( Incidence *, bool deleted ) ; 155 void checkAlarmForIncidence( Incidence *, bool deleted ) ;
155 void registerAlarm(); 156 void registerAlarm();
156 void deRegisterAlarm(); 157 void deRegisterAlarm();
157 QString getAlarmNotification(); 158 QString getAlarmNotification();
158 QString nextSummary() const ; 159 QString nextSummary() const ;
159 /** 160 /**
160 This method should be called whenever a Event is modified directly 161 This method should be called whenever a Event is modified directly
161 via it's pointer. It makes sure that the calendar is internally 162 via it's pointer. It makes sure that the calendar is internally
162 consistent. 163 consistent.
163 */ 164 */
164 void update( IncidenceBase *incidence ); 165 void update( IncidenceBase *incidence );
165 166
166 /** 167 /**
167 Builds and then returns a list of all events that match for the 168 Builds and then returns a list of all events that match for the
168 date specified. useful for dayView, etc. etc. 169 date specified. useful for dayView, etc. etc.
169 */ 170 */
170 QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false ); 171 QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false );
171 /** 172 /**
172 Get unfiltered events for date \a qdt. 173 Get unfiltered events for date \a qdt.
173 */ 174 */
174 QPtrList<Event> rawEventsForDate( const QDateTime &qdt ); 175 QPtrList<Event> rawEventsForDate( const QDateTime &qdt );
175 /** 176 /**
176 Get unfiltered events in a range of dates. If inclusive is set to true, 177 Get unfiltered events in a range of dates. If inclusive is set to true,
177 only events are returned, which are completely included in the range. 178 only events are returned, which are completely included in the range.
178 */ 179 */
179 QPtrList<Event> rawEvents( const QDate &start, const QDate &end, 180 QPtrList<Event> rawEvents( const QDate &start, const QDate &end,
180 bool inclusive = false ); 181 bool inclusive = false );
181 Todo *todo( QString, QString ); 182 Todo *todo( QString, QString );
182 Event *event( QString, QString ); 183 Event *event( QString, QString );
183 184
184public slots: 185public slots:
185 void setCalendarEnabled( int id, bool enable ); 186 void setCalendarEnabled( int id, bool enable );
186 void setAlarmEnabled( int id, bool enable ); 187 void setAlarmEnabled( int id, bool enable );
187 void setReadOnly( int id, bool enable ); 188 void setReadOnly( int id, bool enable );
188 void setDefaultCalendarEnabledOnly(); 189 void setDefaultCalendarEnabledOnly();
189 void setCalendarRemove( int id ); 190 void setCalendarRemove( int id );
190 191
191 protected: 192 protected:
192 193
193 // Event* mNextAlarmEvent; 194 // Event* mNextAlarmEvent;
194 QString mNextSummary; 195 QString mNextSummary;
195 QString mNextAlarmEventDateTimeString; 196 QString mNextAlarmEventDateTimeString;
196 QString mLastAlarmNotificationString; 197 QString mLastAlarmNotificationString;
197 QDateTime mNextAlarmEventDateTime; 198 QDateTime mNextAlarmEventDateTime;
198 QDateTime mNextAlarmDateTime; 199 QDateTime mNextAlarmDateTime;
199 void reInitAlarmSettings(); 200 void reInitAlarmSettings();
200 201
201 /** Notification function of IncidenceBase::Observer. */ 202 /** Notification function of IncidenceBase::Observer. */
202 void incidenceUpdated( IncidenceBase *i ) { update( i ); } 203 void incidenceUpdated( IncidenceBase *i ) { update( i ); }
203 204
204 /** inserts an event into its "proper place" in the calendar. */ 205 /** inserts an event into its "proper place" in the calendar. */
205 void insertEvent( Event *event ); 206 void insertEvent( Event *event );
206 207
207 /** Append alarms of incidence in interval to list of alarms. */ 208 /** Append alarms of incidence in interval to list of alarms. */
208 void appendAlarms( Alarm::List &alarms, Incidence *incidence, 209 void appendAlarms( Alarm::List &alarms, Incidence *incidence,
209 const QDateTime &from, const QDateTime &to ); 210 const QDateTime &from, const QDateTime &to );
210 211
211 /** Append alarms of recurring events in interval to list of alarms. */ 212 /** Append alarms of recurring events in interval to list of alarms. */
212 void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence, 213 void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence,
213 const QDateTime &from, const QDateTime &to ); 214 const QDateTime &from, const QDateTime &to );
214 215
215 private: 216 private:
216 void init(); 217 void init();
217 218
218 QPtrList<Event> mEventList; 219 QPtrList<Event> mEventList;
219 QPtrList<Todo> mTodoList; 220 QPtrList<Todo> mTodoList;
220 QPtrList<Journal> mJournalList; 221 QPtrList<Journal> mJournalList;
221}; 222};
222 223
223} 224}
224 225
225#endif 226#endif
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 9a8b6e4..5260051 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -1,307 +1,307 @@
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 <kglobal.h> 21#include <kglobal.h>
22#include <kglobalsettings.h> 22#include <kglobalsettings.h>
23#include <klocale.h> 23#include <klocale.h>
24#include <kdebug.h> 24#include <kdebug.h>
25#include <qregexp.h> 25#include <qregexp.h>
26#include <qfileinfo.h> 26#include <qfileinfo.h>
27 27
28#include "calendarlocal.h" 28#include "calendarlocal.h"
29#include "icalformat.h" 29#include "icalformat.h"
30#include "todo.h" 30#include "todo.h"
31 31
32using namespace KCal; 32using namespace KCal;
33 33
34Todo::Todo(): QObject(), Incidence() 34Todo::Todo(): QObject(), Incidence()
35{ 35{
36// mStatus = TENTATIVE; 36// mStatus = TENTATIVE;
37 37
38 mHasDueDate = false; 38 mHasDueDate = false;
39 setHasStartDate( false ); 39 setHasStartDate( false );
40 mCompleted = getEvenTime(QDateTime::currentDateTime()); 40 mCompleted = getEvenTime(QDateTime::currentDateTime());
41 mHasCompletedDate = false; 41 mHasCompletedDate = false;
42 mPercentComplete = 0; 42 mPercentComplete = 0;
43 mRunning = false; 43 mRunning = false;
44 mRunSaveTimer = 0; 44 mRunSaveTimer = 0;
45} 45}
46 46
47Todo::Todo(const Todo &t) : QObject(),Incidence(t) 47Todo::Todo(const Todo &t) : QObject(),Incidence(t)
48{ 48{
49 mDtDue = t.mDtDue; 49 mDtDue = t.mDtDue;
50 mHasDueDate = t.mHasDueDate; 50 mHasDueDate = t.mHasDueDate;
51 mCompleted = t.mCompleted; 51 mCompleted = t.mCompleted;
52 mHasCompletedDate = t.mHasCompletedDate; 52 mHasCompletedDate = t.mHasCompletedDate;
53 mPercentComplete = t.mPercentComplete; 53 mPercentComplete = t.mPercentComplete;
54 mRunning = false; 54 mRunning = false;
55 mRunSaveTimer = 0; 55 mRunSaveTimer = 0;
56} 56}
57 57
58Todo::~Todo() 58Todo::~Todo()
59{ 59{
60 setRunning( false ); 60 setRunning( false );
61 //qDebug("Todo::~Todo() "); 61 //qDebug("Todo::~Todo() ");
62} 62}
63 63
64void Todo::setRunningFalse( QString s ) 64void Todo::setRunningFalse( QString s )
65{ 65{
66 if ( ! mRunning ) 66 if ( ! mRunning )
67 return; 67 return;
68 mRunning = false; 68 mRunning = false;
69 mRunSaveTimer->stop(); 69 mRunSaveTimer->stop();
70 saveRunningInfoToFile( s ); 70 saveRunningInfoToFile( s );
71} 71}
72void Todo::stopRunning() 72void Todo::stopRunning()
73{ 73{
74 if ( !mRunning ) 74 if ( !mRunning )
75 return; 75 return;
76 if ( mRunSaveTimer ) 76 if ( mRunSaveTimer )
77 mRunSaveTimer->stop(); 77 mRunSaveTimer->stop();
78 mRunning = false; 78 mRunning = false;
79} 79}
80void Todo::setRunning( bool run ) 80void Todo::setRunning( bool run )
81{ 81{
82 if ( run == mRunning ) 82 if ( run == mRunning )
83 return; 83 return;
84 //qDebug("Todo::setRunning %d ", run); 84 //qDebug("Todo::setRunning %d ", run);
85 if ( !mRunSaveTimer ) { 85 if ( !mRunSaveTimer ) {
86 mRunSaveTimer = new QTimer ( this ); 86 mRunSaveTimer = new QTimer ( this );
87 connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) ); 87 connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) );
88 } 88 }
89 mRunning = run; 89 mRunning = run;
90 if ( mRunning ) { 90 if ( mRunning ) {
91 mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min 91 mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min
92 mRunStart = QDateTime::currentDateTime(); 92 mRunStart = QDateTime::currentDateTime();
93 } else { 93 } else {
94 mRunSaveTimer->stop(); 94 mRunSaveTimer->stop();
95 saveRunningInfoToFile(); 95 saveRunningInfoToFile();
96 } 96 }
97} 97}
98void Todo::saveRunningInfo( QString comment, QDateTime start, QDateTime end ) 98void Todo::saveRunningInfo( QString comment, QDateTime start, QDateTime end )
99{ 99{
100 if ( !mRunning) return; 100 if ( !mRunning) return;
101 mRunning = false; 101 mRunning = false;
102 mRunStart = start; 102 mRunStart = start;
103 mRunEnd = end; 103 mRunEnd = end;
104 saveRunningInfoToFile( comment ); 104 saveRunningInfoToFile( comment );
105} 105}
106void Todo::saveRunningInfoToFile() 106void Todo::saveRunningInfoToFile()
107{ 107{
108 mRunEnd = QDateTime::currentDateTime(); 108 mRunEnd = QDateTime::currentDateTime();
109 saveRunningInfoToFile( QString::null ); 109 saveRunningInfoToFile( QString::null );
110} 110}
111void Todo::saveRunningInfoToFile( QString comment ) 111void Todo::saveRunningInfoToFile( QString comment )
112{ 112{
113 //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); 113 //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1());
114 if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 10 ) { 114 if ( mRunStart.secsTo ( mRunEnd) < 15 ) {
115 qDebug("Running time < 30 seconds. Skipped. "); 115 qDebug("Running time < 15 seconds. Skipped. ");
116 return; 116 return;
117 } 117 }
118 QString dir = KGlobalSettings::timeTrackerDir(); 118 QString dir = KGlobalSettings::timeTrackerDir();
119 //qDebug("%s ", dir.latin1()); 119 //qDebug("%s ", dir.latin1());
120 QString file = "%1%2%3-%4%5%6-"; 120 QString file = "%1%2%3-%4%5%6-";
121 file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 ); 121 file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 );
122 file.replace ( QRegExp (" "), "0" ); 122 file.replace ( QRegExp (" "), "0" );
123 file += uid(); 123 file += uid();
124 //qDebug("File %s ",file.latin1() ); 124 //qDebug("File %s ",file.latin1() );
125 CalendarLocal cal; 125 CalendarLocal cal;
126 cal.setLocalTime(); 126 cal.setLocalTime();
127 Todo * to = (Todo*) clone(); 127 Todo * to = (Todo*) clone();
128 to->setFloats( false ); 128 to->setFloats( false );
129 to->setDtStart( mRunStart ); 129 to->setDtStart( mRunStart );
130 to->setHasStartDate( true ); 130 to->setHasStartDate( true );
131 to->setDtDue( mRunEnd ); 131 to->setDtDue( mRunEnd );
132 to->setHasDueDate( true ); 132 to->setHasDueDate( true );
133 to->setUid( file ); 133 to->setUid( file );
134 if ( !comment.isEmpty() ) { 134 if ( !comment.isEmpty() ) {
135 QString des = to->description(); 135 QString des = to->description();
136 if ( des.isEmpty () ) 136 if ( des.isEmpty () )
137 to->setDescription( "TT-Note: " + comment ); 137 to->setDescription( "TT-Note: " + comment );
138 else 138 else
139 to->setDescription( "TT-Note: " + comment +"\n" + des ); 139 to->setDescription( "TT-Note: " + comment +"\n" + des );
140 } 140 }
141 cal.addIncidence( to ); 141 cal.addIncidence( to );
142 ICalFormat format; 142 ICalFormat format;
143 file = dir +"/" +file +".ics"; 143 file = dir +"/" +file +".ics";
144 format.save( &cal, file ); 144 format.save( &cal, file );
145 saveParents(); 145 saveParents();
146 146
147} 147}
148void Todo::saveParents() 148void Todo::saveParents()
149{ 149{
150 if (!relatedTo() ) 150 if (!relatedTo() )
151 return; 151 return;
152 Incidence * inc = relatedTo(); 152 Incidence * inc = relatedTo();
153 if ( inc->typeID() != todoID ) 153 if ( inc->typeID() != todoID )
154 return; 154 return;
155 Todo* to = (Todo*)inc; 155 Todo* to = (Todo*)inc;
156 bool saveTodo = false; 156 bool saveTodo = false;
157 QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics"; 157 QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics";
158 QFileInfo fi ( file ); 158 QFileInfo fi ( file );
159 if ( fi.exists() ) { 159 if ( fi.exists() ) {
160 if ( fi.lastModified () < to->lastModified ()) 160 if ( fi.lastModified () < to->lastModified ())
161 saveTodo = true; 161 saveTodo = true;
162 } else { 162 } else {
163 saveTodo = true; 163 saveTodo = true;
164 } 164 }
165 if ( saveTodo ) { 165 if ( saveTodo ) {
166 CalendarLocal cal; 166 CalendarLocal cal;
167 cal.setLocalTime(); 167 cal.setLocalTime();
168 Todo * par = (Todo *) to->clone(); 168 Todo * par = (Todo *) to->clone();
169 cal.addIncidence( par ); 169 cal.addIncidence( par );
170 ICalFormat format; 170 ICalFormat format;
171 format.save( &cal, file ); 171 format.save( &cal, file );
172 } 172 }
173 to->saveParents(); 173 to->saveParents();
174} 174}
175 175
176int Todo::runTime() 176int Todo::runTime()
177{ 177{
178 if ( !mRunning ) 178 if ( !mRunning )
179 return 0; 179 return 0;
180 return mRunStart.secsTo( QDateTime::currentDateTime() ); 180 return mRunStart.secsTo( QDateTime::currentDateTime() );
181} 181}
182bool Todo::hasRunningSub() 182bool Todo::hasRunningSub()
183{ 183{
184 if ( mRunning ) 184 if ( mRunning )
185 return true; 185 return true;
186 Incidence *aTodo; 186 Incidence *aTodo;
187 for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { 187 for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) {
188 if ( ((Todo*)aTodo)->hasRunningSub() ) 188 if ( ((Todo*)aTodo)->hasRunningSub() )
189 return true; 189 return true;
190 } 190 }
191 return false; 191 return false;
192} 192}
193Incidence *Todo::clone() 193Incidence *Todo::clone()
194{ 194{
195 return new Todo(*this); 195 return new Todo(*this);
196} 196}
197 197
198bool Todo::contains ( Todo* from ) 198bool Todo::contains ( Todo* from )
199{ 199{
200 200
201 if ( !from->summary().isEmpty() ) 201 if ( !from->summary().isEmpty() )
202 if ( !summary().startsWith( from->summary() )) 202 if ( !summary().startsWith( from->summary() ))
203 return false; 203 return false;
204 if ( from->hasStartDate() ) { 204 if ( from->hasStartDate() ) {
205 if ( !hasStartDate() ) 205 if ( !hasStartDate() )
206 return false; 206 return false;
207 if ( from->dtStart() != dtStart()) 207 if ( from->dtStart() != dtStart())
208 return false; 208 return false;
209 } 209 }
210 if ( from->hasDueDate() ){ 210 if ( from->hasDueDate() ){
211 if ( !hasDueDate() ) 211 if ( !hasDueDate() )
212 return false; 212 return false;
213 if ( from->dtDue() != dtDue()) 213 if ( from->dtDue() != dtDue())
214 return false; 214 return false;
215 } 215 }
216 if ( !from->location().isEmpty() ) 216 if ( !from->location().isEmpty() )
217 if ( !location().startsWith( from->location() ) ) 217 if ( !location().startsWith( from->location() ) )
218 return false; 218 return false;
219 if ( !from->description().isEmpty() ) 219 if ( !from->description().isEmpty() )
220 if ( !description().startsWith( from->description() )) 220 if ( !description().startsWith( from->description() ))
221 return false; 221 return false;
222 if ( from->alarms().count() ) { 222 if ( from->alarms().count() ) {
223 Alarm *a = from->alarms().first(); 223 Alarm *a = from->alarms().first();
224 if ( a->enabled() ){ 224 if ( a->enabled() ){
225 if ( !alarms().count() ) 225 if ( !alarms().count() )
226 return false; 226 return false;
227 Alarm *b = alarms().first(); 227 Alarm *b = alarms().first();
228 if( ! b->enabled() ) 228 if( ! b->enabled() )
229 return false; 229 return false;
230 if ( ! (a->offset() == b->offset() )) 230 if ( ! (a->offset() == b->offset() ))
231 return false; 231 return false;
232 } 232 }
233 } 233 }
234 234
235 QStringList cat = categories(); 235 QStringList cat = categories();
236 QStringList catFrom = from->categories(); 236 QStringList catFrom = from->categories();
237 QString nCat; 237 QString nCat;
238 unsigned int iii; 238 unsigned int iii;
239 for ( iii = 0; iii < catFrom.count();++iii ) { 239 for ( iii = 0; iii < catFrom.count();++iii ) {
240 nCat = catFrom[iii]; 240 nCat = catFrom[iii];
241 if ( !nCat.isEmpty() ) 241 if ( !nCat.isEmpty() )
242 if ( !cat.contains( nCat )) { 242 if ( !cat.contains( nCat )) {
243 return false; 243 return false;
244 } 244 }
245 } 245 }
246 if ( from->isCompleted() ) { 246 if ( from->isCompleted() ) {
247 if ( !isCompleted() ) 247 if ( !isCompleted() )
248 return false; 248 return false;
249 } 249 }
250 if( priority() != from->priority() ) 250 if( priority() != from->priority() )
251 return false; 251 return false;
252 252
253 253
254 return true; 254 return true;
255 255
256} 256}
257bool KCal::operator==( const Todo& t1, const Todo& t2 ) 257bool KCal::operator==( const Todo& t1, const Todo& t2 )
258{ 258{
259 259
260 bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 ); 260 bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 );
261 if ( ! ret ) 261 if ( ! ret )
262 return false; 262 return false;
263 if ( t1.hasDueDate() == t2.hasDueDate() ) { 263 if ( t1.hasDueDate() == t2.hasDueDate() ) {
264 if ( t1.hasDueDate() ) { 264 if ( t1.hasDueDate() ) {
265 if ( t1.doesFloat() == t2.doesFloat() ) { 265 if ( t1.doesFloat() == t2.doesFloat() ) {
266 if ( t1.doesFloat() ) { 266 if ( t1.doesFloat() ) {
267 if ( t1.dtDue().date() != t2.dtDue().date() ) 267 if ( t1.dtDue().date() != t2.dtDue().date() )
268 return false; 268 return false;
269 } else 269 } else
270 if ( t1.dtDue() != t2.dtDue() ) 270 if ( t1.dtDue() != t2.dtDue() )
271 return false; 271 return false;
272 } else 272 } else
273 return false;// float != 273 return false;// float !=
274 } 274 }
275 275
276 } else 276 } else
277 return false; 277 return false;
278 if ( t1.percentComplete() != t2.percentComplete() ) 278 if ( t1.percentComplete() != t2.percentComplete() )
279 return false; 279 return false;
280 if ( t1.isCompleted() ) { 280 if ( t1.isCompleted() ) {
281 if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) { 281 if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) {
282 if ( t1.hasCompletedDate() ) { 282 if ( t1.hasCompletedDate() ) {
283 if ( t1.completed() != t2.completed() ) 283 if ( t1.completed() != t2.completed() )
284 return false; 284 return false;
285 } 285 }
286 286
287 } else 287 } else
288 return false; 288 return false;
289 } 289 }
290 return true; 290 return true;
291 291
292} 292}
293 293
294void Todo::setDtDue(const QDateTime &dtDue) 294void Todo::setDtDue(const QDateTime &dtDue)
295{ 295{
296 //int diffsecs = mDtDue.secsTo(dtDue); 296 //int diffsecs = mDtDue.secsTo(dtDue);
297 297
298 /*if (mReadOnly) return; 298 /*if (mReadOnly) return;
299 const QPtrList<Alarm>& alarms = alarms(); 299 const QPtrList<Alarm>& alarms = alarms();
300 for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) { 300 for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) {
301 if (alarm->enabled()) { 301 if (alarm->enabled()) {
302 alarm->setTime(alarm->time().addSecs(diffsecs)); 302 alarm->setTime(alarm->time().addSecs(diffsecs));
303 } 303 }
304 }*/ 304 }*/
305 mDtDue = getEvenTime(dtDue); 305 mDtDue = getEvenTime(dtDue);
306 306
307 //kdDebug(5800) << "setDtDue says date is " << mDtDue.toString() << endl; 307 //kdDebug(5800) << "setDtDue says date is " << mDtDue.toString() << endl;