summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-02-13 19:07:45 (UTC)
committer zautrix <zautrix>2005-02-13 19:07:45 (UTC)
commit7bd83e913399b8be68a7d37e8f02118ec9eab90e (patch) (unidiff)
tree284d1592687ea4d3e0c220fafd289a702718dee4
parent293271fe9e6a9061da329183f8f488d79580f7da (diff)
downloadkdepimpi-7bd83e913399b8be68a7d37e8f02118ec9eab90e.zip
kdepimpi-7bd83e913399b8be68a7d37e8f02118ec9eab90e.tar.gz
kdepimpi-7bd83e913399b8be68a7d37e8f02118ec9eab90e.tar.bz2
todo fixi
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt4
-rw-r--r--korganizer/calendarview.cpp14
-rw-r--r--korganizer/koagendaview.cpp17
-rw-r--r--korganizer/koeventviewer.cpp7
-rw-r--r--korganizer/kolistview.cpp2
-rw-r--r--korganizer/komonthview.cpp3
-rw-r--r--korganizer/kowhatsnextview.cpp6
-rw-r--r--libkcal/icalformatimpl.cpp2
-rw-r--r--libkcal/incidence.cpp16
-rw-r--r--libkcal/kincidenceformatter.cpp12
-rw-r--r--libkcal/todo.cpp4
11 files changed, 74 insertions, 13 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index c85ca35..2d4cb74 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1016,269 +1016,269 @@
1016{ "<p><b>up/down</b>: Scroll agenda view</p>\n","<p><b>up/down</b>: Scrolle Agenda Ansicht</p>\n" }, 1016{ "<p><b>up/down</b>: Scroll agenda view</p>\n","<p><b>up/down</b>: Scrolle Agenda Ansicht</p>\n" },
1017{ "<p><h3>In agenda view:</h3></p>\n","<p><h3>In Agenda Ansicht:</h3></p>\n" }, 1017{ "<p><h3>In agenda view:</h3></p>\n","<p><h3>In Agenda Ansicht:</h3></p>\n" },
1018{ "<p><b>del,backspace</b>: Delete selected item</p>\n","<p><b>del,backspace</b>: Lösche selektiertes Item</p>\n" }, 1018{ "<p><b>del,backspace</b>: Delete selected item</p>\n","<p><b>del,backspace</b>: Lösche selektiertes Item</p>\n" },
1019{ "<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n","<p><b>left</b>: Vorh. Woche | <b>left+ctrl</b>: Vorh. Monat</p>\n" }, 1019{ "<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n","<p><b>left</b>: Vorh. Woche | <b>left+ctrl</b>: Vorh. Monat</p>\n" },
1020{ "<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n","<p><b>right</b>: Nächste Woche | <b>right+ctrl</b>: Nächste Woche</p>\n" }, 1020{ "<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n","<p><b>right</b>: Nächste Woche | <b>right+ctrl</b>: Nächste Woche</p>\n" },
1021{ "<p><b>B</b>: Edit description (details) of selected item</p>\n","<p><b>B</b>: Editiere Beschreibung (Details) des selektierten Items</p>\n" }, 1021{ "<p><b>B</b>: Edit description (details) of selected item</p>\n","<p><b>B</b>: Editiere Beschreibung (Details) des selektierten Items</p>\n" },
1022{ "<p><b>C</b>: Show current time in agenda view</p>\n","<p><b>C</b>: Zeige aktuelle Zeit in Agenda Ansicht</p>\n" }, 1022{ "<p><b>C</b>: Show current time in agenda view</p>\n","<p><b>C</b>: Zeige aktuelle Zeit in Agenda Ansicht</p>\n" },
1023{ "<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n","<p><b>+,-</b> : Zoom rein/raus Agenda | <b>A</b>: Wechsle Ganztag Agenda Höhe</p>\n" }, 1023{ "<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n","<p><b>+,-</b> : Zoom rein/raus Agenda | <b>A</b>: Wechsle Ganztag Agenda Höhe</p>\n" },
1024{ "<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n","<p><b>S+ctrl</b>: Füge Sub-Todo hinzu | <b>X</b>: Zeige/verstecke Datenavigator</p>\n" }, 1024{ "<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n","<p><b>S+ctrl</b>: Füge Sub-Todo hinzu | <b>X</b>: Zeige/verstecke Datenavigator</p>\n" },
1025{ "<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n","<p><b>T</b>: Gehe zu Heute | <b>T+ctrl</b>: Neues Todo</p>\n" }, 1025{ "<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n","<p><b>T</b>: Gehe zu Heute | <b>T+ctrl</b>: Neues Todo</p>\n" },
1026{ "<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n","<p><b>E</b>: Editiere selektiertes Item |<b> E+ctrl</b>: Neuer Termin</p>\n" }, 1026{ "<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n","<p><b>E</b>: Editiere selektiertes Item |<b> E+ctrl</b>: Neuer Termin</p>\n" },
1027{ "<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n","<p><b>D</b>: Ein-Tages Ansicht | <b>M</b>: Monats Ansicht</p>\n" }, 1027{ "<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n","<p><b>D</b>: Ein-Tages Ansicht | <b>M</b>: Monats Ansicht</p>\n" },
1028{ "<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n","<p><b>Z,Y</b>: Arbeitswochen Ansicht | <b>U</b>: Wochen Ansicht</p>\n" }, 1028{ "<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n","<p><b>Z,Y</b>: Arbeitswochen Ansicht | <b>U</b>: Wochen Ansicht</p>\n" },
1029{ "<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n","<p><b>V</b>: Todo Ansicht | <b>L</b>: Termin Listen Ansicht</p>\n" }, 1029{ "<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n","<p><b>V</b>: Todo Ansicht | <b>L</b>: Termin Listen Ansicht</p>\n" },
1030{ "<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ","<p><b>N</b>: Nächste-Tage Ansicht days view| <b>W</b>: What's next Ansicht\n " }, 1030{ "<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ","<p><b>N</b>: Nächste-Tage Ansicht days view| <b>W</b>: What's next Ansicht\n " },
1031{ "<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n","<p><b>1-0</b> (+<b>ctrl</b>): Selektiere Filter 1-10 (11-20)</p>\n" }, 1031{ "<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n","<p><b>1-0</b> (+<b>ctrl</b>): Selektiere Filter 1-10 (11-20)</p>\n" },
1032{ "<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n","<p><b>O</b>: Filter An/Aus | <b>J</b>: Journal Ansicht</p>\n" }, 1032{ "<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n","<p><b>O</b>: Filter An/Aus | <b>J</b>: Journal Ansicht</p>\n" },
1033{ "<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n","<p><b>F</b>: Zeige/verstecke Filter Ansicht |<b>F+ctrl</b>: Editiere Filter </p>\n" }, 1033{ "<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n","<p><b>F</b>: Zeige/verstecke Filter Ansicht |<b>F+ctrl</b>: Editiere Filter </p>\n" },
1034{ "<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n","<p><b>Space</b>: Zeige fullscreen | <b>P</b>: Datums Picker</p>\n" }, 1034{ "<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n","<p><b>Space</b>: Zeige fullscreen | <b>P</b>: Datums Picker</p>\n" },
1035{ "<p><b>I</b>: Show info for selected event/todo</p>\n","<p><b>I</b>: Zeige Info (Details) für selektiertes Item</p>\n" }, 1035{ "<p><b>I</b>: Show info for selected event/todo</p>\n","<p><b>I</b>: Zeige Info (Details) für selektiertes Item</p>\n" },
1036{ "<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n","<p><b>H</b>: Dieser Hilfe Dialog | <b>S</b>: Such Dialog</p>\n" }, 1036{ "<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n","<p><b>H</b>: Dieser Hilfe Dialog | <b>S</b>: Such Dialog</p>\n" },
1037{ "<p><h2>KO/Pi key shortcuts:</h2></p>\n","<p><h2>KO/Pi Tastatur Kurzbefehle:</h2></p>\n" }, 1037{ "<p><h2>KO/Pi key shortcuts:</h2></p>\n","<p><h2>KO/Pi Tastatur Kurzbefehle:</h2></p>\n" },
1038{ "After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n","Nachdem etwas geändert wurde, werden die\nDaten automatisch in die Datei abgespeichert\n~/kdepim/apps/korganizer/mycalendar.ics\nnach (konfigurierbar) drei Minuten.\nAus Sicherheitsgründen wird noch einmal\nnach 10 Min. abgespeichert, wenn keine\nÄnderungen vorgenommen wurden. Die \nDaten werden automatisch gespeichert,\nwenn KO/Pi beendet wird.\nSie können eine Backup-Datei erstellen im\nMenu: Datei - Speichere Kalender Backup\n" }, 1038{ "After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n","Nachdem etwas geändert wurde, werden die\nDaten automatisch in die Datei abgespeichert\n~/kdepim/apps/korganizer/mycalendar.ics\nnach (konfigurierbar) drei Minuten.\nAus Sicherheitsgründen wird noch einmal\nnach 10 Min. abgespeichert, wenn keine\nÄnderungen vorgenommen wurden. Die \nDaten werden automatisch gespeichert,\nwenn KO/Pi beendet wird.\nSie können eine Backup-Datei erstellen im\nMenu: Datei - Speichere Kalender Backup\n" },
1039{ "Auto Saving in KOrganizer/Pi","Auto Speichern in KOrganizer/Pi" }, 1039{ "Auto Saving in KOrganizer/Pi","Auto Speichern in KOrganizer/Pi" },
1040{ "\nhttp://sourceforge.net/projects/kdepimpi\n","\nhttp://sourceforge.net/projects/kdepimpi\n" }, 1040{ "\nhttp://sourceforge.net/projects/kdepimpi\n","\nhttp://sourceforge.net/projects/kdepimpi\n" },
1041{ "\nor report them in the bugtracker on\n","\noder trage sie in dem Bugtracker ein auf\n" }, 1041{ "\nor report them in the bugtracker on\n","\noder trage sie in dem Bugtracker ein auf\n" },
1042{ "\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n","\nBitte melde fehlerhaftes Verhalten an\nlutz@pi-sync.net\n" }, 1042{ "\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n","\nBitte melde fehlerhaftes Verhalten an\nlutz@pi-sync.net\n" },
1043{ "2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n","2) Ein Audio Alarm Daemon\nfür den Zaurus ist verfügbar\nals zusätzliche Anwendung\n" }, 1043{ "2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n","2) Ein Audio Alarm Daemon\nfür den Zaurus ist verfügbar\nals zusätzliche Anwendung\n" },
1044{ "1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n","1) Importieren von *.vcs oder *.ics Dateien von\nanderen Anwendungen kann möglicherweise\n nicht richtig funktionieren,\nwenn die Termine Eigenschaften haben,\ndie KO/Pi nicht unterstützt.\n" }, 1044{ "1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n","1) Importieren von *.vcs oder *.ics Dateien von\nanderen Anwendungen kann möglicherweise\n nicht richtig funktionieren,\nwenn die Termine Eigenschaften haben,\ndie KO/Pi nicht unterstützt.\n" },
1045{ "Known Problems in KOrganizer/Pi","Bekannte Probleme in KOrganizer/Pi" }, 1045{ "Known Problems in KOrganizer/Pi","Bekannte Probleme in KOrganizer/Pi" },
1046{ "KO/Pi FAQ","KO/Pi FAQ" }, 1046{ "KO/Pi FAQ","KO/Pi FAQ" },
1047{ "PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n","PDA-Edition\nfür: Zaurus 5x00/7x0/860/3000/6000\n" }, 1047{ "PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n","PDA-Edition\nfür: Zaurus 5x00/7x0/860/3000/6000\n" },
1048{ "KOrganizer/Platform-independent\n","KOrganizer/Platform-independent\n" }, 1048{ "KOrganizer/Platform-independent\n","KOrganizer/Platform-independent\n" },
1049{ "About KOrganizer/Pi","Über KOrganizer/Pi" }, 1049{ "About KOrganizer/Pi","Über KOrganizer/Pi" },
1050{ "From: ","Von: " }, 1050{ "From: ","Von: " },
1051{ "Remove sync info","Entferne Sync Info" }, 1051{ "Remove sync info","Entferne Sync Info" },
1052{ "For all profiles","Für alle Profile" }, 1052{ "For all profiles","Für alle Profile" },
1053{ "Hide not Running","Verstecke nicht Laufende" }, 1053{ "Hide not Running","Verstecke nicht Laufende" },
1054{ "ME","ME" }, 1054{ "ME","ME" },
1055{ "Toolbar","Toolbar" }, 1055{ "Toolbar","Toolbar" },
1056{ "Undo Delete...","Löschen rückgängig machen..." }, 1056{ "Undo Delete...","Löschen rückgängig machen..." },
1057{ "Undo Delete","Löschen rückgängig machen" }, 1057{ "Undo Delete","Löschen rückgängig machen" },
1058{ "KDE Sync HowTo...","KDE Sync HowTo..." }, 1058{ "KDE Sync HowTo...","KDE Sync HowTo..." },
1059{ "Multi Sync HowTo...","Multi Sync HowTo..." }, 1059{ "Multi Sync HowTo...","Multi Sync HowTo..." },
1060{ "Januar","Januar" }, 1060{ "Januar","Januar" },
1061{ "KO/Pi Keys + Colors","KO/Pi Tasten + Farben" }, 1061{ "KO/Pi Keys + Colors","KO/Pi Tasten + Farben" },
1062{ "No Filter","Kein Filter" }, 1062{ "No Filter","Kein Filter" },
1063{ "Multiple Sync options","Multi Sync Optionen" }, 1063{ "Multiple Sync options","Multi Sync Optionen" },
1064{ "Sync algo options","Sync Ablauf Optionen" }, 1064{ "Sync algo options","Sync Ablauf Optionen" },
1065{ "Apply filter when adding data to local:","Filter für das Hinzufügen von Daten zu Lokal:" }, 1065{ "Apply filter when adding data to local:","Filter für das Hinzufügen von Daten zu Lokal:" },
1066{ "Incoming calendar filter:","Eingehender Kalender Filter:" }, 1066{ "Incoming calendar filter:","Eingehender Kalender Filter:" },
1067{ "Incoming addressbook filter:","Eingehender Adressbuch Filter:" }, 1067{ "Incoming addressbook filter:","Eingehender Adressbuch Filter:" },
1068{ "Write back options","Optionen zum Zurückschreiben" }, 1068{ "Write back options","Optionen zum Zurückschreiben" },
1069{ "Write back (on remote) existing entries only","Schreibe nur existierende (auf Entfernt) Einträge zurück" }, 1069{ "Write back (on remote) existing entries only","Schreibe nur existierende (auf Entfernt) Einträge zurück" },
1070{ "Apply filter when adding data to remote:","Filter für das Hinzufügen von Daten zu Entfernt:" }, 1070{ "Apply filter when adding data to remote:","Filter für das Hinzufügen von Daten zu Entfernt:" },
1071{ "Outgoing calendar filter:","Ausgehender Kalender Filter:" }, 1071{ "Outgoing calendar filter:","Ausgehender Kalender Filter:" },
1072{ "Outgoing addressbook filter:","Ausgehender Adressbuch Filter:" }, 1072{ "Outgoing addressbook filter:","Ausgehender Adressbuch Filter:" },
1073{ "Write back (calendar) entries for time period only","Schreibe nur Kalender Einträge für Zeitspanne zurück" }, 1073{ "Write back (calendar) entries for time period only","Schreibe nur Kalender Einträge für Zeitspanne zurück" },
1074{ "Time period","Zeitspanne" }, 1074{ "Time period","Zeitspanne" },
1075{ "From ","Von " }, 1075{ "From ","Von " },
1076{ " weeks in the past to "," Wochen in der Vergangenheit bis zu " }, 1076{ " weeks in the past to "," Wochen in der Vergangenheit bis zu " },
1077{ " weeks in the future "," Wochen in der Zukunft " }, 1077{ " weeks in the future "," Wochen in der Zukunft " },
1078{ "Profile kind specific settings","Profil Art abhängige Einstellungen" }, 1078{ "Profile kind specific settings","Profil Art abhängige Einstellungen" },
1079{ "Local temp file:","Lokale temp Datei:" }, 1079{ "Local temp file:","Lokale temp Datei:" },
1080{ "Multiple profiles with same name!\nPlease use unique profile names!","Mehrere Profile mit demselben Namen!\nBitte verschiedene Namen benutzen!" }, 1080{ "Multiple profiles with same name!\nPlease use unique profile names!","Mehrere Profile mit demselben Namen!\nBitte verschiedene Namen benutzen!" },
1081{ "Aborted! Nothing synced!","Abgebrochen! Nichts wurde gesynct!" }, 1081{ "Aborted! Nothing synced!","Abgebrochen! Nichts wurde gesynct!" },
1082{ "Language","Sprache" }, 1082{ "Language","Sprache" },
1083{ "Time Format","Zeit Format" }, 1083{ "Time Format","Zeit Format" },
1084{ "Time Zone","Zeit Zone" }, 1084{ "Time Zone","Zeit Zone" },
1085{ "%1 groups subscribed","%1 Guppen abboniert" }, 1085{ "%1 groups subscribed","%1 Guppen abboniert" },
1086{ "Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail","Aktuelles Speicherverzeichnis ist:\n%1\nIhre Mail wird gespeichert in:\n(speicherverz.)/apps/kopiemail/localmail" }, 1086{ "Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail","Aktuelles Speicherverzeichnis ist:\n%1\nIhre Mail wird gespeichert in:\n(speicherverz.)/apps/kopiemail/localmail" },
1087{ "<b>New data storage dir:</b>","<b>Neues Datenspeicherverzeichnis:</b>" }, 1087{ "<b>New data storage dir:</b>","<b>Neues Datenspeicherverzeichnis:</b>" },
1088{ "New dirs are created automatically","Neue Verzeichnisse werden aut. erstellt" }, 1088{ "New dirs are created automatically","Neue Verzeichnisse werden aut. erstellt" },
1089{ "Save settings","Speichere Einstellungen" }, 1089{ "Save settings","Speichere Einstellungen" },
1090{ "Save standard","Speichere Standard" }, 1090{ "Save standard","Speichere Standard" },
1091{ "<b>New settings are used\nafter a restart</b>","<b>Neue Einstellungen werden nach\neinem Neustart genutzt</b>" }, 1091{ "<b>New settings are used\nafter a restart</b>","<b>Neue Einstellungen werden nach\neinem Neustart genutzt</b>" },
1092{ "Settings are stored in\n%1","Einstellungen werden gespeichert in:\n%1" }, 1092{ "Settings are stored in\n%1","Einstellungen werden gespeichert in:\n%1" },
1093{ "Data storage path","Daten Speicherpfad" }, 1093{ "Data storage path","Daten Speicherpfad" },
1094{ "Language","Sprache" }, 1094{ "Language","Sprache" },
1095{ "Show time in agenda items","Zeige Zeit in Agenda Items" }, 1095{ "Show time in agenda items","Zeige Zeit in Agenda Items" },
1096{ "Color for Sundays + category "Holiday"","Farbe für Sonntags + Kategorie "Feiertag"" }, 1096{ "Color for Sundays + category "Holiday"","Farbe für Sonntags + Kategorie "Feiertag"" },
1097{ "Show events, that are done in \nWhat's Next view","Zeige abgelaufene Termine in\nWhat's Next Ansicht" }, 1097{ "Show events, that are done in \nWhat's Next view","Zeige abgelaufene Termine in\nWhat's Next Ansicht" },
1098{ "Hide not running Todos in To-do view","Verstecke nicht laufende Todos" }, 1098{ "Hide not running Todos in To-do view","Verstecke nicht laufende Todos" },
1099{ "+01:00 Europe/Oslo(CET)","+01:00 Europe/Oslo(CET)" }, 1099{ "+01:00 Europe/Oslo(CET)","+01:00 Europe/Oslo(CET)" },
1100{ "KO/Pi","KO/Pi" }, 1100{ "KO/Pi","KO/Pi" },
1101{ "There is nothing to undo!","Es gibt nichts zum\nRückgängigmachen!" }, 1101{ "There is nothing to undo!","Es gibt nichts zum\nRückgängigmachen!" },
1102{ "Recreating edit dialog. Please wait...","Recreating edit dialog. Please wait..." }, 1102{ "Recreating edit dialog. Please wait...","Recreating edit dialog. Please wait..." },
1103{ "Sound.Al.: ","Sound.Al.: " }, 1103{ "Sound.Al.: ","Sound.Al.: " },
1104{ "From: %1 To: %2 %3","Von: %1 Bis: %2 %3" }, 1104{ "From: %1 To: %2 %3","Von: %1 Bis: %2 %3" },
1105{ "Restore","Wiederherstellen" }, 1105{ "Restore","Wiederherstellen" },
1106{ "\nAre you sure you want\nto restore this?","\nMöchten Sie das wirklicht\nwiederherstellen?" }, 1106{ "\nAre you sure you want\nto restore this?","\nMöchten Sie das wirklicht\nwiederherstellen?" },
1107{ "% completed","% komplett" }, 1107{ "% completed","% komplett" },
1108{ "%d item(s) found.","%d Item(s) gefunden." }, 1108{ "%d item(s) found.","%d Item(s) gefunden." },
1109{ "Set complete","Setze auf erledigt" }, 1109{ "Set complete","Setze auf erledigt" },
1110{ "(cancelled)","(gecancelt)" }, 1110{ "(cancelled)","(gecancelt)" },
1111{ "Click on the week number to\nshow week in agenda view","Klicke auf die Wochennummer\num die Woche in der Agenda anzuzeigen" }, 1111{ "Click on the week number to\nshow week in agenda view","Klicke auf die Wochennummer\num die Woche in der Agenda anzuzeigen" },
1112{ " Local time "," Locale Zeit " }, 1112{ " Local time "," Locale Zeit " },
1113{ "Form2","Form2" }, 1113{ "Form2","Form2" },
1114{ "Filter enabled","Filter angeschaltet" }, 1114{ "Filter enabled","Filter angeschaltet" },
1115{ "Edit Filters","Ändere Filter" }, 1115{ "Edit Filters","Ändere Filter" },
1116{ "Print What's Next View...","Drucke What's Next Ansicht..." }, 1116{ "Print What's Next View...","Drucke What's Next Ansicht..." },
1117{ "Agenda","Agenda" }, 1117{ "Agenda","Agenda" },
1118{ " ("," (" }, 1118{ " ("," (" },
1119{ "<p><b>Due on:</b> %1</p>","<p><b>Fällig am:</b> %1</p>" }, 1119{ "<p><b>Due on:</b> %1</p>","<p><b>Fällig am:</b> %1</p>" },
1120{ "Print","Print" }, 1120{ "Print","Print" },
1121{ "&Setup Printer...","Drucker &Setup..." }, 1121{ "&Setup Printer...","Drucker &Setup..." },
1122{ "View Type","Zeige Typ" }, 1122{ "View Type","Zeige Typ" },
1123{ "Page &orientation:","Seiten Ausrichtung:" }, 1123{ "Page &orientation:","Seiten Ausrichtung:" },
1124{ "Use Default of Selected Style","Default des selektierten Stils" }, 1124{ "Use Default of Selected Style","Default des selektierten Stils" },
1125{ "Use Default Setting of Printer","Default Einstellung des Druckers" }, 1125{ "Use Default Setting of Printer","Default Einstellung des Druckers" },
1126{ "Portrait","Portrait" }, 1126{ "Portrait","Portrait" },
1127{ "Landscape","Landschaft" }, 1127{ "Landscape","Landschaft" },
1128{ "Print day","Drucke Tag" }, 1128{ "Print day","Drucke Tag" },
1129{ "CalPrintDay_Base","CalPrintDay_Base" }, 1129{ "CalPrintDay_Base","CalPrintDay_Base" },
1130{ "Date && Time Range","Datum && Zeitspanne" }, 1130{ "Date && Time Range","Datum && Zeitspanne" },
1131{ "&End date:","&Enddatum:" }, 1131{ "&End date:","&Enddatum:" },
1132{ "&Start date:","&Startdatum:" }, 1132{ "&Start date:","&Startdatum:" },
1133{ "Start &time:","Startzeit:" }, 1133{ "Start &time:","Startzeit:" },
1134{ "End ti&me:","Endzeit:" }, 1134{ "End ti&me:","Endzeit:" },
1135{ "E&xtend time range to include all events","Erweitere Zeitspanne um alle Termine einzuschliessen" }, 1135{ "E&xtend time range to include all events","Erweitere Zeitspanne um alle Termine einzuschliessen" },
1136{ "Include to&dos that are due on the printed day(s)","Inclusive To&dos, die an den selektierten Tagen fällig sind" }, 1136{ "Include to&dos that are due on the printed day(s)","Inclusive To&dos, die an den selektierten Tagen fällig sind" },
1137{ "Alt+D","Alt+D" }, 1137{ "Alt+D","Alt+D" },
1138{ "&Use colors","Nutze Farben" }, 1138{ "&Use colors","Nutze Farben" },
1139{ "Alt+U","Alt+U" }, 1139{ "Alt+U","Alt+U" },
1140{ "Print week","Drucke Woche" }, 1140{ "Print week","Drucke Woche" },
1141{ "CalPrintWeek_Base","CalPrintWeek_Base" }, 1141{ "CalPrintWeek_Base","CalPrintWeek_Base" },
1142{ "Use &colors","Nutze Farben" }, 1142{ "Use &colors","Nutze Farben" },
1143{ "Type of View","Typ der Ansicht" }, 1143{ "Type of View","Typ der Ansicht" },
1144{ "Print as &Filofax page","Drucke als &Filofax Seite" }, 1144{ "Print as &Filofax page","Drucke als &Filofax Seite" },
1145{ "Alt+F","Alt+F" }, 1145{ "Alt+F","Alt+F" },
1146{ "Print as &timetable view:","Drucke als Zeittabelle:" }, 1146{ "Print as &timetable view:","Drucke als Zeittabelle:" },
1147{ "Alt+T","Alt+T" }, 1147{ "Alt+T","Alt+T" },
1148{ "Print as split week view","Drucke als gesplittete Wochenansicht" }, 1148{ "Print as split week view","Drucke als gesplittete Wochenansicht" },
1149{ "Print month","Drucke Monat" }, 1149{ "Print month","Drucke Monat" },
1150{ "CalPrintMonth_Base","CalPrintMonth_Base" }, 1150{ "CalPrintMonth_Base","CalPrintMonth_Base" },
1151{ "&Start month:","&Startmonat:" }, 1151{ "&Start month:","&Startmonat:" },
1152{ "&End month:","&Endmonat:" }, 1152{ "&End month:","&Endmonat:" },
1153{ "Print week &numbers","Drucke Wochen Nummer(n)" }, 1153{ "Print week &numbers","Drucke Wochen Nummer(n)" },
1154{ "Print todos","Drucke Todos" }, 1154{ "Print todos","Drucke Todos" },
1155{ "CalPrintTodoConfig_Base","CalPrintTodoConfig_Base" }, 1155{ "CalPrintTodoConfig_Base","CalPrintTodoConfig_Base" },
1156{ "Include &description of the item","Inclusive Itembeschreibung" }, 1156{ "Include &description of the item","Inclusive Itembeschreibung" },
1157{ "Include d&ue date of the item","Inclusive Fälligkeitsdatum des Items" }, 1157{ "Include d&ue date of the item","Inclusive Fälligkeitsdatum des Items" },
1158{ "Include &priority of the item","Inclusive Priorität des Items" }, 1158{ "Include &priority of the item","Inclusive Priorität des Items" },
1159{ "Items to Print","Zu druckende Items" }, 1159{ "Items to Print","Zu druckende Items" },
1160{ "&From:","Von:" }, 1160{ "&From:","Von:" },
1161{ "&To:","Bis:" }, 1161{ "&To:","Bis:" },
1162{ "Print &all todo items","Drucke alle Todo Items" }, 1162{ "Print &all todo items","Drucke alle Todo Items" },
1163{ "Print only &uncompleted items","Drucke nur nicht erledigte Todos" }, 1163{ "Print only &uncompleted items","Drucke nur nicht erledigte Todos" },
1164{ "Only items due in the &range:","Nur Items in dem Zeitraum:" }, 1164{ "Only items due in the &range:","Nur Items in dem Zeitraum:" },
1165{ "Todo List","Todo Liste" }, 1165{ "Todo List","Todo Liste" },
1166{ "&Title:","&Titel:" }, 1166{ "&Title:","&Titel:" },
1167{ "Co&nnect subtodos with its parent","Verbinde Unter-Todos mit ihren Ober-Todos" }, 1167{ "Co&nnect subtodos with its parent","Verbinde Unter-Todos mit ihren Ober-Todos" },
1168{ "Todo list","Todo Liste" }, 1168{ "Todo list","Todo Liste" },
1169{ "&Print...","Drucke..." }, 1169{ "&Print...","Drucke..." },
1170{ "<qt>Printing on printer <b>%1</b></qt>","<qt>Drucke auf Drucker <b>%1</b></qt>" }, 1170{ "<qt>Printing on printer <b>%1</b></qt>","<qt>Drucke auf Drucker <b>%1</b></qt>" },
1171{ "[Unconfigured]","[Unkonfiguriert]" }, 1171{ "[Unconfigured]","[Unkonfiguriert]" },
1172{ "OK","OK" }, 1172{ "OK","OK" },
1173{ "FilterEditor","FilterEditor" }, 1173{ "FilterEditor","FilterEditor" },
1174{ "Include","Inclusive" }, 1174{ "Include","Inclusive" },
1175{ "Exclude","Exclusive" }, 1175{ "Exclude","Exclusive" },
1176{ "Edit Selection...","Editiere Auswahl" }, 1176{ "Edit Selection...","Editiere Auswahl" },
1177{ "recurring events","wiederholende Termine" }, 1177{ "recurring events","wiederholende Termine" },
1178{ "recurr. events","wiederh.Termine" }, 1178{ "recurr. events","wiederh.Termine" },
1179{ "completed to-dos","erledigte Todos" }, 1179{ "completed to-dos","erledigte Todos" },
1180{ "events","Termine" }, 1180{ "events","Termine" },
1181{ "todos","Todos" }, 1181{ "todos","Todos" },
1182{ "journals","Journale" }, 1182{ "journals","Journale" },
1183{ "public","öffentl." }, 1183{ "public","öffentl." },
1184{ "private","privat" }, 1184{ "private","privat" },
1185{ "confidential","vertraul." }, 1185{ "confidential","vertraul." },
1186{ "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Unter-Todos.\nAlle erledigten Unter-Todos\nwerden auch gelöscht!" }, 1186{ "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Unter-Todos.\nAlle erledigten Unter-Todos\nwerden auch gelöscht!" },
1187{ "Yesterday","Gestern" }, 1187{ "Yesterday","Gestern" },
1188{ "Day after tomorrow","Übermorgen" }, 1188{ "Day after tomorrow","Übermorgen" },
1189{ "Tomorrow","Morgen" }, 1189{ "Tomorrow","Morgen" },
1190{ "Day before yesterday","Vorgestern" }, 1190{ "Day before yesterday","Vorgestern" },
1191{ "Size %1","Größe %1" }, 1191{ "Size %1","Größe %1" },
1192{ "New Agendasize: %1","Neue Agendagröße: %1" }, 1192{ "New Agendasize: %1","Neue Agendagröße: %1" },
1193{ " (%1 y.)"," (%1 J.)" }, 1193{ " (%1 y.)"," (%1 J.)" },
1194{ "Allday:","Ganztägig:" }, 1194{ "Allday:","Ganztägig:" },
1195{ "compl.todos","erled.Todos" }, 1195{ "compl.todos","erled.Todos" },
1196{ "Day view","Tagesansicht" }, 1196{ "Day view","Tagesansicht" },
1197{ "Next days","Nächste Tage" }, 1197{ "Next days","Nächste Tage" },
1198{ "Next week","Nächste Woche" }, 1198{ "Next week","Nächste Woche" },
1199{ "Next two weeks","Nächste zwei Wochen" }, 1199{ "Next two weeks","Nächste zwei Wochen" },
1200{ "Next month","Nächster Monat" }, 1200{ "Next month","Nächster Monat" },
1201{ "Journal view","Journal" }, 1201{ "Journal view","Journal" },
1202{ "Display all opened","Zeige alle geöffnet" }, 1202{ "Display all opened","Zeige alle geöffnet" },
1203{ "Display all closed","Zeige alle geschlossen" }, 1203{ "Display all closed","Zeige alle geschlossen" },
1204{ "Display all flat","Zeige alle flach" }, 1204{ "Display all flat","Zeige alle flach" },
1205{ "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" }, 1205{ "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" },
1206{ "Default todo done color:","Standard Todo erledigt Farbe" }, 1206{ "Default todo done color:","Standard Todo erledigt Farbe" },
1207{ "Select week %1-%2","Wähle Woche %1-%2" }, 1207{ "Select week %1-%2","Wähle Woche %1-%2" },
1208{ "Select Week","Wähle Woche" }, 1208{ "Select Week","Wähle Woche" },
1209{ "Set alarm for selected...","Setze Alarm für Selekt..." }, 1209{ "Set alarm for selected...","Setze Alarm für Selekt..." },
1210{ "Set Alarm!","Setze Alarm!" }, 1210{ "Set Alarm!","Setze Alarm!" },
1211{ "Canged alarm for %1 items","Alarm für %1 Items geändert" }, 1211{ "Canged alarm for %1 items","Alarm für %1 Items geändert" },
1212{ " and "," und " }, 1212{ " and "," und " },
1213{ "<IMG src="%1"> only )","nur <IMG src="%1"> )" }, 1213{ "<IMG src="%1"> only )","nur <IMG src="%1"> )" },
1214{ "Mail to selected","Mail an Ausgewählte" }, 1214{ "Mail to selected","Mail an Ausgewählte" },
1215{ "Mail to all","Mail an Alle" }, 1215{ "Mail to all","Mail an Alle" },
1216{ "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" }, 1216{ "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" },
1217{ "Set reminder ON with offset to:","Alarm AN mit Offset auf:" }, 1217{ "Set reminder ON with offset to:","Alarm AN mit Offset auf:" },
1218{ " on"," am" }, 1218{ " on"," am" },
1219{ " completed on "," erledigt am " }, 1219{ " completed on "," erledigt am " },
1220{ "Save as Event template","Speichere als Vorlage" }, 1220{ "Save as Event template","Speichere als Vorlage" },
1221{ "Load Event template","Lade Termin Vorlage" }, 1221{ "Load Event template","Lade Termin Vorlage" },
1222{ "Save as Journal template","Speichere als Journal Vorlage" }, 1222{ "Save as Journal template","Speichere als Journal Vorlage" },
1223{ "Insert Journal template","Füge Journal Vorlage ein" }, 1223{ "Insert Journal template","Füge Journal Vorlage ein" },
1224{ "Sub todos:<br>","Unter Todos:<br>" }, 1224{ "Sub todos:<br>","Unter Todos:<br>" },
1225{ "Parent todo:<br>","Über Todo:<br>" }, 1225{ "Parent todo:<br>","Über Todo:<br>" },
1226{ "Set current as color category","Setze Gewählte als Farbkategorie" }, 1226{ "Set current as color category","Setze Gewählte als Farbkategorie" },
1227{ " completed"," erledigt" }, 1227{ " completed"," erledigt" },
1228{ "(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.net --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!","(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi basiert auf KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) und das KDE Team.\nKOrganizer/Pi ist lizensiert unter der GPL.\nKO/Pi kann kompiliert werden für\nLinux, Zaurus-PDA und Windows\nwww.pi-sync.net --- www.korganizer.org\nBesonderen Dank an Michael und Ben\nfür intensives Testen!" }, 1228{ "(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.net --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!","(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi basiert auf KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) und das KDE Team.\nKOrganizer/Pi ist lizensiert unter der GPL.\nKO/Pi kann kompiliert werden für\nLinux, Zaurus-PDA und Windows\nwww.pi-sync.net --- www.korganizer.org\nBesonderen Dank an Michael und Ben\nfür intensives Testen!" },
1229{ "Syncing aborted. Nothing synced.","Syncing abgebrochen.Nichts wurde gesynct." }, 1229{ "Syncing aborted. Nothing synced.","Syncing abgebrochen.Nichts wurde gesynct." },
1230{ "Connected! Sending request for remote file ...","Verbunden! Sende Daten Anfrage..." }, 1230{ "Connected! Sending request for remote file ...","Verbunden! Sende Daten Anfrage..." },
1231{ "Trying to connect to remote...","Versuche mit Gegenstelle zu verbinden..." }, 1231{ "Trying to connect to remote...","Versuche mit Gegenstelle zu verbinden..." },
1232{ "Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?","Verbindungsversuch wegen\nZeitüberschreitung gescheitert!\nWurde vergessen Pi-Sync auf\nder Gegenstelle anzuschalten?" }, 1232{ "Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?","Verbindungsversuch wegen\nZeitüberschreitung gescheitert!\nWurde vergessen Pi-Sync auf\nder Gegenstelle anzuschalten?" },
1233{ "ERROR: Receiving remote file failed.","FEHLER: Empfang der entfernten Daten fehlgeschlagen." }, 1233{ "ERROR: Receiving remote file failed.","FEHLER: Empfang der entfernten Daten fehlgeschlagen." },
1234{ "Error","Fehler" }, 1234{ "Error","Fehler" },
1235{ ""You entered an invalid date!\n Date changed to current date.","Ungültiges Datum eingegeben.\nSetze heutiges Datum." }, 1235{ ""You entered an invalid date!\n Date changed to current date.","Ungültiges Datum eingegeben.\nSetze heutiges Datum." },
1236{ "You entered an invalid date!\n Will use current date instead.","Ungültiges Datum eingegeben.\nSetze stattdessen heutiges Datum." }, 1236{ "You entered an invalid date!\n Will use current date instead.","Ungültiges Datum eingegeben.\nSetze stattdessen heutiges Datum." },
1237{ "Warning","Warnung" }, 1237{ "Warning","Warnung" },
1238{ "Select week number","Wähle Wochen Nummer" }, 1238{ "Select week number","Wähle Wochen Nummer" },
1239{ "Februar","Februar" }, 1239{ "Februar","Februar" },
1240{ "Click on the week number to\nshow week zoomed","Klicke auf die Wochennummer\num die Woche groß zu zeigen" }, 1240{ "Click on the week number to\nshow week zoomed","Klicke auf die Wochennummer\num die Woche groß zu zeigen" },
1241{ "W","W" }, 1241{ "W","W" },
1242{ "Click on this to\nselect week number","Klicke hierauf um\ndie Woche auszuwählen" }, 1242{ "Click on this to\nselect week number","Klicke hierauf um\ndie Woche auszuwählen" },
1243{ "T: %1","T: %1" }, 1243{ "T: %1","T: %1" },
1244{ "Start: ","Start: " }, 1244{ "Start: ","Start: " },
1245{ "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " }, 1245{ "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " },
1246{ "Password for remote access:","Passwort für fernen Zugriff:" }, 1246{ "Password for remote access:","Passwort für fernen Zugriff:" },
1247{ "Remote IP address:","Ferne IP Adresse:" }, 1247{ "Remote IP address:","Ferne IP Adresse:" },
1248{ "Remote port number:","Ferne Port Nummer:" }, 1248{ "Remote port number:","Ferne Port Nummer:" },
1249{ "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." }, 1249{ "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." },
1250{ "Remote from: ","Fern von: " }, 1250{ "Remote from: ","Fern von: " },
1251{ "Local from: ","Lokal von: " }, 1251{ "Local from: ","Lokal von: " },
1252{ "Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n","Synchronisationsübersicht:\n\n %d lokal hinzugefügt\n %d fern hinzugefügt\n %d lokal geändert\n %d fern geändert\n %d lokal gelöscht\n %d fern gelöscht\n %d eingehende ausgefiltert\n %d ausgehende ausgefiltert\n" }, 1252{ "Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n","Synchronisationsübersicht:\n\n %d lokal hinzugefügt\n %d fern hinzugefügt\n %d lokal geändert\n %d fern geändert\n %d lokal gelöscht\n %d fern gelöscht\n %d eingehende ausgefiltert\n %d ausgehende ausgefiltert\n" },
1253{ "Local calendar changed!\n","Lokaler Kalender geändert!\n" }, 1253{ "Local calendar changed!\n","Lokaler Kalender geändert!\n" },
1254{ "Write back","Schreibe zurück" }, 1254{ "Write back","Schreibe zurück" },
1255{ "KO/Pi Synchronization","KO/Pi Synchronisation" }, 1255{ "KO/Pi Synchronization","KO/Pi Synchronisation" },
1256{ "Pi-Sync succesful!","Pi-Sync erfolgreich!" }, 1256{ "Pi-Sync succesful!","Pi-Sync erfolgreich!" },
1257{ "Received sync request","Sync Anfrage erhalten" }, 1257{ "Received sync request","Sync Anfrage erhalten" },
1258{ "Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog.","Ferne Synchronisation ...\n\nBenutze diese Anwendung nicht!\n\nWenn das Syncen fehlschlägt kann\ndieser Dialog geschlossen werden." }, 1258{ "Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog.","Ferne Synchronisation ...\n\nBenutze diese Anwendung nicht!\n\nWenn das Syncen fehlschlägt kann\ndieser Dialog geschlossen werden." },
1259{ "Saving Data to temp file ...","Speichere Daten in temp Datei..." }, 1259{ "Saving Data to temp file ...","Speichere Daten in temp Datei..." },
1260{ "Data saved to temp file!","Daten in temp Datei gespeichert!" }, 1260{ "Data saved to temp file!","Daten in temp Datei gespeichert!" },
1261{ "Sending file...","Sende Datei..." }, 1261{ "Sending file...","Sende Datei..." },
1262{ "Waiting for synced file...","Warte auf gesyncte Daten..." }, 1262{ "Waiting for synced file...","Warte auf gesyncte Daten..." },
1263{ "Receiving synced file...","Gesyncte Daten erhalten..." }, 1263{ "Receiving synced file...","Gesyncte Daten erhalten..." },
1264{ "Received %1 bytes","%1 Bytes erhalten" }, 1264{ "Received %1 bytes","%1 Bytes erhalten" },
1265{ "Writing file to disk...","Speichere Datei..." }, 1265{ "Writing file to disk...","Speichere Datei..." },
1266{ "Pi-Sync successful!","Pi-Sync erfolgreich!" }, 1266{ "Pi-Sync successful!","Pi-Sync erfolgreich!" },
1267{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" }, 1267{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" },
1268{ "Synchronize!","Synchronisiere!" }, 1268{ "Synchronize!","Synchronisiere!" },
1269{ "High clock skew!","Großer Uhrzeitunterschied!" }, 1269{ "High clock skew!","Großer Uhrzeitunterschied!" },
1270{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" }, 1270{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" },
1271{ "The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!","Die Uhren der syncenden Geräte\nhaben einen Unterschied von\nmehr als 5 Minuten. Bitte die\nUhrzeiten anpassen. Sie können\nfalsche Sync-Resultate erhalten!\nBitte das Syncen bestätigen!" }, 1271{ "The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!","Die Uhren der syncenden Geräte\nhaben einen Unterschied von\nmehr als 5 Minuten. Bitte die\nUhrzeiten anpassen. Sie können\nfalsche Sync-Resultate erhalten!\nBitte das Syncen bestätigen!" },
1272{ "","" }, 1272{ "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." },
1273{ "","" }, 1273{ "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" },
1274{ "","" }, 1274{ "","" },
1275{ "","" }, 1275{ "","" },
1276{ "","" }, 1276{ "","" },
1277{ "","" }, 1277{ "","" },
1278{ "","" }, 1278{ "","" },
1279{ "","" }, 1279{ "","" },
1280{ "","" }, 1280{ "","" },
1281{ "","" }, 1281{ "","" },
1282{ "","" }, 1282{ "","" },
1283{ "","" }, 1283{ "","" },
1284{ "","" }, \ No newline at end of file 1284{ "","" }, \ No newline at end of file
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 7c8316f..3dac20b 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2010,521 +2010,533 @@ void CalendarView::writeFilterSettings(KConfig *config)
2010 config->setGroup("General"); 2010 config->setGroup("General");
2011 config->writeEntry("CalendarFilters",filterList); 2011 config->writeEntry("CalendarFilters",filterList);
2012 2012
2013 config->setGroup("FilterView"); 2013 config->setGroup("FilterView");
2014 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 2014 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
2015 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 2015 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
2016} 2016}
2017 2017
2018 2018
2019void CalendarView::goToday() 2019void CalendarView::goToday()
2020{ 2020{
2021 if ( mViewManager->currentView()->isMonthView() ) 2021 if ( mViewManager->currentView()->isMonthView() )
2022 mNavigator->selectTodayMonth(); 2022 mNavigator->selectTodayMonth();
2023 else 2023 else
2024 mNavigator->selectToday(); 2024 mNavigator->selectToday();
2025} 2025}
2026 2026
2027void CalendarView::goNext() 2027void CalendarView::goNext()
2028{ 2028{
2029 mNavigator->selectNext(); 2029 mNavigator->selectNext();
2030} 2030}
2031 2031
2032void CalendarView::goPrevious() 2032void CalendarView::goPrevious()
2033{ 2033{
2034 mNavigator->selectPrevious(); 2034 mNavigator->selectPrevious();
2035} 2035}
2036void CalendarView::goNextMonth() 2036void CalendarView::goNextMonth()
2037{ 2037{
2038 mNavigator->selectNextMonth(); 2038 mNavigator->selectNextMonth();
2039} 2039}
2040 2040
2041void CalendarView::goPreviousMonth() 2041void CalendarView::goPreviousMonth()
2042{ 2042{
2043 mNavigator->selectPreviousMonth(); 2043 mNavigator->selectPreviousMonth();
2044} 2044}
2045void CalendarView::writeLocale() 2045void CalendarView::writeLocale()
2046{ 2046{
2047 //KPimGlobalPrefs::instance()->setGlobalConfig(); 2047 //KPimGlobalPrefs::instance()->setGlobalConfig();
2048#if 0 2048#if 0
2049 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); 2049 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
2050 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); 2050 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
2051 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); 2051 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
2052 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); 2052 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
2053 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 2053 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
2054 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 2054 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
2055 dummy = KOPrefs::instance()->mUserDateFormatShort; 2055 dummy = KOPrefs::instance()->mUserDateFormatShort;
2056 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 2056 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
2057 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 2057 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
2058 KOPrefs::instance()->mDaylightsavingStart, 2058 KOPrefs::instance()->mDaylightsavingStart,
2059 KOPrefs::instance()->mDaylightsavingEnd ); 2059 KOPrefs::instance()->mDaylightsavingEnd );
2060 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); 2060 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId );
2061#endif 2061#endif
2062} 2062}
2063void CalendarView::updateConfig() 2063void CalendarView::updateConfig()
2064{ 2064{
2065 writeLocale(); 2065 writeLocale();
2066 if ( KOPrefs::instance()->mUseAppColors ) 2066 if ( KOPrefs::instance()->mUseAppColors )
2067 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2067 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2068 emit configChanged(); 2068 emit configChanged();
2069 mTodoList->updateConfig(); 2069 mTodoList->updateConfig();
2070 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2070 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2071 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2071 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2072 // To make the "fill window" configurations work 2072 // To make the "fill window" configurations work
2073 //mViewManager->raiseCurrentView(); 2073 //mViewManager->raiseCurrentView();
2074} 2074}
2075 2075
2076 2076
2077void CalendarView::eventChanged(Event *event) 2077void CalendarView::eventChanged(Event *event)
2078{ 2078{
2079 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2079 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2080 //updateUnmanagedViews(); 2080 //updateUnmanagedViews();
2081} 2081}
2082 2082
2083void CalendarView::eventAdded(Event *event) 2083void CalendarView::eventAdded(Event *event)
2084{ 2084{
2085 changeEventDisplay(event,KOGlobals::EVENTADDED); 2085 changeEventDisplay(event,KOGlobals::EVENTADDED);
2086} 2086}
2087 2087
2088void CalendarView::eventToBeDeleted(Event *) 2088void CalendarView::eventToBeDeleted(Event *)
2089{ 2089{
2090 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2090 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2091} 2091}
2092 2092
2093void CalendarView::eventDeleted() 2093void CalendarView::eventDeleted()
2094{ 2094{
2095 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2095 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2096} 2096}
2097void CalendarView::changeTodoDisplay(Todo *which, int action) 2097void CalendarView::changeTodoDisplay(Todo *which, int action)
2098{ 2098{
2099 changeIncidenceDisplay((Incidence *)which, action); 2099 changeIncidenceDisplay((Incidence *)which, action);
2100 mDateNavigator->updateView(); //LR 2100 mDateNavigator->updateView(); //LR
2101 //mDialogManager->updateSearchDialog(); 2101 //mDialogManager->updateSearchDialog();
2102 2102
2103 if (which) { 2103 if (which) {
2104 mViewManager->updateWNview(); 2104 mViewManager->updateWNview();
2105 //mTodoList->updateView(); 2105 //mTodoList->updateView();
2106 } 2106 }
2107 2107
2108} 2108}
2109 2109
2110void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2110void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2111{ 2111{
2112 updateUnmanagedViews(); 2112 updateUnmanagedViews();
2113 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2113 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2114 if ( action == KOGlobals::EVENTDELETED ) { //delete 2114 if ( action == KOGlobals::EVENTDELETED ) { //delete
2115 mCalendar->checkAlarmForIncidence( 0, true ); 2115 mCalendar->checkAlarmForIncidence( 0, true );
2116 if ( mEventViewerDialog ) 2116 if ( mEventViewerDialog )
2117 mEventViewerDialog->hide(); 2117 mEventViewerDialog->hide();
2118 } 2118 }
2119 else 2119 else
2120 mCalendar->checkAlarmForIncidence( which , false ); 2120 mCalendar->checkAlarmForIncidence( which , false );
2121} 2121}
2122 2122
2123// most of the changeEventDisplays() right now just call the view's 2123// most of the changeEventDisplays() right now just call the view's
2124// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2124// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2125void CalendarView::changeEventDisplay(Event *which, int action) 2125void CalendarView::changeEventDisplay(Event *which, int action)
2126{ 2126{
2127 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2127 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2128 changeIncidenceDisplay((Incidence *)which, action); 2128 changeIncidenceDisplay((Incidence *)which, action);
2129 mDateNavigator->updateView(); 2129 mDateNavigator->updateView();
2130 //mDialogManager->updateSearchDialog(); 2130 //mDialogManager->updateSearchDialog();
2131 2131
2132 if (which) { 2132 if (which) {
2133 // If there is an event view visible update the display 2133 // If there is an event view visible update the display
2134 mViewManager->currentView()->changeEventDisplay(which,action); 2134 mViewManager->currentView()->changeEventDisplay(which,action);
2135 // TODO: check, if update needed 2135 // TODO: check, if update needed
2136 // if (which->getTodoStatus()) { 2136 // if (which->getTodoStatus()) {
2137 mTodoList->updateView(); 2137 mTodoList->updateView();
2138 // } 2138 // }
2139 } else { 2139 } else {
2140 mViewManager->currentView()->updateView(); 2140 mViewManager->currentView()->updateView();
2141 } 2141 }
2142} 2142}
2143 2143
2144 2144
2145void CalendarView::updateTodoViews() 2145void CalendarView::updateTodoViews()
2146{ 2146{
2147 mTodoList->updateView(); 2147 mTodoList->updateView();
2148 mViewManager->currentView()->updateView(); 2148 mViewManager->currentView()->updateView();
2149 2149
2150} 2150}
2151 2151
2152 2152
2153void CalendarView::updateView(const QDate &start, const QDate &end) 2153void CalendarView::updateView(const QDate &start, const QDate &end)
2154{ 2154{
2155 mTodoList->updateView(); 2155 mTodoList->updateView();
2156 mViewManager->updateView(start, end); 2156 mViewManager->updateView(start, end);
2157 //mDateNavigator->updateView(); 2157 //mDateNavigator->updateView();
2158} 2158}
2159 2159
2160void CalendarView::updateView() 2160void CalendarView::updateView()
2161{ 2161{
2162 DateList tmpList = mNavigator->selectedDates(); 2162 DateList tmpList = mNavigator->selectedDates();
2163 2163
2164 if ( KOPrefs::instance()->mHideNonStartedTodos ) 2164 if ( KOPrefs::instance()->mHideNonStartedTodos )
2165 mTodoList->updateView(); 2165 mTodoList->updateView();
2166 // We assume that the navigator only selects consecutive days. 2166 // We assume that the navigator only selects consecutive days.
2167 updateView( tmpList.first(), tmpList.last() ); 2167 updateView( tmpList.first(), tmpList.last() );
2168} 2168}
2169 2169
2170void CalendarView::updateUnmanagedViews() 2170void CalendarView::updateUnmanagedViews()
2171{ 2171{
2172 mDateNavigator->updateDayMatrix(); 2172 mDateNavigator->updateDayMatrix();
2173} 2173}
2174 2174
2175int CalendarView::msgItemDelete(const QString name) 2175int CalendarView::msgItemDelete(const QString name)
2176{ 2176{
2177 return KMessageBox::warningContinueCancel(this,name +"\n\n"+ 2177 return KMessageBox::warningContinueCancel(this,name +"\n\n"+
2178 i18n("This item will be\npermanently deleted."), 2178 i18n("This item will be\npermanently deleted."),
2179 i18n("KO/Pi Confirmation"),i18n("Delete")); 2179 i18n("KO/Pi Confirmation"),i18n("Delete"));
2180} 2180}
2181 2181
2182 2182
2183void CalendarView::edit_cut() 2183void CalendarView::edit_cut()
2184{ 2184{
2185 Event *anEvent=0; 2185 Event *anEvent=0;
2186 2186
2187 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2187 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2188 2188
2189 if (mViewManager->currentView()->isEventView()) { 2189 if (mViewManager->currentView()->isEventView()) {
2190 if ( incidence && incidence->type() == "Event" ) { 2190 if ( incidence && incidence->type() == "Event" ) {
2191 anEvent = static_cast<Event *>(incidence); 2191 anEvent = static_cast<Event *>(incidence);
2192 } 2192 }
2193 } 2193 }
2194 2194
2195 if (!anEvent) { 2195 if (!anEvent) {
2196 KNotifyClient::beep(); 2196 KNotifyClient::beep();
2197 return; 2197 return;
2198 } 2198 }
2199 DndFactory factory( mCalendar ); 2199 DndFactory factory( mCalendar );
2200 factory.cutIncidence(anEvent); 2200 factory.cutIncidence(anEvent);
2201 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2201 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2202} 2202}
2203 2203
2204void CalendarView::edit_copy() 2204void CalendarView::edit_copy()
2205{ 2205{
2206 Event *anEvent=0; 2206 Event *anEvent=0;
2207 2207
2208 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2208 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2209 2209
2210 if (mViewManager->currentView()->isEventView()) { 2210 if (mViewManager->currentView()->isEventView()) {
2211 if ( incidence && incidence->type() == "Event" ) { 2211 if ( incidence && incidence->type() == "Event" ) {
2212 anEvent = static_cast<Event *>(incidence); 2212 anEvent = static_cast<Event *>(incidence);
2213 } 2213 }
2214 } 2214 }
2215 2215
2216 if (!anEvent) { 2216 if (!anEvent) {
2217 KNotifyClient::beep(); 2217 KNotifyClient::beep();
2218 return; 2218 return;
2219 } 2219 }
2220 DndFactory factory( mCalendar ); 2220 DndFactory factory( mCalendar );
2221 factory.copyIncidence(anEvent); 2221 factory.copyIncidence(anEvent);
2222} 2222}
2223 2223
2224void CalendarView::edit_paste() 2224void CalendarView::edit_paste()
2225{ 2225{
2226 QDate date = mNavigator->selectedDates().first(); 2226 QDate date = mNavigator->selectedDates().first();
2227 2227
2228 DndFactory factory( mCalendar ); 2228 DndFactory factory( mCalendar );
2229 Event *pastedEvent = (Event *)factory.pasteIncidence( date ); 2229 Event *pastedEvent = (Event *)factory.pasteIncidence( date );
2230 2230
2231 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2231 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2232} 2232}
2233 2233
2234void CalendarView::edit_options() 2234void CalendarView::edit_options()
2235{ 2235{
2236 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; 2236 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId;
2237 emit save(); 2237 emit save();
2238 emit saveStopTimer(); 2238 emit saveStopTimer();
2239 mDialogManager->showOptionsDialog(); 2239 mDialogManager->showOptionsDialog();
2240 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { 2240 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) {
2241 emit saveStopTimer(); 2241 emit saveStopTimer();
2242 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), 2242 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"),
2243 i18n("Timezone settings"),i18n("Reload"))) { 2243 i18n("Timezone settings"),i18n("Reload"))) {
2244 qDebug("KO: TZ reload cancelled "); 2244 qDebug("KO: TZ reload cancelled ");
2245 return; 2245 return;
2246 } 2246 }
2247 qDebug("KO: Timezone change "); 2247 qDebug("KO: Timezone change ");
2248 openCalendar( MainWindow::defaultFileName() ); 2248 openCalendar( MainWindow::defaultFileName() );
2249 setModified(true); 2249 setModified(true);
2250 } 2250 }
2251 else 2251 else
2252 qDebug("KO: No tz change "); 2252 qDebug("KO: No tz change ");
2253 2253
2254} 2254}
2255 2255
2256 2256
2257void CalendarView::slotSelectPickerDate( QDate d) 2257void CalendarView::slotSelectPickerDate( QDate d)
2258{ 2258{
2259 mDateFrame->hide(); 2259 mDateFrame->hide();
2260 if ( mDatePickerMode == 1 ) { 2260 if ( mDatePickerMode == 1 ) {
2261 mNavigator->slotDaySelect( d ); 2261 mNavigator->slotDaySelect( d );
2262 } else if ( mDatePickerMode == 2 ) { 2262 } else if ( mDatePickerMode == 2 ) {
2263 if ( mMoveIncidence->type() == "Todo" ) { 2263 if ( mMoveIncidence->type() == "Todo" ) {
2264 Todo * to = (Todo *) mMoveIncidence; 2264 Todo * to = (Todo *) mMoveIncidence;
2265 QTime tim; 2265 QTime tim;
2266 int len = 0;
2267 if ( to->hasStartDate() && to->hasDueDate() )
2268 len = to->dtStart().secsTo( to->dtDue());
2266 if ( to->hasDueDate() ) 2269 if ( to->hasDueDate() )
2267 tim = to->dtDue().time(); 2270 tim = to->dtDue().time();
2268 else { 2271 else {
2269 tim = QTime ( 0,0,0 ); 2272 tim = QTime ( 0,0,0 );
2270 to->setFloats( true ); 2273 to->setFloats( true );
2271 to->setHasDueDate( true ); 2274 to->setHasDueDate( true );
2272 } 2275 }
2273 QDateTime dt ( d,tim ); 2276 QDateTime dt ( d,tim );
2274 to->setDtDue( dt ); 2277 to->setDtDue( dt );
2278
2279 if ( to->hasStartDate() ) {
2280 if ( len>0 )
2281 to->setDtStart(to->dtDue().addSecs( -len ));
2282 else
2283 if (to->dtStart() > to->dtDue() )
2284 to->setDtStart(to->dtDue().addDays( -3 ));
2285 }
2286
2275 todoChanged( to ); 2287 todoChanged( to );
2276 } else { 2288 } else {
2277 if ( mMoveIncidence->doesRecur() ) { 2289 if ( mMoveIncidence->doesRecur() ) {
2278#if 0 2290#if 0
2279 // PENDING implement this 2291 // PENDING implement this
2280 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); 2292 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate );
2281 mCalendar()->addIncidence( newInc ); 2293 mCalendar()->addIncidence( newInc );
2282 if ( mMoveIncidence->type() == "Todo" ) 2294 if ( mMoveIncidence->type() == "Todo" )
2283 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); 2295 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
2284 else 2296 else
2285 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); 2297 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED);
2286 mMoveIncidence = newInc; 2298 mMoveIncidence = newInc;
2287 2299
2288#endif 2300#endif
2289 } 2301 }
2290 QTime tim = mMoveIncidence->dtStart().time(); 2302 QTime tim = mMoveIncidence->dtStart().time();
2291 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2303 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2292 QDateTime dt ( d,tim ); 2304 QDateTime dt ( d,tim );
2293 mMoveIncidence->setDtStart( dt ); 2305 mMoveIncidence->setDtStart( dt );
2294 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2306 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2295 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2307 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2296 } 2308 }
2297 2309
2298 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2310 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2299 } 2311 }
2300} 2312}
2301 2313
2302void CalendarView::removeCategories() 2314void CalendarView::removeCategories()
2303{ 2315{
2304 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2316 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2305 QStringList catList = KOPrefs::instance()->mCustomCategories; 2317 QStringList catList = KOPrefs::instance()->mCustomCategories;
2306 QStringList catIncList; 2318 QStringList catIncList;
2307 QStringList newCatList; 2319 QStringList newCatList;
2308 Incidence* inc = incList.first(); 2320 Incidence* inc = incList.first();
2309 int i; 2321 int i;
2310 int count = 0; 2322 int count = 0;
2311 while ( inc ) { 2323 while ( inc ) {
2312 newCatList.clear(); 2324 newCatList.clear();
2313 catIncList = inc->categories() ; 2325 catIncList = inc->categories() ;
2314 for( i = 0; i< catIncList.count(); ++i ) { 2326 for( i = 0; i< catIncList.count(); ++i ) {
2315 if ( catList.contains (catIncList[i])) 2327 if ( catList.contains (catIncList[i]))
2316 newCatList.append( catIncList[i] ); 2328 newCatList.append( catIncList[i] );
2317 } 2329 }
2318 newCatList.sort(); 2330 newCatList.sort();
2319 inc->setCategories( newCatList.join(",") ); 2331 inc->setCategories( newCatList.join(",") );
2320 inc = incList.next(); 2332 inc = incList.next();
2321 } 2333 }
2322} 2334}
2323 2335
2324int CalendarView::addCategories() 2336int CalendarView::addCategories()
2325{ 2337{
2326 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2338 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2327 QStringList catList = KOPrefs::instance()->mCustomCategories; 2339 QStringList catList = KOPrefs::instance()->mCustomCategories;
2328 QStringList catIncList; 2340 QStringList catIncList;
2329 Incidence* inc = incList.first(); 2341 Incidence* inc = incList.first();
2330 int i; 2342 int i;
2331 int count = 0; 2343 int count = 0;
2332 while ( inc ) { 2344 while ( inc ) {
2333 catIncList = inc->categories() ; 2345 catIncList = inc->categories() ;
2334 for( i = 0; i< catIncList.count(); ++i ) { 2346 for( i = 0; i< catIncList.count(); ++i ) {
2335 if ( !catList.contains (catIncList[i])) { 2347 if ( !catList.contains (catIncList[i])) {
2336 catList.append( catIncList[i] ); 2348 catList.append( catIncList[i] );
2337 //qDebug("add cat %s ", catIncList[i].latin1()); 2349 //qDebug("add cat %s ", catIncList[i].latin1());
2338 ++count; 2350 ++count;
2339 } 2351 }
2340 } 2352 }
2341 inc = incList.next(); 2353 inc = incList.next();
2342 } 2354 }
2343 catList.sort(); 2355 catList.sort();
2344 KOPrefs::instance()->mCustomCategories = catList; 2356 KOPrefs::instance()->mCustomCategories = catList;
2345 return count; 2357 return count;
2346} 2358}
2347 2359
2348void CalendarView::manageCategories() 2360void CalendarView::manageCategories()
2349{ 2361{
2350 KOCatPrefs* cp = new KOCatPrefs(); 2362 KOCatPrefs* cp = new KOCatPrefs();
2351 cp->show(); 2363 cp->show();
2352 int w =cp->sizeHint().width() ; 2364 int w =cp->sizeHint().width() ;
2353 int h = cp->sizeHint().height() ; 2365 int h = cp->sizeHint().height() ;
2354 int dw = QApplication::desktop()->width(); 2366 int dw = QApplication::desktop()->width();
2355 int dh = QApplication::desktop()->height(); 2367 int dh = QApplication::desktop()->height();
2356 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2368 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2357 if ( !cp->exec() ) { 2369 if ( !cp->exec() ) {
2358 delete cp; 2370 delete cp;
2359 return; 2371 return;
2360 } 2372 }
2361 int count = 0; 2373 int count = 0;
2362 if ( cp->addCat() ) { 2374 if ( cp->addCat() ) {
2363 count = addCategories(); 2375 count = addCategories();
2364 if ( count ) { 2376 if ( count ) {
2365 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2377 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2366 writeSettings(); 2378 writeSettings();
2367 } else 2379 } else
2368 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); 2380 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! "));
2369 } else { 2381 } else {
2370 removeCategories(); 2382 removeCategories();
2371 updateView(); 2383 updateView();
2372 } 2384 }
2373 delete cp; 2385 delete cp;
2374} 2386}
2375 2387
2376void CalendarView::beamIncidence(Incidence * Inc) 2388void CalendarView::beamIncidence(Incidence * Inc)
2377{ 2389{
2378 QPtrList<Incidence> delSel ; 2390 QPtrList<Incidence> delSel ;
2379 delSel.append(Inc); 2391 delSel.append(Inc);
2380 beamIncidenceList( delSel ); 2392 beamIncidenceList( delSel );
2381} 2393}
2382void CalendarView::beamCalendar() 2394void CalendarView::beamCalendar()
2383{ 2395{
2384 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2396 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2385 //qDebug("beamCalendar() "); 2397 //qDebug("beamCalendar() ");
2386 beamIncidenceList( delSel ); 2398 beamIncidenceList( delSel );
2387} 2399}
2388void CalendarView::beamFilteredCalendar() 2400void CalendarView::beamFilteredCalendar()
2389{ 2401{
2390 QPtrList<Incidence> delSel = mCalendar->incidences(); 2402 QPtrList<Incidence> delSel = mCalendar->incidences();
2391 //qDebug("beamFilteredCalendar() "); 2403 //qDebug("beamFilteredCalendar() ");
2392 beamIncidenceList( delSel ); 2404 beamIncidenceList( delSel );
2393} 2405}
2394void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2406void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2395{ 2407{
2396 if ( beamDialog->exec () == QDialog::Rejected ) 2408 if ( beamDialog->exec () == QDialog::Rejected )
2397 return; 2409 return;
2398#ifdef DESKTOP_VERSION 2410#ifdef DESKTOP_VERSION
2399 QString fn = locateLocal( "tmp", "kopibeamfile" ); 2411 QString fn = locateLocal( "tmp", "kopibeamfile" );
2400#else 2412#else
2401 QString fn = "/tmp/kopibeamfile"; 2413 QString fn = "/tmp/kopibeamfile";
2402#endif 2414#endif
2403 QString mes; 2415 QString mes;
2404 bool createbup = true; 2416 bool createbup = true;
2405 if ( createbup ) { 2417 if ( createbup ) {
2406 QString description = "\n"; 2418 QString description = "\n";
2407 CalendarLocal* cal = new CalendarLocal(); 2419 CalendarLocal* cal = new CalendarLocal();
2408 if ( beamDialog->beamLocal() ) 2420 if ( beamDialog->beamLocal() )
2409 cal->setLocalTime(); 2421 cal->setLocalTime();
2410 else 2422 else
2411 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2423 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2412 Incidence *incidence = delSel.first(); 2424 Incidence *incidence = delSel.first();
2413 bool addText = false; 2425 bool addText = false;
2414 if ( delSel.count() < 10 ) 2426 if ( delSel.count() < 10 )
2415 addText = true; 2427 addText = true;
2416 else { 2428 else {
2417 description.sprintf(i18n(" %d items?"),delSel.count() ); 2429 description.sprintf(i18n(" %d items?"),delSel.count() );
2418 } 2430 }
2419 while ( incidence ) { 2431 while ( incidence ) {
2420 Incidence *in = incidence->clone(); 2432 Incidence *in = incidence->clone();
2421 if ( ! in->summary().isEmpty() ) { 2433 if ( ! in->summary().isEmpty() ) {
2422 in->setDescription(""); 2434 in->setDescription("");
2423 } else { 2435 } else {
2424 in->setSummary( in->description().left(20)); 2436 in->setSummary( in->description().left(20));
2425 in->setDescription(""); 2437 in->setDescription("");
2426 } 2438 }
2427 if ( addText ) 2439 if ( addText )
2428 description += in->summary() + "\n"; 2440 description += in->summary() + "\n";
2429 cal->addIncidence( in ); 2441 cal->addIncidence( in );
2430 incidence = delSel.next(); 2442 incidence = delSel.next();
2431 } 2443 }
2432 if ( beamDialog->beamVcal() ) { 2444 if ( beamDialog->beamVcal() ) {
2433 fn += ".vcs"; 2445 fn += ".vcs";
2434 FileStorage storage( cal, fn, new VCalFormat ); 2446 FileStorage storage( cal, fn, new VCalFormat );
2435 storage.save(); 2447 storage.save();
2436 } else { 2448 } else {
2437 fn += ".ics"; 2449 fn += ".ics";
2438 FileStorage storage( cal, fn, new ICalFormat( ) ); 2450 FileStorage storage( cal, fn, new ICalFormat( ) );
2439 storage.save(); 2451 storage.save();
2440 } 2452 }
2441 delete cal; 2453 delete cal;
2442 mes = i18n("KO/Pi: Ready for beaming"); 2454 mes = i18n("KO/Pi: Ready for beaming");
2443 topLevelWidget()->setCaption(mes); 2455 topLevelWidget()->setCaption(mes);
2444 KApplication::convert2latin1( fn ); 2456 KApplication::convert2latin1( fn );
2445#ifndef DESKTOP_VERSION 2457#ifndef DESKTOP_VERSION
2446 Ir *ir = new Ir( this ); 2458 Ir *ir = new Ir( this );
2447 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2459 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2448 ir->send( fn, description, "text/x-vCalendar" ); 2460 ir->send( fn, description, "text/x-vCalendar" );
2449#endif 2461#endif
2450 } 2462 }
2451} 2463}
2452void CalendarView::beamDone( Ir *ir ) 2464void CalendarView::beamDone( Ir *ir )
2453{ 2465{
2454#ifndef DESKTOP_VERSION 2466#ifndef DESKTOP_VERSION
2455 delete ir; 2467 delete ir;
2456#endif 2468#endif
2457 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); 2469 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
2458 topLevelWidget()->raise(); 2470 topLevelWidget()->raise();
2459} 2471}
2460 2472
2461void CalendarView::moveIncidence(Incidence * inc ) 2473void CalendarView::moveIncidence(Incidence * inc )
2462{ 2474{
2463 if ( !inc ) return; 2475 if ( !inc ) return;
2464 showDatePickerPopup(); 2476 showDatePickerPopup();
2465 mDatePickerMode = 2; 2477 mDatePickerMode = 2;
2466 mMoveIncidence = inc ; 2478 mMoveIncidence = inc ;
2467 QDate da; 2479 QDate da;
2468 if ( mMoveIncidence->type() == "Todo" ) { 2480 if ( mMoveIncidence->type() == "Todo" ) {
2469 Todo * to = (Todo *) mMoveIncidence; 2481 Todo * to = (Todo *) mMoveIncidence;
2470 if ( to->hasDueDate() ) 2482 if ( to->hasDueDate() )
2471 da = to->dtDue().date(); 2483 da = to->dtDue().date();
2472 else 2484 else
2473 da = QDate::currentDate(); 2485 da = QDate::currentDate();
2474 } else { 2486 } else {
2475 da = mMoveIncidence->dtStart().date(); 2487 da = mMoveIncidence->dtStart().date();
2476 } 2488 }
2477 //PENDING set date for recurring incidence to date of recurrence 2489 //PENDING set date for recurring incidence to date of recurrence
2478 //mMoveIncidenceOldDate; 2490 //mMoveIncidenceOldDate;
2479 mDatePicker->setDate( da ); 2491 mDatePicker->setDate( da );
2480} 2492}
2481void CalendarView::showDatePickerPopup() 2493void CalendarView::showDatePickerPopup()
2482{ 2494{
2483 if ( mDateFrame->isVisible() ) 2495 if ( mDateFrame->isVisible() )
2484 mDateFrame->hide(); 2496 mDateFrame->hide();
2485 else { 2497 else {
2486 int offX = 0, offY = 0; 2498 int offX = 0, offY = 0;
2487#ifdef DESKTOP_VERSION 2499#ifdef DESKTOP_VERSION
2488 int w =mDatePicker->sizeHint().width() ; 2500 int w =mDatePicker->sizeHint().width() ;
2489 int h = mDatePicker->sizeHint().height() ; 2501 int h = mDatePicker->sizeHint().height() ;
2490 int dw = topLevelWidget()->width(); 2502 int dw = topLevelWidget()->width();
2491 int dh = topLevelWidget()->height(); 2503 int dh = topLevelWidget()->height();
2492 offX = topLevelWidget()->x(); 2504 offX = topLevelWidget()->x();
2493 offY = topLevelWidget()->y(); 2505 offY = topLevelWidget()->y();
2494#else 2506#else
2495 int w =mDatePicker->sizeHint().width() ; 2507 int w =mDatePicker->sizeHint().width() ;
2496 int h = mDatePicker->sizeHint().height() ; 2508 int h = mDatePicker->sizeHint().height() ;
2497 int dw = QApplication::desktop()->width(); 2509 int dw = QApplication::desktop()->width();
2498 int dh = QApplication::desktop()->height(); 2510 int dh = QApplication::desktop()->height();
2499#endif 2511#endif
2500 mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); 2512 mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h );
2501 mDateFrame->show(); 2513 mDateFrame->show();
2502 } 2514 }
2503} 2515}
2504void CalendarView::showDatePicker( ) 2516void CalendarView::showDatePicker( )
2505{ 2517{
2506 showDatePickerPopup(); 2518 showDatePickerPopup();
2507 mDatePickerMode = 1; 2519 mDatePickerMode = 1;
2508 mDatePicker->setDate( mNavigator->selectedDates().first() ); 2520 mDatePicker->setDate( mNavigator->selectedDates().first() );
2509} 2521}
2510 2522
2511void CalendarView::showEventEditor() 2523void CalendarView::showEventEditor()
2512{ 2524{
2513#ifdef DESKTOP_VERSION 2525#ifdef DESKTOP_VERSION
2514 mEventEditor->show(); 2526 mEventEditor->show();
2515#else 2527#else
2516 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { 2528 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) {
2517 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 2529 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2518 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); 2530 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() );
2519 qApp->processEvents(); 2531 qApp->processEvents();
2520 delete mEventEditor; 2532 delete mEventEditor;
2521 mEventEditor = mDialogManager->getEventEditor(); 2533 mEventEditor = mDialogManager->getEventEditor();
2522 topLevelWidget()->setCaption( i18n("") ); 2534 topLevelWidget()->setCaption( i18n("") );
2523 } 2535 }
2524 mEventEditor->showMaximized(); 2536 mEventEditor->showMaximized();
2525#endif 2537#endif
2526} 2538}
2527void CalendarView::showTodoEditor() 2539void CalendarView::showTodoEditor()
2528{ 2540{
2529#ifdef DESKTOP_VERSION 2541#ifdef DESKTOP_VERSION
2530 mTodoEditor->show(); 2542 mTodoEditor->show();
@@ -3557,356 +3569,356 @@ void CalendarView::showFilter(bool visible)
3557 else mFilterView->hide(); 3569 else mFilterView->hide();
3558} 3570}
3559void CalendarView::toggleFilerEnabled( ) 3571void CalendarView::toggleFilerEnabled( )
3560{ 3572{
3561 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); 3573 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() );
3562 if ( !mFilterView->filtersEnabled() ) 3574 if ( !mFilterView->filtersEnabled() )
3563 topLevelWidget()->setCaption( i18n("Filter disabled ") ); 3575 topLevelWidget()->setCaption( i18n("Filter disabled ") );
3564 3576
3565} 3577}
3566void CalendarView::updateFilter() 3578void CalendarView::updateFilter()
3567{ 3579{
3568 CalFilter *filter = mFilterView->selectedFilter(); 3580 CalFilter *filter = mFilterView->selectedFilter();
3569 if (filter) { 3581 if (filter) {
3570 if (mFilterView->filtersEnabled()) { 3582 if (mFilterView->filtersEnabled()) {
3571 topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() ); 3583 topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() );
3572 filter->setEnabled(true); 3584 filter->setEnabled(true);
3573 } 3585 }
3574 else filter->setEnabled(false); 3586 else filter->setEnabled(false);
3575 mCalendar->setFilter(filter); 3587 mCalendar->setFilter(filter);
3576 updateView(); 3588 updateView();
3577 } 3589 }
3578} 3590}
3579 3591
3580void CalendarView::filterEdited() 3592void CalendarView::filterEdited()
3581{ 3593{
3582 mFilterView->updateFilters(); 3594 mFilterView->updateFilters();
3583 updateFilter(); 3595 updateFilter();
3584 writeSettings(); 3596 writeSettings();
3585} 3597}
3586 3598
3587 3599
3588void CalendarView::takeOverEvent() 3600void CalendarView::takeOverEvent()
3589{ 3601{
3590 Incidence *incidence = currentSelection(); 3602 Incidence *incidence = currentSelection();
3591 3603
3592 if (!incidence) return; 3604 if (!incidence) return;
3593 3605
3594 incidence->setOrganizer(KOPrefs::instance()->email()); 3606 incidence->setOrganizer(KOPrefs::instance()->email());
3595 incidence->recreate(); 3607 incidence->recreate();
3596 incidence->setReadOnly(false); 3608 incidence->setReadOnly(false);
3597 3609
3598 updateView(); 3610 updateView();
3599} 3611}
3600 3612
3601void CalendarView::takeOverCalendar() 3613void CalendarView::takeOverCalendar()
3602{ 3614{
3603 // TODO: Create Calendar::allIncidences() function and use it here 3615 // TODO: Create Calendar::allIncidences() function and use it here
3604 3616
3605 QPtrList<Event> events = mCalendar->events(); 3617 QPtrList<Event> events = mCalendar->events();
3606 for(uint i=0; i<events.count(); ++i) { 3618 for(uint i=0; i<events.count(); ++i) {
3607 events.at(i)->setOrganizer(KOPrefs::instance()->email()); 3619 events.at(i)->setOrganizer(KOPrefs::instance()->email());
3608 events.at(i)->recreate(); 3620 events.at(i)->recreate();
3609 events.at(i)->setReadOnly(false); 3621 events.at(i)->setReadOnly(false);
3610 } 3622 }
3611 3623
3612 QPtrList<Todo> todos = mCalendar->todos(); 3624 QPtrList<Todo> todos = mCalendar->todos();
3613 for(uint i=0; i<todos.count(); ++i) { 3625 for(uint i=0; i<todos.count(); ++i) {
3614 todos.at(i)->setOrganizer(KOPrefs::instance()->email()); 3626 todos.at(i)->setOrganizer(KOPrefs::instance()->email());
3615 todos.at(i)->recreate(); 3627 todos.at(i)->recreate();
3616 todos.at(i)->setReadOnly(false); 3628 todos.at(i)->setReadOnly(false);
3617 } 3629 }
3618 3630
3619 QPtrList<Journal> journals = mCalendar->journals(); 3631 QPtrList<Journal> journals = mCalendar->journals();
3620 for(uint i=0; i<journals.count(); ++i) { 3632 for(uint i=0; i<journals.count(); ++i) {
3621 journals.at(i)->setOrganizer(KOPrefs::instance()->email()); 3633 journals.at(i)->setOrganizer(KOPrefs::instance()->email());
3622 journals.at(i)->recreate(); 3634 journals.at(i)->recreate();
3623 journals.at(i)->setReadOnly(false); 3635 journals.at(i)->setReadOnly(false);
3624 } 3636 }
3625 3637
3626 updateView(); 3638 updateView();
3627} 3639}
3628 3640
3629void CalendarView::showIntro() 3641void CalendarView::showIntro()
3630{ 3642{
3631 kdDebug() << "To be implemented." << endl; 3643 kdDebug() << "To be implemented." << endl;
3632} 3644}
3633 3645
3634QWidgetStack *CalendarView::viewStack() 3646QWidgetStack *CalendarView::viewStack()
3635{ 3647{
3636 return mRightFrame; 3648 return mRightFrame;
3637} 3649}
3638 3650
3639QWidget *CalendarView::leftFrame() 3651QWidget *CalendarView::leftFrame()
3640{ 3652{
3641 return mLeftFrame; 3653 return mLeftFrame;
3642} 3654}
3643 3655
3644DateNavigator *CalendarView::dateNavigator() 3656DateNavigator *CalendarView::dateNavigator()
3645{ 3657{
3646 return mNavigator; 3658 return mNavigator;
3647} 3659}
3648 3660
3649KDateNavigator* CalendarView::dateNavigatorWidget() 3661KDateNavigator* CalendarView::dateNavigatorWidget()
3650{ 3662{
3651 return mDateNavigator; 3663 return mDateNavigator;
3652} 3664}
3653void CalendarView::toggleDateNavigatorWidget() 3665void CalendarView::toggleDateNavigatorWidget()
3654{ 3666{
3655 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; 3667 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ;
3656 if (!KOPrefs::instance()->mShowDateNavigator ) 3668 if (!KOPrefs::instance()->mShowDateNavigator )
3657 mDateNavigator->hide(); 3669 mDateNavigator->hide();
3658 else 3670 else
3659 mDateNavigator->show(); 3671 mDateNavigator->show();
3660} 3672}
3661void CalendarView::addView(KOrg::BaseView *view) 3673void CalendarView::addView(KOrg::BaseView *view)
3662{ 3674{
3663 mViewManager->addView(view); 3675 mViewManager->addView(view);
3664} 3676}
3665 3677
3666void CalendarView::showView(KOrg::BaseView *view) 3678void CalendarView::showView(KOrg::BaseView *view)
3667{ 3679{
3668 mViewManager->showView(view, mLeftFrame->isVisible()); 3680 mViewManager->showView(view, mLeftFrame->isVisible());
3669} 3681}
3670 3682
3671Incidence *CalendarView::currentSelection() 3683Incidence *CalendarView::currentSelection()
3672{ 3684{
3673 return mViewManager->currentSelection(); 3685 return mViewManager->currentSelection();
3674} 3686}
3675void CalendarView::toggleAllDaySize() 3687void CalendarView::toggleAllDaySize()
3676{ 3688{
3677 /* 3689 /*
3678 if ( KOPrefs::instance()->mAllDaySize > 47 ) 3690 if ( KOPrefs::instance()->mAllDaySize > 47 )
3679 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; 3691 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2;
3680 else 3692 else
3681 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; 3693 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2;
3682 */ 3694 */
3683 viewManager()->agendaView()->toggleAllDay(); 3695 viewManager()->agendaView()->toggleAllDay();
3684} 3696}
3685void CalendarView::toggleExpand() 3697void CalendarView::toggleExpand()
3686{ 3698{
3687 // if ( mLeftFrame->isHidden() ) { 3699 // if ( mLeftFrame->isHidden() ) {
3688 // mLeftFrame->show(); 3700 // mLeftFrame->show();
3689 // emit calendarViewExpanded( false ); 3701 // emit calendarViewExpanded( false );
3690 // } else { 3702 // } else {
3691 // mLeftFrame->hide(); 3703 // mLeftFrame->hide();
3692 // emit calendarViewExpanded( true ); 3704 // emit calendarViewExpanded( true );
3693 // } 3705 // }
3694 //qDebug(" CalendarView::toggleExpand()"); 3706 //qDebug(" CalendarView::toggleExpand()");
3695 globalFlagBlockAgenda = 1; 3707 globalFlagBlockAgenda = 1;
3696 emit calendarViewExpanded( !mLeftFrame->isHidden() ); 3708 emit calendarViewExpanded( !mLeftFrame->isHidden() );
3697 globalFlagBlockAgenda = 5; 3709 globalFlagBlockAgenda = 5;
3698 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); 3710 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() );
3699 //mViewManager->showView( 0, true ); 3711 //mViewManager->showView( 0, true );
3700} 3712}
3701 3713
3702void CalendarView::calendarModified( bool modified, Calendar * ) 3714void CalendarView::calendarModified( bool modified, Calendar * )
3703{ 3715{
3704 setModified( modified ); 3716 setModified( modified );
3705} 3717}
3706 3718
3707Todo *CalendarView::selectedTodo() 3719Todo *CalendarView::selectedTodo()
3708{ 3720{
3709 Incidence *incidence = currentSelection(); 3721 Incidence *incidence = currentSelection();
3710 if ( incidence && incidence->type() == "Todo" ) { 3722 if ( incidence && incidence->type() == "Todo" ) {
3711 return static_cast<Todo *>( incidence ); 3723 return static_cast<Todo *>( incidence );
3712 } 3724 }
3713 3725
3714 incidence = mTodoList->selectedIncidences().first(); 3726 incidence = mTodoList->selectedIncidences().first();
3715 if ( incidence && incidence->type() == "Todo" ) { 3727 if ( incidence && incidence->type() == "Todo" ) {
3716 return static_cast<Todo *>( incidence ); 3728 return static_cast<Todo *>( incidence );
3717 } 3729 }
3718 3730
3719 return 0; 3731 return 0;
3720} 3732}
3721 3733
3722void CalendarView::dialogClosing(Incidence *in) 3734void CalendarView::dialogClosing(Incidence *in)
3723{ 3735{
3724 // mDialogList.remove(in); 3736 // mDialogList.remove(in);
3725} 3737}
3726 3738
3727void CalendarView::showIncidence() 3739void CalendarView::showIncidence()
3728{ 3740{
3729 Incidence *incidence = currentSelection(); 3741 Incidence *incidence = currentSelection();
3730 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3742 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3731 if ( incidence ) { 3743 if ( incidence ) {
3732 ShowIncidenceVisitor v; 3744 ShowIncidenceVisitor v;
3733 v.act( incidence, this ); 3745 v.act( incidence, this );
3734 } 3746 }
3735} 3747}
3736void CalendarView::editIncidenceDescription() 3748void CalendarView::editIncidenceDescription()
3737{ 3749{
3738 mFlagEditDescription = true; 3750 mFlagEditDescription = true;
3739 editIncidence(); 3751 editIncidence();
3740 mFlagEditDescription = false; 3752 mFlagEditDescription = false;
3741} 3753}
3742void CalendarView::editIncidence() 3754void CalendarView::editIncidence()
3743{ 3755{
3744 // qDebug("editIncidence() "); 3756 // qDebug("editIncidence() ");
3745 Incidence *incidence = currentSelection(); 3757 Incidence *incidence = currentSelection();
3746 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3758 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3747 if ( incidence ) { 3759 if ( incidence ) {
3748 EditIncidenceVisitor v; 3760 EditIncidenceVisitor v;
3749 v.act( incidence, this ); 3761 v.act( incidence, this );
3750 } 3762 }
3751} 3763}
3752 3764
3753void CalendarView::deleteIncidence() 3765void CalendarView::deleteIncidence()
3754{ 3766{
3755 Incidence *incidence = currentSelection(); 3767 Incidence *incidence = currentSelection();
3756 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3768 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3757 if ( incidence ) { 3769 if ( incidence ) {
3758 deleteIncidence(incidence); 3770 deleteIncidence(incidence);
3759 } 3771 }
3760} 3772}
3761 3773
3762void CalendarView::showIncidence(Incidence *incidence) 3774void CalendarView::showIncidence(Incidence *incidence)
3763{ 3775{
3764 if ( incidence ) { 3776 if ( incidence ) {
3765 ShowIncidenceVisitor v; 3777 ShowIncidenceVisitor v;
3766 v.act( incidence, this ); 3778 v.act( incidence, this );
3767 } 3779 }
3768} 3780}
3769 3781
3770void CalendarView::editIncidence(Incidence *incidence) 3782void CalendarView::editIncidence(Incidence *incidence)
3771{ 3783{
3772 if ( incidence ) { 3784 if ( incidence ) {
3773 3785
3774 EditIncidenceVisitor v; 3786 EditIncidenceVisitor v;
3775 v.act( incidence, this ); 3787 v.act( incidence, this );
3776 3788
3777 } 3789 }
3778} 3790}
3779 3791
3780void CalendarView::deleteIncidence(Incidence *incidence) 3792void CalendarView::deleteIncidence(Incidence *incidence)
3781{ 3793{
3782 //qDebug(" CalendarView::deleteIncidence "); 3794 //qDebug(" CalendarView::deleteIncidence ");
3783 if ( incidence ) { 3795 if ( incidence ) {
3784 DeleteIncidenceVisitor v; 3796 DeleteIncidenceVisitor v;
3785 v.act( incidence, this ); 3797 v.act( incidence, this );
3786 } 3798 }
3787} 3799}
3788 3800
3789 3801
3790void CalendarView::lookForOutgoingMessages() 3802void CalendarView::lookForOutgoingMessages()
3791{ 3803{
3792 OutgoingDialog *ogd = mDialogManager->outgoingDialog(); 3804 OutgoingDialog *ogd = mDialogManager->outgoingDialog();
3793 ogd->loadMessages(); 3805 ogd->loadMessages();
3794} 3806}
3795 3807
3796void CalendarView::lookForIncomingMessages() 3808void CalendarView::lookForIncomingMessages()
3797{ 3809{
3798 IncomingDialog *icd = mDialogManager->incomingDialog(); 3810 IncomingDialog *icd = mDialogManager->incomingDialog();
3799 icd->retrieve(); 3811 icd->retrieve();
3800} 3812}
3801 3813
3802bool CalendarView::removeCompletedSubTodos( Todo* t ) 3814bool CalendarView::removeCompletedSubTodos( Todo* t )
3803{ 3815{
3804 bool deleteTodo = true; 3816 bool deleteTodo = true;
3805 QPtrList<Incidence> subTodos; 3817 QPtrList<Incidence> subTodos;
3806 Incidence *aTodo; 3818 Incidence *aTodo;
3807 subTodos = t->relations(); 3819 subTodos = t->relations();
3808 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 3820 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
3809 if (! removeCompletedSubTodos( (Todo*) aTodo )) 3821 if (! removeCompletedSubTodos( (Todo*) aTodo ))
3810 deleteTodo = false; 3822 deleteTodo = false;
3811 } 3823 }
3812 if ( deleteTodo ) { 3824 if ( deleteTodo ) {
3813 if ( t->isCompleted() ) { 3825 if ( t->isCompleted() && !t->doesRecur()) {
3814 checkExternalId( t ); 3826 checkExternalId( t );
3815 mCalendar->deleteTodo( t ); 3827 mCalendar->deleteTodo( t );
3816 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 3828 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
3817 } 3829 }
3818 else 3830 else
3819 deleteTodo = false; 3831 deleteTodo = false;
3820 } 3832 }
3821 return deleteTodo; 3833 return deleteTodo;
3822 3834
3823} 3835}
3824void CalendarView::purgeCompleted() 3836void CalendarView::purgeCompleted()
3825{ 3837{
3826 int result = KMessageBox::warningContinueCancel(this, 3838 int result = KMessageBox::warningContinueCancel(this,
3827 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); 3839 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge"));
3828 3840
3829 if (result == KMessageBox::Continue) { 3841 if (result == KMessageBox::Continue) {
3830 3842
3831 QPtrList<Todo> todoCal; 3843 QPtrList<Todo> todoCal;
3832 QPtrList<Todo> rootTodos; 3844 QPtrList<Todo> rootTodos;
3833 //QPtrList<Incidence> rel; 3845 //QPtrList<Incidence> rel;
3834 Todo *aTodo;//, *rTodo; 3846 Todo *aTodo;//, *rTodo;
3835 Incidence *rIncidence; 3847 Incidence *rIncidence;
3836 bool childDelete = false; 3848 bool childDelete = false;
3837 bool deletedOne = true; 3849 bool deletedOne = true;
3838 todoCal = calendar()->todos(); 3850 todoCal = calendar()->todos();
3839 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 3851 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
3840 if ( !aTodo->relatedTo() ) 3852 if ( !aTodo->relatedTo() )
3841 rootTodos.append( aTodo ); 3853 rootTodos.append( aTodo );
3842 } 3854 }
3843 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 3855 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
3844 removeCompletedSubTodos( aTodo ); 3856 removeCompletedSubTodos( aTodo );
3845 } 3857 }
3846 3858
3847 updateView(); 3859 updateView();
3848 } 3860 }
3849} 3861}
3850 3862
3851void CalendarView::slotCalendarChanged() 3863void CalendarView::slotCalendarChanged()
3852{ 3864{
3853 ; 3865 ;
3854} 3866}
3855 3867
3856void CalendarView::keyPressEvent ( QKeyEvent *e) 3868void CalendarView::keyPressEvent ( QKeyEvent *e)
3857{ 3869{
3858 //qDebug(" alendarView::keyPressEvent "); 3870 //qDebug(" alendarView::keyPressEvent ");
3859 e->ignore(); 3871 e->ignore();
3860} 3872}
3861 3873
3862 3874
3863bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 3875bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
3864{ 3876{
3865 // mSyncManager = manager; 3877 // mSyncManager = manager;
3866 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { 3878 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
3867 qDebug("KO: SyncKDE request detected!"); 3879 qDebug("KO: SyncKDE request detected!");
3868 } 3880 }
3869 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 3881 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
3870 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 3882 mCurrentSyncName = mSyncManager->getCurrentSyncName();
3871 return syncCalendar( filename, mode ); 3883 return syncCalendar( filename, mode );
3872} 3884}
3873bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 3885bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
3874{ 3886{
3875 //mSyncManager = manager; 3887 //mSyncManager = manager;
3876 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 3888 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
3877 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 3889 mCurrentSyncName = mSyncManager->getCurrentSyncName();
3878 if ( resource == "sharp" ) 3890 if ( resource == "sharp" )
3879 syncExternal( 0 ); 3891 syncExternal( 0 );
3880 if ( resource == "phone" ) 3892 if ( resource == "phone" )
3881 syncExternal( 1 ); 3893 syncExternal( 1 );
3882 // pending setmodified 3894 // pending setmodified
3883 return true; 3895 return true;
3884} 3896}
3885void CalendarView::setSyncManager(KSyncManager* manager) 3897void CalendarView::setSyncManager(KSyncManager* manager)
3886{ 3898{
3887 mSyncManager = manager; 3899 mSyncManager = manager;
3888} 3900}
3889 3901
3890void CalendarView::removeSyncInfo( QString syncProfile) 3902void CalendarView::removeSyncInfo( QString syncProfile)
3891{ 3903{
3892 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); 3904 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1());
3893 mCalendar->removeSyncInfo( syncProfile ); 3905 mCalendar->removeSyncInfo( syncProfile );
3894 3906
3895} 3907}
3896 3908
3897void CalendarView::undo_delete() 3909void CalendarView::undo_delete()
3898{ 3910{
3899 //qDebug("undo_delete() "); 3911 //qDebug("undo_delete() ");
3900 Incidence* undo = mCalendar->undoIncidence(); 3912 Incidence* undo = mCalendar->undoIncidence();
3901 if ( !undo ) { 3913 if ( !undo ) {
3902 KMessageBox::sorry(this,i18n("There is nothing to undo!"), 3914 KMessageBox::sorry(this,i18n("There is nothing to undo!"),
3903 i18n("KO/Pi")); 3915 i18n("KO/Pi"));
3904 return; 3916 return;
3905 } 3917 }
3906 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + 3918 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) +
3907 i18n("\nAre you sure you want\nto restore this?"), 3919 i18n("\nAre you sure you want\nto restore this?"),
3908 i18n("KO/Pi Confirmation"),i18n("Restore"))) { 3920 i18n("KO/Pi Confirmation"),i18n("Restore"))) {
3909 mCalendar->undoDeleteIncidence(); 3921 mCalendar->undoDeleteIncidence();
3910 updateView(); 3922 updateView();
3911 } 3923 }
3912} 3924}
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 13d8398..4ff6899 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -746,694 +746,707 @@ void KOAgendaView::createDayLabels()
746 break; 746 break;
747 case 4: 747 case 4:
748 str = dayName.left( 1 ) + " " +QString::number( date.day()); 748 str = dayName.left( 1 ) + " " +QString::number( date.day());
749 749
750 break; 750 break;
751 case 5: 751 case 5:
752 str = dayName.left( 2 ) + " " +QString::number( date.day()); 752 str = dayName.left( 2 ) + " " +QString::number( date.day());
753 753
754 break; 754 break;
755 case 6: 755 case 6:
756 str = dayName.left( 3 ) + " " +QString::number( date.day()); 756 str = dayName.left( 3 ) + " " +QString::number( date.day());
757 break; 757 break;
758 758
759 default: 759 default:
760 break; 760 break;
761 } 761 }
762 if ( oneday ) { 762 if ( oneday ) {
763 QString addString; 763 QString addString;
764 if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) 764 if ( mSelectedDates.first() == QDateTime::currentDateTime().date() )
765 addString = i18n("Today"); 765 addString = i18n("Today");
766 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) 766 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) )
767 addString = i18n("Tomorrow"); 767 addString = i18n("Tomorrow");
768 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) 768 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) )
769 addString = i18n("Yesterday"); 769 addString = i18n("Yesterday");
770 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) 770 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) )
771 addString = i18n("Day before yesterday"); 771 addString = i18n("Day before yesterday");
772 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) 772 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) )
773 addString = i18n("Day after tomorrow"); 773 addString = i18n("Day after tomorrow");
774 if ( !addString.isEmpty() ) { 774 if ( !addString.isEmpty() ) {
775 str = addString+", " + str; 775 str = addString+", " + str;
776 } 776 }
777 } 777 }
778 dayLabel->setText(str); 778 dayLabel->setText(str);
779 //dayLabel->setAlignment(QLabel::AlignHCenter); 779 //dayLabel->setAlignment(QLabel::AlignHCenter);
780 if (date == QDate::currentDate()) { 780 if (date == QDate::currentDate()) {
781 QFont bFont = dlf; 781 QFont bFont = dlf;
782 bFont.setBold( true ); 782 bFont.setBold( true );
783 dayLabel->setFont(bFont); 783 dayLabel->setFont(bFont);
784 } 784 }
785 //dayLayout->addWidget(dayLabel); 785 //dayLayout->addWidget(dayLabel);
786 786
787#ifndef KORG_NOPLUGINS 787#ifndef KORG_NOPLUGINS
788 CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); 788 CalendarDecoration::List cds = KOCore::self()->calendarDecorations();
789 CalendarDecoration *it; 789 CalendarDecoration *it;
790 for(it = cds.first(); it; it = cds.next()) { 790 for(it = cds.first(); it; it = cds.next()) {
791 QString text = it->shortText( date ); 791 QString text = it->shortText( date );
792 if ( !text.isEmpty() ) { 792 if ( !text.isEmpty() ) {
793 QLabel *label = new QLabel(text,mDayLabels); 793 QLabel *label = new QLabel(text,mDayLabels);
794 label->setAlignment(AlignCenter); 794 label->setAlignment(AlignCenter);
795 dayLayout->addWidget(label); 795 dayLayout->addWidget(label);
796 } 796 }
797 } 797 }
798 798
799 for(it = cds.first(); it; it = cds.next()) { 799 for(it = cds.first(); it; it = cds.next()) {
800 QWidget *wid = it->smallWidget(mDayLabels,date); 800 QWidget *wid = it->smallWidget(mDayLabels,date);
801 if ( wid ) { 801 if ( wid ) {
802 // wid->setHeight(20); 802 // wid->setHeight(20);
803 dayLayout->addWidget(wid); 803 dayLayout->addWidget(wid);
804 } 804 }
805 } 805 }
806#endif 806#endif
807 } 807 }
808 if ( ! appendLabels ) { 808 if ( ! appendLabels ) {
809 dayLabel = mDayLabelsList.next(); 809 dayLabel = mDayLabelsList.next();
810 if ( !dayLabel ) 810 if ( !dayLabel )
811 appendLabels = true; 811 appendLabels = true;
812 } 812 }
813 if ( appendLabels ) { 813 if ( appendLabels ) {
814 dayLabel = getNewDaylabel(); 814 dayLabel = getNewDaylabel();
815 } 815 }
816 //dayLabel->hide();//test only 816 //dayLabel->hide();//test only
817 817
818 int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; 818 int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ;
819 if ( offset < 0 ) offset = 0; 819 if ( offset < 0 ) offset = 0;
820 //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); 820 //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 );
821 dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) ); 821 dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) );
822 dayLabel->setFont( dlf ); 822 dayLabel->setFont( dlf );
823 dayLabel->show(); 823 dayLabel->show();
824 dayLabel->setNum( -2 ); 824 dayLabel->setNum( -2 );
825 dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); 825 dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset );
826 //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2); 826 //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2);
827 //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); 827 //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2);
828 if ( !appendLabels ) { 828 if ( !appendLabels ) {
829 dayLabel = mDayLabelsList.next(); 829 dayLabel = mDayLabelsList.next();
830 while ( dayLabel ) { 830 while ( dayLabel ) {
831 //qDebug("!dayLabel %d",dayLabel ); 831 //qDebug("!dayLabel %d",dayLabel );
832 dayLabel->hide(); 832 dayLabel->hide();
833 dayLabel = mDayLabelsList.next(); 833 dayLabel = mDayLabelsList.next();
834 } 834 }
835 } 835 }
836 //mDayLabelsFrame->show(); 836 //mDayLabelsFrame->show();
837 //mDayLabels->show(); 837 //mDayLabels->show();
838 //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight); 838 //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight);
839 //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight ); 839 //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight );
840 mDayLabelsFrame->setFixedHeight( newHight ); 840 mDayLabelsFrame->setFixedHeight( newHight );
841} 841}
842 842
843int KOAgendaView::maxDatesHint() 843int KOAgendaView::maxDatesHint()
844{ 844{
845 // Not sure about the max number of events, so return 0 for now. 845 // Not sure about the max number of events, so return 0 for now.
846 return 0; 846 return 0;
847} 847}
848 848
849int KOAgendaView::currentDateCount() 849int KOAgendaView::currentDateCount()
850{ 850{
851 return mSelectedDates.count(); 851 return mSelectedDates.count();
852} 852}
853 853
854QPtrList<Incidence> KOAgendaView::selectedIncidences() 854QPtrList<Incidence> KOAgendaView::selectedIncidences()
855{ 855{
856 QPtrList<Incidence> selected; 856 QPtrList<Incidence> selected;
857 Incidence *incidence; 857 Incidence *incidence;
858 858
859 incidence = mAgenda->selectedIncidence(); 859 incidence = mAgenda->selectedIncidence();
860 if (incidence) selected.append(incidence); 860 if (incidence) selected.append(incidence);
861 861
862 incidence = mAllDayAgenda->selectedIncidence(); 862 incidence = mAllDayAgenda->selectedIncidence();
863 if (incidence) selected.append(incidence); 863 if (incidence) selected.append(incidence);
864 864
865 return selected; 865 return selected;
866} 866}
867 867
868DateList KOAgendaView::selectedDates() 868DateList KOAgendaView::selectedDates()
869{ 869{
870 DateList selected; 870 DateList selected;
871 QDate qd; 871 QDate qd;
872 872
873 qd = mAgenda->selectedIncidenceDate(); 873 qd = mAgenda->selectedIncidenceDate();
874 if (qd.isValid()) selected.append(qd); 874 if (qd.isValid()) selected.append(qd);
875 875
876 qd = mAllDayAgenda->selectedIncidenceDate(); 876 qd = mAllDayAgenda->selectedIncidenceDate();
877 if (qd.isValid()) selected.append(qd); 877 if (qd.isValid()) selected.append(qd);
878 878
879 return selected; 879 return selected;
880} 880}
881 881
882 882
883void KOAgendaView::updateView() 883void KOAgendaView::updateView()
884{ 884{
885 if ( mBlockUpdating ) 885 if ( mBlockUpdating )
886 return; 886 return;
887 // kdDebug() << "KOAgendaView::updateView()" << endl; 887 // kdDebug() << "KOAgendaView::updateView()" << endl;
888 fillAgenda(); 888 fillAgenda();
889 889
890} 890}
891 891
892 892
893/* 893/*
894 Update configuration settings for the agenda view. This method is not 894 Update configuration settings for the agenda view. This method is not
895 complete. 895 complete.
896*/ 896*/
897void KOAgendaView::updateConfig() 897void KOAgendaView::updateConfig()
898{ 898{
899 if ( mBlockUpdating ) 899 if ( mBlockUpdating )
900 return; 900 return;
901 901
902 902
903 903
904 // update config for children 904 // update config for children
905 mTimeLabels->updateConfig(); 905 mTimeLabels->updateConfig();
906 mAgenda->storePosition(); 906 mAgenda->storePosition();
907 mAgenda->updateConfig(); 907 mAgenda->updateConfig();
908 mAllDayAgenda->updateConfig(); 908 mAllDayAgenda->updateConfig();
909 // widget synchronization 909 // widget synchronization
910 //TODO: find a better way, maybe signal/slot 910 //TODO: find a better way, maybe signal/slot
911 mTimeLabels->positionChanged(); 911 mTimeLabels->positionChanged();
912 912
913 // for some reason, this needs to be called explicitly 913 // for some reason, this needs to be called explicitly
914 mTimeLabels->repaint(); 914 mTimeLabels->repaint();
915 915
916 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); 916 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width());
917 917
918 // ToolTips displaying summary of events 918 // ToolTips displaying summary of events
919 KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() 919 KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance()
920 ->mEnableToolTips); 920 ->mEnableToolTips);
921 921
922 //setHolidayMasks(); 922 //setHolidayMasks();
923 923
924 //createDayLabels(); called by via updateView(); 924 //createDayLabels(); called by via updateView();
925 mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); 925 mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth());
926 updateView(); 926 updateView();
927 mAgenda->restorePosition(); 927 mAgenda->restorePosition();
928} 928}
929 929
930 930
931void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) 931void KOAgendaView::updateEventDates(KOAgendaItem *item, int type)
932{ 932{
933 // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; 933 // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl;
934 //qDebug("KOAgendaView::updateEventDates "); 934 //qDebug("KOAgendaView::updateEventDates ");
935 QDateTime startDt,endDt; 935 QDateTime startDt,endDt;
936 QDate startDate; 936 QDate startDate;
937 int lenInSecs; 937 int lenInSecs;
938 // if ( type == KOAgenda::RESIZETOP ) 938 // if ( type == KOAgenda::RESIZETOP )
939 // qDebug("RESIZETOP "); 939 // qDebug("RESIZETOP ");
940 // if ( type == KOAgenda::RESIZEBOTTOM ) 940 // if ( type == KOAgenda::RESIZEBOTTOM )
941 // qDebug("RESIZEBOTTOM "); 941 // qDebug("RESIZEBOTTOM ");
942 // if ( type == KOAgenda::MOVE ) 942 // if ( type == KOAgenda::MOVE )
943 // qDebug("MOVE "); 943 // qDebug("MOVE ");
944 if ( item->incidence()->type() == "Event" ) { 944 if ( item->incidence()->type() == "Event" ) {
945 startDt =item->incidence()->dtStart(); 945 startDt =item->incidence()->dtStart();
946 endDt = item->incidence()->dtEnd(); 946 endDt = item->incidence()->dtEnd();
947 lenInSecs = startDt.secsTo( endDt ); 947 lenInSecs = startDt.secsTo( endDt );
948 } 948 }
949 949
950 // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); 950 // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED );
951 951
952 if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { 952 if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) {
953 startDate = mSelectedDates[item->mLastMoveXPos]; 953 startDate = mSelectedDates[item->mLastMoveXPos];
954 } else { 954 } else {
955 if (item->cellX() < 0) { 955 if (item->cellX() < 0) {
956 startDate = (mSelectedDates.first()).addDays(item->cellX()); 956 startDate = (mSelectedDates.first()).addDays(item->cellX());
957 } else { 957 } else {
958 startDate = mSelectedDates[item->cellX()]; 958 startDate = mSelectedDates[item->cellX()];
959 } 959 }
960 } 960 }
961 startDt.setDate(startDate); 961 startDt.setDate(startDate);
962 962
963 if (item->incidence()->doesFloat()) { 963 if (item->incidence()->doesFloat()) {
964 endDt.setDate(startDate.addDays(item->cellWidth() - 1)); 964 endDt.setDate(startDate.addDays(item->cellWidth() - 1));
965 } else { 965 } else {
966 if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) 966 if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE )
967 startDt.setTime(mAgenda->gyToTime(item->cellYTop())); 967 startDt.setTime(mAgenda->gyToTime(item->cellYTop()));
968 if ( item->incidence()->type() == "Event" ) { 968 if ( item->incidence()->type() == "Event" ) {
969 if ( type == KOAgenda::MOVE ) { 969 if ( type == KOAgenda::MOVE ) {
970 endDt = startDt.addSecs(lenInSecs); 970 endDt = startDt.addSecs(lenInSecs);
971 971
972 } else if ( type == KOAgenda::RESIZEBOTTOM ) { 972 } else if ( type == KOAgenda::RESIZEBOTTOM ) {
973 if (item->lastMultiItem()) { 973 if (item->lastMultiItem()) {
974 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); 974 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1));
975 endDt.setDate(startDate. 975 endDt.setDate(startDate.
976 addDays(item->lastMultiItem()->cellX() - item->cellX())); 976 addDays(item->lastMultiItem()->cellX() - item->cellX()));
977 } else { 977 } else {
978 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); 978 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1));
979 endDt.setDate(startDate); 979 endDt.setDate(startDate);
980 } 980 }
981 } 981 }
982 } else { 982 } else {
983 // todo 983 // todo
984 if (item->lastMultiItem()) { 984 if (item->lastMultiItem()) {
985 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); 985 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1));
986 endDt.setDate(startDate. 986 endDt.setDate(startDate.
987 addDays(item->lastMultiItem()->cellX() - item->cellX())); 987 addDays(item->lastMultiItem()->cellX() - item->cellX()));
988 } else { 988 } else {
989 //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); 989 //qDebug("tem->cellYBottom() %d",item->cellYBottom() );
990 if ( item->cellYBottom() > 0 ) 990 if ( item->cellYBottom() > 0 )
991 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); 991 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1));
992 else 992 else
993 endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); 993 endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time());
994 endDt.setDate(startDate); 994 endDt.setDate(startDate);
995 } 995 }
996 } 996 }
997 } 997 }
998 if ( item->incidence()->type() == "Event" ) { 998 if ( item->incidence()->type() == "Event" ) {
999 item->incidence()->setDtStart(startDt); 999 item->incidence()->setDtStart(startDt);
1000 (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); 1000 (static_cast<Event*>(item->incidence()))->setDtEnd(endDt);
1001 } else if ( item->incidence()->type() == "Todo" ) { 1001 } else if ( item->incidence()->type() == "Todo" ) {
1002 (static_cast<Todo*>(item->incidence()))->setDtDue(endDt); 1002 Todo* to = static_cast<Todo*>(item->incidence());
1003
1004 int len = 0;
1005 if ( to->hasStartDate() && to->hasDueDate() )
1006 len = to->dtStart().secsTo( to->dtDue());
1007 to->setDtDue(endDt);
1008 if ( to->hasStartDate() ) {
1009 if ( len>0 )
1010 to->setDtStart(to->dtDue().addSecs( -len ));
1011 else
1012 if (to->dtStart() > to->dtDue() )
1013 to->setDtStart(to->dtDue().addDays( -3 ));
1014 }
1015
1003 } 1016 }
1004 //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); 1017 //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() );
1005 item->incidence()->setRevision(item->incidence()->revision()+1); 1018 item->incidence()->setRevision(item->incidence()->revision()+1);
1006 item->setItemDate(startDt.date()); 1019 item->setItemDate(startDt.date());
1007 //item->updateItem(); 1020 //item->updateItem();
1008 if ( item->incidence()->type() == "Todo" ) { 1021 if ( item->incidence()->type() == "Todo" ) {
1009 emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); 1022 emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED );
1010 1023
1011 } 1024 }
1012 else 1025 else
1013 emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); 1026 emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED);
1014 item->updateItem(); 1027 item->updateItem();
1015} 1028}
1016 1029
1017void KOAgendaView::showDates( const QDate &start, const QDate &end ) 1030void KOAgendaView::showDates( const QDate &start, const QDate &end )
1018{ 1031{
1019 // kdDebug() << "KOAgendaView::selectDates" << endl; 1032 // kdDebug() << "KOAgendaView::selectDates" << endl;
1020 1033
1021 mSelectedDates.clear(); 1034 mSelectedDates.clear();
1022 // qDebug("KOAgendaView::showDates "); 1035 // qDebug("KOAgendaView::showDates ");
1023 QDate d = start; 1036 QDate d = start;
1024 while (d <= end) { 1037 while (d <= end) {
1025 mSelectedDates.append(d); 1038 mSelectedDates.append(d);
1026 d = d.addDays( 1 ); 1039 d = d.addDays( 1 );
1027 } 1040 }
1028 1041
1029 // and update the view 1042 // and update the view
1030 fillAgenda(); 1043 fillAgenda();
1031} 1044}
1032 1045
1033 1046
1034void KOAgendaView::showEvents(QPtrList<Event>) 1047void KOAgendaView::showEvents(QPtrList<Event>)
1035{ 1048{
1036 kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; 1049 kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl;
1037} 1050}
1038 1051
1039void KOAgendaView::changeEventDisplay(Event *, int) 1052void KOAgendaView::changeEventDisplay(Event *, int)
1040{ 1053{
1041 // qDebug("KOAgendaView::changeEventDisplay "); 1054 // qDebug("KOAgendaView::changeEventDisplay ");
1042 // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; 1055 // kdDebug() << "KOAgendaView::changeEventDisplay" << endl;
1043 // this should be re-written to be MUCH smarter. Right now we 1056 // this should be re-written to be MUCH smarter. Right now we
1044 // are just playing dumb. 1057 // are just playing dumb.
1045 fillAgenda(); 1058 fillAgenda();
1046} 1059}
1047 1060
1048void KOAgendaView::fillAgenda(const QDate &) 1061void KOAgendaView::fillAgenda(const QDate &)
1049{ 1062{
1050 // qDebug("KOAgendaView::fillAgenda "); 1063 // qDebug("KOAgendaView::fillAgenda ");
1051 fillAgenda(); 1064 fillAgenda();
1052} 1065}
1053 1066
1054void KOAgendaView::fillAgenda() 1067void KOAgendaView::fillAgenda()
1055{ 1068{
1056 if ( globalFlagBlockStartup ) 1069 if ( globalFlagBlockStartup )
1057 return; 1070 return;
1058 if ( globalFlagBlockAgenda == 1 ) 1071 if ( globalFlagBlockAgenda == 1 )
1059 return; 1072 return;
1060 //if ( globalFlagBlockAgenda == 2 ) 1073 //if ( globalFlagBlockAgenda == 2 )
1061 //globalFlagBlockAgenda = 0; 1074 //globalFlagBlockAgenda = 0;
1062 // globalFlagBlockPainting = false; 1075 // globalFlagBlockPainting = false;
1063 if ( globalFlagBlockAgenda == 0 ) 1076 if ( globalFlagBlockAgenda == 0 )
1064 globalFlagBlockAgenda = 1; 1077 globalFlagBlockAgenda = 1;
1065 // clearView(); 1078 // clearView();
1066 //qDebug("fillAgenda()++++ "); 1079 //qDebug("fillAgenda()++++ ");
1067 globalFlagBlockAgendaItemPaint = 1; 1080 globalFlagBlockAgendaItemPaint = 1;
1068 1081
1069 mAllDayAgenda->changeColumns(mSelectedDates.count()); 1082 mAllDayAgenda->changeColumns(mSelectedDates.count());
1070 mAgenda->changeColumns(mSelectedDates.count()); 1083 mAgenda->changeColumns(mSelectedDates.count());
1071 qApp->processEvents(); 1084 qApp->processEvents();
1072 mEventIndicatorTop->changeColumns(mSelectedDates.count()); 1085 mEventIndicatorTop->changeColumns(mSelectedDates.count());
1073 mEventIndicatorBottom->changeColumns(mSelectedDates.count()); 1086 mEventIndicatorBottom->changeColumns(mSelectedDates.count());
1074 setHolidayMasks(); 1087 setHolidayMasks();
1075 1088
1076 //mAgenda->hideUnused(); 1089 //mAgenda->hideUnused();
1077 //mAllDayAgenda->hideUnused(); 1090 //mAllDayAgenda->hideUnused();
1078 1091
1079 // mAgenda->blockNextRepaint( false ); 1092 // mAgenda->blockNextRepaint( false );
1080 // mAgenda->viewport()->repaint(); 1093 // mAgenda->viewport()->repaint();
1081 // mAgenda->blockNextRepaint( true ); 1094 // mAgenda->blockNextRepaint( true );
1082 mMinY.resize(mSelectedDates.count()); 1095 mMinY.resize(mSelectedDates.count());
1083 mMaxY.resize(mSelectedDates.count()); 1096 mMaxY.resize(mSelectedDates.count());
1084 1097
1085 QPtrList<Event> dayEvents; 1098 QPtrList<Event> dayEvents;
1086 1099
1087 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. 1100 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
1088 // Therefore, gtodoset all of them. 1101 // Therefore, gtodoset all of them.
1089 QPtrList<Todo> todos = calendar()->todos(); 1102 QPtrList<Todo> todos = calendar()->todos();
1090 1103
1091 mAgenda->setDateList(mSelectedDates); 1104 mAgenda->setDateList(mSelectedDates);
1092 1105
1093 QDate today = QDate::currentDate(); 1106 QDate today = QDate::currentDate();
1094 1107
1095 DateList::ConstIterator dit; 1108 DateList::ConstIterator dit;
1096 int curCol = 0; 1109 int curCol = 0;
1097 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { 1110 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) {
1098 QDate currentDate = *dit; 1111 QDate currentDate = *dit;
1099 // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() 1112 // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString()
1100 // << endl; 1113 // << endl;
1101 1114
1102 dayEvents = calendar()->events(currentDate,true); 1115 dayEvents = calendar()->events(currentDate,true);
1103 1116
1104 // Default values, which can never be reached 1117 // Default values, which can never be reached
1105 mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; 1118 mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1;
1106 mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; 1119 mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1;
1107 1120
1108 unsigned int numEvent; 1121 unsigned int numEvent;
1109 for(numEvent=0;numEvent<dayEvents.count();++numEvent) { 1122 for(numEvent=0;numEvent<dayEvents.count();++numEvent) {
1110 Event *event = dayEvents.at(numEvent); 1123 Event *event = dayEvents.at(numEvent);
1111 if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) 1124 if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") )
1112 if ( event->uid().left(15) == QString("last-syncEvent-") ) 1125 if ( event->uid().left(15) == QString("last-syncEvent-") )
1113 continue; 1126 continue;
1114 // kdDebug() << " Event: " << event->summary() << endl; 1127 // kdDebug() << " Event: " << event->summary() << endl;
1115 1128
1116 int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; 1129 int beginX = currentDate.daysTo(event->dtStart().date()) + curCol;
1117 int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; 1130 int endX = currentDate.daysTo(event->dtEnd().date()) + curCol;
1118 1131
1119 // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; 1132 // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl;
1120 1133
1121 if (event->doesFloat()) { 1134 if (event->doesFloat()) {
1122 if (event->recurrence()->doesRecur()) { 1135 if (event->recurrence()->doesRecur()) {
1123 mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); 1136 mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol);
1124 } else { 1137 } else {
1125 if (beginX <= 0 && curCol == 0) { 1138 if (beginX <= 0 && curCol == 0) {
1126 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); 1139 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1127 } else if (beginX == curCol) { 1140 } else if (beginX == curCol) {
1128 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); 1141 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1129 } 1142 }
1130 } 1143 }
1131 } else if (event->isMultiDay()) { 1144 } else if (event->isMultiDay()) {
1132 if ( event->doesRecur () ) { 1145 if ( event->doesRecur () ) {
1133 QDate dateit = currentDate; 1146 QDate dateit = currentDate;
1134 int count = 0; 1147 int count = 0;
1135 int max = event->dtStart().daysTo( event->dtEnd() ) +2; 1148 int max = event->dtStart().daysTo( event->dtEnd() ) +2;
1136 while (! event->recursOn( dateit ) && count <= max ) { 1149 while (! event->recursOn( dateit ) && count <= max ) {
1137 ++count; 1150 ++count;
1138 dateit = dateit.addDays( -1 ); 1151 dateit = dateit.addDays( -1 );
1139 } 1152 }
1140 bool ok; 1153 bool ok;
1141 QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); 1154 QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok );
1142 if ( ok ) 1155 if ( ok )
1143 { 1156 {
1144 int secs = event->dtStart().secsTo( event->dtEnd() ); 1157 int secs = event->dtStart().secsTo( event->dtEnd() );
1145 QDateTime nextOcend =nextOcstart.addSecs( secs ); ; 1158 QDateTime nextOcend =nextOcstart.addSecs( secs ); ;
1146 beginX = currentDate.daysTo(nextOcstart.date()) + curCol; 1159 beginX = currentDate.daysTo(nextOcstart.date()) + curCol;
1147 endX = currentDate.daysTo(nextOcend.date()) + curCol; 1160 endX = currentDate.daysTo(nextOcend.date()) + curCol;
1148 1161
1149 } 1162 }
1150 } 1163 }
1151 int startY = mAgenda->timeToY(event->dtStart().time()); 1164 int startY = mAgenda->timeToY(event->dtStart().time());
1152 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; 1165 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1;
1153 //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); 1166 //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol );
1154 if ((beginX <= 0 && curCol == 0) || beginX == curCol) { 1167 if ((beginX <= 0 && curCol == 0) || beginX == curCol) {
1155 //qDebug("insert!!! "); 1168 //qDebug("insert!!! ");
1156 mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); 1169 mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY);
1157 } 1170 }
1158 if (beginX == curCol) { 1171 if (beginX == curCol) {
1159 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); 1172 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59));
1160 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1173 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1161 } else if (endX == curCol) { 1174 } else if (endX == curCol) {
1162 mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); 1175 mMinY[curCol] = mAgenda->timeToY(QTime(0,0));
1163 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1176 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1164 } else { 1177 } else {
1165 mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); 1178 mMinY[curCol] = mAgenda->timeToY(QTime(0,0));
1166 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); 1179 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59));
1167 } 1180 }
1168 } else { 1181 } else {
1169 int startY = mAgenda->timeToY(event->dtStart().time()); 1182 int startY = mAgenda->timeToY(event->dtStart().time());
1170 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; 1183 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1;
1171 if (endY < startY) endY = startY; 1184 if (endY < startY) endY = startY;
1172 mAgenda->insertItem(event,currentDate,curCol,startY,endY); 1185 mAgenda->insertItem(event,currentDate,curCol,startY,endY);
1173 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1186 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1174 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1187 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1175 } 1188 }
1176 } 1189 }
1177 // ---------- [display Todos -------------- 1190 // ---------- [display Todos --------------
1178 unsigned int numTodo; 1191 unsigned int numTodo;
1179 for (numTodo = 0; numTodo < todos.count(); ++numTodo) { 1192 for (numTodo = 0; numTodo < todos.count(); ++numTodo) {
1180 Todo *todo = todos.at(numTodo); 1193 Todo *todo = todos.at(numTodo);
1181 1194
1182 if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date 1195 if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date
1183 1196
1184 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. 1197 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
1185 // Already completed items can be displayed on their original due date 1198 // Already completed items can be displayed on their original due date
1186 //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda 1199 //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda
1187 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; 1200 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda;
1188 bool fillIn = false; 1201 bool fillIn = false;
1189 if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) 1202 if ( todo->hasCompletedDate() && todo->completed().date() == currentDate )
1190 fillIn = true; 1203 fillIn = true;
1191 if ( ! fillIn && !todo->hasCompletedDate() ) 1204 if ( ! fillIn && !todo->hasCompletedDate() )
1192 fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue); 1205 fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue);
1193 if ( fillIn ) { 1206 if ( fillIn ) {
1194 if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue 1207 if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue
1195 if ( KOPrefs::instance()->mShowTodoInAgenda ) 1208 if ( KOPrefs::instance()->mShowTodoInAgenda )
1196 mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); 1209 mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol);
1197 } 1210 }
1198 else { 1211 else {
1199 QDateTime dt; 1212 QDateTime dt;
1200 if ( todo->hasCompletedDate() ) 1213 if ( todo->hasCompletedDate() )
1201 dt = todo->completed(); 1214 dt = todo->completed();
1202 else 1215 else
1203 dt = todo->dtDue();; 1216 dt = todo->dtDue();;
1204 1217
1205 1218
1206 int endY = mAgenda->timeToY(dt.time()) - 1; 1219 int endY = mAgenda->timeToY(dt.time()) - 1;
1207 int hi = (18/KOPrefs::instance()->mHourSize); 1220 int hi = (18/KOPrefs::instance()->mHourSize);
1208 //qDebug("hei %d ",KOPrefs::instance()->mHourSize); 1221 //qDebug("hei %d ",KOPrefs::instance()->mHourSize);
1209 int startY = endY -hi; 1222 int startY = endY -hi;
1210 1223
1211 mAgenda->insertItem(todo,currentDate,curCol,startY,endY); 1224 mAgenda->insertItem(todo,currentDate,curCol,startY,endY);
1212 1225
1213 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1226 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1214 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1227 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1215 } 1228 }
1216 } 1229 }
1217 } 1230 }
1218 // ---------- display Todos] -------------- 1231 // ---------- display Todos] --------------
1219 1232
1220 ++curCol; 1233 ++curCol;
1221 } 1234 }
1222 mAgenda->hideUnused(); 1235 mAgenda->hideUnused();
1223 mAllDayAgenda->hideUnused(); 1236 mAllDayAgenda->hideUnused();
1224 mAgenda->checkScrollBoundaries(); 1237 mAgenda->checkScrollBoundaries();
1225 1238
1226 deleteSelectedDateTime(); 1239 deleteSelectedDateTime();
1227 1240
1228 createDayLabels(); 1241 createDayLabels();
1229 emit incidenceSelected( 0 ); 1242 emit incidenceSelected( 0 );
1230 1243
1231 if ( globalFlagBlockAgenda == 2 ) { 1244 if ( globalFlagBlockAgenda == 2 ) {
1232 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 1245 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
1233 setStartHour( KOPrefs::instance()->mDayBegins ); 1246 setStartHour( KOPrefs::instance()->mDayBegins );
1234 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 1247 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
1235 setStartHour( QTime::currentTime ().hour() ); 1248 setStartHour( QTime::currentTime ().hour() );
1236 // qApp->processEvents(); 1249 // qApp->processEvents();
1237 } 1250 }
1238 qApp->processEvents(); 1251 qApp->processEvents();
1239 //qDebug("qApp->processEvents(); END "); 1252 //qDebug("qApp->processEvents(); END ");
1240 globalFlagBlockAgenda = 0; 1253 globalFlagBlockAgenda = 0;
1241 1254
1242 // mAgenda->hideUnused(); 1255 // mAgenda->hideUnused();
1243 //mAllDayAgenda->hideUnused(); 1256 //mAllDayAgenda->hideUnused();
1244 mAllDayAgenda->drawContentsToPainter(); 1257 mAllDayAgenda->drawContentsToPainter();
1245 mAgenda->drawContentsToPainter(); 1258 mAgenda->drawContentsToPainter();
1246 repaintAgenda(); 1259 repaintAgenda();
1247 // mAgenda->finishUpdate(); 1260 // mAgenda->finishUpdate();
1248 //mAllDayAgenda->finishUpdate(); 1261 //mAllDayAgenda->finishUpdate();
1249 1262
1250 // repaintAgenda(); 1263 // repaintAgenda();
1251 //qApp->processEvents(); 1264 //qApp->processEvents();
1252 // globalFlagBlockAgenda = 0; 1265 // globalFlagBlockAgenda = 0;
1253} 1266}
1254void KOAgendaView::repaintAgenda() 1267void KOAgendaView::repaintAgenda()
1255{ 1268{
1256 // mAllDayAgenda->drawContentsToPainter(); 1269 // mAllDayAgenda->drawContentsToPainter();
1257// mAllDayAgenda->viewport()->repaint( false ); 1270// mAllDayAgenda->viewport()->repaint( false );
1258// mAgenda->drawContentsToPainter(); 1271// mAgenda->drawContentsToPainter();
1259// mAgenda->viewport()->repaint( false ); 1272// mAgenda->viewport()->repaint( false );
1260// qApp->processEvents(); 1273// qApp->processEvents();
1261 1274
1262 //qDebug("KOAgendaView::repaintAgenda() "); 1275 //qDebug("KOAgendaView::repaintAgenda() ");
1263 //qApp->processEvents(); 1276 //qApp->processEvents();
1264 mAgenda->viewport()->repaint( false ); 1277 mAgenda->viewport()->repaint( false );
1265 mAllDayAgenda->viewport()->repaint( false ); 1278 mAllDayAgenda->viewport()->repaint( false );
1266 mAgenda->finishUpdate(); 1279 mAgenda->finishUpdate();
1267 mAllDayAgenda->finishUpdate(); 1280 mAllDayAgenda->finishUpdate();
1268} 1281}
1269 1282
1270 1283
1271void KOAgendaView::clearView() 1284void KOAgendaView::clearView()
1272{ 1285{
1273 // kdDebug() << "ClearView" << endl; 1286 // kdDebug() << "ClearView" << endl;
1274 mAllDayAgenda->clear(); 1287 mAllDayAgenda->clear();
1275 mAgenda->clear(); 1288 mAgenda->clear();
1276} 1289}
1277 1290
1278void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1291void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1279 const QDate &td) 1292 const QDate &td)
1280{ 1293{
1281#ifndef KORG_NOPRINTER 1294#ifndef KORG_NOPRINTER
1282 if (fd == td) 1295 if (fd == td)
1283 calPrinter->preview(CalPrinter::Day, fd, td); 1296 calPrinter->preview(CalPrinter::Day, fd, td);
1284 else 1297 else
1285 calPrinter->preview(CalPrinter::Week, fd, td); 1298 calPrinter->preview(CalPrinter::Week, fd, td);
1286#endif 1299#endif
1287} 1300}
1288 1301
1289// void KOAgendaView::updateMovedTodo() 1302// void KOAgendaView::updateMovedTodo()
1290// { 1303// {
1291// // updateConfig(); 1304// // updateConfig();
1292// // emit updateTodoViews(); 1305// // emit updateTodoViews();
1293// } 1306// }
1294 1307
1295void KOAgendaView::newEvent(int gx, int gy) 1308void KOAgendaView::newEvent(int gx, int gy)
1296{ 1309{
1297 if (!mSelectedDates.count()) return; 1310 if (!mSelectedDates.count()) return;
1298 1311
1299 QDate day = mSelectedDates[gx]; 1312 QDate day = mSelectedDates[gx];
1300 1313
1301 QTime time = mAgenda->gyToTime(gy); 1314 QTime time = mAgenda->gyToTime(gy);
1302 QDateTime dt(day,time); 1315 QDateTime dt(day,time);
1303 // if ( dt < QDateTime::currentDateTime () ) 1316 // if ( dt < QDateTime::currentDateTime () )
1304 // dt = QDateTime::currentDateTime ().addSecs( 3600 ); 1317 // dt = QDateTime::currentDateTime ().addSecs( 3600 );
1305 emit newEventSignal(dt); 1318 emit newEventSignal(dt);
1306} 1319}
1307 1320
1308void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) 1321void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd)
1309{ 1322{
1310 if (!mSelectedDates.count()) return; 1323 if (!mSelectedDates.count()) return;
1311 1324
1312 QDate dayStart = mSelectedDates[gxStart]; 1325 QDate dayStart = mSelectedDates[gxStart];
1313 QDate dayEnd = mSelectedDates[gxEnd]; 1326 QDate dayEnd = mSelectedDates[gxEnd];
1314 1327
1315 QTime timeStart = mAgenda->gyToTime(gyStart); 1328 QTime timeStart = mAgenda->gyToTime(gyStart);
1316 QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); 1329 QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 );
1317 1330
1318 QDateTime dtStart(dayStart,timeStart); 1331 QDateTime dtStart(dayStart,timeStart);
1319 QDateTime dtEnd(dayEnd,timeEnd); 1332 QDateTime dtEnd(dayEnd,timeEnd);
1320 1333
1321 emit newEventSignal(dtStart,dtEnd); 1334 emit newEventSignal(dtStart,dtEnd);
1322} 1335}
1323 1336
1324void KOAgendaView::newEventAllDay(int gx, int ) 1337void KOAgendaView::newEventAllDay(int gx, int )
1325{ 1338{
1326 if (!mSelectedDates.count()) return; 1339 if (!mSelectedDates.count()) return;
1327 1340
1328 QDate day = mSelectedDates[gx]; 1341 QDate day = mSelectedDates[gx];
1329 1342
1330 emit newEventSignal(day); 1343 emit newEventSignal(day);
1331} 1344}
1332void KOAgendaView::newTodoAllDay(int gx, int ) 1345void KOAgendaView::newTodoAllDay(int gx, int )
1333{ 1346{
1334 if (!mSelectedDates.count()) return; 1347 if (!mSelectedDates.count()) return;
1335 1348
1336 QDateTime day (mSelectedDates[gx] ); 1349 QDateTime day (mSelectedDates[gx] );
1337 emit newTodoSignal(day, true); 1350 emit newTodoSignal(day, true);
1338} 1351}
1339void KOAgendaView::newTodo(int gx, int gy ) 1352void KOAgendaView::newTodo(int gx, int gy )
1340{ 1353{
1341 if (!mSelectedDates.count()) return; 1354 if (!mSelectedDates.count()) return;
1342 QDate dayStart = mSelectedDates[gx]; 1355 QDate dayStart = mSelectedDates[gx];
1343 QTime timeStart = mAgenda->gyToTime(gy); 1356 QTime timeStart = mAgenda->gyToTime(gy);
1344 QDateTime dt (dayStart,timeStart); 1357 QDateTime dt (dayStart,timeStart);
1345 emit newTodoSignal( dt, false ); 1358 emit newTodoSignal( dt, false );
1346} 1359}
1347 1360
1348void KOAgendaView::updateEventIndicatorTop(int newY) 1361void KOAgendaView::updateEventIndicatorTop(int newY)
1349{ 1362{
1350 uint i; 1363 uint i;
1351 for(i=0;i<mMinY.size();++i) { 1364 for(i=0;i<mMinY.size();++i) {
1352 if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true); 1365 if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true);
1353 else mEventIndicatorTop->enableColumn(i,false); 1366 else mEventIndicatorTop->enableColumn(i,false);
1354 } 1367 }
1355 1368
1356 mEventIndicatorTop->update(); 1369 mEventIndicatorTop->update();
1357} 1370}
1358 1371
1359void KOAgendaView::updateEventIndicatorBottom(int newY) 1372void KOAgendaView::updateEventIndicatorBottom(int newY)
1360{ 1373{
1361 uint i; 1374 uint i;
1362 for(i=0;i<mMaxY.size();++i) { 1375 for(i=0;i<mMaxY.size();++i) {
1363 if (newY <= mMaxY.at(i)) mEventIndicatorBottom->enableColumn(i,true); 1376 if (newY <= mMaxY.at(i)) mEventIndicatorBottom->enableColumn(i,true);
1364 else mEventIndicatorBottom->enableColumn(i,false); 1377 else mEventIndicatorBottom->enableColumn(i,false);
1365 } 1378 }
1366 1379
1367 mEventIndicatorBottom->update(); 1380 mEventIndicatorBottom->update();
1368} 1381}
1369 1382
1370void KOAgendaView::startDrag(Event *event) 1383void KOAgendaView::startDrag(Event *event)
1371{ 1384{
1372#ifndef KORG_NODND 1385#ifndef KORG_NODND
1373 DndFactory factory( calendar() ); 1386 DndFactory factory( calendar() );
1374 ICalDrag *vd = factory.createDrag(event,this); 1387 ICalDrag *vd = factory.createDrag(event,this);
1375 if (vd->drag()) { 1388 if (vd->drag()) {
1376 kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl; 1389 kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl;
1377 } 1390 }
1378#endif 1391#endif
1379} 1392}
1380 1393
1381void KOAgendaView::readSettings() 1394void KOAgendaView::readSettings()
1382{ 1395{
1383 readSettings(KOGlobals::config()); 1396 readSettings(KOGlobals::config());
1384} 1397}
1385 1398
1386void KOAgendaView::readSettings(KConfig *config) 1399void KOAgendaView::readSettings(KConfig *config)
1387{ 1400{
1388 // kdDebug() << "KOAgendaView::readSettings()" << endl; 1401 // kdDebug() << "KOAgendaView::readSettings()" << endl;
1389 1402
1390 config->setGroup("Views"); 1403 config->setGroup("Views");
1391 1404
1392 //#ifndef KORG_NOSPLITTER 1405 //#ifndef KORG_NOSPLITTER
1393 QValueList<int> sizes = config->readIntListEntry("Separator AgendaView"); 1406 QValueList<int> sizes = config->readIntListEntry("Separator AgendaView");
1394 if (sizes.count() == 2) { 1407 if (sizes.count() == 2) {
1395 if ( sizes[0] < 20 ) { 1408 if ( sizes[0] < 20 ) {
1396 sizes[1] = sizes[1] +20 - sizes[0]; 1409 sizes[1] = sizes[1] +20 - sizes[0];
1397 sizes[0] = 20; 1410 sizes[0] = 20;
1398 } 1411 }
1399 mSplitterAgenda->setSizes(sizes); 1412 mSplitterAgenda->setSizes(sizes);
1400 // qDebug("read %d %d ",sizes[0],sizes[1] ); 1413 // qDebug("read %d %d ",sizes[0],sizes[1] );
1401 } 1414 }
1402 //#endif 1415 //#endif
1403 1416
1404 // updateConfig(); 1417 // updateConfig();
1405} 1418}
1406 1419
1407void KOAgendaView::writeSettings(KConfig *config) 1420void KOAgendaView::writeSettings(KConfig *config)
1408{ 1421{
1409 // kdDebug() << "KOAgendaView::writeSettings()" << endl; 1422 // kdDebug() << "KOAgendaView::writeSettings()" << endl;
1410 1423
1411 config->setGroup("Views"); 1424 config->setGroup("Views");
1412 1425
1413 //#ifndef KORG_NOSPLITTER 1426 //#ifndef KORG_NOSPLITTER
1414 QValueList<int> list = mSplitterAgenda->sizes(); 1427 QValueList<int> list = mSplitterAgenda->sizes();
1415 config->writeEntry("Separator AgendaView",list); 1428 config->writeEntry("Separator AgendaView",list);
1416 //qDebug("write %d %d ", list[0],list[1] ); 1429 //qDebug("write %d %d ", list[0],list[1] );
1417 //#endif 1430 //#endif
1418} 1431}
1419 1432
1420void KOAgendaView::setHolidayMasks() 1433void KOAgendaView::setHolidayMasks()
1421{ 1434{
1422 mHolidayMask.resize(mSelectedDates.count()); 1435 mHolidayMask.resize(mSelectedDates.count());
1423 1436
1424 uint i; 1437 uint i;
1425 for(i=0;i<mSelectedDates.count();++i) { 1438 for(i=0;i<mSelectedDates.count();++i) {
1426 QDate date = mSelectedDates[i]; 1439 QDate date = mSelectedDates[i];
1427 bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6); 1440 bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6);
1428 bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7); 1441 bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7);
1429 bool showHoliday = false; 1442 bool showHoliday = false;
1430 if ( KOPrefs::instance()->mExcludeHolidays ) { 1443 if ( KOPrefs::instance()->mExcludeHolidays ) {
1431 QPtrList<Event> events = calendar()->events( date, true ); 1444 QPtrList<Event> events = calendar()->events( date, true );
1432 Event *event; 1445 Event *event;
1433 for( event = events.first(); event; event = events.next() ) { 1446 for( event = events.first(); event; event = events.next() ) {
1434 if ( event->categories().contains("Holiday") || 1447 if ( event->categories().contains("Holiday") ||
1435 event->categories().contains(i18n("Holiday"))) { 1448 event->categories().contains(i18n("Holiday"))) {
1436 showHoliday = true; 1449 showHoliday = true;
1437 break; 1450 break;
1438 } 1451 }
1439 } 1452 }
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 39921a0..f6c9624 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -149,512 +149,519 @@ void KOEventViewer::setSource(const QString& n)
149 //emit showIncidence(n); 149 //emit showIncidence(n);
150 return; 150 return;
151 } else if (n.startsWith("uid:")) { 151 } else if (n.startsWith("uid:")) {
152 DCOPClient *client = KApplication::kApplication()->dcopClient(); 152 DCOPClient *client = KApplication::kApplication()->dcopClient();
153 const QByteArray noParamData; 153 const QByteArray noParamData;
154 const QByteArray paramData; 154 const QByteArray paramData;
155 QByteArray replyData; 155 QByteArray replyData;
156 QCString replyTypeStr; 156 QCString replyTypeStr;
157#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) 157#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData))
158 bool foundAbbrowser = PING_ABBROWSER; 158 bool foundAbbrowser = PING_ABBROWSER;
159 159
160 if (foundAbbrowser) { 160 if (foundAbbrowser) {
161 //KAddressbook is already running, so just DCOP to it to bring up the contact editor 161 //KAddressbook is already running, so just DCOP to it to bring up the contact editor
162 //client->send("kaddressbook","KAddressBookIface", 162 //client->send("kaddressbook","KAddressBookIface",
163 QDataStream arg(paramData, IO_WriteOnly); 163 QDataStream arg(paramData, IO_WriteOnly);
164 arg << n.mid(6); 164 arg << n.mid(6);
165 client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); 165 client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData);
166 return; 166 return;
167 } else { 167 } else {
168 /* 168 /*
169 KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. 169 KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater.
170 We start it without its main interface 170 We start it without its main interface
171 */ 171 */
172 KIconLoader* iconLoader = new KIconLoader(); 172 KIconLoader* iconLoader = new KIconLoader();
173 QString iconPath = iconLoader->iconPath("go",KIcon::Small); 173 QString iconPath = iconLoader->iconPath("go",KIcon::Small);
174 ActionManager::setStartedKAddressBook(true); 174 ActionManager::setStartedKAddressBook(true);
175 tmpStr = "kaddressbook --editor-only --uid "; 175 tmpStr = "kaddressbook --editor-only --uid ";
176 tmpStr += KProcess::quote(n.mid(6)); 176 tmpStr += KProcess::quote(n.mid(6));
177 KRun::runCommand(tmpStr,"KAddressBook",iconPath); 177 KRun::runCommand(tmpStr,"KAddressBook",iconPath);
178 return; 178 return;
179 } 179 }
180 } else { 180 } else {
181 //QTextBrowser::setSource(n); 181 //QTextBrowser::setSource(n);
182 } 182 }
183#endif 183#endif
184} 184}
185void KOEventViewer::mailToAttendees( bool all ) 185void KOEventViewer::mailToAttendees( bool all )
186{ 186{
187 QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); 187 QPtrList<Attendee> attendees = mCurrentIncidence->attendees();
188 if (attendees.count() == 0) return; 188 if (attendees.count() == 0) return;
189 QStringList nameList; 189 QStringList nameList;
190 QStringList emailList; 190 QStringList emailList;
191 QStringList uidList; 191 QStringList uidList;
192 Attendee* a; 192 Attendee* a;
193 for(a=attendees.first();a;a=attendees.next()) { 193 for(a=attendees.first();a;a=attendees.next()) {
194 if ( !all && !a->RSVP() ) continue; 194 if ( !all && !a->RSVP() ) continue;
195 if (!a->email().isEmpty()) { 195 if (!a->email().isEmpty()) {
196 nameList.append (a->name() ); 196 nameList.append (a->name() );
197 emailList.append (a->email() ); 197 emailList.append (a->email() );
198 uidList.append (a->uid() ); 198 uidList.append (a->uid() );
199 } 199 }
200 } 200 }
201 QString uid = "ComposeMailUIpick2"+mMailSubject; 201 QString uid = "ComposeMailUIpick2"+mMailSubject;
202#ifndef DESKTOP_VERSION 202#ifndef DESKTOP_VERSION
203 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 203 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
204#endif 204#endif
205 205
206} 206}
207void KOEventViewer::addTag(const QString & tag,const QString & text) 207void KOEventViewer::addTag(const QString & tag,const QString & text)
208{ 208{
209 int number=text.contains("\n"); 209 int number=text.contains("\n");
210 QString str = "<" + tag + ">"; 210 QString str = "<" + tag + ">";
211 QString tmpText=text; 211 QString tmpText=text;
212 QString tmpStr=str; 212 QString tmpStr=str;
213 if(number !=-1) 213 if(number !=-1)
214 { 214 {
215 if (number > 0) { 215 if (number > 0) {
216 int pos=0; 216 int pos=0;
217 QString tmp; 217 QString tmp;
218 for(int i=0;i<=number;i++) { 218 for(int i=0;i<=number;i++) {
219 pos=tmpText.find("\n"); 219 pos=tmpText.find("\n");
220 tmp=tmpText.left(pos); 220 tmp=tmpText.left(pos);
221 tmpText=tmpText.right(tmpText.length()-pos-1); 221 tmpText=tmpText.right(tmpText.length()-pos-1);
222 tmpStr+=tmp+"<br>"; 222 tmpStr+=tmp+"<br>";
223 } 223 }
224 } 224 }
225 else tmpStr += tmpText; 225 else tmpStr += tmpText;
226 tmpStr+="</" + tag + ">"; 226 tmpStr+="</" + tag + ">";
227 mText.append(tmpStr); 227 mText.append(tmpStr);
228 } 228 }
229 else 229 else
230 { 230 {
231 str += text + "</" + tag + ">"; 231 str += text + "</" + tag + ">";
232 mText.append(str); 232 mText.append(str);
233 } 233 }
234} 234}
235 235
236void KOEventViewer::setColorMode( int m ) 236void KOEventViewer::setColorMode( int m )
237{ 237{
238 mColorMode = m; 238 mColorMode = m;
239} 239}
240void KOEventViewer::appendEvent(Event *event, int mode ) 240void KOEventViewer::appendEvent(Event *event, int mode )
241{ 241{
242 mMailSubject = ""; 242 mMailSubject = "";
243 mCurrentIncidence = event; 243 mCurrentIncidence = event;
244 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 244 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
245 topLevelWidget()->setCaption(i18n("Event Viewer")); 245 topLevelWidget()->setCaption(i18n("Event Viewer"));
246 if ( mode == 0 ) { 246 if ( mode == 0 ) {
247 addTag("h2",event->summary()); 247 addTag("h2",event->summary());
248 } 248 }
249 else { 249 else {
250 if ( mColorMode == 1 ) { 250 if ( mColorMode == 1 ) {
251 mText +="<font color=\"#00A000\">"; 251 mText +="<font color=\"#00A000\">";
252 } 252 }
253 if ( mColorMode == 2 ) { 253 if ( mColorMode == 2 ) {
254 mText +="<font color=\"#C00000\">"; 254 mText +="<font color=\"#C00000\">";
255 } 255 }
256 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 256 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
257 if ( mode == 1 ) { 257 if ( mode == 1 ) {
258 addTag("h2",i18n( "Local: " ) +event->summary()); 258 addTag("h2",i18n( "Local: " ) +event->summary());
259 } else { 259 } else {
260 addTag("h2",i18n( "Remote: " ) +event->summary()); 260 addTag("h2",i18n( "Remote: " ) +event->summary());
261 } 261 }
262 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 262 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
263 if ( mColorMode ) 263 if ( mColorMode )
264 mText += "</font>"; 264 mText += "</font>";
265 } 265 }
266 mMailSubject += i18n( "Meeting " )+ event->summary(); 266 mMailSubject += i18n( "Meeting " )+ event->summary();
267 if (event->cancelled ()) { 267 if (event->cancelled ()) {
268 mText +="<font color=\"#B00000\">"; 268 mText +="<font color=\"#B00000\">";
269 addTag("i",i18n("This event has been cancelled!")); 269 addTag("i",i18n("This event has been cancelled!"));
270 mText.append("<br>"); 270 mText.append("<br>");
271 mText += "</font>"; 271 mText += "</font>";
272 mMailSubject += i18n("(cancelled)"); 272 mMailSubject += i18n("(cancelled)");
273 } 273 }
274 if (!event->location().isEmpty()) { 274 if (!event->location().isEmpty()) {
275 addTag("b",i18n("Location: ")); 275 addTag("b",i18n("Location: "));
276 mText.append(event->location()+"<br>"); 276 mText.append(event->location()+"<br>");
277 mMailSubject += i18n(" at ") + event->location(); 277 mMailSubject += i18n(" at ") + event->location();
278 } 278 }
279 if (event->doesFloat()) { 279 if (event->doesFloat()) {
280 if (event->isMultiDay()) { 280 if (event->isMultiDay()) {
281 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") 281 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>")
282 .arg(event->dtStartDateStr(shortDate)) 282 .arg(event->dtStartDateStr(shortDate))
283 .arg(event->dtEndDateStr(shortDate))); 283 .arg(event->dtEndDateStr(shortDate)));
284 } else { 284 } else {
285 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); 285 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate )));
286 } 286 }
287 } else { 287 } else {
288 if (event->isMultiDay()) { 288 if (event->isMultiDay()) {
289 mText.append(i18n("<p><b>From:</b> %1</p> ") 289 mText.append(i18n("<p><b>From:</b> %1</p> ")
290 .arg(event->dtStartStr( shortDate))); 290 .arg(event->dtStartStr( shortDate)));
291 mText.append(i18n("<p><b>To:</b> %1</p>") 291 mText.append(i18n("<p><b>To:</b> %1</p>")
292 .arg(event->dtEndStr(shortDate))); 292 .arg(event->dtEndStr(shortDate)));
293 } else { 293 } else {
294 mText.append(i18n("<p><b>On:</b> %1</p> ") 294 mText.append(i18n("<p><b>On:</b> %1</p> ")
295 .arg(event->dtStartDateStr( shortDate ))); 295 .arg(event->dtStartDateStr( shortDate )));
296 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") 296 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>")
297 .arg(event->dtStartTimeStr()) 297 .arg(event->dtStartTimeStr())
298 .arg(event->dtEndTimeStr())); 298 .arg(event->dtEndTimeStr()));
299 } 299 }
300 } 300 }
301 301
302 if (event->recurrence()->doesRecur()) { 302 if (event->recurrence()->doesRecur()) {
303 303
304 QString recurText = event->recurrence()->recurrenceText(); 304 QString recurText = event->recurrence()->recurrenceText();
305 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); 305 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
306 bool ok; 306 bool ok;
307 QDate start = QDate::currentDate(); 307 QDate start = QDate::currentDate();
308 QDateTime next; 308 QDateTime next;
309 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); 309 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
310 if ( ok ) { 310 if ( ok ) {
311 addTag("p",i18n("<b>Next recurrence is on:</b>") ); 311 addTag("p",i18n("<b>Next recurrence is on:</b>") );
312 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); 312 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
313 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); 313 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true );
314 314
315 } else { 315 } else {
316 bool last; 316 bool last;
317 QDate nextd; 317 QDate nextd;
318 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); 318 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
319 if ( last ) { 319 if ( last ) {
320 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 320 addTag("p",i18n("<b>Last recurrence was on:</b>") );
321 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); 321 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
322 } 322 }
323 } 323 }
324 } else { 324 } else {
325 mMailSubject += i18n(" - " )+event->dtStartStr( true ); 325 mMailSubject += i18n(" - " )+event->dtStartStr( true );
326 326
327 } 327 }
328 328
329 329
330 if (event->isAlarmEnabled()) { 330 if (event->isAlarmEnabled()) {
331 Alarm *alarm =event->alarms().first() ; 331 Alarm *alarm =event->alarms().first() ;
332 QDateTime t = alarm->time(); 332 QDateTime t = alarm->time();
333 int min = t.secsTo( event->dtStart() )/60; 333 int min = t.secsTo( event->dtStart() )/60;
334 QString s =i18n("( %1 min before )").arg( min ); 334 QString s =i18n("( %1 min before )").arg( min );
335 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 335 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
336 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 336 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
337 //addTag("p",s); 337 //addTag("p",s);
338 } 338 }
339 339
340 addTag("b",i18n("Access: ")); 340 addTag("b",i18n("Access: "));
341 mText.append(event->secrecyStr()+"<br>"); 341 mText.append(event->secrecyStr()+"<br>");
342 if (!event->description().isEmpty()) { 342 if (!event->description().isEmpty()) {
343 addTag("p",i18n("<b>Details: </b>")); 343 addTag("p",i18n("<b>Details: </b>"));
344 addTag("p",event->description()); 344 addTag("p",event->description());
345 } 345 }
346 346
347 formatCategories(event); 347 formatCategories(event);
348 348
349 formatReadOnly(event); 349 formatReadOnly(event);
350 formatAttendees(event); 350 formatAttendees(event);
351 351
352 setText(mText); 352 setText(mText);
353 //QWhatsThis::add(this,mText); 353 //QWhatsThis::add(this,mText);
354 354
355} 355}
356 356
357void KOEventViewer::appendTodo(Todo *event, int mode ) 357void KOEventViewer::appendTodo(Todo *event, int mode )
358{ 358{
359 mMailSubject = ""; 359 mMailSubject = "";
360 mCurrentIncidence = event; 360 mCurrentIncidence = event;
361 topLevelWidget()->setCaption(i18n("Todo Viewer")); 361 topLevelWidget()->setCaption(i18n("Todo Viewer"));
362 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 362 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
363 if (mode == 0 ) 363 if (mode == 0 )
364 addTag("h2",event->summary()); 364 addTag("h2",event->summary());
365 else { 365 else {
366 if ( mColorMode == 1 ) { 366 if ( mColorMode == 1 ) {
367 mText +="<font color=\"#00A000\">"; 367 mText +="<font color=\"#00A000\">";
368 } 368 }
369 if ( mColorMode == 2 ) { 369 if ( mColorMode == 2 ) {
370 mText +="<font color=\"#B00000\">"; 370 mText +="<font color=\"#B00000\">";
371 } 371 }
372 if ( mode == 1 ) { 372 if ( mode == 1 ) {
373 addTag("h2",i18n( "Local: " ) +event->summary()); 373 addTag("h2",i18n( "Local: " ) +event->summary());
374 } else { 374 } else {
375 addTag("h2",i18n( "Remote: " ) +event->summary()); 375 addTag("h2",i18n( "Remote: " ) +event->summary());
376 } 376 }
377 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 377 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
378 if ( mColorMode ) 378 if ( mColorMode )
379 mText += "</font>"; 379 mText += "</font>";
380 } 380 }
381 mMailSubject += i18n( "Todo " )+ event->summary(); 381 mMailSubject += i18n( "Todo " )+ event->summary();
382 382
383 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { 383 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
384 mText +="<font color=\"#B00000\">"; 384 mText +="<font color=\"#B00000\">";
385 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); 385 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) );
386 mText += "</font>"; 386 mText += "</font>";
387 } else { 387 } else {
388 mText.append(i18n("<p><i>%1 % completed</i></p>") 388 mText.append(i18n("<p><i>%1 % completed</i></p>")
389 .arg(event->percentComplete())); 389 .arg(event->percentComplete()));
390 } 390 }
391 391
392 if (event->cancelled ()) { 392 if (event->cancelled ()) {
393 mText +="<font color=\"#B00000\">"; 393 mText +="<font color=\"#B00000\">";
394 addTag("i",i18n("This todo has been cancelled!")); 394 addTag("i",i18n("This todo has been cancelled!"));
395 mText.append("<br>"); 395 mText.append("<br>");
396 mText += "</font>"; 396 mText += "</font>";
397 mMailSubject += i18n("(cancelled)"); 397 mMailSubject += i18n("(cancelled)");
398 } 398 }
399 399
400 if (!event->location().isEmpty()) { 400 if (!event->location().isEmpty()) {
401 addTag("b",i18n("Location: ")); 401 addTag("b",i18n("Location: "));
402 mText.append(event->location()+"<br>"); 402 mText.append(event->location()+"<br>");
403 mMailSubject += i18n(" at ") + event->location(); 403 mMailSubject += i18n(" at ") + event->location();
404 } 404 }
405
406 if (event->recurrence()->doesRecur()) {
407
408 QString recurText = event->recurrence()->recurrenceText();
409 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
410
411 }
405 if (event->hasStartDate()) { 412 if (event->hasStartDate()) {
406 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); 413 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer)));
407 } 414 }
408 if (event->hasDueDate()) { 415 if (event->hasDueDate()) {
409 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); 416 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer)));
410 mMailSubject += i18n(" - " )+event->dtDueStr( true ); 417 mMailSubject += i18n(" - " )+event->dtDueStr( true );
411 } 418 }
412 addTag("b",i18n("Access: ")); 419 addTag("b",i18n("Access: "));
413 mText.append(event->secrecyStr()+"<br>"); 420 mText.append(event->secrecyStr()+"<br>");
414 if (!event->description().isEmpty()) { 421 if (!event->description().isEmpty()) {
415 addTag("p",i18n("<b>Details: </b>")); 422 addTag("p",i18n("<b>Details: </b>"));
416 addTag("p",event->description()); 423 addTag("p",event->description());
417 } 424 }
418 425
419 formatCategories(event); 426 formatCategories(event);
420 427
421 mText.append(i18n("<p><b>Priority:</b> %2</p>") 428 mText.append(i18n("<p><b>Priority:</b> %2</p>")
422 .arg(QString::number(event->priority()))); 429 .arg(QString::number(event->priority())));
423 430
424 formatReadOnly(event); 431 formatReadOnly(event);
425 formatAttendees(event); 432 formatAttendees(event);
426 if ( event->relatedTo() ) { 433 if ( event->relatedTo() ) {
427 addTag("b",i18n("Parent todo:<br>")); 434 addTag("b",i18n("Parent todo:<br>"));
428 mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); 435 mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>");
429 } 436 }
430 QPtrList<Incidence> Relations = event->relations(); 437 QPtrList<Incidence> Relations = event->relations();
431 Incidence *to; 438 Incidence *to;
432 if ( Relations.first() ) 439 if ( Relations.first() )
433 addTag("b",i18n("Sub todos:<br>")); 440 addTag("b",i18n("Sub todos:<br>"));
434 for (to=Relations.first();to;to=Relations.next()) { 441 for (to=Relations.first();to;to=Relations.next()) {
435 mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); 442 mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>");
436 443
437 } 444 }
438 setText(mText); 445 setText(mText);
439} 446}
440 447
441void KOEventViewer::formatCategories(Incidence *event) 448void KOEventViewer::formatCategories(Incidence *event)
442{ 449{
443 if (!event->categoriesStr().isEmpty()) { 450 if (!event->categoriesStr().isEmpty()) {
444 if (event->categories().count() == 1) { 451 if (event->categories().count() == 1) {
445 addTag("h3",i18n("Category")); 452 addTag("h3",i18n("Category"));
446 } else { 453 } else {
447 addTag("h3",i18n("Categories")); 454 addTag("h3",i18n("Categories"));
448 } 455 }
449 addTag("p",event->categoriesStr()); 456 addTag("p",event->categoriesStr());
450 } 457 }
451} 458}
452void KOEventViewer::formatAttendees(Incidence *event) 459void KOEventViewer::formatAttendees(Incidence *event)
453{ 460{
454 QPtrList<Attendee> attendees = event->attendees(); 461 QPtrList<Attendee> attendees = event->attendees();
455 if (attendees.count()) { 462 if (attendees.count()) {
456 463
457 464
458 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); 465 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
459 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); 466 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small);
460 addTag("h3",i18n("Organizer")); 467 addTag("h3",i18n("Organizer"));
461 mText.append("<ul><li>"); 468 mText.append("<ul><li>");
462#ifndef KORG_NOKABC 469#ifndef KORG_NOKABC
463 470
464#ifdef DESKTOP_VERSION 471#ifdef DESKTOP_VERSION
465 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 472 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
466 KABC::Addressee::List addressList; 473 KABC::Addressee::List addressList;
467 addressList = add_book->findByEmail(event->organizer()); 474 addressList = add_book->findByEmail(event->organizer());
468 KABC::Addressee o = addressList.first(); 475 KABC::Addressee o = addressList.first();
469 if (!o.isEmpty() && addressList.size()<2) { 476 if (!o.isEmpty() && addressList.size()<2) {
470 mText += "<a href=\"uid:" + o.uid() + "\">"; 477 mText += "<a href=\"uid:" + o.uid() + "\">";
471 mText += o.formattedName(); 478 mText += o.formattedName();
472 mText += "</a>\n"; 479 mText += "</a>\n";
473 } else { 480 } else {
474 mText.append(event->organizer()); 481 mText.append(event->organizer());
475 } 482 }
476#else //DESKTOP_VERSION 483#else //DESKTOP_VERSION
477 mText += "<a href=\"uid:organizer\">"; 484 mText += "<a href=\"uid:organizer\">";
478 mText += event->organizer(); 485 mText += event->organizer();
479 mText += "</a>\n"; 486 mText += "</a>\n";
480#endif //DESKTOP_VERSION 487#endif //DESKTOP_VERSION
481 488
482 489
483#else 490#else
484 mText.append(event->organizer()); 491 mText.append(event->organizer());
485#endif 492#endif
486 493
487 if (iconPath) { 494 if (iconPath) {
488 mText += " <a href=\"mailto:" + event->organizer() + "\">"; 495 mText += " <a href=\"mailto:" + event->organizer() + "\">";
489 mText += "<IMG src=\"" + iconPath + "\">"; 496 mText += "<IMG src=\"" + iconPath + "\">";
490 mText += "</a>\n"; 497 mText += "</a>\n";
491 } 498 }
492 mText.append("</li></ul>"); 499 mText.append("</li></ul>");
493 500
494 addTag("h3",i18n("Attendees")); 501 addTag("h3",i18n("Attendees"));
495 Attendee *a; 502 Attendee *a;
496 mText.append("<ul>"); 503 mText.append("<ul>");
497 int a_count = 0; 504 int a_count = 0;
498 int a_count_nr = 0; 505 int a_count_nr = 0;
499 506
500 for(a=attendees.first();a;a=attendees.next()) { 507 for(a=attendees.first();a;a=attendees.next()) {
501#ifndef KORG_NOKABC 508#ifndef KORG_NOKABC
502#ifdef DESKTOP_VERSION 509#ifdef DESKTOP_VERSION
503 if (a->name().isEmpty()) { 510 if (a->name().isEmpty()) {
504 addressList = add_book->findByEmail(a->email()); 511 addressList = add_book->findByEmail(a->email());
505 KABC::Addressee o = addressList.first(); 512 KABC::Addressee o = addressList.first();
506 if (!o.isEmpty() && addressList.size()<2) { 513 if (!o.isEmpty() && addressList.size()<2) {
507 mText += "<a href=\"uid:" + o.uid() + "\">"; 514 mText += "<a href=\"uid:" + o.uid() + "\">";
508 mText += o.formattedName(); 515 mText += o.formattedName();
509 mText += "</a>\n"; 516 mText += "</a>\n";
510 } else { 517 } else {
511 mText += "<li>"; 518 mText += "<li>";
512 mText.append(a->email()); 519 mText.append(a->email());
513 mText += "\n"; 520 mText += "\n";
514 } 521 }
515 } else { 522 } else {
516 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 523 mText += "<li><a href=\"uid:" + a->uid() + "\">";
517 if (!a->name().isEmpty()) mText += a->name(); 524 if (!a->name().isEmpty()) mText += a->name();
518 else mText += a->email(); 525 else mText += a->email();
519 mText += "</a>\n"; 526 mText += "</a>\n";
520 } 527 }
521#else //DESKTOP_VERSION 528#else //DESKTOP_VERSION
522 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 529 mText += "<li><a href=\"uid:" + a->uid() + "\">";
523 if (!a->name().isEmpty()) mText += a->name(); 530 if (!a->name().isEmpty()) mText += a->name();
524 else mText += a->email(); 531 else mText += a->email();
525 mText += "</a>\n"; 532 mText += "</a>\n";
526#endif //DESKTOP_VERSION 533#endif //DESKTOP_VERSION
527#else 534#else
528 //qDebug("nokabc "); 535 //qDebug("nokabc ");
529 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 536 mText += "<li><a href=\"uid:" + a->uid() + "\">";
530 if (!a->name().isEmpty()) mText += a->name(); 537 if (!a->name().isEmpty()) mText += a->name();
531 else mText += a->email(); 538 else mText += a->email();
532 mText += "</a>\n"; 539 mText += "</a>\n";
533#endif 540#endif
534 541
535 542
536 if (!a->email().isEmpty()) { 543 if (!a->email().isEmpty()) {
537 if (iconPath) { 544 if (iconPath) {
538 mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; 545 mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">";
539 if ( a->RSVP() ) { 546 if ( a->RSVP() ) {
540 ++a_count_nr; 547 ++a_count_nr;
541 mText += "<IMG src=\"" + iconPath + "\">"; 548 mText += "<IMG src=\"" + iconPath + "\">";
542 } 549 }
543 else { 550 else {
544 ++a_count; 551 ++a_count;
545 mText += "<IMG src=\"" + NOiconPath + "\">"; 552 mText += "<IMG src=\"" + NOiconPath + "\">";
546 } 553 }
547 mText += "</a>\n"; 554 mText += "</a>\n";
548 } 555 }
549 } 556 }
550 if (a->status() != Attendee::NeedsAction ) 557 if (a->status() != Attendee::NeedsAction )
551 mText +="[" + a->statusStr() + "] "; 558 mText +="[" + a->statusStr() + "] ";
552 if (a->role() == Attendee::Chair ) 559 if (a->role() == Attendee::Chair )
553 mText +="(" + a->roleStr().left(1) + ".)"; 560 mText +="(" + a->roleStr().left(1) + ".)";
554 } 561 }
555 mText.append("</li></ul>"); 562 mText.append("</li></ul>");
556 if ( (a_count+a_count_nr) > 1 ) { 563 if ( (a_count+a_count_nr) > 1 ) {
557 mText += "<a href=\"mailto:ALL\">"; 564 mText += "<a href=\"mailto:ALL\">";
558 mText += i18n( "Mail to all" ); 565 mText += i18n( "Mail to all" );
559 mText += "</a> ( "; 566 mText += "</a> ( ";
560 mText += "<IMG src=\"" + iconPath + "\">"; 567 mText += "<IMG src=\"" + iconPath + "\">";
561 mText += i18n( " and " ); 568 mText += i18n( " and " );
562 mText += "<IMG src=\"" + NOiconPath + "\"> )"; 569 mText += "<IMG src=\"" + NOiconPath + "\"> )";
563 mText += "<br>\n"; 570 mText += "<br>\n";
564 571
565 572
566 } 573 }
567 if ( a_count_nr > 1 ) { 574 if ( a_count_nr > 1 ) {
568 mText += "<a href=\"mailto:RSVP\">"; 575 mText += "<a href=\"mailto:RSVP\">";
569 mText += i18n( "Mail to selected" ); 576 mText += i18n( "Mail to selected" );
570 mText += "</a> ( "; 577 mText += "</a> ( ";
571 mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath ); 578 mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath );
572 mText += "<br>\n"; 579 mText += "<br>\n";
573 } 580 }
574 } 581 }
575 582
576} 583}
577void KOEventViewer::appendJournal(Journal *jour, int mode ) 584void KOEventViewer::appendJournal(Journal *jour, int mode )
578{ 585{
579 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 586 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
580 if (mode == 0 ) { 587 if (mode == 0 ) {
581 addTag("h2",i18n("Journal from: ")); 588 addTag("h2",i18n("Journal from: "));
582 } 589 }
583 else { 590 else {
584 if ( mode == 1 ) { 591 if ( mode == 1 ) {
585 addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); 592 addTag("h2",i18n( "Local: " ) +i18n("Journal from: "));
586 } else { 593 } else {
587 addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); 594 addTag("h2",i18n( "Remote: " ) +i18n("Journal from: "));
588 } 595 }
589 } 596 }
590 topLevelWidget()->setCaption("Journal Viewer"); 597 topLevelWidget()->setCaption("Journal Viewer");
591 mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); 598 mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer)));
592 addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); 599 addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) );
593 if (!jour->description().isEmpty()) { 600 if (!jour->description().isEmpty()) {
594 addTag("p",jour->description()); 601 addTag("p",jour->description());
595 } 602 }
596 setText(mText); 603 setText(mText);
597} 604}
598 605
599void KOEventViewer::formatReadOnly(Incidence *event) 606void KOEventViewer::formatReadOnly(Incidence *event)
600{ 607{
601 if (event->isReadOnly()) { 608 if (event->isReadOnly()) {
602 addTag("p","<em>(" + i18n("read-only") + ")</em>"); 609 addTag("p","<em>(" + i18n("read-only") + ")</em>");
603 } 610 }
604} 611}
605void KOEventViewer::setSyncMode( bool b ) 612void KOEventViewer::setSyncMode( bool b )
606{ 613{
607 mSyncMode = b; 614 mSyncMode = b;
608} 615}
609 616
610 617
611void KOEventViewer::setTodo(Todo *event, bool clearV ) 618void KOEventViewer::setTodo(Todo *event, bool clearV )
612{ 619{
613 if ( clearV ) 620 if ( clearV )
614 clearEvents(); 621 clearEvents();
615 if ( mSyncMode ) { 622 if ( mSyncMode ) {
616 if ( clearV ) 623 if ( clearV )
617 appendTodo(event,1 ); 624 appendTodo(event,1 );
618 else 625 else
619 appendTodo(event,2); 626 appendTodo(event,2);
620 } else 627 } else
621 appendTodo(event); 628 appendTodo(event);
622} 629}
623void KOEventViewer::setJournal(Journal *event, bool clearV ) 630void KOEventViewer::setJournal(Journal *event, bool clearV )
624{ 631{
625 if ( clearV ) 632 if ( clearV )
626 clearEvents(); 633 clearEvents();
627 if ( mSyncMode ) { 634 if ( mSyncMode ) {
628 if ( clearV ) 635 if ( clearV )
629 appendJournal(event, 1); 636 appendJournal(event, 1);
630 else 637 else
631 appendJournal(event, 2); 638 appendJournal(event, 2);
632 } else 639 } else
633 appendJournal(event); 640 appendJournal(event);
634} 641}
635 642
636void KOEventViewer::setEvent(Event *event) 643void KOEventViewer::setEvent(Event *event)
637{ 644{
638 clearEvents(); 645 clearEvents();
639 if ( mSyncMode ) 646 if ( mSyncMode )
640 appendEvent(event, 1); 647 appendEvent(event, 1);
641 else 648 else
642 appendEvent(event); 649 appendEvent(event);
643} 650}
644 651
645void KOEventViewer::addEvent(Event *event) 652void KOEventViewer::addEvent(Event *event)
646{ 653{
647 if ( mSyncMode ) 654 if ( mSyncMode )
648 appendEvent(event, 2); 655 appendEvent(event, 2);
649 else 656 else
650 appendEvent(event); 657 appendEvent(event);
651} 658}
652 659
653void KOEventViewer::clearEvents(bool now) 660void KOEventViewer::clearEvents(bool now)
654{ 661{
655 mText = ""; 662 mText = "";
656 if (now) setText(mText); 663 if (now) setText(mText);
657} 664}
658 665
659void KOEventViewer::addText(QString text) 666void KOEventViewer::addText(QString text)
660{ 667{
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index acd9265..d8e940b 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -1,415 +1,415 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 1999 Preston Brown 3 Copyright (c) 1999 Preston Brown
4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qlistview.h> 25#include <qlistview.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qpopupmenu.h> 28#include <qpopupmenu.h>
29#include <qprogressbar.h> 29#include <qprogressbar.h>
30#include <qfileinfo.h> 30#include <qfileinfo.h>
31#include <qmessagebox.h> 31#include <qmessagebox.h>
32#include <qdialog.h> 32#include <qdialog.h>
33#include <qtextstream.h> 33#include <qtextstream.h>
34#include <qdir.h> 34#include <qdir.h>
35#include <qwhatsthis.h> 35#include <qwhatsthis.h>
36#include <qregexp.h> 36#include <qregexp.h>
37 37
38#include <klocale.h> 38#include <klocale.h>
39#include <kdebug.h> 39#include <kdebug.h>
40#include <kiconloader.h> 40#include <kiconloader.h>
41#include <kglobal.h> 41#include <kglobal.h>
42 42
43#include <libkdepim/kpimglobalprefs.h> 43#include <libkdepim/kpimglobalprefs.h>
44#include <libkcal/calendar.h> 44#include <libkcal/calendar.h>
45#include <libkcal/calendarlocal.h> 45#include <libkcal/calendarlocal.h>
46#include <libkcal/icalformat.h> 46#include <libkcal/icalformat.h>
47#include <libkcal/vcalformat.h> 47#include <libkcal/vcalformat.h>
48#include <libkcal/recurrence.h> 48#include <libkcal/recurrence.h>
49#include <libkcal/filestorage.h> 49#include <libkcal/filestorage.h>
50#include <libkdepim/categoryselectdialog.h> 50#include <libkdepim/categoryselectdialog.h>
51#include <libkcal/kincidenceformatter.h> 51#include <libkcal/kincidenceformatter.h>
52#ifndef DESKTOP_VERSION 52#ifndef DESKTOP_VERSION
53#include <qpe/qpeapplication.h> 53#include <qpe/qpeapplication.h>
54#else 54#else
55#include <qapplication.h> 55#include <qapplication.h>
56#endif 56#endif
57 57
58#ifndef KORG_NOPRINTER 58#ifndef KORG_NOPRINTER
59#include "calprinter.h" 59#include "calprinter.h"
60#endif 60#endif
61#include "koglobals.h" 61#include "koglobals.h"
62#include "koprefs.h" 62#include "koprefs.h"
63#include "kfiledialog.h" 63#include "kfiledialog.h"
64 64
65#include "kolistview.h" 65#include "kolistview.h"
66 66
67 67
68 68
69 69
70class KOListViewWhatsThis :public QWhatsThis 70class KOListViewWhatsThis :public QWhatsThis
71{ 71{
72public: 72public:
73 KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; 73 KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { };
74 74
75protected: 75protected:
76 virtual QString text( const QPoint& p) 76 virtual QString text( const QPoint& p)
77 { 77 {
78 return _view->getWhatsThisText(p) ; 78 return _view->getWhatsThisText(p) ;
79 } 79 }
80private: 80private:
81 QWidget* _wid; 81 QWidget* _wid;
82 KOListView * _view; 82 KOListView * _view;
83}; 83};
84 84
85 85
86ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) 86ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date )
87{ 87{
88 mItem = item; 88 mItem = item;
89 mDate = date; 89 mDate = date;
90} 90}
91 91
92ListItemVisitor::~ListItemVisitor() 92ListItemVisitor::~ListItemVisitor()
93{ 93{
94} 94}
95 95
96bool ListItemVisitor::visit(Event *e) 96bool ListItemVisitor::visit(Event *e)
97{ 97{
98 98
99 bool ok = false; 99 bool ok = false;
100 QString start, end; 100 QString start, end;
101 QDate ds, de; 101 QDate ds, de;
102 if ( e->doesRecur() ) { 102 if ( e->doesRecur() ) {
103 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); 103 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date();
104 if ( ok ) { 104 if ( ok ) {
105 int days = e->dtStart().date().daysTo(e->dtEnd().date() ); 105 int days = e->dtStart().date().daysTo(e->dtEnd().date() );
106 start = KGlobal::locale()->formatDate(ds,true); 106 start = KGlobal::locale()->formatDate(ds,true);
107 de = ds.addDays( days); 107 de = ds.addDays( days);
108 end = KGlobal::locale()->formatDate(de,true); 108 end = KGlobal::locale()->formatDate(de,true);
109 } 109 }
110 110
111 } 111 }
112 if ( ! ok ) { 112 if ( ! ok ) {
113 start =e->dtStartDateStr(); 113 start =e->dtStartDateStr();
114 end = e->dtEndDateStr(); 114 end = e->dtEndDateStr();
115 ds = e->dtStart().date(); 115 ds = e->dtStart().date();
116 de = e->dtEnd().date(); 116 de = e->dtEnd().date();
117 } 117 }
118 mItem->setText(0,e->summary()); 118 mItem->setText(0,e->summary());
119 mItem->setText(1,start); 119 mItem->setText(1,start);
120 mItem->setText(2,e->dtStartTimeStr()); 120 mItem->setText(2,e->dtStartTimeStr());
121 mItem->setText(3,end); 121 mItem->setText(3,end);
122 mItem->setText(4,e->dtEndTimeStr()); 122 mItem->setText(4,e->dtEndTimeStr());
123 mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No")); 123 mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No"));
124 mItem->setText(6, e->recurrence()->recurrenceText()); 124 mItem->setText(6, e->recurrence()->recurrenceText());
125 mItem->setText(7,"---"); 125 mItem->setText(7,"---");
126 mItem->setText(8,"---"); 126 mItem->setText(8,"---");
127 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); 127 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No"));
128 mItem->setText(10,e->categoriesStr()); 128 mItem->setText(10,e->categoriesStr());
129 129
130 QString key; 130 QString key;
131 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); 131 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time();
132 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); 132 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute());
133 mItem->setSortKey(1,key); 133 mItem->setSortKey(1,key);
134 134
135 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); 135 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time();
136 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); 136 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute());
137 mItem->setSortKey(3,key); 137 mItem->setSortKey(3,key);
138 138
139 return true; 139 return true;
140} 140}
141 141
142bool ListItemVisitor::visit(Todo *t) 142bool ListItemVisitor::visit(Todo *t)
143{ 143{
144 mItem->setText(0,i18n("To-Do: %1").arg(t->summary())); 144 mItem->setText(0,i18n("To-Do: %1").arg(t->summary()));
145 if (t->hasStartDate()) { 145 if (t->hasStartDate()) {
146 mItem->setText(1,t->dtStartDateStr()); 146 mItem->setText(1,t->dtStartDateStr());
147 if (t->doesFloat()) { 147 if (t->doesFloat()) {
148 mItem->setText(2,"---"); 148 mItem->setText(2,"---");
149 } else { 149 } else {
150 mItem->setText(2,t->dtStartTimeStr()); 150 mItem->setText(2,t->dtStartTimeStr());
151 } 151 }
152 } else { 152 } else {
153 mItem->setText(1,"---"); 153 mItem->setText(1,"---");
154 mItem->setText(2,"---"); 154 mItem->setText(2,"---");
155 } 155 }
156 mItem->setText(3,"---"); 156 mItem->setText(3,"---");
157 mItem->setText(4,"---"); 157 mItem->setText(4,"---");
158 mItem->setText(5,t->isAlarmEnabled() ? i18n("Yes") : i18n("No")); 158 mItem->setText(5,t->isAlarmEnabled() ? i18n("Yes") : i18n("No"));
159 mItem->setText(6,"---"); 159 mItem->setText(6, t->recurrence()->recurrenceText());
160 if (t->hasDueDate()) { 160 if (t->hasDueDate()) {
161 mItem->setText(7,t->dtDueDateStr()); 161 mItem->setText(7,t->dtDueDateStr());
162 if (t->doesFloat()) { 162 if (t->doesFloat()) {
163 mItem->setText(8,"---"); 163 mItem->setText(8,"---");
164 } else { 164 } else {
165 mItem->setText(8,t->dtDueTimeStr()); 165 mItem->setText(8,t->dtDueTimeStr());
166 } 166 }
167 } else { 167 } else {
168 mItem->setText(7,"---"); 168 mItem->setText(7,"---");
169 mItem->setText(8,"---"); 169 mItem->setText(8,"---");
170 } 170 }
171 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); 171 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No"));
172 mItem->setText(10,t->categoriesStr()); 172 mItem->setText(10,t->categoriesStr());
173 173
174 QString key; 174 QString key;
175 QDate d; 175 QDate d;
176 if (t->hasDueDate()) { 176 if (t->hasDueDate()) {
177 d = t->dtDue().date(); 177 d = t->dtDue().date();
178 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); 178 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time();
179 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 179 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
180 mItem->setSortKey(7,key); 180 mItem->setSortKey(7,key);
181 } 181 }
182 if ( t->hasStartDate() ) { 182 if ( t->hasStartDate() ) {
183 d = t->dtStart().date(); 183 d = t->dtStart().date();
184 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); 184 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time();
185 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 185 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
186 mItem->setSortKey(1,key); 186 mItem->setSortKey(1,key);
187 } 187 }
188 return true; 188 return true;
189} 189}
190 190
191bool ListItemVisitor::visit(Journal * j) 191bool ListItemVisitor::visit(Journal * j)
192{ 192{
193 QString des = j->description().left(50); 193 QString des = j->description().left(50);
194 des = des.simplifyWhiteSpace (); 194 des = des.simplifyWhiteSpace ();
195 des.replace (QRegExp ("\\n"),"" ); 195 des.replace (QRegExp ("\\n"),"" );
196 des.replace (QRegExp ("\\r"),"" ); 196 des.replace (QRegExp ("\\r"),"" );
197 mItem->setText(0,i18n("Journal")+": "+des.left(25)); 197 mItem->setText(0,i18n("Journal")+": "+des.left(25));
198 mItem->setText(1,j->dtStartDateStr()); 198 mItem->setText(1,j->dtStartDateStr());
199 mItem->setText(2,"---"); 199 mItem->setText(2,"---");
200 mItem->setText(3,"---"); 200 mItem->setText(3,"---");
201 mItem->setText(4,"---"); 201 mItem->setText(4,"---");
202 mItem->setText(5,"---"); 202 mItem->setText(5,"---");
203 mItem->setText(6,"---"); 203 mItem->setText(6,"---");
204 mItem->setText(7,j->dtStartDateStr()); 204 mItem->setText(7,j->dtStartDateStr());
205 mItem->setText(8,"---"); 205 mItem->setText(8,"---");
206 mItem->setText(9,"---"); 206 mItem->setText(9,"---");
207 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); 207 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) );
208 208
209 QString key; 209 QString key;
210 QDate d = j->dtStart().date(); 210 QDate d = j->dtStart().date();
211 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 211 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
212 mItem->setSortKey(1,key); 212 mItem->setSortKey(1,key);
213 mItem->setSortKey(7,key); 213 mItem->setSortKey(7,key);
214 214
215 return true; 215 return true;
216} 216}
217 217
218KOListView::KOListView(Calendar *calendar, QWidget *parent, 218KOListView::KOListView(Calendar *calendar, QWidget *parent,
219 const char *name) 219 const char *name)
220 : KOEventView(calendar, parent, name) 220 : KOEventView(calendar, parent, name)
221{ 221{
222 mActiveItem = 0; 222 mActiveItem = 0;
223 mListView = new KOListViewListView(this); 223 mListView = new KOListViewListView(this);
224 mListView->addColumn(i18n("Summary")); 224 mListView->addColumn(i18n("Summary"));
225 mListView->addColumn(i18n("Start Date")); 225 mListView->addColumn(i18n("Start Date"));
226 mListView->addColumn(i18n("Start Time")); 226 mListView->addColumn(i18n("Start Time"));
227 mListView->addColumn(i18n("End Date")); 227 mListView->addColumn(i18n("End Date"));
228 mListView->addColumn(i18n("End Time")); 228 mListView->addColumn(i18n("End Time"));
229 mListView->addColumn(i18n("Alarm")); // alarm set? 229 mListView->addColumn(i18n("Alarm")); // alarm set?
230 mListView->addColumn(i18n("Recurs")); // recurs? 230 mListView->addColumn(i18n("Recurs")); // recurs?
231 mListView->addColumn(i18n("Due Date")); 231 mListView->addColumn(i18n("Due Date"));
232 mListView->addColumn(i18n("Due Time")); 232 mListView->addColumn(i18n("Due Time"));
233 mListView->addColumn(i18n("Cancelled")); 233 mListView->addColumn(i18n("Cancelled"));
234 mListView->addColumn(i18n("Categories")); 234 mListView->addColumn(i18n("Categories"));
235 235
236 mListView->setColumnAlignment(0,AlignLeft); 236 mListView->setColumnAlignment(0,AlignLeft);
237 mListView->setColumnAlignment(1,AlignLeft); 237 mListView->setColumnAlignment(1,AlignLeft);
238 mListView->setColumnAlignment(2,AlignHCenter); 238 mListView->setColumnAlignment(2,AlignHCenter);
239 mListView->setColumnAlignment(3,AlignLeft); 239 mListView->setColumnAlignment(3,AlignLeft);
240 mListView->setColumnAlignment(4,AlignHCenter); 240 mListView->setColumnAlignment(4,AlignHCenter);
241 mListView->setColumnAlignment(5,AlignLeft); 241 mListView->setColumnAlignment(5,AlignLeft);
242 mListView->setColumnAlignment(6,AlignLeft); 242 mListView->setColumnAlignment(6,AlignLeft);
243 mListView->setColumnAlignment(7,AlignLeft); 243 mListView->setColumnAlignment(7,AlignLeft);
244 mListView->setColumnAlignment(8,AlignLeft); 244 mListView->setColumnAlignment(8,AlignLeft);
245 mListView->setColumnAlignment(9,AlignLeft); 245 mListView->setColumnAlignment(9,AlignLeft);
246 mListView->setColumnAlignment(10,AlignLeft); 246 mListView->setColumnAlignment(10,AlignLeft);
247 mListView->setColumnWidthMode(10, QListView::Manual); 247 mListView->setColumnWidthMode(10, QListView::Manual);
248 new KOListViewWhatsThis(mListView->viewport(),this); 248 new KOListViewWhatsThis(mListView->viewport(),this);
249 249
250 int iii = 0; 250 int iii = 0;
251 for ( iii = 0; iii< 10 ; ++iii ) 251 for ( iii = 0; iii< 10 ; ++iii )
252 mListView->setColumnWidthMode( iii, QListView::Manual ); 252 mListView->setColumnWidthMode( iii, QListView::Manual );
253 253
254 QBoxLayout *layoutTop = new QVBoxLayout(this); 254 QBoxLayout *layoutTop = new QVBoxLayout(this);
255 layoutTop->addWidget(mListView); 255 layoutTop->addWidget(mListView);
256 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 256 mListView->setFont ( KOPrefs::instance()->mListViewFont );
257 mPopupMenu = eventPopup(); 257 mPopupMenu = eventPopup();
258 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 258 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
259 i18n("Select all"),this, 259 i18n("Select all"),this,
260 SLOT(allSelection()),true); 260 SLOT(allSelection()),true);
261 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 261 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
262 i18n("Deselect all"),this, 262 i18n("Deselect all"),this,
263 SLOT(clearSelection()),true); 263 SLOT(clearSelection()),true);
264 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 264 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
265 i18n("Delete all selected"),this, 265 i18n("Delete all selected"),this,
266 SLOT(deleteAll()),true); 266 SLOT(deleteAll()),true);
267 mPopupMenu->insertSeparator(); 267 mPopupMenu->insertSeparator();
268 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 268 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
269 i18n("Save selected to file..."),this, 269 i18n("Save selected to file..."),this,
270 SLOT(saveToFile()),true); 270 SLOT(saveToFile()),true);
271 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 271 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
272 i18n("Save Journal/Description..."),this, 272 i18n("Save Journal/Description..."),this,
273 SLOT(saveDescriptionToFile()),true); 273 SLOT(saveDescriptionToFile()),true);
274 // mPopupMenu->insertSeparator(); 274 // mPopupMenu->insertSeparator();
275 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 275 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
276 i18n("Add Categ. to selected..."),this, 276 i18n("Add Categ. to selected..."),this,
277 SLOT(addCat()),true); 277 SLOT(addCat()),true);
278 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 278 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
279 i18n("Set Categ. for selected..."),this, 279 i18n("Set Categ. for selected..."),this,
280 SLOT(setCat()),true); 280 SLOT(setCat()),true);
281 //mPopupMenu->insertSeparator(); 281 //mPopupMenu->insertSeparator();
282 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 282 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
283 i18n("Set alarm for selected..."),this, 283 i18n("Set alarm for selected..."),this,
284 SLOT(setAlarm()),true); 284 SLOT(setAlarm()),true);
285 285
286 286
287#ifndef DESKTOP_VERSION 287#ifndef DESKTOP_VERSION
288 mPopupMenu->insertSeparator(); 288 mPopupMenu->insertSeparator();
289 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 289 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
290 i18n("Beam selected via IR"),this, 290 i18n("Beam selected via IR"),this,
291 SLOT(beamSelected()),true); 291 SLOT(beamSelected()),true);
292#endif 292#endif
293 /* 293 /*
294 mPopupMenu = new QPopupMenu; 294 mPopupMenu = new QPopupMenu;
295 mPopupMenu->insertItem(i18n("Edit Event"), this, 295 mPopupMenu->insertItem(i18n("Edit Event"), this,
296 SLOT (editEvent())); 296 SLOT (editEvent()));
297 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, 297 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
298 SLOT (deleteEvent())); 298 SLOT (deleteEvent()));
299 mPopupMenu->insertSeparator(); 299 mPopupMenu->insertSeparator();
300 mPopupMenu->insertItem(i18n("Show Dates"), this, 300 mPopupMenu->insertItem(i18n("Show Dates"), this,
301 SLOT(showDates())); 301 SLOT(showDates()));
302 mPopupMenu->insertItem(i18n("Hide Dates"), this, 302 mPopupMenu->insertItem(i18n("Hide Dates"), this,
303 SLOT(hideDates())); 303 SLOT(hideDates()));
304 */ 304 */
305 QObject::connect(mListView,SIGNAL( newEvent()), 305 QObject::connect(mListView,SIGNAL( newEvent()),
306 this,SIGNAL(signalNewEvent())); 306 this,SIGNAL(signalNewEvent()));
307 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), 307 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
308 this,SLOT(defaultItemAction(QListViewItem *))); 308 this,SLOT(defaultItemAction(QListViewItem *)));
309 QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *, 309 QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *,
310 const QPoint &, int )), 310 const QPoint &, int )),
311 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 311 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
312 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 312 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
313 SLOT(processSelectionChange(QListViewItem *))); 313 SLOT(processSelectionChange(QListViewItem *)));
314 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 314 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
315 SIGNAL(showIncidenceSignal(Incidence *)) ); 315 SIGNAL(showIncidenceSignal(Incidence *)) );
316 316
317 readSettings(KOGlobals::config(),"KOListView Layout"); 317 readSettings(KOGlobals::config(),"KOListView Layout");
318} 318}
319 319
320KOListView::~KOListView() 320KOListView::~KOListView()
321{ 321{
322 delete mPopupMenu; 322 delete mPopupMenu;
323} 323}
324QString KOListView::getWhatsThisText(QPoint p) 324QString KOListView::getWhatsThisText(QPoint p)
325{ 325{
326 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); 326 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
327 if ( item ) 327 if ( item )
328 return KIncidenceFormatter::instance()->getFormattedText( item->data() ); 328 return KIncidenceFormatter::instance()->getFormattedText( item->data() );
329 return i18n("That is the list view" ); 329 return i18n("That is the list view" );
330 330
331} 331}
332 332
333void KOListView::updateList() 333void KOListView::updateList()
334{ 334{
335 // qDebug(" KOListView::updateList() "); 335 // qDebug(" KOListView::updateList() ");
336 336
337} 337}
338 338
339void KOListView::addCat( ) 339void KOListView::addCat( )
340{ 340{
341 setCategories( false ); 341 setCategories( false );
342} 342}
343void KOListView::setCat() 343void KOListView::setCat()
344{ 344{
345 setCategories( true ); 345 setCategories( true );
346} 346}
347void KOListView::setAlarm() 347void KOListView::setAlarm()
348{ 348{
349 KOAlarmPrefs kap( this); 349 KOAlarmPrefs kap( this);
350 if ( !kap.exec() ) 350 if ( !kap.exec() )
351 return; 351 return;
352 352
353 353
354 QStringList itemList; 354 QStringList itemList;
355 QPtrList<KOListViewItem> sel ; 355 QPtrList<KOListViewItem> sel ;
356 QListViewItem *qitem = mListView->firstChild (); 356 QListViewItem *qitem = mListView->firstChild ();
357 while ( qitem ) { 357 while ( qitem ) {
358 if ( qitem->isSelected() ) { 358 if ( qitem->isSelected() ) {
359 Incidence* inc = ((KOListViewItem *) qitem)->data(); 359 Incidence* inc = ((KOListViewItem *) qitem)->data();
360 if ( inc->type() != "Journal" ) { 360 if ( inc->type() != "Journal" ) {
361 if ( inc->type() == "Todo" ) { 361 if ( inc->type() == "Todo" ) {
362 if ( ((Todo*)inc)->hasDueDate() ) 362 if ( ((Todo*)inc)->hasDueDate() )
363 sel.append(((KOListViewItem *)qitem)); 363 sel.append(((KOListViewItem *)qitem));
364 } else 364 } else
365 sel.append(((KOListViewItem *)qitem)); 365 sel.append(((KOListViewItem *)qitem));
366 } 366 }
367 } 367 }
368 qitem = qitem->nextSibling(); 368 qitem = qitem->nextSibling();
369 } 369 }
370 int count = 0; 370 int count = 0;
371 KOListViewItem * item, *temp; 371 KOListViewItem * item, *temp;
372 item = sel.first(); 372 item = sel.first();
373 Incidence* inc; 373 Incidence* inc;
374 while ( item ) { 374 while ( item ) {
375 inc = item->data(); 375 inc = item->data();
376 ++count; 376 ++count;
377 if (kap.mAlarmButton->isChecked()) { 377 if (kap.mAlarmButton->isChecked()) {
378 if (inc->alarms().count() == 0) 378 if (inc->alarms().count() == 0)
379 inc->newAlarm(); 379 inc->newAlarm();
380 QPtrList<Alarm> alarms = inc->alarms(); 380 QPtrList<Alarm> alarms = inc->alarms();
381 Alarm *alarm; 381 Alarm *alarm;
382 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { 382 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
383 alarm->setEnabled(true); 383 alarm->setEnabled(true);
384 int j = kap.mAlarmTimeEdit->value()* -60; 384 int j = kap.mAlarmTimeEdit->value()* -60;
385 if (kap.mAlarmIncrCombo->currentItem() == 1) 385 if (kap.mAlarmIncrCombo->currentItem() == 1)
386 j = j * 60; 386 j = j * 60;
387 else if (kap.mAlarmIncrCombo->currentItem() == 2) 387 else if (kap.mAlarmIncrCombo->currentItem() == 2)
388 j = j * (60 * 24); 388 j = j * (60 * 24);
389 alarm->setStartOffset( j ); 389 alarm->setStartOffset( j );
390 390
391 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { 391 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) {
392 alarm->setProcedureAlarm(kap.mAlarmProgram); 392 alarm->setProcedureAlarm(kap.mAlarmProgram);
393 } 393 }
394 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) 394 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn())
395 alarm->setAudioAlarm(kap.mAlarmSound); 395 alarm->setAudioAlarm(kap.mAlarmSound);
396 else 396 else
397 alarm->setType(Alarm::Invalid); 397 alarm->setType(Alarm::Invalid);
398 //alarm->setAudioAlarm("default"); 398 //alarm->setAudioAlarm("default");
399 // TODO: Deal with multiple alarms 399 // TODO: Deal with multiple alarms
400 break; // For now, stop after the first alarm 400 break; // For now, stop after the first alarm
401 } 401 }
402 } else { 402 } else {
403 Alarm* alarm = inc->alarms().first(); 403 Alarm* alarm = inc->alarms().first();
404 if ( alarm ) { 404 if ( alarm ) {
405 alarm->setEnabled(false); 405 alarm->setEnabled(false);
406 alarm->setType(Alarm::Invalid); 406 alarm->setType(Alarm::Invalid);
407 } 407 }
408 } 408 }
409 temp = item; 409 temp = item;
410 item = sel.next(); 410 item = sel.next();
411 mUidDict.remove( inc->uid() ); 411 mUidDict.remove( inc->uid() );
412 delete temp;; 412 delete temp;;
413 addIncidence( inc ); 413 addIncidence( inc );
414 } 414 }
415 topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) ); 415 topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) );
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index f595d35..d0380e3 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -328,512 +328,515 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
328#ifdef DESKTOP_VERSION 328#ifdef DESKTOP_VERSION
329QToolTipGroup *MonthViewCell::toolTipGroup() 329QToolTipGroup *MonthViewCell::toolTipGroup()
330{ 330{
331 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); 331 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0);
332 return mToolTipGroup; 332 return mToolTipGroup;
333} 333}
334#endif 334#endif
335 335
336void MonthViewCell::setDate( const QDate &date ) 336void MonthViewCell::setDate( const QDate &date )
337{ 337{
338 // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; 338 // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl;
339 mDate = date; 339 mDate = date;
340 340
341 341
342 342
343 //resizeEvent( 0 ); 343 //resizeEvent( 0 );
344} 344}
345 345
346QDate MonthViewCell::date() const 346QDate MonthViewCell::date() const
347{ 347{
348 return mDate; 348 return mDate;
349} 349}
350 350
351void MonthViewCell::setPrimary( bool primary ) 351void MonthViewCell::setPrimary( bool primary )
352{ 352{
353 mPrimary = primary; 353 mPrimary = primary;
354 //setMyPalette(); 354 //setMyPalette();
355} 355}
356void MonthViewCell::setMyPalette() 356void MonthViewCell::setMyPalette()
357{ 357{
358 358
359 if ( mHoliday) { 359 if ( mHoliday) {
360 setPalette( mHolidayPalette ); 360 setPalette( mHolidayPalette );
361 } else { 361 } else {
362 if ( mPrimary ) { 362 if ( mPrimary ) {
363 setPalette( mPrimaryPalette ); 363 setPalette( mPrimaryPalette );
364 } else { 364 } else {
365 setPalette( mNonPrimaryPalette ); 365 setPalette( mNonPrimaryPalette );
366 } 366 }
367 } 367 }
368 QPalette pal = palette(); 368 QPalette pal = palette();
369 369
370 mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); 370 mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) ));
371} 371}
372QPalette MonthViewCell::getPalette () 372QPalette MonthViewCell::getPalette ()
373{ 373{
374 if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) 374 if ( !KOPrefs::instance()->mMonthViewUsesDayColors )
375 return mStandardPalette; 375 return mStandardPalette;
376 if ( mHoliday) { 376 if ( mHoliday) {
377 return mHolidayPalette ; 377 return mHolidayPalette ;
378 } else { 378 } else {
379 if ( mPrimary ) { 379 if ( mPrimary ) {
380 return mPrimaryPalette ; 380 return mPrimaryPalette ;
381 } 381 }
382 } 382 }
383 return mNonPrimaryPalette; 383 return mNonPrimaryPalette;
384} 384}
385bool MonthViewCell::isPrimary() const 385bool MonthViewCell::isPrimary() const
386{ 386{
387 return mPrimary; 387 return mPrimary;
388} 388}
389 389
390void MonthViewCell::setHoliday( bool holiday ) 390void MonthViewCell::setHoliday( bool holiday )
391{ 391{
392 mHoliday = holiday; 392 mHoliday = holiday;
393 //setMyPalette(); 393 //setMyPalette();
394} 394}
395 395
396void MonthViewCell::setHoliday( const QString &holiday ) 396void MonthViewCell::setHoliday( const QString &holiday )
397{ 397{
398 mHolidayString = holiday; 398 mHolidayString = holiday;
399 399
400 if ( !holiday.isEmpty() ) { 400 if ( !holiday.isEmpty() ) {
401 setHoliday( true ); 401 setHoliday( true );
402 } 402 }
403} 403}
404void MonthViewCell::keyPressEvent ( QKeyEvent * e ) 404void MonthViewCell::keyPressEvent ( QKeyEvent * e )
405{ 405{
406 406
407 e->ignore(); 407 e->ignore();
408 408
409} 409}
410 410
411void MonthViewCell::startUpdateCell() 411void MonthViewCell::startUpdateCell()
412{ 412{
413 413
414 mItemList->setFocusPolicy(NoFocus); 414 mItemList->setFocusPolicy(NoFocus);
415 if ( !mMonthView->isUpdatePossible() ) 415 if ( !mMonthView->isUpdatePossible() )
416 return; 416 return;
417 417
418 /* 418 /*
419 if ( !isVisible() ){ 419 if ( !isVisible() ){
420 return; 420 return;
421 } 421 }
422 */ 422 */
423 // qDebug("MonthViewCell::updateCell() "); 423 // qDebug("MonthViewCell::updateCell() ");
424 setPrimary( mDate.month()%2 ); 424 setPrimary( mDate.month()%2 );
425 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); 425 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays);
426 if ( mDate == QDate::currentDate() ) { 426 if ( mDate == QDate::currentDate() ) {
427 mItemList->setLineWidth( 3 ); 427 mItemList->setLineWidth( 3 );
428 } else { 428 } else {
429 mItemList->setLineWidth( 1 ); 429 mItemList->setLineWidth( 1 );
430 } 430 }
431 mItemList->clear(); 431 mItemList->clear();
432 432
433#ifdef DESKTOP_VERSION 433#ifdef DESKTOP_VERSION
434 QToolTip::remove(this); 434 QToolTip::remove(this);
435#endif 435#endif
436 mToolTip = ""; 436 mToolTip = "";
437 //qApp->processEvents(); 437 //qApp->processEvents();
438 if ( !mHolidayString.isEmpty() ) { 438 if ( !mHolidayString.isEmpty() ) {
439 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); 439 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString );
440 item->setPalette( mHolidayPalette ); 440 item->setPalette( mHolidayPalette );
441 mItemList->insertItem( item ); 441 mItemList->insertItem( item );
442 mToolTip += mHolidayString+"\n"; 442 mToolTip += mHolidayString+"\n";
443 } 443 }
444} 444}
445 445
446void MonthViewCell::insertEvent(Event *event) 446void MonthViewCell::insertEvent(Event *event)
447{ 447{
448 448
449 mItemList->setFocusPolicy(WheelFocus); 449 mItemList->setFocusPolicy(WheelFocus);
450 if ( !(event->doesRecur() == Recurrence::rNone) ) { 450 if ( !(event->doesRecur() == Recurrence::rNone) ) {
451 if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) 451 if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily )
452 return; 452 return;
453 else 453 else
454 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) 454 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly )
455 return; 455 return;
456 } 456 }
457 457
458 if ( event->categories().contains("Holiday") || 458 if ( event->categories().contains("Holiday") ||
459 event->categories().contains(i18n("Holiday"))) { 459 event->categories().contains(i18n("Holiday"))) {
460 setHoliday( true ); 460 setHoliday( true );
461 if ( mDate.dayOfWeek() == 7 ) 461 if ( mDate.dayOfWeek() == 7 )
462 mItemList->setLineWidth( 3 ); 462 mItemList->setLineWidth( 3 );
463 } 463 }
464 QString text; 464 QString text;
465 if (event->isMultiDay()) { 465 if (event->isMultiDay()) {
466 QString prefix = "<->"; 466 QString prefix = "<->";
467 if ( event->doesRecur() ) { 467 if ( event->doesRecur() ) {
468 if ( event->recursOn( mDate) ) 468 if ( event->recursOn( mDate) )
469 prefix ="->" ; 469 prefix ="->" ;
470 else { 470 else {
471 int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); 471 int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
472 if ( event->recursOn( mDate.addDays( -days)) ) 472 if ( event->recursOn( mDate.addDays( -days)) )
473 prefix ="<-" ; 473 prefix ="<-" ;
474 } 474 }
475 475
476 } else { 476 } else {
477 if (mDate == event->dtStart().date()) { 477 if (mDate == event->dtStart().date()) {
478 prefix ="->" ; 478 prefix ="->" ;
479 } else if (mDate == event->dtEnd().date()) { 479 } else if (mDate == event->dtEnd().date()) {
480 prefix ="<-" ; 480 prefix ="<-" ;
481 } 481 }
482 } 482 }
483 if ( !event->doesFloat() ) { 483 if ( !event->doesFloat() ) {
484 if ( mDate == event->dtStart().date () ) 484 if ( mDate == event->dtStart().date () )
485 prefix += KGlobal::locale()->formatTime(event->dtStart().time())+" "; 485 prefix += KGlobal::locale()->formatTime(event->dtStart().time())+" ";
486 else if ( mDate == event->dtEnd().date () ) 486 else if ( mDate == event->dtEnd().date () )
487 prefix += KGlobal::locale()->formatTime(event->dtEnd().time())+" "; 487 prefix += KGlobal::locale()->formatTime(event->dtEnd().time())+" ";
488 488
489 } 489 }
490 text = prefix + event->summary(); 490 text = prefix + event->summary();
491 mToolTip += text; 491 mToolTip += text;
492 } else { 492 } else {
493 if (event->doesFloat()) { 493 if (event->doesFloat()) {
494 text = event->summary(); 494 text = event->summary();
495 mToolTip += text; 495 mToolTip += text;
496 } 496 }
497 else { 497 else {
498 text = KGlobal::locale()->formatTime(event->dtStart().time()); 498 text = KGlobal::locale()->formatTime(event->dtStart().time());
499 text += " " + event->summary(); 499 text += " " + event->summary();
500 mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); 500 mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
501 } 501 }
502 } 502 }
503 503
504 MonthViewItem *item = new MonthViewItem( event, mDate, text ); 504 MonthViewItem *item = new MonthViewItem( event, mDate, text );
505 QPalette pal; 505 QPalette pal;
506 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 506 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
507 QStringList categories = event->categories(); 507 QStringList categories = event->categories();
508 QString cat = categories.first(); 508 QString cat = categories.first();
509 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 509 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
510 pal = getPalette(); 510 pal = getPalette();
511 if (cat.isEmpty()) { 511 if (cat.isEmpty()) {
512 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 512 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
513 } else { 513 } else {
514 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 514 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
515 } 515 }
516 516
517 } else { 517 } else {
518 if (cat.isEmpty()) { 518 if (cat.isEmpty()) {
519 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 519 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
520 } else { 520 } else {
521 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 521 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
522 } 522 }
523 } 523 }
524 524
525 } else { 525 } else {
526 pal = mStandardPalette ; 526 pal = mStandardPalette ;
527 } 527 }
528 item->setPalette( pal ); 528 item->setPalette( pal );
529 item->setRecur( event->recurrence()->doesRecur() ); 529 item->setRecur( event->recurrence()->doesRecur() );
530 item->setAlarm( event->isAlarmEnabled() ); 530 item->setAlarm( event->isAlarmEnabled() );
531 item->setMoreInfo( event->description().length() > 0 ); 531 item->setMoreInfo( event->description().length() > 0 );
532#ifdef DESKTOP_VERSION 532#ifdef DESKTOP_VERSION
533 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, 533 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails,
534 KOPrefs::instance()->email()); 534 KOPrefs::instance()->email());
535 if ( me != 0 ) { 535 if ( me != 0 ) {
536 if ( me->status() == Attendee::NeedsAction && me->RSVP()) 536 if ( me->status() == Attendee::NeedsAction && me->RSVP())
537 item->setReply(true); 537 item->setReply(true);
538 else 538 else
539 item->setReply(false); 539 item->setReply(false);
540 } else 540 } else
541 item->setReply(false); 541 item->setReply(false);
542#endif 542#endif
543 mItemList->insertItem( item ); 543 mItemList->insertItem( item );
544 mToolTip += "\n"; 544 mToolTip += "\n";
545} 545}
546void MonthViewCell::insertTodo(Todo *todo) 546void MonthViewCell::insertTodo(Todo *todo)
547{ 547{
548 mItemList->setFocusPolicy(WheelFocus); 548 mItemList->setFocusPolicy(WheelFocus);
549 QString text; 549 QString text;
550 if (todo->hasDueDate()) { 550 if (todo->hasDueDate()) {
551 if (!todo->doesFloat()) { 551 if (!todo->doesFloat()) {
552 text += KGlobal::locale()->formatTime(todo->dtDue().time()); 552 text += KGlobal::locale()->formatTime(todo->dtDue().time());
553 text += " "; 553 text += " ";
554 } 554 }
555 } 555 }
556 text += i18n("T: %1").arg(todo->summary()); 556 text += i18n("T: %1").arg(todo->summary());
557 557
558 MonthViewItem *item = new MonthViewItem( todo, mDate, text ); 558 MonthViewItem *item = new MonthViewItem( todo, mDate, text );
559 //item->setPalette( mStandardPalette ); 559 //item->setPalette( mStandardPalette );
560 QPalette pal; 560 QPalette pal;
561 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 561 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
562 QStringList categories = todo->categories(); 562 QStringList categories = todo->categories();
563 QString cat = categories.first(); 563 QString cat = categories.first();
564 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 564 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
565 pal = getPalette(); 565 pal = getPalette();
566 if (cat.isEmpty()) { 566 if (cat.isEmpty()) {
567 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 567 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
568 } else { 568 } else {
569 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 569 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
570 } 570 }
571 571
572 } else { 572 } else {
573 if (cat.isEmpty()) { 573 if (cat.isEmpty()) {
574 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 574 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
575 } else { 575 } else {
576 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 576 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
577 } 577 }
578 } 578 }
579 579
580 } else { 580 } else {
581 pal = mStandardPalette ; 581 pal = mStandardPalette ;
582 } 582 }
583 item->setPalette( pal ); 583 item->setPalette( pal );
584 item->setRecur( todo->recurrence()->doesRecur() );
585 item->setAlarm( todo->isAlarmEnabled() );
586 item->setMoreInfo( todo->description().length() > 0 );
584 mItemList->insertItem( item ); 587 mItemList->insertItem( item );
585 mToolTip += text+"\n"; 588 mToolTip += text+"\n";
586} 589}
587void MonthViewCell::finishUpdateCell() 590void MonthViewCell::finishUpdateCell()
588{ 591{
589#ifdef DESKTOP_VERSION 592#ifdef DESKTOP_VERSION
590 if (mToolTip != "") 593 if (mToolTip != "")
591 QToolTip::add(this,mToolTip,toolTipGroup(),""); 594 QToolTip::add(this,mToolTip,toolTipGroup(),"");
592#endif 595#endif
593 mItemList->sort(); 596 mItemList->sort();
594 //setMyPalette(); 597 //setMyPalette();
595 setMyPalette(); 598 setMyPalette();
596 QString text; 599 QString text;
597 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; 600 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog;
598 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { 601 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) {
599 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; 602 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " ";
600 mLabel->resize( mLabelBigSize ); 603 mLabel->resize( mLabelBigSize );
601 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 604 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
602 } else { 605 } else {
603 mLabel->resize( mLabelSize ); 606 mLabel->resize( mLabelSize );
604 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 607 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
605 } 608 }
606 609
607 mLabel->setText( text ); 610 mLabel->setText( text );
608 resizeEvent( 0 ); 611 resizeEvent( 0 );
609} 612}
610void MonthViewCell::updateCell() 613void MonthViewCell::updateCell()
611{ 614{
612 qDebug("MonthViewCell::updateCell() "); 615 qDebug("MonthViewCell::updateCell() ");
613 if ( !mMonthView->isUpdatePossible() ) 616 if ( !mMonthView->isUpdatePossible() )
614 return; 617 return;
615 startUpdateCell(); 618 startUpdateCell();
616 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 619 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
617 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); 620 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true );
618 Event *event; 621 Event *event;
619 for( event = events.first(); event; event = events.next() ) { // for event 622 for( event = events.first(); event; event = events.next() ) { // for event
620 insertEvent(event); 623 insertEvent(event);
621 } 624 }
622 // insert due todos 625 // insert due todos
623 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); 626 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate );
624 Todo *todo; 627 Todo *todo;
625 for(todo = todos.first(); todo; todo = todos.next()) { 628 for(todo = todos.first(); todo; todo = todos.next()) {
626 insertTodo( todo ); 629 insertTodo( todo );
627 } 630 }
628 finishUpdateCell(); 631 finishUpdateCell();
629 // if ( isVisible()) 632 // if ( isVisible())
630 //qApp->processEvents(); 633 //qApp->processEvents();
631} 634}
632 635
633void MonthViewCell::updateConfig( bool bigFont ) // = false 636void MonthViewCell::updateConfig( bool bigFont ) // = false
634{ 637{
635 638
636 if ( bigFont ) { 639 if ( bigFont ) {
637 QFont fo = KOPrefs::instance()->mMonthViewFont; 640 QFont fo = KOPrefs::instance()->mMonthViewFont;
638 int ps = fo.pointSize() + 2; 641 int ps = fo.pointSize() + 2;
639 if ( ps < 18 ) 642 if ( ps < 18 )
640 ps += 2; 643 ps += 2;
641 fo.setPointSize( ps ); 644 fo.setPointSize( ps );
642 setFont( fo ); 645 setFont( fo );
643 } else 646 } else
644 setFont( KOPrefs::instance()->mMonthViewFont ); 647 setFont( KOPrefs::instance()->mMonthViewFont );
645 648
646 QFontMetrics fm( font() ); 649 QFontMetrics fm( font() );
647 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); 650 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 );
648 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); 651 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 );
649 mHolidayPalette = mStandardPalette; 652 mHolidayPalette = mStandardPalette;
650 mPrimaryPalette = mStandardPalette; 653 mPrimaryPalette = mStandardPalette;
651 mNonPrimaryPalette = mStandardPalette; 654 mNonPrimaryPalette = mStandardPalette;
652 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { 655 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) {
653 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); 656 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor );
654 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); 657 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor );
655 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); 658 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark());
656 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); 659 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark());
657 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); 660 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor);
658 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); 661 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor);
659 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); 662 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark());
660 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); 663 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor);
661 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); 664 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor);
662 } 665 }
663 //updateCell(); 666 //updateCell();
664} 667}
665 668
666void MonthViewCell::enableScrollBars( bool enabled ) 669void MonthViewCell::enableScrollBars( bool enabled )
667{ 670{
668 if ( enabled ) { 671 if ( enabled ) {
669 mItemList->setVScrollBarMode(QScrollView::Auto); 672 mItemList->setVScrollBarMode(QScrollView::Auto);
670 mItemList->setHScrollBarMode(QScrollView::Auto); 673 mItemList->setHScrollBarMode(QScrollView::Auto);
671 } else { 674 } else {
672 mItemList->setVScrollBarMode(QScrollView::AlwaysOff); 675 mItemList->setVScrollBarMode(QScrollView::AlwaysOff);
673 mItemList->setHScrollBarMode(QScrollView::AlwaysOff); 676 mItemList->setHScrollBarMode(QScrollView::AlwaysOff);
674 } 677 }
675} 678}
676 679
677Incidence *MonthViewCell::selectedIncidence() 680Incidence *MonthViewCell::selectedIncidence()
678{ 681{
679 int index = mItemList->currentItem(); 682 int index = mItemList->currentItem();
680 if ( index < 0 ) return 0; 683 if ( index < 0 ) return 0;
681 684
682 MonthViewItem *item = 685 MonthViewItem *item =
683 static_cast<MonthViewItem *>( mItemList->item( index ) ); 686 static_cast<MonthViewItem *>( mItemList->item( index ) );
684 687
685 if ( !item ) return 0; 688 if ( !item ) return 0;
686 689
687 return item->incidence(); 690 return item->incidence();
688} 691}
689 692
690QDate MonthViewCell::selectedIncidenceDate() 693QDate MonthViewCell::selectedIncidenceDate()
691{ 694{
692 QDate qd; 695 QDate qd;
693 int index = mItemList->currentItem(); 696 int index = mItemList->currentItem();
694 if ( index < 0 ) return qd; 697 if ( index < 0 ) return qd;
695 698
696 MonthViewItem *item = 699 MonthViewItem *item =
697 static_cast<MonthViewItem *>( mItemList->item( index ) ); 700 static_cast<MonthViewItem *>( mItemList->item( index ) );
698 701
699 if ( !item ) return qd; 702 if ( !item ) return qd;
700 703
701 return item->incidenceDate(); 704 return item->incidenceDate();
702} 705}
703 706
704void MonthViewCell::deselect() 707void MonthViewCell::deselect()
705{ 708{
706 mItemList->clearSelection(); 709 mItemList->clearSelection();
707 enableScrollBars( false ); 710 enableScrollBars( false );
708 // updateCell(); 711 // updateCell();
709} 712}
710void MonthViewCell::select() 713void MonthViewCell::select()
711{ 714{
712 ;// updateCell(); 715 ;// updateCell();
713} 716}
714 717
715void MonthViewCell::resizeEvent ( QResizeEvent * ) 718void MonthViewCell::resizeEvent ( QResizeEvent * )
716{ 719{
717 if ( !mMonthView->isUpdatePossible() ) 720 if ( !mMonthView->isUpdatePossible() )
718 return; 721 return;
719 722
720 int size = height() - mLabel->height() - 2; 723 int size = height() - mLabel->height() - 2;
721 if ( size > 0 ) 724 if ( size > 0 )
722 mItemList->verticalScrollBar()->setMaximumHeight( size ); 725 mItemList->verticalScrollBar()->setMaximumHeight( size );
723 size = width() - mLabel->width() -2; 726 size = width() - mLabel->width() -2;
724 if ( size > 0 ) 727 if ( size > 0 )
725 mItemList->horizontalScrollBar()->setMaximumWidth( size ); 728 mItemList->horizontalScrollBar()->setMaximumWidth( size );
726 mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); 729 mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() );
727 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 730 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
728} 731}
729 732
730void MonthViewCell::defaultAction( QListBoxItem *item ) 733void MonthViewCell::defaultAction( QListBoxItem *item )
731{ 734{
732 if ( !item ) return; 735 if ( !item ) return;
733 736
734 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 737 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
735 Incidence *incidence = eventItem->incidence(); 738 Incidence *incidence = eventItem->incidence();
736 if ( incidence ) mMonthView->defaultAction( incidence ); 739 if ( incidence ) mMonthView->defaultAction( incidence );
737} 740}
738void MonthViewCell::showDay() 741void MonthViewCell::showDay()
739{ 742{
740 emit showDaySignal( date() ); 743 emit showDaySignal( date() );
741} 744}
742void MonthViewCell::newEvent() 745void MonthViewCell::newEvent()
743{ 746{
744 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 747 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
745 emit newEventSignal( dt ); 748 emit newEventSignal( dt );
746} 749}
747void MonthViewCell::cellClicked( QListBoxItem *item ) 750void MonthViewCell::cellClicked( QListBoxItem *item )
748{ 751{
749 static QListBoxItem * lastClicked = 0; 752 static QListBoxItem * lastClicked = 0;
750 if ( item == 0 ) { 753 if ( item == 0 ) {
751 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 754 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
752 emit newEventSignal( dt ); 755 emit newEventSignal( dt );
753 return; 756 return;
754 } 757 }
755 /* 758 /*
756 if ( lastClicked ) 759 if ( lastClicked )
757 if ( ! item ) { 760 if ( ! item ) {
758 if ( lastClicked->listBox() != item->listBox() ) 761 if ( lastClicked->listBox() != item->listBox() )
759 lastClicked->listBox()->clearSelection(); 762 lastClicked->listBox()->clearSelection();
760 } 763 }
761 */ 764 */
762 765
763 mMonthView->setSelectedCell( this ); 766 mMonthView->setSelectedCell( this );
764 if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); 767 if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true );
765 select(); 768 select();
766} 769}
767 770
768void MonthViewCell::contextMenu( QListBoxItem *item ) 771void MonthViewCell::contextMenu( QListBoxItem *item )
769{ 772{
770 if ( !item ) return; 773 if ( !item ) return;
771 774
772 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 775 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
773 Incidence *incidence = eventItem->incidence(); 776 Incidence *incidence = eventItem->incidence();
774 if ( incidence ) mMonthView->showContextMenu( incidence ); 777 if ( incidence ) mMonthView->showContextMenu( incidence );
775} 778}
776 779
777void MonthViewCell::selection( QListBoxItem *item ) 780void MonthViewCell::selection( QListBoxItem *item )
778{ 781{
779 if ( !item ) return; 782 if ( !item ) return;
780 783
781 mMonthView->setSelectedCell( this ); 784 mMonthView->setSelectedCell( this );
782} 785}
783 786
784 787
785// ******************************************************************************* 788// *******************************************************************************
786// ******************************************************************************* 789// *******************************************************************************
787// ******************************************************************************* 790// *******************************************************************************
788 791
789 792
790KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) 793KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
791 : KOEventView( calendar, parent, name ), 794 : KOEventView( calendar, parent, name ),
792 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), 795 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ),
793 mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) 796 mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
794{ 797{
795 mShortDayLabelsM = false; 798 mShortDayLabelsM = false;
796 mShortDayLabelsW = false; 799 mShortDayLabelsW = false;
797 skipResize = false; 800 skipResize = false;
798 clPending = true; 801 clPending = true;
799 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); 802 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" );
800 mWidStack = new QWidgetStack( this ); 803 mWidStack = new QWidgetStack( this );
801 QVBoxLayout* hb = new QVBoxLayout( this ); 804 QVBoxLayout* hb = new QVBoxLayout( this );
802 mMonthView = new QWidget( mWidStack ); 805 mMonthView = new QWidget( mWidStack );
803 mWeekView = new QWidget( mWidStack ); 806 mWeekView = new QWidget( mWidStack );
804#if QT_VERSION >= 0x030000 807#if QT_VERSION >= 0x030000
805 mWidStack->addWidget(mMonthView ); 808 mWidStack->addWidget(mMonthView );
806 mWidStack->addWidget(mWeekView ); 809 mWidStack->addWidget(mWeekView );
807#else 810#else
808 mWidStack->addWidget( mMonthView, 1 ); 811 mWidStack->addWidget( mMonthView, 1 );
809 mWidStack->addWidget( mWeekView , 1 ); 812 mWidStack->addWidget( mWeekView , 1 );
810#endif 813#endif
811 hb->addWidget( mNavigatorBar ); 814 hb->addWidget( mNavigatorBar );
812 hb->addWidget( mWidStack ); 815 hb->addWidget( mWidStack );
813 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 816 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
814 mShowWeekView = KOPrefs::instance()->mMonthViewWeek; 817 mShowWeekView = KOPrefs::instance()->mMonthViewWeek;
815 if ( mShowWeekView ) 818 if ( mShowWeekView )
816 mWeekStartsMonday = true; 819 mWeekStartsMonday = true;
817 updatePossible = false; 820 updatePossible = false;
818 //updatePossible = true; 821 //updatePossible = true;
819 mCells.setAutoDelete( true ); 822 mCells.setAutoDelete( true );
820 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 823 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
821 mDayLabels.resize( mDaysPerWeek ); 824 mDayLabels.resize( mDaysPerWeek );
822 mDayLabelsW.resize( mDaysPerWeek ); 825 mDayLabelsW.resize( mDaysPerWeek );
823 QFont bfont = font(); 826 QFont bfont = font();
824 if ( QApplication::desktop()->width() < 650 ) { 827 if ( QApplication::desktop()->width() < 650 ) {
825 bfont.setPointSize( bfont.pointSize() - 2 ); 828 bfont.setPointSize( bfont.pointSize() - 2 );
826 } 829 }
827 bfont.setBold( true ); 830 bfont.setBold( true );
828 int i; 831 int i;
829 832
830 for( i = 0; i < mDaysPerWeek; i++ ) { 833 for( i = 0; i < mDaysPerWeek; i++ ) {
831 QLabel *label = new QLabel( mMonthView ); 834 QLabel *label = new QLabel( mMonthView );
832 label->setFont(bfont); 835 label->setFont(bfont);
833 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 836 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
834 label->setLineWidth(1); 837 label->setLineWidth(1);
835 label->setAlignment(AlignCenter); 838 label->setAlignment(AlignCenter);
836 mDayLabels.insert( i, label ); 839 mDayLabels.insert( i, label );
837 label = new QLabel( mWeekView ); 840 label = new QLabel( mWeekView );
838 label->setFont(bfont); 841 label->setFont(bfont);
839 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 842 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 391b3bb..18dc656 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -414,355 +414,361 @@ void KOWhatsNextView::appendDay( int i, QDate eventDate )
414 //mText += "<table>\n"; 414 //mText += "<table>\n";
415 return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; 415 return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>";
416 } 416 }
417 417
418#ifdef DESKTOP_VERSION 418#ifdef DESKTOP_VERSION
419 else if ( i == 1 ) { 419 else if ( i == 1 ) {
420 date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; 420 date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ;
421 } 421 }
422 else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>"; 422 else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>";
423#else 423#else
424 else if ( i == 1 ) { 424 else if ( i == 1 ) {
425 date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; 425 date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ;
426 } 426 }
427 else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>"; 427 else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>";
428 428
429#endif 429#endif
430 mText += "<h2>" + date + "</h2>\n"; 430 mText += "<h2>" + date + "</h2>\n";
431 //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; 431 //mText += "<big><big><strong>" + date + "</strong></big></big>\n";
432 mText += "<table>\n"; 432 mText += "<table>\n";
433 } 433 }
434} 434}
435 435
436 436
437void KOWhatsNextView::showDates(const QDate &, const QDate &) 437void KOWhatsNextView::showDates(const QDate &, const QDate &)
438{ 438{
439 updateView(); 439 updateView();
440} 440}
441 441
442void KOWhatsNextView::showEvents(QPtrList<Event>) 442void KOWhatsNextView::showEvents(QPtrList<Event>)
443{ 443{
444} 444}
445 445
446void KOWhatsNextView::changeEventDisplay(Event *, int action) 446void KOWhatsNextView::changeEventDisplay(Event *, int action)
447{ 447{
448 switch(action) { 448 switch(action) {
449 case KOGlobals::EVENTADDED: 449 case KOGlobals::EVENTADDED:
450 updateView(); 450 updateView();
451 break; 451 break;
452 case KOGlobals::EVENTEDITED: 452 case KOGlobals::EVENTEDITED:
453 updateView(); 453 updateView();
454 break; 454 break;
455 case KOGlobals::EVENTDELETED: 455 case KOGlobals::EVENTDELETED:
456 updateView(); 456 updateView();
457 break; 457 break;
458 default: 458 default:
459 updateView(); 459 updateView();
460 kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; 460 kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl;
461 } 461 }
462} 462}
463 463
464bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable ) 464bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable )
465{ 465{
466 if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) 466 if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") )
467 return false; 467 return false;
468 QDateTime cdt = QDateTime::currentDateTime(); 468 QDateTime cdt = QDateTime::currentDateTime();
469 QDateTime noc; 469 QDateTime noc;
470 QString tempText; 470 QString tempText;
471 if ( appendTable && !notRed ) { 471 if ( appendTable && !notRed ) {
472 tempText = "<table>"; 472 tempText = "<table>";
473 } 473 }
474 bool ok = true; 474 bool ok = true;
475 if ( reply ) { 475 if ( reply ) {
476 noc = ev->getNextOccurence( cdt, &ok ); 476 noc = ev->getNextOccurence( cdt, &ok );
477 if (! ok && ev->type() == "Event") 477 if (! ok && ev->type() == "Event")
478 return false; 478 return false;
479 } 479 }
480 bool bDay = false; 480 bool bDay = false;
481 if ( ev->categories().contains( i18n("Birthday") ) || ev->categories().contains( i18n("Anniversary") ) ) 481 if ( ev->categories().contains( i18n("Birthday") ) || ev->categories().contains( i18n("Anniversary") ) )
482 bDay = true; 482 bDay = true;
483 tempText += "<tr><td><b>"; 483 tempText += "<tr><td><b>";
484 if (ev->type()=="Event") { 484 if (ev->type()=="Event") {
485 if (reply) { 485 if (reply) {
486 if (!ev->doesFloat()) 486 if (!ev->doesFloat())
487 tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; 487 tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": ";
488 else 488 else
489 tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; 489 tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
490 490
491 } else { 491 } else {
492 if (!ev->doesFloat()) { 492 if (!ev->doesFloat()) {
493 Event *event = static_cast<Event *>(ev); 493 Event *event = static_cast<Event *>(ev);
494 QDateTime st,end; 494 QDateTime st,end;
495 if ( event->recurrence()->doesRecur() ) { 495 if ( event->recurrence()->doesRecur() ) {
496 QDate recDate= mEventDate; 496 QDate recDate= mEventDate;
497 int days = event->dtStart().date().daysTo (event->dtEnd().date() ); 497 int days = event->dtStart().date().daysTo (event->dtEnd().date() );
498 while ( ! event->recursOn( recDate ) ) { 498 while ( ! event->recursOn( recDate ) ) {
499 recDate = recDate.addDays( -1 ); 499 recDate = recDate.addDays( -1 );
500 500
501 } 501 }
502 st = QDateTime ( recDate, event->dtStart().time() ); 502 st = QDateTime ( recDate, event->dtStart().time() );
503 end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); 503 end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() );
504 } 504 }
505 else { 505 else {
506 st = event->dtStart(); 506 st = event->dtStart();
507 end = event->dtEnd(); 507 end = event->dtEnd();
508 } 508 }
509 509
510 510
511 QString dateText; 511 QString dateText;
512 // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); 512 // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() );
513 if ( st.date() < mEventDate ) 513 if ( st.date() < mEventDate )
514 dateText = "++:++-"; 514 dateText = "++:++-";
515 else 515 else
516 dateText = event->dtStartTimeStr() + "-"; 516 dateText = event->dtStartTimeStr() + "-";
517 if ( end.date() > mEventDate ) 517 if ( end.date() > mEventDate )
518 dateText += "++:++"; 518 dateText += "++:++";
519 else 519 else
520 dateText += event->dtEndTimeStr(); 520 dateText += event->dtEndTimeStr();
521 if ( notRed ) 521 if ( notRed )
522 tempText += dateText; 522 tempText += dateText;
523 else { 523 else {
524 if ( end < cdt ) { 524 if ( end < cdt ) {
525 if ( !KOPrefs::instance()->mWNViewShowsPast ) 525 if ( !KOPrefs::instance()->mWNViewShowsPast )
526 return false; 526 return false;
527 tempText += "<font color=\"#F00000\">" + dateText + "</font>"; 527 tempText += "<font color=\"#F00000\">" + dateText + "</font>";
528 } 528 }
529 else if ( st < cdt ) 529 else if ( st < cdt )
530 tempText += "<font color=\"#008000\">" + dateText + "</font>"; 530 tempText += "<font color=\"#008000\">" + dateText + "</font>";
531 else 531 else
532 tempText += dateText; 532 tempText += dateText;
533 533
534 } 534 }
535 535
536 } else { 536 } else {
537 if ( bDay ) { 537 if ( bDay ) {
538 538
539 if ( ev->categories().contains( i18n("Birthday") )) 539 if ( ev->categories().contains( i18n("Birthday") ))
540 tempText += "<font color=\"#F00000\">" + i18n("Birthday") +":</font>"; 540 tempText += "<font color=\"#F00000\">" + i18n("Birthday") +":</font>";
541 else 541 else
542 tempText += "<font color=\"#F00000\">" + i18n("Anniversary")+":</font>"; 542 tempText += "<font color=\"#F00000\">" + i18n("Anniversary")+":</font>";
543 } else { 543 } else {
544 tempText += i18n("Allday:"); 544 tempText += i18n("Allday:");
545 } 545 }
546 546
547 } 547 }
548 } 548 }
549 } else { 549 } else {
550 mTodos.append( ev ); 550 mTodos.append( ev );
551 tempText += i18n("ToDo:"); 551 tempText += i18n("ToDo:");
552 if (reply) { 552 if (reply) {
553 tempText += " "; 553 tempText += " ";
554 if ( noc != cdt ) { 554 if ( noc != cdt ) {
555 tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; 555 tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
556 } 556 }
557 } else { 557 } else {
558 if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { 558 if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) {
559 // tempText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 559 // tempText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
560 QString dfs = KGlobal::locale()->dateFormatShort(); 560 QString dfs = KGlobal::locale()->dateFormatShort();
561 KGlobal::locale()->setDateFormatShort("%d.%b"); 561 KGlobal::locale()->setDateFormatShort("%d.%b");
562 tempText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; 562 tempText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>";
563 KGlobal::locale()->setDateFormatShort(dfs); 563 KGlobal::locale()->setDateFormatShort(dfs);
564 } else { 564 } else {
565 if (!ev->doesFloat() ) 565 if (!ev->doesFloat() )
566 if( ( (Todo*)ev)->dtDue() < cdt ) { 566 if( ( (Todo*)ev)->dtDue() < cdt ) {
567 tempText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; 567 tempText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>";
568 568
569 569
570 } else 570 } else
571 tempText +=((Todo*)ev)->dtDueTimeStr(); 571 tempText +=((Todo*)ev)->dtDueTimeStr();
572 mTodos.append( ev ); 572 mTodos.append( ev );
573 } 573 }
574 } 574 }
575 } 575 }
576 tempText += "</b></td><td>"; 576 tempText += "</b></td><td>";
577 bool needClose = false; 577 bool needClose = false;
578 if ( ev->cancelled() ) { 578 if ( ev->cancelled() ) {
579 tempText += "<font color=\"#F00000\">[c"; 579 tempText += "<font color=\"#F00000\">[c";
580 needClose =true; 580 needClose =true;
581 581
582 } 582 }
583 if ( ev->isAlarmEnabled() ) { 583 if ( ev->isAlarmEnabled() ) {
584 if ( !needClose) 584 if ( !needClose)
585 tempText +="["; 585 tempText +="[";
586 tempText += "a"; 586 tempText += "a";
587 needClose =true; 587 needClose =true;
588 588
589 } 589 }
590 if ( ev->description().length() > 0 ) { 590 if ( ev->description().length() > 0 ) {
591 if ( !needClose) 591 if ( !needClose)
592 tempText +="["; 592 tempText +="[";
593 tempText += "i"; 593 tempText += "i";
594 needClose =true; 594 needClose =true;
595 } 595 }
596 if ( ev->recurrence()->doesRecur() ) { 596 if ( ev->recurrence()->doesRecur() ) {
597 if ( !needClose) 597 if ( !needClose)
598 tempText +="["; 598 tempText +="[";
599 tempText += "r"; 599 tempText += "r";
600 needClose =true; 600 needClose =true;
601 } 601 }
602 if ( needClose ) { 602 if ( needClose ) {
603 tempText += "] "; 603 tempText += "] ";
604 } 604 }
605 if ( ev->cancelled() ) 605 if ( ev->cancelled() )
606 tempText += "</font>"; 606 tempText += "</font>";
607 tempText += "<a "; 607 tempText += "<a ";
608 if (ev->type()=="Event") tempText += "href=\"event:"; 608 if (ev->type()=="Event") tempText += "href=\"event:";
609 if (ev->type()=="Todo") tempText += "href=\"todo:"; 609 if (ev->type()=="Todo") tempText += "href=\"todo:";
610 tempText += ev->uid() + "\">"; 610 tempText += ev->uid() + "\">";
611 if ( ev->summary().length() > 0 ) 611 if ( ev->summary().length() > 0 )
612 tempText += ev->summary(); 612 tempText += ev->summary();
613 else 613 else
614 tempText += i18n("-no summary-"); 614 tempText += i18n("-no summary-");
615 if ( bDay ) { 615 if ( bDay ) {
616 noc = ev->getNextOccurence( cdt.addDays(-1), &ok ); 616 noc = ev->getNextOccurence( cdt.addDays(-1), &ok );
617 if ( ok ) { 617 if ( ok ) {
618 int years = 0; 618 int years = 0;
619 if ( ev->type() =="Todo" ) { 619 if ( ev->type() =="Todo" ) {
620 years = noc.date().year() -((Todo*)ev)->dtDue().date().year(); 620 years = noc.date().year() -((Todo*)ev)->dtDue().date().year();
621 } else 621 } else
622 years = noc.date().year() - ev->dtStart().date().year(); 622 years = noc.date().year() - ev->dtStart().date().year();
623 tempText += i18n(" (%1 y.)"). arg( years ); 623 tempText += i18n(" (%1 y.)"). arg( years );
624 } 624 }
625 } 625 }
626 626
627 tempText += "</a>"; 627 tempText += "</a>";
628 if ( KOPrefs::instance()->mWNViewShowLocation ) 628 if ( KOPrefs::instance()->mWNViewShowLocation )
629 if ( !ev->location().isEmpty() ) 629 if ( !ev->location().isEmpty() )
630 tempText += " ("+ev->location() +")"; 630 tempText += " ("+ev->location() +")";
631 if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) 631 if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents)
632 tempText += " ["+ev->relatedTo()->summary() +"]"; 632 tempText += " ["+ev->relatedTo()->summary() +"]";
633 tempText += "</td></tr>\n"; 633 tempText += "</td></tr>\n";
634 mText += tempText; 634 mText += tempText;
635 return true; 635 return true;
636} 636}
637 637
638bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) 638bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
639{ 639{
640 if ( mTodos.find( ev ) != mTodos.end() ) return false; 640 if ( mTodos.find( ev ) != mTodos.end() ) return false;
641 641
642 mTodos.append( ev ); 642 mTodos.append( ev );
643 if ( !isSub ) 643 if ( !isSub )
644 mText += "<p>"; 644 mText += "<p>";
645 else 645 else
646 mText += "<li>"; 646 mText += "<li>";
647 mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; 647 mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] ";
648 648
649 649
650 mText += ind; 650 mText += ind;
651 bool needClose = false; 651 bool needClose = false;
652 if ( ev->cancelled() ) { 652 if ( ev->cancelled() ) {
653 mText += "<font color=\"#F00000\">[c"; 653 mText += "<font color=\"#F00000\">[c";
654 needClose =true; 654 needClose =true;
655 655
656 } 656 }
657 if ( ev->isAlarmEnabled() ) { 657 if ( ev->isAlarmEnabled() ) {
658 if ( !needClose) 658 if ( !needClose)
659 mText +="["; 659 mText +="[";
660 mText += "a"; 660 mText += "a";
661 needClose =true; 661 needClose =true;
662 662
663 } 663 }
664 664
665 if ( ev->description().length() > 0 ) { 665 if ( ev->description().length() > 0 ) {
666 if ( !needClose) 666 if ( !needClose)
667 mText +="["; 667 mText +="[";
668 mText += "i"; 668 mText += "i";
669 needClose =true; 669 needClose =true;
670 }
671 if ( ev->doesRecur() ) {
672 if ( !needClose)
673 mText +="[";
674 mText += "r";
675 needClose =true;
670 } 676 }
671 // if ( ev->recurrence()->doesRecur() ) { 677 // if ( ev->recurrence()->doesRecur() ) {
672 // if ( !needClose) 678 // if ( !needClose)
673 // mText +="("; 679 // mText +="(";
674 // mText += "r"; 680 // mText += "r";
675 // needClose =true; 681 // needClose =true;
676 // } 682 // }
677 if ( needClose ) 683 if ( needClose )
678 mText += "] "; 684 mText += "] ";
679 if ( ev->cancelled() ) 685 if ( ev->cancelled() )
680 mText += "</font>"; 686 mText += "</font>";
681 mText += "<a href=\"todo:" + ev->uid() + "\">"; 687 mText += "<a href=\"todo:" + ev->uid() + "\">";
682 if ( ev->summary().length() > 0 ) 688 if ( ev->summary().length() > 0 )
683 mText += ev->summary(); 689 mText += ev->summary();
684 else 690 else
685 mText += i18n("-no summary-"); 691 mText += i18n("-no summary-");
686 mText += "</a>"; 692 mText += "</a>";
687 if ( ((Todo*)ev)->hasDueDate () ) { 693 if ( ((Todo*)ev)->hasDueDate () ) {
688 QString year = ""; 694 QString year = "";
689 int ye = ((Todo*)ev)->dtDue().date().year(); 695 int ye = ((Todo*)ev)->dtDue().date().year();
690 if ( QDateTime::currentDateTime().date().year() != ye ) 696 if ( QDateTime::currentDateTime().date().year() != ye )
691 year = QString::number( ye ); 697 year = QString::number( ye );
692 QString dfs = KGlobal::locale()->dateFormatShort(); 698 QString dfs = KGlobal::locale()->dateFormatShort();
693 KGlobal::locale()->setDateFormatShort("%d.%b"); 699 KGlobal::locale()->setDateFormatShort("%d.%b");
694 mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>"; 700 mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>";
695 KGlobal::locale()->setDateFormatShort(dfs); 701 KGlobal::locale()->setDateFormatShort(dfs);
696 } 702 }
697 if ( KOPrefs::instance()->mWNViewShowLocation ) 703 if ( KOPrefs::instance()->mWNViewShowLocation )
698 if ( !ev->location().isEmpty() ) 704 if ( !ev->location().isEmpty() )
699 mText += " ("+ev->location() +")"; 705 mText += " ("+ev->location() +")";
700 if ( !isSub ) { 706 if ( !isSub ) {
701 if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) 707 if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents)
702 mText += " ["+ev->relatedTo()->summary() +"]"; 708 mText += " ["+ev->relatedTo()->summary() +"]";
703 mText += "</p>\n"; 709 mText += "</p>\n";
704 } 710 }
705 else { 711 else {
706 ind += "-"; 712 ind += "-";
707 mText += "</li>\n"; 713 mText += "</li>\n";
708 } 714 }
709 QPtrList<Incidence> Relations = ev->relations(); 715 QPtrList<Incidence> Relations = ev->relations();
710 Incidence *to; 716 Incidence *to;
711 for (to=Relations.first();to;to=Relations.next()) { 717 for (to=Relations.first();to;to=Relations.next()) {
712 if (!((Todo*)to)->isCompleted()) 718 if (!((Todo*)to)->isCompleted())
713 appendTodo( to, ind , true ); 719 appendTodo( to, ind , true );
714 } 720 }
715 721
716 return true; 722 return true;
717} 723}
718 724
719/* 725/*
720 void KOWhatsNextView::createEventViewer() 726 void KOWhatsNextView::createEventViewer()
721 { 727 {
722 if (!mEventViewer) { 728 if (!mEventViewer) {
723 729
724 mEventViewer = new KOEventViewerDialog(this); 730 mEventViewer = new KOEventViewerDialog(this);
725 } 731 }
726 } 732 }
727*/ 733*/
728void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) 734void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v )
729{ 735{
730 mEventViewer = v; 736 mEventViewer = v;
731} 737}
732 738
733// TODO: Create this function in CalendarView and remove it from here 739// TODO: Create this function in CalendarView and remove it from here
734void KOWhatsNextView::showIncidence(const QString &uid) 740void KOWhatsNextView::showIncidence(const QString &uid)
735{ 741{
736 742
737 if ( !mEventViewer ) { 743 if ( !mEventViewer ) {
738 qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set "); 744 qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set ");
739 return; 745 return;
740 } 746 }
741 //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl; 747 //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl;
742 //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1()); 748 //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1());
743 if (uid.startsWith("event:")) { 749 if (uid.startsWith("event:")) {
744#ifdef DESKTOP_VERSION 750#ifdef DESKTOP_VERSION
745 Event *event = calendar()->event(uid.mid(8)); 751 Event *event = calendar()->event(uid.mid(8));
746#else 752#else
747 Event *event = calendar()->event(uid.mid(6)); 753 Event *event = calendar()->event(uid.mid(6));
748#endif 754#endif
749 //qDebug("event %d uid %s ", event, uid.mid(6).latin1()); 755 //qDebug("event %d uid %s ", event, uid.mid(6).latin1());
750 if (!event) return; 756 if (!event) return;
751 //createEventViewer(); 757 //createEventViewer();
752 mEventViewer->setEvent(event); 758 mEventViewer->setEvent(event);
753 } else if (uid.startsWith("todo:")) { 759 } else if (uid.startsWith("todo:")) {
754#ifdef DESKTOP_VERSION 760#ifdef DESKTOP_VERSION
755 Todo *todo = calendar()->todo(uid.mid(7)); 761 Todo *todo = calendar()->todo(uid.mid(7));
756#else 762#else
757 Todo *todo = calendar()->todo(uid.mid(5)); 763 Todo *todo = calendar()->todo(uid.mid(5));
758#endif 764#endif
759 if (!todo) return; 765 if (!todo) return;
760 //createEventViewer(); 766 //createEventViewer();
761 mEventViewer->setTodo(todo); 767 mEventViewer->setTodo(todo);
762 } else { 768 } else {
763 return; 769 return;
764 770
765 } 771 }
766 mEventViewer->showMe(); 772 mEventViewer->showMe();
767 mEventViewer->raise(); 773 mEventViewer->raise();
768} 774}
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp
index bb9cb29..2e38ae3 100644
--- a/libkcal/icalformatimpl.cpp
+++ b/libkcal/icalformatimpl.cpp
@@ -957,513 +957,513 @@ Event *ICalFormatImpl::readEvent(icalcomponent *vevent)
957 event->setDtEnd(endDate.addDays(-1)); 957 event->setDtEnd(endDate.addDays(-1));
958 } 958 }
959 } 959 }
960 960
961 // some stupid vCal exporters ignore the standard and use Description 961 // some stupid vCal exporters ignore the standard and use Description
962 // instead of Summary for the default field. Correct for this. 962 // instead of Summary for the default field. Correct for this.
963 if (event->summary().isEmpty() && 963 if (event->summary().isEmpty() &&
964 !(event->description().isEmpty())) { 964 !(event->description().isEmpty())) {
965 QString tmpStr = event->description().simplifyWhiteSpace(); 965 QString tmpStr = event->description().simplifyWhiteSpace();
966 event->setDescription(""); 966 event->setDescription("");
967 event->setSummary(tmpStr); 967 event->setSummary(tmpStr);
968 } 968 }
969 969
970 return event; 970 return event;
971} 971}
972 972
973FreeBusy *ICalFormatImpl::readFreeBusy(icalcomponent *vfreebusy) 973FreeBusy *ICalFormatImpl::readFreeBusy(icalcomponent *vfreebusy)
974{ 974{
975 FreeBusy *freebusy = new FreeBusy; 975 FreeBusy *freebusy = new FreeBusy;
976 976
977 readIncidenceBase(vfreebusy,freebusy); 977 readIncidenceBase(vfreebusy,freebusy);
978 978
979 icalproperty *p = icalcomponent_get_first_property(vfreebusy,ICAL_ANY_PROPERTY); 979 icalproperty *p = icalcomponent_get_first_property(vfreebusy,ICAL_ANY_PROPERTY);
980 980
981 icaltimetype icaltime; 981 icaltimetype icaltime;
982 icalperiodtype icalperiod; 982 icalperiodtype icalperiod;
983 QDateTime period_start, period_end; 983 QDateTime period_start, period_end;
984 984
985 while (p) { 985 while (p) {
986 icalproperty_kind kind = icalproperty_isa(p); 986 icalproperty_kind kind = icalproperty_isa(p);
987 switch (kind) { 987 switch (kind) {
988 988
989 case ICAL_DTSTART_PROPERTY: // start date and time 989 case ICAL_DTSTART_PROPERTY: // start date and time
990 icaltime = icalproperty_get_dtstart(p); 990 icaltime = icalproperty_get_dtstart(p);
991 freebusy->setDtStart(readICalDateTime(icaltime)); 991 freebusy->setDtStart(readICalDateTime(icaltime));
992 break; 992 break;
993 993
994 case ICAL_DTEND_PROPERTY: // start End Date and Time 994 case ICAL_DTEND_PROPERTY: // start End Date and Time
995 icaltime = icalproperty_get_dtend(p); 995 icaltime = icalproperty_get_dtend(p);
996 freebusy->setDtEnd(readICalDateTime(icaltime)); 996 freebusy->setDtEnd(readICalDateTime(icaltime));
997 break; 997 break;
998 998
999 case ICAL_FREEBUSY_PROPERTY: //Any FreeBusy Times 999 case ICAL_FREEBUSY_PROPERTY: //Any FreeBusy Times
1000 icalperiod = icalproperty_get_freebusy(p); 1000 icalperiod = icalproperty_get_freebusy(p);
1001 period_start = readICalDateTime(icalperiod.start); 1001 period_start = readICalDateTime(icalperiod.start);
1002 period_end = readICalDateTime(icalperiod.end); 1002 period_end = readICalDateTime(icalperiod.end);
1003 freebusy->addPeriod(period_start, period_end); 1003 freebusy->addPeriod(period_start, period_end);
1004 break; 1004 break;
1005 1005
1006 default: 1006 default:
1007 kdDebug(5800) << "ICALFormat::readIncidence(): Unknown property: " << kind 1007 kdDebug(5800) << "ICALFormat::readIncidence(): Unknown property: " << kind
1008 << endl; 1008 << endl;
1009 break; 1009 break;
1010 } 1010 }
1011 p = icalcomponent_get_next_property(vfreebusy,ICAL_ANY_PROPERTY); 1011 p = icalcomponent_get_next_property(vfreebusy,ICAL_ANY_PROPERTY);
1012 } 1012 }
1013 1013
1014 return freebusy; 1014 return freebusy;
1015} 1015}
1016 1016
1017Journal *ICalFormatImpl::readJournal(icalcomponent *vjournal) 1017Journal *ICalFormatImpl::readJournal(icalcomponent *vjournal)
1018{ 1018{
1019 Journal *journal = new Journal; 1019 Journal *journal = new Journal;
1020 1020
1021 readIncidence(vjournal,journal); 1021 readIncidence(vjournal,journal);
1022 1022
1023 return journal; 1023 return journal;
1024} 1024}
1025 1025
1026Attendee *ICalFormatImpl::readAttendee(icalproperty *attendee) 1026Attendee *ICalFormatImpl::readAttendee(icalproperty *attendee)
1027{ 1027{
1028 icalparameter *p = 0; 1028 icalparameter *p = 0;
1029 1029
1030 QString email = QString::fromUtf8(icalproperty_get_attendee(attendee)); 1030 QString email = QString::fromUtf8(icalproperty_get_attendee(attendee));
1031 1031
1032 QString name; 1032 QString name;
1033 QString uid = QString::null; 1033 QString uid = QString::null;
1034 p = icalproperty_get_first_parameter(attendee,ICAL_CN_PARAMETER); 1034 p = icalproperty_get_first_parameter(attendee,ICAL_CN_PARAMETER);
1035 if (p) { 1035 if (p) {
1036 name = QString::fromUtf8(icalparameter_get_cn(p)); 1036 name = QString::fromUtf8(icalparameter_get_cn(p));
1037 } else { 1037 } else {
1038 } 1038 }
1039 1039
1040 bool rsvp=false; 1040 bool rsvp=false;
1041 p = icalproperty_get_first_parameter(attendee,ICAL_RSVP_PARAMETER); 1041 p = icalproperty_get_first_parameter(attendee,ICAL_RSVP_PARAMETER);
1042 if (p) { 1042 if (p) {
1043 icalparameter_rsvp rsvpParameter = icalparameter_get_rsvp(p); 1043 icalparameter_rsvp rsvpParameter = icalparameter_get_rsvp(p);
1044 if (rsvpParameter == ICAL_RSVP_TRUE) rsvp = true; 1044 if (rsvpParameter == ICAL_RSVP_TRUE) rsvp = true;
1045 } 1045 }
1046 1046
1047 Attendee::PartStat status = Attendee::NeedsAction; 1047 Attendee::PartStat status = Attendee::NeedsAction;
1048 p = icalproperty_get_first_parameter(attendee,ICAL_PARTSTAT_PARAMETER); 1048 p = icalproperty_get_first_parameter(attendee,ICAL_PARTSTAT_PARAMETER);
1049 if (p) { 1049 if (p) {
1050 icalparameter_partstat partStatParameter = icalparameter_get_partstat(p); 1050 icalparameter_partstat partStatParameter = icalparameter_get_partstat(p);
1051 switch(partStatParameter) { 1051 switch(partStatParameter) {
1052 default: 1052 default:
1053 case ICAL_PARTSTAT_NEEDSACTION: 1053 case ICAL_PARTSTAT_NEEDSACTION:
1054 status = Attendee::NeedsAction; 1054 status = Attendee::NeedsAction;
1055 break; 1055 break;
1056 case ICAL_PARTSTAT_ACCEPTED: 1056 case ICAL_PARTSTAT_ACCEPTED:
1057 status = Attendee::Accepted; 1057 status = Attendee::Accepted;
1058 break; 1058 break;
1059 case ICAL_PARTSTAT_DECLINED: 1059 case ICAL_PARTSTAT_DECLINED:
1060 status = Attendee::Declined; 1060 status = Attendee::Declined;
1061 break; 1061 break;
1062 case ICAL_PARTSTAT_TENTATIVE: 1062 case ICAL_PARTSTAT_TENTATIVE:
1063 status = Attendee::Tentative; 1063 status = Attendee::Tentative;
1064 break; 1064 break;
1065 case ICAL_PARTSTAT_DELEGATED: 1065 case ICAL_PARTSTAT_DELEGATED:
1066 status = Attendee::Delegated; 1066 status = Attendee::Delegated;
1067 break; 1067 break;
1068 case ICAL_PARTSTAT_COMPLETED: 1068 case ICAL_PARTSTAT_COMPLETED:
1069 status = Attendee::Completed; 1069 status = Attendee::Completed;
1070 break; 1070 break;
1071 case ICAL_PARTSTAT_INPROCESS: 1071 case ICAL_PARTSTAT_INPROCESS:
1072 status = Attendee::InProcess; 1072 status = Attendee::InProcess;
1073 break; 1073 break;
1074 } 1074 }
1075 } 1075 }
1076 1076
1077 Attendee::Role role = Attendee::ReqParticipant; 1077 Attendee::Role role = Attendee::ReqParticipant;
1078 p = icalproperty_get_first_parameter(attendee,ICAL_ROLE_PARAMETER); 1078 p = icalproperty_get_first_parameter(attendee,ICAL_ROLE_PARAMETER);
1079 if (p) { 1079 if (p) {
1080 icalparameter_role roleParameter = icalparameter_get_role(p); 1080 icalparameter_role roleParameter = icalparameter_get_role(p);
1081 switch(roleParameter) { 1081 switch(roleParameter) {
1082 case ICAL_ROLE_CHAIR: 1082 case ICAL_ROLE_CHAIR:
1083 role = Attendee::Chair; 1083 role = Attendee::Chair;
1084 break; 1084 break;
1085 default: 1085 default:
1086 case ICAL_ROLE_REQPARTICIPANT: 1086 case ICAL_ROLE_REQPARTICIPANT:
1087 role = Attendee::ReqParticipant; 1087 role = Attendee::ReqParticipant;
1088 break; 1088 break;
1089 case ICAL_ROLE_OPTPARTICIPANT: 1089 case ICAL_ROLE_OPTPARTICIPANT:
1090 role = Attendee::OptParticipant; 1090 role = Attendee::OptParticipant;
1091 break; 1091 break;
1092 case ICAL_ROLE_NONPARTICIPANT: 1092 case ICAL_ROLE_NONPARTICIPANT:
1093 role = Attendee::NonParticipant; 1093 role = Attendee::NonParticipant;
1094 break; 1094 break;
1095 } 1095 }
1096 } 1096 }
1097 1097
1098 p = icalproperty_get_first_parameter(attendee,ICAL_X_PARAMETER); 1098 p = icalproperty_get_first_parameter(attendee,ICAL_X_PARAMETER);
1099 uid = icalparameter_get_xvalue(p); 1099 uid = icalparameter_get_xvalue(p);
1100 // This should be added, but there seems to be a libical bug here. 1100 // This should be added, but there seems to be a libical bug here.
1101 /*while (p) { 1101 /*while (p) {
1102 // if (icalparameter_get_xname(p) == "X-UID") { 1102 // if (icalparameter_get_xname(p) == "X-UID") {
1103 uid = icalparameter_get_xvalue(p); 1103 uid = icalparameter_get_xvalue(p);
1104 p = icalproperty_get_next_parameter(attendee,ICAL_X_PARAMETER); 1104 p = icalproperty_get_next_parameter(attendee,ICAL_X_PARAMETER);
1105 } */ 1105 } */
1106 1106
1107 return new Attendee( name, email, rsvp, status, role, uid ); 1107 return new Attendee( name, email, rsvp, status, role, uid );
1108} 1108}
1109 1109
1110Attachment *ICalFormatImpl::readAttachment(icalproperty *attach) 1110Attachment *ICalFormatImpl::readAttachment(icalproperty *attach)
1111{ 1111{
1112 icalattach *a = icalproperty_get_attach(attach); 1112 icalattach *a = icalproperty_get_attach(attach);
1113 icalparameter_value v = ICAL_VALUE_NONE; 1113 icalparameter_value v = ICAL_VALUE_NONE;
1114 icalparameter_encoding e = ICAL_ENCODING_NONE; 1114 icalparameter_encoding e = ICAL_ENCODING_NONE;
1115 1115
1116 Attachment *attachment = 0; 1116 Attachment *attachment = 0;
1117 /* 1117 /*
1118 icalparameter *vp = icalproperty_get_first_parameter(attach, ICAL_VALUE_PARAMETER); 1118 icalparameter *vp = icalproperty_get_first_parameter(attach, ICAL_VALUE_PARAMETER);
1119 if (vp) 1119 if (vp)
1120 v = icalparameter_get_value(vp); 1120 v = icalparameter_get_value(vp);
1121 1121
1122 icalparameter *ep = icalproperty_get_first_parameter(attach, ICAL_ENCODING_PARAMETER); 1122 icalparameter *ep = icalproperty_get_first_parameter(attach, ICAL_ENCODING_PARAMETER);
1123 if (ep) 1123 if (ep)
1124 e = icalparameter_get_encoding(ep); 1124 e = icalparameter_get_encoding(ep);
1125 */ 1125 */
1126 int isurl = icalattach_get_is_url (a); 1126 int isurl = icalattach_get_is_url (a);
1127 if (isurl == 0) 1127 if (isurl == 0)
1128 attachment = new Attachment((const char*)icalattach_get_data(a)); 1128 attachment = new Attachment((const char*)icalattach_get_data(a));
1129 else { 1129 else {
1130 attachment = new Attachment(QString(icalattach_get_url(a))); 1130 attachment = new Attachment(QString(icalattach_get_url(a)));
1131 } 1131 }
1132 1132
1133 icalparameter *p = icalproperty_get_first_parameter(attach, ICAL_FMTTYPE_PARAMETER); 1133 icalparameter *p = icalproperty_get_first_parameter(attach, ICAL_FMTTYPE_PARAMETER);
1134 if (p) 1134 if (p)
1135 attachment->setMimeType(QString(icalparameter_get_fmttype(p))); 1135 attachment->setMimeType(QString(icalparameter_get_fmttype(p)));
1136 1136
1137 return attachment; 1137 return attachment;
1138} 1138}
1139#include <qtextcodec.h> 1139#include <qtextcodec.h>
1140void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence) 1140void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence)
1141{ 1141{
1142 readIncidenceBase(parent,incidence); 1142 readIncidenceBase(parent,incidence);
1143 1143
1144 icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY); 1144 icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY);
1145 bool readrec = false; 1145 bool readrec = false;
1146 const char *text; 1146 const char *text;
1147 int intvalue; 1147 int intvalue;
1148 icaltimetype icaltime; 1148 icaltimetype icaltime;
1149 icaldurationtype icalduration; 1149 icaldurationtype icalduration;
1150 struct icalrecurrencetype rectype; 1150 struct icalrecurrencetype rectype;
1151 QStringList categories; 1151 QStringList categories;
1152 1152
1153 while (p) { 1153 while (p) {
1154 icalproperty_kind kind = icalproperty_isa(p); 1154 icalproperty_kind kind = icalproperty_isa(p);
1155 switch (kind) { 1155 switch (kind) {
1156 1156
1157 case ICAL_CREATED_PROPERTY: 1157 case ICAL_CREATED_PROPERTY:
1158 icaltime = icalproperty_get_created(p); 1158 icaltime = icalproperty_get_created(p);
1159 incidence->setCreated(readICalDateTime(icaltime)); 1159 incidence->setCreated(readICalDateTime(icaltime));
1160 break; 1160 break;
1161 1161
1162 case ICAL_SEQUENCE_PROPERTY: // sequence 1162 case ICAL_SEQUENCE_PROPERTY: // sequence
1163 intvalue = icalproperty_get_sequence(p); 1163 intvalue = icalproperty_get_sequence(p);
1164 incidence->setRevision(intvalue); 1164 incidence->setRevision(intvalue);
1165 break; 1165 break;
1166 1166
1167 case ICAL_LASTMODIFIED_PROPERTY: // last modification date 1167 case ICAL_LASTMODIFIED_PROPERTY: // last modification date
1168 icaltime = icalproperty_get_lastmodified(p); 1168 icaltime = icalproperty_get_lastmodified(p);
1169 incidence->setLastModified(readICalDateTime(icaltime)); 1169 incidence->setLastModified(readICalDateTime(icaltime));
1170 break; 1170 break;
1171 1171
1172 case ICAL_DTSTART_PROPERTY: // start date and time 1172 case ICAL_DTSTART_PROPERTY: // start date and time
1173 icaltime = icalproperty_get_dtstart(p); 1173 icaltime = icalproperty_get_dtstart(p);
1174 if (icaltime.is_date) { 1174 if (icaltime.is_date) {
1175 incidence->setDtStart(QDateTime(readICalDate(icaltime),QTime(0,0,0))); 1175 incidence->setDtStart(QDateTime(readICalDate(icaltime),QTime(0,0,0)));
1176 incidence->setFloats(true); 1176 incidence->setFloats(true);
1177 } else { 1177 } else {
1178 incidence->setDtStart(readICalDateTime(icaltime)); 1178 incidence->setDtStart(readICalDateTime(icaltime));
1179 } 1179 }
1180 break; 1180 break;
1181 1181
1182 case ICAL_DURATION_PROPERTY: // start date and time 1182 case ICAL_DURATION_PROPERTY: // start date and time
1183 icalduration = icalproperty_get_duration(p); 1183 icalduration = icalproperty_get_duration(p);
1184 incidence->setDuration(readICalDuration(icalduration)); 1184 incidence->setDuration(readICalDuration(icalduration));
1185 break; 1185 break;
1186 1186
1187 case ICAL_DESCRIPTION_PROPERTY: // description 1187 case ICAL_DESCRIPTION_PROPERTY: // description
1188 text = icalproperty_get_description(p); 1188 text = icalproperty_get_description(p);
1189 incidence->setDescription(QString::fromUtf8(text)); 1189 incidence->setDescription(QString::fromUtf8(text));
1190 break; 1190 break;
1191 1191
1192 case ICAL_SUMMARY_PROPERTY: // summary 1192 case ICAL_SUMMARY_PROPERTY: // summary
1193 { 1193 {
1194 text = icalproperty_get_summary(p); 1194 text = icalproperty_get_summary(p);
1195 incidence->setSummary(QString::fromUtf8(text)); 1195 incidence->setSummary(QString::fromUtf8(text));
1196 } 1196 }
1197 break; 1197 break;
1198 case ICAL_STATUS_PROPERTY: // summary 1198 case ICAL_STATUS_PROPERTY: // summary
1199 { 1199 {
1200 if ( ICAL_STATUS_CANCELLED == icalproperty_get_status(p) ) 1200 if ( ICAL_STATUS_CANCELLED == icalproperty_get_status(p) )
1201 incidence->setCancelled( true ); 1201 incidence->setCancelled( true );
1202 } 1202 }
1203 break; 1203 break;
1204 1204
1205 case ICAL_LOCATION_PROPERTY: // location 1205 case ICAL_LOCATION_PROPERTY: // location
1206 text = icalproperty_get_location(p); 1206 text = icalproperty_get_location(p);
1207 incidence->setLocation(QString::fromUtf8(text)); 1207 incidence->setLocation(QString::fromUtf8(text));
1208 break; 1208 break;
1209 1209
1210 case ICAL_RECURRENCEID_PROPERTY: 1210 case ICAL_RECURRENCEID_PROPERTY:
1211 icaltime = icalproperty_get_recurrenceid(p); 1211 icaltime = icalproperty_get_recurrenceid(p);
1212 incidence->setRecurrenceID( readICalDateTime(icaltime) ); 1212 incidence->setRecurrenceID( readICalDateTime(icaltime) );
1213 qDebug(" RecurrenceID %s",incidence->recurrenceID().toString().latin1() ); 1213 //qDebug(" RecurrenceID %s",incidence->recurrenceID().toString().latin1() );
1214 break; 1214 break;
1215#if 0 1215#if 0
1216 // status 1216 // status
1217 if ((vo = isAPropertyOf(vincidence, VCStatusProp)) != 0) { 1217 if ((vo = isAPropertyOf(vincidence, VCStatusProp)) != 0) {
1218 incidence->setStatus(s = fakeCString(vObjectUStringZValue(vo))); 1218 incidence->setStatus(s = fakeCString(vObjectUStringZValue(vo)));
1219 deleteStr(s); 1219 deleteStr(s);
1220 } 1220 }
1221 else 1221 else
1222 incidence->setStatus("NEEDS ACTION"); 1222 incidence->setStatus("NEEDS ACTION");
1223#endif 1223#endif
1224 1224
1225 case ICAL_PRIORITY_PROPERTY: // priority 1225 case ICAL_PRIORITY_PROPERTY: // priority
1226 intvalue = icalproperty_get_priority(p); 1226 intvalue = icalproperty_get_priority(p);
1227 incidence->setPriority(intvalue); 1227 incidence->setPriority(intvalue);
1228 break; 1228 break;
1229 1229
1230 case ICAL_CATEGORIES_PROPERTY: // categories 1230 case ICAL_CATEGORIES_PROPERTY: // categories
1231 text = icalproperty_get_categories(p); 1231 text = icalproperty_get_categories(p);
1232 categories.append(QString::fromUtf8(text)); 1232 categories.append(QString::fromUtf8(text));
1233 break; 1233 break;
1234 //******************************************* 1234 //*******************************************
1235 case ICAL_RRULE_PROPERTY: 1235 case ICAL_RRULE_PROPERTY:
1236 // we do need (maybe )start datetime of incidence for recurrence 1236 // we do need (maybe )start datetime of incidence for recurrence
1237 // such that we can read recurrence only after we read incidence completely 1237 // such that we can read recurrence only after we read incidence completely
1238 readrec = true; 1238 readrec = true;
1239 rectype = icalproperty_get_rrule(p); 1239 rectype = icalproperty_get_rrule(p);
1240 break; 1240 break;
1241 1241
1242 case ICAL_EXDATE_PROPERTY: 1242 case ICAL_EXDATE_PROPERTY:
1243 icaltime = icalproperty_get_exdate(p); 1243 icaltime = icalproperty_get_exdate(p);
1244 incidence->addExDate(readICalDate(icaltime)); 1244 incidence->addExDate(readICalDate(icaltime));
1245 break; 1245 break;
1246 1246
1247 case ICAL_CLASS_PROPERTY: { 1247 case ICAL_CLASS_PROPERTY: {
1248 int inttext = icalproperty_get_class(p); 1248 int inttext = icalproperty_get_class(p);
1249 if (inttext == ICAL_CLASS_PUBLIC ) { 1249 if (inttext == ICAL_CLASS_PUBLIC ) {
1250 incidence->setSecrecy(Incidence::SecrecyPublic); 1250 incidence->setSecrecy(Incidence::SecrecyPublic);
1251 } else if (inttext == ICAL_CLASS_CONFIDENTIAL ) { 1251 } else if (inttext == ICAL_CLASS_CONFIDENTIAL ) {
1252 incidence->setSecrecy(Incidence::SecrecyConfidential); 1252 incidence->setSecrecy(Incidence::SecrecyConfidential);
1253 } else { 1253 } else {
1254 incidence->setSecrecy(Incidence::SecrecyPrivate); 1254 incidence->setSecrecy(Incidence::SecrecyPrivate);
1255 } 1255 }
1256 } 1256 }
1257 break; 1257 break;
1258 1258
1259 case ICAL_ATTACH_PROPERTY: // attachments 1259 case ICAL_ATTACH_PROPERTY: // attachments
1260 incidence->addAttachment(readAttachment(p)); 1260 incidence->addAttachment(readAttachment(p));
1261 break; 1261 break;
1262 1262
1263 default: 1263 default:
1264// kdDebug(5800) << "ICALFormat::readIncidence(): Unknown property: " << kind 1264// kdDebug(5800) << "ICALFormat::readIncidence(): Unknown property: " << kind
1265// << endl; 1265// << endl;
1266 break; 1266 break;
1267 } 1267 }
1268 1268
1269 p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY); 1269 p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY);
1270 } 1270 }
1271 if ( readrec ) { 1271 if ( readrec ) {
1272 readRecurrenceRule(rectype,incidence); 1272 readRecurrenceRule(rectype,incidence);
1273 } 1273 }
1274 // kpilot stuff 1274 // kpilot stuff
1275// TODO: move this application-specific code to kpilot 1275// TODO: move this application-specific code to kpilot
1276 QString kp = incidence->nonKDECustomProperty("X-PILOTID"); 1276 QString kp = incidence->nonKDECustomProperty("X-PILOTID");
1277 if (!kp.isNull()) { 1277 if (!kp.isNull()) {
1278 incidence->setPilotId(kp.toInt()); 1278 incidence->setPilotId(kp.toInt());
1279 } 1279 }
1280 kp = incidence->nonKDECustomProperty("X-PILOTSTAT"); 1280 kp = incidence->nonKDECustomProperty("X-PILOTSTAT");
1281 if (!kp.isNull()) { 1281 if (!kp.isNull()) {
1282 incidence->setSyncStatus(kp.toInt()); 1282 incidence->setSyncStatus(kp.toInt());
1283 } 1283 }
1284 1284
1285 1285
1286 kp = incidence->nonKDECustomProperty("X-KOPIEXTID"); 1286 kp = incidence->nonKDECustomProperty("X-KOPIEXTID");
1287 if (!kp.isNull()) { 1287 if (!kp.isNull()) {
1288 incidence->setIDStr(kp); 1288 incidence->setIDStr(kp);
1289 } 1289 }
1290 1290
1291 // Cancel backwards compatibility mode for subsequent changes by the application 1291 // Cancel backwards compatibility mode for subsequent changes by the application
1292 incidence->recurrence()->setCompatVersion(); 1292 incidence->recurrence()->setCompatVersion();
1293 1293
1294 // add categories 1294 // add categories
1295 incidence->setCategories(categories); 1295 incidence->setCategories(categories);
1296 1296
1297 // iterate through all alarms 1297 // iterate through all alarms
1298 for (icalcomponent *alarm = icalcomponent_get_first_component(parent,ICAL_VALARM_COMPONENT); 1298 for (icalcomponent *alarm = icalcomponent_get_first_component(parent,ICAL_VALARM_COMPONENT);
1299 alarm; 1299 alarm;
1300 alarm = icalcomponent_get_next_component(parent,ICAL_VALARM_COMPONENT)) { 1300 alarm = icalcomponent_get_next_component(parent,ICAL_VALARM_COMPONENT)) {
1301 readAlarm(alarm,incidence); 1301 readAlarm(alarm,incidence);
1302 } 1302 }
1303} 1303}
1304 1304
1305void ICalFormatImpl::readIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) 1305void ICalFormatImpl::readIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase)
1306{ 1306{
1307 icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY); 1307 icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY);
1308 1308
1309 while (p) { 1309 while (p) {
1310 icalproperty_kind kind = icalproperty_isa(p); 1310 icalproperty_kind kind = icalproperty_isa(p);
1311 switch (kind) { 1311 switch (kind) {
1312 1312
1313 case ICAL_UID_PROPERTY: // unique id 1313 case ICAL_UID_PROPERTY: // unique id
1314 incidenceBase->setUid(QString::fromUtf8(icalproperty_get_uid(p))); 1314 incidenceBase->setUid(QString::fromUtf8(icalproperty_get_uid(p)));
1315 break; 1315 break;
1316 1316
1317 case ICAL_ORGANIZER_PROPERTY: // organizer 1317 case ICAL_ORGANIZER_PROPERTY: // organizer
1318 incidenceBase->setOrganizer(QString::fromUtf8(icalproperty_get_organizer(p))); 1318 incidenceBase->setOrganizer(QString::fromUtf8(icalproperty_get_organizer(p)));
1319 break; 1319 break;
1320 1320
1321 case ICAL_ATTENDEE_PROPERTY: // attendee 1321 case ICAL_ATTENDEE_PROPERTY: // attendee
1322 incidenceBase->addAttendee(readAttendee(p)); 1322 incidenceBase->addAttendee(readAttendee(p));
1323 break; 1323 break;
1324 1324
1325 default: 1325 default:
1326 break; 1326 break;
1327 } 1327 }
1328 1328
1329 p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY); 1329 p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY);
1330 } 1330 }
1331 1331
1332 // custom properties 1332 // custom properties
1333 readCustomProperties(parent, incidenceBase); 1333 readCustomProperties(parent, incidenceBase);
1334} 1334}
1335 1335
1336void ICalFormatImpl::readCustomProperties(icalcomponent *parent,CustomProperties *properties) 1336void ICalFormatImpl::readCustomProperties(icalcomponent *parent,CustomProperties *properties)
1337{ 1337{
1338 QMap<QCString, QString> customProperties; 1338 QMap<QCString, QString> customProperties;
1339 1339
1340 icalproperty *p = icalcomponent_get_first_property(parent,ICAL_X_PROPERTY); 1340 icalproperty *p = icalcomponent_get_first_property(parent,ICAL_X_PROPERTY);
1341 1341
1342 while (p) { 1342 while (p) {
1343 QString value = QString::fromUtf8(icalproperty_get_x(p)); 1343 QString value = QString::fromUtf8(icalproperty_get_x(p));
1344 customProperties[icalproperty_get_x_name(p)] = value; 1344 customProperties[icalproperty_get_x_name(p)] = value;
1345 //qDebug("ICalFormatImpl::readCustomProperties %s %s",value.latin1(), icalproperty_get_x_name(p) ); 1345 //qDebug("ICalFormatImpl::readCustomProperties %s %s",value.latin1(), icalproperty_get_x_name(p) );
1346 1346
1347 p = icalcomponent_get_next_property(parent,ICAL_X_PROPERTY); 1347 p = icalcomponent_get_next_property(parent,ICAL_X_PROPERTY);
1348 } 1348 }
1349 1349
1350 properties->setCustomProperties(customProperties); 1350 properties->setCustomProperties(customProperties);
1351} 1351}
1352 1352
1353void ICalFormatImpl::readRecurrenceRule(struct icalrecurrencetype rrule,Incidence *incidence) 1353void ICalFormatImpl::readRecurrenceRule(struct icalrecurrencetype rrule,Incidence *incidence)
1354{ 1354{
1355// kdDebug(5800) << "Read recurrence for " << incidence->summary() << endl; 1355// kdDebug(5800) << "Read recurrence for " << incidence->summary() << endl;
1356 1356
1357 Recurrence *recur = incidence->recurrence(); 1357 Recurrence *recur = incidence->recurrence();
1358 recur->setCompatVersion(mCalendarVersion); 1358 recur->setCompatVersion(mCalendarVersion);
1359 recur->unsetRecurs(); 1359 recur->unsetRecurs();
1360 1360
1361 struct icalrecurrencetype r = rrule; 1361 struct icalrecurrencetype r = rrule;
1362 1362
1363 dumpIcalRecurrence(r); 1363 dumpIcalRecurrence(r);
1364 readRecurrence( r, recur, incidence); 1364 readRecurrence( r, recur, incidence);
1365} 1365}
1366 1366
1367void ICalFormatImpl::readRecurrence( const struct icalrecurrencetype &r, Recurrence* recur, Incidence *incidence) 1367void ICalFormatImpl::readRecurrence( const struct icalrecurrencetype &r, Recurrence* recur, Incidence *incidence)
1368{ 1368{
1369 int wkst; 1369 int wkst;
1370 int index = 0; 1370 int index = 0;
1371 short day = 0; 1371 short day = 0;
1372 QBitArray qba(7); 1372 QBitArray qba(7);
1373 int frequ = r.freq; 1373 int frequ = r.freq;
1374 int interv = r.interval; 1374 int interv = r.interval;
1375 // preprocessing for odd recurrence definitions 1375 // preprocessing for odd recurrence definitions
1376 1376
1377 if ( r.freq == ICAL_MONTHLY_RECURRENCE ) { 1377 if ( r.freq == ICAL_MONTHLY_RECURRENCE ) {
1378 if ( r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX) { 1378 if ( r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX) {
1379 interv = 12; 1379 interv = 12;
1380 } 1380 }
1381 } 1381 }
1382 if ( r.freq == ICAL_YEARLY_RECURRENCE ) { 1382 if ( r.freq == ICAL_YEARLY_RECURRENCE ) {
1383 if ( r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX && r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX ) { 1383 if ( r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX && r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX ) {
1384 frequ = ICAL_MONTHLY_RECURRENCE; 1384 frequ = ICAL_MONTHLY_RECURRENCE;
1385 interv = 12* r.interval; 1385 interv = 12* r.interval;
1386 } 1386 }
1387 } 1387 }
1388 1388
1389 switch (frequ) { 1389 switch (frequ) {
1390 case ICAL_MINUTELY_RECURRENCE: 1390 case ICAL_MINUTELY_RECURRENCE:
1391 if (!icaltime_is_null_time(r.until)) { 1391 if (!icaltime_is_null_time(r.until)) {
1392 recur->setMinutely(interv,readICalDateTime(r.until)); 1392 recur->setMinutely(interv,readICalDateTime(r.until));
1393 } else { 1393 } else {
1394 if (r.count == 0) 1394 if (r.count == 0)
1395 recur->setMinutely(interv,-1); 1395 recur->setMinutely(interv,-1);
1396 else 1396 else
1397 recur->setMinutely(interv,r.count); 1397 recur->setMinutely(interv,r.count);
1398 } 1398 }
1399 break; 1399 break;
1400 case ICAL_HOURLY_RECURRENCE: 1400 case ICAL_HOURLY_RECURRENCE:
1401 if (!icaltime_is_null_time(r.until)) { 1401 if (!icaltime_is_null_time(r.until)) {
1402 recur->setHourly(interv,readICalDateTime(r.until)); 1402 recur->setHourly(interv,readICalDateTime(r.until));
1403 } else { 1403 } else {
1404 if (r.count == 0) 1404 if (r.count == 0)
1405 recur->setHourly(interv,-1); 1405 recur->setHourly(interv,-1);
1406 else 1406 else
1407 recur->setHourly(interv,r.count); 1407 recur->setHourly(interv,r.count);
1408 } 1408 }
1409 break; 1409 break;
1410 case ICAL_DAILY_RECURRENCE: 1410 case ICAL_DAILY_RECURRENCE:
1411 if (!icaltime_is_null_time(r.until)) { 1411 if (!icaltime_is_null_time(r.until)) {
1412 recur->setDaily(interv,readICalDate(r.until)); 1412 recur->setDaily(interv,readICalDate(r.until));
1413 } else { 1413 } else {
1414 if (r.count == 0) 1414 if (r.count == 0)
1415 recur->setDaily(interv,-1); 1415 recur->setDaily(interv,-1);
1416 else 1416 else
1417 recur->setDaily(interv,r.count); 1417 recur->setDaily(interv,r.count);
1418 } 1418 }
1419 break; 1419 break;
1420 case ICAL_WEEKLY_RECURRENCE: 1420 case ICAL_WEEKLY_RECURRENCE:
1421 // kdDebug(5800) << "WEEKLY_RECURRENCE" << endl; 1421 // kdDebug(5800) << "WEEKLY_RECURRENCE" << endl;
1422 wkst = (r.week_start + 5)%7 + 1; 1422 wkst = (r.week_start + 5)%7 + 1;
1423 if (!icaltime_is_null_time(r.until)) { 1423 if (!icaltime_is_null_time(r.until)) {
1424 recur->setWeekly(interv,qba,readICalDate(r.until),wkst); 1424 recur->setWeekly(interv,qba,readICalDate(r.until),wkst);
1425 } else { 1425 } else {
1426 if (r.count == 0) 1426 if (r.count == 0)
1427 recur->setWeekly(interv,qba,-1,wkst); 1427 recur->setWeekly(interv,qba,-1,wkst);
1428 else 1428 else
1429 recur->setWeekly(interv,qba,r.count,wkst); 1429 recur->setWeekly(interv,qba,r.count,wkst);
1430 } 1430 }
1431 if ( r.by_day[0] == ICAL_RECURRENCE_ARRAY_MAX) { 1431 if ( r.by_day[0] == ICAL_RECURRENCE_ARRAY_MAX) {
1432 int wday = incidence->dtStart().date().dayOfWeek ()-1; 1432 int wday = incidence->dtStart().date().dayOfWeek ()-1;
1433 //qDebug("weekly error found "); 1433 //qDebug("weekly error found ");
1434 qba.setBit(wday); 1434 qba.setBit(wday);
1435 } else { 1435 } else {
1436 while((day = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { 1436 while((day = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) {
1437 // kdDebug(5800) << " " << day << endl; 1437 // kdDebug(5800) << " " << day << endl;
1438 qba.setBit((day+5)%7); // convert from Sunday=1 to Monday=0 1438 qba.setBit((day+5)%7); // convert from Sunday=1 to Monday=0
1439 } 1439 }
1440 } 1440 }
1441 break; 1441 break;
1442 case ICAL_MONTHLY_RECURRENCE: 1442 case ICAL_MONTHLY_RECURRENCE:
1443 1443
1444 if (r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { 1444 if (r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX) {
1445 if (!icaltime_is_null_time(r.until)) { 1445 if (!icaltime_is_null_time(r.until)) {
1446 recur->setMonthly(Recurrence::rMonthlyPos,interv, 1446 recur->setMonthly(Recurrence::rMonthlyPos,interv,
1447 readICalDate(r.until)); 1447 readICalDate(r.until));
1448 } else { 1448 } else {
1449 if (r.count == 0) 1449 if (r.count == 0)
1450 recur->setMonthly(Recurrence::rMonthlyPos,interv,-1); 1450 recur->setMonthly(Recurrence::rMonthlyPos,interv,-1);
1451 else 1451 else
1452 recur->setMonthly(Recurrence::rMonthlyPos,interv,r.count); 1452 recur->setMonthly(Recurrence::rMonthlyPos,interv,r.count);
1453 } 1453 }
1454 bool useSetPos = false; 1454 bool useSetPos = false;
1455 short pos = 0; 1455 short pos = 0;
1456 while((day = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { 1456 while((day = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) {
1457 // kdDebug(5800) << "----a " << index << ": " << day << endl; 1457 // kdDebug(5800) << "----a " << index << ": " << day << endl;
1458 pos = icalrecurrencetype_day_position(day); 1458 pos = icalrecurrencetype_day_position(day);
1459 if (pos) { 1459 if (pos) {
1460 day = icalrecurrencetype_day_day_of_week(day); 1460 day = icalrecurrencetype_day_day_of_week(day);
1461 QBitArray ba(7); // don't wipe qba 1461 QBitArray ba(7); // don't wipe qba
1462 ba.setBit((day+5)%7); // convert from Sunday=1 to Monday=0 1462 ba.setBit((day+5)%7); // convert from Sunday=1 to Monday=0
1463 recur->addMonthlyPos(pos,ba); 1463 recur->addMonthlyPos(pos,ba);
1464 } else { 1464 } else {
1465 qba.setBit((day+5)%7); // convert from Sunday=1 to Monday=0 1465 qba.setBit((day+5)%7); // convert from Sunday=1 to Monday=0
1466 useSetPos = true; 1466 useSetPos = true;
1467 } 1467 }
1468 } 1468 }
1469 if (useSetPos) { 1469 if (useSetPos) {
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 0684af2..708ee6b 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -1,475 +1,483 @@
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 <klocale.h> 22#include <klocale.h>
23#include <kdebug.h> 23#include <kdebug.h>
24 24
25#include "calformat.h" 25#include "calformat.h"
26 26
27#include "incidence.h" 27#include "incidence.h"
28#include "todo.h" 28#include "todo.h"
29 29
30using namespace KCal; 30using namespace KCal;
31 31
32Incidence::Incidence() : 32Incidence::Incidence() :
33 IncidenceBase(), 33 IncidenceBase(),
34 mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3) 34 mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3)
35{ 35{
36 mRecurrence = new Recurrence(this); 36 mRecurrence = new Recurrence(this);
37 mCancelled = false; 37 mCancelled = false;
38 recreate(); 38 recreate();
39 mHasStartDate = true; 39 mHasStartDate = true;
40 mAlarms.setAutoDelete(true); 40 mAlarms.setAutoDelete(true);
41 mAttachments.setAutoDelete(true); 41 mAttachments.setAutoDelete(true);
42 mHasRecurrenceID = false; 42 mHasRecurrenceID = false;
43} 43}
44 44
45Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) 45Incidence::Incidence( const Incidence &i ) : IncidenceBase( i )
46{ 46{
47// TODO: reenable attributes currently commented out. 47// TODO: reenable attributes currently commented out.
48 mRevision = i.mRevision; 48 mRevision = i.mRevision;
49 mCreated = i.mCreated; 49 mCreated = i.mCreated;
50 mDescription = i.mDescription; 50 mDescription = i.mDescription;
51 mSummary = i.mSummary; 51 mSummary = i.mSummary;
52 mCategories = i.mCategories; 52 mCategories = i.mCategories;
53// Incidence *mRelatedTo; Incidence *mRelatedTo; 53// Incidence *mRelatedTo; Incidence *mRelatedTo;
54 mRelatedTo = 0; 54 mRelatedTo = 0;
55 mRelatedToUid = i.mRelatedToUid; 55 mRelatedToUid = i.mRelatedToUid;
56// QPtrList<Incidence> mRelations; QPtrList<Incidence> mRelations; 56// QPtrList<Incidence> mRelations; QPtrList<Incidence> mRelations;
57 mExDates = i.mExDates; 57 mExDates = i.mExDates;
58 mAttachments = i.mAttachments; 58 mAttachments = i.mAttachments;
59 mResources = i.mResources; 59 mResources = i.mResources;
60 mSecrecy = i.mSecrecy; 60 mSecrecy = i.mSecrecy;
61 mPriority = i.mPriority; 61 mPriority = i.mPriority;
62 mLocation = i.mLocation; 62 mLocation = i.mLocation;
63 mCancelled = i.mCancelled; 63 mCancelled = i.mCancelled;
64 mHasStartDate = i.mHasStartDate; 64 mHasStartDate = i.mHasStartDate;
65 QPtrListIterator<Alarm> it( i.mAlarms ); 65 QPtrListIterator<Alarm> it( i.mAlarms );
66 const Alarm *a; 66 const Alarm *a;
67 while( (a = it.current()) ) { 67 while( (a = it.current()) ) {
68 Alarm *b = new Alarm( *a ); 68 Alarm *b = new Alarm( *a );
69 b->setParent( this ); 69 b->setParent( this );
70 mAlarms.append( b ); 70 mAlarms.append( b );
71 71
72 ++it; 72 ++it;
73 } 73 }
74 mAlarms.setAutoDelete(true); 74 mAlarms.setAutoDelete(true);
75 mHasRecurrenceID = i.mHasRecurrenceID; 75 mHasRecurrenceID = i.mHasRecurrenceID;
76 mRecurrenceID = i.mRecurrenceID; 76 mRecurrenceID = i.mRecurrenceID;
77 mRecurrence = new Recurrence( *(i.mRecurrence), this ); 77 mRecurrence = new Recurrence( *(i.mRecurrence), this );
78} 78}
79 79
80Incidence::~Incidence() 80Incidence::~Incidence()
81{ 81{
82 82
83 Incidence *ev; 83 Incidence *ev;
84 QPtrList<Incidence> Relations = relations(); 84 QPtrList<Incidence> Relations = relations();
85 for (ev=Relations.first();ev;ev=Relations.next()) { 85 for (ev=Relations.first();ev;ev=Relations.next()) {
86 if (ev->relatedTo() == this) ev->setRelatedTo(0); 86 if (ev->relatedTo() == this) ev->setRelatedTo(0);
87 } 87 }
88 if (relatedTo()) relatedTo()->removeRelation(this); 88 if (relatedTo()) relatedTo()->removeRelation(this);
89 delete mRecurrence; 89 delete mRecurrence;
90 90
91} 91}
92bool Incidence::hasRecurrenceID() const 92bool Incidence::hasRecurrenceID() const
93{ 93{
94 return mHasRecurrenceID; 94 return mHasRecurrenceID;
95} 95}
96 96
97void Incidence::setHasRecurrenceID( bool b ) 97void Incidence::setHasRecurrenceID( bool b )
98{ 98{
99 mHasRecurrenceID = b; 99 mHasRecurrenceID = b;
100} 100}
101 101
102void Incidence::setRecurrenceID(QDateTime d) 102void Incidence::setRecurrenceID(QDateTime d)
103{ 103{
104 mRecurrenceID = d; 104 mRecurrenceID = d;
105 mHasRecurrenceID = true; 105 mHasRecurrenceID = true;
106 updated(); 106 updated();
107} 107}
108QDateTime Incidence::recurrenceID () const 108QDateTime Incidence::recurrenceID () const
109{ 109{
110 return mRecurrenceID; 110 return mRecurrenceID;
111} 111}
112 112
113bool Incidence::cancelled() const 113bool Incidence::cancelled() const
114{ 114{
115 return mCancelled; 115 return mCancelled;
116} 116}
117void Incidence::setCancelled( bool b ) 117void Incidence::setCancelled( bool b )
118{ 118{
119 mCancelled = b; 119 mCancelled = b;
120 updated(); 120 updated();
121} 121}
122bool Incidence::hasStartDate() const 122bool Incidence::hasStartDate() const
123{ 123{
124 return mHasStartDate; 124 return mHasStartDate;
125} 125}
126 126
127void Incidence::setHasStartDate(bool f) 127void Incidence::setHasStartDate(bool f)
128{ 128{
129 if (mReadOnly) return; 129 if (mReadOnly) return;
130 mHasStartDate = f; 130 mHasStartDate = f;
131 updated(); 131 updated();
132} 132}
133 133
134// A string comparison that considers that null and empty are the same 134// A string comparison that considers that null and empty are the same
135static bool stringCompare( const QString& s1, const QString& s2 ) 135static bool stringCompare( const QString& s1, const QString& s2 )
136{ 136{
137 if ( s1.isEmpty() && s2.isEmpty() ) 137 if ( s1.isEmpty() && s2.isEmpty() )
138 return true; 138 return true;
139 return s1 == s2; 139 return s1 == s2;
140} 140}
141 141
142bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) 142bool KCal::operator==( const Incidence& i1, const Incidence& i2 )
143{ 143{
144 144
145 if( i1.alarms().count() != i2.alarms().count() ) { 145 if( i1.alarms().count() != i2.alarms().count() ) {
146 return false; // no need to check further 146 return false; // no need to check further
147 } 147 }
148 if ( i1.alarms().count() > 0 ) { 148 if ( i1.alarms().count() > 0 ) {
149 if ( !( *(i1.alarms().first()) == *(i2.alarms().first())) ) 149 if ( !( *(i1.alarms().first()) == *(i2.alarms().first())) )
150 { 150 {
151 qDebug("alarm not equal "); 151 qDebug("alarm not equal ");
152 return false; 152 return false;
153 } 153 }
154 } 154 }
155#if 0 155#if 0
156 QPtrListIterator<Alarm> a1( i1.alarms() ); 156 QPtrListIterator<Alarm> a1( i1.alarms() );
157 QPtrListIterator<Alarm> a2( i2.alarms() ); 157 QPtrListIterator<Alarm> a2( i2.alarms() );
158 for( ; a1.current() && a2.current(); ++a1, ++a2 ) { 158 for( ; a1.current() && a2.current(); ++a1, ++a2 ) {
159 if( *a1.current() == *a2.current() ) { 159 if( *a1.current() == *a2.current() ) {
160 continue; 160 continue;
161 } 161 }
162 else { 162 else {
163 return false; 163 return false;
164 } 164 }
165 } 165 }
166#endif 166#endif
167 167
168 if ( i1.hasRecurrenceID() == i2.hasRecurrenceID() ) { 168 if ( i1.hasRecurrenceID() == i2.hasRecurrenceID() ) {
169 if ( i1.hasRecurrenceID() ) { 169 if ( i1.hasRecurrenceID() ) {
170 if ( i1.recurrenceID() != i2.recurrenceID() ) 170 if ( i1.recurrenceID() != i2.recurrenceID() )
171 return false; 171 return false;
172 } 172 }
173 173
174 } else { 174 } else {
175 return false; 175 return false;
176 } 176 }
177 177
178 if ( ! operator==( (const IncidenceBase&)i1, (const IncidenceBase&)i2 ) ) 178 if ( ! operator==( (const IncidenceBase&)i1, (const IncidenceBase&)i2 ) )
179 return false; 179 return false;
180 if ( i1.hasStartDate() == i2.hasStartDate() ) { 180 if ( i1.hasStartDate() == i2.hasStartDate() ) {
181 if ( i1.hasStartDate() ) { 181 if ( i1.hasStartDate() ) {
182 if ( i1.dtStart() != i2.dtStart() ) 182 if ( i1.dtStart() != i2.dtStart() )
183 return false; 183 return false;
184 } 184 }
185 } else { 185 } else {
186 return false; 186 return false;
187 } 187 }
188 if (!( *i1.recurrence() == *i2.recurrence()) ) { 188 if (!( *i1.recurrence() == *i2.recurrence()) ) {
189 qDebug("recurrence is NOT equal "); 189 qDebug("recurrence is NOT equal ");
190 return false; 190 return false;
191 } 191 }
192 return 192 return
193 // i1.created() == i2.created() && 193 // i1.created() == i2.created() &&
194 stringCompare( i1.description(), i2.description() ) && 194 stringCompare( i1.description(), i2.description() ) &&
195 stringCompare( i1.summary(), i2.summary() ) && 195 stringCompare( i1.summary(), i2.summary() ) &&
196 i1.categories() == i2.categories() && 196 i1.categories() == i2.categories() &&
197 // no need to compare mRelatedTo 197 // no need to compare mRelatedTo
198 stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && 198 stringCompare( i1.relatedToUid(), i2.relatedToUid() ) &&
199 // i1.relations() == i2.relations() && 199 // i1.relations() == i2.relations() &&
200 i1.exDates() == i2.exDates() && 200 i1.exDates() == i2.exDates() &&
201 i1.attachments() == i2.attachments() && 201 i1.attachments() == i2.attachments() &&
202 i1.resources() == i2.resources() && 202 i1.resources() == i2.resources() &&
203 i1.secrecy() == i2.secrecy() && 203 i1.secrecy() == i2.secrecy() &&
204 i1.priority() == i2.priority() && 204 i1.priority() == i2.priority() &&
205 i1.cancelled() == i2.cancelled() && 205 i1.cancelled() == i2.cancelled() &&
206 stringCompare( i1.location(), i2.location() ); 206 stringCompare( i1.location(), i2.location() );
207} 207}
208 208
209Incidence* Incidence::recreateCloneException( QDate d ) 209Incidence* Incidence::recreateCloneException( QDate d )
210{ 210{
211 Incidence* newInc = clone(); 211 Incidence* newInc = clone();
212 newInc->recreate(); 212 newInc->recreate();
213 if ( doesRecur() ) { 213 if ( doesRecur() ) {
214 addExDate( d ); 214 addExDate( d );
215 newInc->recurrence()->unsetRecurs(); 215 newInc->recurrence()->unsetRecurs();
216 int len = dtStart().secsTo( ((Event*)this)->dtEnd()); 216 if ( type() == "Event") {
217 QTime tim = dtStart().time(); 217 int len = dtStart().secsTo( ((Event*)this)->dtEnd());
218 newInc->setDtStart( QDateTime(d, tim) ); 218 QTime tim = dtStart().time();
219 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); 219 newInc->setDtStart( QDateTime(d, tim) );
220 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) );
221 } else {
222 int len = dtStart().secsTo( ((Todo*)this)->dtDue());
223 QTime tim = ((Todo*)this)->dtDue().time();
224 ((Todo*)newInc)->setDtDue( QDateTime(d, tim) );
225 ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) );
226 ((Todo*)this)->setRecurDates();
227 }
220 } 228 }
221 return newInc; 229 return newInc;
222} 230}
223 231
224void Incidence::recreate() 232void Incidence::recreate()
225{ 233{
226 setCreated(QDateTime::currentDateTime()); 234 setCreated(QDateTime::currentDateTime());
227 235
228 setUid(CalFormat::createUniqueId()); 236 setUid(CalFormat::createUniqueId());
229 237
230 setRevision(0); 238 setRevision(0);
231 setIDStr( ":" ); 239 setIDStr( ":" );
232 setLastModified(QDateTime::currentDateTime()); 240 setLastModified(QDateTime::currentDateTime());
233} 241}
234 242
235void Incidence::setReadOnly( bool readOnly ) 243void Incidence::setReadOnly( bool readOnly )
236{ 244{
237 IncidenceBase::setReadOnly( readOnly ); 245 IncidenceBase::setReadOnly( readOnly );
238 recurrence()->setRecurReadOnly( readOnly); 246 recurrence()->setRecurReadOnly( readOnly);
239} 247}
240 248
241void Incidence::setCreated(QDateTime created) 249void Incidence::setCreated(QDateTime created)
242{ 250{
243 if (mReadOnly) return; 251 if (mReadOnly) return;
244 mCreated = getEvenTime(created); 252 mCreated = getEvenTime(created);
245} 253}
246 254
247QDateTime Incidence::created() const 255QDateTime Incidence::created() const
248{ 256{
249 return mCreated; 257 return mCreated;
250} 258}
251 259
252void Incidence::setRevision(int rev) 260void Incidence::setRevision(int rev)
253{ 261{
254 if (mReadOnly) return; 262 if (mReadOnly) return;
255 mRevision = rev; 263 mRevision = rev;
256 264
257 updated(); 265 updated();
258} 266}
259 267
260int Incidence::revision() const 268int Incidence::revision() const
261{ 269{
262 return mRevision; 270 return mRevision;
263} 271}
264 272
265void Incidence::setDtStart(const QDateTime &dtStart) 273void Incidence::setDtStart(const QDateTime &dtStart)
266{ 274{
267 275
268 QDateTime dt = getEvenTime(dtStart); 276 QDateTime dt = getEvenTime(dtStart);
269 recurrence()->setRecurStart( dt); 277 recurrence()->setRecurStart( dt);
270 IncidenceBase::setDtStart( dt ); 278 IncidenceBase::setDtStart( dt );
271} 279}
272 280
273void Incidence::setDescription(const QString &description) 281void Incidence::setDescription(const QString &description)
274{ 282{
275 if (mReadOnly) return; 283 if (mReadOnly) return;
276 mDescription = description; 284 mDescription = description;
277 updated(); 285 updated();
278} 286}
279 287
280QString Incidence::description() const 288QString Incidence::description() const
281{ 289{
282 return mDescription; 290 return mDescription;
283} 291}
284 292
285 293
286void Incidence::setSummary(const QString &summary) 294void Incidence::setSummary(const QString &summary)
287{ 295{
288 if (mReadOnly) return; 296 if (mReadOnly) return;
289 mSummary = summary; 297 mSummary = summary;
290 updated(); 298 updated();
291} 299}
292 300
293QString Incidence::summary() const 301QString Incidence::summary() const
294{ 302{
295 return mSummary; 303 return mSummary;
296} 304}
297 305
298void Incidence::setCategories(const QStringList &categories) 306void Incidence::setCategories(const QStringList &categories)
299{ 307{
300 if (mReadOnly) return; 308 if (mReadOnly) return;
301 mCategories = categories; 309 mCategories = categories;
302 updated(); 310 updated();
303} 311}
304 312
305// TODO: remove setCategories(QString) function 313// TODO: remove setCategories(QString) function
306void Incidence::setCategories(const QString &catStr) 314void Incidence::setCategories(const QString &catStr)
307{ 315{
308 if (mReadOnly) return; 316 if (mReadOnly) return;
309 mCategories.clear(); 317 mCategories.clear();
310 318
311 if (catStr.isEmpty()) return; 319 if (catStr.isEmpty()) return;
312 320
313 mCategories = QStringList::split(",",catStr); 321 mCategories = QStringList::split(",",catStr);
314 322
315 QStringList::Iterator it; 323 QStringList::Iterator it;
316 for(it = mCategories.begin();it != mCategories.end(); ++it) { 324 for(it = mCategories.begin();it != mCategories.end(); ++it) {
317 *it = (*it).stripWhiteSpace(); 325 *it = (*it).stripWhiteSpace();
318 } 326 }
319 327
320 updated(); 328 updated();
321} 329}
322 330
323QStringList Incidence::categories() const 331QStringList Incidence::categories() const
324{ 332{
325 return mCategories; 333 return mCategories;
326} 334}
327 335
328QString Incidence::categoriesStr() 336QString Incidence::categoriesStr()
329{ 337{
330 return mCategories.join(","); 338 return mCategories.join(",");
331} 339}
332 340
333void Incidence::setRelatedToUid(const QString &relatedToUid) 341void Incidence::setRelatedToUid(const QString &relatedToUid)
334{ 342{
335 if (mReadOnly) return; 343 if (mReadOnly) return;
336 mRelatedToUid = relatedToUid; 344 mRelatedToUid = relatedToUid;
337} 345}
338 346
339QString Incidence::relatedToUid() const 347QString Incidence::relatedToUid() const
340{ 348{
341 return mRelatedToUid; 349 return mRelatedToUid;
342} 350}
343 351
344void Incidence::setRelatedTo(Incidence *relatedTo) 352void Incidence::setRelatedTo(Incidence *relatedTo)
345{ 353{
346 //qDebug("Incidence::setRelatedTo %d ", relatedTo); 354 //qDebug("Incidence::setRelatedTo %d ", relatedTo);
347 //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); 355 //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() );
348 if (mReadOnly || mRelatedTo == relatedTo) return; 356 if (mReadOnly || mRelatedTo == relatedTo) return;
349 if(mRelatedTo) { 357 if(mRelatedTo) {
350 // updated(); 358 // updated();
351 mRelatedTo->removeRelation(this); 359 mRelatedTo->removeRelation(this);
352 } 360 }
353 mRelatedTo = relatedTo; 361 mRelatedTo = relatedTo;
354 if (mRelatedTo) mRelatedTo->addRelation(this); 362 if (mRelatedTo) mRelatedTo->addRelation(this);
355} 363}
356 364
357Incidence *Incidence::relatedTo() const 365Incidence *Incidence::relatedTo() const
358{ 366{
359 return mRelatedTo; 367 return mRelatedTo;
360} 368}
361 369
362QPtrList<Incidence> Incidence::relations() const 370QPtrList<Incidence> Incidence::relations() const
363{ 371{
364 return mRelations; 372 return mRelations;
365} 373}
366 374
367void Incidence::addRelation(Incidence *event) 375void Incidence::addRelation(Incidence *event)
368{ 376{
369 if( mRelations.findRef( event ) == -1 ) { 377 if( mRelations.findRef( event ) == -1 ) {
370 mRelations.append(event); 378 mRelations.append(event);
371 //updated(); 379 //updated();
372 } 380 }
373} 381}
374 382
375void Incidence::removeRelation(Incidence *event) 383void Incidence::removeRelation(Incidence *event)
376{ 384{
377 385
378 mRelations.removeRef(event); 386 mRelations.removeRef(event);
379 387
380// if (event->getRelatedTo() == this) event->setRelatedTo(0); 388// if (event->getRelatedTo() == this) event->setRelatedTo(0);
381} 389}
382 390
383bool Incidence::recursOn(const QDate &qd) const 391bool Incidence::recursOn(const QDate &qd) const
384{ 392{
385 if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; 393 if (recurrence()->recursOnPure(qd) && !isException(qd)) return true;
386 else return false; 394 else return false;
387} 395}
388 396
389void Incidence::setExDates(const DateList &exDates) 397void Incidence::setExDates(const DateList &exDates)
390{ 398{
391 if (mReadOnly) return; 399 if (mReadOnly) return;
392 mExDates = exDates; 400 mExDates = exDates;
393 401
394 recurrence()->setRecurExDatesCount(mExDates.count()); 402 recurrence()->setRecurExDatesCount(mExDates.count());
395 403
396 updated(); 404 updated();
397} 405}
398 406
399void Incidence::addExDate(const QDate &date) 407void Incidence::addExDate(const QDate &date)
400{ 408{
401 if (mReadOnly) return; 409 if (mReadOnly) return;
402 mExDates.append(date); 410 mExDates.append(date);
403 411
404 recurrence()->setRecurExDatesCount(mExDates.count()); 412 recurrence()->setRecurExDatesCount(mExDates.count());
405 413
406 updated(); 414 updated();
407} 415}
408 416
409DateList Incidence::exDates() const 417DateList Incidence::exDates() const
410{ 418{
411 return mExDates; 419 return mExDates;
412} 420}
413 421
414bool Incidence::isException(const QDate &date) const 422bool Incidence::isException(const QDate &date) const
415{ 423{
416 DateList::ConstIterator it; 424 DateList::ConstIterator it;
417 for( it = mExDates.begin(); it != mExDates.end(); ++it ) { 425 for( it = mExDates.begin(); it != mExDates.end(); ++it ) {
418 if ( (*it) == date ) { 426 if ( (*it) == date ) {
419 return true; 427 return true;
420 } 428 }
421 } 429 }
422 430
423 return false; 431 return false;
424} 432}
425 433
426void Incidence::addAttachment(Attachment *attachment) 434void Incidence::addAttachment(Attachment *attachment)
427{ 435{
428 if (mReadOnly || !attachment) return; 436 if (mReadOnly || !attachment) return;
429 mAttachments.append(attachment); 437 mAttachments.append(attachment);
430 updated(); 438 updated();
431} 439}
432 440
433void Incidence::deleteAttachment(Attachment *attachment) 441void Incidence::deleteAttachment(Attachment *attachment)
434{ 442{
435 mAttachments.removeRef(attachment); 443 mAttachments.removeRef(attachment);
436} 444}
437 445
438void Incidence::deleteAttachments(const QString& mime) 446void Incidence::deleteAttachments(const QString& mime)
439{ 447{
440 Attachment *at = mAttachments.first(); 448 Attachment *at = mAttachments.first();
441 while (at) { 449 while (at) {
442 if (at->mimeType() == mime) 450 if (at->mimeType() == mime)
443 mAttachments.remove(); 451 mAttachments.remove();
444 else 452 else
445 at = mAttachments.next(); 453 at = mAttachments.next();
446 } 454 }
447} 455}
448 456
449QPtrList<Attachment> Incidence::attachments() const 457QPtrList<Attachment> Incidence::attachments() const
450{ 458{
451 return mAttachments; 459 return mAttachments;
452} 460}
453 461
454QPtrList<Attachment> Incidence::attachments(const QString& mime) const 462QPtrList<Attachment> Incidence::attachments(const QString& mime) const
455{ 463{
456 QPtrList<Attachment> attachments; 464 QPtrList<Attachment> attachments;
457 QPtrListIterator<Attachment> it( mAttachments ); 465 QPtrListIterator<Attachment> it( mAttachments );
458 Attachment *at; 466 Attachment *at;
459 while ( (at = it.current()) ) { 467 while ( (at = it.current()) ) {
460 if (at->mimeType() == mime) 468 if (at->mimeType() == mime)
461 attachments.append(at); 469 attachments.append(at);
462 ++it; 470 ++it;
463 } 471 }
464 472
465 return attachments; 473 return attachments;
466} 474}
467 475
468void Incidence::setResources(const QStringList &resources) 476void Incidence::setResources(const QStringList &resources)
469{ 477{
470 if (mReadOnly) return; 478 if (mReadOnly) return;
471 mResources = resources; 479 mResources = resources;
472 updated(); 480 updated();
473} 481}
474 482
475QStringList Incidence::resources() const 483QStringList Incidence::resources() const
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index 0d9c3f4..cc3088a 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -1,344 +1,356 @@
1#include "kincidenceformatter.h" 1#include "kincidenceformatter.h"
2#include <kstaticdeleter.h> 2#include <kstaticdeleter.h>
3#include <kglobal.h> 3#include <kglobal.h>
4#include <klocale.h> 4#include <klocale.h>
5#ifdef DEKTOP_VERSION 5#ifdef DEKTOP_VERSION
6#include <kabc/stdaddressbook.h> 6#include <kabc/stdaddressbook.h>
7#define size count 7#define size count
8#endif 8#endif
9 9
10KIncidenceFormatter* KIncidenceFormatter::mInstance = 0; 10KIncidenceFormatter* KIncidenceFormatter::mInstance = 0;
11static KStaticDeleter<KIncidenceFormatter> insd; 11static KStaticDeleter<KIncidenceFormatter> insd;
12 12
13QString KIncidenceFormatter::getFormattedText( Incidence * inc ) 13QString KIncidenceFormatter::getFormattedText( Incidence * inc )
14{ 14{
15// #ifndef QT_NO_INPUTDIALOG 15// #ifndef QT_NO_INPUTDIALOG
16// return QInputDialog::getItem( caption, label, items, current, editable ); 16// return QInputDialog::getItem( caption, label, items, current, editable );
17// #else 17// #else
18// return QString::null; 18// return QString::null;
19// #endif 19// #endif
20 mText = ""; 20 mText = "";
21 if ( inc->type() == "Event" ) 21 if ( inc->type() == "Event" )
22 setEvent((Event *) inc ); 22 setEvent((Event *) inc );
23 else if ( inc->type() == "Todo" ) 23 else if ( inc->type() == "Todo" )
24 setTodo((Todo *) inc ); 24 setTodo((Todo *) inc );
25 return mText; 25 return mText;
26} 26}
27 27
28KIncidenceFormatter* KIncidenceFormatter::instance() 28KIncidenceFormatter* KIncidenceFormatter::instance()
29{ 29{
30 if (!mInstance) { 30 if (!mInstance) {
31 mInstance = insd.setObject(new KIncidenceFormatter()); 31 mInstance = insd.setObject(new KIncidenceFormatter());
32 } 32 }
33 return mInstance; 33 return mInstance;
34} 34}
35KIncidenceFormatter::~KIncidenceFormatter() 35KIncidenceFormatter::~KIncidenceFormatter()
36{ 36{
37 if (mInstance == this) 37 if (mInstance == this)
38 mInstance = insd.setObject(0); 38 mInstance = insd.setObject(0);
39 //qDebug("KIncidenceFormatter::~KIncidenceFormatter "); 39 //qDebug("KIncidenceFormatter::~KIncidenceFormatter ");
40} 40}
41KIncidenceFormatter::KIncidenceFormatter() 41KIncidenceFormatter::KIncidenceFormatter()
42{ 42{
43 mColorMode = 0; 43 mColorMode = 0;
44} 44}
45void KIncidenceFormatter::setEvent(Event *event) 45void KIncidenceFormatter::setEvent(Event *event)
46{ 46{
47 int mode = 0; 47 int mode = 0;
48 mCurrentIncidence = event; 48 mCurrentIncidence = event;
49 bool shortDate = true; 49 bool shortDate = true;
50 if ( mode == 0 ) { 50 if ( mode == 0 ) {
51 addTag("h3",event->summary()); 51 addTag("h3",event->summary());
52 } 52 }
53 else { 53 else {
54 if ( mColorMode == 1 ) { 54 if ( mColorMode == 1 ) {
55 mText +="<font color=\"#00A000\">"; 55 mText +="<font color=\"#00A000\">";
56 } 56 }
57 if ( mColorMode == 2 ) { 57 if ( mColorMode == 2 ) {
58 mText +="<font color=\"#C00000\">"; 58 mText +="<font color=\"#C00000\">";
59 } 59 }
60 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 60 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
61 if ( mode == 1 ) { 61 if ( mode == 1 ) {
62 addTag("h2",i18n( "Local: " ) +event->summary()); 62 addTag("h2",i18n( "Local: " ) +event->summary());
63 } else { 63 } else {
64 addTag("h2",i18n( "Remote: " ) +event->summary()); 64 addTag("h2",i18n( "Remote: " ) +event->summary());
65 } 65 }
66 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 66 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
67 if ( mColorMode ) 67 if ( mColorMode )
68 mText += "</font>"; 68 mText += "</font>";
69 } 69 }
70 if (event->cancelled ()) { 70 if (event->cancelled ()) {
71 mText +="<font color=\"#B00000\">"; 71 mText +="<font color=\"#B00000\">";
72 addTag("i",i18n("This event has been cancelled!")); 72 addTag("i",i18n("This event has been cancelled!"));
73 mText.append("<br>"); 73 mText.append("<br>");
74 mText += "</font>"; 74 mText += "</font>";
75 } 75 }
76 if (!event->location().isEmpty()) { 76 if (!event->location().isEmpty()) {
77 addTag("b",i18n("Location: ")); 77 addTag("b",i18n("Location: "));
78 mText.append(event->location()+"<br>"); 78 mText.append(event->location()+"<br>");
79 } 79 }
80 if (event->doesFloat()) { 80 if (event->doesFloat()) {
81 if (event->isMultiDay()) { 81 if (event->isMultiDay()) {
82 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") 82 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>")
83 .arg(event->dtStartDateStr(shortDate)) 83 .arg(event->dtStartDateStr(shortDate))
84 .arg(event->dtEndDateStr(shortDate))); 84 .arg(event->dtEndDateStr(shortDate)));
85 } else { 85 } else {
86 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); 86 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate )));
87 } 87 }
88 } else { 88 } else {
89 if (event->isMultiDay()) { 89 if (event->isMultiDay()) {
90 mText.append(i18n("<p><b>From:</b> %1</p> ") 90 mText.append(i18n("<p><b>From:</b> %1</p> ")
91 .arg(event->dtStartStr( shortDate))); 91 .arg(event->dtStartStr( shortDate)));
92 mText.append(i18n("<p><b>To:</b> %1</p>") 92 mText.append(i18n("<p><b>To:</b> %1</p>")
93 .arg(event->dtEndStr(shortDate))); 93 .arg(event->dtEndStr(shortDate)));
94 } else { 94 } else {
95 mText.append(i18n("<p><b>On:</b> %1</p> ") 95 mText.append(i18n("<p><b>On:</b> %1</p> ")
96 .arg(event->dtStartDateStr( shortDate ))); 96 .arg(event->dtStartDateStr( shortDate )));
97 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") 97 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>")
98 .arg(event->dtStartTimeStr()) 98 .arg(event->dtStartTimeStr())
99 .arg(event->dtEndTimeStr())); 99 .arg(event->dtEndTimeStr()));
100 } 100 }
101 } 101 }
102 102
103 if (event->recurrence()->doesRecur()) { 103 if (event->recurrence()->doesRecur()) {
104 104
105 QString recurText = event->recurrence()->recurrenceText(); 105 QString recurText = event->recurrence()->recurrenceText();
106 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); 106 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
107 107
108 bool ok; 108 bool ok;
109 QDate start = QDate::currentDate(); 109 QDate start = QDate::currentDate();
110 QDateTime next; 110 QDateTime next;
111 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); 111 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
112 if ( ok ) { 112 if ( ok ) {
113 addTag("p",i18n("<b>Next recurrence is on:</b>") ); 113 addTag("p",i18n("<b>Next recurrence is on:</b>") );
114 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); 114 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
115 115
116 } else { 116 } else {
117 bool last; 117 bool last;
118 QDate nextd; 118 QDate nextd;
119 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); 119 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
120 if ( last ) { 120 if ( last ) {
121 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 121 addTag("p",i18n("<b>Last recurrence was on:</b>") );
122 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); 122 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
123 } 123 }
124 } 124 }
125 } 125 }
126 126
127 127
128 if (event->isAlarmEnabled()) { 128 if (event->isAlarmEnabled()) {
129 Alarm *alarm =event->alarms().first() ; 129 Alarm *alarm =event->alarms().first() ;
130 QDateTime t = alarm->time(); 130 QDateTime t = alarm->time();
131 int min = t.secsTo( event->dtStart() )/60; 131 int min = t.secsTo( event->dtStart() )/60;
132 QString s =i18n("(%1 min before)").arg( min ); 132 QString s =i18n("(%1 min before)").arg( min );
133 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate )); 133 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate ));
134 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 134 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
135 //addTag("p",s); 135 //addTag("p",s);
136 } 136 }
137 137
138 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); 138 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
139 // mText.append(event->secrecyStr()+"<br>"); 139 // mText.append(event->secrecyStr()+"<br>");
140 formatCategories(event); 140 formatCategories(event);
141 if (!event->description().isEmpty()) { 141 if (!event->description().isEmpty()) {
142 addTag("p",i18n("<b>Details: </b>")); 142 addTag("p",i18n("<b>Details: </b>"));
143 addTag("p",event->description()); 143 addTag("p",event->description());
144 } 144 }
145 145
146 146
147 formatReadOnly(event); 147 formatReadOnly(event);
148 formatAttendees(event); 148 formatAttendees(event);
149 149
150 150
151} 151}
152 152
153void KIncidenceFormatter::setTodo(Todo *event ) 153void KIncidenceFormatter::setTodo(Todo *event )
154{ 154{
155 int mode = 0; 155 int mode = 0;
156 mCurrentIncidence = event; 156 mCurrentIncidence = event;
157 bool shortDate = true; 157 bool shortDate = true;
158 if (mode == 0 ) 158 if (mode == 0 )
159 addTag("h3",event->summary()); 159 addTag("h3",event->summary());
160 else { 160 else {
161 if ( mColorMode == 1 ) { 161 if ( mColorMode == 1 ) {
162 mText +="<font color=\"#00A000\">"; 162 mText +="<font color=\"#00A000\">";
163 } 163 }
164 if ( mColorMode == 2 ) { 164 if ( mColorMode == 2 ) {
165 mText +="<font color=\"#B00000\">"; 165 mText +="<font color=\"#B00000\">";
166 } 166 }
167 if ( mode == 1 ) { 167 if ( mode == 1 ) {
168 addTag("h2",i18n( "Local: " ) +event->summary()); 168 addTag("h2",i18n( "Local: " ) +event->summary());
169 } else { 169 } else {
170 addTag("h2",i18n( "Remote: " ) +event->summary()); 170 addTag("h2",i18n( "Remote: " ) +event->summary());
171 } 171 }
172 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 172 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
173 if ( mColorMode ) 173 if ( mColorMode )
174 mText += "</font>"; 174 mText += "</font>";
175 } 175 }
176 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { 176 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
177 mText +="<font color=\"#B00000\">"; 177 mText +="<font color=\"#B00000\">";
178 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) ); 178 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) );
179 mText += "</font>"; 179 mText += "</font>";
180 } else { 180 } else {
181 mText.append(i18n("<p><i>%1 % completed</i></p>") 181 mText.append(i18n("<p><i>%1 % completed</i></p>")
182 .arg(event->percentComplete())); 182 .arg(event->percentComplete()));
183 } 183 }
184 if (event->cancelled ()) { 184 if (event->cancelled ()) {
185 mText +="<font color=\"#B00000\">"; 185 mText +="<font color=\"#B00000\">";
186 addTag("i",i18n("This todo has been cancelled!")); 186 addTag("i",i18n("This todo has been cancelled!"));
187 mText.append("<br>"); 187 mText.append("<br>");
188 mText += "</font>"; 188 mText += "</font>";
189 } 189 }
190 190
191 if (!event->location().isEmpty()) { 191 if (!event->location().isEmpty()) {
192 addTag("b",i18n("Location: ")); 192 addTag("b",i18n("Location: "));
193 mText.append(event->location()+"<br>"); 193 mText.append(event->location()+"<br>");
194 } 194 }
195
196 if (event->recurrence()->doesRecur()) {
197
198 QString recurText = event->recurrence()->recurrenceText();
199 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
200 }
201
202 if (event->hasStartDate()) {
203 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate)));
204 }
205
206
195 if (event->hasDueDate()) { 207 if (event->hasDueDate()) {
196 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); 208 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate)));
197 } 209 }
198 mText.append(i18n("<p><b>Priority:</b> %2</p>") 210 mText.append(i18n("<p><b>Priority:</b> %2</p>")
199 .arg(QString::number(event->priority()))); 211 .arg(QString::number(event->priority())));
200 212
201 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); 213 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
202 formatCategories(event); 214 formatCategories(event);
203 if (!event->description().isEmpty()) { 215 if (!event->description().isEmpty()) {
204 addTag("p",i18n("<b>Details: </b>")); 216 addTag("p",i18n("<b>Details: </b>"));
205 addTag("p",event->description()); 217 addTag("p",event->description());
206 } 218 }
207 219
208 220
209 221
210 formatReadOnly(event); 222 formatReadOnly(event);
211 formatAttendees(event); 223 formatAttendees(event);
212 224
213} 225}
214 226
215void KIncidenceFormatter::setJournal(Journal* ) 227void KIncidenceFormatter::setJournal(Journal* )
216{ 228{
217 229
218} 230}
219 231
220void KIncidenceFormatter::formatCategories(Incidence *event) 232void KIncidenceFormatter::formatCategories(Incidence *event)
221{ 233{
222 if (!event->categoriesStr().isEmpty()) { 234 if (!event->categoriesStr().isEmpty()) {
223 addTag("p",i18n("<b>Categories: </b>")+event->categoriesStr() ); 235 addTag("p",i18n("<b>Categories: </b>")+event->categoriesStr() );
224 //mText.append(event->categoriesStr()); 236 //mText.append(event->categoriesStr());
225 } 237 }
226} 238}
227void KIncidenceFormatter::addTag(const QString & tag,const QString & text) 239void KIncidenceFormatter::addTag(const QString & tag,const QString & text)
228{ 240{
229 int number=text.contains("\n"); 241 int number=text.contains("\n");
230 QString str = "<" + tag + ">"; 242 QString str = "<" + tag + ">";
231 QString tmpText=text; 243 QString tmpText=text;
232 QString tmpStr=str; 244 QString tmpStr=str;
233 if(number !=-1) 245 if(number !=-1)
234 { 246 {
235 if (number > 0) { 247 if (number > 0) {
236 int pos=0; 248 int pos=0;
237 QString tmp; 249 QString tmp;
238 for(int i=0;i<=number;i++) { 250 for(int i=0;i<=number;i++) {
239 pos=tmpText.find("\n"); 251 pos=tmpText.find("\n");
240 tmp=tmpText.left(pos); 252 tmp=tmpText.left(pos);
241 tmpText=tmpText.right(tmpText.length()-pos-1); 253 tmpText=tmpText.right(tmpText.length()-pos-1);
242 tmpStr+=tmp+"<br>"; 254 tmpStr+=tmp+"<br>";
243 } 255 }
244 } 256 }
245 else tmpStr += tmpText; 257 else tmpStr += tmpText;
246 tmpStr+="</" + tag + ">"; 258 tmpStr+="</" + tag + ">";
247 mText.append(tmpStr); 259 mText.append(tmpStr);
248 } 260 }
249 else 261 else
250 { 262 {
251 str += text + "</" + tag + ">"; 263 str += text + "</" + tag + ">";
252 mText.append(str); 264 mText.append(str);
253 } 265 }
254} 266}
255 267
256void KIncidenceFormatter::formatAttendees(Incidence *event) 268void KIncidenceFormatter::formatAttendees(Incidence *event)
257{ 269{
258 QPtrList<Attendee> attendees = event->attendees(); 270 QPtrList<Attendee> attendees = event->attendees();
259 if (attendees.count()) { 271 if (attendees.count()) {
260 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); 272 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
261 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); 273 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small);
262 addTag("h3",i18n("Organizer")); 274 addTag("h3",i18n("Organizer"));
263 mText.append("<ul><li>"); 275 mText.append("<ul><li>");
264#if 0 276#if 0
265 //ndef KORG_NOKABC 277 //ndef KORG_NOKABC
266 278
267 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 279 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
268 KABC::Addressee::List addressList; 280 KABC::Addressee::List addressList;
269 addressList = add_book->findByEmail(event->organizer()); 281 addressList = add_book->findByEmail(event->organizer());
270 KABC::Addressee o = addressList.first(); 282 KABC::Addressee o = addressList.first();
271 if (!o.isEmpty() && addressList.size()<2) { 283 if (!o.isEmpty() && addressList.size()<2) {
272 mText += "<a href=\"uid:" + o.uid() + "\">"; 284 mText += "<a href=\"uid:" + o.uid() + "\">";
273 mText += o.formattedName(); 285 mText += o.formattedName();
274 mText += "</a>\n"; 286 mText += "</a>\n";
275 } else { 287 } else {
276 mText.append(event->organizer()); 288 mText.append(event->organizer());
277 } 289 }
278#else 290#else
279 mText.append(event->organizer()); 291 mText.append(event->organizer());
280#endif 292#endif
281 if (iconPath) { 293 if (iconPath) {
282 mText += " <a href=\"mailto:" + event->organizer() + "\">"; 294 mText += " <a href=\"mailto:" + event->organizer() + "\">";
283 mText += "<IMG src=\"" + iconPath + "\">"; 295 mText += "<IMG src=\"" + iconPath + "\">";
284 mText += "</a>\n"; 296 mText += "</a>\n";
285 } 297 }
286 mText.append("</li></ul>"); 298 mText.append("</li></ul>");
287 299
288 addTag("h3",i18n("Attendees")); 300 addTag("h3",i18n("Attendees"));
289 Attendee *a; 301 Attendee *a;
290 mText.append("<ul>"); 302 mText.append("<ul>");
291 for(a=attendees.first();a;a=attendees.next()) { 303 for(a=attendees.first();a;a=attendees.next()) {
292#if 0 304#if 0
293//ndef KORG_NOKABC 305//ndef KORG_NOKABC
294 if (a->name().isEmpty()) { 306 if (a->name().isEmpty()) {
295 addressList = add_book->findByEmail(a->email()); 307 addressList = add_book->findByEmail(a->email());
296 KABC::Addressee o = addressList.first(); 308 KABC::Addressee o = addressList.first();
297 if (!o.isEmpty() && addressList.size()<2) { 309 if (!o.isEmpty() && addressList.size()<2) {
298 mText += "<a href=\"uid:" + o.uid() + "\">"; 310 mText += "<a href=\"uid:" + o.uid() + "\">";
299 mText += o.formattedName(); 311 mText += o.formattedName();
300 mText += "</a>\n"; 312 mText += "</a>\n";
301 } else { 313 } else {
302 mText += "<li>"; 314 mText += "<li>";
303 mText.append(a->email()); 315 mText.append(a->email());
304 mText += "\n"; 316 mText += "\n";
305 } 317 }
306 } else { 318 } else {
307 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 319 mText += "<li><a href=\"uid:" + a->uid() + "\">";
308 if (!a->name().isEmpty()) mText += a->name(); 320 if (!a->name().isEmpty()) mText += a->name();
309 else mText += a->email(); 321 else mText += a->email();
310 mText += "</a>\n"; 322 mText += "</a>\n";
311 } 323 }
312#else 324#else
313 //qDebug("nokabc "); 325 //qDebug("nokabc ");
314 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 326 mText += "<li><a href=\"uid:" + a->uid() + "\">";
315 if (!a->name().isEmpty()) mText += a->name(); 327 if (!a->name().isEmpty()) mText += a->name();
316 else mText += a->email(); 328 else mText += a->email();
317 mText += "</a>\n"; 329 mText += "</a>\n";
318#endif 330#endif
319 331
320 if (!a->email().isEmpty()) { 332 if (!a->email().isEmpty()) {
321 if (iconPath) { 333 if (iconPath) {
322 mText += "<a href=\"mailto:" + a->name() +" "+ "<" + a->email() + ">" + "\">"; 334 mText += "<a href=\"mailto:" + a->name() +" "+ "<" + a->email() + ">" + "\">";
323 if ( a->RSVP() ) 335 if ( a->RSVP() )
324 mText += "<IMG src=\"" + iconPath + "\">"; 336 mText += "<IMG src=\"" + iconPath + "\">";
325 else 337 else
326 mText += "<IMG src=\"" + NOiconPath + "\">"; 338 mText += "<IMG src=\"" + NOiconPath + "\">";
327 mText += "</a>\n"; 339 mText += "</a>\n";
328 } 340 }
329 } 341 }
330 if (a->status() != Attendee::NeedsAction ) 342 if (a->status() != Attendee::NeedsAction )
331 mText +="[" + a->statusStr() + "] "; 343 mText +="[" + a->statusStr() + "] ";
332 if (a->role() == Attendee::Chair ) 344 if (a->role() == Attendee::Chair )
333 mText +="(" + a->roleStr().left(1) + ".)"; 345 mText +="(" + a->roleStr().left(1) + ".)";
334 } 346 }
335 mText.append("</li></ul>"); 347 mText.append("</li></ul>");
336 } 348 }
337} 349}
338 350
339void KIncidenceFormatter::formatReadOnly(Incidence *event) 351void KIncidenceFormatter::formatReadOnly(Incidence *event)
340{ 352{
341 if (event->isReadOnly()) { 353 if (event->isReadOnly()) {
342 addTag("p","<em>(" + i18n("read-only") + ")</em>"); 354 addTag("p","<em>(" + i18n("read-only") + ")</em>");
343 } 355 }
344} 356}
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 1f54c2f..39d16b6 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -116,342 +116,342 @@ bool Todo::contains ( Todo* from )
116 116
117} 117}
118bool KCal::operator==( const Todo& t1, const Todo& t2 ) 118bool KCal::operator==( const Todo& t1, const Todo& t2 )
119{ 119{
120 120
121 bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 ); 121 bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 );
122 if ( ! ret ) 122 if ( ! ret )
123 return false; 123 return false;
124 if ( t1.hasDueDate() == t2.hasDueDate() ) { 124 if ( t1.hasDueDate() == t2.hasDueDate() ) {
125 if ( t1.hasDueDate() ) { 125 if ( t1.hasDueDate() ) {
126 if ( t1.doesFloat() == t2.doesFloat() ) { 126 if ( t1.doesFloat() == t2.doesFloat() ) {
127 if ( t1.doesFloat() ) { 127 if ( t1.doesFloat() ) {
128 if ( t1.dtDue().date() != t2.dtDue().date() ) 128 if ( t1.dtDue().date() != t2.dtDue().date() )
129 return false; 129 return false;
130 } else 130 } else
131 if ( t1.dtDue() != t2.dtDue() ) 131 if ( t1.dtDue() != t2.dtDue() )
132 return false; 132 return false;
133 } else 133 } else
134 return false;// float != 134 return false;// float !=
135 } 135 }
136 136
137 } else 137 } else
138 return false; 138 return false;
139 if ( t1.percentComplete() != t2.percentComplete() ) 139 if ( t1.percentComplete() != t2.percentComplete() )
140 return false; 140 return false;
141 if ( t1.isCompleted() ) { 141 if ( t1.isCompleted() ) {
142 if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) { 142 if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) {
143 if ( t1.hasCompletedDate() ) { 143 if ( t1.hasCompletedDate() ) {
144 if ( t1.completed() != t2.completed() ) 144 if ( t1.completed() != t2.completed() )
145 return false; 145 return false;
146 } 146 }
147 147
148 } else 148 } else
149 return false; 149 return false;
150 } 150 }
151 return true; 151 return true;
152 152
153} 153}
154 154
155void Todo::setDtDue(const QDateTime &dtDue) 155void Todo::setDtDue(const QDateTime &dtDue)
156{ 156{
157 //int diffsecs = mDtDue.secsTo(dtDue); 157 //int diffsecs = mDtDue.secsTo(dtDue);
158 158
159 /*if (mReadOnly) return; 159 /*if (mReadOnly) return;
160 const QPtrList<Alarm>& alarms = alarms(); 160 const QPtrList<Alarm>& alarms = alarms();
161 for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) { 161 for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) {
162 if (alarm->enabled()) { 162 if (alarm->enabled()) {
163 alarm->setTime(alarm->time().addSecs(diffsecs)); 163 alarm->setTime(alarm->time().addSecs(diffsecs));
164 } 164 }
165 }*/ 165 }*/
166 mDtDue = getEvenTime(dtDue); 166 mDtDue = getEvenTime(dtDue);
167 167
168 //kdDebug(5800) << "setDtDue says date is " << mDtDue.toString() << endl; 168 //kdDebug(5800) << "setDtDue says date is " << mDtDue.toString() << endl;
169 169
170 /*const QPtrList<Alarm>& alarms = alarms(); 170 /*const QPtrList<Alarm>& alarms = alarms();
171 for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) 171 for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next())
172 alarm->setAlarmStart(mDtDue);*/ 172 alarm->setAlarmStart(mDtDue);*/
173 173
174 updated(); 174 updated();
175} 175}
176 176
177QDateTime Todo::dtDue() const 177QDateTime Todo::dtDue() const
178{ 178{
179 return mDtDue; 179 return mDtDue;
180} 180}
181 181
182QString Todo::dtDueTimeStr() const 182QString Todo::dtDueTimeStr() const
183{ 183{
184 return KGlobal::locale()->formatTime(mDtDue.time()); 184 return KGlobal::locale()->formatTime(mDtDue.time());
185} 185}
186 186
187QString Todo::dtDueDateStr(bool shortfmt) const 187QString Todo::dtDueDateStr(bool shortfmt) const
188{ 188{
189 return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); 189 return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt);
190} 190}
191 191
192QString Todo::dtDueStr(bool shortfmt) const 192QString Todo::dtDueStr(bool shortfmt) const
193{ 193{
194 return KGlobal::locale()->formatDateTime(mDtDue, shortfmt); 194 return KGlobal::locale()->formatDateTime(mDtDue, shortfmt);
195} 195}
196// retval 0 : no found 196// retval 0 : no found
197// 1 : due for date found 197// 1 : due for date found
198// 2 : overdue for date found 198// 2 : overdue for date found
199int Todo::hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ) 199int Todo::hasDueSubTodoForDate( const QDate & date, bool checkSubtodos )
200{ 200{
201 int retval = 0; 201 int retval = 0;
202 if ( isCompleted() ) 202 if ( isCompleted() )
203 return 0; 203 return 0;
204 if ( hasDueDate() ) { 204 if ( hasDueDate() ) {
205 if ( dtDue().date() < date ) 205 if ( dtDue().date() < date )
206 return 2; 206 return 2;
207 // we do not return, because we may find an overdue sub todo 207 // we do not return, because we may find an overdue sub todo
208 if ( dtDue().date() == date ) 208 if ( dtDue().date() == date )
209 retval = 1; 209 retval = 1;
210 } 210 }
211 if ( checkSubtodos ) { 211 if ( checkSubtodos ) {
212 Incidence *aTodo; 212 Incidence *aTodo;
213 for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { 213 for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) {
214 int ret = ((Todo*)aTodo)->hasDueSubTodoForDate( date ,checkSubtodos ); 214 int ret = ((Todo*)aTodo)->hasDueSubTodoForDate( date ,checkSubtodos );
215 if ( ret == 2 ) 215 if ( ret == 2 )
216 return 2; 216 return 2;
217 if ( ret == 1) 217 if ( ret == 1)
218 retval = 1; 218 retval = 1;
219 } 219 }
220 } 220 }
221 return retval; 221 return retval;
222} 222}
223int Todo::hasDueSubTodo( bool checkSubtodos ) //= true 223int Todo::hasDueSubTodo( bool checkSubtodos ) //= true
224{ 224{
225 return hasDueSubTodoForDate(QDate::currentDate(), checkSubtodos ); 225 return hasDueSubTodoForDate(QDate::currentDate(), checkSubtodos );
226} 226}
227bool Todo::hasDueDate() const 227bool Todo::hasDueDate() const
228{ 228{
229 return mHasDueDate; 229 return mHasDueDate;
230} 230}
231 231
232void Todo::setHasDueDate(bool f) 232void Todo::setHasDueDate(bool f)
233{ 233{
234 if (mReadOnly) return; 234 if (mReadOnly) return;
235 mHasDueDate = f; 235 mHasDueDate = f;
236 updated(); 236 updated();
237} 237}
238 238
239 239
240#if 0 240#if 0
241void Todo::setStatus(const QString &statStr) 241void Todo::setStatus(const QString &statStr)
242{ 242{
243 if (mReadOnly) return; 243 if (mReadOnly) return;
244 QString ss(statStr.upper()); 244 QString ss(statStr.upper());
245 245
246 if (ss == "X-ACTION") 246 if (ss == "X-ACTION")
247 mStatus = NEEDS_ACTION; 247 mStatus = NEEDS_ACTION;
248 else if (ss == "NEEDS ACTION") 248 else if (ss == "NEEDS ACTION")
249 mStatus = NEEDS_ACTION; 249 mStatus = NEEDS_ACTION;
250 else if (ss == "ACCEPTED") 250 else if (ss == "ACCEPTED")
251 mStatus = ACCEPTED; 251 mStatus = ACCEPTED;
252 else if (ss == "SENT") 252 else if (ss == "SENT")
253 mStatus = SENT; 253 mStatus = SENT;
254 else if (ss == "TENTATIVE") 254 else if (ss == "TENTATIVE")
255 mStatus = TENTATIVE; 255 mStatus = TENTATIVE;
256 else if (ss == "CONFIRMED") 256 else if (ss == "CONFIRMED")
257 mStatus = CONFIRMED; 257 mStatus = CONFIRMED;
258 else if (ss == "DECLINED") 258 else if (ss == "DECLINED")
259 mStatus = DECLINED; 259 mStatus = DECLINED;
260 else if (ss == "COMPLETED") 260 else if (ss == "COMPLETED")
261 mStatus = COMPLETED; 261 mStatus = COMPLETED;
262 else if (ss == "DELEGATED") 262 else if (ss == "DELEGATED")
263 mStatus = DELEGATED; 263 mStatus = DELEGATED;
264 264
265 updated(); 265 updated();
266} 266}
267 267
268void Todo::setStatus(int status) 268void Todo::setStatus(int status)
269{ 269{
270 if (mReadOnly) return; 270 if (mReadOnly) return;
271 mStatus = status; 271 mStatus = status;
272 updated(); 272 updated();
273} 273}
274 274
275int Todo::status() const 275int Todo::status() const
276{ 276{
277 return mStatus; 277 return mStatus;
278} 278}
279 279
280QString Todo::statusStr() const 280QString Todo::statusStr() const
281{ 281{
282 switch(mStatus) { 282 switch(mStatus) {
283 case NEEDS_ACTION: 283 case NEEDS_ACTION:
284 return QString("NEEDS ACTION"); 284 return QString("NEEDS ACTION");
285 break; 285 break;
286 case ACCEPTED: 286 case ACCEPTED:
287 return QString("ACCEPTED"); 287 return QString("ACCEPTED");
288 break; 288 break;
289 case SENT: 289 case SENT:
290 return QString("SENT"); 290 return QString("SENT");
291 break; 291 break;
292 case TENTATIVE: 292 case TENTATIVE:
293 return QString("TENTATIVE"); 293 return QString("TENTATIVE");
294 break; 294 break;
295 case CONFIRMED: 295 case CONFIRMED:
296 return QString("CONFIRMED"); 296 return QString("CONFIRMED");
297 break; 297 break;
298 case DECLINED: 298 case DECLINED:
299 return QString("DECLINED"); 299 return QString("DECLINED");
300 break; 300 break;
301 case COMPLETED: 301 case COMPLETED:
302 return QString("COMPLETED"); 302 return QString("COMPLETED");
303 break; 303 break;
304 case DELEGATED: 304 case DELEGATED:
305 return QString("DELEGATED"); 305 return QString("DELEGATED");
306 break; 306 break;
307 } 307 }
308 return QString(""); 308 return QString("");
309} 309}
310#endif 310#endif
311 311
312bool Todo::isCompleted() const 312bool Todo::isCompleted() const
313{ 313{
314 if (mPercentComplete == 100) { 314 if (mPercentComplete == 100) {
315 return true; 315 return true;
316 } 316 }
317 else return false; 317 else return false;
318} 318}
319 319
320void Todo::setCompleted(bool completed) 320void Todo::setCompleted(bool completed)
321{ 321{
322 if ( mHasRecurrenceID && completed && mPercentComplete != 100 ) { 322 if ( mHasRecurrenceID && completed && mPercentComplete != 100 ) {
323 if ( !setRecurDates() ) 323 if ( !setRecurDates() )
324 completed = false; 324 completed = false;
325 } 325 }
326 if (completed) mPercentComplete = 100; 326 if (completed) mPercentComplete = 100;
327 else { 327 else {
328 mPercentComplete = 0; 328 mPercentComplete = 0;
329 mHasCompletedDate = false; 329 mHasCompletedDate = false;
330 } 330 }
331 updated(); 331 updated();
332} 332}
333 333
334QDateTime Todo::completed() const 334QDateTime Todo::completed() const
335{ 335{
336 return mCompleted; 336 return mCompleted;
337} 337}
338 338
339QString Todo::completedStr( bool shortF ) const 339QString Todo::completedStr( bool shortF ) const
340{ 340{
341 return KGlobal::locale()->formatDateTime(mCompleted, shortF); 341 return KGlobal::locale()->formatDateTime(mCompleted, shortF);
342} 342}
343 343
344void Todo::setCompleted(const QDateTime &completed) 344void Todo::setCompleted(const QDateTime &completed)
345{ 345{
346 //qDebug("Todo::setCompleted "); 346 //qDebug("Todo::setCompleted ");
347 if ( mHasCompletedDate ) { 347 if ( mHasCompletedDate ) {
348 // qDebug("has completed data - return "); 348 // qDebug("has completed data - return ");
349 return; 349 return;
350 } 350 }
351 mHasCompletedDate = true; 351 mHasCompletedDate = true;
352 mPercentComplete = 100; 352 mPercentComplete = 100;
353 mCompleted = getEvenTime(completed); 353 mCompleted = getEvenTime(completed);
354 updated(); 354 updated();
355} 355}
356 356
357bool Todo::hasCompletedDate() const 357bool Todo::hasCompletedDate() const
358{ 358{
359 return mHasCompletedDate; 359 return mHasCompletedDate;
360} 360}
361 361
362int Todo::percentComplete() const 362int Todo::percentComplete() const
363{ 363{
364 return mPercentComplete; 364 return mPercentComplete;
365} 365}
366bool Todo::setRecurDates() 366bool Todo::setRecurDates()
367{ 367{
368 if ( !mHasRecurrenceID ) 368 if ( !mHasRecurrenceID )
369 return true; 369 return true;
370 int secs = mDtStart.secsTo( dtDue() ); 370 int secs = mDtStart.secsTo( dtDue() );
371 bool ok; 371 bool ok;
372 qDebug("--------------------setRecurDates() "); 372 qDebug("T:setRecurDates() ");
373 //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); 373 //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() );
374 QDateTime next = getNextOccurence( mRecurrenceID, &ok ); 374 QDateTime next = getNextOccurence( mRecurrenceID, &ok );
375 if ( ok ) { 375 if ( ok ) {
376 mRecurrenceID = next; 376 mRecurrenceID = next;
377 mDtStart = next; 377 mDtStart = next;
378 setDtDue( next.addSecs( secs ) ); 378 setDtDue( next.addSecs( secs ) );
379 if ( QDateTime::currentDateTime() > next) 379 if ( QDateTime::currentDateTime() > next)
380 return false; 380 return false;
381 } else { 381 } else {
382 setHasRecurrenceID( false ); 382 setHasRecurrenceID( false );
383 recurrence()->unsetRecurs(); 383 recurrence()->unsetRecurs();
384 } 384 }
385 return true; 385 return true;
386} 386}
387void Todo::setPercentComplete(int v) 387void Todo::setPercentComplete(int v)
388{ 388{
389 if ( mHasRecurrenceID && v == 100 && mPercentComplete != 100 ) { 389 if ( mHasRecurrenceID && v == 100 && mPercentComplete != 100 ) {
390 if ( !setRecurDates() ) 390 if ( !setRecurDates() )
391 v = 0; 391 v = 0;
392 } 392 }
393 mPercentComplete = v; 393 mPercentComplete = v;
394 if ( v != 100 ) 394 if ( v != 100 )
395 mHasCompletedDate = false; 395 mHasCompletedDate = false;
396 updated(); 396 updated();
397} 397}
398QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const 398QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const
399{ 399{
400 if ( isCompleted() || ! hasDueDate() || cancelled() ) { 400 if ( isCompleted() || ! hasDueDate() || cancelled() ) {
401 *ok = false; 401 *ok = false;
402 return QDateTime (); 402 return QDateTime ();
403 } 403 }
404 QDateTime incidenceStart; 404 QDateTime incidenceStart;
405 incidenceStart = dtDue(); 405 incidenceStart = dtDue();
406 bool enabled = false; 406 bool enabled = false;
407 Alarm* alarm; 407 Alarm* alarm;
408 int off = 0; 408 int off = 0;
409 QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; 409 QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );;
410 // if ( QDateTime::currentDateTime() > incidenceStart ){ 410 // if ( QDateTime::currentDateTime() > incidenceStart ){
411// *ok = false; 411// *ok = false;
412// return incidenceStart; 412// return incidenceStart;
413// } 413// }
414 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { 414 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
415 if (alarm->enabled()) { 415 if (alarm->enabled()) {
416 if ( alarm->hasTime () ) { 416 if ( alarm->hasTime () ) {
417 if ( alarm->time() < alarmStart ) { 417 if ( alarm->time() < alarmStart ) {
418 alarmStart = alarm->time(); 418 alarmStart = alarm->time();
419 enabled = true; 419 enabled = true;
420 off = alarmStart.secsTo( incidenceStart ); 420 off = alarmStart.secsTo( incidenceStart );
421 } 421 }
422 422
423 } else { 423 } else {
424 int secs = alarm->startOffset().asSeconds(); 424 int secs = alarm->startOffset().asSeconds();
425 if ( incidenceStart.addSecs( secs ) < alarmStart ) { 425 if ( incidenceStart.addSecs( secs ) < alarmStart ) {
426 alarmStart = incidenceStart.addSecs( secs ); 426 alarmStart = incidenceStart.addSecs( secs );
427 enabled = true; 427 enabled = true;
428 off = -secs; 428 off = -secs;
429 } 429 }
430 } 430 }
431 } 431 }
432 } 432 }
433 if ( enabled ) { 433 if ( enabled ) {
434 if ( alarmStart > QDateTime::currentDateTime() ) { 434 if ( alarmStart > QDateTime::currentDateTime() ) {
435 *ok = true; 435 *ok = true;
436 * offset = off; 436 * offset = off;
437 return alarmStart; 437 return alarmStart;
438 } 438 }
439 } 439 }
440 *ok = false; 440 *ok = false;
441 return QDateTime (); 441 return QDateTime ();
442 442
443} 443}
444 444
445void Todo::checkSetCompletedFalse() 445void Todo::checkSetCompletedFalse()
446{ 446{
447 if ( !hasRecurrenceID() ) { 447 if ( !hasRecurrenceID() ) {
448 qDebug("ERROR 1 in Todo::checkSetCompletedFalse"); 448 qDebug("ERROR 1 in Todo::checkSetCompletedFalse");
449 } 449 }
450 // qDebug("Todo::checkSetCompletedFalse()"); 450 // qDebug("Todo::checkSetCompletedFalse()");
451 //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); 451 //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() );
452 if ( mPercentComplete == 100 && mDtStart == mRecurrenceID && QDateTime::currentDateTime() > mDtStart) { 452 if ( mPercentComplete == 100 && mDtStart == mRecurrenceID && QDateTime::currentDateTime() > mDtStart) {
453 qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); 453 qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() );
454 setCompleted( false ); 454 setCompleted( false );
455 qDebug("Todo::checkSetCompletedFalse++++++++++++++++++++++++++++ "); 455 qDebug("Todo::checkSetCompletedFalse ");
456 } 456 }
457} 457}