summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt4
-rw-r--r--kalarmd/alarmdialog.cpp5
-rw-r--r--korganizer/calendarview.cpp47
-rw-r--r--korganizer/calendarview.h2
-rw-r--r--korganizer/kodialogmanager.cpp4
-rw-r--r--korganizer/kolistview.cpp3
-rw-r--r--korganizer/mainwindow.cpp17
-rw-r--r--korganizer/mainwindow.h2
8 files changed, 43 insertions, 41 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index 44e6bdf..593806b 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -965,517 +965,517 @@
965{ "Password to enable\naccess from remote:","Passwort um entfernten\nZugriff zuzulassen:" }, 965{ "Password to enable\naccess from remote:","Passwort um entfernten\nZugriff zuzulassen:" },
966{ "Automatically start\nat application startup","Starte automatisch\nbeim Programmstart" }, 966{ "Automatically start\nat application startup","Starte automatisch\nbeim Programmstart" },
967{ "Automatically sync\nwith KDE-Desktop","Automatischer Sync\nmit dem KDE-Desktop" }, 967{ "Automatically sync\nwith KDE-Desktop","Automatischer Sync\nmit dem KDE-Desktop" },
968{ "Enter port for Pi-Sync","Port Nummer für Pi-Sync" }, 968{ "Enter port for Pi-Sync","Port Nummer für Pi-Sync" },
969{ "Disable Pi-Sync","Schalte Pi-Sync aus" }, 969{ "Disable Pi-Sync","Schalte Pi-Sync aus" },
970{ "Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!","Wollen Sie wirklich\nmit allen selektierten\nProfilen "Multi-Syncen"?\nDas Syncen dauert einige Zeit -\nalle Profile werden zweimal gesynct!" }, 970{ "Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!","Wollen Sie wirklich\nmit allen selektierten\nProfilen "Multi-Syncen"?\nDas Syncen dauert einige Zeit -\nalle Profile werden zweimal gesynct!" },
971{ "KDE-Pim Sync","KDE-Pim Sync" }, 971{ "KDE-Pim Sync","KDE-Pim Sync" },
972{ "Multiple profiles","Multi-Sync Profile" }, 972{ "Multiple profiles","Multi-Sync Profile" },
973{ "Device: ","Gerät: " }, 973{ "Device: ","Gerät: " },
974{ "Multiple sync started.","Multi-Sync gestartet." }, 974{ "Multiple sync started.","Multi-Sync gestartet." },
975{ "Nothing synced! No profiles defined for multisync!","Nichts gesynct! Keine Profile\nselektiert für Multi-Sync" }, 975{ "Nothing synced! No profiles defined for multisync!","Nichts gesynct! Keine Profile\nselektiert für Multi-Sync" },
976{ "Turn filter on","Schalte Filter an" }, 976{ "Turn filter on","Schalte Filter an" },
977{ "Turn filter off","Schalte Filter aus" }, 977{ "Turn filter off","Schalte Filter aus" },
978{ "Key bindings KOrganizer/Pi","Tastatur Belegung KOrganizer/Pi" }, 978{ "Key bindings KOrganizer/Pi","Tastatur Belegung KOrganizer/Pi" },
979{ "<p><b>White</b>: Item readonly</p>\n","<p><b>Weiss</b>: Eintrag schreibgeschützt</p>\n" }, 979{ "<p><b>White</b>: Item readonly</p>\n","<p><b>Weiss</b>: Eintrag schreibgeschützt</p>\n" },
980{ "<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n","<p><b>Dunkelgelb</b>: Termin/Todo mit Teilnehmern.</p>\n" }, 980{ "<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n","<p><b>Dunkelgelb</b>: Termin/Todo mit Teilnehmern.</p>\n" },
981{ "<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n","<p><b>Schwarz</b>: Termin/Todo mit Teilnehmern. Sie sind der Organisator!</p>\n" }, 981{ "<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n","<p><b>Schwarz</b>: Termin/Todo mit Teilnehmern. Sie sind der Organisator!</p>\n" },
982{ "<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n","<p><b>Dunkelgrün</b>: Information(Beschreibung) verfügbar.([i] in WN Ansicht)</p>\n" }, 982{ "<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n","<p><b>Dunkelgrün</b>: Information(Beschreibung) verfügbar.([i] in WN Ansicht)</p>\n" },
983{ "<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n","<p><b>Blau</b>: Wiederholender Termin.([r] in Whats'Next Ansicht)</p>\n" }, 983{ "<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n","<p><b>Blau</b>: Wiederholender Termin.([r] in Whats'Next Ansicht)</p>\n" },
984{ "<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n","<p><b>Rot</b>: Alarm gesetzt.([a] in Whats'Next Ansicht)</p>\n" }, 984{ "<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n","<p><b>Rot</b>: Alarm gesetzt.([a] in Whats'Next Ansicht)</p>\n" },
985{ "<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n","<p><b>Kreuz</b>: Eintrag gecancelt.([c] in Whats'Next Ansicht)</p>\n" }, 985{ "<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n","<p><b>Kreuz</b>: Eintrag gecancelt.([c] in Whats'Next Ansicht)</p>\n" },
986{ "<p><b>(for square icons in agenda and month view)</b></p>\n","<p><b>(für quadratische Icons in Agenda und Monats Ansicht)</b></p>\n" }, 986{ "<p><b>(for square icons in agenda and month view)</b></p>\n","<p><b>(für quadratische Icons in Agenda und Monats Ansicht)</b></p>\n" },
987{ "<p><h2>KO/Pi icon colors:</h2></p>\n","<p><h2>KO/Pi Icon Farben:</h2></p>\n" }, 987{ "<p><h2>KO/Pi icon colors:</h2></p>\n","<p><h2>KO/Pi Icon Farben:</h2></p>\n" },
988{ "<p><b>E</b>: Edit item</p>\n","<p><b>E</b>: Editiere Eintrag</p>\n" }, 988{ "<p><b>E</b>: Edit item</p>\n","<p><b>E</b>: Editiere Eintrag</p>\n" },
989{ "<p><b>A</b>: Show agenda view.</p>\n","<p><b>A</b>: Zeige Agenda Ansicht.</p>\n" }, 989{ "<p><b>A</b>: Show agenda view.</p>\n","<p><b>A</b>: Zeige Agenda Ansicht.</p>\n" },
990{ "<p><b>I,C</b>: Close dialog.</p>\n","<p><b>I,C</b>: Schließe Dialog.</p>\n" }, 990{ "<p><b>I,C</b>: Close dialog.</p>\n","<p><b>I,C</b>: Schließe Dialog.</p>\n" },
991{ "<p><h3>In event/todo viewer:</h3></p>\n","<p><h3>In Termin/Todo Detail-Anzeige:</h3></p>\n" }, 991{ "<p><h3>In event/todo viewer:</h3></p>\n","<p><h3>In Termin/Todo Detail-Anzeige:</h3></p>\n" },
992{ "<p><b>shift+up/down</b>: Goto first/last item</p>\n","<p><b>shift+up/down</b>: Gehe zum ersten/letzten Eintrag</p>\n" }, 992{ "<p><b>shift+up/down</b>: Goto first/last item</p>\n","<p><b>shift+up/down</b>: Gehe zum ersten/letzten Eintrag</p>\n" },
993{ "<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n","<p><b>ctrl+up/down</b>: Gehe hoch/runter 20% aller Einträge</p>\n" }, 993{ "<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n","<p><b>ctrl+up/down</b>: Gehe hoch/runter 20% aller Einträge</p>\n" },
994{ "<p><b>up/down</b>: Next/prev item</p>\n","<p><b>up/down</b>: Nächster/vorheriger Eintrag</p>\n" }, 994{ "<p><b>up/down</b>: Next/prev item</p>\n","<p><b>up/down</b>: Nächster/vorheriger Eintrag</p>\n" },
995{ "<p><b>return+shift</b>: Deselect item+one step down</p>\n","<p><b>return+shift</b>: Deselektiere Item+Cursor einen Eintrag runter</p>\n" }, 995{ "<p><b>return+shift</b>: Deselect item+one step down</p>\n","<p><b>return+shift</b>: Deselektiere Item+Cursor einen Eintrag runter</p>\n" },
996{ "<p><b>return</b>: Select item+one step down</p>\n","<p><b>return</b>: Selektiere Item+Cursor einen Eintrag runter</p>\n" }, 996{ "<p><b>return</b>: Select item+one step down</p>\n","<p><b>return</b>: Selektiere Item+Cursor einen Eintrag runter</p>\n" },
997{ "<p><b>I</b>: Show info of current item+one step down.</p>\n","<p><b>I</b>: Zeige Detail-Ansicht vom sel.Eintrag+Cursor einen Eintrag runter.</p>\n" }, 997{ "<p><b>I</b>: Show info of current item+one step down.</p>\n","<p><b>I</b>: Zeige Detail-Ansicht vom sel.Eintrag+Cursor einen Eintrag runter.</p>\n" },
998{ "<p><h3>In list view:</h3></p>\n","<p><h3>In Listen Ansicht:</h3></p>\n" }, 998{ "<p><h3>In list view:</h3></p>\n","<p><h3>In Listen Ansicht:</h3></p>\n" },
999{ "<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n","<p><b>return+shift</b>: Markiere Todo als nicht erledigt+Cursor einen Eintrag runter</p>\n" }, 999{ "<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n","<p><b>return+shift</b>: Markiere Todo als nicht erledigt+Cursor einen Eintrag runter</p>\n" },
1000{ "<p><b>return</b>: Mark item as completed+one step down.</p>\n","<p><b>return</b>: Markiere Todo als erledigt+Cursor einen Eintrag runter.</p>\n" }, 1000{ "<p><b>return</b>: Mark item as completed+one step down.</p>\n","<p><b>return</b>: Markiere Todo als erledigt+Cursor einen Eintrag runter.</p>\n" },
1001{ "<p><b>Q</b>: Toggle quick todo line edit.</p>\n","<p><b>Q</b>: Zeige/verstecke Quick Todo Eingabe Zeile.</p>\n" }, 1001{ "<p><b>Q</b>: Toggle quick todo line edit.</p>\n","<p><b>Q</b>: Zeige/verstecke Quick Todo Eingabe Zeile.</p>\n" },
1002{ "<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n","<p><b>shift+P</b>: Mache Todo zum neuen <b>P</b>arent Todo für das Todo, welches mit shift+Sselektiert wurde.</p>\n" }, 1002{ "<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n","<p><b>shift+P</b>: Mache Todo zum neuen <b>P</b>arent Todo für das Todo, welches mit shift+Sselektiert wurde.</p>\n" },
1003{ "<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n","<p><b>shift+S</b>: Mache Todo zum <b>S</b>ubtodo</p>\n" }, 1003{ "<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n","<p><b>shift+S</b>: Mache Todo zum <b>S</b>ubtodo</p>\n" },
1004{ "<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n","<p><b>shift+U</b>: <b>U</b>nparent Todo (Mache Sub-Todo zum Toplevel Todo)</p>\n" }, 1004{ "<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n","<p><b>shift+U</b>: <b>U</b>nparent Todo (Mache Sub-Todo zum Toplevel Todo)</p>\n" },
1005{ "<p><h3>In todo view:</h3></p>\n","<p><h3>In Todo Anzige:</h3></p>\n" }, 1005{ "<p><h3>In todo view:</h3></p>\n","<p><h3>In Todo Anzige:</h3></p>\n" },
1006{ "<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n","<p><b>ctrl+up/down</b>: Scrolle kleine Todo Ansicht</p>\n" }, 1006{ "<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n","<p><b>ctrl+up/down</b>: Scrolle kleine Todo Ansicht</p>\n" },
1007{ "<p><b>up/down</b>: Scroll agenda view</p>\n","<p><b>up/down</b>: Scrolle Agenda Ansicht</p>\n" }, 1007{ "<p><b>up/down</b>: Scroll agenda view</p>\n","<p><b>up/down</b>: Scrolle Agenda Ansicht</p>\n" },
1008{ "<p><h3>In agenda view:</h3></p>\n","<p><h3>In Agenda Ansicht:</h3></p>\n" }, 1008{ "<p><h3>In agenda view:</h3></p>\n","<p><h3>In Agenda Ansicht:</h3></p>\n" },
1009{ "<p><b>del,backspace</b>: Delete selected item</p>\n","<p><b>del,backspace</b>: Lösche selektiertes Item</p>\n" }, 1009{ "<p><b>del,backspace</b>: Delete selected item</p>\n","<p><b>del,backspace</b>: Lösche selektiertes Item</p>\n" },
1010{ "<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" }, 1010{ "<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" },
1011{ "<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" }, 1011{ "<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" },
1012{ "<p><b>B</b>: Edit description (details) of selected item</p>\n","<p><b>B</b>: Editiere Beschreibung (Details) des selektierten Items</p>\n" }, 1012{ "<p><b>B</b>: Edit description (details) of selected item</p>\n","<p><b>B</b>: Editiere Beschreibung (Details) des selektierten Items</p>\n" },
1013{ "<p><b>C</b>: Show current time in agenda view</p>\n","<p><b>C</b>: Zeige aktuelle Zeit in Agenda Ansicht</p>\n" }, 1013{ "<p><b>C</b>: Show current time in agenda view</p>\n","<p><b>C</b>: Zeige aktuelle Zeit in Agenda Ansicht</p>\n" },
1014{ "<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" }, 1014{ "<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" },
1015{ "<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n","<p><b>S+ctrl</b>: Füge Sub-Todo hinzu | <b>X+ctrl</b>: Zeige/verstecke Datumsnavigator</p>\n" }, 1015{ "<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n","<p><b>S+ctrl</b>: Füge Sub-Todo hinzu | <b>X+ctrl</b>: Zeige/verstecke Datumsnavigator</p>\n" },
1016{ "<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" }, 1016{ "<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" },
1017{ "<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" }, 1017{ "<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" },
1018{ "<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n","<p><b>D</b>: Ein-Tages Ansicht | <b>M</b>: Monatsansicht</p>\n" }, 1018{ "<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n","<p><b>D</b>: Ein-Tages Ansicht | <b>M</b>: Monatsansicht</p>\n" },
1019{ "<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n","<p><b>Z,Y</b>: Arbeitswochenansicht | <b>U</b>: Wochenansicht</p>\n" }, 1019{ "<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n","<p><b>Z,Y</b>: Arbeitswochenansicht | <b>U</b>: Wochenansicht</p>\n" },
1020{ "<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" }, 1020{ "<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" },
1021{ "<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ","<p><b>X</b>: Nächste-X-Tage Ansicht | <b>W</b>: What's Next Ansicht\n " }, 1021{ "<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ","<p><b>X</b>: Nächste-X-Tage Ansicht | <b>W</b>: What's Next Ansicht\n " },
1022{ "<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" }, 1022{ "<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" },
1023{ "<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" }, 1023{ "<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" },
1024{ "<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" }, 1024{ "<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" },
1025{ "<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" }, 1025{ "<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" },
1026{ "<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" }, 1026{ "<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" },
1027{ "<p><h2>KO/Pi key shortcuts:</h2></p>\n","<p><h2>KO/Pi Tastatur Kurzbefehle:</h2></p>\n" }, 1027{ "<p><h2>KO/Pi key shortcuts:</h2></p>\n","<p><h2>KO/Pi Tastatur Kurzbefehle:</h2></p>\n" },
1028{ "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" }, 1028{ "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" },
1029{ "Auto Saving in KOrganizer/Pi","Auto Speichern in KOrganizer/Pi" }, 1029{ "Auto Saving in KOrganizer/Pi","Auto Speichern in KOrganizer/Pi" },
1030{ "\nhttp://sourceforge.net/projects/kdepimpi\n","\nhttp://sourceforge.net/projects/kdepimpi\n" }, 1030{ "\nhttp://sourceforge.net/projects/kdepimpi\n","\nhttp://sourceforge.net/projects/kdepimpi\n" },
1031{ "\nor report them in the bugtracker on\n","\noder trage sie in dem Bugtracker ein auf\n" }, 1031{ "\nor report them in the bugtracker on\n","\noder trage sie in dem Bugtracker ein auf\n" },
1032{ "\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n","\nBitte melde fehlerhaftes Verhalten an\nlutz@pi-sync.info\n" }, 1032{ "\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n","\nBitte melde fehlerhaftes Verhalten an\nlutz@pi-sync.info\n" },
1033{ "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" }, 1033{ "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" },
1034{ "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" }, 1034{ "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" },
1035{ "Known Problems in KOrganizer/Pi","Bekannte Probleme in KOrganizer/Pi" }, 1035{ "Known Problems in KOrganizer/Pi","Bekannte Probleme in KOrganizer/Pi" },
1036{ "KO/Pi FAQ","KO/Pi FAQ" }, 1036{ "KO/Pi FAQ","KO/Pi FAQ" },
1037{ "PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n","PDA-Edition\nfür: Zaurus 5x00/7x0/860/3000/6000\n" }, 1037{ "PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n","PDA-Edition\nfür: Zaurus 5x00/7x0/860/3000/6000\n" },
1038{ "KOrganizer/Platform-independent\n","KOrganizer/Platform-independent\n" }, 1038{ "KOrganizer/Platform-independent\n","KOrganizer/Platform-independent\n" },
1039{ "About KOrganizer/Pi","Über KOrganizer/Pi" }, 1039{ "About KOrganizer/Pi","Über KOrganizer/Pi" },
1040{ "From: ","Von: " }, 1040{ "From: ","Von: " },
1041{ "Remove sync info","Entferne Sync Info" }, 1041{ "Remove sync info","Entferne Sync Info" },
1042{ "For all profiles","Für alle Profile" }, 1042{ "For all profiles","Für alle Profile" },
1043{ "Hide not Running","Verstecke nicht Laufende" }, 1043{ "Hide not Running","Verstecke nicht Laufende" },
1044{ "ME","ME" }, 1044{ "ME","ME" },
1045{ "Toolbar","Toolbar" }, 1045{ "Toolbar","Toolbar" },
1046{ "Undo Delete...","Löschen rückgängig machen..." }, 1046{ "Undo Delete...","Löschen rückgängig machen..." },
1047{ "Undo Delete","Löschen rückgängig machen" }, 1047{ "Undo Delete","Löschen rückgängig machen" },
1048{ "KDE Sync HowTo...","KDE Sync HowTo..." }, 1048{ "KDE Sync HowTo...","KDE Sync HowTo..." },
1049{ "Multi Sync HowTo...","Multi Sync HowTo..." }, 1049{ "Multi Sync HowTo...","Multi Sync HowTo..." },
1050{ "Januar","Januar" }, 1050{ "Januar","Januar" },
1051{ "KO/Pi Keys + Colors","KO/Pi Tasten + Farben" }, 1051{ "KO/Pi Keys + Colors","KO/Pi Tasten + Farben" },
1052{ "No Filter","Kein Filter" }, 1052{ "No Filter","Kein Filter" },
1053{ "Multiple Sync options","Multi Sync Optionen" }, 1053{ "Multiple Sync options","Multi Sync Optionen" },
1054{ "Sync algo options","Sync Ablauf Optionen" }, 1054{ "Sync algo options","Sync Ablauf Optionen" },
1055{ "Apply filter when adding data to local:","Filter für das Hinzufügen von Daten zu Lokal:" }, 1055{ "Apply filter when adding data to local:","Filter für das Hinzufügen von Daten zu Lokal:" },
1056{ "Incoming calendar filter:","Eingehender Kalender Filter:" }, 1056{ "Incoming calendar filter:","Eingehender Kalender Filter:" },
1057{ "Incoming addressbook filter:","Eingehender Adressbuch Filter:" }, 1057{ "Incoming addressbook filter:","Eingehender Adressbuch Filter:" },
1058{ "Write back options","Optionen zum Zurückschreiben" }, 1058{ "Write back options","Optionen zum Zurückschreiben" },
1059{ "Write back (on remote) existing entries only","Schreibe nur existierende (auf Entfernt) Einträge zurück" }, 1059{ "Write back (on remote) existing entries only","Schreibe nur existierende (auf Entfernt) Einträge zurück" },
1060{ "Apply filter when adding data to remote:","Filter für das Hinzufügen von Daten zu Entfernt:" }, 1060{ "Apply filter when adding data to remote:","Filter für das Hinzufügen von Daten zu Entfernt:" },
1061{ "Outgoing calendar filter:","Ausgehender Kalender Filter:" }, 1061{ "Outgoing calendar filter:","Ausgehender Kalender Filter:" },
1062{ "Outgoing addressbook filter:","Ausgehender Adressbuch Filter:" }, 1062{ "Outgoing addressbook filter:","Ausgehender Adressbuch Filter:" },
1063{ "Write back (calendar) entries for time period only","Schreibe nur Kalender Einträge für Zeitspanne zurück" }, 1063{ "Write back (calendar) entries for time period only","Schreibe nur Kalender Einträge für Zeitspanne zurück" },
1064{ "Time period","Zeitspanne" }, 1064{ "Time period","Zeitspanne" },
1065{ "From ","Von " }, 1065{ "From ","Von " },
1066{ " weeks in the past to "," Wochen in der Vergangenheit bis zu " }, 1066{ " weeks in the past to "," Wochen in der Vergangenheit bis zu " },
1067{ " weeks in the future "," Wochen in der Zukunft " }, 1067{ " weeks in the future "," Wochen in der Zukunft " },
1068{ "Profile kind specific settings","Profil Art abhängige Einstellungen" }, 1068{ "Profile kind specific settings","Profil Art abhängige Einstellungen" },
1069{ "Local temp file:","Lokale temp Datei:" }, 1069{ "Local temp file:","Lokale temp Datei:" },
1070{ "Multiple profiles with same name!\nPlease use unique profile names!","Mehrere Profile mit demselben Namen!\nBitte verschiedene Namen benutzen!" }, 1070{ "Multiple profiles with same name!\nPlease use unique profile names!","Mehrere Profile mit demselben Namen!\nBitte verschiedene Namen benutzen!" },
1071{ "Aborted! Nothing synced!","Abgebrochen! Nichts wurde gesynct!" }, 1071{ "Aborted! Nothing synced!","Abgebrochen! Nichts wurde gesynct!" },
1072{ "Language","Sprache" }, 1072{ "Language","Sprache" },
1073{ "Time Format","Zeit Format" }, 1073{ "Time Format","Zeit Format" },
1074{ "Time Zone","Zeit Zone" }, 1074{ "Time Zone","Zeit Zone" },
1075{ "%1 groups subscribed","%1 Guppen abboniert" }, 1075{ "%1 groups subscribed","%1 Guppen abboniert" },
1076{ "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" }, 1076{ "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" },
1077{ "<b>New data storage dir:</b>","<b>Neues Datenspeicherverzeichnis:</b>" }, 1077{ "<b>New data storage dir:</b>","<b>Neues Datenspeicherverzeichnis:</b>" },
1078{ "New dirs are created automatically","Neue Verzeichnisse werden aut. erstellt" }, 1078{ "New dirs are created automatically","Neue Verzeichnisse werden aut. erstellt" },
1079{ "Save settings","Speichere Einstellungen" }, 1079{ "Save settings","Speichere Einstellungen" },
1080{ "Save standard","Speichere Standard" }, 1080{ "Save standard","Speichere Standard" },
1081{ "<b>New settings are used\nafter a restart</b>","<b>Neue Einstellungen werden nach\neinem Neustart genutzt</b>" }, 1081{ "<b>New settings are used\nafter a restart</b>","<b>Neue Einstellungen werden nach\neinem Neustart genutzt</b>" },
1082{ "Settings are stored in\n%1","Einstellungen werden gespeichert in:\n%1" }, 1082{ "Settings are stored in\n%1","Einstellungen werden gespeichert in:\n%1" },
1083{ "Data storage path","Daten Speicherpfad" }, 1083{ "Data storage path","Daten Speicherpfad" },
1084{ "Language","Sprache" }, 1084{ "Language","Sprache" },
1085{ "Show time in agenda items","Zeige Zeit in Agenda Items" }, 1085{ "Show time in agenda items","Zeige Zeit in Agenda Items" },
1086{ "Color for Sundays + category "Holiday"","Farbe für Sonntags + Kategorie "Feiertag"" }, 1086{ "Color for Sundays + category "Holiday"","Farbe für Sonntags + Kategorie "Feiertag"" },
1087{ "Show events that are done","Zeige abgelaufene Termine" }, 1087{ "Show events that are done","Zeige abgelaufene Termine" },
1088{ "Hide not running Todos in To-do view","Verstecke nicht laufende Todos" }, 1088{ "Hide not running Todos in To-do view","Verstecke nicht laufende Todos" },
1089{ "+01:00 Europe/Oslo(CET)","+01:00 Europe/Oslo(CET)" }, 1089{ "+01:00 Europe/Oslo(CET)","+01:00 Europe/Oslo(CET)" },
1090{ "KO/Pi","KO/Pi" }, 1090{ "KO/Pi","KO/Pi" },
1091{ "There is nothing to undo!","Es gibt nichts zum\nRückgängigmachen!" }, 1091{ "There is nothing to undo!","Es gibt nichts zum\nRückgängigmachen!" },
1092{ "Recreating edit dialog. Please wait...","Recreating edit dialog. Please wait..." }, 1092{ "Recreating edit dialog. Please wait...","Recreating edit dialog. Please wait..." },
1093{ "Sound.Al.: ","Sound.Al.: " }, 1093{ "Sound.Al.: ","Sound.Al.: " },
1094{ "From: %1 To: %2 %3","Von: %1 Bis: %2 %3" }, 1094{ "From: %1 To: %2 %3","Von: %1 Bis: %2 %3" },
1095{ "Restore","Wiederherstellen" }, 1095{ "Restore","Wiederherstellen" },
1096{ "\nAre you sure you want\nto restore this?","\nMöchten Sie das wirklich\nwiederherstellen?" }, 1096{ "\nAre you sure you want\nto restore this?","\nMöchten Sie das wirklich\nwiederherstellen?" },
1097{ "% completed","% erledigt" }, 1097{ "% completed","% erledigt" },
1098{ "%d item(s) found.","%d Item(s) gefunden." }, 1098{ "%d item(s) found.","%d Item(s) gefunden." },
1099{ "Set complete","Setze auf erledigt" }, 1099{ "Set complete","Setze auf erledigt" },
1100{ "(cancelled)","(gecancelt)" }, 1100{ "(cancelled)","(gecancelt)" },
1101{ "Click on the week number to\nshow week in agenda view","Klicke auf die Wochennummer\num die Woche in der Agenda anzuzeigen" }, 1101{ "Click on the week number to\nshow week in agenda view","Klicke auf die Wochennummer\num die Woche in der Agenda anzuzeigen" },
1102{ " Local time "," Locale Zeit " }, 1102{ " Local time "," Locale Zeit " },
1103{ "Form2","Form2" }, 1103{ "Form2","Form2" },
1104{ "Filter enabled","Filter angeschaltet" }, 1104{ "Filter enabled","Filter angeschaltet" },
1105{ "Edit Filters","Ändere Filter" }, 1105{ "Edit Filters","Ändere Filter" },
1106{ "Print What's Next View...","Drucke What's Next Ansicht..." }, 1106{ "Print What's Next View...","Drucke What's Next Ansicht..." },
1107{ "Agenda","Agenda" }, 1107{ "Agenda","Agenda" },
1108{ " ("," (" }, 1108{ " ("," (" },
1109{ "<p><b>Due on:</b> %1</p>","<p><b>Fällig am:</b> %1</p>" }, 1109{ "<p><b>Due on:</b> %1</p>","<p><b>Fällig am:</b> %1</p>" },
1110{ "Print","Print" }, 1110{ "Print","Print" },
1111{ "&Setup Printer...","Drucker &Setup..." }, 1111{ "&Setup Printer...","Drucker &Setup..." },
1112{ "View Type","Zeige Typ" }, 1112{ "View Type","Zeige Typ" },
1113{ "Page &orientation:","Seiten Ausrichtung:" }, 1113{ "Page &orientation:","Seiten Ausrichtung:" },
1114{ "Use Default of Selected Style","Default des selektierten Stils" }, 1114{ "Use Default of Selected Style","Default des selektierten Stils" },
1115{ "Use Default Setting of Printer","Default Einstellung des Druckers" }, 1115{ "Use Default Setting of Printer","Default Einstellung des Druckers" },
1116{ "Portrait","Portrait" }, 1116{ "Portrait","Portrait" },
1117{ "Landscape","Landschaft" }, 1117{ "Landscape","Landschaft" },
1118{ "Print day","Drucke Tag" }, 1118{ "Print day","Drucke Tag" },
1119{ "CalPrintDay_Base","CalPrintDay_Base" }, 1119{ "CalPrintDay_Base","CalPrintDay_Base" },
1120{ "Date && Time Range","Datum && Zeitspanne" }, 1120{ "Date && Time Range","Datum && Zeitspanne" },
1121{ "&End date:","&Enddatum:" }, 1121{ "&End date:","&Enddatum:" },
1122{ "&Start date:","&Startdatum:" }, 1122{ "&Start date:","&Startdatum:" },
1123{ "Start &time:","Startzeit:" }, 1123{ "Start &time:","Startzeit:" },
1124{ "End ti&me:","Endzeit:" }, 1124{ "End ti&me:","Endzeit:" },
1125{ "E&xtend time range to include all events","Erweitere Zeitspanne um alle Termine einzuschliessen" }, 1125{ "E&xtend time range to include all events","Erweitere Zeitspanne um alle Termine einzuschliessen" },
1126{ "Include to&dos that are due on the printed day(s)","Inclusive To&dos, die an den selektierten Tagen fällig sind" }, 1126{ "Include to&dos that are due on the printed day(s)","Inclusive To&dos, die an den selektierten Tagen fällig sind" },
1127{ "Alt+D","Alt+D" }, 1127{ "Alt+D","Alt+D" },
1128{ "&Use colors","Nutze Farben" }, 1128{ "&Use colors","Nutze Farben" },
1129{ "Alt+U","Alt+U" }, 1129{ "Alt+U","Alt+U" },
1130{ "Print week","Drucke Woche" }, 1130{ "Print week","Drucke Woche" },
1131{ "CalPrintWeek_Base","CalPrintWeek_Base" }, 1131{ "CalPrintWeek_Base","CalPrintWeek_Base" },
1132{ "Use &colors","Nutze Farben" }, 1132{ "Use &colors","Nutze Farben" },
1133{ "Type of View","Typ der Ansicht" }, 1133{ "Type of View","Typ der Ansicht" },
1134{ "Print as &Filofax page","Drucke als &Filofax Seite" }, 1134{ "Print as &Filofax page","Drucke als &Filofax Seite" },
1135{ "Alt+F","Alt+F" }, 1135{ "Alt+F","Alt+F" },
1136{ "Print as &timetable view:","Drucke als Zeittabelle:" }, 1136{ "Print as &timetable view:","Drucke als Zeittabelle:" },
1137{ "Alt+T","Alt+T" }, 1137{ "Alt+T","Alt+T" },
1138{ "Print as split week view","Drucke als gesplittete Wochenansicht" }, 1138{ "Print as split week view","Drucke als gesplittete Wochenansicht" },
1139{ "Print month","Drucke Monat" }, 1139{ "Print month","Drucke Monat" },
1140{ "CalPrintMonth_Base","CalPrintMonth_Base" }, 1140{ "CalPrintMonth_Base","CalPrintMonth_Base" },
1141{ "&Start month:","&Startmonat:" }, 1141{ "&Start month:","&Startmonat:" },
1142{ "&End month:","&Endmonat:" }, 1142{ "&End month:","&Endmonat:" },
1143{ "Print week &numbers","Drucke Wochen Nummer(n)" }, 1143{ "Print week &numbers","Drucke Wochen Nummer(n)" },
1144{ "Print todos","Drucke Todos" }, 1144{ "Print todos","Drucke Todos" },
1145{ "CalPrintTodoConfig_Base","CalPrintTodoConfig_Base" }, 1145{ "CalPrintTodoConfig_Base","CalPrintTodoConfig_Base" },
1146{ "Include &description of the item","Inclusive Itembeschreibung" }, 1146{ "Include &description of the item","Inclusive Itembeschreibung" },
1147{ "Include d&ue date of the item","Inclusive Fälligkeitsdatum des Items" }, 1147{ "Include d&ue date of the item","Inclusive Fälligkeitsdatum des Items" },
1148{ "Include &priority of the item","Inclusive Priorität des Items" }, 1148{ "Include &priority of the item","Inclusive Priorität des Items" },
1149{ "Items to Print","Zu druckende Items" }, 1149{ "Items to Print","Zu druckende Items" },
1150{ "&From:","Von:" }, 1150{ "&From:","Von:" },
1151{ "&To:","Bis:" }, 1151{ "&To:","Bis:" },
1152{ "Print &all todo items","Drucke alle Todo Items" }, 1152{ "Print &all todo items","Drucke alle Todo Items" },
1153{ "Print only &uncompleted items","Drucke nur nicht erledigte Todos" }, 1153{ "Print only &uncompleted items","Drucke nur nicht erledigte Todos" },
1154{ "Only items due in the &range:","Nur Items in dem Zeitraum:" }, 1154{ "Only items due in the &range:","Nur Items in dem Zeitraum:" },
1155{ "Todo List","Todo Liste" }, 1155{ "Todo List","Todo Liste" },
1156{ "&Title:","&Titel:" }, 1156{ "&Title:","&Titel:" },
1157{ "Co&nnect subtodos with its parent","Verbinde Untertodos mit ihren Ober-Todos" }, 1157{ "Co&nnect subtodos with its parent","Verbinde Untertodos mit ihren Ober-Todos" },
1158{ "Todo list","Todo Liste" }, 1158{ "Todo list","Todo Liste" },
1159{ "&Print...","Drucke..." }, 1159{ "&Print...","Drucke..." },
1160{ "<qt>Printing on printer <b>%1</b></qt>","<qt>Drucke auf Drucker <b>%1</b></qt>" }, 1160{ "<qt>Printing on printer <b>%1</b></qt>","<qt>Drucke auf Drucker <b>%1</b></qt>" },
1161{ "[Unconfigured]","[Unkonfiguriert]" }, 1161{ "[Unconfigured]","[Unkonfiguriert]" },
1162{ "OK","OK" }, 1162{ "OK","OK" },
1163{ "FilterEditor","FilterEditor" }, 1163{ "FilterEditor","FilterEditor" },
1164{ "Include","Inclusive" }, 1164{ "Include","Inclusive" },
1165{ "Exclude","Exclusive" }, 1165{ "Exclude","Exclusive" },
1166{ "Edit Selection...","Editiere Auswahl" }, 1166{ "Edit Selection...","Editiere Auswahl" },
1167{ "recurring events","wiederholende Termine" }, 1167{ "recurring events","wiederholende Termine" },
1168{ "recurr. events","wiederh.Termine" }, 1168{ "recurr. events","wiederh.Termine" },
1169{ "completed to-dos","erledigte Todos" }, 1169{ "completed to-dos","erledigte Todos" },
1170{ "events","Termine" }, 1170{ "events","Termine" },
1171{ "todos","Todos" }, 1171{ "todos","Todos" },
1172{ "journals","Journale" }, 1172{ "journals","Journale" },
1173{ "public","öffentl." }, 1173{ "public","öffentl." },
1174{ "private","privat" }, 1174{ "private","privat" },
1175{ "confidential","vertraul." }, 1175{ "confidential","vertraul." },
1176{ "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Untertodos.\nAlle erledigten Untertodos\nwerden auch gelöscht!" }, 1176{ "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Untertodos.\nAlle erledigten Untertodos\nwerden auch gelöscht!" },
1177{ "Yesterday","Gestern" }, 1177{ "Yesterday","Gestern" },
1178{ "Day after tomorrow","Übermorgen" }, 1178{ "Day after tomorrow","Übermorgen" },
1179{ "Tomorrow","Morgen" }, 1179{ "Tomorrow","Morgen" },
1180{ "Day before yesterday","Vorgestern" }, 1180{ "Day before yesterday","Vorgestern" },
1181{ "Size %1","Größe %1" }, 1181{ "Size %1","Größe %1" },
1182{ "New Agendasize: %1","Neue Agendagröße: %1" }, 1182{ "New Agendasize: %1","Neue Agendagröße: %1" },
1183{ " (%1 y.)"," (%1 J.)" }, 1183{ " (%1 y.)"," (%1 J.)" },
1184{ "Allday:","Ganztägig:" }, 1184{ "Allday:","Ganztägig:" },
1185{ "compl.todos","erled.Todos" }, 1185{ "compl.todos","erled.Todos" },
1186{ "Day view","Tagesansicht" }, 1186{ "Day view","Tagesansicht" },
1187{ "Next days","Nächste Tage" }, 1187{ "Next days","Nächste Tage" },
1188{ "Next week","Nächste Woche" }, 1188{ "Next week","Nächste Woche" },
1189{ "Next two weeks","Nächste zwei Wochen" }, 1189{ "Next two weeks","Nächste zwei Wochen" },
1190{ "This month","Dieser Monat" }, 1190{ "This month","Dieser Monat" },
1191{ "Journal view","Journal" }, 1191{ "Journal view","Journal" },
1192{ "Display all opened","Zeige alle geöffnet" }, 1192{ "Display all opened","Zeige alle geöffnet" },
1193{ "Display all closed","Zeige alle geschlossen" }, 1193{ "Display all closed","Zeige alle geschlossen" },
1194{ "Display all flat","Zeige alle flach" }, 1194{ "Display all flat","Zeige alle flach" },
1195{ "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" }, 1195{ "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" },
1196{ "Default todo done color:","Standard Todo erledigt Farbe" }, 1196{ "Default todo done color:","Standard Todo erledigt Farbe" },
1197{ "Select week %1-%2","Wähle Woche %1-%2" }, 1197{ "Select week %1-%2","Wähle Woche %1-%2" },
1198{ "Select Week","Wähle Woche" }, 1198{ "Select Week","Wähle Woche" },
1199{ "Set alarm for selected...","Setze Alarm für Selekt..." }, 1199{ "Set alarm for selected...","Setze Alarm für Selekt..." },
1200{ "Set Alarm!","Setze Alarm!" }, 1200{ "Set Alarm!","Setze Alarm!" },
1201{ "Changed alarm for %1 items","Alarm für %1 Items geändert" }, 1201{ "Changed alarm for %1 items","Alarm für %1 Items geändert" },
1202{ " and "," und " }, 1202{ " and "," und " },
1203{ "<IMG src="%1"> only )","nur <IMG src="%1"> )" }, 1203{ "<IMG src="%1"> only )","nur <IMG src="%1"> )" },
1204{ "Mail to selected","Mail an Ausgewählte" }, 1204{ "Mail to selected","Mail an Ausgewählte" },
1205{ "Mail to all","Mail an Alle" }, 1205{ "Mail to all","Mail an Alle" },
1206{ "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" }, 1206{ "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" },
1207{ "Set reminder ON with offset to:","Alarm AN mit Offset auf:" }, 1207{ "Set reminder ON with offset to:","Alarm AN mit Offset auf:" },
1208{ " on"," am" }, 1208{ " on"," am" },
1209{ " completed on "," erledigt am " }, 1209{ " completed on "," erledigt am " },
1210{ "Save as Event template","Speichere als Vorlage" }, 1210{ "Save as Event template","Speichere als Vorlage" },
1211{ "Load Event template","Lade Termin Vorlage" }, 1211{ "Load Event template","Lade Termin Vorlage" },
1212{ "Save as Journal template","Speichere als Journal Vorlage" }, 1212{ "Save as Journal template","Speichere als Journal Vorlage" },
1213{ "Insert Journal template","Füge Journal Vorlage ein" }, 1213{ "Insert Journal template","Füge Journal Vorlage ein" },
1214{ "Sub todos:<br>","Unter Todos:<br>" }, 1214{ "Sub todos:<br>","Unter Todos:<br>" },
1215{ "Parent todo:<br>","Über Todo:<br>" }, 1215{ "Parent todo:<br>","Über Todo:<br>" },
1216{ "Set current as color category","Setze Gewählte als Farbkategorie" }, 1216{ "Set current as color category","Setze Gewählte als Farbkategorie" },
1217{ " completed"," erledigt" }, 1217{ " completed"," erledigt" },
1218{ "(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.info --- 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.info --- www.korganizer.org\nBesonderen Dank an Michael und Ben\nfür intensives Testen!" }, 1218{ "(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.info --- 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.info --- www.korganizer.org\nBesonderen Dank an Michael und Ben\nfür intensives Testen!" },
1219{ "Syncing aborted. Nothing synced.","Syncing abgebrochen.Nichts wurde gesynct." }, 1219{ "Syncing aborted. Nothing synced.","Syncing abgebrochen.Nichts wurde gesynct." },
1220{ "Connected! Sending request for remote file ...","Verbunden! Sende Daten Anfrage..." }, 1220{ "Connected! Sending request for remote file ...","Verbunden! Sende Daten Anfrage..." },
1221{ "Trying to connect to remote...","Versuche mit Gegenstelle zu verbinden..." }, 1221{ "Trying to connect to remote...","Versuche mit Gegenstelle zu verbinden..." },
1222{ "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?" }, 1222{ "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?" },
1223{ "ERROR: Receiving remote file failed.","FEHLER: Empfang der entfernten Daten fehlgeschlagen." }, 1223{ "ERROR: Receiving remote file failed.","FEHLER: Empfang der entfernten Daten fehlgeschlagen." },
1224{ "Error","Fehler" }, 1224{ "Error","Fehler" },
1225{ ""You entered an invalid date!\n Date changed to current date.","Ungültiges Datum eingegeben.\nSetze heutiges Datum." }, 1225{ ""You entered an invalid date!\n Date changed to current date.","Ungültiges Datum eingegeben.\nSetze heutiges Datum." },
1226{ "You entered an invalid date!\n Will use current date instead.","Ungültiges Datum eingegeben.\nSetze stattdessen heutiges Datum." }, 1226{ "You entered an invalid date!\n Will use current date instead.","Ungültiges Datum eingegeben.\nSetze stattdessen heutiges Datum." },
1227{ "Warning","Warnung" }, 1227{ "Warning","Warnung" },
1228{ "Select week number","Wähle Wochen Nummer" }, 1228{ "Select week number","Wähle Wochen Nummer" },
1229{ "Februar","Februar" }, 1229{ "Februar","Februar" },
1230{ "Click on the week number to\nshow week zoomed","Klicke auf die Wochennummer\num die Woche groß zu zeigen" }, 1230{ "Click on the week number to\nshow week zoomed","Klicke auf die Wochennummer\num die Woche groß zu zeigen" },
1231{ "W","W" }, 1231{ "W","W" },
1232{ "Click on this to\nselect week number","Klicke hierauf um\ndie Woche auszuwählen" }, 1232{ "Click on this to\nselect week number","Klicke hierauf um\ndie Woche auszuwählen" },
1233{ "T: %1","T: %1" }, 1233{ "T: %1","T: %1" },
1234{ "Start: ","Start: " }, 1234{ "Start: ","Start: " },
1235{ "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " }, 1235{ "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " },
1236{ "Password for remote access:","Passwort für fernen Zugriff:" }, 1236{ "Password for remote access:","Passwort für fernen Zugriff:" },
1237{ "Remote IP address:","Ferne IP Adresse:" }, 1237{ "Remote IP address:","Ferne IP Adresse:" },
1238{ "Remote port number:","Ferne Port Nummer:" }, 1238{ "Remote port number:","Ferne Port Nummer:" },
1239{ "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." }, 1239{ "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." },
1240{ "Remote from: ","Fern von: " }, 1240{ "Remote from: ","Fern von: " },
1241{ "Local from: ","Lokal von: " }, 1241{ "Local from: ","Lokal von: " },
1242{ "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" }, 1242{ "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" },
1243{ "Local calendar changed!\n","Lokaler Kalender geändert!\n" }, 1243{ "Local calendar changed!\n","Lokaler Kalender geändert!\n" },
1244{ "Write back","Schreibe zurück" }, 1244{ "Write back","Schreibe zurück" },
1245{ "KO/Pi Synchronization","KO/Pi Synchronisation" }, 1245{ "KO/Pi Synchronization","KO/Pi Synchronisation" },
1246{ "Pi-Sync succesful!","Pi-Sync erfolgreich!" }, 1246{ "Pi-Sync succesful!","Pi-Sync erfolgreich!" },
1247{ "Received sync request","Sync Anfrage erhalten" }, 1247{ "Received sync request","Sync Anfrage erhalten" },
1248{ "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." }, 1248{ "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." },
1249{ "Saving Data to temp file ...","Speichere Daten in temp Datei..." }, 1249{ "Saving Data to temp file ...","Speichere Daten in temp Datei..." },
1250{ "Data saved to temp file!","Daten in temp Datei gespeichert!" }, 1250{ "Data saved to temp file!","Daten in temp Datei gespeichert!" },
1251{ "Sending file...","Sende Datei..." }, 1251{ "Sending file...","Sende Datei..." },
1252{ "Waiting for synced file...","Warte auf gesyncte Daten..." }, 1252{ "Waiting for synced file...","Warte auf gesyncte Daten..." },
1253{ "Receiving synced file...","Gesyncte Daten erhalten..." }, 1253{ "Receiving synced file...","Gesyncte Daten erhalten..." },
1254{ "Received %1 bytes","%1 Bytes erhalten" }, 1254{ "Received %1 bytes","%1 Bytes erhalten" },
1255{ "Writing file to disk...","Speichere Datei..." }, 1255{ "Writing file to disk...","Speichere Datei..." },
1256{ "Pi-Sync successful!","Pi-Sync erfolgreich!" }, 1256{ "Pi-Sync successful!","Pi-Sync erfolgreich!" },
1257{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" }, 1257{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" },
1258{ "Synchronize!","Synchronisiere!" }, 1258{ "Synchronize!","Synchronisiere!" },
1259{ "High clock skew!","Großer Uhrzeitunterschied!" }, 1259{ "High clock skew!","Großer Uhrzeitunterschied!" },
1260{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" }, 1260{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" },
1261{ "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!" }, 1261{ "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!" },
1262{ "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." }, 1262{ "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." },
1263{ "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" }, 1263{ "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" },
1264{ "List week view","Listenwochenansicht" }, 1264{ "List week view","Listenwochenansicht" },
1265{ "List week","Listenwochenansicht" }, 1265{ "List week","Listenwochenansicht" },
1266{ "Next Week","Nächste Woche" }, 1266{ "Next Week","Nächste Woche" },
1267{ "Previous Week","Vorherige Woche" }, 1267{ "Previous Week","Vorherige Woche" },
1268{ "No items were found matching\nyour search expression.\nUse the wildcard characters\n'*' and '?' where needed.","Keine Einträge gefunden die\ndem Suchausdruck entsprechen.\nBenutze Platzhalter Zeichen\n'*' und '?' wo benötigt." }, 1268{ "No items were found matching\nyour search expression.\nUse the wildcard characters\n'*' and '?' where needed.","Keine Einträge gefunden die\ndem Suchausdruck entsprechen.\nBenutze Platzhalter Zeichen\n'*' und '?' wo benötigt." },
1269{ "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" }, 1269{ "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" },
1270{ "Details","Details" }, 1270{ "Details","Details" },
1271{ "Created time","Erstellt Zeit" }, 1271{ "Created time","Erstellt Zeit" },
1272{ "Last modified time","Geändert Zeit" }, 1272{ "Last modified time","Geändert Zeit" },
1273{ "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" }, 1273{ "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" },
1274{ "View Options","Anzeige Optionen" }, 1274{ "View Options","Anzeige Optionen" },
1275{ "<b>Created: ","<b>Erstellt am: " }, 1275{ "<b>Created: ","<b>Erstellt am: " },
1276{ "<b>Last modified: ","<b>Zuletzt geändert am: " }, 1276{ "<b>Last modified: ","<b>Zuletzt geändert am: " },
1277{ "Journal: ","Journal: " }, 1277{ "Journal: ","Journal: " },
1278{ "yearly","jährlich" }, 1278{ "yearly","jährlich" },
1279{ "(%1) ","%1-" }, 1279{ "(%1) ","%1-" },
1280{ "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" }, 1280{ "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" },
1281{ "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" }, 1281{ "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" },
1282{ "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" }, 1282{ "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" },
1283{ "Summary/Loc.","Titel/Ort" }, 1283{ "Summary/Loc.","Titel/Ort" },
1284{ "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." }, 1284{ "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." },
1285{ "Week Number","Wochennummer" }, 1285{ "Week Number","Wochennummer" },
1286{ "Import","Importiere" }, 1286{ "Import","Importiere" },
1287{ "Export","Exportiere" }, 1287{ "Export","Exportiere" },
1288{ "Beam","Beame" }, 1288{ "Beam","Beame" },
1289{ "Export selected","Exportiere Selektierte" }, 1289{ "Export selected","Exportiere Selektierte" },
1290{ "As iCal (ics) file...","Als iCal (ics) Datei..." }, 1290{ "As iCal (ics) file...","Als iCal (ics) Datei..." },
1291{ "As vCal (vcs) file...","Als vCal (vcs) Datei..." }, 1291{ "As vCal (vcs) file...","Als vCal (vcs) Datei..." },
1292{ "Journal/Details...","Journale/Details..." }, 1292{ "Journal/Details...","Journale/Details..." },
1293{ "Agenda View","Agenda Ansicht" }, 1293{ "Agenda View","Agenda Ansicht" },
1294{ "Show current time","Zeige aktuelle Zeit" }, 1294{ "Show current time","Zeige aktuelle Zeit" },
1295{ "Edit new item","Bearbeite neuen Eintrag" }, 1295{ "Edit new item","Bearbeite neuen Eintrag" },
1296{ "Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals","Bitte wählen Sie mindestens\neinen dieser Typen\num darin zu suchen:\n\nTermine\nTodos\nJournale" }, 1296{ "Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals","Bitte wählen Sie mindestens\neinen dieser Typen\num darin zu suchen:\n\nTermine\nTodos\nJournale" },
1297{ "There is no next alarm.","Es gibt keinen nächsten Alarm." }, 1297{ "There is no next alarm.","Es gibt keinen nächsten Alarm." },
1298{ "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" }, 1298{ "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" },
1299{ "The next alarm is in:\n","Der nächste Alarm ist in:\n" }, 1299{ "The next alarm is in:\n","Der nächste Alarm ist in:\n" },
1300{ "%1 days\n","%1 Tagen\n" }, 1300{ "%1 days\n","%1 Tagen\n" },
1301{ "1 day\n","1 Tag\n" }, 1301{ "1 day\n","1 Tag\n" },
1302{ "%1 hours\n","%1 Stunden\n" }, 1302{ "%1 hours\n","%1 Stunden\n" },
1303{ "1 hour\n","1 Stunde\n" }, 1303{ "1 hour\n","1 Stunde\n" },
1304{ "%1 minutes\n","%1 Minuten\n" }, 1304{ "%1 minutes\n","%1 Minuten\n" },
1305{ "1 minute\n","1 Minute\n" }, 1305{ "1 minute\n","1 Minute\n" },
1306{ "Only one toolbar","Nur eine Toolbar" }, 1306{ "Only one toolbar","Nur eine Toolbar" },
1307{ "Print","Drucke" }, 1307{ "Print","Drucke" },
1308{ "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." }, 1308{ "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." },
1309{ "There is nothing selected!","Es ist nichts ausgewählt!" }, 1309{ "There is nothing selected!","Es ist nichts ausgewählt!" },
1310{ "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " }, 1310{ "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " },
1311{ "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" }, 1311{ "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" },
1312{ "This prints the view as you see it.\n(With the complete content, of course.)\nYou may change the print layout by resizing the view.\nPrint unscaled may print several pages\ndepending on the amount of data.\nPrint scaled down will print all on one page.\nPrint scaled up/down will print all on one page,\nbut will scale up the text to page boundaries,\nif the text is smaller than the page.\nYou can select page geometry setup in the next dialog.\n","Dies druckt die Ansicht wie man sie sieht.\n(Mit dem kompletten Inhalt natürlich.)\nMan kann das Layout ändern durch ändern der Fenstergröße.\nDrucke unskaliert druckt ggf. mehrere Seiten\nabhängig von der Menge der Daten.\nDrucke runterskaliert um auf eine Seite zu passen\ndruckt alles auf eine Seite.\nDrucke hoch/runterskaliert um genau auf eine Seite zu passen\nvergrößert den Text gegebenenfalls.\nDas Seitenlayout kann im nächsten Dialog gewählt werden.\n" }, 1312{ "This prints the view as you see it.\n(With the complete content, of course.)\nYou may change the print layout by resizing the view.\nPrint unscaled may print several pages\ndepending on the amount of data.\nPrint scaled down will print all on one page.\nPrint scaled up/down will print all on one page,\nbut will scale up the text to page boundaries,\nif the text is smaller than the page.\nYou can select page geometry setup in the next dialog.\n","Dies druckt die Ansicht wie man sie sieht.\n(Mit dem kompletten Inhalt natürlich.)\nMan kann das Layout ändern durch ändern der Fenstergröße.\nDrucke unskaliert druckt ggf. mehrere Seiten\nabhängig von der Menge der Daten.\nDrucke runterskaliert um auf eine Seite zu passen\ndruckt alles auf eine Seite.\nDrucke hoch/runterskaliert um genau auf eine Seite zu passen\nvergrößert den Text gegebenenfalls.\nDas Seitenlayout kann im nächsten Dialog gewählt werden.\n" },
1313{ "KO/Pi Printout","KO/Pi Ausdruck" }, 1313{ "KO/Pi Printout","KO/Pi Ausdruck" },
1314{ "Print unscaled","Drucke unskaliert" }, 1314{ "Print unscaled","Drucke unskaliert" },
1315{ "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." }, 1315{ "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." },
1316{ "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." }, 1316{ "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." },
1317{ "Printout Mode","Druck Modus" }, 1317{ "Printout Mode","Druck Modus" },
1318{ "Filter menu icon","Filtermenu Icon" }, 1318{ "Filter menu icon","Filtermenu Icon" },
1319{ "<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n","<p><b>A+(shift oder ctrl)</b>: Zeige Zeit bis zum nächsten Alarm</p>\n" }, 1319{ "<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n","<p><b>A+(shift oder ctrl)</b>: Zeige Zeit bis zum nächsten Alarm</p>\n" },
1320{ "<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n","<p><b>N</b>: Wechsle zur nächsten Ansicht, die ein Icon in der Toolbar hat</p>\n" }, 1320{ "<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n","<p><b>N</b>: Wechsle zur nächsten Ansicht, die ein Icon in der Toolbar hat</p>\n" },
1321{ "%1d","%1t" }, 1321{ "%1d","%1t" },
1322{ "%1h","%1std" }, 1322{ "%1h","%1std" },
1323{ "%1min","%1min" }, 1323{ "%1min","%1min" },
1324{ "( %1 before )","( %1 vorher )" }, 1324{ "( %1 before )","( %1 vorher )" },
1325{ "The next alarm is in\nless than one minute!","Der nächste Alarm kommt in\nweniger als einer Minute!" }, 1325{ "The next alarm is in\nless than one minute!","Der nächste Alarm kommt in\nweniger als einer Minute!" },
1326{ "\nThe internal alarm notification is disabled!\n","\nDie interne Alarmbenachrichtigung ist ausgeschaltet!\n" }, 1326{ "\nThe internal alarm notification is disabled!\n","\nDie interne Alarmbenachrichtigung ist ausgeschaltet!\n" },
1327{ "Enable it in the settings menu, TAB alarm.","Schalten Sie sie an im Menu Einstellungen, TAB Alarm." }, 1327{ "Enable it in the settings menu, TAB alarm.","Schalten Sie sie an im Menu Einstellungen, TAB Alarm." },
1328{ "Show Sync Events","Zeige Sync-Ereignisse" }, 1328{ "Show Sync Events","Zeige Sync-Ereignisse" },
1329{ "Use short date in WN+Event view","Zeige Kurzdatum in WN+Terminanzeige" }, 1329{ "Use short date in WN+Event view","Zeige Kurzdatum in WN+Terminanzeige" },
1330{ "Number of max.displayed todo prios:","Anzahl max.angezeigter Todo-Prios:" }, 1330{ "Number of max.displayed todo prios:","Anzahl max.angezeigter Todo-Prios:" },
1331{ " on "," am " }, 1331{ " on "," am " },
1332{ "On: ","Am: " }, 1332{ "On: ","Am: " },
1333{ "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" }, 1333{ "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" },
1334{ "Start/Stop todo...","Starte/Stoppe Todo..." }, 1334{ "Start/Stop todo...","Starte/Stoppe Todo..." },
1335{ "Color for running todos:","Farbe für laufende Todos:" }, 1335{ "Color for running todos:","Farbe für laufende Todos:" },
1336{ "The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?","Das Todo\n%1\nist gestartet.\nWollen Sie es\nauf gestoppt setzen?" }, 1336{ "The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?","Das Todo\n%1\nist gestartet.\nWollen Sie es\nauf gestoppt setzen?" },
1337{ "Todo is started","Todo ist gestartet" }, 1337{ "Todo is started","Todo ist gestartet" },
1338{ "Stop todo","Stoppe Todo" }, 1338{ "Stop todo","Stoppe Todo" },
1339{ "Todo is stopped","Todo ist gestoppt" }, 1339{ "Todo is stopped","Todo ist gestoppt" },
1340{ "Start todo","Starte Todo" }, 1340{ "Start todo","Starte Todo" },
1341{ "The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?","Das Todo\n%1\nist gestoppt.\nWollen Sie es auf\ngestartet setzen?" }, 1341{ "The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?","Das Todo\n%1\nist gestoppt.\nWollen Sie es auf\ngestartet setzen?" },
1342{ "The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?","Das Todo\n%1\nwird geklont!\nEs hat Untertodos!\nMöchten Sie alle\nUntertodos auch klonen?" }, 1342{ "The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?","Das Todo\n%1\nwird geklont!\nEs hat Untertodos!\nMöchten Sie alle\nUntertodos auch klonen?" },
1343{ "Todo has subtodos","Todo hat Untertodos" }, 1343{ "Todo has subtodos","Todo hat Untertodos" },
1344{ "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" }, 1344{ "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" },
1345{ "Colors","Farben" }, 1345{ "Colors","Farben" },
1346{ "Click on new parent item","Klicke auf neues Übertodo" }, 1346{ "Click on new parent item","Klicke auf neues Übertodo" },
1347{ "Reparenting aborted!","Übertodo setzen abgebrochen" }, 1347{ "Reparenting aborted!","Übertodo setzen abgebrochen" },
1348{ "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" }, 1348{ "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" },
1349{ "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" }, 1349{ "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" },
1350{ "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" }, 1350{ "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" },
1351{ "Alternating background of list views","Abwechselnder Hintergrund für Listen" }, 1351{ "Alternating background of list views","Abwechselnder Hintergrund für Listen" },
1352{ "times","Zeiten" }, 1352{ "times","Zeiten" },
1353{ "The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?","Das Todo\n%1\nhat Untertodos!\nMöchten Sie die Kategorien\nauch für alle Untertodos setzen?" }, 1353{ "The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?","Das Todo\n%1\nhat Untertodos!\nMöchten Sie die Kategorien\nauch für alle Untertodos setzen?" },
1354{ "Backup enabled","Backup angeschaltet" }, 1354{ "Backup enabled","Backup angeschaltet" },
1355{ "Use standard backup dir","Standard Backupverzeichnis" }, 1355{ "Use standard backup dir","Standard Backupverzeichnis" },
1356{ "Number of Backups:","Anzahl der Backups" }, 1356{ "Number of Backups:","Anzahl der Backups" },
1357{ "Make backup every ","Mache ein Backup alle " }, 1357{ "Make backup every ","Mache ein Backup alle " },
1358{ " days"," Tage" }, 1358{ " days"," Tage" },
1359{ "Creating backup ... please wait ...","Erstelle Backup ... bitte warten ..." }, 1359{ "Creating backup ... please wait ...","Erstelle Backup ... bitte warten ..." },
1360{ "Backup Failed!","Backup Problem!" }, 1360{ "Backup Failed!","Backup Problem!" },
1361{ "Try again now","Versuche jetzt nochmal" }, 1361{ "Try again now","Versuche jetzt nochmal" },
1362{ "Try again later","Versuche später nochmal" }, 1362{ "Try again later","Versuche später nochmal" },
1363{ "Try again tomorrow","Versuche morgen nochmal" }, 1363{ "Try again tomorrow","Versuche morgen nochmal" },
1364{ "Disable backup","Schalte Backup ab" }, 1364{ "Disable backup","Schalte Backup ab" },
1365{ "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" }, 1365{ "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" },
1366{ "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" }, 1366{ "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" },
1367{ "Choose action","Wähle Aktion" }, 1367{ "Choose action","Wähle Aktion" },
1368{ "Comment for todo:","Kommentar zum Todo:" }, 1368{ "Comment for todo:","Kommentar zum Todo:" },
1369{ "Stop+note","Stop+Notiz" }, 1369{ "Stop+note","Stop+Notiz" },
1370{ "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" }, 1370{ "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" },
1371{ "KO/Pi: Missing alarms!","KO/Pi: Verpasste Alarme!" }, 1371{ "KO/Pi: Missing alarms!","KO/Pi: Verpasste Alarme!" },
1372{ "You missed the alarms for the following events or todos:","Sie verpassten die Alarme für folgende Termine oder Todos:" }, 1372{ "You missed the alarms for the following events or todos:","Sie verpassten die Alarme für folgende Termine oder Todos:" },
1373{ "Print complete list","Drucke komplette Liste" }, 1373{ "Print complete list","Drucke komplette Liste" },
1374{ "Hide all selected","Verstecke Selektierte" }, 1374{ "Hide all selected","Verstecke Selektierte" },
1375{ "Add items","hinzufügen" }, 1375{ "Add items","hinzufügen" },
1376{ "One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?","Ein (oder mehrere) ausgewähltes\nTodo hat Untertodos!\nMöchten Sie der Auswahlliste\nalle Untertodos von allen\nausgewählten Todos hinzufügen?" }, 1376{ "One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?","Ein (oder mehrere) ausgewähltes\nTodo hat Untertodos!\nMöchten Sie der Auswahlliste\nalle Untertodos von allen\nausgewählten Todos hinzufügen?" },
1377{ "Print List View...","Drucke Listenansicht..." }, 1377{ "Print List View...","Drucke Listenansicht..." },
1378{ "You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items.","Sie können die <b>Listenansicht</b> und die Listenansicht im <b>Suchdialog</b> ausdrucken! Um das zu machen gehen Sie bitte zur <b>Listenansicht</b> oder zum <b>Suchdialog</b>. Rechtsklicken Sie auf die Liste. Wählen Sie im Popupmenu den Eintrag <b>Drucke komplette Liste</b>. Das druckt die Liste so, wie man sie sieht. Sie können Listeneinträge entfernen ohne die korrespondierenden Ereignisse/Todos zu löschen! Selektieren sie einfach alle Einträge, die sie nicht ausdrucken möchten. Dann Rechtsklicken Sie auf einen Eintrag und wählen <b>Verstecke Selektierte</b>. Danach können Sie die Liste ohne diese Einträge ausdrucken." }, 1378{ "You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items.","Sie können die <b>Listenansicht</b> und die Listenansicht im <b>Suchdialog</b> ausdrucken! Um das zu machen gehen Sie bitte zur <b>Listenansicht</b> oder zum <b>Suchdialog</b>. Rechtsklicken Sie auf die Liste. Wählen Sie im Popupmenu den Eintrag <b>Drucke komplette Liste</b>. Das druckt die Liste so, wie man sie sieht. Sie können Listeneinträge entfernen ohne die korrespondierenden Ereignisse/Todos zu löschen! Selektieren sie einfach alle Einträge, die sie nicht ausdrucken möchten. Dann Rechtsklicken Sie auf einen Eintrag und wählen <b>Verstecke Selektierte</b>. Danach können Sie die Liste ohne diese Einträge ausdrucken." },
1379{ "Configure KO/Pi...","Konfiguriere KO/Pi..." }, 1379{ "Configure KO/Pi...","Konfiguriere KO/Pi..." },
1380{ "Global Settings...","Globale Einstellungen..." }, 1380{ "Global Settings...","Globale Einstellungen..." },
1381{ "<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n","<p><b>R</b>: Zeige Resource Ansicht | <b>F</b>: Editiere Filter </p>\n" }, 1381{ "<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n","<p><b>R</b>: Zeige Resource Ansicht | <b>F</b>: Editiere Filter </p>\n" },
1382{ "(disabled)","(abgeschaltet)" }, 1382{ "(disabled)","(abgeschaltet)" },
1383{ "New Calendar","Neuer Kalender" }, 1383{ "New Calendar","Neuer Kalender" },
1384{ "Calendar","Kalender" }, 1384{ "Calendar","Kalender" },
1385{ "Filter selector","Filterauswahl" }, 1385{ "Filter selector","Filterauswahl" },
1386{ "Filtermenu","Filtermenu" }, 1386{ "Filtermenu","Filtermenu" },
1387{ "Toggle Fullscreen","Vollbild umschalten" }, 1387{ "Toggle Fullscreen","Vollbild umschalten" },
1388{ "Toggle Resource View","Resourcenansicht umschalten" }, 1388{ "Toggle Resource View","Resourcenansicht umschalten" },
1389{ "Storage HowTo...","Speicherort HowTo..." }, 1389{ "Storage HowTo...","Speicherort HowTo..." },
1390{ "Timetracking HowTo...","Timetracking HowTo..." }, 1390{ "Timetracking HowTo...","Timetracking HowTo..." },
1391{ "Juni","Juni" }, 1391{ "Juni","Juni" },
1392{ "Juli","Juli" }, 1392{ "Juli","Juli" },
1393{ "ToDo:","ToDo:" }, 1393{ "ToDo:","ToDo:" },
1394{ "Set Calendar","Setze Kalender" }, 1394{ "Set Calendar","Setze Kalender" },
1395{ "Todo: %1","Todo: %1" }, 1395{ "Todo: %1","Todo: %1" },
1396{ ": (Prio ",": (Prio " }, 1396{ ": (Prio ",": (Prio " },
1397{ "Todos","Todos" }, 1397{ "Todos","Todos" },
1398{ "Todo Viewer","Todo Viewer" }, 1398{ "Todo Viewer","Todo Viewer" },
1399{ "Todo ","Todo " }, 1399{ "Todo ","Todo " },
1400{ " Calendar \n Resource "," Kalender \n Resource " }, 1400{ " Calendar \n Resource "," Kalender \n Resource " },
1401{ " Color "," Farbe " }, 1401{ " Color "," Farbe " },
1402{ "The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)","Der Kalender <b>%1</b> zeigt die Datei <b>%2</b>. Möchten Sie diesen Kalender aus KO/Pi entfernen? (Die Datei wird dabei nicht gelöscht!)" }, 1402{ "The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)","Der Kalender <b>%1</b> zeigt die Datei <b>%2</b>. Möchten Sie diesen Kalender aus KO/Pi entfernen? (Die Datei wird dabei nicht gelöscht!)" },
1403{ "The calendar <b>%1</b> is displaying file <b>%2</b>","Der Kalender <b>%1</b> zeigt die Datei <b>%2</b>" }, 1403{ "The calendar <b>%1</b> is displaying file <b>%2</b>","Der Kalender <b>%1</b> zeigt die Datei <b>%2</b>" },
1404{ "Add new Calendar","Füge Kalender hinzu" }, 1404{ "Add new Calendar","Füge Kalender hinzu" },
1405{ "<b>Name of new calendar:</b>","<b>Name des Kalenders:</b>" }, 1405{ "<b>Name of new calendar:</b>","<b>Name des Kalenders:</b>" },
1406{ "<b>Local ical (*.ics) file:</b>","<b>Lokale ical (*.ics) Datei:</b>" }, 1406{ "<b>Local ical (*.ics) file:</b>","<b>Lokale ical (*.ics) Datei:</b>" },
1407{ "Sorry, the calendar name is empty!","Sorry, der Kalendername ist leer!" }, 1407{ "Sorry, the calendar name is empty!","Sorry, der Kalendername ist leer!" },
1408{ "Sorry, the file name is empty!","Sorry, der Dateiname ist leer!" }, 1408{ "Sorry, the file name is empty!","Sorry, der Dateiname ist leer!" },
1409{ "Error loading calendar file\n%1.","Fehler beim Laden der Kalenderdatei\n%1." }, 1409{ "Error loading calendar file\n%1.","Fehler beim Laden der Kalenderdatei\n%1." },
1410{ "The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>","Der Kalender <b>%1</b> ist nicht geladen! Das Laden der Datei <b>%2</b> schlug fehl! <b>Soll erneut versucht werden den Kalender zu laden?</b>" }, 1410{ "The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>","Der Kalender <b>%1</b> ist nicht geladen! Das Laden der Datei <b>%2</b> schlug fehl! <b>Soll erneut versucht werden den Kalender zu laden?</b>" },
1411{ "Global application font for all apps:","Globale Schriftart:" }, 1411{ "Global application font for all apps:","Globale Schriftart:" },
1412{ "Application Font","Applikationsschriftart" }, 1412{ "Application Font","Applikationsschriftart" },
1413{ "Kx/Pi","Kx/Pi" }, 1413{ "Kx/Pi","Kx/Pi" },
1414{ "Backup","Backup" }, 1414{ "Backup","Backup" },
1415{ "KDE-Pim Global Settings","KDE-Pim Globale Einstellungen" }, 1415{ "KDE-Pim Global Settings","KDE-Pim Globale Einstellungen" },
1416{ "Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!","Sorry, der Kalendername \n%1\nist schon in Benutzung!\nBitte wählen Sie einen anderen!" }, 1416{ "Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!","Sorry, der Kalendername \n%1\nist schon in Benutzung!\nBitte wählen Sie einen anderen!" },
1417{ "Sorry, the file \n%1\nis already loaded!\nPlease choose another file!","Sorry, die Datei \n%1\nist schon geladen!\nBitte wählen Sie eine andere!" }, 1417{ "Sorry, the file \n%1\nis already loaded!\nPlease choose another file!","Sorry, die Datei \n%1\nist schon geladen!\nBitte wählen Sie eine andere!" },
1418{ "Choose Color","Wähle Farbe" }, 1418{ "Choose Color","Wähle Farbe" },
1419{ " OK "," OK " }, 1419{ " OK "," OK " },
1420{ " Cancel "," Abbrechen " }, 1420{ " Cancel "," Abbrechen " },
1421{ "Matching items will be added to list","Passende werden zur Liste hinzugefügt" }, 1421{ "Matching items will be added to list","Passende werden zur Liste hinzugefügt" },
1422{ "Matching items will be removed from list","Passende werden von der Liste entfernt" }, 1422{ "Matching items will be removed from list","Passende werden von der Liste entfernt" },
1423{ "Search on displayed list only","Suche auf der dargestellten Liste" }, 1423{ "Search on displayed list only","Suche auf der dargestellten Liste" },
1424{ "List will be cleared before search","Liste wird vor der Suche gelöscht" }, 1424{ "List will be cleared before search","Liste wird vor der Suche gelöscht" },
1425{ "<center>%1</center> <center>is not running. Do you want to set\nthe state to running?</center>","<center>%1</center> <center>ist nicht am Laufen. Möchten Sie den Zustand auf "laufend" setzen?</center>" }, 1425{ "<center>%1</center> <center>is not running. Do you want to set\nthe state to running?</center>","<center>%1</center> <center>ist nicht am Laufen. Möchten Sie den Zustand auf "laufend" setzen?</center>" },
1426{ "%1\nis running!","%1\nist am Laufen!" }, 1426{ "%1\nis running!","%1\nist am Laufen!" },
1427{ "Additional Comment:","Zusätzlicher Kommentar:" }, 1427{ "Additional Comment:","Zusätzlicher Kommentar:" },
1428{ "Stop and save","Stopp und Speichern" }, 1428{ "Stop and save","Stopp und Speichern" },
1429{ "Continue running","Weiter laufen lassen" }, 1429{ "Continue running","Weiter laufen lassen" },
1430{ "Stop - do not save","Stopp - nicht Speichern" }, 1430{ "Stop - do not save","Stopp - nicht Speichern" },
1431{ "Do you really want to set\nthe state to stopped\nwithout saving the data?","Möchten sie den Zustand\nwirklich auf gestoppt setzen\nohne die Daten abzuspeichern?" }, 1431{ "Do you really want to set\nthe state to stopped\nwithout saving the data?","Möchten sie den Zustand\nwirklich auf gestoppt setzen\nohne die Daten abzuspeichern?" },
1432{ "Time mismatch!","Zeiten stimmen nicht!" }, 1432{ "Time mismatch!","Zeiten stimmen nicht!" },
1433{ "The start time is\nafter the end time!","Die Startzeit ist\nhinter der Endzeit!" }, 1433{ "The start time is\nafter the end time!","Die Startzeit ist\nhinter der Endzeit!" },
1434{ "Yes, stop todo","Ja, stoppe Todo" }, 1434{ "Yes, stop todo","Ja, stoppe Todo" },
1435{ "Todo stopped - no data saved because runtime was < 15 sec!","Todo gestoppt - nichts gespeichert da Laufzeit < 15 sec!" }, 1435{ "Todo stopped - no data saved because runtime was < 15 sec!","Todo gestoppt - nichts gespeichert da Laufzeit < 15 sec!" },
1436{ "Todo started! Double click again to stop!","Todo gestartet! Doppelklicke um es zu stoppen!" }, 1436{ "Todo started! Double click again to stop!","Todo gestartet! Doppelklicke um es zu stoppen!" },
1437{ "Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.","Bitte wählen Sie den <b>Default-Kalender</b> in dieser Spalte. Neu angelegte oder importierte Einträge werden dem Default-Kalender hinzugefügt." }, 1437{ "Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.","Bitte wählen Sie den <b>Default-Kalender</b> in dieser Spalte. Neu angelegte oder importierte Einträge werden dem Default-Kalender hinzugefügt." },
1438{ "Spouse","Ehegatte" }, 1438{ "Spouse","Ehegatte" },
1439{ "Notes","Notizen" }, 1439{ "Notes","Notizen" },
1440{ "Messanger","Messanger" }, 1440{ "Messanger","Messanger" },
1441{ "Assistant","Assistent" }, 1441{ "Assistant","Assistent" },
1442{ "Manager","Manager" }, 1442{ "Manager","Manager" },
1443{ "Secrecy","Sichtbar" }, 1443{ "Secrecy","Sichtbar" },
1444{ "male","männlich" }, 1444{ "male","männlich" },
1445{ "female","weiblich" }, 1445{ "female","weiblich" },
1446{ "Hide!","Verbergen!" }, 1446{ "Hide!","Verbergen!" },
1447{ "Show!","Anzeigen!" }, 1447{ "Show!","Anzeigen!" },
1448{ "Details","Details" }, 1448{ "Details","Details" },
1449{ "Profession","Beruf" }, 1449{ "Profession","Beruf" },
1450{ "Children","Kinder" }, 1450{ "Children","Kinder" },
1451{ "Department","Abteilung" }, 1451{ "Department","Abteilung" },
1452{ "Backup cancelled","Backup abgebrochen" }, 1452{ "Backup cancelled","Backup abgebrochen" },
1453{ "Backup globally disabled","Backup global abgeschaltet" }, 1453{ "Backup globally disabled","Backup global abgeschaltet" },
1454{ "Backup succesfully finished","Backup erfolgreich beendet" }, 1454{ "Backup succesfully finished","Backup erfolgreich beendet" },
1455{ "(Hint: You can enable automatic backup in the global settings!)","(Hinweis: Sie können ein automatisches Backup in den globalen Einstellungen konfigurieren!)" }, 1455{ "(Hint: You can enable automatic backup in the global settings!)","(Hinweis: Sie können ein automatisches Backup in den globalen Einstellungen konfigurieren!)" },
1456{ "This will <b>backup all calendar files</b> to the directory %1 %2","Das schreibt ein <b>Backup aller Kalenderdateien</b> in das Verzeichnis %1 %2" }, 1456{ "This will <b>backup all calendar files</b> to the directory %1 %2","Das schreibt ein <b>Backup aller Kalenderdateien</b> in das Verzeichnis %1 %2" },
1457{ "Birthdays","Geburtstage" }, 1457{ "Birthdays","Geburtstage" },
1458{ "KO/Pi import information!","KO/Pi Import Information!" }, 1458{ "KO/Pi import information!","KO/Pi Import Information!" },
1459{ "Start this todo\nand stop all running","Starte dieses Todo\nund stoppe alle Laufenden" }, 1459{ "Start this todo\nand stop all running","Starte dieses Todo\nund stoppe alle Laufenden" },
1460{ "Cancel - do not start"," Abbrechen - Todo nicht starten" }, 1460{ "Cancel - do not start"," Abbrechen - Todo nicht starten" },
1461{ "The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n"How do I change the timezone?"\nas well!","Die Zeitzone wurde geändert!\nSollen die Kalender neu geladen\nwerden num die Zeiten\nder Termine zu ändern?\nBitte lesen Sie auch\nMenu: Help->FAQ:\n"How do I change the timezone?"" }, 1461{ "The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n"How do I change the timezone?"\nas well!","Die Zeitzone wurde geändert!\nSollen die Kalender neu geladen\nwerden num die Zeiten\nder Termine zu ändern?\nBitte lesen Sie auch\nMenu: Help->FAQ:\n"How do I change the timezone?"" },
1462{ "Reload","Neu laden" }, 1462{ "Reload","Neu laden" },
1463{ "Timezone settings","Zeitzoneneinstellung" }, 1463{ "Timezone settings","Zeitzoneneinstellung" },
1464{ "Title: ","Titel: " }, 1464{ "Title: ","Titel: " },
1465{ "Journal from: ","Journal vom: " }, 1465{ "Journal from: ","Journal vom: " },
1466{ "Journal: %1 from ","Journal: %1 vom " }, 1466{ "Journal: %1 from ","Journal: %1 vom " },
1467{ "<b>Click here to edit categories: </b>","<b>Klicke hier um Kategorien zu ändern: </b>" }, 1467{ "<b>Click here to edit categories: </b>","<b>Klicke hier um Kategorien zu ändern: </b>" },
1468{ "Selected Item","Ausgewähltes Item" }, 1468{ "Selected Item","Ausgewähltes Item" },
1469{ "Select Date...","Wähle Datum..." }, 1469{ "Select Date...","Wähle Datum..." },
1470{ "After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:","Nach dem Importieren/Laden/Syncen kann es neue Kategorien in den Terminen oder Todos geben, die nicht automatisch der Kategorieliste hinzugefügt werden. Bitte wählen Sie, was <b>jetzt</b> passieren soll:" }, 1470{ "After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:","Nach dem Importieren/Laden/Syncen kann es neue Kategorien in den Terminen oder Todos geben, die nicht automatisch der Kategorieliste hinzugefügt werden. Bitte wählen Sie, was <b>jetzt</b> passieren soll:" },
1471{ "Change category list now!","Ändere Kategorieliste jetzt!" }, 1471{ "Change category list now!","Ändere Kategorieliste jetzt!" },
1472{ "Edit category list...","Ändere Kategorieliste..." }, 1472{ "Edit category list...","Ändere Kategorieliste..." },
1473{ "Toolbar changes needs a restart!","Neustart benötigt für Toolbaränderungen!" }, 1473{ "Toolbar changes needs a restart!","Neustart benötigt für Toolbaränderungen!" },
1474{ "Filepath: ","Dateipfad: " }, 1474{ "Filepath: ","Dateipfad: " },
1475{ "The loading of one or more calendar failed:","Das Laden eines oder mehrerer Kalender schlug fehl:" }, 1475{ "The loading of one or more calendar failed:","Das Laden eines oder mehrerer Kalender schlug fehl:" },
1476{ "You can try to reload the calendar in the Resource View!","In der Resourcenansicht können Sie erneut versuchen den Kalender zu laden!" }, 1476{ "You can try to reload the calendar in the Resource View!","In der Resourcenansicht können Sie erneut versuchen den Kalender zu laden!" },
1477{ "","" }, 1477{ "<b>WARNING:</b> There is a pending suspended alarm!","<b>WARNUNG:</b> Es gibt einen laufenden Suspendalarm!" },
1478{ "","" }, 1478{ "Pending Suspend Alarm","Laufender Suspend Alarm" },
1479{ "","" }, 1479{ "","" },
1480{ "","" }, 1480{ "","" },
1481{ "","" }, \ No newline at end of file 1481{ "","" }, \ No newline at end of file
diff --git a/kalarmd/alarmdialog.cpp b/kalarmd/alarmdialog.cpp
index 17d4afa..ddb125a 100644
--- a/kalarmd/alarmdialog.cpp
+++ b/kalarmd/alarmdialog.cpp
@@ -1,335 +1,340 @@
1/* 1/*
2 This file is part of the KDE alarm daemon. 2 This file is part of the KDE alarm daemon.
3 Copyright (c) 2000 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24// $Id$ 24// $Id$
25 25
26#include <qhbox.h> 26#include <qhbox.h>
27#include <qvbox.h> 27#include <qvbox.h>
28#include <qapp.h> 28#include <qapp.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qlayout.h> 30#include <qlayout.h>
31#include <qfile.h> 31#include <qfile.h>
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qsound.h> 33#include <qsound.h>
34#include <qpushbutton.h> 34#include <qpushbutton.h>
35#include <qregexp.h> 35#include <qregexp.h>
36#ifndef DESKTOP_VERSION 36#ifndef DESKTOP_VERSION
37#define protected public 37#define protected public
38#include <qspinbox.h> 38#include <qspinbox.h>
39#undef protected 39#undef protected
40#else 40#else
41#include <qspinbox.h> 41#include <qspinbox.h>
42#endif 42#endif
43#include <stdlib.h> 43#include <stdlib.h>
44#ifndef _WIN32_ 44#ifndef _WIN32_
45#include <unistd.h> 45#include <unistd.h>
46#include <sys/ioctl.h> 46#include <sys/ioctl.h>
47#endif 47#endif
48#include <stdio.h> 48#include <stdio.h>
49#include <fcntl.h> 49#include <fcntl.h>
50 50
51#ifndef DESKTOP_VERSION 51#ifndef DESKTOP_VERSION
52#include <qtopia/alarmserver.h> 52#include <qtopia/alarmserver.h>
53#include <qpe/resource.h> 53#include <qpe/resource.h>
54#include <qtopia/sound.h> 54#include <qtopia/sound.h>
55 55
56#endif 56#endif
57 57
58#include "alarmdialog.h" 58#include "alarmdialog.h"
59 59
60 60
61AlarmDialog::AlarmDialog(QWidget *parent,const char *name) 61AlarmDialog::AlarmDialog(QWidget *parent,const char *name)
62 : QDialog (parent, name ,false, Qt::WStyle_StaysOnTop ) 62 : QDialog (parent, name ,false, Qt::WStyle_StaysOnTop )
63{ 63{
64 setCaption( "KO/Pi Alarm!" ); 64 setCaption( "KO/Pi Alarm!" );
65 QVBoxLayout* layout = new QVBoxLayout( this); 65 QVBoxLayout* layout = new QVBoxLayout( this);
66 QLabel* l = new QLabel("The following event triggered alarm:",this); 66 QLabel* l = new QLabel("The following event triggered alarm:",this);
67 layout->addWidget ( l ); 67 layout->addWidget ( l );
68 l->setAlignment( AlignCenter); 68 l->setAlignment( AlignCenter);
69 mMessage = new QLabel ( " ", this ); 69 mMessage = new QLabel ( " ", this );
70 int fs = 18; 70 int fs = 18;
71 int fs2 = 12; 71 int fs2 = 12;
72 int baseSize = 6; 72 int baseSize = 6;
73 if ( QApplication::desktop()->width() < 480 ) { 73 if ( QApplication::desktop()->width() < 480 ) {
74 fs2 = 10; 74 fs2 = 10;
75 fs = 12; 75 fs = 12;
76 baseSize = 4; 76 baseSize = 4;
77 } 77 }
78 layout->setSpacing( 3 ); 78 layout->setSpacing( 3 );
79 layout->setMargin( 3 ); 79 layout->setMargin( 3 );
80 QFont fo = QApplication::font(); 80 QFont fo = QApplication::font();
81 fo.setBold( true ); 81 fo.setBold( true );
82 fo.setPointSize( fs2 ); 82 fo.setPointSize( fs2 );
83 l->setFont( fo ); 83 l->setFont( fo );
84 fo.setPointSize( fs ); 84 fo.setPointSize( fs );
85 mMessage->setFont(fo ); 85 mMessage->setFont(fo );
86 mMessage->setAlignment( AlignCenter); 86 mMessage->setAlignment( AlignCenter);
87 layout->addWidget ( mMessage ); 87 layout->addWidget ( mMessage );
88 mMissedAlarms= new QLabel ( "(No missed Alarms)", this ); 88 mMissedAlarms= new QLabel ( "(No missed Alarms)", this );
89 mMissedAlarms->setAlignment( AlignCenter); 89 mMissedAlarms->setAlignment( AlignCenter);
90 90
91 playSoundTimer = new QTimer( this ); 91 playSoundTimer = new QTimer( this );
92 connect ( playSoundTimer, SIGNAL( timeout() ), this, SLOT (playSound() ) ); 92 connect ( playSoundTimer, SIGNAL( timeout() ), this, SLOT (playSound() ) );
93 93
94 playSoundTimer->stop(); 94 playSoundTimer->stop();
95 95
96 layout->addWidget ( mMissedAlarms ); 96 layout->addWidget ( mMissedAlarms );
97 mMissedAlarmsCombo = new QComboBox ( this ); 97 mMissedAlarmsCombo = new QComboBox ( this );
98 layout->addWidget ( mMissedAlarmsCombo ); 98 layout->addWidget ( mMissedAlarmsCombo );
99 99
100 QLabel* labb = new QLabel("Suspend\nduration\n(minutes):",this); 100 QLabel* labb = new QLabel("Suspend\nduration\n(minutes):",this);
101#ifdef DESKTOP_VERSION
102 fo = font();
103 fo.setPointSize( 12 );
104 labb->setFont ( fo );
105#endif
101 labb->setAlignment(AlignCenter); 106 labb->setAlignment(AlignCenter);
102 //layout->addWidget ( labb ); 107 //layout->addWidget ( labb );
103 fo = font(); 108 fo = font();
104 int pointSize = 36; 109 int pointSize = 36;
105 if ( QApplication::desktop()->width() <= 320 ) 110 if ( QApplication::desktop()->width() <= 320 )
106 pointSize = 18; 111 pointSize = 18;
107 fo.setPointSize( pointSize ); 112 fo.setPointSize( pointSize );
108 mSuspendSpin = new QSpinBox(1,1440,1,this); 113 mSuspendSpin = new QSpinBox(1,1440,1,this);
109 mSuspendSpin->setFont( fo ); 114 mSuspendSpin->setFont( fo );
110 mSuspendSpin->setValue(7); // default suspend duration 115 mSuspendSpin->setValue(7); // default suspend duration
111 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); 116 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
112 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); 117 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
113 118
114#if QT_VERSION < 0x030000 119#if QT_VERSION < 0x030000
115 mSuspendSpin->upButton ()->setFixedSize( QSize( 8*baseSize, 5*baseSize )); 120 mSuspendSpin->upButton ()->setFixedSize( QSize( 8*baseSize, 5*baseSize ));
116 mSuspendSpin->downButton ()->setFixedSize( QSize( 8*baseSize, 5*baseSize )); 121 mSuspendSpin->downButton ()->setFixedSize( QSize( 8*baseSize, 5*baseSize ));
117#endif 122#endif
118 mSuspendSpin->setFixedSize( 18*baseSize, 10*baseSize+2 ); 123 mSuspendSpin->setFixedSize( 18*baseSize, 10*baseSize+2 );
119 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); 124 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
120 QHBoxLayout* layoutSpin = new QHBoxLayout( layout ); 125 QHBoxLayout* layoutSpin = new QHBoxLayout( layout );
121 layoutSpin->addStretch (); 126 layoutSpin->addStretch ();
122 layoutSpin->addWidget ( labb ); 127 layoutSpin->addWidget ( labb );
123 layoutSpin->addWidget ( mSuspendSpin ); 128 layoutSpin->addWidget ( mSuspendSpin );
124 layoutSpin->addStretch (); 129 layoutSpin->addStretch ();
125 130
126 QVBox * bbox = new QVBox ( this ); 131 QVBox * bbox = new QVBox ( this );
127 layout->addWidget ( bbox ); 132 layout->addWidget ( bbox );
128 bbox->layout()->setSpacing( 2 ); 133 bbox->layout()->setSpacing( 2 );
129 labb = new QLabel("Press \"Cancel\" or \"Esc\" to suspend!",bbox); 134 labb = new QLabel("Press \"Cancel\" or \"Esc\" to suspend!",bbox);
130 labb->setAlignment(AlignCenter); 135 labb->setAlignment(AlignCenter);
131 mSuspendButton = new QPushButton( "Suspend", bbox); 136 mSuspendButton = new QPushButton( "Suspend", bbox);
132 QPushButton* silen = new QPushButton( " Stop sound ", bbox); 137 QPushButton* silen = new QPushButton( " Stop sound ", bbox);
133 okbut = new QPushButton( "Ok", bbox); 138 okbut = new QPushButton( "Ok", bbox);
134 mSuspendButton->setFont( fo ); 139 mSuspendButton->setFont( fo );
135 silen->setFont( fo ); 140 silen->setFont( fo );
136 okbut->setFont( fo ); 141 okbut->setFont( fo );
137 okbut->setDefault( true ); 142 okbut->setDefault( true );
138 connect (silen , SIGNAL( clicked() ), this, SLOT (silent() ) ); 143 connect (silen , SIGNAL( clicked() ), this, SLOT (silent() ) );
139 connect (mSuspendButton, SIGNAL( clicked() ), this, SLOT (slotSuspend() ) ); 144 connect (mSuspendButton, SIGNAL( clicked() ), this, SLOT (slotSuspend() ) );
140 connect (okbut , SIGNAL( clicked() ), this, SLOT (slotOk() ) ); 145 connect (okbut , SIGNAL( clicked() ), this, SLOT (slotOk() ) );
141 connect (mSuspendSpin , SIGNAL( valueChanged ( int ) ), this, SLOT ( spinBoxChanged( int ) ) ); 146 connect (mSuspendSpin , SIGNAL( valueChanged ( int ) ), this, SLOT ( spinBoxChanged( int ) ) );
142#ifndef _WIN32_ 147#ifndef _WIN32_
143 if ( QFile::exists ( "/dev/sharp_led" ) ) 148 if ( QFile::exists ( "/dev/sharp_led" ) )
144 fd_led = open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); 149 fd_led = open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK );
145 else 150 else
146#endif 151#endif
147 fd_led = 0; 152 fd_led = 0;
148 statusLED.which = SHARP_LED_SALARM; 153 statusLED.which = SHARP_LED_SALARM;
149 mSilent = false; 154 mSilent = false;
150 mSuspendCounter = 0; 155 mSuspendCounter = 0;
151 setServerNotification( true ); 156 setServerNotification( true );
152} 157}
153void AlarmDialog::reject () 158void AlarmDialog::reject ()
154{ 159{
155 QTimer::singleShot ( 3000, this, SLOT (suspend()) ); 160 QTimer::singleShot ( 3000, this, SLOT (suspend()) );
156 slotSuspend(); 161 slotSuspend();
157} 162}
158AlarmDialog::~AlarmDialog() 163AlarmDialog::~AlarmDialog()
159{ 164{
160} 165}
161void AlarmDialog::silent () 166void AlarmDialog::silent ()
162{ 167{
163 mSilent = true; 168 mSilent = true;
164} 169}
165void AlarmDialog::accept() 170void AlarmDialog::accept()
166{ 171{
167 slotOk(); 172 slotOk();
168} 173}
169 174
170void AlarmDialog::suspend() 175void AlarmDialog::suspend()
171{ 176{
172#ifdef DESKTOP_VERSION 177#ifdef DESKTOP_VERSION
173 178
174#else 179#else
175 Sound::soundAlarm (); 180 Sound::soundAlarm ();
176#endif 181#endif
177} 182}
178void AlarmDialog::slotOk() 183void AlarmDialog::slotOk()
179{ 184{
180 mStopAlarm = true; 185 mStopAlarm = true;
181 mMissedAlarms->setText("(No missed Alarms)"); 186 mMissedAlarms->setText("(No missed Alarms)");
182 mMessage->setText(""); 187 mMessage->setText("");
183 mMissedAlarmsCombo->clear(); 188 mMissedAlarmsCombo->clear();
184#ifndef _WIN32_ 189#ifndef _WIN32_
185 if ( fd_led > 0 ) { 190 if ( fd_led > 0 ) {
186 statusLED.status = LED_SALARM_OFF ; 191 statusLED.status = LED_SALARM_OFF ;
187 ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); 192 ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED);
188 } 193 }
189#endif 194#endif
190 QDialog::accept(); 195 QDialog::accept();
191} 196}
192 197
193void AlarmDialog::slotSuspend() 198void AlarmDialog::slotSuspend()
194{ 199{
195 //qDebug("AlarmDialog::suspend() "); // emit suspendSignal(mSuspendSpin->value()); 200 //qDebug("AlarmDialog::suspend() "); // emit suspendSignal(mSuspendSpin->value());
196 mStopAlarm = true; 201 mStopAlarm = true;
197 QDateTime nextA = QDateTime::currentDateTime().addSecs( mSuspendSpin->value() * 60 ); 202 QDateTime nextA = QDateTime::currentDateTime().addSecs( mSuspendSpin->value() * 60 );
198 QString mess = "suspend_alarm" +mFileName+"+++" ; 203 QString mess = "suspend_alarm" +mFileName+"+++" ;
199 if ( mMessage->text().left( 10 ) !="Suspended:" ) 204 if ( mMessage->text().left( 10 ) !="Suspended:" )
200 mess += "Suspended:\n"; 205 mess += "Suspended:\n";
201 mess +=mMessage->text(); 206 mess +=mMessage->text();
202#ifndef DESKTOP_VERSION 207#ifndef DESKTOP_VERSION
203 if ( mServerNotification ) 208 if ( mServerNotification )
204 AlarmServer::addAlarm ( nextA,"koalarm",mess.latin1()); 209 AlarmServer::addAlarm ( nextA,"koalarm",mess.latin1());
205#endif 210#endif
206 emit addAlarm( nextA , mess ); 211 emit addAlarm( nextA , mess );
207 slotOk(); 212 slotOk();
208} 213}
209 214
210void AlarmDialog::setServerNotification( bool b ) 215void AlarmDialog::setServerNotification( bool b )
211{ 216{
212 mServerNotification = b; 217 mServerNotification = b;
213} 218}
214int AlarmDialog::getSuspendTime( ) 219int AlarmDialog::getSuspendTime( )
215{ 220{
216 return mSuspendSpin->value(); 221 return mSuspendSpin->value();
217 222
218} 223}
219void AlarmDialog::setSuspendTime( int val ) 224void AlarmDialog::setSuspendTime( int val )
220{ 225{
221 mSuspendSpin->setValue( val ); 226 mSuspendSpin->setValue( val );
222} 227}
223bool AlarmDialog::eventNotification( QString mess, int replay , QString fn, bool playwav, int pause , int suspendtimes) 228bool AlarmDialog::eventNotification( QString mess, int replay , QString fn, bool playwav, int pause , int suspendtimes)
224{ 229{
225 if ( mess.left( 9) != "Suspended" ) 230 if ( mess.left( 9) != "Suspended" )
226 mSuspendCounter = suspendtimes; 231 mSuspendCounter = suspendtimes;
227 mPauseCount = pause; 232 mPauseCount = pause;
228 mFileName = fn; 233 mFileName = fn;
229 mPlayWav = playwav; 234 mPlayWav = playwav;
230 if ( !QFile::exists( fn ) ) 235 if ( !QFile::exists( fn ) )
231 mFileName = ""; 236 mFileName = "";
232 alarmCounter = 0 ; 237 alarmCounter = 0 ;
233 maxAlarmReplay = replay ; 238 maxAlarmReplay = replay ;
234 mStopAlarm = false; 239 mStopAlarm = false;
235 mSilent = false; 240 mSilent = false;
236 if ( !mMessage->text().stripWhiteSpace().isEmpty() ) { 241 if ( !mMessage->text().stripWhiteSpace().isEmpty() ) {
237 mMissedAlarmsCombo->show(); 242 mMissedAlarmsCombo->show();
238 QString newItem = mMessage->text().stripWhiteSpace(); 243 QString newItem = mMessage->text().stripWhiteSpace();
239 newItem.replace( QRegExp("\n"), QString(" ") ); 244 newItem.replace( QRegExp("\n"), QString(" ") );
240 mMissedAlarmsCombo->insertItem( newItem ); 245 mMissedAlarmsCombo->insertItem( newItem );
241 mMissedAlarms->setText( "Missed alarms:"); 246 mMissedAlarms->setText( "Missed alarms:");
242 } else 247 } else
243 mMissedAlarmsCombo->hide(); 248 mMissedAlarmsCombo->hide();
244 mMessage->setText(mess); 249 mMessage->setText(mess);
245 int w = minimumSizeHint().width() ; 250 int w = minimumSizeHint().width() ;
246 int h = minimumSizeHint().height() ; 251 int h = minimumSizeHint().height() ;
247 int dw = QApplication::desktop()->width(); 252 int dw = QApplication::desktop()->width();
248 int dh = QApplication::desktop()->height(); 253 int dh = QApplication::desktop()->height();
249 setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 254 setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
250 hide(); 255 hide();
251 256
252#ifndef _WIN32_ 257#ifndef _WIN32_
253 if ( fd_led > 0 ) { 258 if ( fd_led > 0 ) {
254 statusLED.status = LED_SALARM_ON ; 259 statusLED.status = LED_SALARM_ON ;
255 ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); 260 ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED);
256 } 261 }
257#endif 262#endif
258 okbut->setDefault( true ); 263 okbut->setDefault( true );
259 QTimer::singleShot( 1, this, SLOT ( forceRepaint() ) ); 264 QTimer::singleShot( 1, this, SLOT ( forceRepaint() ) );
260 // playSoundTimer->start( 1000, true ); 265 // playSoundTimer->start( 1000, true );
261 return true; 266 return true;
262 267
263} 268}
264 269
265void AlarmDialog::forceRepaint() 270void AlarmDialog::forceRepaint()
266{ 271{
267 272
268 showNormal(); 273 showNormal();
269 setActiveWindow(); 274 setActiveWindow();
270 raise(); 275 raise();
271 mSuspendSpin->setFocus(); 276 mSuspendSpin->setFocus();
272 playSoundTimer->start( 1000, true ); 277 playSoundTimer->start( 1000, true );
273 278
274} 279}
275void AlarmDialog::spinBoxChanged( int v ) 280void AlarmDialog::spinBoxChanged( int v )
276{ 281{
277 okbut->setDefault( false ); 282 okbut->setDefault( false );
278 mSilent = true; 283 mSilent = true;
279} 284}
280 285
281void AlarmDialog::playSound () 286void AlarmDialog::playSound ()
282{ 287{
283 288
284 if (mStopAlarm ) 289 if (mStopAlarm )
285 return; 290 return;
286 if ( mSilent ) 291 if ( mSilent )
287 return; 292 return;
288 //showNormal(); 293 //showNormal();
289 setActiveWindow(); 294 setActiveWindow();
290 //raise(); 295 //raise();
291 mSuspendSpin->setFocus(); 296 mSuspendSpin->setFocus();
292 if ( alarmCounter < maxAlarmReplay && ! mSilent) { 297 if ( alarmCounter < maxAlarmReplay && ! mSilent) {
293 ++alarmCounter; 298 ++alarmCounter;
294#ifdef DESKTOP_VERSION 299#ifdef DESKTOP_VERSION
295 mPlayWav = true; 300 mPlayWav = true;
296#endif 301#endif
297 if ( !mPlayWav || mFileName.length() < 2 ) { 302 if ( !mPlayWav || mFileName.length() < 2 ) {
298 303
299#ifdef DESKTOP_VERSION 304#ifdef DESKTOP_VERSION
300 qDebug("Sound play not possible - file not found"); 305 qDebug("Sound play not possible - file not found");
301#else 306#else
302 Sound::soundAlarm (); 307 Sound::soundAlarm ();
303#endif 308#endif
304 } else 309 } else
305 310
306 { 311 {
307#ifdef DESKTOP_VERSION 312#ifdef DESKTOP_VERSION
308#ifdef _WIN32_ 313#ifdef _WIN32_
309 QSound::play ( mFileName ); 314 QSound::play ( mFileName );
310#else 315#else
311 316
312 QString command = "playwave -r 22050 " + mFileName; 317 QString command = "playwave -r 22050 " + mFileName;
313 qDebug("KO: Playing file %s with 22kHz",mFileName.latin1() ); 318 qDebug("KO: Playing file %s with 22kHz",mFileName.latin1() );
314 int ret = system ( command.latin1() ); 319 int ret = system ( command.latin1() );
315 if ( ret != 0 ) { 320 if ( ret != 0 ) {
316 qDebug("Sound play command failed: %s ",command.latin1() ); 321 qDebug("Sound play command failed: %s ",command.latin1() );
317 } 322 }
318 323
319#endif 324#endif
320 325
321#else 326#else
322 QSound::play ( mFileName ); 327 QSound::play ( mFileName );
323#endif 328#endif
324 qDebug("BEEP!"); 329 qDebug("BEEP!");
325 } 330 }
326 } else { 331 } else {
327 if ( ! mSilent && mSuspendCounter > 0 ) { 332 if ( ! mSilent && mSuspendCounter > 0 ) {
328 --mSuspendCounter; 333 --mSuspendCounter;
329 reject (); 334 reject ();
330 hide(); 335 hide();
331 return; 336 return;
332 } 337 }
333 } 338 }
334 playSoundTimer->start( mPauseCount * 1000, true ); 339 playSoundTimer->start( mPauseCount * 1000, true );
335} 340}
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index fd026fa..70a1d2d 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -274,1452 +274,1455 @@ class KOBeamPrefs : public QDialog
274 public: 274 public:
275 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : 275 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
276 QDialog( parent, name, true ) 276 QDialog( parent, name, true )
277 { 277 {
278 setCaption( i18n("Beam Options") ); 278 setCaption( i18n("Beam Options") );
279 QVBoxLayout* lay = new QVBoxLayout( this ); 279 QVBoxLayout* lay = new QVBoxLayout( this );
280 lay->setSpacing( 3 ); 280 lay->setSpacing( 3 );
281 lay->setMargin( 3 ); 281 lay->setMargin( 3 );
282 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); 282 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
283 lay->addWidget( format ); 283 lay->addWidget( format );
284 format->setExclusive ( true ) ; 284 format->setExclusive ( true ) ;
285 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); 285 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
286 lay->addWidget( time ); time->setExclusive ( true ) ; 286 lay->addWidget( time ); time->setExclusive ( true ) ;
287 vcal = new QRadioButton(" vCalendar ", format ); 287 vcal = new QRadioButton(" vCalendar ", format );
288 ical = new QRadioButton(" iCalendar ", format ); 288 ical = new QRadioButton(" iCalendar ", format );
289 vcal->setChecked( true ); 289 vcal->setChecked( true );
290 tz = new QRadioButton(i18n(" With timezone "), time ); 290 tz = new QRadioButton(i18n(" With timezone "), time );
291 local = new QRadioButton(i18n(" Local time "), time ); 291 local = new QRadioButton(i18n(" Local time "), time );
292 tz->setChecked( true ); 292 tz->setChecked( true );
293 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); 293 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
294 lay->addWidget( ok ); 294 lay->addWidget( ok );
295 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 295 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
296 lay->addWidget( cancel ); 296 lay->addWidget( cancel );
297 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 297 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
298 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 298 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
299 resize( 200, 200 ); 299 resize( 200, 200 );
300 } 300 }
301 301
302 bool beamVcal() { return vcal->isChecked(); } 302 bool beamVcal() { return vcal->isChecked(); }
303 bool beamLocal() { return local->isChecked(); } 303 bool beamLocal() { return local->isChecked(); }
304private: 304private:
305 QRadioButton* vcal, *ical, *local, *tz; 305 QRadioButton* vcal, *ical, *local, *tz;
306}; 306};
307class KOCatPrefs : public QDialog 307class KOCatPrefs : public QDialog
308{ 308{
309 public: 309 public:
310 KOCatPrefs( QWidget *parent=0, const char *name=0 ) : 310 KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
311 QDialog( parent, name, true ) 311 QDialog( parent, name, true )
312 { 312 {
313 setCaption( i18n("Manage new Categories") ); 313 setCaption( i18n("Manage new Categories") );
314 QVBoxLayout* lay = new QVBoxLayout( this ); 314 QVBoxLayout* lay = new QVBoxLayout( this );
315 lay->setSpacing( 3 ); 315 lay->setSpacing( 3 );
316 lay->setMargin( 3 ); 316 lay->setMargin( 3 );
317 QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this ); 317 QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this );
318 lay->addWidget( lab ); 318 lay->addWidget( lab );
319 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 319 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
320 lay->addWidget( format ); 320 lay->addWidget( format );
321 format->setExclusive ( true ) ; 321 format->setExclusive ( true ) ;
322 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 322 addCatBut = new QRadioButton(i18n("Add to category list"), format );
323 new QRadioButton(i18n("Remove from Events/Todos"), format ); 323 new QRadioButton(i18n("Remove from Events/Todos"), format );
324 addCatBut->setChecked( true ); 324 addCatBut->setChecked( true );
325 QPushButton * ok = new QPushButton( i18n("Change category list now!"), this ); 325 QPushButton * ok = new QPushButton( i18n("Change category list now!"), this );
326 lay->addWidget( ok ); 326 lay->addWidget( ok );
327 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 327 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
328 lay->addWidget( cancel ); 328 lay->addWidget( cancel );
329 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 329 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
330 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 330 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
331 resize( 200, 200 ); 331 resize( 200, 200 );
332 } 332 }
333 333
334 bool addCat() { return addCatBut->isChecked(); } 334 bool addCat() { return addCatBut->isChecked(); }
335private: 335private:
336 QRadioButton* addCatBut; 336 QRadioButton* addCatBut;
337}; 337};
338 338
339 339
340 340
341CalendarView::CalendarView( CalendarResources *calendar, 341CalendarView::CalendarView( CalendarResources *calendar,
342 QWidget *parent, const char *name ) 342 QWidget *parent, const char *name )
343 : CalendarViewBase( parent, name ), 343 : CalendarViewBase( parent, name ),
344 mCalendar( calendar ), 344 mCalendar( calendar ),
345 mResourceManager( calendar->resourceManager() ) 345 mResourceManager( calendar->resourceManager() )
346{ 346{
347 347
348 mEventEditor = 0; 348 mEventEditor = 0;
349 mTodoEditor = 0; 349 mTodoEditor = 0;
350 350
351 init(); 351 init();
352} 352}
353 353
354CalendarView::CalendarView( Calendar *calendar, 354CalendarView::CalendarView( Calendar *calendar,
355 QWidget *parent, const char *name ) 355 QWidget *parent, const char *name )
356 : CalendarViewBase( parent, name ), 356 : CalendarViewBase( parent, name ),
357 mCalendar( calendar ), 357 mCalendar( calendar ),
358 mResourceManager( 0 ) 358 mResourceManager( 0 )
359{ 359{
360 360
361 mEventEditor = 0; 361 mEventEditor = 0;
362 mTodoEditor = 0; 362 mTodoEditor = 0;
363 init(); 363 init();
364} 364}
365 365
366void CalendarView::init() 366void CalendarView::init()
367{ 367{
368 mNextAlarmDateTime = QDateTime::currentDateTime(); 368 mNextAlarmDateTime = QDateTime::currentDateTime();
369 setFocusPolicy ( NoFocus ); 369 setFocusPolicy ( NoFocus );
370 mViewerCallerIsSearchDialog = false; 370 mViewerCallerIsSearchDialog = false;
371 mBlockShowDates = false; 371 mBlockShowDates = false;
372 372
373 mDatePickerMode = 0; 373 mDatePickerMode = 0;
374 mCurrentSyncDevice = ""; 374 mCurrentSyncDevice = "";
375 mViewManager = new KOViewManager( this ); 375 mViewManager = new KOViewManager( this );
376 mDialogManager = new KODialogManager( this ); 376 mDialogManager = new KODialogManager( this );
377 mEventViewerDialog = 0; 377 mEventViewerDialog = 0;
378 mModified = false; 378 mModified = false;
379 mReadOnly = false; 379 mReadOnly = false;
380 mSelectedIncidence = 0; 380 mSelectedIncidence = 0;
381 mCalPrinter = 0; 381 mCalPrinter = 0;
382 mFilters.setAutoDelete(true); 382 mFilters.setAutoDelete(true);
383 383
384 mCalendar->registerObserver( this ); 384 mCalendar->registerObserver( this );
385 // TODO: Make sure that view is updated, when calendar is changed. 385 // TODO: Make sure that view is updated, when calendar is changed.
386 386
387 mStorage = new FileStorage( mCalendar ); 387 mStorage = new FileStorage( mCalendar );
388 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 388 mNavigator = new DateNavigator( this, "datevav", mViewManager );
389 389
390 QBoxLayout *topLayout = (QBoxLayout*)layout(); 390 QBoxLayout *topLayout = (QBoxLayout*)layout();
391#ifndef KORG_NOSPLITTER 391#ifndef KORG_NOSPLITTER
392 // create the main layout frames. 392 // create the main layout frames.
393 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 393 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
394 topLayout->addWidget(mPanner); 394 topLayout->addWidget(mPanner);
395 395
396 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 396 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
397 "CalendarView::LeftFrame"); 397 "CalendarView::LeftFrame");
398 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 398 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
399 399
400 mDateNavigator = new DateNavigatorContainer( mLeftSplitter, 400 mDateNavigator = new DateNavigatorContainer( mLeftSplitter,
401 "CalendarView::DateNavigator" ); 401 "CalendarView::DateNavigator" );
402 402
403 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 403 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
404 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 404 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
405 mTodoList->setNavigator( mNavigator ); 405 mTodoList->setNavigator( mNavigator );
406 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 406 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
407 407
408#ifdef KORG_NORESOURCEVIEW 408#ifdef KORG_NORESOURCEVIEW
409 mResourceView = 0; 409 mResourceView = 0;
410#else 410#else
411 if ( mResourceManager ) { 411 if ( mResourceManager ) {
412 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 412 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
413 mResourceView->updateView(); 413 mResourceView->updateView();
414 connect( mResourceView, SIGNAL( resourcesChanged() ), 414 connect( mResourceView, SIGNAL( resourcesChanged() ),
415 SLOT( updateView() ) ); 415 SLOT( updateView() ) );
416 } else { 416 } else {
417 mResourceView = 0; 417 mResourceView = 0;
418 } 418 }
419#endif 419#endif
420 QWidget *rightBox = new QWidget( mPanner ); 420 QWidget *rightBox = new QWidget( mPanner );
421 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 421 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
422 422
423 mRightFrame = new QWidgetStack( rightBox ); 423 mRightFrame = new QWidgetStack( rightBox );
424 rightLayout->addWidget( mRightFrame, 1 ); 424 rightLayout->addWidget( mRightFrame, 1 );
425 425
426 mLeftFrame = mLeftSplitter; 426 mLeftFrame = mLeftSplitter;
427#else 427#else
428 //QWidget *mainBox = new QWidget( this ); 428 //QWidget *mainBox = new QWidget( this );
429 //QWidget *leftFrame = new QWidget( mainBox ); 429 //QWidget *leftFrame = new QWidget( mainBox );
430 //QBoxLayout * mainBoxLayout; 430 //QBoxLayout * mainBoxLayout;
431 if ( KOPrefs::instance()->mVerticalScreen ) { 431 if ( KOPrefs::instance()->mVerticalScreen ) {
432 //mainBoxLayout = new QVBoxLayout(mainBox); 432 //mainBoxLayout = new QVBoxLayout(mainBox);
433 //leftFrameLayout = new QHBoxLayout(leftFrame ); 433 //leftFrameLayout = new QHBoxLayout(leftFrame );
434 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); 434 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this );
435 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 435 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
436 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; 436 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);;
437 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 437 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
438 } else { 438 } else {
439 //mainBoxLayout = new QHBoxLayout(mainBox); 439 //mainBoxLayout = new QHBoxLayout(mainBox);
440 //leftFrameLayout = new QVBoxLayout(leftFrame ); 440 //leftFrameLayout = new QVBoxLayout(leftFrame );
441 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 441 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
442 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); 442 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
443 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); 443 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
444 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 444 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
445 } 445 }
446 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 446 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
447 //QBoxLayout * leftFrameLayout; 447 //QBoxLayout * leftFrameLayout;
448 topLayout->addWidget( mMainFrame ); 448 topLayout->addWidget( mMainFrame );
449#ifdef DESKTOP_VERSION 449#ifdef DESKTOP_VERSION
450 mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this ); 450 mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this );
451 topLayout->addWidget( mDateScrollBar ); 451 topLayout->addWidget( mDateScrollBar );
452 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); 452 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) );
453 if ( QApplication::desktop()->width() < 800 ) 453 if ( QApplication::desktop()->width() < 800 )
454 mDateScrollBar->hide(); 454 mDateScrollBar->hide();
455#endif 455#endif
456 //mainBoxLayout->addWidget (mLeftFrame); 456 //mainBoxLayout->addWidget (mLeftFrame);
457 mDateNavigator = new DateNavigatorContainer( mLeftFrame, 457 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
458 "CalendarView::DateNavigator" ); 458 "CalendarView::DateNavigator" );
459#if 0 459#if 0
460 // FIXME 460 // FIXME
461 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, 461 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
462 "CalendarView::DateNavigator", QDate::currentDate()); 462 "CalendarView::DateNavigator", QDate::currentDate());
463#endif 463#endif
464 // mDateNavigator->blockSignals( true ); 464 // mDateNavigator->blockSignals( true );
465 //leftFrameLayout->addWidget( mDateNavigator ); 465 //leftFrameLayout->addWidget( mDateNavigator );
466 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); 466 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
467 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); 467 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
468 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); 468 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView");
469 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); 469 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) );
470 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); 470 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) );
471 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) ); 471 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) );
472 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); 472 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) );
473 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); 473 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) );
474 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); 474 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) );
475 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); 475 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) );
476 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); 476 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) );
477 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); 477 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) );
478 478
479 mTodoList->setNavigator( mNavigator ); 479 mTodoList->setNavigator( mNavigator );
480#if 0 480#if 0
481 if ( QApplication::desktop()->width() < 480 ) { 481 if ( QApplication::desktop()->width() < 480 ) {
482 leftFrameLayout->addWidget(mFilterView); 482 leftFrameLayout->addWidget(mFilterView);
483 leftFrameLayout->addWidget(mTodoList, 2 ); 483 leftFrameLayout->addWidget(mTodoList, 2 );
484 484
485 } else { 485 } else {
486 leftFrameLayout->addWidget(mTodoList,2 ); 486 leftFrameLayout->addWidget(mTodoList,2 );
487 leftFrameLayout->addWidget(mFilterView ); 487 leftFrameLayout->addWidget(mFilterView );
488 } 488 }
489#endif 489#endif
490 mFilterView->hide(); 490 mFilterView->hide();
491 mCalEditView->hide(); 491 mCalEditView->hide();
492 QWidget *rightBox = new QWidget( mMainFrame ); 492 QWidget *rightBox = new QWidget( mMainFrame );
493 //mainBoxLayout->addWidget ( rightBox, 10 ); 493 //mainBoxLayout->addWidget ( rightBox, 10 );
494 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 494 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
495 mRightFrame = new QWidgetStack( rightBox ); 495 mRightFrame = new QWidgetStack( rightBox );
496 rightLayout->addWidget( mRightFrame, 10 ); 496 rightLayout->addWidget( mRightFrame, 10 );
497 497
498 //mLeftFrame = (QWidget *)leftFrame; 498 //mLeftFrame = (QWidget *)leftFrame;
499 if ( KOPrefs::instance()->mVerticalScreen ) { 499 if ( KOPrefs::instance()->mVerticalScreen ) {
500 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); 500 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
501 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); 501 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
502 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 502 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
503 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 503 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
504 } else { 504 } else {
505 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); 505 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
506 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 506 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
507 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 507 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
508 } 508 }
509 if ( !KOPrefs::instance()->mShowDateNavigator) 509 if ( !KOPrefs::instance()->mShowDateNavigator)
510 mDateNavigator->hide(); 510 mDateNavigator->hide();
511 //qDebug("Calendarview Size %d %d ", width(), height()); 511 //qDebug("Calendarview Size %d %d ", width(), height());
512#endif 512#endif
513 513
514 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 514 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
515 SLOT( showDates( const KCal::DateList & ) ) ); 515 SLOT( showDates( const KCal::DateList & ) ) );
516 516
517 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 517 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
518 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 518 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
519 519
520 520
521 521
522 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), 522 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ),
523 mViewManager, SLOT( showMonth( const QDate & ) ) ); 523 mViewManager, SLOT( showMonth( const QDate & ) ) );
524 524
525 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 525 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
526 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 526 mNavigator, SLOT( selectWeek( const QDate & ) ) );
527 527
528 connect( mDateNavigator, SIGNAL( goPrevYear() ), 528 connect( mDateNavigator, SIGNAL( goPrevYear() ),
529 mNavigator, SLOT( selectPreviousYear() ) ); 529 mNavigator, SLOT( selectPreviousYear() ) );
530 connect( mDateNavigator, SIGNAL( goNextYear() ), 530 connect( mDateNavigator, SIGNAL( goNextYear() ),
531 mNavigator, SLOT( selectNextYear() ) ); 531 mNavigator, SLOT( selectNextYear() ) );
532 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 532 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
533 mNavigator, SLOT( selectPreviousMonth() ) ); 533 mNavigator, SLOT( selectPreviousMonth() ) );
534 connect( mDateNavigator, SIGNAL( goNextMonth() ), 534 connect( mDateNavigator, SIGNAL( goNextMonth() ),
535 mNavigator, SLOT( selectNextMonth() ) ); 535 mNavigator, SLOT( selectNextMonth() ) );
536 536
537 connect( mDateNavigator, SIGNAL( goPrevious() ), 537 connect( mDateNavigator, SIGNAL( goPrevious() ),
538 mNavigator, SLOT( selectPrevious() ) ); 538 mNavigator, SLOT( selectPrevious() ) );
539 connect( mDateNavigator, SIGNAL( goNext() ), 539 connect( mDateNavigator, SIGNAL( goNext() ),
540 mNavigator, SLOT( selectNext() ) ); 540 mNavigator, SLOT( selectNext() ) );
541 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 541 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
542 mNavigator, SLOT( slotMonthSelect( int ) ) ); 542 mNavigator, SLOT( slotMonthSelect( int ) ) );
543 543
544 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 544 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
545 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 545 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
546#if 0 546#if 0
547 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), 547 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ),
548 SLOT( incidenceAdded( Incidence *) ) ); 548 SLOT( incidenceAdded( Incidence *) ) );
549#endif 549#endif
550 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 550 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
551 551
552 connect( this, SIGNAL( configChanged() ), 552 connect( this, SIGNAL( configChanged() ),
553 mDateNavigator, SLOT( updateConfig() ) ); 553 mDateNavigator, SLOT( updateConfig() ) );
554 554
555 connect( mTodoList, SIGNAL( newTodoSignal() ), 555 connect( mTodoList, SIGNAL( newTodoSignal() ),
556 SLOT( newTodo() ) ); 556 SLOT( newTodo() ) );
557 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 557 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
558 SLOT( newSubTodo( Todo * ) ) ); 558 SLOT( newSubTodo( Todo * ) ) );
559 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 559 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
560 SLOT( editTodo( Todo * ) ) ); 560 SLOT( editTodo( Todo * ) ) );
561 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 561 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
562 SLOT( showTodo( Todo *) ) ); 562 SLOT( showTodo( Todo *) ) );
563 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 563 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
564 SLOT( deleteTodo( Todo *) ) ); 564 SLOT( deleteTodo( Todo *) ) );
565 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 565 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
566 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 566 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
567 SLOT( purgeCompleted() ) ); 567 SLOT( purgeCompleted() ) );
568 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 568 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
569 SIGNAL( todoModified( Todo *, int ) ) ); 569 SIGNAL( todoModified( Todo *, int ) ) );
570 570
571 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 571 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
572 this, SLOT ( cloneIncidence( Incidence * ) ) ); 572 this, SLOT ( cloneIncidence( Incidence * ) ) );
573 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 573 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
574 this, SLOT (cancelIncidence( Incidence * ) ) ); 574 this, SLOT (cancelIncidence( Incidence * ) ) );
575 575
576 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 576 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
577 this, SLOT ( moveIncidence( Incidence * ) ) ); 577 this, SLOT ( moveIncidence( Incidence * ) ) );
578 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 578 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
579 this, SLOT ( beamIncidence( Incidence * ) ) ); 579 this, SLOT ( beamIncidence( Incidence * ) ) );
580 580
581 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 581 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
582 this, SLOT ( todo_unsub( Todo * ) ) ); 582 this, SLOT ( todo_unsub( Todo * ) ) );
583 583
584 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 584 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
585 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 585 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
586 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 586 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
587 SLOT( updateTodo( Todo *, int ) ) ); 587 SLOT( updateTodo( Todo *, int ) ) );
588 connect( this, SIGNAL( todoModified( Todo *, int )), this, 588 connect( this, SIGNAL( todoModified( Todo *, int )), this,
589 SLOT( changeTodoDisplay( Todo *, int ) ) ); 589 SLOT( changeTodoDisplay( Todo *, int ) ) );
590 590
591 591
592 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 592 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
593 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 593 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
594 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 594 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
595 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 595 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
596 596
597 597
598 598
599 599
600 600
601 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 601 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
602 SLOT(checkClipboard())); 602 SLOT(checkClipboard()));
603 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 603 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
604 SLOT( processTodoListSelection( Incidence * ) ) ); 604 SLOT( processTodoListSelection( Incidence * ) ) );
605 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 605 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
606 606
607 // kdDebug() << "CalendarView::CalendarView() done" << endl; 607 // kdDebug() << "CalendarView::CalendarView() done" << endl;
608 608
609 mDateFrame = new QVBox(0,0,WType_Popup); 609 mDateFrame = new QVBox(0,0,WType_Popup);
610 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 610 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
611 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 611 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
612 mDateFrame->setLineWidth(3); 612 mDateFrame->setLineWidth(3);
613 mDateFrame->hide(); 613 mDateFrame->hide();
614 mDateFrame->setCaption( i18n( "Pick a date to display")); 614 mDateFrame->setCaption( i18n( "Pick a date to display"));
615 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 615 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
616 616
617 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 617 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
618 618
619 mEventEditor = mDialogManager->getEventEditor(); 619 mEventEditor = mDialogManager->getEventEditor();
620 mTodoEditor = mDialogManager->getTodoEditor(); 620 mTodoEditor = mDialogManager->getTodoEditor();
621 621
622 mFlagEditDescription = false; 622 mFlagEditDescription = false;
623 623
624 mSuspendTimer = new QTimer( this ); 624 mSuspendTimer = new QTimer( this );
625 mAlarmTimer = new QTimer( this ); 625 mAlarmTimer = new QTimer( this );
626 mRecheckAlarmTimer = new QTimer( this ); 626 mRecheckAlarmTimer = new QTimer( this );
627 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 627 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
628 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 628 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
629 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 629 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
630 mAlarmDialog = new AlarmDialog( this ); 630 mAlarmDialog = new AlarmDialog( this );
631 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 631 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
632 mAlarmDialog->setServerNotification( false ); 632 mAlarmDialog->setServerNotification( false );
633 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 633 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
634 634
635 635
636#ifndef DESKTOP_VERSION 636#ifndef DESKTOP_VERSION
637//US listen for arriving address resultsets 637//US listen for arriving address resultsets
638 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 638 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
639 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 639 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
640#endif 640#endif
641 mDateNavigator->setCalendar( mCalendar ); 641 mDateNavigator->setCalendar( mCalendar );
642} 642}
643 643
644 644
645CalendarView::~CalendarView() 645CalendarView::~CalendarView()
646{ 646{
647 // kdDebug() << "~CalendarView()" << endl; 647 // kdDebug() << "~CalendarView()" << endl;
648 //qDebug("CalendarView::~CalendarView() "); 648 //qDebug("CalendarView::~CalendarView() ");
649 delete mDialogManager; 649 delete mDialogManager;
650 delete mViewManager; 650 delete mViewManager;
651 delete mStorage; 651 delete mStorage;
652 delete mDateFrame ; 652 delete mDateFrame ;
653 delete mEventViewerDialog; 653 delete mEventViewerDialog;
654 //kdDebug() << "~CalendarView() done" << endl; 654 //kdDebug() << "~CalendarView() done" << endl;
655} 655}
656void CalendarView::setScrollBarStep(int val ) 656void CalendarView::setScrollBarStep(int val )
657{ 657{
658#ifdef DESKTOP_VERSION 658#ifdef DESKTOP_VERSION
659 mDateScrollBar->setLineStep ( val ); 659 mDateScrollBar->setLineStep ( val );
660#endif 660#endif
661} 661}
662void CalendarView::scrollBarValue(int val ) 662void CalendarView::scrollBarValue(int val )
663{ 663{
664#ifdef DESKTOP_VERSION 664#ifdef DESKTOP_VERSION
665 if ( QApplication::desktop()->width() < 800 ) return; 665 if ( QApplication::desktop()->width() < 800 ) return;
666 static bool block = false; 666 static bool block = false;
667 if ( block ) return; 667 if ( block ) return;
668 block = true; 668 block = true;
669 val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); 669 val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
670 //qDebug("VAL %d ",val ); 670 //qDebug("VAL %d ",val );
671 int count = mNavigator->selectedDates().count(); 671 int count = mNavigator->selectedDates().count();
672 int year = mNavigator->selectedDates().first().year(); 672 int year = mNavigator->selectedDates().first().year();
673 int day = mNavigator->selectedDates().first().dayOfYear(); 673 int day = mNavigator->selectedDates().first().dayOfYear();
674 if ( val == day -1 ) { 674 if ( val == day -1 ) {
675 block = false; 675 block = false;
676 return; 676 return;
677 } 677 }
678 QDate d ( year,1,1 ); 678 QDate d ( year,1,1 );
679 mNavigator->selectDates( d.addDays( val ), count ); 679 mNavigator->selectDates( d.addDays( val ), count );
680 block = false; 680 block = false;
681#endif 681#endif
682 682
683} 683}
684 684
685void CalendarView::checkAlarms() 685void CalendarView::checkAlarms()
686{ 686{
687 687
688 QString message; 688 QString message;
689 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 689 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
690 KopiCalendarFile * cal = calendars.first(); 690 KopiCalendarFile * cal = calendars.first();
691 while ( cal ) { 691 while ( cal ) {
692 if ( cal->mErrorOnLoad ) { 692 if ( cal->mErrorOnLoad ) {
693 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; 693 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n";
694 } 694 }
695 cal = calendars.next(); 695 cal = calendars.next();
696 } 696 }
697 if ( !message.isEmpty() ) { 697 if ( !message.isEmpty() ) {
698 message = KGlobal::formatMessage( i18n("The loading of one or more calendar failed:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0); 698 message = KGlobal::formatMessage( i18n("The loading of one or more calendar failed:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0);
699 KMessageBox::error(this,message); 699 KMessageBox::error(this,message);
700 } 700 }
701 KConfig *config = KOGlobals::config(); 701 KConfig *config = KOGlobals::config();
702 config->setGroup( "AppRun" ); 702 config->setGroup( "AppRun" );
703 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 703 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
704 int daysto = dt.daysTo( QDate::currentDate() ); 704 int daysto = dt.daysTo( QDate::currentDate() );
705 int days = config->readNumEntry( "LatestProgramStopDays" , daysto); 705 int days = config->readNumEntry( "LatestProgramStopDays" , daysto);
706 dt = dt.addDays( days ); 706 dt = dt.addDays( days );
707 int secto = dt.secsTo( QDateTime::currentDateTime() ); 707 int secto = dt.secsTo( QDateTime::currentDateTime() );
708 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; 708 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30;
709 //qDebug("KO: Reading program stop %d ", secs); 709 //qDebug("KO: Reading program stop %d ", secs);
710 //secs -= ( 3600 * 24*3 ); // debug only 710 //secs -= ( 3600 * 24*3 ); // debug only
711 QDateTime latest = dt.addSecs ( secs ); 711 QDateTime latest = dt.addSecs ( secs );
712 qDebug("KO: Last termination on %s ", latest.toString().latin1()); 712 qDebug("KO: Last termination on %s ", latest.toString().latin1());
713 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); 713 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
714 QPtrList<Incidence> el = mCalendar->rawIncidences(); 714 QPtrList<Incidence> el = mCalendar->rawIncidences();
715 QPtrList<Incidence> al; 715 QPtrList<Incidence> al;
716 Incidence* inL = el.first(); 716 Incidence* inL = el.first();
717 QDateTime cur = QDateTime::currentDateTime().addSecs(-59); 717 QDateTime cur = QDateTime::currentDateTime().addSecs(-59);
718 qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); 718 qDebug("KO: Checking alarm until %s ", cur.toString().latin1());
719 while ( inL ) { 719 while ( inL ) {
720 bool ok = false; 720 bool ok = false;
721 int offset = 0; 721 int offset = 0;
722 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; 722 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
723 if ( ok ) { 723 if ( ok ) {
724 //qDebug("OK %s",next.toString().latin1()); 724 //qDebug("OK %s",next.toString().latin1());
725 if ( next < cur ) { 725 if ( next < cur ) {
726 al.append( inL ); 726 al.append( inL );
727 //qDebug("found missed alarm: %s ", inL->summary().latin1() ); 727 //qDebug("found missed alarm: %s ", inL->summary().latin1() );
728 } 728 }
729 } 729 }
730 inL = el.next(); 730 inL = el.next();
731 } 731 }
732 if ( al.count() ) { 732 if ( al.count() ) {
733 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); 733 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop );
734 dia->setCaption( i18n("KO/Pi: Missing alarms!") ); 734 dia->setCaption( i18n("KO/Pi: Missing alarms!") );
735 QVBoxLayout* lay = new QVBoxLayout( dia ); 735 QVBoxLayout* lay = new QVBoxLayout( dia );
736 lay->setSpacing( 0 ); 736 lay->setSpacing( 0 );
737 lay->setMargin( 0 ); 737 lay->setMargin( 0 );
738 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); 738 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest );
739 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); 739 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
740 lay->addWidget( matb ); 740 lay->addWidget( matb );
741 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { 741 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) {
742 int wid = 210; 742 int wid = 210;
743 int x = QApplication::desktop()->width() - wid - 7; 743 int x = QApplication::desktop()->width() - wid - 7;
744 int y = QApplication::desktop()->height() - wid - 70; 744 int y = QApplication::desktop()->height() - wid - 70;
745 dia->setGeometry ( x,y,wid,wid); 745 dia->setGeometry ( x,y,wid,wid);
746 } else { 746 } else {
747 int si = 220; 747 int si = 220;
748 if ( QApplication::desktop()->width() > 470 ) 748 if ( QApplication::desktop()->width() > 470 )
749 si = 400; 749 si = 400;
750 dia->resize(si,si/2); 750 dia->resize(si,si/2);
751 } 751 }
752 dia->setBackgroundColor( QColor( 255, 255, 255 ) ); 752 dia->setBackgroundColor( QColor( 255, 255, 255 ) );
753 dia->show(); 753 dia->show();
754 754
755 } 755 }
756} 756}
757void CalendarView::showDay( QDate d ) 757void CalendarView::showDay( QDate d )
758{ 758{
759 dateNavigator()->blockSignals( true ); 759 dateNavigator()->blockSignals( true );
760 dateNavigator()->selectDate( d ); 760 dateNavigator()->selectDate( d );
761 dateNavigator()->blockSignals( false ); 761 dateNavigator()->blockSignals( false );
762 mViewManager->showDayView(); 762 mViewManager->showDayView();
763 //dateNavigator()->selectDate( d ); 763 //dateNavigator()->selectDate( d );
764} 764}
765void CalendarView::timerAlarm() 765void CalendarView::timerAlarm()
766{ 766{
767 //qDebug("CalendarView::timerAlarm() "); 767 //qDebug("CalendarView::timerAlarm() ");
768 computeAlarm(mAlarmNotification ); 768 computeAlarm(mAlarmNotification );
769} 769}
770 770
771void CalendarView::suspendAlarm() 771void CalendarView::suspendAlarm()
772{ 772{
773 //qDebug(" CalendarView::suspendAlarm() "); 773 //qDebug(" CalendarView::suspendAlarm() ");
774 computeAlarm(mSuspendAlarmNotification ); 774 computeAlarm(mSuspendAlarmNotification );
775 775
776} 776}
777 777
778void CalendarView::startAlarm( QString mess , QString filename) 778void CalendarView::startAlarm( QString mess , QString filename)
779{ 779{
780 780
781 topLevelWidget()->showNormal(); 781 topLevelWidget()->showNormal();
782 topLevelWidget()->setActiveWindow(); 782 topLevelWidget()->setActiveWindow();
783 topLevelWidget()->raise(); 783 topLevelWidget()->raise();
784 784
785 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 785 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
786 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 786 QTimer::singleShot( 2000, this, SLOT( checkNextTimerAlarm() ) );
787 787
788} 788}
789 789
790void CalendarView::checkNextTimerAlarm() 790void CalendarView::checkNextTimerAlarm()
791{ 791{
792 mCalendar->checkAlarmForIncidence( 0, true ); 792 mCalendar->checkAlarmForIncidence( 0, true );
793} 793}
794 794
795void CalendarView::computeAlarm( QString msg ) 795void CalendarView::computeAlarm( QString msg )
796{ 796{
797 797
798 QString mess = msg; 798 QString mess = msg;
799 QString mAlarmMessage = mess.mid( 9 ); 799 QString mAlarmMessage = mess.mid( 9 );
800 QString filename = MainWindow::resourcePath(); 800 QString filename = MainWindow::resourcePath();
801 filename += "koalarm.wav"; 801 filename += "koalarm.wav";
802 QString tempfilename; 802 QString tempfilename;
803 if ( mess.left( 13 ) == "suspend_alarm") { 803 if ( mess.left( 13 ) == "suspend_alarm") {
804 bool error = false; 804 bool error = false;
805 int len = mess.mid( 13 ).find("+++"); 805 int len = mess.mid( 13 ).find("+++");
806 if ( len < 2 ) 806 if ( len < 2 )
807 error = true; 807 error = true;
808 else { 808 else {
809 tempfilename = mess.mid( 13, len ); 809 tempfilename = mess.mid( 13, len );
810 if ( !QFile::exists( tempfilename ) ) 810 if ( !QFile::exists( tempfilename ) )
811 error = true; 811 error = true;
812 } 812 }
813 if ( ! error ) { 813 if ( ! error ) {
814 filename = tempfilename; 814 filename = tempfilename;
815 } 815 }
816 mAlarmMessage = mess.mid( 13+len+3 ); 816 mAlarmMessage = mess.mid( 13+len+3 );
817 //qDebug("suspend file %s ",tempfilename.latin1() ); 817 //qDebug("suspend file %s ",tempfilename.latin1() );
818 startAlarm( mAlarmMessage, filename); 818 startAlarm( mAlarmMessage, filename);
819 return; 819 return;
820 } 820 }
821 if ( mess.left( 11 ) == "timer_alarm") { 821 if ( mess.left( 11 ) == "timer_alarm") {
822 //mTimerTime = 0; 822 //mTimerTime = 0;
823 startAlarm( mess.mid( 11 ), filename ); 823 startAlarm( mess.mid( 11 ), filename );
824 return; 824 return;
825 } 825 }
826 if ( mess.left( 10 ) == "proc_alarm") { 826 if ( mess.left( 10 ) == "proc_alarm") {
827 bool error = false; 827 bool error = false;
828 int len = mess.mid( 10 ).find("+++"); 828 int len = mess.mid( 10 ).find("+++");
829 if ( len < 2 ) 829 if ( len < 2 )
830 error = true; 830 error = true;
831 else { 831 else {
832 tempfilename = mess.mid( 10, len ); 832 tempfilename = mess.mid( 10, len );
833 if ( !QFile::exists( tempfilename ) ) 833 if ( !QFile::exists( tempfilename ) )
834 error = true; 834 error = true;
835 } 835 }
836 if ( error ) { 836 if ( error ) {
837 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 837 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
838 mAlarmMessage += mess.mid( 10+len+3+9 ); 838 mAlarmMessage += mess.mid( 10+len+3+9 );
839 } else { 839 } else {
840 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 840 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
841 //qDebug("-----system command %s ",tempfilename.latin1() ); 841 //qDebug("-----system command %s ",tempfilename.latin1() );
842#ifndef _WIN32_ 842#ifndef _WIN32_
843 if ( vfork () == 0 ) { 843 if ( vfork () == 0 ) {
844 execl ( tempfilename.latin1(), 0 ); 844 execl ( tempfilename.latin1(), 0 );
845 return; 845 return;
846 } 846 }
847#else 847#else
848 QProcess* p = new QProcess(); 848 QProcess* p = new QProcess();
849 p->addArgument( tempfilename.latin1() ); 849 p->addArgument( tempfilename.latin1() );
850 p->start(); 850 p->start();
851 return; 851 return;
852#endif 852#endif
853 853
854 return; 854 return;
855 } 855 }
856 856
857 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 857 //qDebug("+++++++system command %s ",tempfilename.latin1() );
858 } 858 }
859 if ( mess.left( 11 ) == "audio_alarm") { 859 if ( mess.left( 11 ) == "audio_alarm") {
860 bool error = false; 860 bool error = false;
861 int len = mess.mid( 11 ).find("+++"); 861 int len = mess.mid( 11 ).find("+++");
862 if ( len < 2 ) 862 if ( len < 2 )
863 error = true; 863 error = true;
864 else { 864 else {
865 tempfilename = mess.mid( 11, len ); 865 tempfilename = mess.mid( 11, len );
866 if ( !QFile::exists( tempfilename ) ) 866 if ( !QFile::exists( tempfilename ) )
867 error = true; 867 error = true;
868 } 868 }
869 if ( ! error ) { 869 if ( ! error ) {
870 filename = tempfilename; 870 filename = tempfilename;
871 } 871 }
872 mAlarmMessage = mess.mid( 11+len+3+9 ); 872 mAlarmMessage = mess.mid( 11+len+3+9 );
873 //qDebug("audio file command %s ",tempfilename.latin1() ); 873 //qDebug("audio file command %s ",tempfilename.latin1() );
874 } 874 }
875 if ( mess.left( 9 ) == "cal_alarm") { 875 if ( mess.left( 9 ) == "cal_alarm") {
876 mAlarmMessage = mess.mid( 9 ) ; 876 mAlarmMessage = mess.mid( 9 ) ;
877 } 877 }
878 878
879 startAlarm( mAlarmMessage, filename ); 879 startAlarm( mAlarmMessage, filename );
880 880
881 881
882} 882}
883 883
884void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti ) 884void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
885{ 885{
886 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 886 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
887 887
888 mSuspendAlarmNotification = noti; 888 mSuspendAlarmNotification = noti;
889 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 889 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
890 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 890 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
891 mSuspendTimer->start( ms , true ); 891 mSuspendTimer->start( ms , true );
892 892
893} 893}
894 894
895void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 895void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
896{ 896{
897 mNextAlarmDateTime = qdt; 897 mNextAlarmDateTime = qdt;
898 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 898 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
899 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 899 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
900#ifndef DESKTOP_VERSION 900#ifndef DESKTOP_VERSION
901 AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); 901 AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() );
902#endif 902#endif
903 return; 903 return;
904 } 904 }
905 int maxSec; 905 int maxSec;
906 //maxSec = 5; //testing only 906 //maxSec = 5; //testing only
907 maxSec = 86400+3600; // one day+1hour 907 maxSec = 86400+3600; // one day+1hour
908 mAlarmNotification = noti; 908 mAlarmNotification = noti;
909 int sec = QDateTime::currentDateTime().secsTo( qdt ); 909 int sec = QDateTime::currentDateTime().secsTo( qdt );
910 if ( sec > maxSec ) { 910 if ( sec > maxSec ) {
911 mRecheckAlarmTimer->start( maxSec * 1000 ); 911 mRecheckAlarmTimer->start( maxSec * 1000 );
912 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 912 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
913 return; 913 return;
914 } else { 914 } else {
915 mRecheckAlarmTimer->stop(); 915 mRecheckAlarmTimer->stop();
916 } 916 }
917 //qDebug("Alarm timer started with secs: %d ", sec); 917 //qDebug("Alarm timer started with secs: %d ", sec);
918 mAlarmTimer->start( sec *1000 , true ); 918 mAlarmTimer->start( sec *1000 , true );
919 919
920} 920}
921// called by mRecheckAlarmTimer to get next alarm 921// called by mRecheckAlarmTimer to get next alarm
922// we need this, because a QTimer has only a max range of 25 days 922// we need this, because a QTimer has only a max range of 25 days
923void CalendarView::recheckTimerAlarm() 923void CalendarView::recheckTimerAlarm()
924{ 924{
925 mAlarmTimer->stop(); 925 mAlarmTimer->stop();
926 mRecheckAlarmTimer->stop(); 926 mRecheckAlarmTimer->stop();
927 mCalendar->checkAlarmForIncidence( 0, true ); 927 mCalendar->checkAlarmForIncidence( 0, true );
928} 928}
929#ifndef DESKTOP_VERSION
929void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti ) 930void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
931#else
932void CalendarView::removeAlarm(const QDateTime &, const QString & )
933#endif
930{ 934{
931 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 935 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
932 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 936 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
933#ifndef DESKTOP_VERSION 937#ifndef DESKTOP_VERSION
934 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); 938 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.utf8() );
935#endif 939#endif
936 return; 940 return;
937 } 941 }
938 mAlarmTimer->stop(); 942 mAlarmTimer->stop();
939} 943}
940void CalendarView::selectWeekNum ( int num ) 944void CalendarView::selectWeekNum ( int num )
941{ 945{
942 dateNavigator()->blockSignals( true ); 946 dateNavigator()->blockSignals( true );
943 dateNavigator()->selectWeek( num ); 947 dateNavigator()->selectWeek( num );
944 dateNavigator()->blockSignals( false ); 948 dateNavigator()->blockSignals( false );
945 mViewManager->showWeekView(); 949 mViewManager->showWeekView();
946} 950}
947KOViewManager *CalendarView::viewManager() 951KOViewManager *CalendarView::viewManager()
948{ 952{
949 return mViewManager; 953 return mViewManager;
950} 954}
951 955
952KODialogManager *CalendarView::dialogManager() 956KODialogManager *CalendarView::dialogManager()
953{ 957{
954 return mDialogManager; 958 return mDialogManager;
955} 959}
956 960
957QDate CalendarView::startDate() 961QDate CalendarView::startDate()
958{ 962{
959 DateList dates = mNavigator->selectedDates(); 963 DateList dates = mNavigator->selectedDates();
960 964
961 return dates.first(); 965 return dates.first();
962} 966}
963 967
964QDate CalendarView::endDate() 968QDate CalendarView::endDate()
965{ 969{
966 DateList dates = mNavigator->selectedDates(); 970 DateList dates = mNavigator->selectedDates();
967 971
968 return dates.last(); 972 return dates.last();
969} 973}
970 974
971 975
972void CalendarView::createPrinter() 976void CalendarView::createPrinter()
973{ 977{
974#ifndef KORG_NOPRINTER 978#ifndef KORG_NOPRINTER
975 if (!mCalPrinter) { 979 if (!mCalPrinter) {
976 mCalPrinter = new CalPrinter(this, mCalendar); 980 mCalPrinter = new CalPrinter(this, mCalendar);
977 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); 981 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig()));
978 } 982 }
979#endif 983#endif
980} 984}
981 985
982 986
983//KOPrefs::instance()->mWriteBackFile 987//KOPrefs::instance()->mWriteBackFile
984//KOPrefs::instance()->mWriteBackExistingOnly 988//KOPrefs::instance()->mWriteBackExistingOnly
985 989
986// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 990// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
987// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 991// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
988// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 992// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
989// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 993// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
990// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 994// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
991// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 995// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
992 996
993int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) 997int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full )
994{ 998{
995 999
996 // 0 equal 1000 // 0 equal
997 // 1 take local 1001 // 1 take local
998 // 2 take remote 1002 // 2 take remote
999 // 3 cancel 1003 // 3 cancel
1000 QDateTime lastSync = mLastCalendarSync; 1004 QDateTime lastSync = mLastCalendarSync;
1001 QDateTime localMod = local->lastModified(); 1005 QDateTime localMod = local->lastModified();
1002 QDateTime remoteMod = remote->lastModified(); 1006 QDateTime remoteMod = remote->lastModified();
1003 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1007 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1004 bool remCh, locCh; 1008 bool remCh, locCh;
1005 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 1009 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
1006 //if ( remCh ) 1010 //if ( remCh )
1007 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 1011 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
1008 locCh = ( localMod > mLastCalendarSync ); 1012 locCh = ( localMod > mLastCalendarSync );
1009 if ( !remCh && ! locCh ) { 1013 if ( !remCh && ! locCh ) {
1010 //qDebug("both not changed "); 1014 //qDebug("both not changed ");
1011 lastSync = localMod.addDays(1); 1015 lastSync = localMod.addDays(1);
1012 if ( mode <= SYNC_PREF_ASK ) 1016 if ( mode <= SYNC_PREF_ASK )
1013 return 0; 1017 return 0;
1014 } else { 1018 } else {
1015 if ( locCh ) { 1019 if ( locCh ) {
1016 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); 1020 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1());
1017 lastSync = localMod.addDays( -1 ); 1021 lastSync = localMod.addDays( -1 );
1018 if ( !remCh ) 1022 if ( !remCh )
1019 remoteMod = ( lastSync.addDays( -1 ) ); 1023 remoteMod = ( lastSync.addDays( -1 ) );
1020 } else { 1024 } else {
1021 //qDebug(" not loc changed "); 1025 //qDebug(" not loc changed ");
1022 lastSync = localMod.addDays( 1 ); 1026 lastSync = localMod.addDays( 1 );
1023 if ( remCh ) 1027 if ( remCh )
1024 remoteMod =( lastSync.addDays( 1 ) ); 1028 remoteMod =( lastSync.addDays( 1 ) );
1025 1029
1026 } 1030 }
1027 } 1031 }
1028 full = true; 1032 full = true;
1029 if ( mode < SYNC_PREF_ASK ) 1033 if ( mode < SYNC_PREF_ASK )
1030 mode = SYNC_PREF_ASK; 1034 mode = SYNC_PREF_ASK;
1031 } else { 1035 } else {
1032 if ( localMod == remoteMod ) 1036 if ( localMod == remoteMod )
1033 // if ( local->revision() == remote->revision() ) 1037 // if ( local->revision() == remote->revision() )
1034 return 0; 1038 return 0;
1035 1039
1036 } 1040 }
1037 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 1041 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
1038 1042
1039 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); 1043 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision());
1040 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); 1044 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() );
1041 //full = true; //debug only 1045 //full = true; //debug only
1042 if ( full ) { 1046 if ( full ) {
1043 bool equ = false; 1047 bool equ = false;
1044 if ( local->typeID() == eventID ) { 1048 if ( local->typeID() == eventID ) {
1045 equ = (*((Event*) local) == *((Event*) remote)); 1049 equ = (*((Event*) local) == *((Event*) remote));
1046 } 1050 }
1047 else if ( local->typeID() == todoID ) 1051 else if ( local->typeID() == todoID )
1048 equ = (*((Todo*) local) == (*(Todo*) remote)); 1052 equ = (*((Todo*) local) == (*(Todo*) remote));
1049 else if ( local->typeID() == journalID ) 1053 else if ( local->typeID() == journalID )
1050 equ = (*((Journal*) local) == *((Journal*) remote)); 1054 equ = (*((Journal*) local) == *((Journal*) remote));
1051 if ( equ ) { 1055 if ( equ ) {
1052 //qDebug("equal "); 1056 //qDebug("equal ");
1053 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1057 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1054 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 1058 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
1055 } 1059 }
1056 if ( mode < SYNC_PREF_FORCE_LOCAL ) 1060 if ( mode < SYNC_PREF_FORCE_LOCAL )
1057 return 0; 1061 return 0;
1058 1062
1059 }//else //debug only 1063 }//else //debug only
1060 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 1064 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
1061 } 1065 }
1062 int result; 1066 int result;
1063 bool localIsNew; 1067 bool localIsNew;
1064 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); 1068 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() );
1065 1069
1066 1070
1067 // ************************************************ 1071 // ************************************************
1068 // ************************************************ 1072 // ************************************************
1069 // ************************************************ 1073 // ************************************************
1070 // We may have that lastSync > remoteMod AND lastSync > localMod 1074 // We may have that lastSync > remoteMod AND lastSync > localMod
1071 // BUT remoteMod != localMod 1075 // BUT remoteMod != localMod
1072 1076
1073 1077
1074 if ( full && mode < SYNC_PREF_NEWEST ) 1078 if ( full && mode < SYNC_PREF_NEWEST )
1075 mode = SYNC_PREF_ASK; 1079 mode = SYNC_PREF_ASK;
1076 1080
1077 switch( mode ) { 1081 switch( mode ) {
1078 case SYNC_PREF_LOCAL: 1082 case SYNC_PREF_LOCAL:
1079 if ( lastSync > remoteMod ) 1083 if ( lastSync > remoteMod )
1080 return 1; 1084 return 1;
1081 if ( lastSync > localMod ) 1085 if ( lastSync > localMod )
1082 return 2; 1086 return 2;
1083 return 1; 1087 return 1;
1084 break; 1088 break;
1085 case SYNC_PREF_REMOTE: 1089 case SYNC_PREF_REMOTE:
1086 if ( lastSync > localMod ) 1090 if ( lastSync > localMod )
1087 return 2; 1091 return 2;
1088 if ( lastSync > remoteMod ) 1092 if ( lastSync > remoteMod )
1089 return 1; 1093 return 1;
1090 return 2; 1094 return 2;
1091 break; 1095 break;
1092 case SYNC_PREF_NEWEST: 1096 case SYNC_PREF_NEWEST:
1093 if ( localMod >= remoteMod ) 1097 if ( localMod >= remoteMod )
1094 return 1; 1098 return 1;
1095 else 1099 else
1096 return 2; 1100 return 2;
1097 break; 1101 break;
1098 case SYNC_PREF_ASK: 1102 case SYNC_PREF_ASK:
1099 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 1103 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
1100 if ( lastSync > remoteMod && lastSync > localMod) 1104 if ( lastSync > remoteMod && lastSync > localMod)
1101 return 0; 1105 return 0;
1102 if ( lastSync > remoteMod ) 1106 if ( lastSync > remoteMod )
1103 return 1; 1107 return 1;
1104 if ( lastSync > localMod ) 1108 if ( lastSync > localMod )
1105 return 2; 1109 return 2;
1106 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 1110 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
1107 localIsNew = localMod >= remoteMod; 1111 localIsNew = localMod >= remoteMod;
1108 if ( localIsNew ) 1112 if ( localIsNew )
1109 getEventViewerDialog()->setColorMode( 1 ); 1113 getEventViewerDialog()->setColorMode( 1 );
1110 else 1114 else
1111 getEventViewerDialog()->setColorMode( 2 ); 1115 getEventViewerDialog()->setColorMode( 2 );
1112 getEventViewerDialog()->setIncidence(local); 1116 getEventViewerDialog()->setIncidence(local);
1113 if ( localIsNew ) 1117 if ( localIsNew )
1114 getEventViewerDialog()->setColorMode( 2 ); 1118 getEventViewerDialog()->setColorMode( 2 );
1115 else 1119 else
1116 getEventViewerDialog()->setColorMode( 1 ); 1120 getEventViewerDialog()->setColorMode( 1 );
1117 getEventViewerDialog()->addIncidence(remote); 1121 getEventViewerDialog()->addIncidence(remote);
1118 getEventViewerDialog()->setColorMode( 0 ); 1122 getEventViewerDialog()->setColorMode( 0 );
1119 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); 1123 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() );
1120 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); 1124 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!"));
1121 getEventViewerDialog()->showMe(); 1125 getEventViewerDialog()->showMe();
1122 result = getEventViewerDialog()->executeS( localIsNew ); 1126 result = getEventViewerDialog()->executeS( localIsNew );
1123 return result; 1127 return result;
1124 1128
1125 break; 1129 break;
1126 case SYNC_PREF_FORCE_LOCAL: 1130 case SYNC_PREF_FORCE_LOCAL:
1127 return 1; 1131 return 1;
1128 break; 1132 break;
1129 case SYNC_PREF_FORCE_REMOTE: 1133 case SYNC_PREF_FORCE_REMOTE:
1130 return 2; 1134 return 2;
1131 break; 1135 break;
1132 1136
1133 default: 1137 default:
1134 // SYNC_PREF_TAKE_BOTH not implemented 1138 // SYNC_PREF_TAKE_BOTH not implemented
1135 break; 1139 break;
1136 } 1140 }
1137 return 0; 1141 return 0;
1138} 1142}
1139Event* CalendarView::getLastSyncEvent() 1143Event* CalendarView::getLastSyncEvent()
1140{ 1144{
1141 Event* lse; 1145 Event* lse;
1142 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 1146 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
1143 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); 1147 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice );
1144 if (!lse) { 1148 if (!lse) {
1145 lse = new Event(); 1149 lse = new Event();
1146 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); 1150 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice );
1147 QString sum = ""; 1151 QString sum = "";
1148 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) 1152 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
1149 sum = "E: "; 1153 sum = "E: ";
1150 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); 1154 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
1151 lse->setDtStart( mLastCalendarSync ); 1155 lse->setDtStart( mLastCalendarSync );
1152 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 1156 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
1153 lse->setCategories( i18n("SyncEvent") ); 1157 lse->setCategories( i18n("SyncEvent") );
1154 lse->setReadOnly( true ); 1158 lse->setReadOnly( true );
1155 mCalendar->addEvent( lse ); 1159 mCalendar->addEvent( lse );
1156 } 1160 }
1157 1161
1158 return lse; 1162 return lse;
1159 1163
1160} 1164}
1161 1165
1162// we check, if the to delete event has a id for a profile 1166// we check, if the to delete event has a id for a profile
1163// if yes, we set this id in the profile to delete 1167// if yes, we set this id in the profile to delete
1164void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) 1168void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete )
1165{ 1169{
1166 if ( lastSync.count() == 0 ) { 1170 if ( lastSync.count() == 0 ) {
1167 //qDebug(" lastSync.count() == 0"); 1171 //qDebug(" lastSync.count() == 0");
1168 return; 1172 return;
1169 } 1173 }
1170 if ( toDelete->typeID() == journalID ) 1174 if ( toDelete->typeID() == journalID )
1171 return; 1175 return;
1172 1176
1173 Event* eve = lastSync.first(); 1177 Event* eve = lastSync.first();
1174 1178
1175 while ( eve ) { 1179 while ( eve ) {
1176 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name 1180 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
1177 if ( !id.isEmpty() ) { 1181 if ( !id.isEmpty() ) {
1178 QString des = eve->description(); 1182 QString des = eve->description();
1179 QString pref = "e"; 1183 QString pref = "e";
1180 if ( toDelete->typeID() == todoID ) 1184 if ( toDelete->typeID() == todoID )
1181 pref = "t"; 1185 pref = "t";
1182 des += pref+ id + ","; 1186 des += pref+ id + ",";
1183 eve->setReadOnly( false ); 1187 eve->setReadOnly( false );
1184 eve->setDescription( des ); 1188 eve->setDescription( des );
1185 //qDebug("setdes %s ", des.latin1()); 1189 //qDebug("setdes %s ", des.latin1());
1186 eve->setReadOnly( true ); 1190 eve->setReadOnly( true );
1187 } 1191 }
1188 eve = lastSync.next(); 1192 eve = lastSync.next();
1189 } 1193 }
1190 1194
1191} 1195}
1192void CalendarView::checkExternalId( Incidence * inc ) 1196void CalendarView::checkExternalId( Incidence * inc )
1193{ 1197{
1194 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; 1198 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ;
1195 checkExternSyncEvent( lastSync, inc ); 1199 checkExternSyncEvent( lastSync, inc );
1196 1200
1197} 1201}
1198bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) 1202bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
1199{ 1203{
1200 bool syncOK = true; 1204 bool syncOK = true;
1201 int addedEvent = 0; 1205 int addedEvent = 0;
1202 int addedEventR = 0; 1206 int addedEventR = 0;
1203 int deletedEventR = 0; 1207 int deletedEventR = 0;
1204 int deletedEventL = 0; 1208 int deletedEventL = 0;
1205 int changedLocal = 0; 1209 int changedLocal = 0;
1206 int changedRemote = 0; 1210 int changedRemote = 0;
1207 int filteredIN = 0; 1211 int filteredIN = 0;
1208 int filteredOUT = 0; 1212 int filteredOUT = 0;
1209 //QPtrList<Event> el = local->rawEvents(); 1213 //QPtrList<Event> el = local->rawEvents();
1210 Event* eventR; 1214 Event* eventR;
1211 QString uid; 1215 QString uid;
1212 int take; 1216 int take;
1213 Event* eventL;
1214 Event* eventRSync; 1217 Event* eventRSync;
1215 Event* eventLSync; 1218 Event* eventLSync;
1216 clearAllViews(); 1219 clearAllViews();
1217 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); 1220 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
1218 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); 1221 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
1219 bool fullDateRange = false; 1222 bool fullDateRange = false;
1220 local->resetTempSyncStat(); 1223 local->resetTempSyncStat();
1221 mLastCalendarSync = QDateTime::currentDateTime(); 1224 mLastCalendarSync = QDateTime::currentDateTime();
1222 if ( mSyncManager->syncWithDesktop() ) { 1225 if ( mSyncManager->syncWithDesktop() ) {
1223 remote->resetPilotStat(1); 1226 remote->resetPilotStat(1);
1224 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 1227 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
1225 mLastCalendarSync = KSyncManager::mRequestedSyncEvent; 1228 mLastCalendarSync = KSyncManager::mRequestedSyncEvent;
1226 qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); 1229 qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() );
1227 } else { 1230 } else {
1228 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); 1231 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime ");
1229 } 1232 }
1230 } 1233 }
1231 QDateTime modifiedCalendar = mLastCalendarSync; 1234 QDateTime modifiedCalendar = mLastCalendarSync;
1232 eventLSync = getLastSyncEvent(); 1235 eventLSync = getLastSyncEvent();
1233 eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); 1236 eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
1234 if ( eventR ) { 1237 if ( eventR ) {
1235 eventRSync = (Event*) eventR->clone(); 1238 eventRSync = (Event*) eventR->clone();
1236 remote->deleteEvent(eventR ); 1239 remote->deleteEvent(eventR );
1237 1240
1238 } else { 1241 } else {
1239 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { 1242 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) {
1240 eventRSync = (Event*)eventLSync->clone(); 1243 eventRSync = (Event*)eventLSync->clone();
1241 } else { 1244 } else {
1242 fullDateRange = true; 1245 fullDateRange = true;
1243 eventRSync = new Event(); 1246 eventRSync = new Event();
1244 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); 1247 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
1245 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); 1248 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName );
1246 eventRSync->setDtStart( mLastCalendarSync ); 1249 eventRSync->setDtStart( mLastCalendarSync );
1247 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 1250 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
1248 eventRSync->setCategories( i18n("SyncEvent") ); 1251 eventRSync->setCategories( i18n("SyncEvent") );
1249 } 1252 }
1250 } 1253 }
1251 if ( eventLSync->dtStart() == mLastCalendarSync ) 1254 if ( eventLSync->dtStart() == mLastCalendarSync )
1252 fullDateRange = true; 1255 fullDateRange = true;
1253 1256
1254 if ( ! fullDateRange ) { 1257 if ( ! fullDateRange ) {
1255 if ( eventLSync->dtStart() != eventRSync->dtStart() ) { 1258 if ( eventLSync->dtStart() != eventRSync->dtStart() ) {
1256 1259
1257 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); 1260 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() );
1258 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); 1261 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec());
1259 fullDateRange = true; 1262 fullDateRange = true;
1260 } 1263 }
1261 } 1264 }
1262 if ( mSyncManager->syncWithDesktop() ) { 1265 if ( mSyncManager->syncWithDesktop() ) {
1263 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); 1266 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync );
1264 } 1267 }
1265 if ( fullDateRange ) 1268 if ( fullDateRange )
1266 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); 1269 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
1267 else 1270 else
1268 mLastCalendarSync = eventLSync->dtStart(); 1271 mLastCalendarSync = eventLSync->dtStart();
1269 // for resyncing if own file has changed 1272 // for resyncing if own file has changed
1270 if ( mCurrentSyncDevice == "deleteaftersync" ) { 1273 if ( mCurrentSyncDevice == "deleteaftersync" ) {
1271 mLastCalendarSync = loadedFileVersion; 1274 mLastCalendarSync = loadedFileVersion;
1272 //qDebug("setting mLastCalendarSync "); 1275 //qDebug("setting mLastCalendarSync ");
1273 } 1276 }
1274 //qDebug("*************************** "); 1277 //qDebug("*************************** ");
1275 qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); 1278 qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange);
1276 QPtrList<Incidence> er = remote->rawIncidences(); 1279 QPtrList<Incidence> er = remote->rawIncidences();
1277 Incidence* inR = er.first(); 1280 Incidence* inR = er.first();
1278 Incidence* inL; 1281 Incidence* inL;
1279 QProgressBar bar( er.count(),0 ); 1282 QProgressBar bar( er.count(),0 );
1280 bar.setCaption (i18n("Syncing - close to abort!") ); 1283 bar.setCaption (i18n("Syncing - close to abort!") );
1281 1284
1282 // ************** setting up filter ************* 1285 // ************** setting up filter *************
1283 CalFilter *filterIN = 0; 1286 CalFilter *filterIN = 0;
1284 CalFilter *filterOUT = 0; 1287 CalFilter *filterOUT = 0;
1285 CalFilter *filter = mFilters.first(); 1288 CalFilter *filter = mFilters.first();
1286 while(filter) { 1289 while(filter) {
1287 if ( filter->name() == mSyncManager->mFilterInCal ) 1290 if ( filter->name() == mSyncManager->mFilterInCal )
1288 filterIN = filter; 1291 filterIN = filter;
1289 if ( filter->name() == mSyncManager->mFilterOutCal ) 1292 if ( filter->name() == mSyncManager->mFilterOutCal )
1290 filterOUT = filter; 1293 filterOUT = filter;
1291 filter = mFilters.next(); 1294 filter = mFilters.next();
1292 } 1295 }
1293 int w = 300; 1296 int w = 300;
1294 if ( QApplication::desktop()->width() < 320 ) 1297 if ( QApplication::desktop()->width() < 320 )
1295 w = 220; 1298 w = 220;
1296 int h = bar.sizeHint().height() ; 1299 int h = bar.sizeHint().height() ;
1297 int dw = QApplication::desktop()->width(); 1300 int dw = QApplication::desktop()->width();
1298 int dh = QApplication::desktop()->height(); 1301 int dh = QApplication::desktop()->height();
1299 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1302 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1300 bar.show(); 1303 bar.show();
1301 int modulo = (er.count()/10)+1; 1304 int modulo = (er.count()/10)+1;
1302 int incCounter = 0; 1305 int incCounter = 0;
1303 while ( inR ) { 1306 while ( inR ) {
1304 if ( ! bar.isVisible() ) 1307 if ( ! bar.isVisible() )
1305 return false; 1308 return false;
1306 if ( incCounter % modulo == 0 ) 1309 if ( incCounter % modulo == 0 )
1307 bar.setProgress( incCounter ); 1310 bar.setProgress( incCounter );
1308 ++incCounter; 1311 ++incCounter;
1309 uid = inR->uid(); 1312 uid = inR->uid();
1310 bool skipIncidence = false; 1313 bool skipIncidence = false;
1311 if ( uid.left(15) == QString("last-syncEvent-") ) 1314 if ( uid.left(15) == QString("last-syncEvent-") )
1312 skipIncidence = true; 1315 skipIncidence = true;
1313 QString idS; 1316 QString idS;
1314 qApp->processEvents(); 1317 qApp->processEvents();
1315 if ( !skipIncidence ) { 1318 if ( !skipIncidence ) {
1316 inL = local->incidence( uid ); 1319 inL = local->incidence( uid );
1317 if ( inL ) { // maybe conflict - same uid in both calendars 1320 if ( inL ) { // maybe conflict - same uid in both calendars
1318 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { 1321 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) {
1319 //qDebug("take %d %s ", take, inL->summary().latin1()); 1322 //qDebug("take %d %s ", take, inL->summary().latin1());
1320 if ( take == 3 ) 1323 if ( take == 3 )
1321 return false; 1324 return false;
1322 if ( take == 1 ) {// take local ********************** 1325 if ( take == 1 ) {// take local **********************
1323 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 1326 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
1324 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1327 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1325 else 1328 else
1326 idS = inR->IDStr(); 1329 idS = inR->IDStr();
1327 remote->deleteIncidence( inR ); 1330 remote->deleteIncidence( inR );
1328 inR = inL->clone(); 1331 inR = inL->clone();
1329 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1332 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1330 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) 1333 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL )
1331 inR->setIDStr( idS ); 1334 inR->setIDStr( idS );
1332 remote->addIncidence( inR ); 1335 remote->addIncidence( inR );
1333 if ( mSyncManager->syncWithDesktop() ) 1336 if ( mSyncManager->syncWithDesktop() )
1334 inR->setPilotId( 2 ); 1337 inR->setPilotId( 2 );
1335 ++changedRemote; 1338 ++changedRemote;
1336 } else {// take remote ********************** 1339 } else {// take remote **********************
1337 idS = inL->IDStr(); 1340 idS = inL->IDStr();
1338 int pid = inL->pilotId(); 1341 int pid = inL->pilotId();
1339 local->deleteIncidence( inL ); 1342 local->deleteIncidence( inL );
1340 inL = inR->clone(); 1343 inL = inR->clone();
1341 if ( mSyncManager->syncWithDesktop() ) 1344 if ( mSyncManager->syncWithDesktop() )
1342 inL->setPilotId( pid ); 1345 inL->setPilotId( pid );
1343 inL->setIDStr( idS ); 1346 inL->setIDStr( idS );
1344 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1347 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1345 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1348 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1346 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1349 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1347 } 1350 }
1348 local->addIncidence( inL ); 1351 local->addIncidence( inL );
1349 ++changedLocal; 1352 ++changedLocal;
1350 } 1353 }
1351 } 1354 }
1352 } else { // no conflict ********** add or delete remote 1355 } else { // no conflict ********** add or delete remote
1353 if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ 1356 if ( !filterIN || filterIN->filterCalendarItem( inR ) ){
1354 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1357 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1355 QString des = eventLSync->description(); 1358 QString des = eventLSync->description();
1356 QString pref = "e"; 1359 QString pref = "e";
1357 if ( inR->typeID() == todoID ) 1360 if ( inR->typeID() == todoID )
1358 pref = "t"; 1361 pref = "t";
1359 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 1362 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
1360 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 1363 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
1361 //remote->deleteIncidence( inR ); 1364 //remote->deleteIncidence( inR );
1362 ++deletedEventR; 1365 ++deletedEventR;
1363 } else { 1366 } else {
1364 inR->setLastModified( modifiedCalendar ); 1367 inR->setLastModified( modifiedCalendar );
1365 inL = inR->clone(); 1368 inL = inR->clone();
1366 inL->setIDStr( ":" ); 1369 inL->setIDStr( ":" );
1367 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1370 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1368 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1371 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1369 local->addIncidence( inL ); 1372 local->addIncidence( inL );
1370 ++addedEvent; 1373 ++addedEvent;
1371 1374
1372 } 1375 }
1373 } else { 1376 } else {
1374 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { 1377 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
1375 inR->setLastModified( modifiedCalendar ); 1378 inR->setLastModified( modifiedCalendar );
1376 inL = inR->clone(); 1379 inL = inR->clone();
1377 inL->setIDStr( ":" ); 1380 inL->setIDStr( ":" );
1378 local->addIncidence( inL ); 1381 local->addIncidence( inL );
1379 ++addedEvent; 1382 ++addedEvent;
1380 1383
1381 } else { 1384 } else {
1382 checkExternSyncEvent(eventRSyncSharp, inR); 1385 checkExternSyncEvent(eventRSyncSharp, inR);
1383 remote->deleteIncidence( inR ); 1386 remote->deleteIncidence( inR );
1384 ++deletedEventR; 1387 ++deletedEventR;
1385 } 1388 }
1386 } 1389 }
1387 } else { 1390 } else {
1388 ++filteredIN; 1391 ++filteredIN;
1389 } 1392 }
1390 } 1393 }
1391 } 1394 }
1392 inR = er.next(); 1395 inR = er.next();
1393 } 1396 }
1394 QPtrList<Incidence> el = local->rawIncidences(); 1397 QPtrList<Incidence> el = local->rawIncidences();
1395 inL = el.first(); 1398 inL = el.first();
1396 modulo = (el.count()/10)+1; 1399 modulo = (el.count()/10)+1;
1397 bar.setCaption (i18n("Add / remove events") ); 1400 bar.setCaption (i18n("Add / remove events") );
1398 bar.setTotalSteps ( el.count() ) ; 1401 bar.setTotalSteps ( el.count() ) ;
1399 bar.show(); 1402 bar.show();
1400 incCounter = 0; 1403 incCounter = 0;
1401 1404
1402 while ( inL ) { 1405 while ( inL ) {
1403 1406
1404 qApp->processEvents(); 1407 qApp->processEvents();
1405 if ( ! bar.isVisible() ) 1408 if ( ! bar.isVisible() )
1406 return false; 1409 return false;
1407 if ( incCounter % modulo == 0 ) 1410 if ( incCounter % modulo == 0 )
1408 bar.setProgress( incCounter ); 1411 bar.setProgress( incCounter );
1409 ++incCounter; 1412 ++incCounter;
1410 uid = inL->uid(); 1413 uid = inL->uid();
1411 bool skipIncidence = false; 1414 bool skipIncidence = false;
1412 if ( uid.left(15) == QString("last-syncEvent-") ) 1415 if ( uid.left(15) == QString("last-syncEvent-") )
1413 skipIncidence = true; 1416 skipIncidence = true;
1414 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID ) 1417 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID )
1415 skipIncidence = true; 1418 skipIncidence = true;
1416 if ( !skipIncidence ) { 1419 if ( !skipIncidence ) {
1417 inR = remote->incidence( uid ); 1420 inR = remote->incidence( uid );
1418 if ( ! inR ) { 1421 if ( ! inR ) {
1419 if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ 1422 if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){
1420 // no conflict ********** add or delete local 1423 // no conflict ********** add or delete local
1421 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1424 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1422 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 1425 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
1423 checkExternSyncEvent(eventLSyncSharp, inL); 1426 checkExternSyncEvent(eventLSyncSharp, inL);
1424 local->deleteIncidence( inL ); 1427 local->deleteIncidence( inL );
1425 ++deletedEventL; 1428 ++deletedEventL;
1426 } else { 1429 } else {
1427 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1430 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1428 inL->removeID(mCurrentSyncDevice ); 1431 inL->removeID(mCurrentSyncDevice );
1429 ++addedEventR; 1432 ++addedEventR;
1430 //qDebug("remote added Incidence %s ", inL->summary().latin1()); 1433 //qDebug("remote added Incidence %s ", inL->summary().latin1());
1431 inL->setLastModified( modifiedCalendar ); 1434 inL->setLastModified( modifiedCalendar );
1432 inR = inL->clone(); 1435 inR = inL->clone();
1433 inR->setIDStr( ":" ); 1436 inR->setIDStr( ":" );
1434 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1437 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1435 remote->addIncidence( inR ); 1438 remote->addIncidence( inR );
1436 } 1439 }
1437 } 1440 }
1438 } else { 1441 } else {
1439 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { 1442 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
1440 checkExternSyncEvent(eventLSyncSharp, inL); 1443 checkExternSyncEvent(eventLSyncSharp, inL);
1441 local->deleteIncidence( inL ); 1444 local->deleteIncidence( inL );
1442 ++deletedEventL; 1445 ++deletedEventL;
1443 } else { 1446 } else {
1444 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1447 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1445 ++addedEventR; 1448 ++addedEventR;
1446 inL->setLastModified( modifiedCalendar ); 1449 inL->setLastModified( modifiedCalendar );
1447 inR = inL->clone(); 1450 inR = inL->clone();
1448 inR->setIDStr( ":" ); 1451 inR->setIDStr( ":" );
1449 remote->addIncidence( inR ); 1452 remote->addIncidence( inR );
1450 } 1453 }
1451 } 1454 }
1452 } 1455 }
1453 } else { 1456 } else {
1454 ++filteredOUT; 1457 ++filteredOUT;
1455 } 1458 }
1456 } 1459 }
1457 } 1460 }
1458 inL = el.next(); 1461 inL = el.next();
1459 } 1462 }
1460 int delFut = 0; 1463 int delFut = 0;
1461 int remRem = 0; 1464 int remRem = 0;
1462 if ( mSyncManager->mWriteBackInFuture ) { 1465 if ( mSyncManager->mWriteBackInFuture ) {
1463 er = remote->rawIncidences(); 1466 er = remote->rawIncidences();
1464 remRem = er.count(); 1467 remRem = er.count();
1465 inR = er.first(); 1468 inR = er.first();
1466 QDateTime dt; 1469 QDateTime dt;
1467 QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); 1470 QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) );
1468 QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); 1471 QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 );
1469 while ( inR ) { 1472 while ( inR ) {
1470 if ( inR->typeID() == todoID ) { 1473 if ( inR->typeID() == todoID ) {
1471 Todo * t = (Todo*)inR; 1474 Todo * t = (Todo*)inR;
1472 if ( t->hasDueDate() ) 1475 if ( t->hasDueDate() )
1473 dt = t->dtDue(); 1476 dt = t->dtDue();
1474 else 1477 else
1475 dt = cur.addSecs( 62 ); 1478 dt = cur.addSecs( 62 );
1476 } 1479 }
1477 else if (inR->typeID() == eventID ) { 1480 else if (inR->typeID() == eventID ) {
1478 bool ok; 1481 bool ok;
1479 dt = inR->getNextOccurence( cur, &ok ); 1482 dt = inR->getNextOccurence( cur, &ok );
1480 if ( !ok ) 1483 if ( !ok )
1481 dt = cur.addSecs( -62 ); 1484 dt = cur.addSecs( -62 );
1482 } 1485 }
1483 else 1486 else
1484 dt = inR->dtStart(); 1487 dt = inR->dtStart();
1485 if ( dt < cur || dt > end ) { 1488 if ( dt < cur || dt > end ) {
1486 remote->deleteIncidence( inR ); 1489 remote->deleteIncidence( inR );
1487 ++delFut; 1490 ++delFut;
1488 } 1491 }
1489 inR = er.next(); 1492 inR = er.next();
1490 } 1493 }
1491 } 1494 }
1492 bar.hide(); 1495 bar.hide();
1493 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1496 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1494 eventLSync->setReadOnly( false ); 1497 eventLSync->setReadOnly( false );
1495 eventLSync->setDtStart( mLastCalendarSync ); 1498 eventLSync->setDtStart( mLastCalendarSync );
1496 eventRSync->setDtStart( mLastCalendarSync ); 1499 eventRSync->setDtStart( mLastCalendarSync );
1497 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1500 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1498 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1501 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1499 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1502 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1500 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1503 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1501 eventLSync->setReadOnly( true ); 1504 eventLSync->setReadOnly( true );
1502 qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL ); 1505 qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL );
1503 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... 1506 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal...
1504 remote->addEvent( eventRSync ); 1507 remote->addEvent( eventRSync );
1505 else 1508 else
1506 delete eventRSync; 1509 delete eventRSync;
1507 qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() ); 1510 qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() );
1508 QString mes; 1511 QString mes;
1509 mes .sprintf( i18n("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"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT ); 1512 mes .sprintf( i18n("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"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT );
1510 QString delmess; 1513 QString delmess;
1511 if ( delFut ) { 1514 if ( delFut ) {
1512 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut); 1515 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut);
1513 mes += delmess; 1516 mes += delmess;
1514 } 1517 }
1515 mes = i18n("Local calendar changed!\n") +mes; 1518 mes = i18n("Local calendar changed!\n") +mes;
1516 mCalendar->checkAlarmForIncidence( 0, true ); 1519 mCalendar->checkAlarmForIncidence( 0, true );
1517 qDebug( mes ); 1520 qDebug( mes );
1518 if ( mSyncManager->mShowSyncSummary ) { 1521 if ( mSyncManager->mShowSyncSummary ) {
1519 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, 1522 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
1520 i18n("KO/Pi Synchronization"),i18n("Write back"))) { 1523 i18n("KO/Pi Synchronization"),i18n("Write back"))) {
1521 qDebug("KO: WB cancelled "); 1524 qDebug("KO: WB cancelled ");
1522 mSyncManager->mWriteBackFile = false; 1525 mSyncManager->mWriteBackFile = false;
1523 return syncOK; 1526 return syncOK;
1524 } 1527 }
1525 } 1528 }
1526 return syncOK; 1529 return syncOK;
1527} 1530}
1528 1531
1529void CalendarView::setSyncDevice( QString s ) 1532void CalendarView::setSyncDevice( QString s )
1530{ 1533{
1531 mCurrentSyncDevice= s; 1534 mCurrentSyncDevice= s;
1532} 1535}
1533void CalendarView::setSyncName( QString s ) 1536void CalendarView::setSyncName( QString s )
1534{ 1537{
1535 mCurrentSyncName= s; 1538 mCurrentSyncName= s;
1536} 1539}
1537bool CalendarView::syncCalendar(QString filename, int mode) 1540bool CalendarView::syncCalendar(QString filename, int mode)
1538{ 1541{
1539 //qDebug("syncCalendar %s ", filename.latin1()); 1542 //qDebug("syncCalendar %s ", filename.latin1());
1540 mGlobalSyncMode = SYNC_MODE_NORMAL; 1543 mGlobalSyncMode = SYNC_MODE_NORMAL;
1541 CalendarLocal* calendar = new CalendarLocal(); 1544 CalendarLocal* calendar = new CalendarLocal();
1542 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1545 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1543 FileStorage* storage = new FileStorage( calendar ); 1546 FileStorage* storage = new FileStorage( calendar );
1544 bool syncOK = false; 1547 bool syncOK = false;
1545 storage->setFileName( filename ); 1548 storage->setFileName( filename );
1546 // qDebug("loading ... "); 1549 // qDebug("loading ... ");
1547 if ( storage->load() ) { 1550 if ( storage->load() ) {
1548 getEventViewerDialog()->setSyncMode( true ); 1551 getEventViewerDialog()->setSyncMode( true );
1549 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1552 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1550 getEventViewerDialog()->setSyncMode( false ); 1553 getEventViewerDialog()->setSyncMode( false );
1551 if ( syncOK ) { 1554 if ( syncOK ) {
1552 if ( mSyncManager->mWriteBackFile ) 1555 if ( mSyncManager->mWriteBackFile )
1553 { 1556 {
1554 storage->setSaveFormat( new ICalFormat() ); 1557 storage->setSaveFormat( new ICalFormat() );
1555 storage->save(); 1558 storage->save();
1556 } 1559 }
1557 } 1560 }
1558 setModified( true ); 1561 setModified( true );
1559 } 1562 }
1560 delete storage; 1563 delete storage;
1561 delete calendar; 1564 delete calendar;
1562 if ( syncOK ) 1565 if ( syncOK )
1563 updateView(); 1566 updateView();
1564 return syncOK; 1567 return syncOK;
1565} 1568}
1566 1569
1567void CalendarView::syncExternal( int mode ) 1570void CalendarView::syncExternal( int mode )
1568{ 1571{
1569 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1572 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1570 1573
1571 qApp->processEvents(); 1574 qApp->processEvents();
1572 CalendarLocal* calendar = new CalendarLocal(); 1575 CalendarLocal* calendar = new CalendarLocal();
1573 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1576 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1574 bool syncOK = false; 1577 bool syncOK = false;
1575 bool loadSuccess = false; 1578 bool loadSuccess = false;
1576 PhoneFormat* phoneFormat = 0; 1579 PhoneFormat* phoneFormat = 0;
1577 emit tempDisableBR(true); 1580 emit tempDisableBR(true);
1578#ifndef DESKTOP_VERSION 1581#ifndef DESKTOP_VERSION
1579 SharpFormat* sharpFormat = 0; 1582 SharpFormat* sharpFormat = 0;
1580 if ( mode == 0 ) { // sharp 1583 if ( mode == 0 ) { // sharp
1581 sharpFormat = new SharpFormat () ; 1584 sharpFormat = new SharpFormat () ;
1582 loadSuccess = sharpFormat->load( calendar, mCalendar ); 1585 loadSuccess = sharpFormat->load( calendar, mCalendar );
1583 1586
1584 } else 1587 } else
1585#endif 1588#endif
1586 if ( mode == 1 ) { // phone 1589 if ( mode == 1 ) { // phone
1587 phoneFormat = new PhoneFormat (mCurrentSyncDevice, 1590 phoneFormat = new PhoneFormat (mCurrentSyncDevice,
1588 mSyncManager->mPhoneDevice, 1591 mSyncManager->mPhoneDevice,
1589 mSyncManager->mPhoneConnection, 1592 mSyncManager->mPhoneConnection,
1590 mSyncManager->mPhoneModel); 1593 mSyncManager->mPhoneModel);
1591 loadSuccess = phoneFormat->load( calendar,mCalendar); 1594 loadSuccess = phoneFormat->load( calendar,mCalendar);
1592 1595
1593 } else { 1596 } else {
1594 emit tempDisableBR(false); 1597 emit tempDisableBR(false);
1595 return; 1598 return;
1596 } 1599 }
1597 if ( loadSuccess ) { 1600 if ( loadSuccess ) {
1598 getEventViewerDialog()->setSyncMode( true ); 1601 getEventViewerDialog()->setSyncMode( true );
1599 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1602 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1600 getEventViewerDialog()->setSyncMode( false ); 1603 getEventViewerDialog()->setSyncMode( false );
1601 qApp->processEvents(); 1604 qApp->processEvents();
1602 if ( syncOK ) { 1605 if ( syncOK ) {
1603 if ( mSyncManager->mWriteBackFile ) 1606 if ( mSyncManager->mWriteBackFile )
1604 { 1607 {
1605 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1608 QPtrList<Incidence> iL = mCalendar->rawIncidences();
1606 Incidence* inc = iL.first(); 1609 Incidence* inc = iL.first();
1607 if ( phoneFormat ) { 1610 if ( phoneFormat ) {
1608 while ( inc ) { 1611 while ( inc ) {
1609 inc->removeID(mCurrentSyncDevice); 1612 inc->removeID(mCurrentSyncDevice);
1610 inc = iL.next(); 1613 inc = iL.next();
1611 } 1614 }
1612 } 1615 }
1613#ifndef DESKTOP_VERSION 1616#ifndef DESKTOP_VERSION
1614 if ( sharpFormat ) 1617 if ( sharpFormat )
1615 sharpFormat->save(calendar); 1618 sharpFormat->save(calendar);
1616#endif 1619#endif
1617 if ( phoneFormat ) 1620 if ( phoneFormat )
1618 phoneFormat->save(calendar); 1621 phoneFormat->save(calendar);
1619 iL = calendar->rawIncidences(); 1622 iL = calendar->rawIncidences();
1620 inc = iL.first(); 1623 inc = iL.first();
1621 Incidence* loc; 1624 Incidence* loc;
1622 while ( inc ) { 1625 while ( inc ) {
1623 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 1626 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
1624 loc = mCalendar->incidence(inc->uid() ); 1627 loc = mCalendar->incidence(inc->uid() );
1625 if ( loc ) { 1628 if ( loc ) {
1626 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); 1629 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
1627 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); 1630 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
1628 } 1631 }
1629 } 1632 }
1630 inc = iL.next(); 1633 inc = iL.next();
1631 } 1634 }
1632 Incidence* lse = getLastSyncEvent(); 1635 Incidence* lse = getLastSyncEvent();
1633 if ( lse ) { 1636 if ( lse ) {
1634 lse->setReadOnly( false ); 1637 lse->setReadOnly( false );
1635 lse->setDescription( "" ); 1638 lse->setDescription( "" );
1636 lse->setReadOnly( true ); 1639 lse->setReadOnly( true );
1637 } 1640 }
1638 } 1641 }
1639 } else { 1642 } else {
1640 topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); 1643 topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") );
1641 } 1644 }
1642 setModified( true ); 1645 setModified( true );
1643 } else { 1646 } else {
1644 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; 1647 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
1645 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), 1648 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
1646 question, i18n("Ok")) ; 1649 question, i18n("Ok")) ;
1647 1650
1648 } 1651 }
1649 delete calendar; 1652 delete calendar;
1650 updateView(); 1653 updateView();
1651 emit tempDisableBR(false); 1654 emit tempDisableBR(false);
1652 return ;//syncOK; 1655 return ;//syncOK;
1653 1656
1654} 1657}
1655 1658
1656bool CalendarView::importBday() 1659bool CalendarView::importBday()
1657{ 1660{
1658#ifndef KORG_NOKABC 1661#ifndef KORG_NOKABC
1659 1662
1660#ifdef DESKTOP_VERSION 1663#ifdef DESKTOP_VERSION
1661 int curCal = mCalendar->defaultCalendar(); 1664 int curCal = mCalendar->defaultCalendar();
1662 int bd = mCalEditView->getBirtdayID(); 1665 int bd = mCalEditView->getBirtdayID();
1663 if ( bd == 0 ) 1666 if ( bd == 0 )
1664 return false; 1667 return false;
1665 mCalendar->setDefaultCalendar( bd ); 1668 mCalendar->setDefaultCalendar( bd );
1666 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 1669 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
1667 KABC::AddressBook::Iterator it; 1670 KABC::AddressBook::Iterator it;
1668 int count = 0; 1671 int count = 0;
1669 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1672 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1670 ++count; 1673 ++count;
1671 } 1674 }
1672 QProgressBar bar(count,0 ); 1675 QProgressBar bar(count,0 );
1673 int w = 300; 1676 int w = 300;
1674 if ( QApplication::desktop()->width() < 320 ) 1677 if ( QApplication::desktop()->width() < 320 )
1675 w = 220; 1678 w = 220;
1676 int h = bar.sizeHint().height() ; 1679 int h = bar.sizeHint().height() ;
1677 int dw = QApplication::desktop()->width(); 1680 int dw = QApplication::desktop()->width();
1678 int dh = QApplication::desktop()->height(); 1681 int dh = QApplication::desktop()->height();
1679 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1682 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1680 bar.show(); 1683 bar.show();
1681 bar.setCaption (i18n("Reading addressbook - close to abort!") ); 1684 bar.setCaption (i18n("Reading addressbook - close to abort!") );
1682 qApp->processEvents(); 1685 qApp->processEvents();
1683 count = 0; 1686 count = 0;
1684 int addCount = 0; 1687 int addCount = 0;
1685 KCal::Attendee* a = 0; 1688 KCal::Attendee* a = 0;
1686 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1689 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1687 if ( ! bar.isVisible() ) 1690 if ( ! bar.isVisible() )
1688 return false; 1691 return false;
1689 bar.setProgress( count++ ); 1692 bar.setProgress( count++ );
1690 qApp->processEvents(); 1693 qApp->processEvents();
1691 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); 1694 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() );
1692 if ( (*it).birthday().date().isValid() ){ 1695 if ( (*it).birthday().date().isValid() ){
1693 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1696 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1694 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) 1697 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) )
1695 ++addCount; 1698 ++addCount;
1696 } 1699 }
1697 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); 1700 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d");
1698 if ( anni.isValid() ){ 1701 if ( anni.isValid() ){
1699 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1702 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1700 if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) 1703 if ( addAnniversary( anni, (*it).assembledName(), a, false ) )
1701 ++addCount; 1704 ++addCount;
1702 } 1705 }
1703 } 1706 }
1704 mCalendar->setDefaultCalendar( curCal ); 1707 mCalendar->setDefaultCalendar( curCal );
1705 updateView(); 1708 updateView();
1706 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1709 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1707#else //DESKTOP_VERSION 1710#else //DESKTOP_VERSION
1708 1711
1709 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 1712 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
1710 // the result should now arrive through method insertBirthdays 1713 // the result should now arrive through method insertBirthdays
1711 1714
1712#endif //DESKTOP_VERSION 1715#endif //DESKTOP_VERSION
1713 1716
1714#endif //KORG_NOKABC 1717#endif //KORG_NOKABC
1715 1718
1716 1719
1717 return true; 1720 return true;
1718} 1721}
1719 1722
1720// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI 1723// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI
1721void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, 1724void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList,
1722 const QStringList& anniversaryList, const QStringList& realNameList, 1725 const QStringList& anniversaryList, const QStringList& realNameList,
1723 const QStringList& emailList, const QStringList& assembledNameList, 1726 const QStringList& emailList, const QStringList& assembledNameList,
1724 const QStringList& uidList) 1727 const QStringList& uidList)
1725{ 1728{
@@ -1801,1668 +1804,1674 @@ void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthd
1801 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1804 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1802 1805
1803 } 1806 }
1804 1807
1805} 1808}
1806 1809
1807 1810
1808 1811
1809bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) 1812bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday)
1810{ 1813{
1811 //qDebug("addAnni "); 1814 //qDebug("addAnni ");
1812 Event * ev = new Event(); 1815 Event * ev = new Event();
1813 ev->setOrganizer(KOPrefs::instance()->email()); 1816 ev->setOrganizer(KOPrefs::instance()->email());
1814 if ( a ) { 1817 if ( a ) {
1815 ev->addAttendee( a ); 1818 ev->addAttendee( a );
1816 } 1819 }
1817 QString kind; 1820 QString kind;
1818 if ( birthday ) { 1821 if ( birthday ) {
1819 kind = i18n( "Birthday" ); 1822 kind = i18n( "Birthday" );
1820 ev->setSummary( name + " (" + QString::number(date.year()) +")"); 1823 ev->setSummary( name + " (" + QString::number(date.year()) +")");
1821 } 1824 }
1822 else { 1825 else {
1823 kind = i18n( "Anniversary" ); 1826 kind = i18n( "Anniversary" );
1824 ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); 1827 ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind );
1825 } 1828 }
1826 ev->setCategories( kind ); 1829 ev->setCategories( kind );
1827 ev->setDtStart( QDateTime(date) ); 1830 ev->setDtStart( QDateTime(date) );
1828 ev->setDtEnd( QDateTime(date) ); 1831 ev->setDtEnd( QDateTime(date) );
1829 ev->setFloats( true ); 1832 ev->setFloats( true );
1830 Recurrence * rec = ev->recurrence(); 1833 Recurrence * rec = ev->recurrence();
1831 rec->setYearly(Recurrence::rYearlyMonth,1,-1); 1834 rec->setYearly(Recurrence::rYearlyMonth,1,-1);
1832 rec->addYearlyNum( date.month() ); 1835 rec->addYearlyNum( date.month() );
1833 if ( !mCalendar->addAnniversaryNoDup( ev ) ) { 1836 if ( !mCalendar->addAnniversaryNoDup( ev ) ) {
1834 delete ev; 1837 delete ev;
1835 return false; 1838 return false;
1836 } 1839 }
1837 return true; 1840 return true;
1838 1841
1839} 1842}
1840bool CalendarView::importQtopia( const QString &categories, 1843bool CalendarView::importQtopia( const QString &categories,
1841 const QString &datebook, 1844 const QString &datebook,
1842 const QString &todolist ) 1845 const QString &todolist )
1843{ 1846{
1844 1847
1845 QtopiaFormat qtopiaFormat; 1848 QtopiaFormat qtopiaFormat;
1846 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1849 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1847 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); 1850 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories );
1848 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); 1851 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook );
1849 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); 1852 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist );
1850 1853
1851 updateView(); 1854 updateView();
1852 return true; 1855 return true;
1853 1856
1854#if 0 1857#if 0
1855 mGlobalSyncMode = SYNC_MODE_QTOPIA; 1858 mGlobalSyncMode = SYNC_MODE_QTOPIA;
1856 mCurrentSyncDevice = "qtopia-XML"; 1859 mCurrentSyncDevice = "qtopia-XML";
1857 if ( mSyncManager->mAskForPreferences ) 1860 if ( mSyncManager->mAskForPreferences )
1858 edit_sync_options(); 1861 edit_sync_options();
1859 qApp->processEvents(); 1862 qApp->processEvents();
1860 CalendarLocal* calendar = new CalendarLocal(); 1863 CalendarLocal* calendar = new CalendarLocal();
1861 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1864 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1862 bool syncOK = false; 1865 bool syncOK = false;
1863 QtopiaFormat qtopiaFormat; 1866 QtopiaFormat qtopiaFormat;
1864 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1867 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1865 bool loadOk = true; 1868 bool loadOk = true;
1866 if ( !categories.isEmpty() ) 1869 if ( !categories.isEmpty() )
1867 loadOk = qtopiaFormat.load( calendar, categories ); 1870 loadOk = qtopiaFormat.load( calendar, categories );
1868 if ( loadOk && !datebook.isEmpty() ) 1871 if ( loadOk && !datebook.isEmpty() )
1869 loadOk = qtopiaFormat.load( calendar, datebook ); 1872 loadOk = qtopiaFormat.load( calendar, datebook );
1870 if ( loadOk && !todolist.isEmpty() ) 1873 if ( loadOk && !todolist.isEmpty() )
1871 loadOk = qtopiaFormat.load( calendar, todolist ); 1874 loadOk = qtopiaFormat.load( calendar, todolist );
1872 1875
1873 if ( loadOk ) { 1876 if ( loadOk ) {
1874 getEventViewerDialog()->setSyncMode( true ); 1877 getEventViewerDialog()->setSyncMode( true );
1875 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1878 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1876 getEventViewerDialog()->setSyncMode( false ); 1879 getEventViewerDialog()->setSyncMode( false );
1877 qApp->processEvents(); 1880 qApp->processEvents();
1878 if ( syncOK ) { 1881 if ( syncOK ) {
1879 if ( mSyncManager->mWriteBackFile ) 1882 if ( mSyncManager->mWriteBackFile )
1880 { 1883 {
1881 // write back XML file 1884 // write back XML file
1882 1885
1883 } 1886 }
1884 setModified( true ); 1887 setModified( true );
1885 } 1888 }
1886 } else { 1889 } else {
1887 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; 1890 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ;
1888 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), 1891 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"),
1889 question, i18n("Ok")) ; 1892 question, i18n("Ok")) ;
1890 } 1893 }
1891 delete calendar; 1894 delete calendar;
1892 updateView(); 1895 updateView();
1893 return syncOK; 1896 return syncOK;
1894 1897
1895 1898
1896#endif 1899#endif
1897 1900
1898} 1901}
1899 1902
1900void CalendarView::setSyncEventsReadOnly() 1903void CalendarView::setSyncEventsReadOnly()
1901{ 1904{
1902 mCalendar->setSyncEventsReadOnly(); 1905 mCalendar->setSyncEventsReadOnly();
1903} 1906}
1904 1907
1905bool CalendarView::loadCalendars() 1908bool CalendarView::loadCalendars()
1906{ 1909{
1907 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 1910 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
1908 KopiCalendarFile * cal = calendars.first(); 1911 KopiCalendarFile * cal = calendars.first();
1909 mCalendar->setDefaultCalendar( 1 ); 1912 mCalendar->setDefaultCalendar( 1 );
1910 openCalendar( MainWindow::defaultFileName(), false ); 1913 openCalendar( MainWindow::defaultFileName(), false );
1911 cal = calendars.next(); 1914 cal = calendars.next();
1912 while ( cal ) { 1915 while ( cal ) {
1913 addCalendar( cal ); 1916 addCalendar( cal );
1914 cal = calendars.next(); 1917 cal = calendars.next();
1915 } 1918 }
1916 restoreCalendarSettings(); 1919 restoreCalendarSettings();
1917 return true; 1920 return true;
1918} 1921}
1919bool CalendarView::restoreCalendarSettings() 1922bool CalendarView::restoreCalendarSettings()
1920{ 1923{
1921 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 1924 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
1922 KopiCalendarFile * cal = calendars.first(); 1925 KopiCalendarFile * cal = calendars.first();
1923 while ( cal ) { 1926 while ( cal ) {
1924 mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); 1927 mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled );
1925 mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); 1928 mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled );
1926 mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); 1929 mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly );
1927 if ( cal->isStandard ) 1930 if ( cal->isStandard )
1928 mCalendar->setDefaultCalendar( cal->mCalNumber ); 1931 mCalendar->setDefaultCalendar( cal->mCalNumber );
1929 cal = calendars.next(); 1932 cal = calendars.next();
1930 } 1933 }
1931 setSyncEventsReadOnly(); 1934 setSyncEventsReadOnly();
1932 mCalendar->reInitAlarmSettings(); 1935 mCalendar->reInitAlarmSettings();
1933 updateUnmanagedViews(); 1936 updateUnmanagedViews();
1934 updateView(); 1937 updateView();
1935 return true; 1938 return true;
1936} 1939}
1937void CalendarView::addCalendarId( int id ) 1940void CalendarView::addCalendarId( int id )
1938{ 1941{
1939 KopiCalendarFile * cal = KOPrefs::instance()->getCalendar( id ); 1942 KopiCalendarFile * cal = KOPrefs::instance()->getCalendar( id );
1940 if ( cal ) 1943 if ( cal )
1941 addCalendar( cal ); 1944 addCalendar( cal );
1942} 1945}
1943bool CalendarView::addCalendar( KopiCalendarFile * cal ) 1946bool CalendarView::addCalendar( KopiCalendarFile * cal )
1944{ 1947{
1945 cal->mErrorOnLoad = false; 1948 cal->mErrorOnLoad = false;
1946 if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) { 1949 if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) {
1947 cal->mLoadDt = QDateTime::currentDateTime(); 1950 cal->mLoadDt = QDateTime::currentDateTime();
1948 return true; 1951 return true;
1949 } 1952 }
1950 qDebug("KO: Error adding calendar file %s ",cal->mFileName.latin1() ); 1953 qDebug("KO: Error adding calendar file %s ",cal->mFileName.latin1() );
1951 cal->mErrorOnLoad = true; 1954 cal->mErrorOnLoad = true;
1952 return false; 1955 return false;
1953} 1956}
1954bool CalendarView::openCalendar(QString filename, bool merge) 1957bool CalendarView::openCalendar(QString filename, bool merge)
1955{ 1958{
1956 1959
1957 if (filename.isEmpty()) { 1960 if (filename.isEmpty()) {
1958 return false; 1961 return false;
1959 } 1962 }
1960 1963
1961 if (!QFile::exists(filename)) { 1964 if (!QFile::exists(filename)) {
1962 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); 1965 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename));
1963 return false; 1966 return false;
1964 } 1967 }
1965 1968
1966 globalFlagBlockAgenda = 1; 1969 globalFlagBlockAgenda = 1;
1967 clearAllViews(); 1970 clearAllViews();
1968 if (!merge) { 1971 if (!merge) {
1969 mViewManager->setDocumentId( filename ); 1972 mViewManager->setDocumentId( filename );
1970 mCalendar->close(); 1973 mCalendar->close();
1971 } 1974 }
1972 mStorage->setFileName( filename ); 1975 mStorage->setFileName( filename );
1973 1976
1974 if ( mStorage->load() ) { 1977 if ( mStorage->load() ) {
1975 if ( merge ) ;//setModified( true ); 1978 if ( merge ) ;//setModified( true );
1976 else { 1979 else {
1977 //setModified( true ); 1980 //setModified( true );
1978 mViewManager->setDocumentId( filename ); 1981 mViewManager->setDocumentId( filename );
1979 mDialogManager->setDocumentId( filename ); 1982 mDialogManager->setDocumentId( filename );
1980 mTodoList->setDocumentId( filename ); 1983 mTodoList->setDocumentId( filename );
1981 } 1984 }
1982 globalFlagBlockAgenda = 2; 1985 globalFlagBlockAgenda = 2;
1983 // if ( getLastSyncEvent() ) 1986 // if ( getLastSyncEvent() )
1984 // getLastSyncEvent()->setReadOnly( true ); 1987 // getLastSyncEvent()->setReadOnly( true );
1985 mCalendar->reInitAlarmSettings(); 1988 mCalendar->reInitAlarmSettings();
1986 setSyncEventsReadOnly(); 1989 setSyncEventsReadOnly();
1987 updateUnmanagedViews(); 1990 updateUnmanagedViews();
1988 updateView(); 1991 updateView();
1989 if ( filename != MainWindow::defaultFileName() ) { 1992 if ( filename != MainWindow::defaultFileName() ) {
1990 saveCalendar( MainWindow::defaultFileName() ); 1993 saveCalendar( MainWindow::defaultFileName() );
1991 } else { 1994 } else {
1992 QFileInfo finf ( MainWindow::defaultFileName()); 1995 QFileInfo finf ( MainWindow::defaultFileName());
1993 if ( finf.exists() ) { 1996 if ( finf.exists() ) {
1994 setLoadedFileVersion( finf.lastModified () ); 1997 setLoadedFileVersion( finf.lastModified () );
1995 } 1998 }
1996 } 1999 }
1997 return true; 2000 return true;
1998 } else { 2001 } else {
1999 // while failing to load, the calendar object could 2002 // while failing to load, the calendar object could
2000 // have become partially populated. Clear it out. 2003 // have become partially populated. Clear it out.
2001 if ( !merge ) { 2004 if ( !merge ) {
2002 mCalendar->close(); 2005 mCalendar->close();
2003 mViewManager->setDocumentId( filename ); 2006 mViewManager->setDocumentId( filename );
2004 mDialogManager->setDocumentId( filename ); 2007 mDialogManager->setDocumentId( filename );
2005 mTodoList->setDocumentId( filename ); 2008 mTodoList->setDocumentId( filename );
2006 } 2009 }
2007 2010
2008 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); 2011 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename));
2009 2012
2010 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); 2013 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) );
2011 globalFlagBlockAgenda = 2; 2014 globalFlagBlockAgenda = 2;
2012 mCalendar->reInitAlarmSettings(); 2015 mCalendar->reInitAlarmSettings();
2013 setSyncEventsReadOnly(); 2016 setSyncEventsReadOnly();
2014 updateUnmanagedViews(); 2017 updateUnmanagedViews();
2015 updateView(); 2018 updateView();
2016 } 2019 }
2017 return false; 2020 return false;
2018} 2021}
2019void CalendarView::showOpenError() 2022void CalendarView::showOpenError()
2020{ 2023{
2021 KMessageBox::error(this,i18n("Couldn't load calendar\n.")); 2024 KMessageBox::error(this,i18n("Couldn't load calendar\n."));
2022} 2025}
2023void CalendarView::setLoadedFileVersion(QDateTime dt) 2026void CalendarView::setLoadedFileVersion(QDateTime dt)
2024{ 2027{
2025 loadedFileVersion = dt; 2028 loadedFileVersion = dt;
2026} 2029}
2027bool CalendarView::checkFileChanged(QString fn) 2030bool CalendarView::checkFileChanged(QString fn)
2028{ 2031{
2029 QFileInfo finf ( fn ); 2032 QFileInfo finf ( fn );
2030 if ( !finf.exists() ) 2033 if ( !finf.exists() )
2031 return true; 2034 return true;
2032 QDateTime dt = finf.lastModified (); 2035 QDateTime dt = finf.lastModified ();
2033 if ( dt <= loadedFileVersion ) 2036 if ( dt <= loadedFileVersion )
2034 return false; 2037 return false;
2035 return true; 2038 return true;
2036 2039
2037} 2040}
2038void CalendarView::watchSavedFile() 2041void CalendarView::watchSavedFile()
2039{ 2042{
2040 QFileInfo finf ( MainWindow::defaultFileName()); 2043 QFileInfo finf ( MainWindow::defaultFileName());
2041 if ( !finf.exists() ) 2044 if ( !finf.exists() )
2042 return; 2045 return;
2043 QDateTime dt = finf.lastModified (); 2046 QDateTime dt = finf.lastModified ();
2044 if ( dt < loadedFileVersion ) { 2047 if ( dt < loadedFileVersion ) {
2045 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); 2048 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1());
2046 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); 2049 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) );
2047 return; 2050 return;
2048 } 2051 }
2049 loadedFileVersion = dt; 2052 loadedFileVersion = dt;
2050} 2053}
2051bool CalendarView::checkAllFileVersions() 2054bool CalendarView::checkAllFileVersions()
2052{ 2055{
2053 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 2056 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
2054 KopiCalendarFile * cal = calendars.first(); 2057 KopiCalendarFile * cal = calendars.first();
2055 mCalendar->setDefaultCalendar( 1 ); 2058 mCalendar->setDefaultCalendar( 1 );
2056 mCalendar->setDefaultCalendarEnabledOnly(); 2059 mCalendar->setDefaultCalendarEnabledOnly();
2057 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { 2060 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) {
2058 if ( !checkFileVersion(MainWindow::defaultFileName())) { 2061 if ( !checkFileVersion(MainWindow::defaultFileName())) {
2059 restoreCalendarSettings(); 2062 restoreCalendarSettings();
2060 return false; 2063 return false;
2061 } 2064 }
2062 } 2065 }
2063 cal = calendars.next(); 2066 cal = calendars.next();
2064 QDateTime storeTemp = loadedFileVersion; 2067 QDateTime storeTemp = loadedFileVersion;
2065 while ( cal ) { 2068 while ( cal ) {
2066 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { 2069 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) {
2067 mCalendar->setDefaultCalendar( cal->mCalNumber ); 2070 mCalendar->setDefaultCalendar( cal->mCalNumber );
2068 mCalendar->setDefaultCalendarEnabledOnly(); 2071 mCalendar->setDefaultCalendarEnabledOnly();
2069 loadedFileVersion = cal->mLoadDt.addSecs( 15 ); 2072 loadedFileVersion = cal->mLoadDt.addSecs( 15 );
2070 if ( !checkFileVersion(cal->mFileName )) { 2073 if ( !checkFileVersion(cal->mFileName )) {
2071 loadedFileVersion = storeTemp; 2074 loadedFileVersion = storeTemp;
2072 restoreCalendarSettings(); 2075 restoreCalendarSettings();
2073 return false; 2076 return false;
2074 } 2077 }
2075 } 2078 }
2076 cal = calendars.next(); 2079 cal = calendars.next();
2077 } 2080 }
2078 loadedFileVersion = storeTemp; 2081 loadedFileVersion = storeTemp;
2079 return true; 2082 return true;
2080} 2083}
2081bool CalendarView::checkFileVersion(QString fn) 2084bool CalendarView::checkFileVersion(QString fn)
2082{ 2085{
2083 QFileInfo finf ( fn ); 2086 QFileInfo finf ( fn );
2084 if ( !finf.exists() ) 2087 if ( !finf.exists() )
2085 return true; 2088 return true;
2086 QDateTime dt = finf.lastModified (); 2089 QDateTime dt = finf.lastModified ();
2087 qDebug("loaded file version %s %s", fn.latin1(), loadedFileVersion.toString().latin1()); 2090 qDebug("loaded file version %s %s", fn.latin1(), loadedFileVersion.toString().latin1());
2088 qDebug("file on disk version %s %s", fn.latin1(),dt.toString().latin1()); 2091 qDebug("file on disk version %s %s", fn.latin1(),dt.toString().latin1());
2089 if ( dt <= loadedFileVersion ) 2092 if ( dt <= loadedFileVersion )
2090 return true; 2093 return true;
2091 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file\n%1\n on disk has changed!\nFile size: %2 bytes.\nLast modified: %3\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg(fn).arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , 2094 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file\n%1\n on disk has changed!\nFile size: %2 bytes.\nLast modified: %3\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg(fn).arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) ,
2092 i18n("KO/Pi Warning"),i18n("Overwrite"), 2095 i18n("KO/Pi Warning"),i18n("Overwrite"),
2093 i18n("Sync+save")); 2096 i18n("Sync+save"));
2094 2097
2095 if ( km == KMessageBox::Cancel ) 2098 if ( km == KMessageBox::Cancel )
2096 return false; 2099 return false;
2097 if ( km == KMessageBox::Yes ) 2100 if ( km == KMessageBox::Yes )
2098 return true; 2101 return true;
2099 2102
2100 setSyncDevice("deleteaftersync" ); 2103 setSyncDevice("deleteaftersync" );
2101 mSyncManager->mAskForPreferences = true; 2104 mSyncManager->mAskForPreferences = true;
2102 mSyncManager->mSyncAlgoPrefs = 3; 2105 mSyncManager->mSyncAlgoPrefs = 3;
2103 mSyncManager->mWriteBackFile = false; 2106 mSyncManager->mWriteBackFile = false;
2104 mSyncManager->mWriteBackExistingOnly = false; 2107 mSyncManager->mWriteBackExistingOnly = false;
2105 mSyncManager->mShowSyncSummary = false; 2108 mSyncManager->mShowSyncSummary = false;
2106 syncCalendar( fn, 3 ); 2109 syncCalendar( fn, 3 );
2107 Event * e = getLastSyncEvent(); 2110 Event * e = getLastSyncEvent();
2108 if ( e ) 2111 if ( e )
2109 mCalendar->deleteEvent( e ); 2112 mCalendar->deleteEvent( e );
2110 return true; 2113 return true;
2111} 2114}
2112bool CalendarView::saveCalendars() 2115bool CalendarView::saveCalendars()
2113{ 2116{
2114 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 2117 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
2115 KopiCalendarFile * cal = calendars.first(); 2118 KopiCalendarFile * cal = calendars.first();
2116 mCalendar->setDefaultCalendar( 1 ); 2119 mCalendar->setDefaultCalendar( 1 );
2117 mCalendar->setDefaultCalendarEnabledOnly(); 2120 mCalendar->setDefaultCalendarEnabledOnly();
2118 saveCalendar( MainWindow::defaultFileName() ); 2121 saveCalendar( MainWindow::defaultFileName() );
2119 cal = calendars.next(); 2122 cal = calendars.next();
2120 while ( cal ) { 2123 while ( cal ) {
2121 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { 2124 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) {
2122 mCalendar->setDefaultCalendar( cal->mCalNumber ); 2125 mCalendar->setDefaultCalendar( cal->mCalNumber );
2123 mCalendar->setDefaultCalendarEnabledOnly(); 2126 mCalendar->setDefaultCalendarEnabledOnly();
2124 if ( saveCalendar( cal->mFileName ) ) 2127 if ( saveCalendar( cal->mFileName ) )
2125 cal->mLoadDt = QDateTime::currentDateTime(); 2128 cal->mLoadDt = QDateTime::currentDateTime();
2126 } 2129 }
2127 cal = calendars.next(); 2130 cal = calendars.next();
2128 } 2131 }
2129 restoreCalendarSettings(); 2132 restoreCalendarSettings();
2130 return true; 2133 return true;
2131} 2134}
2132bool CalendarView::saveCalendar( QString filename ) 2135bool CalendarView::saveCalendar( QString filename )
2133{ 2136{
2134 2137
2135 // Store back all unsaved data into calendar object 2138 // Store back all unsaved data into calendar object
2136 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); 2139 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() );
2137 if ( mViewManager->currentView() ) 2140 if ( mViewManager->currentView() )
2138 mViewManager->currentView()->flushView(); 2141 mViewManager->currentView()->flushView();
2139 2142
2140 2143
2141 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); 2144 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2);
2142 mStorage->setSaveFormat( new ICalFormat() ); 2145 mStorage->setSaveFormat( new ICalFormat() );
2143 mStorage->setFileName( filename ); 2146 mStorage->setFileName( filename );
2144 bool success; 2147 bool success;
2145 success = mStorage->save(); 2148 success = mStorage->save();
2146 if ( !success ) { 2149 if ( !success ) {
2147 return false; 2150 return false;
2148 } 2151 }
2149 if ( filename == MainWindow::defaultFileName() ) { 2152 if ( filename == MainWindow::defaultFileName() ) {
2150 setLoadedFileVersion( lfv ); 2153 setLoadedFileVersion( lfv );
2151 watchSavedFile(); 2154 watchSavedFile();
2152 } 2155 }
2153 return true; 2156 return true;
2154} 2157}
2155 2158
2156void CalendarView::closeCalendar() 2159void CalendarView::closeCalendar()
2157{ 2160{
2158 2161
2159 // child windows no longer valid 2162 // child windows no longer valid
2160 clearAllViews(); 2163 clearAllViews();
2161 emit closingDown(); 2164 emit closingDown();
2162 2165
2163 mCalendar->close(); 2166 mCalendar->close();
2164 setModified(false); 2167 setModified(false);
2165 updateView(); 2168 updateView();
2166} 2169}
2167 2170
2168void CalendarView::archiveCalendar() 2171void CalendarView::archiveCalendar()
2169{ 2172{
2170 mDialogManager->showArchiveDialog(); 2173 mDialogManager->showArchiveDialog();
2171} 2174}
2172 2175
2173 2176
2174void CalendarView::readSettings() 2177void CalendarView::readSettings()
2175{ 2178{
2176 2179
2177 2180
2178 // mViewManager->showAgendaView(); 2181 // mViewManager->showAgendaView();
2179 QString str; 2182 QString str;
2180 //qDebug("CalendarView::readSettings() "); 2183 //qDebug("CalendarView::readSettings() ");
2181 // read settings from the KConfig, supplying reasonable 2184 // read settings from the KConfig, supplying reasonable
2182 // defaults where none are to be found 2185 // defaults where none are to be found
2183 KConfig *config = KOGlobals::config(); 2186 KConfig *config = KOGlobals::config();
2184#ifndef KORG_NOSPLITTER 2187#ifndef KORG_NOSPLITTER
2185 config->setGroup("KOrganizer Geometry"); 2188 config->setGroup("KOrganizer Geometry");
2186 2189
2187 QValueList<int> sizes = config->readIntListEntry("Separator1"); 2190 QValueList<int> sizes = config->readIntListEntry("Separator1");
2188 if (sizes.count() != 2) { 2191 if (sizes.count() != 2) {
2189 sizes << mDateNavigator->minimumSizeHint().width(); 2192 sizes << mDateNavigator->minimumSizeHint().width();
2190 sizes << 300; 2193 sizes << 300;
2191 } 2194 }
2192 mPanner->setSizes(sizes); 2195 mPanner->setSizes(sizes);
2193 2196
2194 sizes = config->readIntListEntry("Separator2"); 2197 sizes = config->readIntListEntry("Separator2");
2195 if ( ( mResourceView && sizes.count() == 4 ) || 2198 if ( ( mResourceView && sizes.count() == 4 ) ||
2196 ( !mResourceView && sizes.count() == 3 ) ) { 2199 ( !mResourceView && sizes.count() == 3 ) ) {
2197 mLeftSplitter->setSizes(sizes); 2200 mLeftSplitter->setSizes(sizes);
2198 } 2201 }
2199#endif 2202#endif
2200 globalFlagBlockAgenda = 1; 2203 globalFlagBlockAgenda = 1;
2201 mViewManager->showAgendaView(); 2204 mViewManager->showAgendaView();
2202 //mViewManager->readSettings( config ); 2205 //mViewManager->readSettings( config );
2203 mTodoList->restoreLayout(config,QString("Todo Layout")); 2206 mTodoList->restoreLayout(config,QString("Todo Layout"));
2204 readFilterSettings(config); 2207 readFilterSettings(config);
2205 2208
2206#ifdef DESKTOP_VERSION 2209#ifdef DESKTOP_VERSION
2207 config->setGroup("WidgetLayout"); 2210 config->setGroup("WidgetLayout");
2208 QStringList list; 2211 QStringList list;
2209 list = config->readListEntry("MainLayout"); 2212 list = config->readListEntry("MainLayout");
2210 int x,y,w,h; 2213 int x,y,w,h;
2211 if ( ! list.isEmpty() ) { 2214 if ( ! list.isEmpty() ) {
2212 x = list[0].toInt(); 2215 x = list[0].toInt();
2213 y = list[1].toInt(); 2216 y = list[1].toInt();
2214 w = list[2].toInt(); 2217 w = list[2].toInt();
2215 h = list[3].toInt(); 2218 h = list[3].toInt();
2216 KApplication::testCoords( &x,&y,&w,&h ); 2219 KApplication::testCoords( &x,&y,&w,&h );
2217 topLevelWidget()->setGeometry(x,y,w,h); 2220 topLevelWidget()->setGeometry(x,y,w,h);
2218 2221
2219 } else { 2222 } else {
2220 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 2223 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
2221 } 2224 }
2222 list = config->readListEntry("EditEventLayout"); 2225 list = config->readListEntry("EditEventLayout");
2223 if ( ! list.isEmpty() ) { 2226 if ( ! list.isEmpty() ) {
2224 x = list[0].toInt(); 2227 x = list[0].toInt();
2225 y = list[1].toInt(); 2228 y = list[1].toInt();
2226 w = list[2].toInt(); 2229 w = list[2].toInt();
2227 h = list[3].toInt(); 2230 h = list[3].toInt();
2228 KApplication::testCoords( &x,&y,&w,&h ); 2231 KApplication::testCoords( &x,&y,&w,&h );
2229 mEventEditor->setGeometry(x,y,w,h); 2232 mEventEditor->setGeometry(x,y,w,h);
2230 2233
2231 } 2234 }
2232 list = config->readListEntry("EditTodoLayout"); 2235 list = config->readListEntry("EditTodoLayout");
2233 if ( ! list.isEmpty() ) { 2236 if ( ! list.isEmpty() ) {
2234 x = list[0].toInt(); 2237 x = list[0].toInt();
2235 y = list[1].toInt(); 2238 y = list[1].toInt();
2236 w = list[2].toInt(); 2239 w = list[2].toInt();
2237 h = list[3].toInt(); 2240 h = list[3].toInt();
2238 KApplication::testCoords( &x,&y,&w,&h ); 2241 KApplication::testCoords( &x,&y,&w,&h );
2239 mTodoEditor->setGeometry(x,y,w,h); 2242 mTodoEditor->setGeometry(x,y,w,h);
2240 2243
2241 } 2244 }
2242 list = config->readListEntry("ViewerLayout"); 2245 list = config->readListEntry("ViewerLayout");
2243 if ( ! list.isEmpty() ) { 2246 if ( ! list.isEmpty() ) {
2244 x = list[0].toInt(); 2247 x = list[0].toInt();
2245 y = list[1].toInt(); 2248 y = list[1].toInt();
2246 w = list[2].toInt(); 2249 w = list[2].toInt();
2247 h = list[3].toInt(); 2250 h = list[3].toInt();
2248 KApplication::testCoords( &x,&y,&w,&h ); 2251 KApplication::testCoords( &x,&y,&w,&h );
2249 getEventViewerDialog()->setGeometry(x,y,w,h); 2252 getEventViewerDialog()->setGeometry(x,y,w,h);
2250 } 2253 }
2251#endif 2254#endif
2252 config->setGroup( "Views" ); 2255 config->setGroup( "Views" );
2253 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 2256 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
2254 2257
2255 QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); 2258 QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame");
2256 2259
2257 int resetval = 0; 2260 int resetval = 0;
2258 int maxVal = 0; 2261 int maxVal = 0;
2259 if (sizes.count() != 3) { 2262 if (sizes.count() != 3) {
2260 if ( KOPrefs::instance()->mVerticalScreen ) { 2263 if ( KOPrefs::instance()->mVerticalScreen ) {
2261 resetval = mDateNavigator->sizeHint().width()+2; 2264 resetval = mDateNavigator->sizeHint().width()+2;
2262 } else { 2265 } else {
2263 resetval = mDateNavigator->sizeHint().height()+2; 2266 resetval = mDateNavigator->sizeHint().height()+2;
2264 } 2267 }
2265 } 2268 }
2266 if ( resetval ) { 2269 if ( resetval ) {
2267 sizes.clear(); 2270 sizes.clear();
2268 if ( KOPrefs::instance()->mVerticalScreen ) { 2271 if ( KOPrefs::instance()->mVerticalScreen ) {
2269 maxVal = QApplication::desktop()->width() -10; 2272 maxVal = QApplication::desktop()->width() -10;
2270 } else { 2273 } else {
2271 maxVal = QApplication::desktop()->height()-10; 2274 maxVal = QApplication::desktop()->height()-10;
2272 } 2275 }
2273 sizes << resetval; 2276 sizes << resetval;
2274 if ( maxVal < resetval + resetval) 2277 if ( maxVal < resetval + resetval)
2275 resetval = maxVal - resetval; 2278 resetval = maxVal - resetval;
2276 sizes << resetval; 2279 sizes << resetval;
2277 sizes << 100; 2280 sizes << 100;
2278 } 2281 }
2279 mLeftFrame->setSizes(sizes); 2282 mLeftFrame->setSizes(sizes);
2280 sizes = config->readIntListEntry("Main Splitter Frame"); 2283 sizes = config->readIntListEntry("Main Splitter Frame");
2281 resetval = 0; 2284 resetval = 0;
2282 maxVal = 0; 2285 maxVal = 0;
2283 if (sizes.count() != 2) { 2286 if (sizes.count() != 2) {
2284 if ( !KOPrefs::instance()->mVerticalScreen ) { 2287 if ( !KOPrefs::instance()->mVerticalScreen ) {
2285 resetval = mDateNavigator->sizeHint().width()+2; 2288 resetval = mDateNavigator->sizeHint().width()+2;
2286 } else { 2289 } else {
2287 resetval = mDateNavigator->sizeHint().height()+2; 2290 resetval = mDateNavigator->sizeHint().height()+2;
2288 } 2291 }
2289 } 2292 }
2290 if ( resetval ) { 2293 if ( resetval ) {
2291 sizes.clear(); 2294 sizes.clear();
2292 if ( !KOPrefs::instance()->mVerticalScreen ) { 2295 if ( !KOPrefs::instance()->mVerticalScreen ) {
2293 maxVal = QApplication::desktop()->width() -10; 2296 maxVal = QApplication::desktop()->width() -10;
2294 } else { 2297 } else {
2295 maxVal = QApplication::desktop()->height()-10; 2298 maxVal = QApplication::desktop()->height()-10;
2296 } 2299 }
2297 sizes << resetval; 2300 sizes << resetval;
2298 if ( maxVal < resetval + resetval) 2301 if ( maxVal < resetval + resetval)
2299 resetval = maxVal - resetval; 2302 resetval = maxVal - resetval;
2300 sizes << resetval; 2303 sizes << resetval;
2301 } 2304 }
2302 mMainFrame->setSizes(sizes); 2305 mMainFrame->setSizes(sizes);
2303 if ( dateCount == 5 ) mNavigator->selectWorkWeek(); 2306 if ( dateCount == 5 ) mNavigator->selectWorkWeek();
2304 else if ( dateCount == 7 ) mNavigator->selectWeek(); 2307 else if ( dateCount == 7 ) mNavigator->selectWeek();
2305 else mNavigator->selectDates( dateCount ); 2308 else mNavigator->selectDates( dateCount );
2306 // mViewManager->readSettings( config ); 2309 // mViewManager->readSettings( config );
2307 updateConfig(); 2310 updateConfig();
2308 globalFlagBlockAgenda = 2; 2311 globalFlagBlockAgenda = 2;
2309 mViewManager->readSettings( config ); 2312 mViewManager->readSettings( config );
2310 QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); 2313 QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) );
2311} 2314}
2312 2315
2313 2316void CalendarView::checkSuspendAlarm()
2317{
2318 if ( mSuspendTimer->isActive() ) {
2319 KMessageBox::information( this, i18n("<b>WARNING:</b> There is a pending suspended alarm!"), i18n("Pending Suspend Alarm"));
2320 }
2321}
2314void CalendarView::writeSettings() 2322void CalendarView::writeSettings()
2315{ 2323{
2316 // kdDebug() << "CalendarView::writeSettings" << endl; 2324 // kdDebug() << "CalendarView::writeSettings" << endl;
2317 2325
2318 KConfig *config = KOGlobals::config(); 2326 KConfig *config = KOGlobals::config();
2319 2327
2320 mViewManager->writeSettings( config ); 2328 mViewManager->writeSettings( config );
2321 mTodoList->saveLayout(config,QString("Todo Layout")); 2329 mTodoList->saveLayout(config,QString("Todo Layout"));
2322 mDialogManager->writeSettings( config ); 2330 mDialogManager->writeSettings( config );
2323 //KOPrefs::instance()->usrWriteConfig(); 2331 //KOPrefs::instance()->usrWriteConfig();
2324 KOPrefs::instance()->writeConfig(); 2332 KOPrefs::instance()->writeConfig();
2325 2333
2326 writeFilterSettings(config); 2334 writeFilterSettings(config);
2327 config->setGroup( "AppRun" ); 2335 config->setGroup( "AppRun" );
2328 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 2336 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
2329 int days = dt.daysTo( QDate::currentDate() ); 2337 int days = dt.daysTo( QDate::currentDate() );
2330 dt = dt.addDays( days ); 2338 dt = dt.addDays( days );
2331 int secs = dt.secsTo( QDateTime::currentDateTime() ); 2339 int secs = dt.secsTo( QDateTime::currentDateTime() );
2332 config->writeEntry( "LatestProgramStopDays", days ); 2340 config->writeEntry( "LatestProgramStopDays", days );
2333 config->writeEntry( "LatestProgramStopSecs", secs ); 2341 config->writeEntry( "LatestProgramStopSecs", secs );
2334 //qDebug("KO: Writing stop time: %d ", secs); 2342 //qDebug("KO: Writing stop time: %d ", secs);
2335 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); 2343 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
2336 //QDateTime latest = dt.addSecs ( secs ); 2344 //QDateTime latest = dt.addSecs ( secs );
2337 //qDebug("KO: Termination on %s ", latest.toString().latin1()); 2345 //qDebug("KO: Termination on %s ", latest.toString().latin1());
2338 config->setGroup( "Views" ); 2346 config->setGroup( "Views" );
2339 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); 2347 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
2340 2348
2341#if 0 2349#if 0
2342 qDebug("********************* "); 2350 qDebug("********************* ");
2343 qDebug("Testcode secsto "); 2351 qDebug("Testcode secsto ");
2344 QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) ); 2352 QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) );
2345 QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) ); 2353 QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) );
2346 int secsto = dt_nodaylight.secsTo( dt_daylight ); 2354 int secsto = dt_nodaylight.secsTo( dt_daylight );
2347 QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto ); 2355 QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto );
2348 qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() ); 2356 qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() );
2349 qDebug("dt daylight %s ",dt_daylight.toString().latin1() ); 2357 qDebug("dt daylight %s ",dt_daylight.toString().latin1() );
2350 qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() ); 2358 qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() );
2351 qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600); 2359 qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600);
2352 qDebug("********************* testcode end"); 2360 qDebug("********************* testcode end");
2353 2361
2354#endif 2362#endif
2355 2363
2356 QValueList<int> listINT = mLeftFrame->sizes(); 2364 QValueList<int> listINT = mLeftFrame->sizes();
2357 config->writeEntry("Left Splitter Frame",listINT); 2365 config->writeEntry("Left Splitter Frame",listINT);
2358 QValueList<int> listINT2 = mMainFrame->sizes(); 2366 QValueList<int> listINT2 = mMainFrame->sizes();
2359 config->writeEntry("Main Splitter Frame",listINT2); 2367 config->writeEntry("Main Splitter Frame",listINT2);
2360#ifdef DESKTOP_VERSION 2368#ifdef DESKTOP_VERSION
2361 config->setGroup("WidgetLayout"); 2369 config->setGroup("WidgetLayout");
2362 QStringList list ;//= config->readListEntry("MainLayout"); 2370 QStringList list ;//= config->readListEntry("MainLayout");
2363 int x,y,w,h; 2371 int x,y,w,h;
2364 QWidget* wid; 2372 QWidget* wid;
2365 wid = topLevelWidget(); 2373 wid = topLevelWidget();
2366 x = wid->geometry().x(); 2374 x = wid->geometry().x();
2367 y = wid->geometry().y(); 2375 y = wid->geometry().y();
2368 w = wid->width(); 2376 w = wid->width();
2369 h = wid->height(); 2377 h = wid->height();
2370 list.clear(); 2378 list.clear();
2371 list << QString::number( x ); 2379 list << QString::number( x );
2372 list << QString::number( y ); 2380 list << QString::number( y );
2373 list << QString::number( w ); 2381 list << QString::number( w );
2374 list << QString::number( h ); 2382 list << QString::number( h );
2375 config->writeEntry("MainLayout",list ); 2383 config->writeEntry("MainLayout",list );
2376 2384
2377 wid = mEventEditor; 2385 wid = mEventEditor;
2378 x = wid->geometry().x(); 2386 x = wid->geometry().x();
2379 y = wid->geometry().y(); 2387 y = wid->geometry().y();
2380 w = wid->width(); 2388 w = wid->width();
2381 h = wid->height(); 2389 h = wid->height();
2382 list.clear(); 2390 list.clear();
2383 list << QString::number( x ); 2391 list << QString::number( x );
2384 list << QString::number( y ); 2392 list << QString::number( y );
2385 list << QString::number( w ); 2393 list << QString::number( w );
2386 list << QString::number( h ); 2394 list << QString::number( h );
2387 config->writeEntry("EditEventLayout",list ); 2395 config->writeEntry("EditEventLayout",list );
2388 2396
2389 wid = mTodoEditor; 2397 wid = mTodoEditor;
2390 x = wid->geometry().x(); 2398 x = wid->geometry().x();
2391 y = wid->geometry().y(); 2399 y = wid->geometry().y();
2392 w = wid->width(); 2400 w = wid->width();
2393 h = wid->height(); 2401 h = wid->height();
2394 list.clear(); 2402 list.clear();
2395 list << QString::number( x ); 2403 list << QString::number( x );
2396 list << QString::number( y ); 2404 list << QString::number( y );
2397 list << QString::number( w ); 2405 list << QString::number( w );
2398 list << QString::number( h ); 2406 list << QString::number( h );
2399 config->writeEntry("EditTodoLayout",list ); 2407 config->writeEntry("EditTodoLayout",list );
2400 wid = getEventViewerDialog(); 2408 wid = getEventViewerDialog();
2401 x = wid->geometry().x(); 2409 x = wid->geometry().x();
2402 y = wid->geometry().y(); 2410 y = wid->geometry().y();
2403 w = wid->width(); 2411 w = wid->width();
2404 h = wid->height(); 2412 h = wid->height();
2405 list.clear(); 2413 list.clear();
2406 list << QString::number( x ); 2414 list << QString::number( x );
2407 list << QString::number( y ); 2415 list << QString::number( y );
2408 list << QString::number( w ); 2416 list << QString::number( w );
2409 list << QString::number( h ); 2417 list << QString::number( h );
2410 config->writeEntry("ViewerLayout",list ); 2418 config->writeEntry("ViewerLayout",list );
2411 wid = mDialogManager->getSearchDialog(); 2419 wid = mDialogManager->getSearchDialog();
2412 if ( wid ) { 2420 if ( wid ) {
2413 x = wid->geometry().x(); 2421 x = wid->geometry().x();
2414 y = wid->geometry().y(); 2422 y = wid->geometry().y();
2415 w = wid->width(); 2423 w = wid->width();
2416 h = wid->height(); 2424 h = wid->height();
2417 list.clear(); 2425 list.clear();
2418 list << QString::number( x ); 2426 list << QString::number( x );
2419 list << QString::number( y ); 2427 list << QString::number( y );
2420 list << QString::number( w ); 2428 list << QString::number( w );
2421 list << QString::number( h ); 2429 list << QString::number( h );
2422 config->writeEntry("SearchLayout",list ); 2430 config->writeEntry("SearchLayout",list );
2423 } 2431 }
2424#endif 2432#endif
2425 2433
2426 2434
2427 config->sync(); 2435 config->sync();
2428} 2436}
2429 2437
2430void CalendarView::readFilterSettings(KConfig *config) 2438void CalendarView::readFilterSettings(KConfig *config)
2431{ 2439{
2432 // kdDebug() << "CalendarView::readFilterSettings()" << endl; 2440 // kdDebug() << "CalendarView::readFilterSettings()" << endl;
2433 2441
2434 mFilters.clear(); 2442 mFilters.clear();
2435 2443
2436 config->setGroup("General"); 2444 config->setGroup("General");
2437 QStringList filterList = config->readListEntry("CalendarFilters"); 2445 QStringList filterList = config->readListEntry("CalendarFilters");
2438 2446
2439 QStringList::ConstIterator it = filterList.begin(); 2447 QStringList::ConstIterator it = filterList.begin();
2440 QStringList::ConstIterator end = filterList.end(); 2448 QStringList::ConstIterator end = filterList.end();
2441 while(it != end) { 2449 while(it != end) {
2442 // kdDebug() << " filter: " << (*it) << endl; 2450 // kdDebug() << " filter: " << (*it) << endl;
2443 2451
2444 CalFilter *filter; 2452 CalFilter *filter;
2445 filter = new CalFilter(*it); 2453 filter = new CalFilter(*it);
2446 config->setGroup("Filter_" + (*it).utf8()); 2454 config->setGroup("Filter_" + (*it).utf8());
2447 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); 2455 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) );
2448 filter->setCriteria(config->readNumEntry("Criteria",0)); 2456 filter->setCriteria(config->readNumEntry("Criteria",0));
2449 filter->setCategoryList(config->readListEntry("CategoryList")); 2457 filter->setCategoryList(config->readListEntry("CategoryList"));
2450 mFilters.append(filter); 2458 mFilters.append(filter);
2451 2459
2452 ++it; 2460 ++it;
2453 } 2461 }
2454 2462
2455 if (mFilters.count() == 0) { 2463 if (mFilters.count() == 0) {
2456 CalFilter *filter = new CalFilter(i18n("Default")); 2464 CalFilter *filter = new CalFilter(i18n("Default"));
2457 mFilters.append(filter); 2465 mFilters.append(filter);
2458 } 2466 }
2459 mFilterView->updateFilters(); 2467 mFilterView->updateFilters();
2460 config->setGroup("FilterView"); 2468 config->setGroup("FilterView");
2461 2469
2462 mFilterView->blockSignals(true); 2470 mFilterView->blockSignals(true);
2463 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); 2471 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled"));
2464 mFilterView->setSelectedFilter(config->readEntry("Current Filter")); 2472 mFilterView->setSelectedFilter(config->readEntry("Current Filter"));
2465 mFilterView->blockSignals(false); 2473 mFilterView->blockSignals(false);
2466 // We do it manually to avoid it being done twice by the above calls 2474 // We do it manually to avoid it being done twice by the above calls
2467 updateFilter(); 2475 updateFilter();
2468} 2476}
2469 2477
2470void CalendarView::writeFilterSettings(KConfig *config) 2478void CalendarView::writeFilterSettings(KConfig *config)
2471{ 2479{
2472 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 2480 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
2473 2481
2474 QStringList filterList; 2482 QStringList filterList;
2475 2483
2476 CalFilter *filter = mFilters.first(); 2484 CalFilter *filter = mFilters.first();
2477 while(filter) { 2485 while(filter) {
2478 // kdDebug() << " fn: " << filter->name() << endl; 2486 // kdDebug() << " fn: " << filter->name() << endl;
2479 filterList << filter->name(); 2487 filterList << filter->name();
2480 config->setGroup("Filter_" + filter->name().utf8()); 2488 config->setGroup("Filter_" + filter->name().utf8());
2481 config->writeEntry("Criteria",filter->criteria()); 2489 config->writeEntry("Criteria",filter->criteria());
2482 config->writeEntry("CategoryList",filter->categoryList()); 2490 config->writeEntry("CategoryList",filter->categoryList());
2483 filter = mFilters.next(); 2491 filter = mFilters.next();
2484 } 2492 }
2485 config->setGroup("General"); 2493 config->setGroup("General");
2486 config->writeEntry("CalendarFilters",filterList); 2494 config->writeEntry("CalendarFilters",filterList);
2487 2495
2488 config->setGroup("FilterView"); 2496 config->setGroup("FilterView");
2489 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 2497 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
2490 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 2498 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
2491} 2499}
2492 2500
2493 2501
2494void CalendarView::goToday() 2502void CalendarView::goToday()
2495{ 2503{
2496 if ( mViewManager->currentView()->isMonthView() ) 2504 if ( mViewManager->currentView()->isMonthView() )
2497 mNavigator->selectTodayMonth(); 2505 mNavigator->selectTodayMonth();
2498 else 2506 else
2499 mNavigator->selectToday(); 2507 mNavigator->selectToday();
2500} 2508}
2501 2509
2502void CalendarView::goNext() 2510void CalendarView::goNext()
2503{ 2511{
2504 mNavigator->selectNext(); 2512 mNavigator->selectNext();
2505} 2513}
2506 2514
2507void CalendarView::goPrevious() 2515void CalendarView::goPrevious()
2508{ 2516{
2509 mNavigator->selectPrevious(); 2517 mNavigator->selectPrevious();
2510} 2518}
2511void CalendarView::goNextMonth() 2519void CalendarView::goNextMonth()
2512{ 2520{
2513 mNavigator->selectNextMonth(); 2521 mNavigator->selectNextMonth();
2514} 2522}
2515 2523
2516void CalendarView::goPreviousMonth() 2524void CalendarView::goPreviousMonth()
2517{ 2525{
2518 mNavigator->selectPreviousMonth(); 2526 mNavigator->selectPreviousMonth();
2519} 2527}
2520 2528
2521void CalendarView::updateConfig() 2529void CalendarView::updateConfig()
2522{ 2530{
2523 if ( KOPrefs::instance()->mUseAppColors ) 2531 if ( KOPrefs::instance()->mUseAppColors )
2524 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2532 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2525 emit configChanged(); 2533 emit configChanged();
2526 mTodoList->updateConfig(); 2534 mTodoList->updateConfig();
2527 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2535 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2528 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2536 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2529 // To make the "fill window" configurations work 2537 // To make the "fill window" configurations work
2530 //mViewManager->raiseCurrentView(); 2538 //mViewManager->raiseCurrentView();
2531} 2539}
2532 2540
2533 2541
2534void CalendarView::eventChanged(Event *event) 2542void CalendarView::eventChanged(Event *event)
2535{ 2543{
2536 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2544 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2537 //updateUnmanagedViews(); 2545 //updateUnmanagedViews();
2538} 2546}
2539 2547
2540void CalendarView::eventAdded(Event *event) 2548void CalendarView::eventAdded(Event *event)
2541{ 2549{
2542 changeEventDisplay(event,KOGlobals::EVENTADDED); 2550 changeEventDisplay(event,KOGlobals::EVENTADDED);
2543} 2551}
2544 2552
2545void CalendarView::eventToBeDeleted(Event *) 2553void CalendarView::eventToBeDeleted(Event *)
2546{ 2554{
2547 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2555 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2548} 2556}
2549 2557
2550void CalendarView::eventDeleted() 2558void CalendarView::eventDeleted()
2551{ 2559{
2552 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2560 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2553} 2561}
2554void CalendarView::changeTodoDisplay(Todo *which, int action) 2562void CalendarView::changeTodoDisplay(Todo *which, int action)
2555{ 2563{
2556 changeIncidenceDisplay((Incidence *)which, action); 2564 changeIncidenceDisplay((Incidence *)which, action);
2557 mDateNavigator->updateView(); //LR 2565 mDateNavigator->updateView(); //LR
2558 //mDialogManager->updateSearchDialog(); 2566 //mDialogManager->updateSearchDialog();
2559 2567
2560 if (which) { 2568 if (which) {
2561 mViewManager->updateWNview(); 2569 mViewManager->updateWNview();
2562 //mTodoList->updateView(); 2570 //mTodoList->updateView();
2563 } 2571 }
2564 2572
2565} 2573}
2566 2574
2567void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2575void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2568{ 2576{
2569 updateUnmanagedViews(); 2577 updateUnmanagedViews();
2570 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2578 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2571 if ( action == KOGlobals::EVENTDELETED ) { //delete 2579 if ( action == KOGlobals::EVENTDELETED ) { //delete
2572 mCalendar->checkAlarmForIncidence( 0, true ); 2580 mCalendar->checkAlarmForIncidence( 0, true );
2573 if ( mEventViewerDialog ) 2581 if ( mEventViewerDialog )
2574 mEventViewerDialog->hide(); 2582 mEventViewerDialog->hide();
2575 } 2583 }
2576 else 2584 else
2577 mCalendar->checkAlarmForIncidence( which , false ); 2585 mCalendar->checkAlarmForIncidence( which , false );
2578} 2586}
2579 2587
2580// most of the changeEventDisplays() right now just call the view's 2588// most of the changeEventDisplays() right now just call the view's
2581// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2589// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2582void CalendarView::changeEventDisplay(Event *which, int action) 2590void CalendarView::changeEventDisplay(Event *which, int action)
2583{ 2591{
2584 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2592 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2585 changeIncidenceDisplay((Incidence *)which, action); 2593 changeIncidenceDisplay((Incidence *)which, action);
2586 mDateNavigator->updateView(); 2594 mDateNavigator->updateView();
2587 //mDialogManager->updateSearchDialog(); 2595 //mDialogManager->updateSearchDialog();
2588 2596
2589 if (which) { 2597 if (which) {
2590 // If there is an event view visible update the display 2598 // If there is an event view visible update the display
2591 mViewManager->currentView()->changeEventDisplay(which,action); 2599 mViewManager->currentView()->changeEventDisplay(which,action);
2592 // TODO: check, if update needed 2600 // TODO: check, if update needed
2593 // if (which->getTodoStatus()) { 2601 // if (which->getTodoStatus()) {
2594 mTodoList->updateView(); 2602 mTodoList->updateView();
2595 // } 2603 // }
2596 } else { 2604 } else {
2597 mViewManager->currentView()->updateView(); 2605 mViewManager->currentView()->updateView();
2598 } 2606 }
2599} 2607}
2600 2608
2601 2609
2602void CalendarView::updateTodoViews() 2610void CalendarView::updateTodoViews()
2603{ 2611{
2604 mTodoList->updateView(); 2612 mTodoList->updateView();
2605 mViewManager->currentView()->updateView(); 2613 mViewManager->currentView()->updateView();
2606 2614
2607} 2615}
2608 2616
2609 2617
2610void CalendarView::updateView(const QDate &start, const QDate &end) 2618void CalendarView::updateView(const QDate &start, const QDate &end)
2611{ 2619{
2612#ifdef DESKTOP_VERSION 2620#ifdef DESKTOP_VERSION
2613 mDateScrollBar->blockSignals( true ); 2621 mDateScrollBar->blockSignals( true );
2614 mDateScrollBar->setValue( start.dayOfYear()-1); 2622 mDateScrollBar->setValue( start.dayOfYear()-1);
2615 mDateScrollBar->blockSignals( false ); 2623 mDateScrollBar->blockSignals( false );
2616#endif 2624#endif
2617 mTodoList->updateView(); 2625 mTodoList->updateView();
2618 mViewManager->updateView(start, end); 2626 mViewManager->updateView(start, end);
2619 //mDateNavigator->updateView(); 2627 //mDateNavigator->updateView();
2620} 2628}
2621 2629
2622void CalendarView::clearAllViews() 2630void CalendarView::clearAllViews()
2623{ 2631{
2624 mTodoList->clearList(); 2632 mTodoList->clearList();
2625 mViewManager->clearAllViews(); 2633 mViewManager->clearAllViews();
2626 SearchDialog * sd = mDialogManager->getSearchDialog(); 2634 SearchDialog * sd = mDialogManager->getSearchDialog();
2627 if ( sd ) { 2635 if ( sd ) {
2628 KOListView* kol = sd->listview(); 2636 KOListView* kol = sd->listview();
2629 if ( kol ) 2637 if ( kol )
2630 kol->clearList(); 2638 kol->clearList();
2631 } 2639 }
2632} 2640}
2633void CalendarView::updateView() 2641void CalendarView::updateView()
2634{ 2642{
2635 DateList tmpList = mNavigator->selectedDates(); 2643 DateList tmpList = mNavigator->selectedDates();
2636 2644
2637 if ( KOPrefs::instance()->mHideNonStartedTodos ) 2645 if ( KOPrefs::instance()->mHideNonStartedTodos )
2638 mTodoList->updateView(); 2646 mTodoList->updateView();
2639 // We assume that the navigator only selects consecutive days. 2647 // We assume that the navigator only selects consecutive days.
2640 updateView( tmpList.first(), tmpList.last() ); 2648 updateView( tmpList.first(), tmpList.last() );
2641} 2649}
2642 2650
2643void CalendarView::updateUnmanagedViews() 2651void CalendarView::updateUnmanagedViews()
2644{ 2652{
2645 mDateNavigator->updateDayMatrix(); 2653 mDateNavigator->updateDayMatrix();
2646} 2654}
2647 2655
2648int CalendarView::msgItemDelete(const QString name) 2656int CalendarView::msgItemDelete(const QString name)
2649{ 2657{
2650 return KMessageBox::warningContinueCancel(this,name +"\n\n"+ 2658 return KMessageBox::warningContinueCancel(this,name +"\n\n"+
2651 i18n("This item will be\npermanently deleted."), 2659 i18n("This item will be\npermanently deleted."),
2652 i18n("KO/Pi Confirmation"),i18n("Delete")); 2660 i18n("KO/Pi Confirmation"),i18n("Delete"));
2653} 2661}
2654 2662
2655 2663
2656void CalendarView::edit_cut() 2664void CalendarView::edit_cut()
2657{ 2665{
2658 Event *anEvent=0; 2666 Event *anEvent=0;
2659 2667
2660 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2668 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2661 2669
2662 if (mViewManager->currentView()->isEventView()) { 2670 if (mViewManager->currentView()->isEventView()) {
2663 if ( incidence && incidence->typeID() == eventID ) { 2671 if ( incidence && incidence->typeID() == eventID ) {
2664 anEvent = static_cast<Event *>(incidence); 2672 anEvent = static_cast<Event *>(incidence);
2665 } 2673 }
2666 } 2674 }
2667 2675
2668 if (!anEvent) { 2676 if (!anEvent) {
2669 KNotifyClient::beep(); 2677 KNotifyClient::beep();
2670 return; 2678 return;
2671 } 2679 }
2672 DndFactory factory( mCalendar ); 2680 DndFactory factory( mCalendar );
2673 factory.cutIncidence(anEvent); 2681 factory.cutIncidence(anEvent);
2674 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2682 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2675} 2683}
2676 2684
2677void CalendarView::edit_copy() 2685void CalendarView::edit_copy()
2678{ 2686{
2679 Event *anEvent=0; 2687 Event *anEvent=0;
2680 2688
2681 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2689 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2682 2690
2683 if (mViewManager->currentView()->isEventView()) { 2691 if (mViewManager->currentView()->isEventView()) {
2684 if ( incidence && incidence->typeID() == eventID ) { 2692 if ( incidence && incidence->typeID() == eventID ) {
2685 anEvent = static_cast<Event *>(incidence); 2693 anEvent = static_cast<Event *>(incidence);
2686 } 2694 }
2687 } 2695 }
2688 2696
2689 if (!anEvent) { 2697 if (!anEvent) {
2690 KNotifyClient::beep(); 2698 KNotifyClient::beep();
2691 return; 2699 return;
2692 } 2700 }
2693 DndFactory factory( mCalendar ); 2701 DndFactory factory( mCalendar );
2694 factory.copyIncidence(anEvent); 2702 factory.copyIncidence(anEvent);
2695} 2703}
2696 2704
2697void CalendarView::edit_paste() 2705void CalendarView::edit_paste()
2698{ 2706{
2699 QDate date = mNavigator->selectedDates().first(); 2707 QDate date = mNavigator->selectedDates().first();
2700 2708
2701 DndFactory factory( mCalendar ); 2709 DndFactory factory( mCalendar );
2702 Event *pastedEvent = (Event *)factory.pasteIncidence( date ); 2710 Event *pastedEvent = (Event *)factory.pasteIncidence( date );
2703 2711
2704 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2712 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2705} 2713}
2706void CalendarView::edit_global_options() 2714void CalendarView::edit_global_options()
2707{ 2715{
2708 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; 2716 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId;
2709 emit save(); 2717 emit save();
2710 emit saveStopTimer(); 2718 emit saveStopTimer();
2711 mDialogManager->showGlobalOptionsDialog(); 2719 mDialogManager->showGlobalOptionsDialog();
2712 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { 2720 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) {
2713 emit saveStopTimer(); 2721 emit saveStopTimer();
2714 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), 2722 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"),
2715 i18n("Timezone settings"),i18n("Reload"))) { 2723 i18n("Timezone settings"),i18n("Reload"))) {
2716 qDebug("KO: TZ reload cancelled "); 2724 qDebug("KO: TZ reload cancelled ");
2717 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2725 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2718 return; 2726 return;
2719 } 2727 }
2720 qDebug("KO: Timezone change "); 2728 qDebug("KO: Timezone change ");
2721 loadCalendars(); 2729 loadCalendars();
2722 setModified(true); 2730 setModified(true);
2723 } 2731 }
2724 else 2732 else
2725 qDebug("KO: No tz change "); 2733 qDebug("KO: No tz change ");
2726} 2734}
2727void CalendarView::edit_options() 2735void CalendarView::edit_options()
2728{ 2736{
2729 mDialogManager->showOptionsDialog(); 2737 mDialogManager->showOptionsDialog();
2730} 2738}
2731 2739
2732 2740
2733void CalendarView::slotSelectPickerDate( QDate d) 2741void CalendarView::slotSelectPickerDate( QDate d)
2734{ 2742{
2735 mDateFrame->hide(); 2743 mDateFrame->hide();
2736 if ( mDatePickerMode == 1 ) { 2744 if ( mDatePickerMode == 1 ) {
2737 mNavigator->slotDaySelect( d ); 2745 mNavigator->slotDaySelect( d );
2738 } else if ( mDatePickerMode == 2 ) { 2746 } else if ( mDatePickerMode == 2 ) {
2739 if ( mMoveIncidence->typeID() == todoID ) { 2747 if ( mMoveIncidence->typeID() == todoID ) {
2740 Todo * to = (Todo *) mMoveIncidence; 2748 Todo * to = (Todo *) mMoveIncidence;
2741 QTime tim; 2749 QTime tim;
2742 int len = 0; 2750 int len = 0;
2743 if ( to->hasStartDate() && to->hasDueDate() ) 2751 if ( to->hasStartDate() && to->hasDueDate() )
2744 len = to->dtStart().secsTo( to->dtDue()); 2752 len = to->dtStart().secsTo( to->dtDue());
2745 if ( to->hasDueDate() ) 2753 if ( to->hasDueDate() )
2746 tim = to->dtDue().time(); 2754 tim = to->dtDue().time();
2747 else { 2755 else {
2748 tim = QTime ( 0,0,0 ); 2756 tim = QTime ( 0,0,0 );
2749 to->setFloats( true ); 2757 to->setFloats( true );
2750 to->setHasDueDate( true ); 2758 to->setHasDueDate( true );
2751 } 2759 }
2752 QDateTime dt ( d,tim ); 2760 QDateTime dt ( d,tim );
2753 to->setDtDue( dt ); 2761 to->setDtDue( dt );
2754 2762
2755 if ( to->hasStartDate() ) { 2763 if ( to->hasStartDate() ) {
2756 if ( len>0 ) 2764 if ( len>0 )
2757 to->setDtStart(to->dtDue().addSecs( -len )); 2765 to->setDtStart(to->dtDue().addSecs( -len ));
2758 else 2766 else
2759 if (to->dtStart() > to->dtDue() ) 2767 if (to->dtStart() > to->dtDue() )
2760 to->setDtStart(to->dtDue().addDays( -3 )); 2768 to->setDtStart(to->dtDue().addDays( -3 ));
2761 } 2769 }
2762 2770
2763 todoChanged( to ); 2771 todoChanged( to );
2764 } else { 2772 } else {
2765 if ( mMoveIncidence->doesRecur() ) { 2773 if ( mMoveIncidence->doesRecur() ) {
2766#if 0 2774#if 0
2767 // PENDING implement this 2775 // PENDING implement this
2768 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); 2776 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate );
2769 mCalendar()->addIncidence( newInc ); 2777 mCalendar()->addIncidence( newInc );
2770 if ( mMoveIncidence->typeID() == todoID ) 2778 if ( mMoveIncidence->typeID() == todoID )
2771 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); 2779 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
2772 else 2780 else
2773 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); 2781 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED);
2774 mMoveIncidence = newInc; 2782 mMoveIncidence = newInc;
2775 2783
2776#endif 2784#endif
2777 } 2785 }
2778 QTime tim = mMoveIncidence->dtStart().time(); 2786 QTime tim = mMoveIncidence->dtStart().time();
2779 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2787 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2780 QDateTime dt ( d,tim ); 2788 QDateTime dt ( d,tim );
2781 mMoveIncidence->setDtStart( dt ); 2789 mMoveIncidence->setDtStart( dt );
2782 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2790 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2783 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2791 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2784 } 2792 }
2785 2793
2786 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2794 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2787 } 2795 }
2788} 2796}
2789 2797
2790void CalendarView::removeCategories() 2798void CalendarView::removeCategories()
2791{ 2799{
2792 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2800 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2793 QStringList catList = KOPrefs::instance()->mCustomCategories; 2801 QStringList catList = KOPrefs::instance()->mCustomCategories;
2794 QStringList catIncList; 2802 QStringList catIncList;
2795 QStringList newCatList; 2803 QStringList newCatList;
2796 Incidence* inc = incList.first(); 2804 Incidence* inc = incList.first();
2797 int i; 2805 uint i;
2798 int count = 0;
2799 while ( inc ) { 2806 while ( inc ) {
2800 newCatList.clear(); 2807 newCatList.clear();
2801 catIncList = inc->categories() ; 2808 catIncList = inc->categories() ;
2802 for( i = 0; i< catIncList.count(); ++i ) { 2809 for( i = 0; i< catIncList.count(); ++i ) {
2803 if ( catList.contains (catIncList[i])) 2810 if ( catList.contains (catIncList[i]))
2804 newCatList.append( catIncList[i] ); 2811 newCatList.append( catIncList[i] );
2805 } 2812 }
2806 newCatList.sort(); 2813 newCatList.sort();
2807 inc->setCategories( newCatList.join(",") ); 2814 inc->setCategories( newCatList.join(",") );
2808 inc = incList.next(); 2815 inc = incList.next();
2809 } 2816 }
2810} 2817}
2811 2818
2812int CalendarView::addCategories() 2819int CalendarView::addCategories()
2813{ 2820{
2814 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2821 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2815 QStringList catList = KOPrefs::instance()->mCustomCategories; 2822 QStringList catList = KOPrefs::instance()->mCustomCategories;
2816 QStringList catIncList; 2823 QStringList catIncList;
2817 Incidence* inc = incList.first(); 2824 Incidence* inc = incList.first();
2818 int i; 2825 uint i;
2819 int count = 0; 2826 int count = 0;
2820 while ( inc ) { 2827 while ( inc ) {
2821 catIncList = inc->categories() ; 2828 catIncList = inc->categories() ;
2822 for( i = 0; i< catIncList.count(); ++i ) { 2829 for( i = 0; i< catIncList.count(); ++i ) {
2823 if ( !catList.contains (catIncList[i])) { 2830 if ( !catList.contains (catIncList[i])) {
2824 catList.append( catIncList[i] ); 2831 catList.append( catIncList[i] );
2825 //qDebug("add cat %s ", catIncList[i].latin1()); 2832 //qDebug("add cat %s ", catIncList[i].latin1());
2826 ++count; 2833 ++count;
2827 } 2834 }
2828 } 2835 }
2829 inc = incList.next(); 2836 inc = incList.next();
2830 } 2837 }
2831 catList.sort(); 2838 catList.sort();
2832 KOPrefs::instance()->mCustomCategories = catList; 2839 KOPrefs::instance()->mCustomCategories = catList;
2833 return count; 2840 return count;
2834} 2841}
2835 2842
2836void CalendarView::editCategories() 2843void CalendarView::editCategories()
2837{ 2844{
2838 qDebug("CalendarView::editCategories() "); 2845 qDebug("CalendarView::editCategories() ");
2839 KPIM::CategoryEditDialog ced (KOPrefs::instance(),this ); 2846 KPIM::CategoryEditDialog ced (KOPrefs::instance(),this );
2840 ced.exec(); 2847 ced.exec();
2841} 2848}
2842void CalendarView::manageCategories() 2849void CalendarView::manageCategories()
2843{ 2850{
2844 KOCatPrefs* cp = new KOCatPrefs(); 2851 KOCatPrefs* cp = new KOCatPrefs();
2845 cp->show(); 2852 cp->show();
2846 int w =cp->sizeHint().width() ; 2853 int w =cp->sizeHint().width() ;
2847 int h = cp->sizeHint().height() ; 2854 int h = cp->sizeHint().height() ;
2848 int dw = QApplication::desktop()->width(); 2855 int dw = QApplication::desktop()->width();
2849 int dh = QApplication::desktop()->height(); 2856 int dh = QApplication::desktop()->height();
2850 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2857 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2851 if ( !cp->exec() ) { 2858 if ( !cp->exec() ) {
2852 delete cp; 2859 delete cp;
2853 return; 2860 return;
2854 } 2861 }
2855 int count = 0; 2862 int count = 0;
2856 if ( cp->addCat() ) { 2863 if ( cp->addCat() ) {
2857 count = addCategories(); 2864 count = addCategories();
2858 if ( count ) { 2865 if ( count ) {
2859 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2866 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2860 writeSettings(); 2867 writeSettings();
2861 } else 2868 } else
2862 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); 2869 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! "));
2863 } else { 2870 } else {
2864 removeCategories(); 2871 removeCategories();
2865 updateView(); 2872 updateView();
2866 } 2873 }
2867 delete cp; 2874 delete cp;
2868} 2875}
2869 2876
2870void CalendarView::beamIncidence(Incidence * Inc) 2877void CalendarView::beamIncidence(Incidence * Inc)
2871{ 2878{
2872 QPtrList<Incidence> delSel ; 2879 QPtrList<Incidence> delSel ;
2873 delSel.append(Inc); 2880 delSel.append(Inc);
2874 beamIncidenceList( delSel ); 2881 beamIncidenceList( delSel );
2875} 2882}
2876void CalendarView::beamCalendar() 2883void CalendarView::beamCalendar()
2877{ 2884{
2878 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2885 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2879 //qDebug("beamCalendar() "); 2886 //qDebug("beamCalendar() ");
2880 beamIncidenceList( delSel ); 2887 beamIncidenceList( delSel );
2881} 2888}
2882void CalendarView::beamFilteredCalendar() 2889void CalendarView::beamFilteredCalendar()
2883{ 2890{
2884 QPtrList<Incidence> delSel = mCalendar->incidences(); 2891 QPtrList<Incidence> delSel = mCalendar->incidences();
2885 //qDebug("beamFilteredCalendar() "); 2892 //qDebug("beamFilteredCalendar() ");
2886 beamIncidenceList( delSel ); 2893 beamIncidenceList( delSel );
2887} 2894}
2888void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2895void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2889{ 2896{
2890 2897
2891 KOBeamPrefs beamDialog; 2898 KOBeamPrefs beamDialog;
2892 if ( beamDialog.exec () == QDialog::Rejected ) 2899 if ( beamDialog.exec () == QDialog::Rejected )
2893 return; 2900 return;
2894#ifdef DESKTOP_VERSION 2901#ifdef DESKTOP_VERSION
2895 QString fn = locateLocal( "tmp", "kopibeamfile" ); 2902 QString fn = locateLocal( "tmp", "kopibeamfile" );
2896#else 2903#else
2897 QString fn = "/tmp/kopibeamfile"; 2904 QString fn = "/tmp/kopibeamfile";
2898#endif 2905#endif
2899 QString mes; 2906 QString mes;
2900 bool createbup = true; 2907 bool createbup = true;
2901 if ( createbup ) { 2908 if ( createbup ) {
2902 QString description = "\n"; 2909 QString description = "\n";
2903 CalendarLocal* cal = new CalendarLocal(); 2910 CalendarLocal* cal = new CalendarLocal();
2904 if ( beamDialog.beamLocal() ) 2911 if ( beamDialog.beamLocal() )
2905 cal->setLocalTime(); 2912 cal->setLocalTime();
2906 else 2913 else
2907 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2914 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2908 Incidence *incidence = delSel.first(); 2915 Incidence *incidence = delSel.first();
2909 bool addText = false; 2916 bool addText = false;
2910 if ( delSel.count() < 10 ) 2917 if ( delSel.count() < 10 )
2911 addText = true; 2918 addText = true;
2912 else { 2919 else {
2913 description.sprintf(i18n(" %d items?"),delSel.count() ); 2920 description.sprintf(i18n(" %d items?"),delSel.count() );
2914 } 2921 }
2915 while ( incidence ) { 2922 while ( incidence ) {
2916 Incidence *in = incidence->clone(); 2923 Incidence *in = incidence->clone();
2917 if ( ! in->summary().isEmpty() ) { 2924 if ( ! in->summary().isEmpty() ) {
2918 in->setDescription(""); 2925 in->setDescription("");
2919 } else { 2926 } else {
2920 in->setSummary( in->description().left(20)); 2927 in->setSummary( in->description().left(20));
2921 in->setDescription(""); 2928 in->setDescription("");
2922 } 2929 }
2923 if ( addText ) 2930 if ( addText )
2924 description += in->summary() + "\n"; 2931 description += in->summary() + "\n";
2925 cal->addIncidence( in ); 2932 cal->addIncidence( in );
2926 incidence = delSel.next(); 2933 incidence = delSel.next();
2927 } 2934 }
2928 if ( beamDialog.beamVcal() ) { 2935 if ( beamDialog.beamVcal() ) {
2929 fn += ".vcs"; 2936 fn += ".vcs";
2930 FileStorage storage( cal, fn, new VCalFormat ); 2937 FileStorage storage( cal, fn, new VCalFormat );
2931 storage.save(); 2938 storage.save();
2932 } else { 2939 } else {
2933 fn += ".ics"; 2940 fn += ".ics";
2934 FileStorage storage( cal, fn, new ICalFormat( ) ); 2941 FileStorage storage( cal, fn, new ICalFormat( ) );
2935 storage.save(); 2942 storage.save();
2936 } 2943 }
2937 delete cal; 2944 delete cal;
2938 mes = i18n("KO/Pi: Ready for beaming"); 2945 mes = i18n("KO/Pi: Ready for beaming");
2939 topLevelWidget()->setCaption(mes); 2946 topLevelWidget()->setCaption(mes);
2940 KApplication::convert2latin1( fn ); 2947 KApplication::convert2latin1( fn );
2941#ifndef DESKTOP_VERSION 2948#ifndef DESKTOP_VERSION
2942 Ir *ir = new Ir( this ); 2949 Ir *ir = new Ir( this );
2943 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2950 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2944 ir->send( fn, description, "text/x-vCalendar" ); 2951 ir->send( fn, description, "text/x-vCalendar" );
2945#endif 2952#endif
2946 } 2953 }
2947} 2954}
2955
2956#ifndef DESKTOP_VERSION
2948void CalendarView::beamDone( Ir *ir ) 2957void CalendarView::beamDone( Ir *ir )
2949{ 2958{
2950#ifndef DESKTOP_VERSION
2951 delete ir; 2959 delete ir;
2952#endif
2953 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); 2960 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
2954 topLevelWidget()->raise(); 2961 topLevelWidget()->raise();
2955} 2962}
2956 2963#else
2964void CalendarView::beamDone( Ir *){;}
2965#endif
2957void CalendarView::moveIncidence(Incidence * inc ) 2966void CalendarView::moveIncidence(Incidence * inc )
2958{ 2967{
2959 if ( !inc ) return; 2968 if ( !inc ) return;
2960 showDatePickerPopup(); 2969 showDatePickerPopup();
2961 mDatePickerMode = 2; 2970 mDatePickerMode = 2;
2962 mMoveIncidence = inc ; 2971 mMoveIncidence = inc ;
2963 QDate da; 2972 QDate da;
2964 if ( mMoveIncidence->typeID() == todoID ) { 2973 if ( mMoveIncidence->typeID() == todoID ) {
2965 Todo * to = (Todo *) mMoveIncidence; 2974 Todo * to = (Todo *) mMoveIncidence;
2966 if ( to->hasDueDate() ) 2975 if ( to->hasDueDate() )
2967 da = to->dtDue().date(); 2976 da = to->dtDue().date();
2968 else 2977 else
2969 da = QDate::currentDate(); 2978 da = QDate::currentDate();
2970 } else { 2979 } else {
2971 da = mMoveIncidence->dtStart().date(); 2980 da = mMoveIncidence->dtStart().date();
2972 } 2981 }
2973 //PENDING set date for recurring incidence to date of recurrence 2982 //PENDING set date for recurring incidence to date of recurrence
2974 //mMoveIncidenceOldDate; 2983 //mMoveIncidenceOldDate;
2975 mDatePicker->setDate( da ); 2984 mDatePicker->setDate( da );
2976} 2985}
2977void CalendarView::showDatePickerPopup() 2986void CalendarView::showDatePickerPopup()
2978{ 2987{
2979 if ( mDateFrame->isVisible() ) 2988 if ( mDateFrame->isVisible() )
2980 mDateFrame->hide(); 2989 mDateFrame->hide();
2981 else { 2990 else {
2982 int offX = 0, offY = 0; 2991 int offX = 0, offY = 0;
2983#ifdef DESKTOP_VERSION 2992#ifdef DESKTOP_VERSION
2984 int w =mDatePicker->sizeHint().width() ; 2993 int w =mDatePicker->sizeHint().width() ;
2985 int h = mDatePicker->sizeHint().height() ; 2994 int h = mDatePicker->sizeHint().height() ;
2986 int dw = topLevelWidget()->width(); 2995 int dw = topLevelWidget()->width();
2987 int dh = topLevelWidget()->height(); 2996 int dh = topLevelWidget()->height();
2988 offX = topLevelWidget()->x(); 2997 offX = topLevelWidget()->x();
2989 offY = topLevelWidget()->y(); 2998 offY = topLevelWidget()->y();
2990#else 2999#else
2991 int w =mDatePicker->sizeHint().width() ; 3000 int w =mDatePicker->sizeHint().width() ;
2992 int h = mDatePicker->sizeHint().height() ; 3001 int h = mDatePicker->sizeHint().height() ;
2993 int dw = QApplication::desktop()->width(); 3002 int dw = QApplication::desktop()->width();
2994 int dh = QApplication::desktop()->height(); 3003 int dh = QApplication::desktop()->height();
2995#endif 3004#endif
2996 mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); 3005 mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h );
2997 mDateFrame->show(); 3006 mDateFrame->show();
2998 } 3007 }
2999} 3008}
3000void CalendarView::showDatePicker( ) 3009void CalendarView::showDatePicker( )
3001{ 3010{
3002 showDatePickerPopup(); 3011 showDatePickerPopup();
3003 mDatePickerMode = 1; 3012 mDatePickerMode = 1;
3004 mDatePicker->setDate( mNavigator->selectedDates().first() ); 3013 mDatePicker->setDate( mNavigator->selectedDates().first() );
3005} 3014}
3006 3015
3007void CalendarView::showEventEditor() 3016void CalendarView::showEventEditor()
3008{ 3017{
3009#ifdef DESKTOP_VERSION 3018#ifdef DESKTOP_VERSION
3010 int x,y,w,h; 3019 int x,y,w,h;
3011 x = mEventEditor->geometry().x(); 3020 x = mEventEditor->geometry().x();
3012 y = mEventEditor->geometry().y(); 3021 y = mEventEditor->geometry().y();
3013 w = mEventEditor->width(); 3022 w = mEventEditor->width();
3014 h = mEventEditor->height(); 3023 h = mEventEditor->height();
3015 mEventEditor->show(); 3024 mEventEditor->show();
3016 mEventEditor->setGeometry(x,y,w,h); 3025 mEventEditor->setGeometry(x,y,w,h);
3017#else 3026#else
3018 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { 3027 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) {
3019 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 3028 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
3020 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); 3029 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() );
3021 qApp->processEvents(); 3030 qApp->processEvents();
3022 delete mEventEditor; 3031 delete mEventEditor;
3023 mEventEditor = mDialogManager->getEventEditor(); 3032 mEventEditor = mDialogManager->getEventEditor();
3024 topLevelWidget()->setCaption( i18n("") ); 3033 topLevelWidget()->setCaption( i18n("") );
3025 } 3034 }
3026 mEventEditor->showMaximized(); 3035 mEventEditor->showMaximized();
3027#endif 3036#endif
3028} 3037}
3029void CalendarView::showTodoEditor() 3038void CalendarView::showTodoEditor()
3030{ 3039{
3031#ifdef DESKTOP_VERSION 3040#ifdef DESKTOP_VERSION
3032 int x,y,w,h; 3041 int x,y,w,h;
3033 x = mTodoEditor->geometry().x(); 3042 x = mTodoEditor->geometry().x();
3034 y = mTodoEditor->geometry().y(); 3043 y = mTodoEditor->geometry().y();
3035 w = mTodoEditor->width(); 3044 w = mTodoEditor->width();
3036 h = mTodoEditor->height(); 3045 h = mTodoEditor->height();
3037 mTodoEditor->show(); 3046 mTodoEditor->show();
3038 mTodoEditor->setGeometry(x,y,w,h); 3047 mTodoEditor->setGeometry(x,y,w,h);
3039#else 3048#else
3040 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { 3049 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) {
3041 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 3050 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
3042 qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); 3051 qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() );
3043 qApp->processEvents(); 3052 qApp->processEvents();
3044 delete mTodoEditor; 3053 delete mTodoEditor;
3045 mTodoEditor = mDialogManager->getTodoEditor(); 3054 mTodoEditor = mDialogManager->getTodoEditor();
3046 topLevelWidget()->setCaption( i18n("") ); 3055 topLevelWidget()->setCaption( i18n("") );
3047 } 3056 }
3048 mTodoEditor->showMaximized(); 3057 mTodoEditor->showMaximized();
3049#endif 3058#endif
3050} 3059}
3051 3060
3052void CalendarView::cloneIncidence() 3061void CalendarView::cloneIncidence()
3053{ 3062{
3054 Incidence *incidence = currentSelection(); 3063 Incidence *incidence = currentSelection();
3055 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3064 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3056 if ( incidence ) { 3065 if ( incidence ) {
3057 cloneIncidence(incidence); 3066 cloneIncidence(incidence);
3058 } 3067 }
3059} 3068}
3060void CalendarView::moveIncidence() 3069void CalendarView::moveIncidence()
3061{ 3070{
3062 Incidence *incidence = currentSelection(); 3071 Incidence *incidence = currentSelection();
3063 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3072 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3064 if ( incidence ) { 3073 if ( incidence ) {
3065 moveIncidence(incidence); 3074 moveIncidence(incidence);
3066 } 3075 }
3067} 3076}
3068void CalendarView::beamIncidence() 3077void CalendarView::beamIncidence()
3069{ 3078{
3070 Incidence *incidence = currentSelection(); 3079 Incidence *incidence = currentSelection();
3071 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3080 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3072 if ( incidence ) { 3081 if ( incidence ) {
3073 beamIncidence(incidence); 3082 beamIncidence(incidence);
3074 } 3083 }
3075} 3084}
3076void CalendarView::toggleCancelIncidence() 3085void CalendarView::toggleCancelIncidence()
3077{ 3086{
3078 Incidence *incidence = currentSelection(); 3087 Incidence *incidence = currentSelection();
3079 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3088 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3080 if ( incidence ) { 3089 if ( incidence ) {
3081 cancelIncidence(incidence); 3090 cancelIncidence(incidence);
3082 } 3091 }
3083} 3092}
3084 3093
3085 3094
3086void CalendarView::cancelIncidence(Incidence * inc ) 3095void CalendarView::cancelIncidence(Incidence * inc )
3087{ 3096{
3088 inc->setCancelled( ! inc->cancelled() ); 3097 inc->setCancelled( ! inc->cancelled() );
3089 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); 3098 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED );
3090 updateView(); 3099 updateView();
3091} 3100}
3092void CalendarView::cloneIncidence(Incidence * orgInc ) 3101void CalendarView::cloneIncidence(Incidence * orgInc )
3093{ 3102{
3094 Incidence * newInc = orgInc->clone(); 3103 Incidence * newInc = orgInc->clone();
3095 newInc->recreate(); 3104 newInc->recreate();
3096 3105
3097 if ( newInc->typeID() == todoID ) { 3106 if ( newInc->typeID() == todoID ) {
3098 Todo* t = (Todo*) newInc; 3107 Todo* t = (Todo*) newInc;
3099 bool cloneSub = false; 3108 bool cloneSub = false;
3100 if ( orgInc->relations().count() ) { 3109 if ( orgInc->relations().count() ) {
3101 int result = KMessageBox::warningYesNoCancel(this, 3110 int result = KMessageBox::warningYesNoCancel(this,
3102 i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( newInc->summary().left ( 25 ) ), 3111 i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( newInc->summary().left ( 25 ) ),
3103 i18n("Todo has subtodos"), 3112 i18n("Todo has subtodos"),
3104 i18n("Yes"), 3113 i18n("Yes"),
3105 i18n("No")); 3114 i18n("No"));
3106 3115
3107 if ( result == KMessageBox::Cancel ) { 3116 if ( result == KMessageBox::Cancel ) {
3108 delete t; 3117 delete t;
3109 return; 3118 return;
3110 } 3119 }
3111 if (result == KMessageBox::Yes) cloneSub = true; 3120 if (result == KMessageBox::Yes) cloneSub = true;
3112 } 3121 }
3113 showTodoEditor(); 3122 showTodoEditor();
3114 mTodoEditor->editTodo( t ); 3123 mTodoEditor->editTodo( t );
3115 if ( mTodoEditor->exec() ) { 3124 if ( mTodoEditor->exec() ) {
3116 if ( cloneSub ) { 3125 if ( cloneSub ) {
3117 orgInc->cloneRelations( t ); 3126 orgInc->cloneRelations( t );
3118 mCalendar->addIncidenceBranch( t ); 3127 mCalendar->addIncidenceBranch( t );
3119 updateView(); 3128 updateView();
3120 3129
3121 } else { 3130 } else {
3122 mCalendar->addTodo( t ); 3131 mCalendar->addTodo( t );
3123 updateView(); 3132 updateView();
3124 } 3133 }
3125 } else { 3134 } else {
3126 delete t; 3135 delete t;
3127 } 3136 }
3128 } 3137 }
3129 else { 3138 else {
3130 Event* e = (Event*) newInc; 3139 Event* e = (Event*) newInc;
3131 showEventEditor(); 3140 showEventEditor();
3132 mEventEditor->editEvent( e ); 3141 mEventEditor->editEvent( e );
3133 if ( mEventEditor->exec() ) { 3142 if ( mEventEditor->exec() ) {
3134 mCalendar->addEvent( e ); 3143 mCalendar->addEvent( e );
3135 updateView(); 3144 updateView();
3136 } else { 3145 } else {
3137 delete e; 3146 delete e;
3138 } 3147 }
3139 } 3148 }
3140 setActiveWindow(); 3149 setActiveWindow();
3141} 3150}
3142 3151
3143void CalendarView::newEvent() 3152void CalendarView::newEvent()
3144{ 3153{
3145 // TODO: Replace this code by a common eventDurationHint of KOBaseView. 3154 // TODO: Replace this code by a common eventDurationHint of KOBaseView.
3146 KOAgendaView *aView = mViewManager->agendaView(); 3155 KOAgendaView *aView = mViewManager->agendaView();
3147 if (aView) { 3156 if (aView) {
3148 if (aView->selectionStart().isValid()) { 3157 if (aView->selectionStart().isValid()) {
3149 if (aView->selectedIsAllDay()) { 3158 if (aView->selectedIsAllDay()) {
3150 newEvent(aView->selectionStart(),aView->selectionEnd(),true); 3159 newEvent(aView->selectionStart(),aView->selectionEnd(),true);
3151 } else { 3160 } else {
3152 newEvent(aView->selectionStart(),aView->selectionEnd()); 3161 newEvent(aView->selectionStart(),aView->selectionEnd());
3153 } 3162 }
3154 return; 3163 return;
3155 } 3164 }
3156 } 3165 }
3157 3166
3158 QDate date = mNavigator->selectedDates().first(); 3167 QDate date = mNavigator->selectedDates().first();
3159 QDateTime current = QDateTime::currentDateTime(); 3168 QDateTime current = QDateTime::currentDateTime();
3160 if ( date <= current.date() ) { 3169 if ( date <= current.date() ) {
3161 int hour = current.time().hour() +1; 3170 int hour = current.time().hour() +1;
3162 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), 3171 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ),
3163 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 3172 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
3164 } else 3173 } else
3165 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), 3174 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ),
3166 QDateTime( date, QTime( KOPrefs::instance()->mStartTime + 3175 QDateTime( date, QTime( KOPrefs::instance()->mStartTime +
3167 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 3176 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
3168} 3177}
3169 3178
3170void CalendarView::newEvent(QDateTime fh) 3179void CalendarView::newEvent(QDateTime fh)
3171{ 3180{
3172 newEvent(fh, 3181 newEvent(fh,
3173 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); 3182 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration)));
3174} 3183}
3175 3184
3176void CalendarView::newEvent(QDate dt) 3185void CalendarView::newEvent(QDate dt)
3177{ 3186{
3178 newEvent(QDateTime(dt, QTime(0,0,0)), 3187 newEvent(QDateTime(dt, QTime(0,0,0)),
3179 QDateTime(dt, QTime(0,0,0)), true); 3188 QDateTime(dt, QTime(0,0,0)), true);
3180} 3189}
3181void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint) 3190void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint)
3182{ 3191{
3183 newEvent(fromHint, toHint, false); 3192 newEvent(fromHint, toHint, false);
3184} 3193}
3185void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) 3194void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay)
3186{ 3195{
3187 3196
3188 showEventEditor(); 3197 showEventEditor();
3189 mEventEditor->newEvent(fromHint,toHint,allDay); 3198 mEventEditor->newEvent(fromHint,toHint,allDay);
3190 if ( mFilterView->filtersEnabled() ) { 3199 if ( mFilterView->filtersEnabled() ) {
3191 CalFilter *filter = mFilterView->selectedFilter(); 3200 CalFilter *filter = mFilterView->selectedFilter();
3192 if (filter && filter->showCategories()) { 3201 if (filter && filter->showCategories()) {
3193 mEventEditor->setCategories(filter->categoryList().join(",") ); 3202 mEventEditor->setCategories(filter->categoryList().join(",") );
3194 } 3203 }
3195 if ( filter ) 3204 if ( filter )
3196 mEventEditor->setSecrecy( filter->getSecrecy() ); 3205 mEventEditor->setSecrecy( filter->getSecrecy() );
3197 } 3206 }
3198 mEventEditor->exec(); 3207 mEventEditor->exec();
3199 setActiveWindow(); 3208 setActiveWindow();
3200} 3209}
3201void CalendarView::todoAdded(Todo * t) 3210void CalendarView::todoAdded(Todo * t)
3202{ 3211{
3203 3212
3204 changeTodoDisplay ( t ,KOGlobals::EVENTADDED); 3213 changeTodoDisplay ( t ,KOGlobals::EVENTADDED);
3205 updateTodoViews(); 3214 updateTodoViews();
3206} 3215}
3207void CalendarView::todoChanged(Todo * t) 3216void CalendarView::todoChanged(Todo * t)
3208{ 3217{
3209 emit todoModified( t, 4 ); 3218 emit todoModified( t, 4 );
3210 // updateTodoViews(); 3219 // updateTodoViews();
3211} 3220}
3212void CalendarView::todoToBeDeleted(Todo *) 3221void CalendarView::todoToBeDeleted(Todo *)
3213{ 3222{
3214 //qDebug("todoToBeDeleted(Todo *) "); 3223 //qDebug("todoToBeDeleted(Todo *) ");
3215 updateTodoViews(); 3224 updateTodoViews();
3216} 3225}
3217void CalendarView::todoDeleted() 3226void CalendarView::todoDeleted()
3218{ 3227{
3219 //qDebug(" todoDeleted()"); 3228 //qDebug(" todoDeleted()");
3220 updateTodoViews(); 3229 updateTodoViews();
3221} 3230}
3222 3231
3223 3232
3224void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) 3233void CalendarView::newTodoDateTime( QDateTime dt, bool allday )
3225{ 3234{
3226 showTodoEditor(); 3235 showTodoEditor();
3227 mTodoEditor->newTodo(dt,0,allday); 3236 mTodoEditor->newTodo(dt,0,allday);
3228 if ( mFilterView->filtersEnabled() ) { 3237 if ( mFilterView->filtersEnabled() ) {
3229 CalFilter *filter = mFilterView->selectedFilter(); 3238 CalFilter *filter = mFilterView->selectedFilter();
3230 if (filter && filter->showCategories()) { 3239 if (filter && filter->showCategories()) {
3231 mTodoEditor->setCategories(filter->categoryList().join(",") ); 3240 mTodoEditor->setCategories(filter->categoryList().join(",") );
3232 } 3241 }
3233 if ( filter ) 3242 if ( filter )
3234 mTodoEditor->setSecrecy( filter->getSecrecy() ); 3243 mTodoEditor->setSecrecy( filter->getSecrecy() );
3235 } 3244 }
3236 mTodoEditor->exec(); 3245 mTodoEditor->exec();
3237 setActiveWindow(); 3246 setActiveWindow();
3238} 3247}
3239 3248
3240void CalendarView::newTodo() 3249void CalendarView::newTodo()
3241{ 3250{
3242 newTodoDateTime( QDateTime(),true ); 3251 newTodoDateTime( QDateTime(),true );
3243} 3252}
3244 3253
3245void CalendarView::newSubTodo() 3254void CalendarView::newSubTodo()
3246{ 3255{
3247 Todo *todo = selectedTodo(); 3256 Todo *todo = selectedTodo();
3248 if ( todo ) newSubTodo( todo ); 3257 if ( todo ) newSubTodo( todo );
3249} 3258}
3250 3259
3251void CalendarView::newSubTodo(Todo *parentEvent) 3260void CalendarView::newSubTodo(Todo *parentEvent)
3252{ 3261{
3253 3262
3254 showTodoEditor(); 3263 showTodoEditor();
3255 mTodoEditor->newTodo(QDateTime(),parentEvent,true); 3264 mTodoEditor->newTodo(QDateTime(),parentEvent,true);
3256 mTodoEditor->exec(); 3265 mTodoEditor->exec();
3257 setActiveWindow(); 3266 setActiveWindow();
3258} 3267}
3259 3268
3260void CalendarView::newFloatingEvent() 3269void CalendarView::newFloatingEvent()
3261{ 3270{
3262 DateList tmpList = mNavigator->selectedDates(); 3271 DateList tmpList = mNavigator->selectedDates();
3263 QDate date = tmpList.first(); 3272 QDate date = tmpList.first();
3264 3273
3265 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), 3274 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ),
3266 QDateTime( date, QTime( 12, 0, 0 ) ), true ); 3275 QDateTime( date, QTime( 12, 0, 0 ) ), true );
3267} 3276}
3268 3277
3269 3278
3270void CalendarView::editEvent( Event *event ) 3279void CalendarView::editEvent( Event *event )
3271{ 3280{
3272 3281
3273 if ( !event ) return; 3282 if ( !event ) return;
3274 if ( event->isReadOnly() ) { 3283 if ( event->isReadOnly() ) {
3275 showEvent( event ); 3284 showEvent( event );
3276 return; 3285 return;
3277 } 3286 }
3278 showEventEditor(); 3287 showEventEditor();
3279 mEventEditor->editEvent( event , mFlagEditDescription); 3288 mEventEditor->editEvent( event , mFlagEditDescription);
3280 mEventEditor->exec(); 3289 mEventEditor->exec();
3281 setActiveWindow(); 3290 setActiveWindow();
3282 3291
3283} 3292}
3284void CalendarView::editJournal( Journal *jour ) 3293void CalendarView::editJournal( Journal *jour )
3285{ 3294{
3286 if ( !jour ) return; 3295 if ( !jour ) return;
3287 mDialogManager->hideSearchDialog(); 3296 mDialogManager->hideSearchDialog();
3288 mViewManager->showJournalView(); 3297 mViewManager->showJournalView();
3289 mNavigator->slotDaySelect( jour->dtStart().date() ); 3298 mNavigator->slotDaySelect( jour->dtStart().date() );
3290} 3299}
3291void CalendarView::editTodo( Todo *todo ) 3300void CalendarView::editTodo( Todo *todo )
3292{ 3301{
3293 if ( !todo ) return; 3302 if ( !todo ) return;
3294 3303
3295 if ( todo->isReadOnly() ) { 3304 if ( todo->isReadOnly() ) {
3296 showTodo( todo ); 3305 showTodo( todo );
3297 return; 3306 return;
3298 } 3307 }
3299 showTodoEditor(); 3308 showTodoEditor();
3300 mTodoEditor->editTodo( todo ,mFlagEditDescription); 3309 mTodoEditor->editTodo( todo ,mFlagEditDescription);
3301 mTodoEditor->exec(); 3310 mTodoEditor->exec();
3302 setActiveWindow(); 3311 setActiveWindow();
3303 3312
3304} 3313}
3305 3314
3306KOEventViewerDialog* CalendarView::getEventViewerDialog() 3315KOEventViewerDialog* CalendarView::getEventViewerDialog()
3307{ 3316{
3308 if ( !mEventViewerDialog ) { 3317 if ( !mEventViewerDialog ) {
3309 mEventViewerDialog = new KOEventViewerDialog(0); 3318 mEventViewerDialog = new KOEventViewerDialog(0);
3310 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); 3319 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) );
3311 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); 3320 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig()));
3312 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), 3321 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)),
3313 dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 3322 dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
3314 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), 3323 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ),
3315 viewManager(), SLOT( showAgendaView( bool ) ) ); 3324 viewManager(), SLOT( showAgendaView( bool ) ) );
3316 connect( mEventViewerDialog, SIGNAL(signalViewerClosed()), 3325 connect( mEventViewerDialog, SIGNAL(signalViewerClosed()),
3317 this, SLOT( slotViewerClosed() ) ); 3326 this, SLOT( slotViewerClosed() ) );
3318 connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), 3327 connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ),
3319 this, SLOT( todoChanged(Todo *) ) ); 3328 this, SLOT( todoChanged(Todo *) ) );
3320 mEventViewerDialog->resize( 640, 480 ); 3329 mEventViewerDialog->resize( 640, 480 );
3321 3330
3322 } 3331 }
3323 return mEventViewerDialog; 3332 return mEventViewerDialog;
3324} 3333}
3325void CalendarView::showEvent(Event *event) 3334void CalendarView::showEvent(Event *event)
3326{ 3335{
3327 getEventViewerDialog()->setEvent(event); 3336 getEventViewerDialog()->setEvent(event);
3328 getEventViewerDialog()->showMe(); 3337 getEventViewerDialog()->showMe();
3329} 3338}
3330 3339
3331void CalendarView::showTodo(Todo *event) 3340void CalendarView::showTodo(Todo *event)
3332{ 3341{
3333 getEventViewerDialog()->setTodo(event); 3342 getEventViewerDialog()->setTodo(event);
3334 getEventViewerDialog()->showMe(); 3343 getEventViewerDialog()->showMe();
3335} 3344}
3336void CalendarView::showJournal( Journal *jour ) 3345void CalendarView::showJournal( Journal *jour )
3337{ 3346{
3338 getEventViewerDialog()->setJournal(jour); 3347 getEventViewerDialog()->setJournal(jour);
3339 getEventViewerDialog()->showMe(); 3348 getEventViewerDialog()->showMe();
3340 3349
3341} 3350}
3342// void CalendarView::todoModified (Todo *event, int changed) 3351// void CalendarView::todoModified (Todo *event, int changed)
3343// { 3352// {
3344// // if (mDialogList.find (event) != mDialogList.end ()) { 3353// // if (mDialogList.find (event) != mDialogList.end ()) {
3345// // kdDebug() << "Todo modified and open" << endl; 3354// // kdDebug() << "Todo modified and open" << endl;
3346// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; 3355// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event];
3347// // temp->modified (changed); 3356// // temp->modified (changed);
3348 3357
3349// // } 3358// // }
3350 3359
3351// mViewManager->updateView(); 3360// mViewManager->updateView();
3352// } 3361// }
3353 3362
3354void CalendarView::appointment_show() 3363void CalendarView::appointment_show()
3355{ 3364{
3356 Event *anEvent = 0; 3365 Event *anEvent = 0;
3357 3366
3358 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 3367 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
3359 3368
3360 if (mViewManager->currentView()->isEventView()) { 3369 if (mViewManager->currentView()->isEventView()) {
3361 if ( incidence && incidence->typeID() == eventID ) { 3370 if ( incidence && incidence->typeID() == eventID ) {
3362 anEvent = static_cast<Event *>(incidence); 3371 anEvent = static_cast<Event *>(incidence);
3363 } 3372 }
3364 } 3373 }
3365 3374
3366 if (!anEvent) { 3375 if (!anEvent) {
3367 KNotifyClient::beep(); 3376 KNotifyClient::beep();
3368 return; 3377 return;
3369 } 3378 }
3370 3379
3371 showEvent(anEvent); 3380 showEvent(anEvent);
3372} 3381}
3373 3382
3374void CalendarView::appointment_edit() 3383void CalendarView::appointment_edit()
3375{ 3384{
3376 Event *anEvent = 0; 3385 Event *anEvent = 0;
3377 3386
3378 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 3387 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
3379 3388
3380 if (mViewManager->currentView()->isEventView()) { 3389 if (mViewManager->currentView()->isEventView()) {
3381 if ( incidence && incidence->typeID() == eventID ) { 3390 if ( incidence && incidence->typeID() == eventID ) {
3382 anEvent = static_cast<Event *>(incidence); 3391 anEvent = static_cast<Event *>(incidence);
3383 } 3392 }
3384 } 3393 }
3385 3394
3386 if (!anEvent) { 3395 if (!anEvent) {
3387 KNotifyClient::beep(); 3396 KNotifyClient::beep();
3388 return; 3397 return;
3389 } 3398 }
3390 3399
3391 editEvent(anEvent); 3400 editEvent(anEvent);
3392} 3401}
3393 3402
3394void CalendarView::appointment_delete() 3403void CalendarView::appointment_delete()
3395{ 3404{
3396 Event *anEvent = 0; 3405 Event *anEvent = 0;
3397 3406
3398 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 3407 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
3399 3408
3400 if (mViewManager->currentView()->isEventView()) { 3409 if (mViewManager->currentView()->isEventView()) {
3401 if ( incidence && incidence->typeID() == eventID ) { 3410 if ( incidence && incidence->typeID() == eventID ) {
3402 anEvent = static_cast<Event *>(incidence); 3411 anEvent = static_cast<Event *>(incidence);
3403 } 3412 }
3404 } 3413 }
3405 3414
3406 if (!anEvent) { 3415 if (!anEvent) {
3407 KNotifyClient::beep(); 3416 KNotifyClient::beep();
3408 return; 3417 return;
3409 } 3418 }
3410 3419
3411 deleteEvent(anEvent); 3420 deleteEvent(anEvent);
3412} 3421}
3413 3422
3414void CalendarView::todo_resub( Todo * parent, Todo * sub ) 3423void CalendarView::todo_resub( Todo * parent, Todo * sub )
3415{ 3424{
3416 if (!sub) return; 3425 if (!sub) return;
3417 if ( sub->relatedTo() == parent ) 3426 if ( sub->relatedTo() == parent )
3418 return; 3427 return;
3419 sub->setRelatedTo(parent); 3428 sub->setRelatedTo(parent);
3420 sub->updated(); 3429 sub->updated();
3421 setModified(true); 3430 setModified(true);
3422 updateView(); 3431 updateView();
3423} 3432}
3424void CalendarView::todo_unsub(Todo *anTodo ) 3433void CalendarView::todo_unsub(Todo *anTodo )
3425{ 3434{
3426 todo_resub( 0, anTodo ); 3435 todo_resub( 0, anTodo );
3427} 3436}
3428 3437
3429void CalendarView::deleteTodo(Todo *todo) 3438void CalendarView::deleteTodo(Todo *todo)
3430{ 3439{
3431 if (!todo) { 3440 if (!todo) {
3432 KNotifyClient::beep(); 3441 KNotifyClient::beep();
3433 return; 3442 return;
3434 } 3443 }
3435 if (KOPrefs::instance()->mConfirm) { 3444 if (KOPrefs::instance()->mConfirm) {
3436 QString text = todo->summary().left(20); 3445 QString text = todo->summary().left(20);
3437 if (!todo->relations().isEmpty()) { 3446 if (!todo->relations().isEmpty()) {
3438 text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); 3447 text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!");
3439 3448
3440 } 3449 }
3441 switch (msgItemDelete(text)) { 3450 switch (msgItemDelete(text)) {
3442 case KMessageBox::Continue: // OK 3451 case KMessageBox::Continue: // OK
3443 bool deleteT = false; 3452 bool deleteT = false;
3444 if (!todo->relations().isEmpty()) { 3453 if (!todo->relations().isEmpty()) {
3445 deleteT = removeCompletedSubTodos( todo ); 3454 deleteT = removeCompletedSubTodos( todo );
3446 } 3455 }
3447 // deleteT == true: todo already deleted in removeCompletedSubTodos 3456 // deleteT == true: todo already deleted in removeCompletedSubTodos
3448 if ( !deleteT ) { 3457 if ( !deleteT ) {
3449 checkExternalId( todo ); 3458 checkExternalId( todo );
3450 calendar()->deleteTodo(todo); 3459 calendar()->deleteTodo(todo);
3451 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 3460 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
3452 updateView(); 3461 updateView();
3453 } 3462 }
3454 break; 3463 break;
3455 } // switch 3464 } // switch
3456 } else { 3465 } else {
3457 checkExternalId( todo ); 3466 checkExternalId( todo );
3458 mCalendar->deleteTodo(todo); 3467 mCalendar->deleteTodo(todo);
3459 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 3468 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
3460 updateView(); 3469 updateView();
3461 } 3470 }
3462 3471
3463 emit updateSearchDialog(); 3472 emit updateSearchDialog();
3464} 3473}
3465void CalendarView::deleteJournal(Journal *jour) 3474void CalendarView::deleteJournal(Journal *jour)
3466{ 3475{
3467 if (!jour) { 3476 if (!jour) {
3468 KNotifyClient::beep(); 3477 KNotifyClient::beep();
@@ -3798,788 +3807,784 @@ void CalendarView::schedule(Scheduler::Method method, Incidence *incidence)
3798 ev->clearAttendees(); 3807 ev->clearAttendees();
3799 ev->addAttendee(menew,false); 3808 ev->addAttendee(menew,false);
3800 } else { 3809 } else {
3801 if (to) { 3810 if (to) {
3802 todo->clearAttendees(); 3811 todo->clearAttendees();
3803 todo->addAttendee(menew,false); 3812 todo->addAttendee(menew,false);
3804 } 3813 }
3805 } 3814 }
3806 } 3815 }
3807 3816
3808 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3817 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3809 if (ev) { 3818 if (ev) {
3810 if ( !dlg->addMessage(ev,method) ) delete(ev); 3819 if ( !dlg->addMessage(ev,method) ) delete(ev);
3811 } else { 3820 } else {
3812 if (to) { 3821 if (to) {
3813 if ( !dlg->addMessage(to,method) ) delete(to); 3822 if ( !dlg->addMessage(to,method) ) delete(to);
3814 } 3823 }
3815 } 3824 }
3816} 3825}
3817 3826
3818void CalendarView::openAddressbook() 3827void CalendarView::openAddressbook()
3819{ 3828{
3820 KRun::runCommand("kaddressbook"); 3829 KRun::runCommand("kaddressbook");
3821} 3830}
3822 3831
3823void CalendarView::setModified(bool modified) 3832void CalendarView::setModified(bool modified)
3824{ 3833{
3825 if ( modified ) 3834 if ( modified )
3826 emit signalmodified(); 3835 emit signalmodified();
3827 if (mModified != modified) { 3836 if (mModified != modified) {
3828 mModified = modified; 3837 mModified = modified;
3829 emit modifiedChanged(mModified); 3838 emit modifiedChanged(mModified);
3830 } 3839 }
3831} 3840}
3832 3841
3833bool CalendarView::isReadOnly() 3842bool CalendarView::isReadOnly()
3834{ 3843{
3835 return mReadOnly; 3844 return mReadOnly;
3836} 3845}
3837 3846
3838void CalendarView::setReadOnly(bool readOnly) 3847void CalendarView::setReadOnly(bool readOnly)
3839{ 3848{
3840 if (mReadOnly != readOnly) { 3849 if (mReadOnly != readOnly) {
3841 mReadOnly = readOnly; 3850 mReadOnly = readOnly;
3842 emit readOnlyChanged(mReadOnly); 3851 emit readOnlyChanged(mReadOnly);
3843 } 3852 }
3844} 3853}
3845 3854
3846bool CalendarView::isModified() 3855bool CalendarView::isModified()
3847{ 3856{
3848 return mModified; 3857 return mModified;
3849} 3858}
3850void CalendarView::slotprintSelInc() 3859void CalendarView::slotprintSelInc()
3851{ 3860{
3852 if ( currentSelection() == 0 ) { 3861 if ( currentSelection() == 0 ) {
3853 KMessageBox::sorry(this,i18n("There is nothing selected!")); 3862 KMessageBox::sorry(this,i18n("There is nothing selected!"));
3854 return; 3863 return;
3855 } 3864 }
3856 showIncidence(); 3865 showIncidence();
3857 getEventViewerDialog()->print(); 3866 getEventViewerDialog()->print();
3858 3867
3859} 3868}
3860void CalendarView::printSetup() 3869void CalendarView::printSetup()
3861{ 3870{
3862#ifndef KORG_NOPRINTER 3871#ifndef KORG_NOPRINTER
3863 createPrinter(); 3872 createPrinter();
3864 3873
3865 mCalPrinter->setupPrinter(); 3874 mCalPrinter->setupPrinter();
3866#endif 3875#endif
3867} 3876}
3868 3877
3869void CalendarView::print() 3878void CalendarView::print()
3870{ 3879{
3871#ifndef KORG_NOPRINTER 3880#ifndef KORG_NOPRINTER
3872 createPrinter(); 3881 createPrinter();
3873 3882
3874 DateList tmpDateList = mNavigator->selectedDates(); 3883 DateList tmpDateList = mNavigator->selectedDates();
3875 mCalPrinter->print(CalPrinter::Month, 3884 mCalPrinter->print(CalPrinter::Month,
3876 tmpDateList.first(), tmpDateList.last()); 3885 tmpDateList.first(), tmpDateList.last());
3877#endif 3886#endif
3878} 3887}
3879 3888
3880void CalendarView::printPreview() 3889void CalendarView::printPreview()
3881{ 3890{
3882#ifndef KORG_NOPRINTER 3891#ifndef KORG_NOPRINTER
3883 kdDebug() << "CalendarView::printPreview()" << endl; 3892 kdDebug() << "CalendarView::printPreview()" << endl;
3884 3893
3885 createPrinter(); 3894 createPrinter();
3886 3895
3887 DateList tmpDateList = mNavigator->selectedDates(); 3896 DateList tmpDateList = mNavigator->selectedDates();
3888 3897
3889 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), 3898 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(),
3890 tmpDateList.last()); 3899 tmpDateList.last());
3891#endif 3900#endif
3892} 3901}
3893 3902
3894void CalendarView::exportICalendar() 3903void CalendarView::exportICalendar()
3895{ 3904{
3896 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); 3905 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this);
3897 3906
3898 // Force correct extension 3907 // Force correct extension
3899 if (filename.right(4) != ".ics") filename += ".ics"; 3908 if (filename.right(4) != ".ics") filename += ".ics";
3900 3909
3901 FileStorage storage( mCalendar, filename, new ICalFormat() ); 3910 FileStorage storage( mCalendar, filename, new ICalFormat() );
3902 storage.save(); 3911 storage.save();
3903} 3912}
3904 3913
3905bool CalendarView::exportVCalendar( QString filename ) 3914bool CalendarView::exportVCalendar( QString filename )
3906{ 3915{
3907 if (mCalendar->journals().count() > 0) { 3916 if (mCalendar->journals().count() > 0) {
3908 int result = KMessageBox::warningContinueCancel(this, 3917 int result = KMessageBox::warningContinueCancel(this,
3909 i18n("The journal entries can not be\nexported to a vCalendar file."), 3918 i18n("The journal entries can not be\nexported to a vCalendar file."),
3910 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), 3919 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
3911 true); 3920 true);
3912 if (result != KMessageBox::Continue) return false; 3921 if (result != KMessageBox::Continue) return false;
3913 } 3922 }
3914 3923
3915 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); 3924 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this);
3916 3925
3917 // Force correct extension 3926 // Force correct extension
3918 if (filename.right(4) != ".vcs") filename += ".vcs"; 3927 if (filename.right(4) != ".vcs") filename += ".vcs";
3919 3928
3920 FileStorage storage( mCalendar, filename, new VCalFormat ); 3929 FileStorage storage( mCalendar, filename, new VCalFormat );
3921 return storage.save(); 3930 return storage.save();
3922 3931
3923} 3932}
3924 3933
3925void CalendarView::eventUpdated(Incidence *) 3934void CalendarView::eventUpdated(Incidence *)
3926{ 3935{
3927 setModified(); 3936 setModified();
3928 // Don't call updateView here. The code, which has caused the update of the 3937 // Don't call updateView here. The code, which has caused the update of the
3929 // event is responsible for updating the view. 3938 // event is responsible for updating the view.
3930 // updateView(); 3939 // updateView();
3931} 3940}
3932 3941
3933void CalendarView::adaptNavigationUnits() 3942void CalendarView::adaptNavigationUnits()
3934{ 3943{
3935 if (mViewManager->currentView()->isEventView()) { 3944 if (mViewManager->currentView()->isEventView()) {
3936 int days = mViewManager->currentView()->currentDateCount(); 3945 int days = mViewManager->currentView()->currentDateCount();
3937 if (days == 1) { 3946 if (days == 1) {
3938 emit changeNavStringPrev(i18n("&Previous Day")); 3947 emit changeNavStringPrev(i18n("&Previous Day"));
3939 emit changeNavStringNext(i18n("&Next Day")); 3948 emit changeNavStringNext(i18n("&Next Day"));
3940 } else { 3949 } else {
3941 emit changeNavStringPrev(i18n("&Previous Week")); 3950 emit changeNavStringPrev(i18n("&Previous Week"));
3942 emit changeNavStringNext(i18n("&Next Week")); 3951 emit changeNavStringNext(i18n("&Next Week"));
3943 } 3952 }
3944 } 3953 }
3945} 3954}
3946 3955
3947void CalendarView::processMainViewSelection( Incidence *incidence ) 3956void CalendarView::processMainViewSelection( Incidence *incidence )
3948{ 3957{
3949 if ( incidence ) mTodoList->clearSelection(); 3958 if ( incidence ) mTodoList->clearSelection();
3950 processIncidenceSelection( incidence ); 3959 processIncidenceSelection( incidence );
3951} 3960}
3952 3961
3953void CalendarView::processTodoListSelection( Incidence *incidence ) 3962void CalendarView::processTodoListSelection( Incidence *incidence )
3954{ 3963{
3955 if ( incidence && mViewManager->currentView() ) { 3964 if ( incidence && mViewManager->currentView() ) {
3956 mViewManager->currentView()->clearSelection(); 3965 mViewManager->currentView()->clearSelection();
3957 } 3966 }
3958 processIncidenceSelection( incidence ); 3967 processIncidenceSelection( incidence );
3959} 3968}
3960 3969
3961void CalendarView::processIncidenceSelection( Incidence *incidence ) 3970void CalendarView::processIncidenceSelection( Incidence *incidence )
3962{ 3971{
3963 if ( incidence == mSelectedIncidence ) return; 3972 if ( incidence == mSelectedIncidence ) return;
3964 3973
3965 mSelectedIncidence = incidence; 3974 mSelectedIncidence = incidence;
3966 3975
3967 emit incidenceSelected( mSelectedIncidence ); 3976 emit incidenceSelected( mSelectedIncidence );
3968 3977
3969 if ( incidence && incidence->typeID() == eventID ) { 3978 if ( incidence && incidence->typeID() == eventID ) {
3970 Event *event = static_cast<Event *>( incidence ); 3979 Event *event = static_cast<Event *>( incidence );
3971 if ( event->organizer() == KOPrefs::instance()->email() ) { 3980 if ( event->organizer() == KOPrefs::instance()->email() ) {
3972 emit organizerEventsSelected( true ); 3981 emit organizerEventsSelected( true );
3973 } else { 3982 } else {
3974 emit organizerEventsSelected(false); 3983 emit organizerEventsSelected(false);
3975 } 3984 }
3976 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3985 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3977 KOPrefs::instance()->email() ) ) { 3986 KOPrefs::instance()->email() ) ) {
3978 emit groupEventsSelected( true ); 3987 emit groupEventsSelected( true );
3979 } else { 3988 } else {
3980 emit groupEventsSelected(false); 3989 emit groupEventsSelected(false);
3981 } 3990 }
3982 return; 3991 return;
3983 } else { 3992 } else {
3984 if ( incidence && incidence->typeID() == todoID ) { 3993 if ( incidence && incidence->typeID() == todoID ) {
3985 emit todoSelected( true ); 3994 emit todoSelected( true );
3986 Todo *event = static_cast<Todo *>( incidence ); 3995 Todo *event = static_cast<Todo *>( incidence );
3987 if ( event->organizer() == KOPrefs::instance()->email() ) { 3996 if ( event->organizer() == KOPrefs::instance()->email() ) {
3988 emit organizerEventsSelected( true ); 3997 emit organizerEventsSelected( true );
3989 } else { 3998 } else {
3990 emit organizerEventsSelected(false); 3999 emit organizerEventsSelected(false);
3991 } 4000 }
3992 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 4001 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3993 KOPrefs::instance()->email() ) ) { 4002 KOPrefs::instance()->email() ) ) {
3994 emit groupEventsSelected( true ); 4003 emit groupEventsSelected( true );
3995 } else { 4004 } else {
3996 emit groupEventsSelected(false); 4005 emit groupEventsSelected(false);
3997 } 4006 }
3998 return; 4007 return;
3999 } else { 4008 } else {
4000 emit todoSelected( false ); 4009 emit todoSelected( false );
4001 emit organizerEventsSelected(false); 4010 emit organizerEventsSelected(false);
4002 emit groupEventsSelected(false); 4011 emit groupEventsSelected(false);
4003 } 4012 }
4004 return; 4013 return;
4005 } 4014 }
4006 4015
4007 /* if ( incidence && incidence->typeID() == todoID ) { 4016 /* if ( incidence && incidence->typeID() == todoID ) {
4008 emit todoSelected( true ); 4017 emit todoSelected( true );
4009 } else { 4018 } else {
4010 emit todoSelected( false ); 4019 emit todoSelected( false );
4011 }*/ 4020 }*/
4012} 4021}
4013 4022
4014 4023
4015void CalendarView::checkClipboard() 4024void CalendarView::checkClipboard()
4016{ 4025{
4017#ifndef KORG_NODND 4026#ifndef KORG_NODND
4018 if (ICalDrag::canDecode(QApplication::clipboard()->data())) { 4027 if (ICalDrag::canDecode(QApplication::clipboard()->data())) {
4019 emit pasteEnabled(true); 4028 emit pasteEnabled(true);
4020 } else { 4029 } else {
4021 emit pasteEnabled(false); 4030 emit pasteEnabled(false);
4022 } 4031 }
4023#endif 4032#endif
4024} 4033}
4025 4034
4026void CalendarView::showDates(const DateList &selectedDates) 4035void CalendarView::showDates(const DateList &selectedDates)
4027{ 4036{
4028 // kdDebug() << "CalendarView::selectDates()" << endl; 4037 // kdDebug() << "CalendarView::selectDates()" << endl;
4029 4038
4030 4039
4031 if ( !mBlockShowDates ) { 4040 if ( !mBlockShowDates ) {
4032 if ( mViewManager->currentView() ) { 4041 if ( mViewManager->currentView() ) {
4033 updateView( selectedDates.first(), selectedDates.last() ); 4042 updateView( selectedDates.first(), selectedDates.last() );
4034 } else { 4043 } else {
4035 mViewManager->showAgendaView(); 4044 mViewManager->showAgendaView();
4036 } 4045 }
4037 } 4046 }
4038 4047
4039 QDate date = selectedDates.first(); 4048 QDate date = selectedDates.first();
4040 if ( ! date.isValid() ) { 4049 if ( ! date.isValid() ) {
4041 topLevelWidget()->setCaption(""); 4050 topLevelWidget()->setCaption("");
4042 return; 4051 return;
4043 } 4052 }
4044 4053
4045 QString selDates; 4054 QString selDates;
4046 selDates = KGlobal::locale()->formatDate( date, true); 4055 selDates = KGlobal::locale()->formatDate( date, true);
4047 if (selectedDates.first() < selectedDates.last() ) 4056 if (selectedDates.first() < selectedDates.last() )
4048 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); 4057 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true);
4049 else { 4058 else {
4050 QString addString; 4059 QString addString;
4051 if ( date == QDateTime::currentDateTime().date() ) 4060 if ( date == QDateTime::currentDateTime().date() )
4052 addString = i18n("Today"); 4061 addString = i18n("Today");
4053 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 4062 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
4054 addString = i18n("Tomorrow"); 4063 addString = i18n("Tomorrow");
4055 else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) 4064 else if ( date == QDateTime::currentDateTime().date().addDays(-1) )
4056 addString = i18n("Yesterday"); 4065 addString = i18n("Yesterday");
4057 else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) 4066 else if ( date == QDateTime::currentDateTime().date().addDays(-2) )
4058 addString = i18n("Day before yesterday"); 4067 addString = i18n("Day before yesterday");
4059 else if ( date == QDateTime::currentDateTime().date().addDays(2) ) 4068 else if ( date == QDateTime::currentDateTime().date().addDays(2) )
4060 addString = i18n("Day after tomorrow"); 4069 addString = i18n("Day after tomorrow");
4061 if ( !addString.isEmpty() ) { 4070 if ( !addString.isEmpty() ) {
4062 topLevelWidget()->setCaption( addString+", " + selDates ); 4071 topLevelWidget()->setCaption( addString+", " + selDates );
4063 return; 4072 return;
4064 } 4073 }
4065 } 4074 }
4066 topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); 4075 topLevelWidget()->setCaption( i18n("Dates: ") + selDates );
4067 4076
4068} 4077}
4069 4078
4070QPtrList<CalFilter> CalendarView::filters() 4079QPtrList<CalFilter> CalendarView::filters()
4071{ 4080{
4072 return mFilters; 4081 return mFilters;
4073 4082
4074} 4083}
4075void CalendarView::editFilters() 4084void CalendarView::editFilters()
4076{ 4085{
4077 // kdDebug() << "CalendarView::editFilters()" << endl; 4086 // kdDebug() << "CalendarView::editFilters()" << endl;
4078 4087
4079 CalFilter *filter = mFilters.first(); 4088 CalFilter *filter = mFilters.first();
4080 while(filter) { 4089 while(filter) {
4081 filter = mFilters.next(); 4090 filter = mFilters.next();
4082 } 4091 }
4083 4092
4084 mDialogManager->showFilterEditDialog(&mFilters); 4093 mDialogManager->showFilterEditDialog(&mFilters);
4085 updateFilter(); 4094 updateFilter();
4086} 4095}
4087void CalendarView::toggleFilter() 4096void CalendarView::toggleFilter()
4088{ 4097{
4089 if ( mLeftFrame->isHidden() ) { 4098 if ( mLeftFrame->isHidden() ) {
4090 toggleExpand(); 4099 toggleExpand();
4091 showFilter( true ); 4100 showFilter( true );
4092 } else 4101 } else
4093 showFilter(! mCalEditView->isVisible()); 4102 showFilter(! mCalEditView->isVisible());
4094} 4103}
4095 4104
4096KOFilterView *CalendarView::filterView() 4105KOFilterView *CalendarView::filterView()
4097{ 4106{
4098 return mFilterView; 4107 return mFilterView;
4099} 4108}
4100void CalendarView::selectFilter( int fil ) 4109void CalendarView::selectFilter( int fil )
4101{ 4110{
4102 mFilterView->setSelectedFilter( fil ); 4111 mFilterView->setSelectedFilter( fil );
4103 updateUnmanagedViews(); 4112 updateUnmanagedViews();
4104} 4113}
4105void CalendarView::showFilter(bool visible) 4114void CalendarView::showFilter(bool visible)
4106{ 4115{
4107#if 1 4116#if 1
4108 if (visible) { 4117 if (visible) {
4109 mCalEditView->readConfig(); 4118 mCalEditView->readConfig();
4110 mCalEditView->show(); 4119 mCalEditView->show();
4111 QValueList<int> sizes; 4120 QValueList<int> sizes;
4112 sizes = mLeftFrame->sizes(); 4121 sizes = mLeftFrame->sizes();
4113 if ( sizes.count() == 4 && sizes[3] < 20 ) { 4122 if ( sizes.count() == 4 && sizes[3] < 20 ) {
4114 sizes.clear(); 4123 sizes.clear();
4115 sizes << 100; 4124 sizes << 100;
4116 sizes << 0; 4125 sizes << 0;
4117 sizes << 0; 4126 sizes << 0;
4118 sizes << 100; 4127 sizes << 100;
4119 mLeftFrame->setSizes(sizes); 4128 mLeftFrame->setSizes(sizes);
4120 } 4129 }
4121#if 0 4130#if 0
4122 sizes = mLeftFrame->sizes(); 4131 sizes = mLeftFrame->sizes();
4123 int ccc = 0; 4132 int ccc = 0;
4124 while ( ccc < sizes.count()) { 4133 while ( ccc < sizes.count()) {
4125 qDebug("size %d %d ", ccc, sizes[ccc]); 4134 qDebug("size %d %d ", ccc, sizes[ccc]);
4126 ++ccc; 4135 ++ccc;
4127 } 4136 }
4128#endif 4137#endif
4129 4138
4130 } 4139 }
4131 else { 4140 else {
4132 mCalEditView->hide(); 4141 mCalEditView->hide();
4133 } 4142 }
4134#else 4143#else
4135 if (visible) mFilterView->show(); 4144 if (visible) mFilterView->show();
4136 else mFilterView->hide(); 4145 else mFilterView->hide();
4137#endif 4146#endif
4138} 4147}
4139void CalendarView::toggleFilerEnabled( ) 4148void CalendarView::toggleFilerEnabled( )
4140{ 4149{
4141 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); 4150 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() );
4142 if ( !mFilterView->filtersEnabled() ) 4151 if ( !mFilterView->filtersEnabled() )
4143 topLevelWidget()->setCaption( i18n("Filter disabled ") ); 4152 topLevelWidget()->setCaption( i18n("Filter disabled ") );
4144 updateUnmanagedViews(); 4153 updateUnmanagedViews();
4145 4154
4146} 4155}
4147void CalendarView::updateFilter() 4156void CalendarView::updateFilter()
4148{ 4157{
4149 CalFilter *filter = mFilterView->selectedFilter(); 4158 CalFilter *filter = mFilterView->selectedFilter();
4150 if (filter) { 4159 if (filter) {
4151 QString mess; 4160 QString mess;
4152 if (mFilterView->filtersEnabled()) { 4161 if (mFilterView->filtersEnabled()) {
4153 mess = i18n("Filter selected: ")+filter->name(); 4162 mess = i18n("Filter selected: ")+filter->name();
4154 filter->setEnabled(true); 4163 filter->setEnabled(true);
4155 } 4164 }
4156 else filter->setEnabled(false); 4165 else filter->setEnabled(false);
4157 mCalendar->setFilter(filter); 4166 mCalendar->setFilter(filter);
4158 updateView(); 4167 updateView();
4159 if ( !mess.isEmpty() ) 4168 if ( !mess.isEmpty() )
4160 topLevelWidget()->setCaption( mess ); 4169 topLevelWidget()->setCaption( mess );
4161 4170
4162 } 4171 }
4163 emit filtersUpdated(); 4172 emit filtersUpdated();
4164} 4173}
4165 4174
4166void CalendarView::filterEdited() 4175void CalendarView::filterEdited()
4167{ 4176{
4168 mFilterView->updateFilters(); 4177 mFilterView->updateFilters();
4169 updateFilter(); 4178 updateFilter();
4170 writeSettings(); 4179 writeSettings();
4171} 4180}
4172 4181
4173 4182
4174void CalendarView::takeOverEvent() 4183void CalendarView::takeOverEvent()
4175{ 4184{
4176 Incidence *incidence = currentSelection(); 4185 Incidence *incidence = currentSelection();
4177 4186
4178 if (!incidence) return; 4187 if (!incidence) return;
4179 4188
4180 incidence->setOrganizer(KOPrefs::instance()->email()); 4189 incidence->setOrganizer(KOPrefs::instance()->email());
4181 incidence->recreate(); 4190 incidence->recreate();
4182 incidence->setReadOnly(false); 4191 incidence->setReadOnly(false);
4183 4192
4184 updateView(); 4193 updateView();
4185} 4194}
4186 4195
4187void CalendarView::takeOverCalendar() 4196void CalendarView::takeOverCalendar()
4188{ 4197{
4189 // TODO: Create Calendar::allIncidences() function and use it here 4198 // TODO: Create Calendar::allIncidences() function and use it here
4190 4199
4191 clearAllViews(); 4200 clearAllViews();
4192 QPtrList<Event> events = mCalendar->events(); 4201 QPtrList<Event> events = mCalendar->events();
4193 for(uint i=0; i<events.count(); ++i) { 4202 for(uint i=0; i<events.count(); ++i) {
4194 events.at(i)->setOrganizer(KOPrefs::instance()->email()); 4203 events.at(i)->setOrganizer(KOPrefs::instance()->email());
4195 events.at(i)->recreate(); 4204 events.at(i)->recreate();
4196 events.at(i)->setReadOnly(false); 4205 events.at(i)->setReadOnly(false);
4197 } 4206 }
4198 4207
4199 QPtrList<Todo> todos = mCalendar->todos(); 4208 QPtrList<Todo> todos = mCalendar->todos();
4200 for(uint i=0; i<todos.count(); ++i) { 4209 for(uint i=0; i<todos.count(); ++i) {
4201 todos.at(i)->setOrganizer(KOPrefs::instance()->email()); 4210 todos.at(i)->setOrganizer(KOPrefs::instance()->email());
4202 todos.at(i)->recreate(); 4211 todos.at(i)->recreate();
4203 todos.at(i)->setReadOnly(false); 4212 todos.at(i)->setReadOnly(false);
4204 } 4213 }
4205 4214
4206 QPtrList<Journal> journals = mCalendar->journals(); 4215 QPtrList<Journal> journals = mCalendar->journals();
4207 for(uint i=0; i<journals.count(); ++i) { 4216 for(uint i=0; i<journals.count(); ++i) {
4208 journals.at(i)->setOrganizer(KOPrefs::instance()->email()); 4217 journals.at(i)->setOrganizer(KOPrefs::instance()->email());
4209 journals.at(i)->recreate(); 4218 journals.at(i)->recreate();
4210 journals.at(i)->setReadOnly(false); 4219 journals.at(i)->setReadOnly(false);
4211 } 4220 }
4212 4221
4213 updateView(); 4222 updateView();
4214} 4223}
4215 4224
4216void CalendarView::showIntro() 4225void CalendarView::showIntro()
4217{ 4226{
4218 kdDebug() << "To be implemented." << endl; 4227 kdDebug() << "To be implemented." << endl;
4219} 4228}
4220 4229
4221QWidgetStack *CalendarView::viewStack() 4230QWidgetStack *CalendarView::viewStack()
4222{ 4231{
4223 return mRightFrame; 4232 return mRightFrame;
4224} 4233}
4225 4234
4226QWidget *CalendarView::leftFrame() 4235QWidget *CalendarView::leftFrame()
4227{ 4236{
4228 return ( QWidget *)mLeftFrame; 4237 return ( QWidget *)mLeftFrame;
4229} 4238}
4230 4239
4231DateNavigator *CalendarView::dateNavigator() 4240DateNavigator *CalendarView::dateNavigator()
4232{ 4241{
4233 return mNavigator; 4242 return mNavigator;
4234} 4243}
4235 4244
4236KDateNavigator* CalendarView::dateNavigatorWidget() 4245KDateNavigator* CalendarView::dateNavigatorWidget()
4237{ 4246{
4238 return mDateNavigator->navigatorView(); 4247 return mDateNavigator->navigatorView();
4239} 4248}
4240void CalendarView::toggleDateNavigatorWidget() 4249void CalendarView::toggleDateNavigatorWidget()
4241{ 4250{
4242 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; 4251 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ;
4243 4252
4244 if (!KOPrefs::instance()->mShowDateNavigator ) 4253 if (!KOPrefs::instance()->mShowDateNavigator )
4245 mDateNavigator->hide(); 4254 mDateNavigator->hide();
4246 else 4255 else
4247 mDateNavigator->show(); 4256 mDateNavigator->show();
4248} 4257}
4249void CalendarView::addView(KOrg::BaseView *view) 4258void CalendarView::addView(KOrg::BaseView *view)
4250{ 4259{
4251 mViewManager->addView(view); 4260 mViewManager->addView(view);
4252} 4261}
4253 4262
4254void CalendarView::showView(KOrg::BaseView *view) 4263void CalendarView::showView(KOrg::BaseView *view)
4255{ 4264{
4256 mViewManager->showView(view, mLeftFrame->isVisible()); 4265 mViewManager->showView(view, mLeftFrame->isVisible());
4257} 4266}
4258 4267
4259Incidence *CalendarView::currentSelection() 4268Incidence *CalendarView::currentSelection()
4260{ 4269{
4261 return mViewManager->currentSelection(); 4270 return mViewManager->currentSelection();
4262} 4271}
4263void CalendarView::toggleAllDaySize() 4272void CalendarView::toggleAllDaySize()
4264{ 4273{
4265 /* 4274 /*
4266 if ( KOPrefs::instance()->mAllDaySize > 47 ) 4275 if ( KOPrefs::instance()->mAllDaySize > 47 )
4267 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; 4276 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2;
4268 else 4277 else
4269 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; 4278 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2;
4270 */ 4279 */
4271 viewManager()->agendaView()->toggleAllDay(); 4280 viewManager()->agendaView()->toggleAllDay();
4272} 4281}
4273void CalendarView::toggleExpand() 4282void CalendarView::toggleExpand()
4274{ 4283{
4275 // if ( mLeftFrame->isHidden() ) { 4284 // if ( mLeftFrame->isHidden() ) {
4276 // mLeftFrame->show(); 4285 // mLeftFrame->show();
4277 // emit calendarViewExpanded( false ); 4286 // emit calendarViewExpanded( false );
4278 // } else { 4287 // } else {
4279 // mLeftFrame->hide(); 4288 // mLeftFrame->hide();
4280 // emit calendarViewExpanded( true ); 4289 // emit calendarViewExpanded( true );
4281 // } 4290 // }
4282 //qDebug(" CalendarView::toggleExpand()"); 4291 //qDebug(" CalendarView::toggleExpand()");
4283 globalFlagBlockAgenda = 1; 4292 globalFlagBlockAgenda = 1;
4284 emit calendarViewExpanded( !mLeftFrame->isHidden() ); 4293 emit calendarViewExpanded( !mLeftFrame->isHidden() );
4285 globalFlagBlockAgenda = 5; 4294 globalFlagBlockAgenda = 5;
4286 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); 4295 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() );
4287 //mViewManager->showView( 0, true ); 4296 //mViewManager->showView( 0, true );
4288} 4297}
4289 4298
4290void CalendarView::calendarModified( bool modified, Calendar * ) 4299void CalendarView::calendarModified( bool modified, Calendar * )
4291{ 4300{
4292 setModified( modified ); 4301 setModified( modified );
4293} 4302}
4294 4303
4295Todo *CalendarView::selectedTodo() 4304Todo *CalendarView::selectedTodo()
4296{ 4305{
4297 Incidence *incidence = currentSelection(); 4306 Incidence *incidence = currentSelection();
4298 if ( incidence && incidence->typeID() == todoID ) { 4307 if ( incidence && incidence->typeID() == todoID ) {
4299 return static_cast<Todo *>( incidence ); 4308 return static_cast<Todo *>( incidence );
4300 } 4309 }
4301 4310
4302 incidence = mTodoList->selectedIncidences().first(); 4311 incidence = mTodoList->selectedIncidences().first();
4303 if ( incidence && incidence->typeID() == todoID ) { 4312 if ( incidence && incidence->typeID() == todoID ) {
4304 return static_cast<Todo *>( incidence ); 4313 return static_cast<Todo *>( incidence );
4305 } 4314 }
4306 4315
4307 return 0; 4316 return 0;
4308} 4317}
4309 4318
4310void CalendarView::dialogClosing(Incidence *in)
4311{
4312 // mDialogList.remove(in);
4313}
4314
4315void CalendarView::showIncidence() 4319void CalendarView::showIncidence()
4316{ 4320{
4317 mViewerCallerIsSearchDialog = false; 4321 mViewerCallerIsSearchDialog = false;
4318 Incidence *incidence = currentSelection(); 4322 Incidence *incidence = currentSelection();
4319 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4323 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4320 if ( incidence ) { 4324 if ( incidence ) {
4321 ShowIncidenceVisitor v; 4325 ShowIncidenceVisitor v;
4322 v.act( incidence, this ); 4326 v.act( incidence, this );
4323 } 4327 }
4324} 4328}
4325void CalendarView::editIncidenceDescription() 4329void CalendarView::editIncidenceDescription()
4326{ 4330{
4327 mFlagEditDescription = true; 4331 mFlagEditDescription = true;
4328 editIncidence(); 4332 editIncidence();
4329 mFlagEditDescription = false; 4333 mFlagEditDescription = false;
4330} 4334}
4331void CalendarView::editIncidence() 4335void CalendarView::editIncidence()
4332{ 4336{
4333 // qDebug("editIncidence() "); 4337 // qDebug("editIncidence() ");
4334 Incidence *incidence = currentSelection(); 4338 Incidence *incidence = currentSelection();
4335 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4339 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4336 if ( incidence ) { 4340 if ( incidence ) {
4337 EditIncidenceVisitor v; 4341 EditIncidenceVisitor v;
4338 v.act( incidence, this ); 4342 v.act( incidence, this );
4339 } 4343 }
4340} 4344}
4341 4345
4342void CalendarView::deleteIncidence() 4346void CalendarView::deleteIncidence()
4343{ 4347{
4344 Incidence *incidence = currentSelection(); 4348 Incidence *incidence = currentSelection();
4345 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4349 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4346 if ( incidence ) { 4350 if ( incidence ) {
4347 deleteIncidence(incidence); 4351 deleteIncidence(incidence);
4348 } 4352 }
4349} 4353}
4350void CalendarView::showIncidence(QString uid) 4354void CalendarView::showIncidence(QString uid)
4351{ 4355{
4352 Incidence *inc = mCalendar->incidence( uid ); 4356 Incidence *inc = mCalendar->incidence( uid );
4353 if ( inc ) 4357 if ( inc )
4354 showIncidence( inc ); 4358 showIncidence( inc );
4355} 4359}
4356void CalendarView::showIncidence(Incidence *incidence) 4360void CalendarView::showIncidence(Incidence *incidence)
4357{ 4361{
4358 mViewerCallerIsSearchDialog = false; 4362 mViewerCallerIsSearchDialog = false;
4359 //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); 4363 //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() );
4360 if ( sender() && mDialogManager->getSearchDialog() ) { 4364 if ( sender() && mDialogManager->getSearchDialog() ) {
4361 if ( sender () == mDialogManager->getSearchDialog()->listview() ) { 4365 if ( sender () == mDialogManager->getSearchDialog()->listview() ) {
4362 mViewerCallerIsSearchDialog = true; 4366 mViewerCallerIsSearchDialog = true;
4363 } 4367 }
4364 } 4368 }
4365 if ( incidence ) { 4369 if ( incidence ) {
4366 ShowIncidenceVisitor v; 4370 ShowIncidenceVisitor v;
4367 v.act( incidence, this ); 4371 v.act( incidence, this );
4368 } 4372 }
4369} 4373}
4370 4374
4371void CalendarView::editIncidence(Incidence *incidence) 4375void CalendarView::editIncidence(Incidence *incidence)
4372{ 4376{
4373 if ( incidence ) { 4377 if ( incidence ) {
4374 4378
4375 EditIncidenceVisitor v; 4379 EditIncidenceVisitor v;
4376 v.act( incidence, this ); 4380 v.act( incidence, this );
4377 4381
4378 } 4382 }
4379} 4383}
4380 4384
4381void CalendarView::deleteIncidence(Incidence *incidence) 4385void CalendarView::deleteIncidence(Incidence *incidence)
4382{ 4386{
4383 //qDebug(" CalendarView::deleteIncidence "); 4387 //qDebug(" CalendarView::deleteIncidence ");
4384 if ( incidence ) { 4388 if ( incidence ) {
4385 DeleteIncidenceVisitor v; 4389 DeleteIncidenceVisitor v;
4386 v.act( incidence, this ); 4390 v.act( incidence, this );
4387 } 4391 }
4388} 4392}
4389 4393
4390 4394
4391void CalendarView::lookForOutgoingMessages() 4395void CalendarView::lookForOutgoingMessages()
4392{ 4396{
4393 OutgoingDialog *ogd = mDialogManager->outgoingDialog(); 4397 OutgoingDialog *ogd = mDialogManager->outgoingDialog();
4394 ogd->loadMessages(); 4398 ogd->loadMessages();
4395} 4399}
4396 4400
4397void CalendarView::lookForIncomingMessages() 4401void CalendarView::lookForIncomingMessages()
4398{ 4402{
4399 IncomingDialog *icd = mDialogManager->incomingDialog(); 4403 IncomingDialog *icd = mDialogManager->incomingDialog();
4400 icd->retrieve(); 4404 icd->retrieve();
4401} 4405}
4402 4406
4403bool CalendarView::removeCompletedSubTodos( Todo* t ) 4407bool CalendarView::removeCompletedSubTodos( Todo* t )
4404{ 4408{
4405 bool deleteTodo = true; 4409 bool deleteTodo = true;
4406 QPtrList<Incidence> subTodos; 4410 QPtrList<Incidence> subTodos;
4407 Incidence *aTodo; 4411 Incidence *aTodo;
4408 subTodos = t->relations(); 4412 subTodos = t->relations();
4409 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 4413 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
4410 if (! removeCompletedSubTodos( (Todo*) aTodo )) 4414 if (! removeCompletedSubTodos( (Todo*) aTodo ))
4411 deleteTodo = false; 4415 deleteTodo = false;
4412 } 4416 }
4413 if ( deleteTodo ) { 4417 if ( deleteTodo ) {
4414 if ( t->isCompleted() && !t->doesRecur()) { 4418 if ( t->isCompleted() && !t->doesRecur()) {
4415 checkExternalId( t ); 4419 checkExternalId( t );
4416 mCalendar->deleteTodo( t ); 4420 mCalendar->deleteTodo( t );
4417 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 4421 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
4418 } 4422 }
4419 else 4423 else
4420 deleteTodo = false; 4424 deleteTodo = false;
4421 } 4425 }
4422 return deleteTodo; 4426 return deleteTodo;
4423 4427
4424} 4428}
4425void CalendarView::purgeCompleted() 4429void CalendarView::purgeCompleted()
4426{ 4430{
4427 int result = KMessageBox::warningContinueCancel(this, 4431 int result = KMessageBox::warningContinueCancel(this,
4428 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); 4432 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge"));
4429 4433
4430 if (result == KMessageBox::Continue) { 4434 if (result == KMessageBox::Continue) {
4431 4435
4432 QPtrList<Todo> todoCal; 4436 QPtrList<Todo> todoCal;
4433 QPtrList<Todo> rootTodos; 4437 QPtrList<Todo> rootTodos;
4434 //QPtrList<Incidence> rel; 4438 //QPtrList<Incidence> rel;
4435 Todo *aTodo;//, *rTodo; 4439 Todo *aTodo;
4436 Incidence *rIncidence;
4437 bool childDelete = false;
4438 bool deletedOne = true;
4439 todoCal = calendar()->todos(); 4440 todoCal = calendar()->todos();
4440 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 4441 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
4441 if ( !aTodo->relatedTo() ) 4442 if ( !aTodo->relatedTo() )
4442 rootTodos.append( aTodo ); 4443 rootTodos.append( aTodo );
4443 } 4444 }
4444 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 4445 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
4445 removeCompletedSubTodos( aTodo ); 4446 removeCompletedSubTodos( aTodo );
4446 } 4447 }
4447 4448
4448 updateView(); 4449 updateView();
4449 } 4450 }
4450} 4451}
4451 4452
4452void CalendarView::slotCalendarChanged() 4453void CalendarView::slotCalendarChanged()
4453{ 4454{
4454 ; 4455 ;
4455} 4456}
4456 4457
4457void CalendarView::keyPressEvent ( QKeyEvent *e) 4458void CalendarView::keyPressEvent ( QKeyEvent *e)
4458{ 4459{
4459 //qDebug(" alendarView::keyPressEvent "); 4460 //qDebug(" alendarView::keyPressEvent ");
4460 e->ignore(); 4461 e->ignore();
4461} 4462}
4462 4463
4463 4464
4464bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 4465bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
4465{ 4466{
4466 // mSyncManager = manager; 4467
4468 if ( manager != mSyncManager)
4469 qDebug("KO: Internal error-1. SyncManager mismatch ");
4467 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { 4470 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
4468 qDebug("KO: SyncKDE request detected!"); 4471 qDebug("KO: SyncKDE request detected!");
4469 } 4472 }
4470 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 4473 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
4471 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 4474 mCurrentSyncName = mSyncManager->getCurrentSyncName();
4472 return syncCalendar( filename, mode ); 4475 return syncCalendar( filename, mode );
4473} 4476}
4474bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 4477bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
4475{ 4478{
4476 //mSyncManager = manager; 4479 //mSyncManager = manager;
4480 if ( manager != mSyncManager)
4481 qDebug("KO: Internal error-2. SyncManager mismatch ");
4477 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 4482 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
4478 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 4483 mCurrentSyncName = mSyncManager->getCurrentSyncName();
4479 if ( resource == "sharp" ) 4484 if ( resource == "sharp" )
4480 syncExternal( 0 ); 4485 syncExternal( 0 );
4481 if ( resource == "phone" ) 4486 if ( resource == "phone" )
4482 syncExternal( 1 ); 4487 syncExternal( 1 );
4483 // pending setmodified 4488 // pending setmodified
4484 return true; 4489 return true;
4485} 4490}
4486void CalendarView::setSyncManager(KSyncManager* manager) 4491void CalendarView::setSyncManager(KSyncManager* manager)
4487{ 4492{
4488 mSyncManager = manager; 4493 mSyncManager = manager;
4489} 4494}
4490 4495
4491void CalendarView::removeSyncInfo( QString syncProfile) 4496void CalendarView::removeSyncInfo( QString syncProfile)
4492{ 4497{
4493 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); 4498 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1());
4494 mCalendar->removeSyncInfo( syncProfile ); 4499 mCalendar->removeSyncInfo( syncProfile );
4495 4500
4496} 4501}
4497 4502
4498void CalendarView::undo_delete() 4503void CalendarView::undo_delete()
4499{ 4504{
4500 //qDebug("undo_delete() "); 4505 //qDebug("undo_delete() ");
4501 Incidence* undo = mCalendar->undoIncidence(); 4506 Incidence* undo = mCalendar->undoIncidence();
4502 if ( !undo ) { 4507 if ( !undo ) {
4503 KMessageBox::sorry(this,i18n("There is nothing to undo!"), 4508 KMessageBox::sorry(this,i18n("There is nothing to undo!"),
4504 i18n("KO/Pi")); 4509 i18n("KO/Pi"));
4505 return; 4510 return;
4506 } 4511 }
4507 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + 4512 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) +
4508 i18n("\nAre you sure you want\nto restore this?"), 4513 i18n("\nAre you sure you want\nto restore this?"),
4509 i18n("KO/Pi Confirmation"),i18n("Restore"))) { 4514 i18n("KO/Pi Confirmation"),i18n("Restore"))) {
4510 mCalendar->undoDeleteIncidence(); 4515 mCalendar->undoDeleteIncidence();
4511 updateView(); 4516 updateView();
4512 } 4517 }
4513} 4518}
4514 4519
4515void CalendarView::slotViewerClosed() 4520void CalendarView::slotViewerClosed()
4516{ 4521{
4517 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); 4522 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) );
4518} 4523}
4519 4524
4520void CalendarView::resetFocus() 4525void CalendarView::resetFocus()
4521{ 4526{
4522 if ( mViewerCallerIsSearchDialog ) { 4527 if ( mViewerCallerIsSearchDialog ) {
4523 if ( mDialogManager->getSearchDialog()->isVisible() ){ 4528 if ( mDialogManager->getSearchDialog()->isVisible() ){
4524 mDialogManager->getSearchDialog()->raise(); 4529 mDialogManager->getSearchDialog()->raise();
4525 mDialogManager->getSearchDialog()->setActiveWindow(); 4530 mDialogManager->getSearchDialog()->setActiveWindow();
4526 mDialogManager->getSearchDialog()->listview()->resetFocus(); 4531 mDialogManager->getSearchDialog()->listview()->resetFocus();
4527 } else 4532 } else
4528 mViewerCallerIsSearchDialog = false; 4533 mViewerCallerIsSearchDialog = false;
4529 } 4534 }
4530 if ( !mViewerCallerIsSearchDialog ) { 4535 if ( !mViewerCallerIsSearchDialog ) {
4531 //mViewManager->currentView()->setFocus(); 4536 //mViewManager->currentView()->setFocus();
4532 //qDebug("sssssssssssssssset focus "); 4537 //qDebug("sssssssssssssssset focus ");
4533 topLevelWidget()->raise(); 4538 topLevelWidget()->raise();
4534 setActiveWindow(); 4539 setActiveWindow();
4535 //setFocus(); 4540 //setFocus();
4536 } 4541 }
4537 mViewerCallerIsSearchDialog = false; 4542 mViewerCallerIsSearchDialog = false;
4538} 4543}
4539 4544
4540void CalendarView::showNextAlarms() 4545void CalendarView::showNextAlarms()
4541{ 4546{
4542 QString message; 4547 QString message;
4543 QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); 4548 QDateTime nextAl = mCalendar->nextAlarmEventDateTime();
4544 if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) { 4549 if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) {
4545 QString sum = mCalendar->nextSummary(); 4550 QString sum = mCalendar->nextSummary();
4546 QDateTime nextA = mNextAlarmDateTime; 4551 QDateTime nextA = mNextAlarmDateTime;
4547 QDateTime cur = QDateTime::currentDateTime(); 4552 QDateTime cur = QDateTime::currentDateTime();
4548 int secs = cur.secsTo( nextA ); 4553 int secs = cur.secsTo( nextA );
4549 int min = secs /60; 4554 int min = secs /60;
4550 int hours = min /60; 4555 int hours = min /60;
4551 min = min % 60; 4556 min = min % 60;
4552 int days = hours /24; 4557 int days = hours /24;
4553 hours = hours % 24; 4558 hours = hours % 24;
4554 4559
4555 //message = i18n("The next alarm is in:\n"); 4560 //message = i18n("The next alarm is in:\n");
4556 if ( days > 1 ) 4561 if ( days > 1 )
4557 message += i18n("%1 days\n").arg( days ); 4562 message += i18n("%1 days\n").arg( days );
4558 else if ( days == 1 ) 4563 else if ( days == 1 )
4559 message += i18n("1 day\n"); 4564 message += i18n("1 day\n");
4560 if ( hours > 1 ) 4565 if ( hours > 1 )
4561 message += i18n("%1 hours\n").arg( hours ); 4566 message += i18n("%1 hours\n").arg( hours );
4562 else if ( hours == 1 ) 4567 else if ( hours == 1 )
4563 message += i18n("1 hour\n"); 4568 message += i18n("1 hour\n");
4564 if ( min > 1 ) 4569 if ( min > 1 )
4565 message += i18n("%1 minutes\n").arg( min ); 4570 message += i18n("%1 minutes\n").arg( min );
4566 else if ( min == 1 ) 4571 else if ( min == 1 )
4567 message += i18n("1 minute\n"); 4572 message += i18n("1 minute\n");
4568 if ( message.isEmpty() ) 4573 if ( message.isEmpty() )
4569 message = i18n("The next alarm is in\nless than one minute!"); 4574 message = i18n("The next alarm is in\nless than one minute!");
4570 else 4575 else
4571 message = i18n("The next alarm is in:\n") + message; 4576 message = i18n("The next alarm is in:\n") + message;
4572 message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; 4577 message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ;
4573 } else { 4578 } else {
4574 message = i18n("There is no next alarm."); 4579 message = i18n("There is no next alarm.");
4575 4580
4576 } 4581 }
4577#ifdef DESKTOP_VERSION 4582#ifdef DESKTOP_VERSION
4578 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 4583 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
4579 message += i18n("\nThe internal alarm notification is disabled!\n"); 4584 message += i18n("\nThe internal alarm notification is disabled!\n");
4580 message += i18n("Enable it in the settings menu, TAB alarm."); 4585 message += i18n("Enable it in the settings menu, TAB alarm.");
4581 } 4586 }
4582 4587
4583#endif 4588#endif
4584 KMessageBox::information( this, message); 4589 KMessageBox::information( this, message);
4585} 4590}
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 3323a98..c9e9870 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -1,658 +1,658 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000, 2001 3 Copyright (c) 2000, 2001
4 Cornelius Schumacher <schumacher@kde.org> 4 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef CALENDARVIEW_H 24#ifndef CALENDARVIEW_H
25#define CALENDARVIEW_H 25#define CALENDARVIEW_H
26 26
27#include <qframe.h> 27#include <qframe.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qwidget.h> 29#include <qwidget.h>
30#include <qptrlist.h> 30#include <qptrlist.h>
31#include <qvbox.h> 31#include <qvbox.h>
32#include <qmap.h> 32#include <qmap.h>
33#include <qscrollbar.h> 33#include <qscrollbar.h>
34#ifndef DESKTOP_VERSION 34#ifndef DESKTOP_VERSION
35#include <qtopia/ir.h> 35#include <qtopia/ir.h>
36#else 36#else
37#define Ir char 37#define Ir char
38#endif 38#endif
39#include <libkcal/calendar.h> 39#include <libkcal/calendar.h>
40#include <libkcal/scheduler.h> 40#include <libkcal/scheduler.h>
41#include <libkcal/calendarresources.h> 41#include <libkcal/calendarresources.h>
42#include <libkcal/resourcecalendar.h> 42#include <libkcal/resourcecalendar.h>
43#include <KDGanttMinimizeSplitter.h> 43#include <KDGanttMinimizeSplitter.h>
44 44
45#include <korganizer/calendarviewbase.h> 45#include <korganizer/calendarviewbase.h>
46 46
47#include <ksyncmanager.h> 47#include <ksyncmanager.h>
48//#include <koprefs.h> 48//#include <koprefs.h>
49 49
50class QWidgetStack; 50class QWidgetStack;
51class QSplitter; 51class QSplitter;
52class KopiCalendarFile; 52class KopiCalendarFile;
53class CalPrinter; 53class CalPrinter;
54class KOFilterView; 54class KOFilterView;
55class KOCalEditView; 55class KOCalEditView;
56class KOViewManager; 56class KOViewManager;
57class KODialogManager; 57class KODialogManager;
58class KOTodoView; 58class KOTodoView;
59class KDateNavigator; 59class KDateNavigator;
60class DateNavigatorContainer; 60class DateNavigatorContainer;
61class DateNavigator; 61class DateNavigator;
62class KOIncidenceEditor; 62class KOIncidenceEditor;
63class KDatePicker; 63class KDatePicker;
64class ResourceView; 64class ResourceView;
65class KOEventEditor; 65class KOEventEditor;
66class KOTodoEditor ; 66class KOTodoEditor ;
67class KOEventViewerDialog; 67class KOEventViewerDialog;
68class KOBeamPrefs; 68class KOBeamPrefs;
69class KSyncProfile; 69class KSyncProfile;
70class AlarmDialog; 70class AlarmDialog;
71class KCal::Attendee; 71class KCal::Attendee;
72 72
73namespace KCal { class FileStorage; } 73namespace KCal { class FileStorage; }
74 74
75using namespace KCal; 75using namespace KCal;
76 76
77/** 77/**
78 This is the main calendar widget. It provides the different vies on t he 78 This is the main calendar widget. It provides the different vies on t he
79 calendar data as well as the date navigator. It also handles synchronisation 79 calendar data as well as the date navigator. It also handles synchronisation
80 of the different views and controls the different dialogs like preferences, 80 of the different views and controls the different dialogs like preferences,
81 event editor, search dialog etc. 81 event editor, search dialog etc.
82 82
83 @short main calendar view widget 83 @short main calendar view widget
84 @author Cornelius Schumacher 84 @author Cornelius Schumacher
85*/ 85*/
86 86
87#include <qtextbrowser.h> 87#include <qtextbrowser.h>
88#include <qtextcodec.h> 88#include <qtextcodec.h>
89 89
90class MissedAlarmTextBrowser : public QTextBrowser { 90class MissedAlarmTextBrowser : public QTextBrowser {
91 Q_OBJECT 91 Q_OBJECT
92 public: 92 public:
93 MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start); 93 MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start);
94 ~MissedAlarmTextBrowser(); 94 ~MissedAlarmTextBrowser();
95 void setSource(const QString & n); 95 void setSource(const QString & n);
96 96
97 private: 97 private:
98 Incidence * getNextInc(QDateTime start ); 98 Incidence * getNextInc(QDateTime start );
99 QPtrList<Incidence> mAlarms; 99 QPtrList<Incidence> mAlarms;
100 signals: 100 signals:
101 void showIncidence( QString uid); 101 void showIncidence( QString uid);
102}; 102};
103 103
104 104
105class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface 105class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface
106{ 106{
107 Q_OBJECT 107 Q_OBJECT
108 public: 108 public:
109 /** 109 /**
110 Constructs a new calendar view widget. 110 Constructs a new calendar view widget.
111 111
112 @param calendar calendar document 112 @param calendar calendar document
113 @param parent parent window 113 @param parent parent window
114 @param name Qt internal widget object name 114 @param name Qt internal widget object name
115 */ 115 */
116 CalendarView( CalendarResources *calendar, QWidget *parent = 0, 116 CalendarView( CalendarResources *calendar, QWidget *parent = 0,
117 const char *name = 0 ); 117 const char *name = 0 );
118 CalendarView( Calendar *calendar, QWidget *parent = 0, 118 CalendarView( Calendar *calendar, QWidget *parent = 0,
119 const char *name = 0 ); 119 const char *name = 0 );
120 virtual ~CalendarView(); 120 virtual ~CalendarView();
121 121
122 Calendar *calendar() { return mCalendar; } 122 Calendar *calendar() { return mCalendar; }
123 123
124 KOViewManager *viewManager(); 124 KOViewManager *viewManager();
125 KODialogManager *dialogManager(); 125 KODialogManager *dialogManager();
126 126
127 QDate startDate(); 127 QDate startDate();
128 QDate endDate(); 128 QDate endDate();
129 129
130 QWidgetStack *viewStack(); 130 QWidgetStack *viewStack();
131 QWidget *leftFrame(); 131 QWidget *leftFrame();
132 132
133 DateNavigator *dateNavigator(); 133 DateNavigator *dateNavigator();
134 KDateNavigator *dateNavigatorWidget(); 134 KDateNavigator *dateNavigatorWidget();
135 135
136 void addView(KOrg::BaseView *); 136 void addView(KOrg::BaseView *);
137 void showView(KOrg::BaseView *); 137 void showView(KOrg::BaseView *);
138 KOEventViewerDialog* getEventViewerDialog(); 138 KOEventViewerDialog* getEventViewerDialog();
139 Incidence *currentSelection(); 139 Incidence *currentSelection();
140 void checkSuspendAlarm();
140 141
141 signals: 142 signals:
142 void save (); 143 void save ();
143 void saveStopTimer (); 144 void saveStopTimer ();
144 void tempDisableBR(bool); 145 void tempDisableBR(bool);
145 /** This todo has been modified */ 146 /** This todo has been modified */
146 void todoModified(Todo *, int); 147 void todoModified(Todo *, int);
147 148
148 /** when change is made to options dialog, the topwidget will catch this 149 /** when change is made to options dialog, the topwidget will catch this
149 * and emit this signal which notifies all widgets which have registered 150 * and emit this signal which notifies all widgets which have registered
150 * for notification to update their settings. */ 151 * for notification to update their settings. */
151 void configChanged(); 152 void configChanged();
152 /** emitted when the topwidget is closing down, so that any attached 153 /** emitted when the topwidget is closing down, so that any attached
153 child windows can also close. */ 154 child windows can also close. */
154 void closingDown(); 155 void closingDown();
155 /** emitted right before we die */ 156 /** emitted right before we die */
156 void closed(QWidget *); 157 void closed(QWidget *);
157 158
158 /** Emitted when state of modified flag changes */ 159 /** Emitted when state of modified flag changes */
159 void modifiedChanged(bool); 160 void modifiedChanged(bool);
160 void signalmodified(); 161 void signalmodified();
161 162
162 /** Emitted when state of read-only flag changes */ 163 /** Emitted when state of read-only flag changes */
163 void readOnlyChanged(bool); 164 void readOnlyChanged(bool);
164 165
165 /** Emitted when the unit of navigation changes */ 166 /** Emitted when the unit of navigation changes */
166 void changeNavStringPrev(const QString &); 167 void changeNavStringPrev(const QString &);
167 void changeNavStringNext(const QString &); 168 void changeNavStringNext(const QString &);
168 169
169 /** Emitted when state of events selection has changed and user is organizer*/ 170 /** Emitted when state of events selection has changed and user is organizer*/
170 void organizerEventsSelected(bool); 171 void organizerEventsSelected(bool);
171 /** Emitted when state of events selection has changed and user is attendee*/ 172 /** Emitted when state of events selection has changed and user is attendee*/
172 void groupEventsSelected(bool); 173 void groupEventsSelected(bool);
173 /** 174 /**
174 Emitted when an incidence gets selected. If the selection is cleared the 175 Emitted when an incidence gets selected. If the selection is cleared the
175 signal is emitted with 0 as argument. 176 signal is emitted with 0 as argument.
176 */ 177 */
177 void incidenceSelected( Incidence * ); 178 void incidenceSelected( Incidence * );
178 /** Emitted, when a todoitem is selected or deselected. */ 179 /** Emitted, when a todoitem is selected or deselected. */
179 void todoSelected( bool ); 180 void todoSelected( bool );
180 181
181 /** 182 /**
182 Emitted, when clipboard content changes. Parameter indicates if paste 183 Emitted, when clipboard content changes. Parameter indicates if paste
183 is possible or not. 184 is possible or not.
184 */ 185 */
185 void pasteEnabled(bool); 186 void pasteEnabled(bool);
186 187
187 /** Emitted, when the number of incoming messages has changed. */ 188 /** Emitted, when the number of incoming messages has changed. */
188 void numIncomingChanged(int); 189 void numIncomingChanged(int);
189 190
190 /** Emitted, when the number of outgoing messages has changed. */ 191 /** Emitted, when the number of outgoing messages has changed. */
191 void numOutgoingChanged(int); 192 void numOutgoingChanged(int);
192 193
193 /** Send status message, which can e.g. be displayed in the status bar. */ 194 /** Send status message, which can e.g. be displayed in the status bar. */
194 void statusMessage(const QString &); 195 void statusMessage(const QString &);
195 196
196 void calendarViewExpanded( bool ); 197 void calendarViewExpanded( bool );
197 void updateSearchDialog(); 198 void updateSearchDialog();
198 void filtersUpdated(); 199 void filtersUpdated();
199 200
200 201
201 public slots: 202 public slots:
202 void checkAlarms(); 203 void checkAlarms();
203 void slotprintSelInc(); 204 void slotprintSelInc();
204 void showNextAlarms(); 205 void showNextAlarms();
205 void showOpenError(); 206 void showOpenError();
206 void watchSavedFile(); 207 void watchSavedFile();
207 void recheckTimerAlarm(); 208 void recheckTimerAlarm();
208 void checkNextTimerAlarm(); 209 void checkNextTimerAlarm();
209 void addAlarm(const QDateTime &qdt, const QString &noti ); 210 void addAlarm(const QDateTime &qdt, const QString &noti );
210 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 211 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
211 void removeAlarm(const QDateTime &qdt, const QString &noti ); 212 void removeAlarm(const QDateTime &qdt, const QString &noti );
212 213
213 /** options dialog made a changed to the configuration. we catch this 214 /** options dialog made a changed to the configuration. we catch this
214 * and notify all widgets which need to update their configuration. */ 215 * and notify all widgets which need to update their configuration. */
215 void updateConfig(); 216 void updateConfig();
216 217
217 void insertBirthdays(const QString& uid, const QStringList& birthdayList, 218 void insertBirthdays(const QString& uid, const QStringList& birthdayList,
218 const QStringList& anniversaryList, const QStringList& realNameList, 219 const QStringList& anniversaryList, const QStringList& realNameList,
219 const QStringList& emailList, const QStringList& assembledNameList, 220 const QStringList& emailList, const QStringList& assembledNameList,
220 const QStringList& uidList); 221 const QStringList& uidList);
221 222
222 /** 223 /**
223 Load calendar from file \a filename. If \a merge is true, load 224 Load calendar from file \a filename. If \a merge is true, load
224 calendar into existing one, if it is false, clear calendar, before 225 calendar into existing one, if it is false, clear calendar, before
225 loading. Return true, if calendar could be successfully loaded. 226 loading. Return true, if calendar could be successfully loaded.
226 */ 227 */
227 bool openCalendar(QString filename, bool merge=false); 228 bool openCalendar(QString filename, bool merge=false);
228 bool loadCalendars(); 229 bool loadCalendars();
229 bool saveCalendars(); 230 bool saveCalendars();
230 bool restoreCalendarSettings(); 231 bool restoreCalendarSettings();
231 bool addCalendar( KopiCalendarFile * ); 232 bool addCalendar( KopiCalendarFile * );
232 void addCalendarId( int id ); 233 void addCalendarId( int id );
233 bool syncCalendar(QString filename,int mode = 0 ); 234 bool syncCalendar(QString filename,int mode = 0 );
234 235
235 /** 236 /**
236 Save calendar data to file. Return true if calendar could be 237 Save calendar data to file. Return true if calendar could be
237 successfully saved. 238 successfully saved.
238 */ 239 */
239 bool saveCalendar(QString filename); 240 bool saveCalendar(QString filename);
240 241
241 /** 242 /**
242 Close calendar. Clear calendar data and reset views to display an empty 243 Close calendar. Clear calendar data and reset views to display an empty
243 calendar. 244 calendar.
244 */ 245 */
245 void closeCalendar(); 246 void closeCalendar();
246 247
247 /** Archive old events of calendar */ 248 /** Archive old events of calendar */
248 void archiveCalendar(); 249 void archiveCalendar();
249 250
250 void showIncidence(); 251 void showIncidence();
251 void editIncidence(); 252 void editIncidence();
252 void editIncidenceDescription(); 253 void editIncidenceDescription();
253 void deleteIncidence(); 254 void deleteIncidence();
254 void cloneIncidence(); 255 void cloneIncidence();
255 void moveIncidence(); 256 void moveIncidence();
256 void beamIncidence(); 257 void beamIncidence();
257 void toggleCancelIncidence(); 258 void toggleCancelIncidence();
258 259
259 /** create an editeventwin with supplied date/time, and if bool is true, 260 /** create an editeventwin with supplied date/time, and if bool is true,
260 * make the event take all day. */ 261 * make the event take all day. */
261 void newEvent(QDateTime, QDateTime, bool allDay ); 262 void newEvent(QDateTime, QDateTime, bool allDay );
262 void newEvent(QDateTime, QDateTime); 263 void newEvent(QDateTime, QDateTime);
263 void newEvent(QDateTime fh); 264 void newEvent(QDateTime fh);
264 void newEvent(QDate dt); 265 void newEvent(QDate dt);
265 /** create new event without having a date hint. Takes current date as 266 /** create new event without having a date hint. Takes current date as
266 default hint. */ 267 default hint. */
267 void newEvent(); 268 void newEvent();
268 void newFloatingEvent(); 269 void newFloatingEvent();
269 270
270 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ 271 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
271 void showIncidence(Incidence *); 272 void showIncidence(Incidence *);
272 void showIncidence(QString uid); 273 void showIncidence(QString uid);
273 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ 274 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/
274 void editIncidence(Incidence *); 275 void editIncidence(Incidence *);
275 /** Delete the supplied incidence. It calls the correct deleteXXX method*/ 276 /** Delete the supplied incidence. It calls the correct deleteXXX method*/
276 void deleteIncidence(Incidence *); 277 void deleteIncidence(Incidence *);
277 void cloneIncidence(Incidence *); 278 void cloneIncidence(Incidence *);
278 void cancelIncidence(Incidence *); 279 void cancelIncidence(Incidence *);
279 /** Create an editor for the supplied event. */ 280 /** Create an editor for the supplied event. */
280 void editEvent(Event *); 281 void editEvent(Event *);
281 /** Delete the supplied event. */ 282 /** Delete the supplied event. */
282 void deleteEvent(Event *); 283 void deleteEvent(Event *);
283 /** Delete the event with the given unique ID. Returns false, if event wasn't 284 /** Delete the event with the given unique ID. Returns false, if event wasn't
284 found. */ 285 found. */
285 bool deleteEvent(const QString &uid); 286 bool deleteEvent(const QString &uid);
286 /** Create a read-only viewer dialog for the supplied event. */ 287 /** Create a read-only viewer dialog for the supplied event. */
287 void showEvent(Event *); 288 void showEvent(Event *);
288 289
289 void editJournal(Journal *); 290 void editJournal(Journal *);
290 void showJournal(Journal *); 291 void showJournal(Journal *);
291 void deleteJournal(Journal *); 292 void deleteJournal(Journal *);
292 /** Create an editor dialog for a todo */ 293 /** Create an editor dialog for a todo */
293 void editTodo(Todo *); 294 void editTodo(Todo *);
294 /** Create a read-only viewer dialog for the supplied todo */ 295 /** Create a read-only viewer dialog for the supplied todo */
295 void showTodo(Todo *); 296 void showTodo(Todo *);
296 /** create new todo */ 297 /** create new todo */
297 void newTodo(); 298 void newTodo();
298 void newTodoDateTime(QDateTime, bool allday); 299 void newTodoDateTime(QDateTime, bool allday);
299 /** create new todo with a parent todo */ 300 /** create new todo with a parent todo */
300 void newSubTodo(); 301 void newSubTodo();
301 /** create new todo with a parent todo */ 302 /** create new todo with a parent todo */
302 void newSubTodo(Todo *); 303 void newSubTodo(Todo *);
303 /** Delete todo */ 304 /** Delete todo */
304 void deleteTodo(Todo *); 305 void deleteTodo(Todo *);
305 306
306 307
307 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is 308 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is
308 * emitted as result. */ 309 * emitted as result. */
309 void checkClipboard(); 310 void checkClipboard();
310 311
311 /** using the KConfig associated with the kapp variable, read in the 312 /** using the KConfig associated with the kapp variable, read in the
312 * settings from the config file. 313 * settings from the config file.
313 */ 314 */
314 void readSettings(); 315 void readSettings();
315 316
316 /** write current state to config file. */ 317 /** write current state to config file. */
317 void writeSettings(); 318 void writeSettings();
318 319
319 /** read settings for calendar filters */ 320 /** read settings for calendar filters */
320 void readFilterSettings(KConfig *config); 321 void readFilterSettings(KConfig *config);
321 322
322 /** write settings for calendar filters */ 323 /** write settings for calendar filters */
323 void writeFilterSettings(KConfig *config); 324 void writeFilterSettings(KConfig *config);
324 325
325 /** passes on the message that an event has changed to the currently 326 /** passes on the message that an event has changed to the currently
326 * activated view so that it can make appropriate display changes. */ 327 * activated view so that it can make appropriate display changes. */
327 void changeEventDisplay(Event *, int); 328 void changeEventDisplay(Event *, int);
328 void changeIncidenceDisplay(Incidence *, int); 329 void changeIncidenceDisplay(Incidence *, int);
329 void changeTodoDisplay(Todo *, int); 330 void changeTodoDisplay(Todo *, int);
330 331
331 void eventAdded(Event *); 332 void eventAdded(Event *);
332 void eventChanged(Event *); 333 void eventChanged(Event *);
333 void eventToBeDeleted(Event *); 334 void eventToBeDeleted(Event *);
334 void eventDeleted(); 335 void eventDeleted();
335 336
336 void todoAdded(Todo *); 337 void todoAdded(Todo *);
337 void todoChanged(Todo *); 338 void todoChanged(Todo *);
338 void todoToBeDeleted(Todo *); 339 void todoToBeDeleted(Todo *);
339 void todoDeleted(); 340 void todoDeleted();
340 341
341 void updateView(const QDate &start, const QDate &end); 342 void updateView(const QDate &start, const QDate &end);
342 void updateView(); 343 void updateView();
343 void clearAllViews(); 344 void clearAllViews();
344 345
345 /** Full update of visible todo views */ 346 /** Full update of visible todo views */
346 void updateTodoViews(); 347 void updateTodoViews();
347 348
348 void updateUnmanagedViews(); 349 void updateUnmanagedViews();
349 350
350 /** cut the current appointment to the clipboard */ 351 /** cut the current appointment to the clipboard */
351 void edit_cut(); 352 void edit_cut();
352 353
353 /** copy the current appointment(s) to the clipboard */ 354 /** copy the current appointment(s) to the clipboard */
354 void edit_copy(); 355 void edit_copy();
355 356
356 /** paste the current vobject(s) in the clipboard buffer into calendar */ 357 /** paste the current vobject(s) in the clipboard buffer into calendar */
357 void edit_paste(); 358 void edit_paste();
358 359
359 /** edit viewing and configuration options. */ 360 /** edit viewing and configuration options. */
360 void edit_options(); 361 void edit_options();
361 void edit_global_options(); 362 void edit_global_options();
362 /** 363 /**
363 Functions for printing, previewing a print, and setting up printing 364 Functions for printing, previewing a print, and setting up printing
364 parameters. 365 parameters.
365 */ 366 */
366 void print(); 367 void print();
367 void printSetup(); 368 void printSetup();
368 void printPreview(); 369 void printPreview();
369 370
370 /** Export as iCalendar file */ 371 /** Export as iCalendar file */
371 void exportICalendar(); 372 void exportICalendar();
372 373
373 /** Export as vCalendar file */ 374 /** Export as vCalendar file */
374 bool exportVCalendar( QString fn); 375 bool exportVCalendar( QString fn);
375 376
376 /** pop up a dialog to show an existing appointment. */ 377 /** pop up a dialog to show an existing appointment. */
377 void appointment_show(); 378 void appointment_show();
378 /** 379 /**
379 * pop up an Appointment Dialog to edit an existing appointment.Get 380 * pop up an Appointment Dialog to edit an existing appointment.Get
380 * information on the appointment from the list of unique IDs that is 381 * information on the appointment from the list of unique IDs that is
381 * currently in the View, called currIds. 382 * currently in the View, called currIds.
382 */ 383 */
383 void appointment_edit(); 384 void appointment_edit();
384 /** 385 /**
385 * pop up dialog confirming deletion of currently selected event in the 386 * pop up dialog confirming deletion of currently selected event in the
386 * View. 387 * View.
387 */ 388 */
388 void appointment_delete(); 389 void appointment_delete();
389 390
390 /** mails the currently selected event to a particular user as a vCalendar 391 /** mails the currently selected event to a particular user as a vCalendar
391 attachment. */ 392 attachment. */
392 void action_mail(); 393 void action_mail();
393 394
394 /* frees a subtodo from it's relation */ 395 /* frees a subtodo from it's relation */
395 void todo_unsub( Todo * ); 396 void todo_unsub( Todo * );
396 void todo_resub( Todo * parent, Todo * sub ); 397 void todo_resub( Todo * parent, Todo * sub );
397 398
398 /** Take ownership of selected event. */ 399 /** Take ownership of selected event. */
399 void takeOverEvent(); 400 void takeOverEvent();
400 401
401 /** Take ownership of all events in calendar. */ 402 /** Take ownership of all events in calendar. */
402 void takeOverCalendar(); 403 void takeOverCalendar();
403 404
404 /** query whether or not the calendar is "dirty". */ 405 /** query whether or not the calendar is "dirty". */
405 bool isModified(); 406 bool isModified();
406 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ 407 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */
407 void setModified(bool modified=true); 408 void setModified(bool modified=true);
408 409
409 /** query if the calendar is read-only. */ 410 /** query if the calendar is read-only. */
410 bool isReadOnly(); 411 bool isReadOnly();
411 /** set state of calendar to read-only */ 412 /** set state of calendar to read-only */
412 void setReadOnly(bool readOnly=true); 413 void setReadOnly(bool readOnly=true);
413 414
414 void eventUpdated(Incidence *); 415 void eventUpdated(Incidence *);
415 416
416 /* iTIP scheduling actions */ 417 /* iTIP scheduling actions */
417 void schedule_publish(Incidence *incidence = 0); 418 void schedule_publish(Incidence *incidence = 0);
418 void schedule_request(Incidence *incidence = 0); 419 void schedule_request(Incidence *incidence = 0);
419 void schedule_refresh(Incidence *incidence = 0); 420 void schedule_refresh(Incidence *incidence = 0);
420 void schedule_cancel(Incidence *incidence = 0); 421 void schedule_cancel(Incidence *incidence = 0);
421 void schedule_add(Incidence *incidence = 0); 422 void schedule_add(Incidence *incidence = 0);
422 void schedule_reply(Incidence *incidence = 0); 423 void schedule_reply(Incidence *incidence = 0);
423 void schedule_counter(Incidence *incidence = 0); 424 void schedule_counter(Incidence *incidence = 0);
424 void schedule_declinecounter(Incidence *incidence = 0); 425 void schedule_declinecounter(Incidence *incidence = 0);
425 void schedule_publish_freebusy(int daysToPublish = 30); 426 void schedule_publish_freebusy(int daysToPublish = 30);
426 427
427 void openAddressbook(); 428 void openAddressbook();
428 429
429 void editFilters(); 430 void editFilters();
430 void toggleFilerEnabled(); 431 void toggleFilerEnabled();
431 QPtrList<CalFilter> filters(); 432 QPtrList<CalFilter> filters();
432 void toggleFilter(); 433 void toggleFilter();
433 void showFilter(bool visible); 434 void showFilter(bool visible);
434 void updateFilter(); 435 void updateFilter();
435 void filterEdited(); 436 void filterEdited();
436 void selectFilter( int ); 437 void selectFilter( int );
437 KOFilterView *filterView(); 438 KOFilterView *filterView();
438 439
439 void showIntro(); 440 void showIntro();
440 441
441 /** Move the curdatepient view date to today */ 442 /** Move the curdatepient view date to today */
442 void goToday(); 443 void goToday();
443 444
444 /** Move to the next date(s) in the current view */ 445 /** Move to the next date(s) in the current view */
445 void goNext(); 446 void goNext();
446 447
447 /** Move to the previous date(s) in the current view */ 448 /** Move to the previous date(s) in the current view */
448 void goPrevious(); 449 void goPrevious();
449 /** Move to the next date(s) in the current view */ 450 /** Move to the next date(s) in the current view */
450 void goNextMonth(); 451 void goNextMonth();
451 452
452 /** Move to the previous date(s) in the current view */ 453 /** Move to the previous date(s) in the current view */
453 void goPreviousMonth(); 454 void goPreviousMonth();
454 455
455 void toggleExpand(); 456 void toggleExpand();
456 void toggleDateNavigatorWidget(); 457 void toggleDateNavigatorWidget();
457 void toggleAllDaySize(); 458 void toggleAllDaySize();
458 void dialogClosing(Incidence *);
459 459
460 /** Look for new messages in the inbox */ 460 /** Look for new messages in the inbox */
461 void lookForIncomingMessages(); 461 void lookForIncomingMessages();
462 /** Look for new messages in the outbox */ 462 /** Look for new messages in the outbox */
463 void lookForOutgoingMessages(); 463 void lookForOutgoingMessages();
464 464
465 void processMainViewSelection( Incidence * ); 465 void processMainViewSelection( Incidence * );
466 void processTodoListSelection( Incidence * ); 466 void processTodoListSelection( Incidence * );
467 467
468 void processIncidenceSelection( Incidence * ); 468 void processIncidenceSelection( Incidence * );
469 469
470 void purgeCompleted(); 470 void purgeCompleted();
471 bool removeCompletedSubTodos( Todo* ); 471 bool removeCompletedSubTodos( Todo* );
472 void slotCalendarChanged(); 472 void slotCalendarChanged();
473 bool importBday(); 473 bool importBday();
474 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); 474 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
475 bool importQtopia( const QString &categoriesFile, 475 bool importQtopia( const QString &categoriesFile,
476 const QString &datebookFile, 476 const QString &datebookFile,
477 const QString &tasklistFile ); 477 const QString &tasklistFile );
478 void syncExternal( int mode ); 478 void syncExternal( int mode );
479 void slotSelectPickerDate( QDate ) ; 479 void slotSelectPickerDate( QDate ) ;
480 void showDatePicker() ; 480 void showDatePicker() ;
481 void showDatePickerPopup() ; 481 void showDatePickerPopup() ;
482 void moveIncidence(Incidence *) ; 482 void moveIncidence(Incidence *) ;
483 void beamIncidence(Incidence *) ; 483 void beamIncidence(Incidence *) ;
484 void beamCalendar() ; 484 void beamCalendar() ;
485 void beamFilteredCalendar() ; 485 void beamFilteredCalendar() ;
486 void beamIncidenceList(QPtrList<Incidence>) ; 486 void beamIncidenceList(QPtrList<Incidence>) ;
487 void manageCategories(); 487 void manageCategories();
488 void editCategories(); 488 void editCategories();
489 int addCategories(); 489 int addCategories();
490 void removeCategories(); 490 void removeCategories();
491 void setSyncDevice( QString ); 491 void setSyncDevice( QString );
492 void setSyncName( QString ); 492 void setSyncName( QString );
493 void showDay( QDate ); 493 void showDay( QDate );
494 void undo_delete(); 494 void undo_delete();
495 protected slots: 495 protected slots:
496 void resetFocus(); 496 void resetFocus();
497 void scrollBarValue(int); 497 void scrollBarValue(int);
498 void slotViewerClosed(); 498 void slotViewerClosed();
499 void timerAlarm(); 499 void timerAlarm();
500 void suspendAlarm(); 500 void suspendAlarm();
501 void beamDone( Ir *ir ); 501 void beamDone( Ir *ir );
502 /** Select a view or adapt the current view to display the specified dates. */ 502 /** Select a view or adapt the current view to display the specified dates. */
503 void showDates( const KCal::DateList & ); 503 void showDates( const KCal::DateList & );
504 void selectWeekNum ( int ); 504 void selectWeekNum ( int );
505 505
506 public: 506 public:
507 // show a standard warning 507 // show a standard warning
508 // returns KMsgBox::yesNoCancel() 508 // returns KMsgBox::yesNoCancel()
509 int msgCalModified(); 509 int msgCalModified();
510 virtual bool sync(KSyncManager* manager, QString filename, int mode); 510 virtual bool sync(KSyncManager* manager, QString filename, int mode);
511 511
512 virtual bool syncExternal(KSyncManager* manager, QString resource); 512 virtual bool syncExternal(KSyncManager* manager, QString resource);
513 virtual void removeSyncInfo( QString syncProfile); 513 virtual void removeSyncInfo( QString syncProfile);
514 void setSyncManager(KSyncManager* manager); 514 void setSyncManager(KSyncManager* manager);
515 void setLoadedFileVersion(QDateTime); 515 void setLoadedFileVersion(QDateTime);
516 bool checkFileVersion(QString fn); 516 bool checkFileVersion(QString fn);
517 bool checkAllFileVersions(); 517 bool checkAllFileVersions();
518 bool checkFileChanged(QString fn); 518 bool checkFileChanged(QString fn);
519 Event* getLastSyncEvent(); 519 Event* getLastSyncEvent();
520 /** Adapt navigation units correpsonding to step size of navigation of the 520 /** Adapt navigation units correpsonding to step size of navigation of the
521 * current view. 521 * current view.
522 */ 522 */
523 void adaptNavigationUnits(); 523 void adaptNavigationUnits();
524 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 524 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
525 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 525 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
526 //Attendee* getYourAttendee(Event *event); 526 //Attendee* getYourAttendee(Event *event);
527 void setBlockShowDates( bool b ) { mBlockShowDates = b ;} 527 void setBlockShowDates( bool b ) { mBlockShowDates = b ;}
528 void setScrollBarStep(int val ); 528 void setScrollBarStep(int val );
529 529
530 protected: 530 protected:
531 void schedule(Scheduler::Method, Incidence *incidence = 0); 531 void schedule(Scheduler::Method, Incidence *incidence = 0);
532 532
533 // returns KMsgBox::OKCandel() 533 // returns KMsgBox::OKCandel()
534 int msgItemDelete(const QString name); 534 int msgItemDelete(const QString name);
535 void showEventEditor(); 535 void showEventEditor();
536 void showTodoEditor(); 536 void showTodoEditor();
537 Todo *selectedTodo(); 537 Todo *selectedTodo();
538 private: 538 private:
539#ifdef DESKTOP_VERSION 539#ifdef DESKTOP_VERSION
540 QScrollBar * mDateScrollBar; 540 QScrollBar * mDateScrollBar;
541#endif 541#endif
542 QDateTime mNextAlarmDateTime; 542 QDateTime mNextAlarmDateTime;
543 bool mViewerCallerIsSearchDialog; 543 bool mViewerCallerIsSearchDialog;
544 bool mBlockShowDates; 544 bool mBlockShowDates;
545 KSyncManager* mSyncManager; 545 KSyncManager* mSyncManager;
546 AlarmDialog * mAlarmDialog; 546 AlarmDialog * mAlarmDialog;
547 QString mAlarmNotification; 547 QString mAlarmNotification;
548 QString mSuspendAlarmNotification; 548 QString mSuspendAlarmNotification;
549 QTimer* mSuspendTimer; 549 QTimer* mSuspendTimer;
550 QTimer* mAlarmTimer; 550 QTimer* mAlarmTimer;
551 QTimer* mRecheckAlarmTimer; 551 QTimer* mRecheckAlarmTimer;
552 void computeAlarm( QString ); 552 void computeAlarm( QString );
553 void startAlarm( QString, QString ); 553 void startAlarm( QString, QString );
554 void setSyncEventsReadOnly(); 554 void setSyncEventsReadOnly();
555 555
556 QDateTime loadedFileVersion; 556 QDateTime loadedFileVersion;
557 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); 557 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
558 void checkExternalId( Incidence * inc ); 558 void checkExternalId( Incidence * inc );
559 int mGlobalSyncMode; 559 int mGlobalSyncMode;
560 QString mCurrentSyncDevice; 560 QString mCurrentSyncDevice;
561 QString mCurrentSyncName; 561 QString mCurrentSyncName;
562 void init(); 562 void init();
563 int mDatePickerMode; 563 int mDatePickerMode;
564 bool mFlagEditDescription; 564 bool mFlagEditDescription;
565 QDateTime mLastCalendarSync; 565 QDateTime mLastCalendarSync;
566 void createPrinter(); 566 void createPrinter();
567 567
568 void calendarModified( bool, Calendar * ); 568 void calendarModified( bool, Calendar * );
569 569
570 CalPrinter *mCalPrinter; 570 CalPrinter *mCalPrinter;
571 571
572 QSplitter *mPanner; 572 QSplitter *mPanner;
573 QSplitter *mLeftSplitter; 573 QSplitter *mLeftSplitter;
574 KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; 574 KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame;
575 QWidgetStack *mRightFrame; 575 QWidgetStack *mRightFrame;
576 576
577 KDatePicker* mDatePicker; 577 KDatePicker* mDatePicker;
578 QVBox* mDateFrame; 578 QVBox* mDateFrame;
579 579
580 DateNavigatorContainer *mDateNavigator; // widget showing small month view. 580 DateNavigatorContainer *mDateNavigator; // widget showing small month view.
581 581
582 KOFilterView *mFilterView; 582 KOFilterView *mFilterView;
583 KOCalEditView *mCalEditView; 583 KOCalEditView *mCalEditView;
584 584
585 ResourceView *mResourceView; 585 ResourceView *mResourceView;
586 586
587 // calendar object for this viewing instance 587 // calendar object for this viewing instance
588 Calendar *mCalendar; 588 Calendar *mCalendar;
589 589
590 CalendarResourceManager *mResourceManager; 590 CalendarResourceManager *mResourceManager;
591 591
592 FileStorage *mStorage; 592 FileStorage *mStorage;
593 593
594 DateNavigator *mNavigator; 594 DateNavigator *mNavigator;
595 595
596 KOViewManager *mViewManager; 596 KOViewManager *mViewManager;
597 KODialogManager *mDialogManager; 597 KODialogManager *mDialogManager;
598 598
599 // Calendar filters 599 // Calendar filters
600 QPtrList<CalFilter> mFilters; 600 QPtrList<CalFilter> mFilters;
601 601
602 // various housekeeping variables. 602 // various housekeeping variables.
603 bool mModified; // flag indicating if calendar is modified 603 bool mModified; // flag indicating if calendar is modified
604 bool mReadOnly; // flag indicating if calendar is read-only 604 bool mReadOnly; // flag indicating if calendar is read-only
605 QDate mSaveSingleDate; 605 QDate mSaveSingleDate;
606 606
607 Incidence *mSelectedIncidence; 607 Incidence *mSelectedIncidence;
608 Incidence *mMoveIncidence; 608 Incidence *mMoveIncidence;
609 QDate mMoveIncidenceOldDate; 609 QDate mMoveIncidenceOldDate;
610 KOTodoView *mTodoList; 610 KOTodoView *mTodoList;
611 KOEventEditor * mEventEditor; 611 KOEventEditor * mEventEditor;
612 KOTodoEditor * mTodoEditor; 612 KOTodoEditor * mTodoEditor;
613 KOEventViewerDialog * mEventViewerDialog; 613 KOEventViewerDialog * mEventViewerDialog;
614 void keyPressEvent ( QKeyEvent *e) ; 614 void keyPressEvent ( QKeyEvent *e) ;
615 //QMap<Incidence*,KOIncidenceEditor*> mDialogList; 615 //QMap<Incidence*,KOIncidenceEditor*> mDialogList;
616}; 616};
617 617
618 618
619class CalendarViewVisitor : public Incidence::Visitor 619class CalendarViewVisitor : public Incidence::Visitor
620{ 620{
621 public: 621 public:
622 CalendarViewVisitor() : mView( 0 ) {} 622 CalendarViewVisitor() : mView( 0 ) {}
623 623
624 bool act( Incidence *incidence, CalendarView *view ) 624 bool act( Incidence *incidence, CalendarView *view )
625 { 625 {
626 mView = view; 626 mView = view;
627 return incidence->accept( *this ); 627 return incidence->accept( *this );
628 } 628 }
629 629
630 protected: 630 protected:
631 CalendarView *mView; 631 CalendarView *mView;
632}; 632};
633 633
634class ShowIncidenceVisitor : public CalendarViewVisitor 634class ShowIncidenceVisitor : public CalendarViewVisitor
635{ 635{
636 protected: 636 protected:
637 bool visit( Event *event ) { mView->showEvent( event ); return true; } 637 bool visit( Event *event ) { mView->showEvent( event ); return true; }
638 bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } 638 bool visit( Todo *todo ) { mView->showTodo( todo ); return true; }
639 bool visit( Journal * j ) { mView->showJournal( j );return true; } 639 bool visit( Journal * j ) { mView->showJournal( j );return true; }
640}; 640};
641 641
642class EditIncidenceVisitor : public CalendarViewVisitor 642class EditIncidenceVisitor : public CalendarViewVisitor
643{ 643{
644 protected: 644 protected:
645 bool visit( Event *event ) { mView->editEvent( event ); return true; } 645 bool visit( Event *event ) { mView->editEvent( event ); return true; }
646 bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } 646 bool visit( Todo *todo ) { mView->editTodo( todo ); return true; }
647 bool visit( Journal *j ) { mView->editJournal( j); return true; } 647 bool visit( Journal *j ) { mView->editJournal( j); return true; }
648}; 648};
649 649
650class DeleteIncidenceVisitor : public CalendarViewVisitor 650class DeleteIncidenceVisitor : public CalendarViewVisitor
651{ 651{
652 protected: 652 protected:
653 bool visit( Event *event ) { mView->deleteEvent( event ); return true; } 653 bool visit( Event *event ) { mView->deleteEvent( event ); return true; }
654 bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } 654 bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; }
655 bool visit( Journal * j) {mView->deleteJournal( j ); return true; } 655 bool visit( Journal * j) {mView->deleteJournal( j ); return true; }
656}; 656};
657 657
658#endif 658#endif
diff --git a/korganizer/kodialogmanager.cpp b/korganizer/kodialogmanager.cpp
index 5455098..ea30fac 100644
--- a/korganizer/kodialogmanager.cpp
+++ b/korganizer/kodialogmanager.cpp
@@ -1,356 +1,352 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Copyright (c) 2001 4 Copyright (c) 2001
5 Cornelius Schumacher <schumacher@kde.org> 5 Cornelius Schumacher <schumacher@kde.org>
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or 9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20*/ 20*/
21 21
22#include <libkdepim/categoryeditdialog.h> 22#include <libkdepim/categoryeditdialog.h>
23 23
24#include "calendarview.h" 24#include "calendarview.h"
25#include "incomingdialog.h" 25#include "incomingdialog.h"
26#include "outgoingdialog.h" 26#include "outgoingdialog.h"
27#include "koprefsdialog.h" 27#include "koprefsdialog.h"
28#include "koeventeditor.h" 28#include "koeventeditor.h"
29#include "koprefs.h" 29#include "koprefs.h"
30#include "datenavigator.h" 30#include "datenavigator.h"
31#include "kotodoeditor.h" 31#include "kotodoeditor.h"
32#include "searchdialog.h" 32#include "searchdialog.h"
33#include "filtereditdialog.h" 33#include "filtereditdialog.h"
34#ifndef KORG_NOPLUGINS 34#ifndef KORG_NOPLUGINS
35#include "plugindialog.h" 35#include "plugindialog.h"
36#endif 36#endif
37#ifndef KORG_NOARCHIVE 37#ifndef KORG_NOARCHIVE
38#include "archivedialog.h" 38#include "archivedialog.h"
39#endif 39#endif
40 40
41#include "kconfig.h" 41#include "kconfig.h"
42#include "kodialogmanager.h" 42#include "kodialogmanager.h"
43#include <kapplication.h> 43#include <kapplication.h>
44 44
45KODialogManager::KODialogManager( CalendarView *mainView ) : 45KODialogManager::KODialogManager( CalendarView *mainView ) :
46 QObject(), mMainView( mainView ) 46 QObject(), mMainView( mainView )
47{ 47{
48 mOutgoingDialog = 0; 48 mOutgoingDialog = 0;
49 mIncomingDialog = 0; 49 mIncomingDialog = 0;
50 mOptionsDialog = 0; 50 mOptionsDialog = 0;
51 mSearchDialog = 0; 51 mSearchDialog = 0;
52 mArchiveDialog = 0; 52 mArchiveDialog = 0;
53 mFilterEditDialog = 0; 53 mFilterEditDialog = 0;
54 mPluginDialog = 0; 54 mPluginDialog = 0;
55 55
56 // mCategoryEditDialog = new KPIM::CategoryEditDialog(KOPrefs::instance(),mMainView); 56 // mCategoryEditDialog = new KPIM::CategoryEditDialog(KOPrefs::instance(),mMainView);
57 //KOGlobals::fitDialogToScreen( mCategoryEditDialog ); 57 //KOGlobals::fitDialogToScreen( mCategoryEditDialog );
58} 58}
59 59
60KODialogManager::~KODialogManager() 60KODialogManager::~KODialogManager()
61{ 61{
62 delete mOutgoingDialog; 62 delete mOutgoingDialog;
63 delete mIncomingDialog; 63 delete mIncomingDialog;
64 delete mOptionsDialog; 64 delete mOptionsDialog;
65 delete mSearchDialog; 65 delete mSearchDialog;
66#ifndef KORG_NOARCHIVE 66#ifndef KORG_NOARCHIVE
67 delete mArchiveDialog; 67 delete mArchiveDialog;
68#endif 68#endif
69 delete mFilterEditDialog; 69 delete mFilterEditDialog;
70#ifndef KORG_NOPLUGINS 70#ifndef KORG_NOPLUGINS
71 delete mPluginDialog; 71 delete mPluginDialog;
72#endif 72#endif
73} 73}
74 74
75OutgoingDialog *KODialogManager::outgoingDialog() 75OutgoingDialog *KODialogManager::outgoingDialog()
76{ 76{
77 createOutgoingDialog(); 77 createOutgoingDialog();
78 return mOutgoingDialog; 78 return mOutgoingDialog;
79} 79}
80 80
81void KODialogManager::createOutgoingDialog() 81void KODialogManager::createOutgoingDialog()
82{ 82{
83 if (!mOutgoingDialog) { 83 if (!mOutgoingDialog) {
84 mOutgoingDialog = new OutgoingDialog(mMainView->calendar(),mMainView); 84 mOutgoingDialog = new OutgoingDialog(mMainView->calendar(),mMainView);
85 if (mIncomingDialog) mIncomingDialog->setOutgoingDialog(mOutgoingDialog); 85 if (mIncomingDialog) mIncomingDialog->setOutgoingDialog(mOutgoingDialog);
86 connect(mOutgoingDialog,SIGNAL(numMessagesChanged(int)), 86 connect(mOutgoingDialog,SIGNAL(numMessagesChanged(int)),
87 mMainView,SIGNAL(numOutgoingChanged(int))); 87 mMainView,SIGNAL(numOutgoingChanged(int)));
88 } 88 }
89} 89}
90 90
91void KODialogManager::showGlobalOptionsDialog( bool showSync ) 91void KODialogManager::showGlobalOptionsDialog( bool showSync )
92{ 92{
93 KPimPrefsGlobalDialog gc ( mMainView ); 93 KPimPrefsGlobalDialog gc ( mMainView );
94 if ( showSync ) 94 if ( showSync )
95 gc.showTZconfig(); 95 gc.showTZconfig();
96 gc.exec(); 96 gc.exec();
97} 97}
98void KODialogManager::showOptionsDialog( bool showSync ) 98void KODialogManager::showOptionsDialog( bool showSync )
99{ 99{
100 100
101 if (!mOptionsDialog) { 101 if (!mOptionsDialog) {
102 mOptionsDialog = new KOPrefsDialog(mMainView); 102 mOptionsDialog = new KOPrefsDialog(mMainView);
103 connect(mOptionsDialog,SIGNAL(configChanged()), 103 connect(mOptionsDialog,SIGNAL(configChanged()),
104 mMainView,SLOT(updateConfig())); 104 mMainView,SLOT(updateConfig()));
105 } 105 }
106 mOptionsDialog->readConfig(); 106 mOptionsDialog->readConfig();
107#ifndef DESKTOP_VERSION 107#ifndef DESKTOP_VERSION
108 mOptionsDialog->hideButtons(); 108 mOptionsDialog->hideButtons();
109 mOptionsDialog->showMaximized(); 109 mOptionsDialog->showMaximized();
110#else 110#else
111 mOptionsDialog->show(); 111 mOptionsDialog->show();
112#endif 112#endif
113 113
114 mOptionsDialog->exec(); 114 mOptionsDialog->exec();
115 delete mOptionsDialog; 115 delete mOptionsDialog;
116 mOptionsDialog = 0; 116 mOptionsDialog = 0;
117} 117}
118void KODialogManager::showSyncOptions() 118void KODialogManager::showSyncOptions()
119{ 119{
120 showGlobalOptionsDialog( true ); 120 showGlobalOptionsDialog( true );
121 121
122} 122}
123void KODialogManager::showOutgoingDialog() 123void KODialogManager::showOutgoingDialog()
124{ 124{
125 createOutgoingDialog(); 125 createOutgoingDialog();
126 mOutgoingDialog->show(); 126 mOutgoingDialog->show();
127 mOutgoingDialog->raise(); 127 mOutgoingDialog->raise();
128} 128}
129 129
130IncomingDialog *KODialogManager::incomingDialog() 130IncomingDialog *KODialogManager::incomingDialog()
131{ 131{
132 createOutgoingDialog(); 132 createOutgoingDialog();
133 if (!mIncomingDialog) { 133 if (!mIncomingDialog) {
134 mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView); 134 mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView);
135 connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)), 135 connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)),
136 mMainView,SIGNAL(numIncomingChanged(int))); 136 mMainView,SIGNAL(numIncomingChanged(int)));
137 connect(mIncomingDialog,SIGNAL(calendarUpdated()), 137 connect(mIncomingDialog,SIGNAL(calendarUpdated()),
138 mMainView,SLOT(updateView())); 138 mMainView,SLOT(updateView()));
139 } 139 }
140 return mIncomingDialog; 140 return mIncomingDialog;
141} 141}
142 142
143void KODialogManager::createIncomingDialog() 143void KODialogManager::createIncomingDialog()
144{ 144{
145 createOutgoingDialog(); 145 createOutgoingDialog();
146 if (!mIncomingDialog) { 146 if (!mIncomingDialog) {
147 mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView); 147 mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView);
148 connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)), 148 connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)),
149 mMainView,SIGNAL(numIncomingChanged(int))); 149 mMainView,SIGNAL(numIncomingChanged(int)));
150 connect(mIncomingDialog,SIGNAL(calendarUpdated()), 150 connect(mIncomingDialog,SIGNAL(calendarUpdated()),
151 mMainView,SLOT(updateView())); 151 mMainView,SLOT(updateView()));
152 } 152 }
153} 153}
154 154
155void KODialogManager::showIncomingDialog() 155void KODialogManager::showIncomingDialog()
156{ 156{
157 createIncomingDialog(); 157 createIncomingDialog();
158 mIncomingDialog->show(); 158 mIncomingDialog->show();
159 mIncomingDialog->raise(); 159 mIncomingDialog->raise();
160} 160}
161/* 161/*
162void KODialogManager::showCategoryEditDialog() 162void KODialogManager::showCategoryEditDialog()
163{ 163{
164 mCategoryEditDialog->show(); 164 mCategoryEditDialog->show();
165} 165}
166*/ 166*/
167void KODialogManager::hideSearchDialog() 167void KODialogManager::hideSearchDialog()
168{ 168{
169 if (mSearchDialog) 169 if (mSearchDialog)
170 mSearchDialog->hide(); 170 mSearchDialog->hide();
171} 171}
172 172
173void KODialogManager::showSearchDialog() 173void KODialogManager::showSearchDialog()
174{ 174{
175 if (!mSearchDialog) { 175 if (!mSearchDialog) {
176 mSearchDialog = new SearchDialog(mMainView->calendar(),mMainView); 176 mSearchDialog = new SearchDialog(mMainView->calendar(),mMainView);
177 KOListView * lview = mSearchDialog->listview(); 177 KOListView * lview = mSearchDialog->listview();
178 178
179 connect(lview, SIGNAL(showIncidenceSignal(Incidence *)), 179 connect(lview, SIGNAL(showIncidenceSignal(Incidence *)),
180 mMainView, SLOT(showIncidence(Incidence *))); 180 mMainView, SLOT(showIncidence(Incidence *)));
181 connect(lview, SIGNAL(editIncidenceSignal(Incidence *)), 181 connect(lview, SIGNAL(editIncidenceSignal(Incidence *)),
182 mMainView, SLOT(editIncidence(Incidence *))); 182 mMainView, SLOT(editIncidence(Incidence *)));
183 connect(lview, SIGNAL(deleteIncidenceSignal(Incidence *)), 183 connect(lview, SIGNAL(deleteIncidenceSignal(Incidence *)),
184 mMainView, SLOT(deleteIncidence(Incidence *))); 184 mMainView, SLOT(deleteIncidence(Incidence *)));
185 connect(lview, SIGNAL(cloneIncidenceSignal(Incidence *)), 185 connect(lview, SIGNAL(cloneIncidenceSignal(Incidence *)),
186 mMainView, SLOT(cloneIncidence(Incidence *))); 186 mMainView, SLOT(cloneIncidence(Incidence *)));
187 connect(lview, SIGNAL(beamIncidenceSignal(Incidence *)), 187 connect(lview, SIGNAL(beamIncidenceSignal(Incidence *)),
188 mMainView, SLOT(beamIncidence(Incidence *))); 188 mMainView, SLOT(beamIncidence(Incidence *)));
189 connect(lview, SIGNAL(moveIncidenceSignal(Incidence *)), 189 connect(lview, SIGNAL(moveIncidenceSignal(Incidence *)),
190 mMainView, SLOT(moveIncidence(Incidence *))); 190 mMainView, SLOT(moveIncidence(Incidence *)));
191 connect(lview, SIGNAL(beamIncidenceList(QPtrList<Incidence> )), 191 connect(lview, SIGNAL(beamIncidenceList(QPtrList<Incidence> )),
192 mMainView, SLOT(beamIncidenceList(QPtrList<Incidence> ))); 192 mMainView, SLOT(beamIncidenceList(QPtrList<Incidence> )));
193 193
194 connect(mMainView, SIGNAL(configChanged()), mSearchDialog, SLOT(updateConfig())); 194 connect(mMainView, SIGNAL(configChanged()), mSearchDialog, SLOT(updateConfig()));
195 connect(mMainView, SIGNAL(updateSearchDialog()), mSearchDialog, SLOT(updateList())); 195 connect(mMainView, SIGNAL(updateSearchDialog()), mSearchDialog, SLOT(updateList()));
196 // connect( lview, SIGNAL( incidenceSelected( Incidence * ) ), 196 // connect( lview, SIGNAL( incidenceSelected( Incidence * ) ),
197 // mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 197 // mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
198#ifndef DESKTOP_VERSION 198#ifndef DESKTOP_VERSION
199 mSearchDialog->setMaximumSize( QApplication::desktop()->size()); 199 mSearchDialog->setMaximumSize( QApplication::desktop()->size());
200 mSearchDialog->showMaximized(); 200 mSearchDialog->showMaximized();
201#else 201#else
202 KConfig *config = KOGlobals::config(); 202 KConfig *config = KOGlobals::config();
203 config->setGroup("WidgetLayout"); 203 config->setGroup("WidgetLayout");
204 QStringList list; 204 QStringList list;
205 list = config->readListEntry("SearchLayout"); 205 list = config->readListEntry("SearchLayout");
206 int x,y,w,h; 206 int x,y,w,h;
207 if ( ! list.isEmpty() ) { 207 if ( ! list.isEmpty() ) {
208 x = list[0].toInt(); 208 x = list[0].toInt();
209 y = list[1].toInt(); 209 y = list[1].toInt();
210 w = list[2].toInt(); 210 w = list[2].toInt();
211 h = list[3].toInt(); 211 h = list[3].toInt();
212 KApplication::testCoords( &x,&y,&w,&h ); 212 KApplication::testCoords( &x,&y,&w,&h );
213 mSearchDialog->setGeometry(x,y,w,h); 213 mSearchDialog->setGeometry(x,y,w,h);
214 214
215 } 215 }
216 216
217#endif 217#endif
218 } 218 }
219 // make sure the widget is on top again 219 // make sure the widget is on top again
220#ifdef DESKTOP_VERSION 220#ifdef DESKTOP_VERSION
221 mSearchDialog->show(); 221 mSearchDialog->show();
222#else 222#else
223 mSearchDialog->setMaximumSize( QApplication::desktop()->size()); 223 mSearchDialog->setMaximumSize( QApplication::desktop()->size());
224 mSearchDialog->showMaximized(); 224 mSearchDialog->showMaximized();
225#endif 225#endif
226 mSearchDialog->raiseAndSelect(); 226 mSearchDialog->raiseAndSelect();
227} 227}
228 228
229SearchDialog * KODialogManager::getSearchDialog() 229SearchDialog * KODialogManager::getSearchDialog()
230{ 230{
231 return mSearchDialog; 231 return mSearchDialog;
232} 232}
233void KODialogManager::showArchiveDialog() 233void KODialogManager::showArchiveDialog()
234{ 234{
235#ifndef KORG_NOARCHIVE 235#ifndef KORG_NOARCHIVE
236 if (!mArchiveDialog) { 236 if (!mArchiveDialog) {
237 mArchiveDialog = new ArchiveDialog(mMainView->calendar(),mMainView); 237 mArchiveDialog = new ArchiveDialog(mMainView->calendar(),mMainView);
238 connect(mArchiveDialog,SIGNAL(eventsDeleted()), 238 connect(mArchiveDialog,SIGNAL(eventsDeleted()),
239 mMainView,SLOT(updateView())); 239 mMainView,SLOT(updateView()));
240 } 240 }
241 mArchiveDialog->show(); 241 mArchiveDialog->show();
242 mArchiveDialog->raise(); 242 mArchiveDialog->raise();
243 243
244 // Workaround. 244 // Workaround.
245 QApplication::restoreOverrideCursor(); 245 QApplication::restoreOverrideCursor();
246#endif 246#endif
247} 247}
248 248
249void KODialogManager::showFilterEditDialog(QPtrList<CalFilter> *filters) 249void KODialogManager::showFilterEditDialog(QPtrList<CalFilter> *filters)
250{ 250{
251 if (!mFilterEditDialog) { 251 if (!mFilterEditDialog) {
252 mFilterEditDialog = new FilterEditDialog(filters,mMainView); 252 mFilterEditDialog = new FilterEditDialog(filters,mMainView);
253 connect(mFilterEditDialog,SIGNAL(filterChanged()), 253 connect(mFilterEditDialog,SIGNAL(filterChanged()),
254 mMainView,SLOT(filterEdited())); 254 mMainView,SLOT(filterEdited()));
255 255
256 } 256 }
257 257
258#ifndef DESKTOP_VERSION 258#ifndef DESKTOP_VERSION
259 mFilterEditDialog->showMaximized(); 259 mFilterEditDialog->showMaximized();
260#else 260#else
261 mFilterEditDialog->show(); 261 mFilterEditDialog->show();
262#endif 262#endif
263 mFilterEditDialog->raise(); 263 mFilterEditDialog->raise();
264} 264}
265 265
266void KODialogManager::showPluginDialog() 266void KODialogManager::showPluginDialog()
267{ 267{
268#ifndef KORG_NOPLUGINS 268#ifndef KORG_NOPLUGINS
269 if (!mPluginDialog) { 269 if (!mPluginDialog) {
270 mPluginDialog = new PluginDialog(mMainView); 270 mPluginDialog = new PluginDialog(mMainView);
271 connect(mPluginDialog,SIGNAL(configChanged()), 271 connect(mPluginDialog,SIGNAL(configChanged()),
272 mMainView,SLOT(updateConfig())); 272 mMainView,SLOT(updateConfig()));
273 } 273 }
274 mPluginDialog->show(); 274 mPluginDialog->show();
275 mPluginDialog->raise(); 275 mPluginDialog->raise();
276#endif 276#endif
277} 277}
278 278
279KOEventEditor *KODialogManager::getEventEditor() 279KOEventEditor *KODialogManager::getEventEditor()
280{ 280{
281 KOEventEditor *eventEditor = new KOEventEditor( mMainView->calendar(), 281 KOEventEditor *eventEditor = new KOEventEditor( mMainView->calendar(),
282 mMainView ); 282 mMainView );
283 283
284 connect(eventEditor,SIGNAL(eventAdded(Event *)), 284 connect(eventEditor,SIGNAL(eventAdded(Event *)),
285 mMainView,SLOT(eventAdded(Event *))); 285 mMainView,SLOT(eventAdded(Event *)));
286 connect(eventEditor,SIGNAL(eventChanged(Event *)), 286 connect(eventEditor,SIGNAL(eventChanged(Event *)),
287 mMainView,SLOT(eventChanged(Event *))); 287 mMainView,SLOT(eventChanged(Event *)));
288 connect(eventEditor,SIGNAL(eventDeleted()), 288 connect(eventEditor,SIGNAL(eventDeleted()),
289 mMainView,SLOT(eventDeleted())); 289 mMainView,SLOT(eventDeleted()));
290 connect(eventEditor,SIGNAL(deleteAttendee(Incidence *)), 290 connect(eventEditor,SIGNAL(deleteAttendee(Incidence *)),
291 mMainView,SLOT(schedule_cancel(Incidence *))); 291 mMainView,SLOT(schedule_cancel(Incidence *)));
292 connect( eventEditor, SIGNAL(jumpToTime( const QDate &)), 292 connect( eventEditor, SIGNAL(jumpToTime( const QDate &)),
293 mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 293 mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
294 connect( eventEditor, SIGNAL( showAgendaView( bool)), 294 connect( eventEditor, SIGNAL( showAgendaView( bool)),
295 mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); 295 mMainView->viewManager(), SLOT( showAgendaView( bool) ) );
296 296
297 // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), 297 // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()),
298 // eventEditor,SLOT(updateCategoryConfig())); 298 // eventEditor,SLOT(updateCategoryConfig()));
299 // connect(eventEditor,SIGNAL(editCategories()), 299 // connect(eventEditor,SIGNAL(editCategories()),
300 // mCategoryEditDialog,SLOT(show())); 300 // mCategoryEditDialog,SLOT(show()));
301 connect(eventEditor,SIGNAL(dialogClose(Incidence*)),
302 mMainView,SLOT(dialogClosing(Incidence*)));
303 301
304 //connect(mMainView,SIGNAL(closingDown()),eventEditor,SLOT(reject())); 302 //connect(mMainView,SIGNAL(closingDown()),eventEditor,SLOT(reject()));
305 303
306#ifndef DESKTOP_VERSION 304#ifndef DESKTOP_VERSION
307 eventEditor->resize( QApplication::desktop()->width() -20, 100 ); 305 eventEditor->resize( QApplication::desktop()->width() -20, 100 );
308#endif 306#endif
309 return eventEditor; 307 return eventEditor;
310} 308}
311 309
312KOTodoEditor *KODialogManager::getTodoEditor() 310KOTodoEditor *KODialogManager::getTodoEditor()
313{ 311{
314 KOTodoEditor *todoEditor = new KOTodoEditor( mMainView->calendar(), 312 KOTodoEditor *todoEditor = new KOTodoEditor( mMainView->calendar(),
315 mMainView ); 313 mMainView );
316 314
317 // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), 315 // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()),
318 // todoEditor,SLOT(updateCategoryConfig())); 316 // todoEditor,SLOT(updateCategoryConfig()));
319 // connect(todoEditor,SIGNAL(editCategories()),mCategoryEditDialog,SLOT(show())); 317 // connect(todoEditor,SIGNAL(editCategories()),mCategoryEditDialog,SLOT(show()));
320 318
321 connect(todoEditor,SIGNAL(todoAdded(Todo *)), 319 connect(todoEditor,SIGNAL(todoAdded(Todo *)),
322 mMainView,SLOT(todoAdded(Todo *))); 320 mMainView,SLOT(todoAdded(Todo *)));
323 connect(todoEditor,SIGNAL(todoChanged(Todo *)), 321 connect(todoEditor,SIGNAL(todoChanged(Todo *)),
324 mMainView,SLOT(todoChanged(Todo *))); 322 mMainView,SLOT(todoChanged(Todo *)));
325 connect(todoEditor,SIGNAL(todoDeleted()), 323 connect(todoEditor,SIGNAL(todoDeleted()),
326 mMainView,SLOT(todoDeleted())); 324 mMainView,SLOT(todoDeleted()));
327 connect(todoEditor,SIGNAL(dialogClose(Incidence*)),
328 mMainView,SLOT(dialogClosing(Incidence*)));
329 connect( todoEditor, SIGNAL(jumpToTime( const QDate &)), 325 connect( todoEditor, SIGNAL(jumpToTime( const QDate &)),
330 mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 326 mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
331 connect( todoEditor, SIGNAL( showAgendaView( bool)), 327 connect( todoEditor, SIGNAL( showAgendaView( bool)),
332 mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); 328 mMainView->viewManager(), SLOT( showAgendaView( bool) ) );
333 // connect(todoEditor,SIGNAL(deleteAttendee(Incidence *)), 329 // connect(todoEditor,SIGNAL(deleteAttendee(Incidence *)),
334 // mMainView,SLOT(schedule_cancel(Incidence *))); 330 // mMainView,SLOT(schedule_cancel(Incidence *)));
335 //connect(mMainView,SIGNAL(closingDown()),todoEditor,SLOT(reject())); 331 //connect(mMainView,SIGNAL(closingDown()),todoEditor,SLOT(reject()));
336#ifndef DESKTOP_VERSION 332#ifndef DESKTOP_VERSION
337 todoEditor->resize( QApplication::desktop()->width() -20, 100 ); 333 todoEditor->resize( QApplication::desktop()->width() -20, 100 );
338#endif 334#endif
339 return todoEditor; 335 return todoEditor;
340} 336}
341 337
342void KODialogManager::updateSearchDialog() 338void KODialogManager::updateSearchDialog()
343{ 339{
344 if (mSearchDialog) mSearchDialog->updateView(); 340 if (mSearchDialog) mSearchDialog->updateView();
345} 341}
346 342
347void KODialogManager::setDocumentId( const QString &id ) 343void KODialogManager::setDocumentId( const QString &id )
348{ 344{
349 if (mOutgoingDialog) mOutgoingDialog->setDocumentId( id ); 345 if (mOutgoingDialog) mOutgoingDialog->setDocumentId( id );
350} 346}
351 347
352void KODialogManager::writeSettings( KConfig *config ) 348void KODialogManager::writeSettings( KConfig *config )
353{ 349{
354 if (mSearchDialog) 350 if (mSearchDialog)
355 mSearchDialog->listview()->writeSettings(config,"SearchListView Layout"); 351 mSearchDialog->listview()->writeSettings(config,"SearchListView Layout");
356} 352}
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 517677c..e5e3704 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -1,954 +1,955 @@
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#include <qpainter.h> 37#include <qpainter.h>
38#include <qpaintdevicemetrics.h> 38#include <qpaintdevicemetrics.h>
39 39
40#include <klocale.h> 40#include <klocale.h>
41#include <kdebug.h> 41#include <kdebug.h>
42#include <kiconloader.h> 42#include <kiconloader.h>
43#include <kglobal.h> 43#include <kglobal.h>
44 44
45#include <libkdepim/kpimglobalprefs.h> 45#include <libkdepim/kpimglobalprefs.h>
46#include <libkcal/calendar.h> 46#include <libkcal/calendar.h>
47#include <libkcal/calendarlocal.h> 47#include <libkcal/calendarlocal.h>
48#include <libkcal/icalformat.h> 48#include <libkcal/icalformat.h>
49#include <libkcal/vcalformat.h> 49#include <libkcal/vcalformat.h>
50#include <libkcal/recurrence.h> 50#include <libkcal/recurrence.h>
51#include <libkcal/filestorage.h> 51#include <libkcal/filestorage.h>
52#include <libkdepim/categoryselectdialog.h> 52#include <libkdepim/categoryselectdialog.h>
53#include <libkcal/kincidenceformatter.h> 53#include <libkcal/kincidenceformatter.h>
54#ifndef DESKTOP_VERSION 54#ifndef DESKTOP_VERSION
55#include <qpe/qpeapplication.h> 55#include <qpe/qpeapplication.h>
56#else 56#else
57#include <qapplication.h> 57#include <qapplication.h>
58#endif 58#endif
59 59
60#ifndef KORG_NOPRINTER 60#ifndef KORG_NOPRINTER
61#include "calprinter.h" 61#include "calprinter.h"
62#endif 62#endif
63#include "koglobals.h" 63#include "koglobals.h"
64#include "koprefs.h" 64#include "koprefs.h"
65#include "kfiledialog.h" 65#include "kfiledialog.h"
66 66
67#include "kolistview.h" 67#include "kolistview.h"
68#include "koeventviewer.h" 68#include "koeventviewer.h"
69 69
70extern QPixmap* sgListViewCompletedPix[6]; 70extern QPixmap* sgListViewCompletedPix[6];
71 71
72class KOListViewWhatsThis :public QWhatsThis 72class KOListViewWhatsThis :public QWhatsThis
73{ 73{
74public: 74public:
75 KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; 75 KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { };
76 76
77protected: 77protected:
78 virtual QString text( const QPoint& p) 78 virtual QString text( const QPoint& p)
79 { 79 {
80 return _view->getWhatsThisText(p) ; 80 return _view->getWhatsThisText(p) ;
81 } 81 }
82private: 82private:
83 QWidget* _wid; 83 QWidget* _wid;
84 KOListView * _view; 84 KOListView * _view;
85}; 85};
86 86
87 87
88ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) 88ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date )
89{ 89{
90 mItem = item; 90 mItem = item;
91 mDate = date; 91 mDate = date;
92} 92}
93 93
94ListItemVisitor::~ListItemVisitor() 94ListItemVisitor::~ListItemVisitor()
95{ 95{
96} 96}
97 97
98bool ListItemVisitor::visit(Event *e) 98bool ListItemVisitor::visit(Event *e)
99{ 99{
100 bool ok = false; 100 bool ok = false;
101 QString start, end; 101 QString start, end;
102 QDate ds, de; 102 QDate ds, de;
103 if ( e->doesRecur() ) { 103 if ( e->doesRecur() ) {
104 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); 104 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date();
105 if ( ok ) { 105 if ( ok ) {
106 int days = e->dtStart().date().daysTo(e->dtEnd().date() ); 106 int days = e->dtStart().date().daysTo(e->dtEnd().date() );
107 start = KGlobal::locale()->formatDate(ds,true); 107 start = KGlobal::locale()->formatDate(ds,true);
108 de = ds.addDays( days); 108 de = ds.addDays( days);
109 end = KGlobal::locale()->formatDate(de,true); 109 end = KGlobal::locale()->formatDate(de,true);
110 } 110 }
111 111
112 } 112 }
113 if ( ! ok ) { 113 if ( ! ok ) {
114 start =e->dtStartDateStr(); 114 start =e->dtStartDateStr();
115 end = e->dtEndDateStr(); 115 end = e->dtEndDateStr();
116 ds = e->dtStart().date(); 116 ds = e->dtStart().date();
117 de = e->dtEnd().date(); 117 de = e->dtEnd().date();
118 } 118 }
119 mItem->setText(0,e->summary()); 119 mItem->setText(0,e->summary());
120 mItem->setText(1,start); 120 mItem->setText(1,start);
121 if ( e->doesFloat() ) 121 if ( e->doesFloat() )
122 mItem->setText(2,"---"); 122 mItem->setText(2,"---");
123 else 123 else
124 mItem->setText(2,e->dtStartTimeStr()); 124 mItem->setText(2,e->dtStartTimeStr());
125 mItem->setText(3,end); 125 mItem->setText(3,end);
126 if ( e->doesFloat() ) 126 if ( e->doesFloat() )
127 mItem->setText(4,"---"); 127 mItem->setText(4,"---");
128 else 128 else
129 mItem->setText(4,e->dtEndTimeStr()); 129 mItem->setText(4,e->dtEndTimeStr());
130 if ( e->isAlarmEnabled() ) { 130 if ( e->isAlarmEnabled() ) {
131 mItem->setText(5,e->alarms().first()->offsetText() ); 131 mItem->setText(5,e->alarms().first()->offsetText() );
132 } else { 132 } else {
133 mItem->setText(5, i18n("No")); 133 mItem->setText(5, i18n("No"));
134 } 134 }
135 mItem->setText(6, e->recurrence()->recurrenceText()); 135 mItem->setText(6, e->recurrence()->recurrenceText());
136 if( ! e->doesRecur() ) 136 if( ! e->doesRecur() )
137 mItem->setSortKey( 6, "-" ); 137 mItem->setSortKey( 6, "-" );
138 mItem->setText(7,"---"); 138 mItem->setText(7,"---");
139 mItem->setText(8,"---"); 139 mItem->setText(8,"---");
140 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); 140 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No"));
141 mItem->setText(10,e->categoriesStr()); 141 mItem->setText(10,e->categoriesStr());
142 mItem->setText(11, KOPrefs::instance()->calName( e->calID() )); 142 mItem->setText(11, KOPrefs::instance()->calName( e->calID() ));
143 143
144 QString key; 144 QString key;
145 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); 145 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time();
146 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); 146 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute());
147 mItem->setSortKey(1,key); 147 mItem->setSortKey(1,key);
148 148
149 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); 149 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time();
150 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); 150 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute());
151 mItem->setSortKey(3,key); 151 mItem->setSortKey(3,key);
152 return true; 152 return true;
153} 153}
154 154
155bool ListItemVisitor::visit(Todo *t) 155bool ListItemVisitor::visit(Todo *t)
156{ 156{
157 mItem->setText(0,t->summary()); 157 mItem->setText(0,t->summary());
158 if ( t->isCompleted() ) { 158 if ( t->isCompleted() ) {
159 mItem->setSortKey(0,"99"+ t->summary().left(10)); 159 mItem->setSortKey(0,"99"+ t->summary().left(10));
160 } else 160 } else
161 mItem->setSortKey(0,QString::number( t->percentComplete() )+ t->summary().left(10)); 161 mItem->setSortKey(0,QString::number( t->percentComplete() )+ t->summary().left(10));
162 mItem->setPixmap( 0, *(sgListViewCompletedPix[t->percentComplete()/20])); 162 mItem->setPixmap( 0, *(sgListViewCompletedPix[t->percentComplete()/20]));
163 if (t->hasStartDate()) { 163 if (t->hasStartDate()) {
164 mItem->setText(1,t->dtStartDateStr()); 164 mItem->setText(1,t->dtStartDateStr());
165 if (t->doesFloat()) { 165 if (t->doesFloat()) {
166 mItem->setText(2,"---"); 166 mItem->setText(2,"---");
167 } else { 167 } else {
168 mItem->setText(2,t->dtStartTimeStr()); 168 mItem->setText(2,t->dtStartTimeStr());
169 } 169 }
170 } else { 170 } else {
171 mItem->setText(1,"---"); 171 mItem->setText(1,"---");
172 mItem->setText(2,"---"); 172 mItem->setText(2,"---");
173 } 173 }
174 mItem->setText(3,"---"); 174 mItem->setText(3,"---");
175 mItem->setText(4,"---"); 175 mItem->setText(4,"---");
176 if ( t->isAlarmEnabled() ) { 176 if ( t->isAlarmEnabled() ) {
177 mItem->setText(5,t->alarms().first()->offsetText() ); 177 mItem->setText(5,t->alarms().first()->offsetText() );
178 } else { 178 } else {
179 mItem->setText(5, i18n("No")); 179 mItem->setText(5, i18n("No"));
180 } 180 }
181 mItem->setText(6, t->recurrence()->recurrenceText()); 181 mItem->setText(6, t->recurrence()->recurrenceText());
182 if( ! t->doesRecur() ) 182 if( ! t->doesRecur() )
183 mItem->setSortKey( 6, "-" ); 183 mItem->setSortKey( 6, "-" );
184 if (t->hasDueDate()) { 184 if (t->hasDueDate()) {
185 mItem->setText(7,t->dtDueDateStr()); 185 mItem->setText(7,t->dtDueDateStr());
186 if (t->doesFloat()) { 186 if (t->doesFloat()) {
187 mItem->setText(8,"---"); 187 mItem->setText(8,"---");
188 } else { 188 } else {
189 mItem->setText(8,t->dtDueTimeStr()); 189 mItem->setText(8,t->dtDueTimeStr());
190 } 190 }
191 } else { 191 } else {
192 mItem->setText(7,"---"); 192 mItem->setText(7,"---");
193 mItem->setText(8,"---"); 193 mItem->setText(8,"---");
194 } 194 }
195 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); 195 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No"));
196 mItem->setText(10,t->categoriesStr()); 196 mItem->setText(10,t->categoriesStr());
197 mItem->setText(11, KOPrefs::instance()->calName( t->calID() )); 197 mItem->setText(11, KOPrefs::instance()->calName( t->calID() ));
198 198
199 QString key; 199 QString key;
200 QDate d; 200 QDate d;
201 if (t->hasDueDate()) { 201 if (t->hasDueDate()) {
202 d = t->dtDue().date(); 202 d = t->dtDue().date();
203 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); 203 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time();
204 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 204 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
205 mItem->setSortKey(7,key); 205 mItem->setSortKey(7,key);
206 } 206 }
207 if ( t->hasStartDate() ) { 207 if ( t->hasStartDate() ) {
208 d = t->dtStart().date(); 208 d = t->dtStart().date();
209 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); 209 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time();
210 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 210 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
211 mItem->setSortKey(1,key); 211 mItem->setSortKey(1,key);
212 } 212 }
213 return true; 213 return true;
214} 214}
215 215
216bool ListItemVisitor::visit(Journal * j) 216bool ListItemVisitor::visit(Journal * j)
217{ 217{
218 218
219 QString des; 219 QString des;
220 if ( !j->summary().isEmpty() ) { 220 if ( !j->summary().isEmpty() ) {
221 des = j->summary(); 221 des = j->summary();
222 } else { 222 } else {
223 des = j->description().left(30); 223 des = j->description().left(30);
224 des = des.simplifyWhiteSpace (); 224 des = des.simplifyWhiteSpace ();
225 des.replace (QRegExp ("\\n"),"" ); 225 des.replace (QRegExp ("\\n"),"" );
226 des.replace (QRegExp ("\\r"),"" ); 226 des.replace (QRegExp ("\\r"),"" );
227 } 227 }
228 mItem->setText(0,i18n("Journal: ")+des.left(25)); 228 mItem->setText(0,i18n("Journal: ")+des.left(25));
229 mItem->setText(1,j->dtStartDateStr()); 229 mItem->setText(1,j->dtStartDateStr());
230 mItem->setText(2,"---"); 230 mItem->setText(2,"---");
231 mItem->setText(3,"---"); 231 mItem->setText(3,"---");
232 mItem->setText(4,"---"); 232 mItem->setText(4,"---");
233 mItem->setText(5,"---"); 233 mItem->setText(5,"---");
234 mItem->setText(6,"---"); 234 mItem->setText(6,"---");
235 mItem->setText(7,j->dtStartDateStr()); 235 mItem->setText(7,j->dtStartDateStr());
236 mItem->setText(8,"---"); 236 mItem->setText(8,"---");
237 mItem->setText(9,"---"); 237 mItem->setText(9,"---");
238 mItem->setText(10,j->categoriesStr()); 238 mItem->setText(10,j->categoriesStr());
239 mItem->setText(11, KOPrefs::instance()->calName( j->calID() )); 239 mItem->setText(11, KOPrefs::instance()->calName( j->calID() ));
240 240
241 QString key; 241 QString key;
242 QDate d = j->dtStart().date(); 242 QDate d = j->dtStart().date();
243 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 243 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
244 mItem->setSortKey(1,key); 244 mItem->setSortKey(1,key);
245 mItem->setSortKey(7,key); 245 mItem->setSortKey(7,key);
246 246
247 return true; 247 return true;
248} 248}
249 249
250KOListView::KOListView(Calendar *calendar, QWidget *parent, 250KOListView::KOListView(Calendar *calendar, QWidget *parent,
251 const char *name) 251 const char *name)
252 : KOEventView(calendar, parent, name) 252 : KOEventView(calendar, parent, name)
253{ 253{
254 254
255 mActiveItem = 0; 255 mActiveItem = 0;
256 mForceShowCompletedTodos = false; 256 mForceShowCompletedTodos = false;
257 mListView = new KOListViewListView(this); 257 mListView = new KOListViewListView(this);
258 mListView->addColumn(i18n("Summary")); 258 mListView->addColumn(i18n("Summary"));
259 mListView->addColumn(i18n("Start Date")); 259 mListView->addColumn(i18n("Start Date"));
260 mListView->addColumn(i18n("Start Time")); 260 mListView->addColumn(i18n("Start Time"));
261 mListView->addColumn(i18n("End Date")); 261 mListView->addColumn(i18n("End Date"));
262 mListView->addColumn(i18n("End Time")); 262 mListView->addColumn(i18n("End Time"));
263 mListView->addColumn(i18n("Alarm")); // alarm set? 263 mListView->addColumn(i18n("Alarm")); // alarm set?
264 mListView->addColumn(i18n("Recurs")); // recurs? 264 mListView->addColumn(i18n("Recurs")); // recurs?
265 mListView->addColumn(i18n("Due Date")); 265 mListView->addColumn(i18n("Due Date"));
266 mListView->addColumn(i18n("Due Time")); 266 mListView->addColumn(i18n("Due Time"));
267 mListView->addColumn(i18n("Cancelled")); 267 mListView->addColumn(i18n("Cancelled"));
268 mListView->addColumn(i18n("Categories")); 268 mListView->addColumn(i18n("Categories"));
269 mListView->addColumn(i18n("Calendar")); 269 mListView->addColumn(i18n("Calendar"));
270 270
271 mListView->setColumnAlignment(0,AlignLeft); 271 mListView->setColumnAlignment(0,AlignLeft);
272 mListView->setColumnAlignment(1,AlignLeft); 272 mListView->setColumnAlignment(1,AlignLeft);
273 mListView->setColumnAlignment(2,AlignHCenter); 273 mListView->setColumnAlignment(2,AlignHCenter);
274 mListView->setColumnAlignment(3,AlignLeft); 274 mListView->setColumnAlignment(3,AlignLeft);
275 mListView->setColumnAlignment(4,AlignHCenter); 275 mListView->setColumnAlignment(4,AlignHCenter);
276 mListView->setColumnAlignment(5,AlignLeft); 276 mListView->setColumnAlignment(5,AlignLeft);
277 mListView->setColumnAlignment(6,AlignLeft); 277 mListView->setColumnAlignment(6,AlignLeft);
278 mListView->setColumnAlignment(7,AlignLeft); 278 mListView->setColumnAlignment(7,AlignLeft);
279 mListView->setColumnAlignment(8,AlignLeft); 279 mListView->setColumnAlignment(8,AlignLeft);
280 mListView->setColumnAlignment(9,AlignLeft); 280 mListView->setColumnAlignment(9,AlignLeft);
281 mListView->setColumnAlignment(10,AlignLeft); 281 mListView->setColumnAlignment(10,AlignLeft);
282 mListView->setColumnAlignment(11,AlignLeft); 282 mListView->setColumnAlignment(11,AlignLeft);
283 mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); 283 mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this);
284 284
285 int iii = 0; 285 int iii = 0;
286 for ( iii = 0; iii< 12 ; ++iii ) 286 for ( iii = 0; iii< 12 ; ++iii )
287 mListView->setColumnWidthMode( iii, QListView::Manual ); 287 mListView->setColumnWidthMode( iii, QListView::Manual );
288 288
289 QBoxLayout *layoutTop = new QVBoxLayout(this); 289 QBoxLayout *layoutTop = new QVBoxLayout(this);
290 layoutTop->addWidget(mListView); 290 layoutTop->addWidget(mListView);
291 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 291 mListView->setFont ( KOPrefs::instance()->mListViewFont );
292 mPopupMenu = eventPopup(); 292 mPopupMenu = eventPopup();
293 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 293 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
294 i18n("Select all"),this, 294 i18n("Select all"),this,
295 SLOT(allSelection()),true); 295 SLOT(allSelection()),true);
296 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 296 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
297 i18n("Deselect all"),this, 297 i18n("Deselect all"),this,
298 SLOT(clearSelection()),true); 298 SLOT(clearSelection()),true);
299 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 299 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
300 i18n("Delete all selected"),this, 300 i18n("Delete all selected"),this,
301 SLOT(deleteAll()),true); 301 SLOT(deleteAll()),true);
302 302
303 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 303 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
304 i18n("Hide all selected"),this, 304 i18n("Hide all selected"),this,
305 SLOT(hideAll()),true); 305 SLOT(hideAll()),true);
306 306
307 mPopupMenu->insertSeparator(); 307 mPopupMenu->insertSeparator();
308#ifdef DESKTOP_VERSION 308#ifdef DESKTOP_VERSION
309 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 309 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
310 i18n("Print complete list"),this, 310 i18n("Print complete list"),this,
311 SLOT(printList()),true); 311 SLOT(printList()),true);
312 mPopupMenu->insertSeparator(); 312 mPopupMenu->insertSeparator();
313#endif 313#endif
314 mCalPopup = new QPopupMenu ( this ); 314 mCalPopup = new QPopupMenu ( this );
315 mPopupMenu->insertItem( i18n("Set Calendar"), mCalPopup ); 315 mPopupMenu->insertItem( i18n("Set Calendar"), mCalPopup );
316 316
317 QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, 317 QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this,
318 SLOT( populateCalPopup() )); 318 SLOT( populateCalPopup() ));
319 QObject::connect(mCalPopup,SIGNAL(activated( int )),this, 319 QObject::connect(mCalPopup,SIGNAL(activated( int )),this,
320 SLOT( setCalendar( int ) )); 320 SLOT( setCalendar( int ) ));
321 QPopupMenu * exportPO = new QPopupMenu ( this ); 321 QPopupMenu * exportPO = new QPopupMenu ( this );
322 mPopupMenu->insertItem( i18n("Export selected"), exportPO ); 322 mPopupMenu->insertItem( i18n("Export selected"), exportPO );
323 exportPO->insertItem( i18n("As iCal (ics) file..."),this, 323 exportPO->insertItem( i18n("As iCal (ics) file..."),this,
324 SLOT(saveToFile())); 324 SLOT(saveToFile()));
325 exportPO->insertItem( i18n("As vCal (vcs) file..."),this, 325 exportPO->insertItem( i18n("As vCal (vcs) file..."),this,
326 SLOT(saveToFileVCS())); 326 SLOT(saveToFileVCS()));
327 exportPO->insertItem( i18n("Journal/Details..."),this, 327 exportPO->insertItem( i18n("Journal/Details..."),this,
328 SLOT(saveDescriptionToFile())); 328 SLOT(saveDescriptionToFile()));
329 // mPopupMenu->insertSeparator(); 329 // mPopupMenu->insertSeparator();
330 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 330 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
331 i18n("Add Categ. to selected..."),this, 331 i18n("Add Categ. to selected..."),this,
332 SLOT(addCat()),true); 332 SLOT(addCat()),true);
333 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 333 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
334 i18n("Set Categ. for selected..."),this, 334 i18n("Set Categ. for selected..."),this,
335 SLOT(setCat()),true); 335 SLOT(setCat()),true);
336 //mPopupMenu->insertSeparator(); 336 //mPopupMenu->insertSeparator();
337 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 337 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
338 i18n("Set alarm for selected..."),this, 338 i18n("Set alarm for selected..."),this,
339 SLOT(setAlarm()),true); 339 SLOT(setAlarm()),true);
340 340
341 341
342 342
343#ifndef DESKTOP_VERSION 343#ifndef DESKTOP_VERSION
344 mPopupMenu->insertSeparator(); 344 mPopupMenu->insertSeparator();
345 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 345 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
346 i18n("Beam selected via IR"),this, 346 i18n("Beam selected via IR"),this,
347 SLOT(beamSelected()),true); 347 SLOT(beamSelected()),true);
348#endif 348#endif
349 /* 349 /*
350 mPopupMenu = new QPopupMenu; 350 mPopupMenu = new QPopupMenu;
351 mPopupMenu->insertItem(i18n("Edit Event"), this, 351 mPopupMenu->insertItem(i18n("Edit Event"), this,
352 SLOT (editEvent())); 352 SLOT (editEvent()));
353 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, 353 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
354 SLOT (deleteEvent())); 354 SLOT (deleteEvent()));
355 mPopupMenu->insertSeparator(); 355 mPopupMenu->insertSeparator();
356 mPopupMenu->insertItem(i18n("Show Dates"), this, 356 mPopupMenu->insertItem(i18n("Show Dates"), this,
357 SLOT(showDates())); 357 SLOT(showDates()));
358 mPopupMenu->insertItem(i18n("Hide Dates"), this, 358 mPopupMenu->insertItem(i18n("Hide Dates"), this,
359 SLOT(hideDates())); 359 SLOT(hideDates()));
360 */ 360 */
361 QObject::connect(mListView,SIGNAL( newEvent()), 361 QObject::connect(mListView,SIGNAL( newEvent()),
362 this,SIGNAL(signalNewEvent())); 362 this,SIGNAL(signalNewEvent()));
363 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), 363 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
364 this,SLOT(defaultItemAction(QListViewItem *))); 364 this,SLOT(defaultItemAction(QListViewItem *)));
365 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, 365 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *,
366 const QPoint &, int )), 366 const QPoint &, int )),
367 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 367 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
368 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 368 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
369 SLOT(processSelectionChange(QListViewItem *))); 369 SLOT(processSelectionChange(QListViewItem *)));
370 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 370 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
371 SIGNAL(showIncidenceSignal(Incidence *)) ); 371 SIGNAL(showIncidenceSignal(Incidence *)) );
372 372
373 readSettings(KOGlobals::config(),"KOListView Layout"); 373 readSettings(KOGlobals::config(),"KOListView Layout");
374} 374}
375 375
376KOListView::~KOListView() 376KOListView::~KOListView()
377{ 377{
378 delete mPopupMenu; 378 delete mPopupMenu;
379#if QT_VERSION >= 0x030000 379#if QT_VERSION >= 0x030000
380 380
381#else 381#else
382 delete mKOListViewWhatsThis; 382 delete mKOListViewWhatsThis;
383#endif 383#endif
384} 384}
385 385
386QString KOListView::getWhatsThisText(QPoint p) 386QString KOListView::getWhatsThisText(QPoint p)
387{ 387{
388 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); 388 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
389 if ( item ) 389 if ( item )
390 return KIncidenceFormatter::instance()->getFormattedText( item->data(), 390 return KIncidenceFormatter::instance()->getFormattedText( item->data(),
391 KOPrefs::instance()->mWTshowDetails, 391 KOPrefs::instance()->mWTshowDetails,
392 KOPrefs::instance()->mWTshowCreated, 392 KOPrefs::instance()->mWTshowCreated,
393 KOPrefs::instance()->mWTshowChanged); 393 KOPrefs::instance()->mWTshowChanged);
394 return i18n("That is the list view" ); 394 return i18n("That is the list view" );
395 395
396} 396}
397 397
398void KOListView::setCalendar( int c ) 398void KOListView::setCalendar( int c )
399{ 399{
400 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), 400 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"),
401 i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ), 401 i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ),
402 i18n("Continue"), i18n("Cancel"), 0, 402 i18n("Continue"), i18n("Cancel"), 0,
403 0, 1 ); 403 0, 1 );
404 if ( result != 0 ) { 404 if ( result != 0 ) {
405 return; 405 return;
406 } 406 }
407 407
408 QPtrList<Incidence> delSel = getSelectedIncidences() ; 408 QPtrList<Incidence> delSel = getSelectedIncidences() ;
409 int icount = delSel.count(); 409 int icount = delSel.count();
410 if ( icount ) { 410 if ( icount ) {
411 Incidence *incidence = delSel.first(); 411 Incidence *incidence = delSel.first();
412 while ( incidence ) { 412 while ( incidence ) {
413 incidence->setCalID( c ); 413 incidence->setCalID( c );
414 KOListViewItem * item = getItemForEvent( incidence ); 414 KOListViewItem * item = getItemForEvent( incidence );
415 if ( item ) { 415 if ( item ) {
416 ListItemVisitor v(item, mStartDate ); 416 ListItemVisitor v(item, mStartDate );
417 incidence->accept(v); 417 incidence->accept(v);
418 } 418 }
419 incidence = delSel.next(); 419 incidence = delSel.next();
420 } 420 }
421 } 421 }
422 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 422 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
423 KopiCalendarFile * cal = calendars.first(); 423 KopiCalendarFile * cal = calendars.first();
424 while ( cal ) { 424 while ( cal ) {
425 mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); 425 mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled );
426 mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); 426 mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled );
427 mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); 427 mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly );
428 if ( cal->isStandard ) 428 if ( cal->isStandard )
429 mCalendar->setDefaultCalendar( cal->mCalNumber ); 429 mCalendar->setDefaultCalendar( cal->mCalNumber );
430 cal = calendars.next(); 430 cal = calendars.next();
431 } 431 }
432 mCalendar->setSyncEventsReadOnly(); 432 mCalendar->setSyncEventsReadOnly();
433 mCalendar->reInitAlarmSettings(); 433 mCalendar->reInitAlarmSettings();
434 434
435} 435}
436void KOListView::populateCalPopup() 436void KOListView::populateCalPopup()
437{ 437{
438 mCalPopup->clear(); 438 mCalPopup->clear();
439 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 439 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
440 while ( kkf ) { 440 while ( kkf ) {
441 int index = mCalPopup->insertItem( kkf->mName, kkf->mCalNumber); 441 int index = mCalPopup->insertItem( kkf->mName, kkf->mCalNumber);
442 mCalPopup->setItemEnabled( index, !kkf->isReadOnly ); 442 if ( kkf->mErrorOnLoad || kkf->isReadOnly )
443 mCalPopup->setItemEnabled( index, false );
443 kkf = KOPrefs::instance()->mCalendars.next(); 444 kkf = KOPrefs::instance()->mCalendars.next();
444 } 445 }
445} 446}
446void KOListView::updateList() 447void KOListView::updateList()
447{ 448{
448 // qDebug(" KOListView::updateList() "); 449 // qDebug(" KOListView::updateList() ");
449 450
450} 451}
451 452
452void KOListView::clearList() 453void KOListView::clearList()
453{ 454{
454 clear (); 455 clear ();
455} 456}
456void KOListView::addCat( ) 457void KOListView::addCat( )
457{ 458{
458 setCategories( false ); 459 setCategories( false );
459} 460}
460void KOListView::setCat() 461void KOListView::setCat()
461{ 462{
462 setCategories( true ); 463 setCategories( true );
463} 464}
464 465
465void KOListView::setAlarm() 466void KOListView::setAlarm()
466{ 467{
467 KOAlarmPrefs kap( this); 468 KOAlarmPrefs kap( this);
468 if ( !kap.exec() ) 469 if ( !kap.exec() )
469 return; 470 return;
470 QStringList itemList; 471 QStringList itemList;
471 QPtrList<KOListViewItem> sel ; 472 QPtrList<KOListViewItem> sel ;
472 QListViewItem *qitem = mListView->firstChild (); 473 QListViewItem *qitem = mListView->firstChild ();
473 while ( qitem ) { 474 while ( qitem ) {
474 if ( qitem->isSelected() ) { 475 if ( qitem->isSelected() ) {
475 Incidence* inc = ((KOListViewItem *) qitem)->data(); 476 Incidence* inc = ((KOListViewItem *) qitem)->data();
476 if ( inc->typeID() != journalID ) { 477 if ( inc->typeID() != journalID ) {
477 if ( inc->typeID() == todoID ) { 478 if ( inc->typeID() == todoID ) {
478 if ( ((Todo*)inc)->hasDueDate() ) 479 if ( ((Todo*)inc)->hasDueDate() )
479 sel.append(((KOListViewItem *)qitem)); 480 sel.append(((KOListViewItem *)qitem));
480 } else 481 } else
481 sel.append(((KOListViewItem *)qitem)); 482 sel.append(((KOListViewItem *)qitem));
482 } 483 }
483 } 484 }
484 qitem = qitem->nextSibling(); 485 qitem = qitem->nextSibling();
485 } 486 }
486 int count = 0; 487 int count = 0;
487 KOListViewItem * item, *temp; 488 KOListViewItem * item, *temp;
488 item = sel.first(); 489 item = sel.first();
489 Incidence* inc; 490 Incidence* inc;
490 while ( item ) { 491 while ( item ) {
491 inc = item->data(); 492 inc = item->data();
492 ++count; 493 ++count;
493 if (kap.mAlarmButton->isChecked()) { 494 if (kap.mAlarmButton->isChecked()) {
494 if (inc->alarms().count() == 0) 495 if (inc->alarms().count() == 0)
495 inc->newAlarm(); 496 inc->newAlarm();
496 QPtrList<Alarm> alarms = inc->alarms(); 497 QPtrList<Alarm> alarms = inc->alarms();
497 Alarm *alarm; 498 Alarm *alarm;
498 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { 499 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
499 alarm->setEnabled(true); 500 alarm->setEnabled(true);
500 int j = kap.mAlarmTimeEdit->value()* -60; 501 int j = kap.mAlarmTimeEdit->value()* -60;
501 if (kap.mAlarmIncrCombo->currentItem() == 1) 502 if (kap.mAlarmIncrCombo->currentItem() == 1)
502 j = j * 60; 503 j = j * 60;
503 else if (kap.mAlarmIncrCombo->currentItem() == 2) 504 else if (kap.mAlarmIncrCombo->currentItem() == 2)
504 j = j * (60 * 24); 505 j = j * (60 * 24);
505 alarm->setStartOffset( j ); 506 alarm->setStartOffset( j );
506 507
507 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { 508 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) {
508 alarm->setProcedureAlarm(kap.mAlarmProgram); 509 alarm->setProcedureAlarm(kap.mAlarmProgram);
509 } 510 }
510 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) 511 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn())
511 alarm->setAudioAlarm(kap.mAlarmSound); 512 alarm->setAudioAlarm(kap.mAlarmSound);
512 else 513 else
513 alarm->setType(Alarm::Invalid); 514 alarm->setType(Alarm::Invalid);
514 //alarm->setAudioAlarm("default"); 515 //alarm->setAudioAlarm("default");
515 // TODO: Deal with multiple alarms 516 // TODO: Deal with multiple alarms
516 break; // For now, stop after the first alarm 517 break; // For now, stop after the first alarm
517 } 518 }
518 } else { 519 } else {
519 Alarm* alarm = inc->alarms().first(); 520 Alarm* alarm = inc->alarms().first();
520 if ( alarm ) { 521 if ( alarm ) {
521 alarm->setEnabled(false); 522 alarm->setEnabled(false);
522 alarm->setType(Alarm::Invalid); 523 alarm->setType(Alarm::Invalid);
523 } 524 }
524 } 525 }
525 ListItemVisitor v(item, mStartDate ); 526 ListItemVisitor v(item, mStartDate );
526 inc->accept(v); 527 inc->accept(v);
527 item = sel.next(); 528 item = sel.next();
528 } 529 }
529 topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) ); 530 topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) );
530 qDebug("KO: Set alarm for %d items", count); 531 qDebug("KO: Set alarm for %d items", count);
531 calendar()->reInitAlarmSettings(); 532 calendar()->reInitAlarmSettings();
532 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); 533 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
533} 534}
534void KOListView::setCategories( bool removeOld ) 535void KOListView::setCategories( bool removeOld )
535{ 536{
536 537
537 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 538 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
538 csd->setColorEnabled(); 539 csd->setColorEnabled();
539 if (! csd->exec()) { 540 if (! csd->exec()) {
540 delete csd; 541 delete csd;
541 return; 542 return;
542 } 543 }
543 QStringList catList = csd->selectedCategories(); 544 QStringList catList = csd->selectedCategories();
544 delete csd; 545 delete csd;
545 // if ( catList.count() == 0 ) 546 // if ( catList.count() == 0 )
546 // return; 547 // return;
547 //catList.sort(); 548 //catList.sort();
548 QString categoriesStr = catList.join(","); 549 QString categoriesStr = catList.join(",");
549 int i; 550 int i;
550 QStringList itemList; 551 QStringList itemList;
551 QPtrList<KOListViewItem> sel ; 552 QPtrList<KOListViewItem> sel ;
552 QListViewItem *qitem = mListView->firstChild (); 553 QListViewItem *qitem = mListView->firstChild ();
553 while ( qitem ) { 554 while ( qitem ) {
554 if ( qitem->isSelected() ) { 555 if ( qitem->isSelected() ) {
555 sel.append(((KOListViewItem *)qitem)); 556 sel.append(((KOListViewItem *)qitem));
556 } 557 }
557 qitem = qitem->nextSibling(); 558 qitem = qitem->nextSibling();
558 } 559 }
559 KOListViewItem * item, *temp; 560 KOListViewItem * item, *temp;
560 item = sel.first(); 561 item = sel.first();
561 if( item ) { 562 if( item ) {
562 Incidence* inc = item->data() ; 563 Incidence* inc = item->data() ;
563 bool setSub = false; 564 bool setSub = false;
564 if( inc->typeID() == todoID && sel.count() == 1 && inc->relations().count() > 0 ) { 565 if( inc->typeID() == todoID && sel.count() == 1 && inc->relations().count() > 0 ) {
565 int result = KMessageBox::warningYesNoCancel(this, 566 int result = KMessageBox::warningYesNoCancel(this,
566 i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ), 567 i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ),
567 i18n("Todo has subtodos"), 568 i18n("Todo has subtodos"),
568 i18n("Yes"), 569 i18n("Yes"),
569 i18n("No")); 570 i18n("No"));
570 if (result == KMessageBox::Cancel) item = 0; 571 if (result == KMessageBox::Cancel) item = 0;
571 if (result == KMessageBox::Yes) setSub = true; 572 if (result == KMessageBox::Yes) setSub = true;
572 } 573 }
573 while ( item ) { 574 while ( item ) {
574 inc = item->data(); 575 inc = item->data();
575 if ( removeOld ) { 576 if ( removeOld ) {
576 inc->setCategories( catList, setSub ); 577 inc->setCategories( catList, setSub );
577 } else { 578 } else {
578 inc->addCategories( catList, setSub ); 579 inc->addCategories( catList, setSub );
579 } 580 }
580 ListItemVisitor v(item, mStartDate ); 581 ListItemVisitor v(item, mStartDate );
581 inc->accept(v); 582 inc->accept(v);
582 item = sel.next(); 583 item = sel.next();
583 } 584 }
584 } 585 }
585 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); 586 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
586} 587}
587 588
588void KOListView::beamSelected() 589void KOListView::beamSelected()
589{ 590{
590 QPtrList<Incidence> delSel = getSelectedIncidences() ; 591 QPtrList<Incidence> delSel = getSelectedIncidences() ;
591 int icount = delSel.count(); 592 int icount = delSel.count();
592 if ( icount ) { 593 if ( icount ) {
593 emit beamIncidenceList( delSel ); 594 emit beamIncidenceList( delSel );
594 return; 595 return;
595 QString fn ; 596 QString fn ;
596 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; 597 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs";
597 QString mes; 598 QString mes;
598 bool createbup = true; 599 bool createbup = true;
599 if ( createbup ) { 600 if ( createbup ) {
600 QString description = "\n"; 601 QString description = "\n";
601 CalendarLocal* cal = new CalendarLocal(); 602 CalendarLocal* cal = new CalendarLocal();
602 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 603 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
603 Incidence *incidence = delSel.first(); 604 Incidence *incidence = delSel.first();
604 while ( incidence ) { 605 while ( incidence ) {
605 Incidence *in = incidence->clone(); 606 Incidence *in = incidence->clone();
606 description += in->summary() + "\n"; 607 description += in->summary() + "\n";
607 cal->addIncidence( in ); 608 cal->addIncidence( in );
608 incidence = delSel.next(); 609 incidence = delSel.next();
609 } 610 }
610 FileStorage storage( cal, fn, new VCalFormat ); 611 FileStorage storage( cal, fn, new VCalFormat );
611 storage.save(); 612 storage.save();
612 delete cal; 613 delete cal;
613 mes = i18n("KO/Pi: Ready for beaming"); 614 mes = i18n("KO/Pi: Ready for beaming");
614 topLevelWidget()->setCaption(mes); 615 topLevelWidget()->setCaption(mes);
615 616
616#ifndef DESKTOP_VERSION 617#ifndef DESKTOP_VERSION
617 Ir *ir = new Ir( this ); 618 Ir *ir = new Ir( this );
618 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 619 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
619 ir->send( fn, description, "text/x-vCalendar" ); 620 ir->send( fn, description, "text/x-vCalendar" );
620#endif 621#endif
621 } 622 }
622 } 623 }
623} 624}
624void KOListView::beamDone( Ir *ir ) 625void KOListView::beamDone( Ir *ir )
625{ 626{
626#ifndef DESKTOP_VERSION 627#ifndef DESKTOP_VERSION
627 delete ir; 628 delete ir;
628#endif 629#endif
629 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); 630 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done"));
630} 631}
631 632
632void KOListView::saveDescriptionToFile() 633void KOListView::saveDescriptionToFile()
633{ 634{
634 635
635 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), 636 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"),
636 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), 637 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."),
637 i18n("Continue"), i18n("Cancel"), 0, 638 i18n("Continue"), i18n("Cancel"), 0,
638 0, 1 ); 639 0, 1 );
639 if ( result != 0 ) { 640 if ( result != 0 ) {
640 return; 641 return;
641 } 642 }
642 QPtrList<Incidence> delSel = getSelectedIncidences() ; 643 QPtrList<Incidence> delSel = getSelectedIncidences() ;
643 int icount = delSel.count(); 644 int icount = delSel.count();
644 if ( icount ) { 645 if ( icount ) {
645 QString fn = KOPrefs::instance()->mLastSaveFile; 646 QString fn = KOPrefs::instance()->mLastSaveFile;
646 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 647 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
647 648
648 if ( fn == "" ) 649 if ( fn == "" )
649 return; 650 return;
650 QFileInfo info; 651 QFileInfo info;
651 info.setFile( fn ); 652 info.setFile( fn );
652 QString mes; 653 QString mes;
653 bool createbup = true; 654 bool createbup = true;
654 if ( info. exists() ) { 655 if ( info. exists() ) {
655 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 656 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
656 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 657 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
657 i18n("Overwrite!"), i18n("Cancel"), 0, 658 i18n("Overwrite!"), i18n("Cancel"), 0,
658 0, 1 ); 659 0, 1 );
659 if ( result != 0 ) { 660 if ( result != 0 ) {
660 createbup = false; 661 createbup = false;
661 } 662 }
662 } 663 }
663 if ( createbup ) { 664 if ( createbup ) {
664 QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + 665 QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") +
665 KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); 666 KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false);
666 Incidence *incidence = delSel.first(); 667 Incidence *incidence = delSel.first();
667 icount = 0; 668 icount = 0;
668 while ( incidence ) { 669 while ( incidence ) {
669 if ( incidence->typeID() == journalID ) { 670 if ( incidence->typeID() == journalID ) {
670 text += "\n************************************\n"; 671 text += "\n************************************\n";
671 if ( !incidence->summary().isEmpty() ) 672 if ( !incidence->summary().isEmpty() )
672 text += i18n("Journal: %1 from ").arg( incidence->summary() ) +incidence->dtStartDateStr( false ); 673 text += i18n("Journal: %1 from ").arg( incidence->summary() ) +incidence->dtStartDateStr( false );
673 else 674 else
674 text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); 675 text += i18n("Journal from: ") +incidence->dtStartDateStr( false );
675 if ( !incidence->location().isEmpty() ) 676 if ( !incidence->location().isEmpty() )
676 text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; 677 text +="\n(" + i18n("Location: ") + incidence->location()+ ")";
677 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 678 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
678 text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); 679 text +="\n" + i18n("Description: ") + "\n"+ incidence->description();
679 ++icount; 680 ++icount;
680 681
681 } else { 682 } else {
682 if ( !incidence->description().isEmpty() ) { 683 if ( !incidence->description().isEmpty() ) {
683 text += "\n************************************\n"; 684 text += "\n************************************\n";
684 if ( incidence->typeID() == todoID ) 685 if ( incidence->typeID() == todoID )
685 text += i18n("To-Do: "); 686 text += i18n("To-Do: ");
686 text += incidence->summary(); 687 text += incidence->summary();
687 if ( !incidence->location().isEmpty() ) 688 if ( !incidence->location().isEmpty() )
688 text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; 689 text +="\n(" + i18n("Location: ") + incidence->location()+ ")";
689 if ( incidence->hasStartDate() ) 690 if ( incidence->hasStartDate() )
690 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); 691 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false );
691 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 692 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
692 text += "\n" + i18n("Description: ") + "\n" + incidence->description(); 693 text += "\n" + i18n("Description: ") + "\n" + incidence->description();
693 ++icount; 694 ++icount;
694 695
695 } 696 }
696 } 697 }
697 incidence = delSel.next(); 698 incidence = delSel.next();
698 } 699 }
699 QFile file( fn ); 700 QFile file( fn );
700 if (!file.open( IO_WriteOnly ) ) { 701 if (!file.open( IO_WriteOnly ) ) {
701 topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); 702 topLevelWidget()->setCaption(i18n("File open error - nothing saved!") );
702 return; 703 return;
703 } 704 }
704 QTextStream ts( &file ); 705 QTextStream ts( &file );
705 ts << text; 706 ts << text;
706 file.close(); 707 file.close();
707 //qDebug("%s ", text.latin1()); 708 //qDebug("%s ", text.latin1());
708 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); 709 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount );
709 KOPrefs::instance()->mLastSaveFile = fn; 710 KOPrefs::instance()->mLastSaveFile = fn;
710 topLevelWidget()->setCaption(mes); 711 topLevelWidget()->setCaption(mes);
711 } 712 }
712 } 713 }
713} 714}
714void KOListView::saveToFileVCS() 715void KOListView::saveToFileVCS()
715{ 716{
716 writeToFile( false ); 717 writeToFile( false );
717} 718}
718void KOListView::saveToFile() 719void KOListView::saveToFile()
719{ 720{
720 writeToFile( true ); 721 writeToFile( true );
721} 722}
722QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos ) 723QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos )
723{ 724{
724 QPtrList<Incidence> delSel ; 725 QPtrList<Incidence> delSel ;
725 bool addSubTodos = false; 726 bool addSubTodos = false;
726 bool askSubTodos = true; 727 bool askSubTodos = true;
727 QListViewItem *item = mListView->firstChild (); 728 QListViewItem *item = mListView->firstChild ();
728 while ( item ) { 729 while ( item ) {
729 if ( item->isSelected() ) { 730 if ( item->isSelected() ) {
730 Incidence* inc = ((KOListViewItem *)item)->data(); 731 Incidence* inc = ((KOListViewItem *)item)->data();
731 if ( ( addSubTodos && delSel.findRef( inc ) == -1) || !addSubTodos ) { 732 if ( ( addSubTodos && delSel.findRef( inc ) == -1) || !addSubTodos ) {
732 if ( (inc->typeID() == todoID && includeTodos) || 733 if ( (inc->typeID() == todoID && includeTodos) ||
733 (inc->typeID() == eventID && includeEvents) || 734 (inc->typeID() == eventID && includeEvents) ||
734 (inc->typeID() == journalID && includeJournals) ) { 735 (inc->typeID() == journalID && includeJournals) ) {
735 if ( inc->typeID() == todoID && onlyDueTodos ) { 736 if ( inc->typeID() == todoID && onlyDueTodos ) {
736 if ( ((Todo*)inc)->hasDueDate() ) 737 if ( ((Todo*)inc)->hasDueDate() )
737 delSel.append( inc ); 738 delSel.append( inc );
738 } else 739 } else
739 delSel.append( inc ); 740 delSel.append( inc );
740 741
741 } 742 }
742 } 743 }
743 if ( inc->typeID() == todoID ) { 744 if ( inc->typeID() == todoID ) {
744 Todo * todo = (Todo*) inc; 745 Todo * todo = (Todo*) inc;
745 if ( todo->relations().count() ) { 746 if ( todo->relations().count() ) {
746 if ( askSubTodos ) { 747 if ( askSubTodos ) {
747 int result = KMessageBox::warningYesNoCancel(this, 748 int result = KMessageBox::warningYesNoCancel(this,
748 i18n("One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?"), 749 i18n("One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?"),
749 i18n("Todo has subtodos"), 750 i18n("Todo has subtodos"),
750 i18n("Yes"), 751 i18n("Yes"),
751 i18n("No")); 752 i18n("No"));
752 if ( result == KMessageBox::Cancel ) { 753 if ( result == KMessageBox::Cancel ) {
753 delSel.clear(); 754 delSel.clear();
754 return delSel; 755 return delSel;
755 } 756 }
756 if (result == KMessageBox::Yes) 757 if (result == KMessageBox::Yes)
757 addSubTodos = true; 758 addSubTodos = true;
758 askSubTodos = false; 759 askSubTodos = false;
759 } 760 }
760 if ( addSubTodos ) { 761 if ( addSubTodos ) {
761 inc->addRelationsToList( &delSel ); 762 inc->addRelationsToList( &delSel );
762 } 763 }
763 } 764 }
764 } 765 }
765 } 766 }
766 item = item->nextSibling(); 767 item = item->nextSibling();
767 } 768 }
768 return delSel; 769 return delSel;
769} 770}
770 771
771void KOListView::writeToFile( bool iCal ) 772void KOListView::writeToFile( bool iCal )
772{ 773{
773 QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; 774 QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;
774 if ( !iCal ) { 775 if ( !iCal ) {
775 bool journal = false; 776 bool journal = false;
776 Incidence *incidence = delSel.first(); 777 Incidence *incidence = delSel.first();
777 while ( incidence ) { 778 while ( incidence ) {
778 if ( incidence->typeID() == journalID ) { 779 if ( incidence->typeID() == journalID ) {
779 journal = true; 780 journal = true;
780 break; 781 break;
781 } 782 }
782 incidence = delSel.next(); 783 incidence = delSel.next();
783 } 784 }
784 if ( journal ) { 785 if ( journal ) {
785 int result = KMessageBox::warningContinueCancel(this, 786 int result = KMessageBox::warningContinueCancel(this,
786 i18n("The journal entries can not be\nexported to a vCalendar file."), 787 i18n("The journal entries can not be\nexported to a vCalendar file."),
787 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), 788 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
788 true); 789 true);
789 if (result != KMessageBox::Continue) return; 790 if (result != KMessageBox::Continue) return;
790 } 791 }
791 } 792 }
792 if ( delSel.count() ) { 793 if ( delSel.count() ) {
793 QString fn = KOPrefs::instance()->mLastSaveFile; 794 QString fn = KOPrefs::instance()->mLastSaveFile;
794 QString extension; 795 QString extension;
795 if ( iCal ) { 796 if ( iCal ) {
796 if ( fn.right( 4 ).lower() == ".vcs" ) { 797 if ( fn.right( 4 ).lower() == ".vcs" ) {
797 fn = fn.left( fn.length() -3) + "ics"; 798 fn = fn.left( fn.length() -3) + "ics";
798 } 799 }
799 } else { 800 } else {
800 if ( fn.right( 4 ).lower() == ".ics" ) { 801 if ( fn.right( 4 ).lower() == ".ics" ) {
801 fn = fn.left( fn.length() -3) + "vcs"; 802 fn = fn.left( fn.length() -3) + "vcs";
802 } 803 }
803 } 804 }
804 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 805 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
805 806
806 if ( fn == "" ) 807 if ( fn == "" )
807 return; 808 return;
808 QFileInfo info; 809 QFileInfo info;
809 info.setFile( fn ); 810 info.setFile( fn );
810 QString mes; 811 QString mes;
811 bool createbup = true; 812 bool createbup = true;
812 if ( info. exists() ) { 813 if ( info. exists() ) {
813 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 814 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
814 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 815 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
815 i18n("Overwrite!"), i18n("Cancel"), 0, 816 i18n("Overwrite!"), i18n("Cancel"), 0,
816 0, 1 ); 817 0, 1 );
817 if ( result != 0 ) { 818 if ( result != 0 ) {
818 createbup = false; 819 createbup = false;
819 } 820 }
820 } 821 }
821 if ( createbup ) { 822 if ( createbup ) {
822 CalendarLocal cal; 823 CalendarLocal cal;
823 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 824 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
824 Incidence *incidence = delSel.first(); 825 Incidence *incidence = delSel.first();
825 while ( incidence ) { 826 while ( incidence ) {
826 cal.addIncidence( incidence->clone() ); 827 cal.addIncidence( incidence->clone() );
827 incidence = delSel.next(); 828 incidence = delSel.next();
828 } 829 }
829 if ( iCal ) { 830 if ( iCal ) {
830 ICalFormat format; 831 ICalFormat format;
831 format.save( &cal, fn ); 832 format.save( &cal, fn );
832 } else { 833 } else {
833 834
834 VCalFormat format; 835 VCalFormat format;
835 format.save( &cal, fn ); 836 format.save( &cal, fn );
836 } 837 }
837 mes = i18n("KO/Pi:Saved %1").arg(fn ); 838 mes = i18n("KO/Pi:Saved %1").arg(fn );
838 KOPrefs::instance()->mLastSaveFile = fn; 839 KOPrefs::instance()->mLastSaveFile = fn;
839 topLevelWidget()->setCaption(mes); 840 topLevelWidget()->setCaption(mes);
840 } 841 }
841 } 842 }
842 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); 843 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
843} 844}
844void KOListView::hideAll() 845void KOListView::hideAll()
845{ 846{
846 QPtrList<QListViewItem> delSel ; 847 QPtrList<QListViewItem> delSel ;
847 QListViewItem *item = mListView->firstChild (); 848 QListViewItem *item = mListView->firstChild ();
848 while ( item ) { 849 while ( item ) {
849 if ( item->isSelected() ) { 850 if ( item->isSelected() ) {
850 delSel.append(item); 851 delSel.append(item);
851 } 852 }
852 item = item->nextSibling(); 853 item = item->nextSibling();
853 } 854 }
854 item = delSel.first() ; 855 item = delSel.first() ;
855 while ( item ) { 856 while ( item ) {
856 QListViewItem * del = item; 857 QListViewItem * del = item;
857 item = delSel.next(); 858 item = delSel.next();
858 delete del; 859 delete del;
859 } 860 }
860} 861}
861void KOListView::printList() 862void KOListView::printList()
862{ 863{
863 mListView->printList(); 864 mListView->printList();
864} 865}
865void KOListView::deleteAll() 866void KOListView::deleteAll()
866{ 867{
867 QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;; 868 QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;;
868 if ( delSel.count() ) { 869 if ( delSel.count() ) {
869 int icount = delSel.count(); 870 int icount = delSel.count();
870 Incidence *incidence = delSel.first(); 871 Incidence *incidence = delSel.first();
871 Incidence *toDelete; 872 Incidence *toDelete;
872 KOPrefs *p = KOPrefs::instance(); 873 KOPrefs *p = KOPrefs::instance();
873 bool confirm = p->mConfirm; 874 bool confirm = p->mConfirm;
874 QString mess; 875 QString mess;
875 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); 876 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount );
876 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { 877 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) {
877 p->mConfirm = false; 878 p->mConfirm = false;
878 int delCounter = 0; 879 int delCounter = 0;
879 QDialog dia ( this, "p-dialog", true ); 880 QDialog dia ( this, "p-dialog", true );
880 QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); 881 QLabel lab (i18n("Close dialog to abort deletion!"), &dia );
881 QVBoxLayout lay( &dia ); 882 QVBoxLayout lay( &dia );
882 lay.setMargin(7); 883 lay.setMargin(7);
883 lay.setSpacing(7); 884 lay.setSpacing(7);
884 lay.addWidget( &lab); 885 lay.addWidget( &lab);
885 QProgressBar bar( icount, &dia ); 886 QProgressBar bar( icount, &dia );
886 lay.addWidget( &bar); 887 lay.addWidget( &bar);
887 int w = 220; 888 int w = 220;
888 int h = 50; 889 int h = 50;
889 int dw = QApplication::desktop()->width(); 890 int dw = QApplication::desktop()->width();
890 int dh = QApplication::desktop()->height(); 891 int dh = QApplication::desktop()->height();
891 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 892 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
892 //dia.resize( 240,50 ); 893 //dia.resize( 240,50 );
893 dia.show(); 894 dia.show();
894 895
895 while ( incidence ) { 896 while ( incidence ) {
896 bar.setProgress( delCounter ); 897 bar.setProgress( delCounter );
897 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); 898 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter );
898 dia.setCaption( mess ); 899 dia.setCaption( mess );
899 qApp->processEvents(); 900 qApp->processEvents();
900 toDelete = (incidence); 901 toDelete = (incidence);
901 incidence = delSel.next(); 902 incidence = delSel.next();
902 emit deleteIncidenceSignal(toDelete ); 903 emit deleteIncidenceSignal(toDelete );
903 if ( dia.result() != 0 ) 904 if ( dia.result() != 0 )
904 break; 905 break;
905 906
906 } 907 }
907 mess = mess.sprintf( i18n("%d items remaining in list."), count() ); 908 mess = mess.sprintf( i18n("%d items remaining in list."), count() );
908 topLevelWidget ()->setCaption( mess ); 909 topLevelWidget ()->setCaption( mess );
909 p->mConfirm = confirm; 910 p->mConfirm = confirm;
910 } 911 }
911 } 912 }
912 913
913 914
914} 915}
915int KOListView::maxDatesHint() 916int KOListView::maxDatesHint()
916{ 917{
917 return 0; 918 return 0;
918} 919}
919 920
920int KOListView::currentDateCount() 921int KOListView::currentDateCount()
921{ 922{
922 return 0; 923 return 0;
923} 924}
924 925
925QPtrList<Incidence> KOListView::selectedIncidences() 926QPtrList<Incidence> KOListView::selectedIncidences()
926{ 927{
927 QPtrList<Incidence> eventList; 928 QPtrList<Incidence> eventList;
928 QListViewItem *item = mListView->firstChild (); 929 QListViewItem *item = mListView->firstChild ();
929 while ( item ) { 930 while ( item ) {
930 if ( item->isSelected() ) { 931 if ( item->isSelected() ) {
931 eventList.append(((KOListViewItem *)item)->data()); 932 eventList.append(((KOListViewItem *)item)->data());
932 } 933 }
933 934
934 item = item->nextSibling(); 935 item = item->nextSibling();
935 } 936 }
936 937
937 // // QListViewItem *item = mListView->selectedItem(); 938 // // QListViewItem *item = mListView->selectedItem();
938 //if (item) eventList.append(((KOListViewItem *)item)->data()); 939 //if (item) eventList.append(((KOListViewItem *)item)->data());
939 940
940 return eventList; 941 return eventList;
941} 942}
942 943
943DateList KOListView::selectedDates() 944DateList KOListView::selectedDates()
944{ 945{
945 DateList eventList; 946 DateList eventList;
946 return eventList; 947 return eventList;
947} 948}
948 949
949void KOListView::showDates(bool show) 950void KOListView::showDates(bool show)
950{ 951{
951 // Shouldn't we set it to a value greater 0? When showDates is called with 952 // Shouldn't we set it to a value greater 0? When showDates is called with
952 // show == true at first, then the columnwidths are set to zero. 953 // show == true at first, then the columnwidths are set to zero.
953 static int oldColWidth1 = 0; 954 static int oldColWidth1 = 0;
954 static int oldColWidth3 = 0; 955 static int oldColWidth3 = 0;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index b6ce7d5..b797d8c 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,859 +1,855 @@
1#include <stdlib.h> 1#include <stdlib.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#include <qpainter.h> 5#include <qpainter.h>
6#include <qwhatsthis.h> 6#include <qwhatsthis.h>
7#include <qpushbutton.h> 7#include <qpushbutton.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qlineedit.h> 9#include <qlineedit.h>
10#include <qtextcodec.h> 10#include <qtextcodec.h>
11#include <qfile.h> 11#include <qfile.h>
12#include <qdir.h> 12#include <qdir.h>
13#include <qapp.h> 13#include <qapp.h>
14#include <qfileinfo.h> 14#include <qfileinfo.h>
15#include <qlabel.h> 15#include <qlabel.h>
16#include <qspinbox.h> 16#include <qspinbox.h>
17#include <qcheckbox.h> 17#include <qcheckbox.h>
18#include <qmap.h> 18#include <qmap.h>
19#include <qwmatrix.h> 19#include <qwmatrix.h>
20#include <qtextbrowser.h> 20#include <qtextbrowser.h>
21#include <qtextstream.h> 21#include <qtextstream.h>
22#ifndef DESKTOP_VERSION 22#ifndef DESKTOP_VERSION
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/qpemenubar.h> 24#include <qpe/qpemenubar.h>
25#include <qpe/qpetoolbar.h> 25#include <qpe/qpetoolbar.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qtopia/alarmserver.h> 28#include <qtopia/alarmserver.h>
29#include <qtopia/qcopenvelope_qws.h> 29#include <qtopia/qcopenvelope_qws.h>
30#include <unistd.h> // for sleep 30#include <unistd.h> // for sleep
31#else 31#else
32#include <qmenubar.h> 32#include <qmenubar.h>
33#include <qtoolbar.h> 33#include <qtoolbar.h>
34#include <qapplication.h> 34#include <qapplication.h>
35//#include <resource.h> 35//#include <resource.h>
36 36
37#endif 37#endif
38#include <libkcal/calendarlocal.h> 38#include <libkcal/calendarlocal.h>
39#include <libkcal/todo.h> 39#include <libkcal/todo.h>
40#include <libkcal/phoneformat.h> 40#include <libkcal/phoneformat.h>
41#include <libkdepim/ksyncprofile.h> 41#include <libkdepim/ksyncprofile.h>
42#include <libkdepim/phoneaccess.h> 42#include <libkdepim/phoneaccess.h>
43#include <libkcal/kincidenceformatter.h> 43#include <libkcal/kincidenceformatter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
46#include "calendarview.h" 46#include "calendarview.h"
47#include "koviewmanager.h" 47#include "koviewmanager.h"
48#include "datenavigator.h" 48#include "datenavigator.h"
49#include "koagendaview.h" 49#include "koagendaview.h"
50#include "kojournalview.h" 50#include "kojournalview.h"
51#include "koagenda.h" 51#include "koagenda.h"
52#include "kodialogmanager.h" 52#include "kodialogmanager.h"
53#include "kdialogbase.h" 53#include "kdialogbase.h"
54#include "kapplication.h" 54#include "kapplication.h"
55#include "kofilterview.h" 55#include "kofilterview.h"
56#include "kstandarddirs.h" 56#include "kstandarddirs.h"
57#include "koprefs.h" 57#include "koprefs.h"
58#include "kfiledialog.h" 58#include "kfiledialog.h"
59#include "koglobals.h" 59#include "koglobals.h"
60#include "kglobal.h" 60#include "kglobal.h"
61#include "ktoolbar.h" 61#include "ktoolbar.h"
62#include "klocale.h" 62#include "klocale.h"
63#include "kconfig.h" 63#include "kconfig.h"
64#include "externalapphandler.h" 64#include "externalapphandler.h"
65#include <kglobalsettings.h> 65#include <kglobalsettings.h>
66 66
67using namespace KCal; 67using namespace KCal;
68#ifndef _WIN32_ 68#ifndef _WIN32_
69#include <unistd.h> 69#include <unistd.h>
70#else 70#else
71#ifdef _OL_IMPORT_ 71#ifdef _OL_IMPORT_
72#include "koimportoldialog.h" 72#include "koimportoldialog.h"
73#endif 73#endif
74#endif 74#endif
75#include "mainwindow.h" 75#include "mainwindow.h"
76 76
77 77
78class KOex2phonePrefs : public QDialog 78class KOex2phonePrefs : public QDialog
79{ 79{
80 public: 80 public:
81 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 81 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
82 QDialog( parent, name, true ) 82 QDialog( parent, name, true )
83 { 83 {
84 setCaption( i18n("Export to phone options") ); 84 setCaption( i18n("Export to phone options") );
85 QVBoxLayout* lay = new QVBoxLayout( this ); 85 QVBoxLayout* lay = new QVBoxLayout( this );
86 lay->setSpacing( 3 ); 86 lay->setSpacing( 3 );
87 lay->setMargin( 3 ); 87 lay->setMargin( 3 );
88 QLabel *lab; 88 QLabel *lab;
89 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 89 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
90 lab->setAlignment (AlignHCenter ); 90 lab->setAlignment (AlignHCenter );
91 QHBox* temphb; 91 QHBox* temphb;
92 temphb = new QHBox( this ); 92 temphb = new QHBox( this );
93 new QLabel( i18n("I/O device: "), temphb ); 93 new QLabel( i18n("I/O device: "), temphb );
94 mPhoneDevice = new QLineEdit( temphb); 94 mPhoneDevice = new QLineEdit( temphb);
95 lay->addWidget( temphb ); 95 lay->addWidget( temphb );
96 temphb = new QHBox( this ); 96 temphb = new QHBox( this );
97 new QLabel( i18n("Connection: "), temphb ); 97 new QLabel( i18n("Connection: "), temphb );
98 mPhoneConnection = new QLineEdit( temphb); 98 mPhoneConnection = new QLineEdit( temphb);
99 lay->addWidget( temphb ); 99 lay->addWidget( temphb );
100 temphb = new QHBox( this ); 100 temphb = new QHBox( this );
101 new QLabel( i18n("Model(opt.): "), temphb ); 101 new QLabel( i18n("Model(opt.): "), temphb );
102 mPhoneModel = new QLineEdit( temphb); 102 mPhoneModel = new QLineEdit( temphb);
103 lay->addWidget( temphb ); 103 lay->addWidget( temphb );
104 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 104 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
105 mWriteBackFuture->setChecked( true ); 105 mWriteBackFuture->setChecked( true );
106 lay->addWidget( mWriteBackFuture ); 106 lay->addWidget( mWriteBackFuture );
107 temphb = new QHBox( this ); 107 temphb = new QHBox( this );
108 new QLabel( i18n("Max. weeks in future: ") , temphb ); 108 new QLabel( i18n("Max. weeks in future: ") , temphb );
109 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 109 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
110 mWriteBackFutureWeeks->setValue( 8 ); 110 mWriteBackFutureWeeks->setValue( 8 );
111 lay->addWidget( temphb ); 111 lay->addWidget( temphb );
112 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 112 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
113 lab->setAlignment (AlignHCenter ); 113 lab->setAlignment (AlignHCenter );
114 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 114 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
115 lay->addWidget( ok ); 115 lay->addWidget( ok );
116 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 116 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
117 lay->addWidget( cancel ); 117 lay->addWidget( cancel );
118 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 118 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
119 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 119 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
120 resize( 220, 240 ); 120 resize( 220, 240 );
121 qApp->processEvents(); 121 qApp->processEvents();
122 int dw = QApplication::desktop()->width(); 122 int dw = QApplication::desktop()->width();
123 int dh = QApplication::desktop()->height(); 123 int dh = QApplication::desktop()->height();
124 move( (dw-width())/2, (dh - height() )/2 ); 124 move( (dw-width())/2, (dh - height() )/2 );
125 } 125 }
126 126
127public: 127public:
128 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 128 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
129 QCheckBox* mWriteBackFuture; 129 QCheckBox* mWriteBackFuture;
130 QSpinBox* mWriteBackFutureWeeks; 130 QSpinBox* mWriteBackFutureWeeks;
131}; 131};
132 132
133QPixmap* sgListViewCompletedPix[6]; 133QPixmap* sgListViewCompletedPix[6];
134 134
135 135
136int globalFlagBlockStartup; 136int globalFlagBlockStartup;
137MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 137MainWindow::MainWindow( QWidget *parent, const char *name ) :
138 QMainWindow( parent, name ) 138 QMainWindow( parent, name )
139{ 139{
140 sgListViewCompletedPix[5] = &listviewPix; 140 sgListViewCompletedPix[5] = &listviewPix;
141 sgListViewCompletedPix[0] = &listviewPix0; 141 sgListViewCompletedPix[0] = &listviewPix0;
142 sgListViewCompletedPix[1] = &listviewPix20; 142 sgListViewCompletedPix[1] = &listviewPix20;
143 sgListViewCompletedPix[2] = &listviewPix40; 143 sgListViewCompletedPix[2] = &listviewPix40;
144 sgListViewCompletedPix[3] = &listviewPix60; 144 sgListViewCompletedPix[3] = &listviewPix60;
145 sgListViewCompletedPix[4] = &listviewPix80; 145 sgListViewCompletedPix[4] = &listviewPix80;
146 if ( sgListViewCompletedPix[5]->height() < 5 ) { 146 if ( sgListViewCompletedPix[5]->height() < 5 ) {
147 int size = 12; 147 //int size = 12;
148 sgListViewCompletedPix[5]->resize( 11, 11 ); 148 sgListViewCompletedPix[5]->resize( 11, 11 );
149 sgListViewCompletedPix[5]->fill( Qt::white ); 149 sgListViewCompletedPix[5]->fill( Qt::white );
150 QPainter p ( sgListViewCompletedPix[5] ); 150 QPainter p ( sgListViewCompletedPix[5] );
151 p.drawRect( 0,0,11,11); 151 p.drawRect( 0,0,11,11);
152 int half = size/2;
153 int heihei = size/2;
154 int x = 1;
155 p.drawLine ( 2, 5, 4 , 7 ) ; 152 p.drawLine ( 2, 5, 4 , 7 ) ;
156 p.drawLine ( 4 , 7 , 8, 3) ; 153 p.drawLine ( 4 , 7 , 8, 3) ;
157 int iii = 0; 154 int iii = 0;
158 for ( iii = 0; iii < 5; ++iii ) { 155 for ( iii = 0; iii < 5; ++iii ) {
159 sgListViewCompletedPix[iii]->resize( 11, 11 ); 156 sgListViewCompletedPix[iii]->resize( 11, 11 );
160 sgListViewCompletedPix[iii]->fill( Qt::white ); 157 sgListViewCompletedPix[iii]->fill( Qt::white );
161 QPainter p ( sgListViewCompletedPix[iii] ); 158 QPainter p ( sgListViewCompletedPix[iii] );
162 p.drawRect( 0,0,11,11); 159 p.drawRect( 0,0,11,11);
163 if ( iii ) 160 if ( iii )
164 p.fillRect( 1,1,iii*2,9,Qt::gray ); 161 p.fillRect( 1,1,iii*2,9,Qt::gray );
165 } 162 }
166 } 163 }
167 mClosed = false; 164 mClosed = false;
168 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 165 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
169 QString confFile = locateLocal("config","korganizerrc"); 166 QString confFile = locateLocal("config","korganizerrc");
170 QFileInfo finf ( confFile ); 167 QFileInfo finf ( confFile );
171 bool showWarning = !finf.exists(); 168 bool showWarning = !finf.exists();
172 setIcon(SmallIcon( "ko24" ) ); 169 setIcon(SmallIcon( "ko24" ) );
173 mBlockAtStartup = true; 170 mBlockAtStartup = true;
174 mFlagKeyPressed = false; 171 mFlagKeyPressed = false;
175 setCaption("KO/Pi"); 172 setCaption("KO/Pi");
176 KOPrefs *p = KOPrefs::instance(); 173 KOPrefs *p = KOPrefs::instance();
177 //KPimGlobalPrefs::instance()->setGlobalConfig(); 174 //KPimGlobalPrefs::instance()->setGlobalConfig();
178 p->mCurrentDisplayedView = 0; 175 p->mCurrentDisplayedView = 0;
179 if ( p->mHourSize > 22 ) 176 if ( p->mHourSize > 22 )
180 p->mHourSize = 22; 177 p->mHourSize = 22;
181 QMainWindow::ToolBarDock tbd; 178 QMainWindow::ToolBarDock tbd;
182 if ( p->mToolBarHor ) { 179 if ( p->mToolBarHor ) {
183 if ( p->mToolBarUp ) 180 if ( p->mToolBarUp )
184 tbd = Bottom; 181 tbd = Bottom;
185 else 182 else
186 tbd = Top; 183 tbd = Top;
187 } 184 }
188 else { 185 else {
189 if ( p->mToolBarUp ) 186 if ( p->mToolBarUp )
190 tbd = Right; 187 tbd = Right;
191 else 188 else
192 tbd = Left; 189 tbd = Left;
193 } 190 }
194 if ( KOPrefs::instance()->mUseAppColors ) 191 if ( KOPrefs::instance()->mUseAppColors )
195 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 192 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
196 globalFlagBlockStartup = 1; 193 globalFlagBlockStartup = 1;
197 iconToolBar = new QPEToolBar( this ); 194 iconToolBar = new QPEToolBar( this );
198 addToolBar (iconToolBar , tbd ); 195 addToolBar (iconToolBar , tbd );
199 196
200#ifdef DESKTOP_VERSION 197#ifdef DESKTOP_VERSION
201 if ( KOPrefs::instance()->mShowIconFilter ) 198 if ( KOPrefs::instance()->mShowIconFilter )
202#else 199#else
203 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) 200 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar )
204#endif 201#endif
205 202
206{ 203{
207 if ( p->mToolBarHorF ) { 204 if ( p->mToolBarHorF ) {
208 if ( p->mToolBarUpF ) 205 if ( p->mToolBarUpF )
209 tbd = Bottom; 206 tbd = Bottom;
210 else 207 else
211 tbd = Top; 208 tbd = Top;
212 } 209 }
213 else { 210 else {
214 if ( p->mToolBarUpF ) 211 if ( p->mToolBarUpF )
215 tbd = Right; 212 tbd = Right;
216 else 213 else
217 tbd = Left; 214 tbd = Left;
218 } 215 }
219 filterToolBar = new QPEToolBar ( this ); 216 filterToolBar = new QPEToolBar ( this );
220 filterMenubar = new QMenuBar( 0 ); 217 filterMenubar = new QMenuBar( 0 );
221 QFontMetrics fm ( filterMenubar->font() ); 218 QFontMetrics fm ( filterMenubar->font() );
222 219
223 filterPopupMenu = new QPopupMenu( this ); 220 filterPopupMenu = new QPopupMenu( this );
224 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); 221 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
225 QString addTest = "A"; 222 QString addTest = "A";
226 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); 223 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) );
227#ifdef DESKTOP_VERSION 224#ifdef DESKTOP_VERSION
228 addTest = "AAABBBCCCx"; 225 addTest = "AAABBBCCCx";
229#else 226#else
230 addTest = "AAx"; 227 addTest = "AAx";
231#endif 228#endif
232 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); 229 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) );
233 addToolBar (filterToolBar , tbd ); 230 addToolBar (filterToolBar , tbd );
234 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); 231 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
235 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); 232 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
236 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) 233 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar )
237 filterToolBar->hide(); 234 filterToolBar->hide();
238 } else { 235 } else {
239 filterToolBar = 0; 236 filterToolBar = 0;
240 filterMenubar = 0; 237 filterMenubar = 0;
241 filterPopupMenu = 0; 238 filterPopupMenu = 0;
242 } 239 }
243 if ( p->mShowIconOnetoolbar ) { 240 if ( p->mShowIconOnetoolbar ) {
244 viewToolBar = iconToolBar ; 241 viewToolBar = iconToolBar ;
245 navigatorToolBar = iconToolBar ; 242 navigatorToolBar = iconToolBar ;
246 } else { 243 } else {
247#ifndef DESKTOP_VERSION 244#ifndef DESKTOP_VERSION
248 setToolBarsMovable( false ); 245 setToolBarsMovable( false );
249#endif 246#endif
250 if ( p->mToolBarHorV ) { 247 if ( p->mToolBarHorV ) {
251 if ( p->mToolBarUpV ) 248 if ( p->mToolBarUpV )
252 tbd = Bottom; 249 tbd = Bottom;
253 else 250 else
254 tbd = Top; 251 tbd = Top;
255 } 252 }
256 else { 253 else {
257 if ( p->mToolBarUpV ) 254 if ( p->mToolBarUpV )
258 tbd = Right; 255 tbd = Right;
259 else 256 else
260 tbd = Left; 257 tbd = Left;
261 } 258 }
262 viewToolBar = new QPEToolBar( this ); 259 viewToolBar = new QPEToolBar( this );
263 addToolBar (viewToolBar , tbd ); 260 addToolBar (viewToolBar , tbd );
264 if ( p->mToolBarHorN ) { 261 if ( p->mToolBarHorN ) {
265 if ( p->mToolBarUpN ) 262 if ( p->mToolBarUpN )
266 tbd = Bottom; 263 tbd = Bottom;
267 else 264 else
268 tbd = Top; 265 tbd = Top;
269 } 266 }
270 else { 267 else {
271 if ( p->mToolBarUpN ) 268 if ( p->mToolBarUpN )
272 tbd = Right; 269 tbd = Right;
273 else 270 else
274 tbd = Left; 271 tbd = Left;
275 } 272 }
276 navigatorToolBar = new QPEToolBar( this ); 273 navigatorToolBar = new QPEToolBar( this );
277 addToolBar (navigatorToolBar , tbd ); 274 addToolBar (navigatorToolBar , tbd );
278 } 275 }
279 276
280 277
281 278
282 mCalendarModifiedFlag = false; 279 mCalendarModifiedFlag = false;
283 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 280 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
284 splash->setAlignment ( AlignCenter ); 281 splash->setAlignment ( AlignCenter );
285 setCentralWidget( splash ); 282 setCentralWidget( splash );
286#ifndef DESKTOP_VERSION 283#ifndef DESKTOP_VERSION
287 showMaximized(); 284 showMaximized();
288#endif 285#endif
289 286
290 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 287 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
291 setDefaultPreferences(); 288 setDefaultPreferences();
292 mCalendar = new CalendarLocal(); 289 mCalendar = new CalendarLocal();
293 mView = new CalendarView( mCalendar, this,"mCalendar " ); 290 mView = new CalendarView( mCalendar, this,"mCalendar " );
294 mView->hide(); 291 mView->hide();
295 //mView->resize(splash->size() ); 292 //mView->resize(splash->size() );
296 initActions(); 293 initActions();
297 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 294 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
298 mSyncManager->setBlockSave(false); 295 mSyncManager->setBlockSave(false);
299 mView->setSyncManager(mSyncManager); 296 mView->setSyncManager(mSyncManager);
300#ifndef DESKTOP_VERSION 297#ifndef DESKTOP_VERSION
301 iconToolBar->show(); 298 iconToolBar->show();
302 qApp->processEvents(); 299 qApp->processEvents();
303#endif 300#endif
304 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 301 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
305 int vh = height() ; 302 int vh = height() ;
306 int vw = width(); 303 int vw = width();
307 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 304 //qDebug("Toolbar hei %d ",iconToolBar->height() );
308 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 305 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
309 vh -= iconToolBar->height(); 306 vh -= iconToolBar->height();
310 } else { 307 } else {
311 vw -= iconToolBar->height(); 308 vw -= iconToolBar->height();
312 } 309 }
313 //mView->setMaximumSize( splash->size() ); 310 //mView->setMaximumSize( splash->size() );
314 //mView->resize( splash->size() ); 311 //mView->resize( splash->size() );
315 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 312 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
316 mView->readSettings(); 313 mView->readSettings();
317 bool newFile = false; 314 bool newFile = false;
318 if( !QFile::exists( defaultFileName() ) ) { 315 if( !QFile::exists( defaultFileName() ) ) {
319 QFileInfo finfo ( defaultFileName() ); 316 QFileInfo finfo ( defaultFileName() );
320 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 317 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
321 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; 318 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n";
322 finfo.setFile( oldFile ); 319 finfo.setFile( oldFile );
323 if (finfo.exists() ) { 320 if (finfo.exists() ) {
324 KMessageBox::information( this, message); 321 KMessageBox::information( this, message);
325 mView->openCalendar( oldFile ); 322 mView->openCalendar( oldFile );
326 qApp->processEvents(); 323 qApp->processEvents();
327 } else { 324 } else {
328 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 325 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
329 finfo.setFile( oldFile ); 326 finfo.setFile( oldFile );
330 if (finfo.exists() ) { 327 if (finfo.exists() ) {
331 KMessageBox::information( this, message); 328 KMessageBox::information( this, message);
332 mView->openCalendar( oldFile ); 329 mView->openCalendar( oldFile );
333 qApp->processEvents(); 330 qApp->processEvents();
334 } 331 }
335 } 332 }
336 mView->saveCalendar( defaultFileName() ); 333 mView->saveCalendar( defaultFileName() );
337 newFile = true; 334 newFile = true;
338 } 335 }
339 336
340 QTime neededSaveTime = QDateTime::currentDateTime().time(); 337 QTime neededSaveTime = QDateTime::currentDateTime().time();
341 mView->loadCalendars(); 338 mView->loadCalendars();
342 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 339 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
343 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 340 qDebug("KO: Calendar loading time: %d ms",msNeeded );
344 341
345 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 342 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
346 KOPrefs::instance()->setAllDefaults(); 343 KOPrefs::instance()->setAllDefaults();
347 int count = mView->addCategories();
348 } 344 }
349 processIncidenceSelection( 0 ); 345 processIncidenceSelection( 0 );
350 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 346 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
351 SLOT( processIncidenceSelection( Incidence * ) ) ); 347 SLOT( processIncidenceSelection( Incidence * ) ) );
352 connect( mView, SIGNAL( modifiedChanged( bool ) ), 348 connect( mView, SIGNAL( modifiedChanged( bool ) ),
353 SLOT( slotModifiedChanged( bool ) ) ); 349 SLOT( slotModifiedChanged( bool ) ) );
354 350
355 351
356 connect( mView, SIGNAL( tempDisableBR(bool) ), 352 connect( mView, SIGNAL( tempDisableBR(bool) ),
357 SLOT( disableBR(bool) ) ); 353 SLOT( disableBR(bool) ) );
358 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 354 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
359 mView->setModified( false ); 355 mView->setModified( false );
360 mBlockAtStartup = false; 356 mBlockAtStartup = false;
361 mView->setModified( false ); 357 mView->setModified( false );
362 setCentralWidget( mView ); 358 setCentralWidget( mView );
363 globalFlagBlockStartup = 0; 359 globalFlagBlockStartup = 0;
364 mView->show(); 360 mView->show();
365 delete splash; 361 delete splash;
366 if ( newFile ) 362 if ( newFile )
367 mView->updateConfig(); 363 mView->updateConfig();
368 // qApp->processEvents(); 364 // qApp->processEvents();
369 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 365 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
370 //fillSyncMenu(); 366 //fillSyncMenu();
371 367
372 368
373 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 369 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
374 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 370 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
375 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 371 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
376 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 372 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
377 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 373 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
378 mSyncManager->setDefaultFileName( sentSyncFile()); 374 mSyncManager->setDefaultFileName( sentSyncFile());
379 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 375 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
380 mSyncManager->fillSyncMenu(); 376 mSyncManager->fillSyncMenu();
381 377
382 378
383 379
384 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 380 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
385 if ( showWarning ) { 381 if ( showWarning ) {
386 KMessageBox::information( this, 382 KMessageBox::information( this,
387 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 383 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
388 qApp->processEvents(); 384 qApp->processEvents();
389 mView->dialogManager()->showSyncOptions(); 385 mView->dialogManager()->showSyncOptions();
390 } 386 }
391 387
392 //US listen for result adressed from Ka/Pi 388 //US listen for result adressed from Ka/Pi
393#ifndef DESKTOP_VERSION 389#ifndef DESKTOP_VERSION
394 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 390 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
395#endif 391#endif
396#ifndef DESKTOP_VERSION 392#ifndef DESKTOP_VERSION
397 infrared = 0; 393 infrared = 0;
398#endif 394#endif
399 updateFilterToolbar(); 395 updateFilterToolbar();
400 updateWeek( mView->startDate() ); 396 updateWeek( mView->startDate() );
401 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 397 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
402 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 398 SLOT( updateWeekNum( const KCal::DateList & ) ) );
403 mBRdisabled = false; 399 mBRdisabled = false;
404 //toggleBeamReceive(); 400 //toggleBeamReceive();
405 int tiint= 3000; 401 int tiint= 3000;
406#ifndef DESKTOP_VERSION 402#ifndef DESKTOP_VERSION
407 tiint = 5000; 403 tiint = 5000;
408#endif 404#endif
409 QTimer::singleShot( tiint, mView, SLOT ( checkAlarms() )); 405 QTimer::singleShot( tiint, mView, SLOT ( checkAlarms() ));
410} 406}
411MainWindow::~MainWindow() 407MainWindow::~MainWindow()
412{ 408{
413 //qDebug("MainWindow::~MainWindow() "); 409 //qDebug("MainWindow::~MainWindow() ");
414 //save toolbar location 410 //save toolbar location
415 delete mCalendar; 411 delete mCalendar;
416 delete mSyncManager; 412 delete mSyncManager;
417#ifndef DESKTOP_VERSION 413#ifndef DESKTOP_VERSION
418 if ( infrared ) 414 if ( infrared )
419 delete infrared; 415 delete infrared;
420#endif 416#endif
421 417
422 418
423} 419}
424 420
425void MainWindow::disableBR(bool b) 421void MainWindow::disableBR(bool b)
426{ 422{
427#ifndef DESKTOP_VERSION 423#ifndef DESKTOP_VERSION
428 if ( b ) { 424 if ( b ) {
429 if ( infrared ) { 425 if ( infrared ) {
430 toggleBeamReceive(); 426 toggleBeamReceive();
431 mBRdisabled = true; 427 mBRdisabled = true;
432 } 428 }
433 mBRdisabled = true; 429 mBRdisabled = true;
434 } else { 430 } else {
435 if ( mBRdisabled ) { 431 if ( mBRdisabled ) {
436 mBRdisabled = false; 432 mBRdisabled = false;
437 //makes no sense,because other cal ap is probably running 433 //makes no sense,because other cal ap is probably running
438 // toggleBeamReceive(); 434 // toggleBeamReceive();
439 } 435 }
440 } 436 }
441#endif 437#endif
442 438
443} 439}
444bool MainWindow::beamReceiveEnabled() 440bool MainWindow::beamReceiveEnabled()
445{ 441{
446#ifndef DESKTOP_VERSION 442#ifndef DESKTOP_VERSION
447 return ( infrared != 0 ); 443 return ( infrared != 0 );
448#endif 444#endif
449 return false; 445 return false;
450} 446}
451 447
452void MainWindow::toggleBeamReceive() 448void MainWindow::toggleBeamReceive()
453{ 449{
454 if ( mBRdisabled ) 450 if ( mBRdisabled )
455 return; 451 return;
456#ifndef DESKTOP_VERSION 452#ifndef DESKTOP_VERSION
457 if ( infrared ) { 453 if ( infrared ) {
458 qDebug("KO: Disable BeamReceive "); 454 qDebug("KO: Disable BeamReceive ");
459 delete infrared; 455 delete infrared;
460 infrared = 0; 456 infrared = 0;
461 brAction->setOn(false); 457 brAction->setOn(false);
462 return; 458 return;
463 } 459 }
464 qDebug("KO: Enable BeamReceive "); 460 qDebug("KO: Enable BeamReceive ");
465 brAction->setOn(true); 461 brAction->setOn(true);
466 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 462 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
467 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 463 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
468#endif 464#endif
469} 465}
470void MainWindow::showMaximized () 466void MainWindow::showMaximized ()
471{ 467{
472#ifndef DESKTOP_VERSION 468#ifndef DESKTOP_VERSION
473 if ( ! globalFlagBlockStartup ) 469 if ( ! globalFlagBlockStartup )
474 if ( mClosed ) 470 if ( mClosed )
475 mView->goToday(); 471 mView->goToday();
476#endif 472#endif
477 QWidget::showMaximized () ; 473 QWidget::showMaximized () ;
478 mClosed = false; 474 mClosed = false;
479} 475}
480void MainWindow::closeEvent( QCloseEvent* ce ) 476void MainWindow::closeEvent( QCloseEvent* ce )
481{ 477{
482 478
483 479
484 480
485 if ( ! KOPrefs::instance()->mAskForQuit ) { 481 if ( ! KOPrefs::instance()->mAskForQuit ) {
486 saveOnClose(); 482 saveOnClose();
487 mClosed = true; 483 mClosed = true;
488 ce->accept(); 484 ce->accept();
489 return; 485 return;
490 486
491 } 487 }
492 488
493 switch( QMessageBox::information( this, "KO/Pi", 489 switch( QMessageBox::information( this, "KO/Pi",
494 i18n("Do you really want\nto close KO/Pi?"), 490 i18n("Do you really want\nto close KO/Pi?"),
495 i18n("Close"), i18n("No"), 491 i18n("Close"), i18n("No"),
496 0, 0 ) ) { 492 0, 0 ) ) {
497 case 0: 493 case 0:
498 saveOnClose(); 494 saveOnClose();
499 mClosed = true; 495 mClosed = true;
500 ce->accept(); 496 ce->accept();
501 break; 497 break;
502 case 1: 498 case 1:
503 ce->ignore(); 499 ce->ignore();
504 break; 500 break;
505 case 2: 501 case 2:
506 502
507 default: 503 default:
508 break; 504 break;
509 } 505 }
510 506
511 507
512} 508}
513 509
514void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 510void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
515{ 511{
516 QDataStream stream( data, IO_ReadOnly ); 512 QDataStream stream( data, IO_ReadOnly );
517 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 513 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
518 //QString datamess; 514 //QString datamess;
519 //qDebug("message "); 515 //qDebug("message ");
520 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 516 qDebug("KO: QCOP message received: %s ", cmsg.data() );
521 517
522 if ( cmsg == "setDocument(QString)" ) { 518 if ( cmsg == "setDocument(QString)" ) {
523 QDataStream stream( data, IO_ReadOnly ); 519 QDataStream stream( data, IO_ReadOnly );
524 QString fileName; 520 QString fileName;
525 stream >> fileName; 521 stream >> fileName;
526 //qDebug("filename %s ", fileName.latin1()); 522 //qDebug("filename %s ", fileName.latin1());
527 showMaximized(); 523 showMaximized();
528 raise(); 524 raise();
529 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 525 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
530 mSyncManager->slotSyncMenu( 1002 ); 526 mSyncManager->slotSyncMenu( 1002 );
531 return; 527 return;
532 } 528 }
533 529
534 if ( cmsg == "-writeFile" ) { 530 if ( cmsg == "-writeFile" ) {
535 // I made from the "-writeFile" an "-writeAlarm" 531 // I made from the "-writeFile" an "-writeAlarm"
536 mView->viewManager()->showWhatsNextView(); 532 mView->viewManager()->showWhatsNextView();
537 mCalendar->checkAlarmForIncidence( 0, true); 533 mCalendar->checkAlarmForIncidence( 0, true);
538 showMaximized(); 534 showMaximized();
539 raise(); 535 raise();
540 return; 536 return;
541 537
542 } 538 }
543 if ( cmsg == "-writeFileSilent" ) { 539 if ( cmsg == "-writeFileSilent" ) {
544 // I made from the "-writeFile" an "-writeAlarm" 540 // I made from the "-writeFile" an "-writeAlarm"
545 // mView->viewManager()->showWhatsNextView(); 541 // mView->viewManager()->showWhatsNextView();
546 mCalendar->checkAlarmForIncidence( 0, true); 542 mCalendar->checkAlarmForIncidence( 0, true);
547 //showMaximized(); 543 //showMaximized();
548 //raise(); 544 //raise();
549 hide(); 545 hide();
550 return; 546 return;
551 } 547 }
552 if ( cmsg == "-newCountdown" ) { 548 if ( cmsg == "-newCountdown" ) {
553 qDebug("newCountdown "); 549 qDebug("newCountdown ");
554 550
555 } 551 }
556 QString msg ; 552 QString msg ;
557 QString allmsg = cmsg; 553 QString allmsg = cmsg;
558 while ( allmsg.length() > 0 ) { 554 while ( allmsg.length() > 0 ) {
559 int nextC = allmsg.find( "-", 1 ); 555 int nextC = allmsg.find( "-", 1 );
560 if ( nextC == -1 ) { 556 if ( nextC == -1 ) {
561 msg = allmsg; 557 msg = allmsg;
562 allmsg = ""; 558 allmsg = "";
563 } else{ 559 } else{
564 msg = allmsg.left( nextC ); 560 msg = allmsg.left( nextC );
565 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 561 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
566 } 562 }
567 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 563 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
568 if ( msg == "-newEvent" ) { 564 if ( msg == "-newEvent" ) {
569 QTimer::singleShot( 0, mView, SLOT ( newEvent())); 565 QTimer::singleShot( 0, mView, SLOT ( newEvent()));
570 } 566 }
571 if ( msg == "-newTodo" ) { 567 if ( msg == "-newTodo" ) {
572 QTimer::singleShot( 0, mView, SLOT ( newTodo())); 568 QTimer::singleShot( 0, mView, SLOT ( newTodo()));
573 } 569 }
574 if ( msg == "-showWN" ) { 570 if ( msg == "-showWN" ) {
575 mView->viewManager()->showWhatsNextView(); 571 mView->viewManager()->showWhatsNextView();
576 } 572 }
577 if ( msg == "-showTodo" ) { 573 if ( msg == "-showTodo" ) {
578 mView->viewManager()->showTodoView(); 574 mView->viewManager()->showTodoView();
579 } 575 }
580 if ( msg == "-showList" ) { 576 if ( msg == "-showList" ) {
581 mView->viewManager()->showListView(); 577 mView->viewManager()->showListView();
582 } 578 }
583 else if ( msg == "-showDay" ) { 579 else if ( msg == "-showDay" ) {
584 mView->viewManager()->showDayView(); 580 mView->viewManager()->showDayView();
585 } 581 }
586 else if ( msg == "-showWWeek" ) { 582 else if ( msg == "-showWWeek" ) {
587 mView->viewManager()->showWorkWeekView(); 583 mView->viewManager()->showWorkWeekView();
588 } 584 }
589 else if ( msg == "-ringSync" ) { 585 else if ( msg == "-ringSync" ) {
590 QTimer::singleShot( 0, this, SLOT (startMultiSync())); 586 QTimer::singleShot( 0, this, SLOT (startMultiSync()));
591 } 587 }
592 else if ( msg == "-showWeek" ) { 588 else if ( msg == "-showWeek" ) {
593 mView->viewManager()->showWeekView(); 589 mView->viewManager()->showWeekView();
594 } 590 }
595 else if ( msg == "-showTodo" ) { 591 else if ( msg == "-showTodo" ) {
596 mView->viewManager()->showTodoView(); 592 mView->viewManager()->showTodoView();
597 } 593 }
598 else if ( msg == "-showJournal" ) { 594 else if ( msg == "-showJournal" ) {
599 mView->dateNavigator()->selectDates( 1 ); 595 mView->dateNavigator()->selectDates( 1 );
600 mView->dateNavigator()->selectToday(); 596 mView->dateNavigator()->selectToday();
601 mView->viewManager()->showJournalView(); 597 mView->viewManager()->showJournalView();
602 } 598 }
603 else if ( msg == "-showKO" ) { 599 else if ( msg == "-showKO" ) {
604 mView->viewManager()->showNextXView(); 600 mView->viewManager()->showNextXView();
605 } 601 }
606 else if ( msg == "-showWNext" ) { 602 else if ( msg == "-showWNext" ) {
607 mView->viewManager()->showWhatsNextView(); 603 mView->viewManager()->showWhatsNextView();
608 } 604 }
609 else if ( msg == "nextView()" ) { 605 else if ( msg == "nextView()" ) {
610 mView->viewManager()->showNextView(); 606 mView->viewManager()->showNextView();
611 } 607 }
612 else if ( msg == "-showNextXView" ) { 608 else if ( msg == "-showNextXView" ) {
613 mView->viewManager()->showNextXView(); 609 mView->viewManager()->showNextXView();
614 } 610 }
615 611
616 612
617 } 613 }
618 614
619 showMaximized(); 615 showMaximized();
620 raise(); 616 raise();
621} 617}
622void MainWindow::startMultiSync() 618void MainWindow::startMultiSync()
623{ 619{
624 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 620 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
625 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), 621 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"),
626 question, 622 question,
627 i18n("Yes"), i18n("No"), 623 i18n("Yes"), i18n("No"),
628 0, 0 ) != 0 ) { 624 0, 0 ) != 0 ) {
629 setCaption(i18n("Aborted! Nothing synced!")); 625 setCaption(i18n("Aborted! Nothing synced!"));
630 return; 626 return;
631 } 627 }
632 mSyncManager->multiSync( false ); 628 mSyncManager->multiSync( false );
633#ifndef DESKTOP_VERSION 629#ifndef DESKTOP_VERSION
634 QCopEnvelope e("QPE/Application/kapi", "doRingSync"); 630 QCopEnvelope e("QPE/Application/kapi", "doRingSync");
635#endif 631#endif
636} 632}
637QPixmap MainWindow::loadPixmap( QString name ) 633QPixmap MainWindow::loadPixmap( QString name )
638{ 634{
639 return SmallIcon( name ); 635 return SmallIcon( name );
640 636
641} 637}
642void MainWindow::setUsesBigPixmaps ( bool b ) 638void MainWindow::setUsesBigPixmaps ( bool b )
643{ 639{
644 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); 640 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b);
645 if ( b ) 641 if ( b )
646 qDebug("KO: BigPixmaps are not supported "); 642 qDebug("KO: BigPixmaps are not supported ");
647} 643}
648void MainWindow::initActions() 644void MainWindow::initActions()
649{ 645{
650 //KOPrefs::instance()->mShowFullMenu 646 //KOPrefs::instance()->mShowFullMenu
651 iconToolBar->clear(); 647 iconToolBar->clear();
652 KOPrefs *p = KOPrefs::instance(); 648 KOPrefs *p = KOPrefs::instance();
653 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 649 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
654 650
655 QPopupMenu *viewMenu = new QPopupMenu( this ); 651 QPopupMenu *viewMenu = new QPopupMenu( this );
656 QPopupMenu *actionMenu = new QPopupMenu( this ); 652 QPopupMenu *actionMenu = new QPopupMenu( this );
657 mCurrentItemMenu = new QPopupMenu ( this ); 653 mCurrentItemMenu = new QPopupMenu ( this );
658 QPopupMenu *importMenu = new QPopupMenu( this ); 654 QPopupMenu *importMenu = new QPopupMenu( this );
659 QPopupMenu *importMenu_X = new QPopupMenu( this ); 655 QPopupMenu *importMenu_X = new QPopupMenu( this );
660 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 656 QPopupMenu *exportMenu_X = new QPopupMenu( this );
661 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 657 QPopupMenu *beamMenu_X = new QPopupMenu( this );
662 selectFilterMenu = new QPopupMenu( this ); 658 selectFilterMenu = new QPopupMenu( this );
663 selectFilterMenu->setCheckable( true ); 659 selectFilterMenu->setCheckable( true );
664 syncMenu = new QPopupMenu( this ); 660 syncMenu = new QPopupMenu( this );
665 configureAgendaMenu = new QPopupMenu( this ); 661 configureAgendaMenu = new QPopupMenu( this );
666 configureToolBarMenu = new QPopupMenu( this ); 662 configureToolBarMenu = new QPopupMenu( this );
667 QPopupMenu *helpMenu = new QPopupMenu( this ); 663 QPopupMenu *helpMenu = new QPopupMenu( this );
668 QIconSet icon; 664 QIconSet icon;
669 int pixWid = 22, pixHei = 22; 665 int pixWid = 22, pixHei = 22;
670 QString pathString = ""; 666 QString pathString = "";
671 if ( !p->mToolBarMiniIcons ) { 667 if ( !p->mToolBarMiniIcons ) {
672 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { 668 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) {
673 pathString += "icons16/"; 669 pathString += "icons16/";
674 pixWid = 18; pixHei = 16; 670 pixWid = 18; pixHei = 16;
675 } 671 }
676 } else { 672 } else {
677 pathString += "iconsmini/"; 673 pathString += "iconsmini/";
678 pixWid = 18; pixHei = 16; 674 pixWid = 18; pixHei = 16;
679 } 675 }
680 if ( KOPrefs::instance()->mShowFullMenu ) { 676 if ( KOPrefs::instance()->mShowFullMenu ) {
681 QMenuBar *menuBar1; 677 QMenuBar *menuBar1;
682 menuBar1 = menuBar(); 678 menuBar1 = menuBar();
683 menuBar1->insertItem( i18n("File"), importMenu ); 679 menuBar1->insertItem( i18n("File"), importMenu );
684 menuBar1->insertItem( i18n("View"), viewMenu ); 680 menuBar1->insertItem( i18n("View"), viewMenu );
685 menuBar1->insertItem( i18n("Actions"), actionMenu ); 681 menuBar1->insertItem( i18n("Actions"), actionMenu );
686#ifdef DESKTOP_VERSION 682#ifdef DESKTOP_VERSION
687 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 683 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
688 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 684 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
689#else 685#else
690 menuBar1->insertItem( i18n("Sync"), syncMenu ); 686 menuBar1->insertItem( i18n("Sync"), syncMenu );
691 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 687 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
692#endif 688#endif
693 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 689 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
694 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 690 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
695 menuBar1->insertItem( i18n("Help"), helpMenu ); 691 menuBar1->insertItem( i18n("Help"), helpMenu );
696 } else { 692 } else {
697 QPEMenuBar *menuBar1; 693 QPEMenuBar *menuBar1;
698 menuBar1 = new QPEMenuBar( iconToolBar ); 694 menuBar1 = new QPEMenuBar( iconToolBar );
699 QPopupMenu *menuBar = new QPopupMenu( this ); 695 QPopupMenu *menuBar = new QPopupMenu( this );
700 icon = loadPixmap( pathString + "z_menu" ); 696 icon = loadPixmap( pathString + "z_menu" );
701 menuBar1->insertItem( icon.pixmap(), menuBar); 697 menuBar1->insertItem( icon.pixmap(), menuBar);
702 //menuBar1->insertItem( i18n("ME"), menuBar); 698 //menuBar1->insertItem( i18n("ME"), menuBar);
703 menuBar->insertItem( i18n("File"), importMenu ); 699 menuBar->insertItem( i18n("File"), importMenu );
704 menuBar->insertItem( i18n("View"), viewMenu ); 700 menuBar->insertItem( i18n("View"), viewMenu );
705 menuBar->insertItem( i18n("Actions"), actionMenu ); 701 menuBar->insertItem( i18n("Actions"), actionMenu );
706 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 702 menuBar->insertItem( i18n("Synchronize"), syncMenu );
707 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 703 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
708 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 704 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
709 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 705 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
710 menuBar->insertItem( i18n("Help"), helpMenu ); 706 menuBar->insertItem( i18n("Help"), helpMenu );
711 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 707 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
712 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 708 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
713 } 709 }
714 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 710 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
715 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 711 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
716 712
717 713
718 mWeekBgColor = iconToolBar->backgroundColor(); 714 mWeekBgColor = iconToolBar->backgroundColor();
719 mWeekPixmap.resize( pixWid , pixHei ); 715 mWeekPixmap.resize( pixWid , pixHei );
720 mWeekPixmap.fill( mWeekBgColor ); 716 mWeekPixmap.fill( mWeekBgColor );
721 icon = mWeekPixmap; 717 icon = mWeekPixmap;
722 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 718 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
723 if ( p-> mShowIconWeekNum ) 719 if ( p-> mShowIconWeekNum )
724 mWeekAction->addTo( iconToolBar ); 720 mWeekAction->addTo( iconToolBar );
725 mWeekFont = font(); 721 mWeekFont = font();
726 722
727 int fontPoint = mWeekFont.pointSize(); 723 int fontPoint = mWeekFont.pointSize();
728 QFontMetrics f( mWeekFont ); 724 QFontMetrics f( mWeekFont );
729 int fontWid = f.width( "30" ); 725 int fontWid = f.width( "30" );
730 while ( fontWid > pixWid ) { 726 while ( fontWid > pixWid ) {
731 --fontPoint; 727 --fontPoint;
732 mWeekFont.setPointSize( fontPoint ); 728 mWeekFont.setPointSize( fontPoint );
733 QFontMetrics f( mWeekFont ); 729 QFontMetrics f( mWeekFont );
734 fontWid = f.width( "30" ); 730 fontWid = f.width( "30" );
735 //qDebug("dec-- "); 731 //qDebug("dec-- ");
736 } 732 }
737 733
738 connect( mWeekAction, SIGNAL( activated() ), 734 connect( mWeekAction, SIGNAL( activated() ),
739 this, SLOT( weekAction() ) ); 735 this, SLOT( weekAction() ) );
740 736
741 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 737 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
742 if ( p->mShowIconFilterview ) { 738 if ( p->mShowIconFilterview ) {
743 icon = loadPixmap( pathString + "filter" ); 739 icon = loadPixmap( pathString + "filter" );
744 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 740 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
745 connect( actionFilterMenuTB, SIGNAL( activated() ), 741 connect( actionFilterMenuTB, SIGNAL( activated() ),
746 this, SLOT( fillFilterMenuTB() ) ); 742 this, SLOT( fillFilterMenuTB() ) );
747 actionFilterMenuTB->addTo( iconToolBar ); 743 actionFilterMenuTB->addTo( iconToolBar );
748 selectFilterMenuTB = new QPopupMenu( this ); 744 selectFilterMenuTB = new QPopupMenu( this );
749 selectFilterMenuTB->setCheckable( true ); 745 selectFilterMenuTB->setCheckable( true );
750 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 746 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
751 } 747 }
752 748
753 //#endif 749 //#endif
754 // ****************** 750 // ******************
755 QAction *action; 751 QAction *action;
756 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 752 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
757 configureToolBarMenu->setCheckable( true ); 753 configureToolBarMenu->setCheckable( true );
758 754
759 755
760 configureAgendaMenu->setCheckable( true ); 756 configureAgendaMenu->setCheckable( true );
761 int iii ; 757 int iii ;
762 for ( iii = 1;iii<= 10 ;++iii ){ 758 for ( iii = 1;iii<= 10 ;++iii ){
763 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 759 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
764 } 760 }
765 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 761 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
766 762
767 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 763 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
768 this, SLOT( showConfigureAgenda( ) ) ); 764 this, SLOT( showConfigureAgenda( ) ) );
769 icon = loadPixmap( pathString + "today" ); 765 icon = loadPixmap( pathString + "today" );
770 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 766 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
771 today_action->addTo( actionMenu ); 767 today_action->addTo( actionMenu );
772 connect( today_action, SIGNAL( activated() ), 768 connect( today_action, SIGNAL( activated() ),
773 mView, SLOT( goToday() ) ); 769 mView, SLOT( goToday() ) );
774 770
775 icon = loadPixmap( pathString + "picker" ); 771 icon = loadPixmap( pathString + "picker" );
776 QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this ); 772 QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this );
777 dPickerAction->addTo( actionMenu ); 773 dPickerAction->addTo( actionMenu );
778 connect( dPickerAction, SIGNAL( activated() ), 774 connect( dPickerAction, SIGNAL( activated() ),
779 mView, SLOT( showDatePicker() ) ); 775 mView, SLOT( showDatePicker() ) );
780 776
781 icon = loadPixmap( pathString + "search" ); 777 icon = loadPixmap( pathString + "search" );
782 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 778 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
783 search_action->addTo( actionMenu ); 779 search_action->addTo( actionMenu );
784 connect( search_action, SIGNAL( activated() ), 780 connect( search_action, SIGNAL( activated() ),
785 mView->dialogManager(), SLOT( showSearchDialog() ) ); 781 mView->dialogManager(), SLOT( showSearchDialog() ) );
786 782
787 actionMenu->insertSeparator(); 783 actionMenu->insertSeparator();
788 784
789 785
790 786
791 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 787 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
792 action->addTo( actionMenu ); 788 action->addTo( actionMenu );
793 connect( action, SIGNAL( activated() ), 789 connect( action, SIGNAL( activated() ),
794 mView, SLOT( undo_delete() ) ); 790 mView, SLOT( undo_delete() ) );
795 791
796 icon = loadPixmap( pathString + "newevent" ); 792 icon = loadPixmap( pathString + "newevent" );
797 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 793 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
798 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); 794 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
799 configureToolBarMenu->insertSeparator(); 795 configureToolBarMenu->insertSeparator();
800 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); 796 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
801 configureToolBarMenu->insertSeparator(); 797 configureToolBarMenu->insertSeparator();
802 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 798 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
803 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 799 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
804 800
805 actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); 801 actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu);
806 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 802 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
807 mShowAction->addTo( mCurrentItemMenu ); 803 mShowAction->addTo( mCurrentItemMenu );
808 connect( mShowAction, SIGNAL( activated() ), 804 connect( mShowAction, SIGNAL( activated() ),
809 mView, SLOT( showIncidence() ) ); 805 mView, SLOT( showIncidence() ) );
810 806
811 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 807 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
812 mEditAction->addTo( mCurrentItemMenu ); 808 mEditAction->addTo( mCurrentItemMenu );
813 connect( mEditAction, SIGNAL( activated() ), 809 connect( mEditAction, SIGNAL( activated() ),
814 mView, SLOT( editIncidence() ) ); 810 mView, SLOT( editIncidence() ) );
815 811
816 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 812 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
817 mDeleteAction->addTo( mCurrentItemMenu ); 813 mDeleteAction->addTo( mCurrentItemMenu );
818 connect( mDeleteAction, SIGNAL( activated() ), 814 connect( mDeleteAction, SIGNAL( activated() ),
819 mView, SLOT( deleteIncidence() ) ); 815 mView, SLOT( deleteIncidence() ) );
820 816
821 817
822 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 818 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
823 mCloneAction->addTo( mCurrentItemMenu ); 819 mCloneAction->addTo( mCurrentItemMenu );
824 connect( mCloneAction, SIGNAL( activated() ), 820 connect( mCloneAction, SIGNAL( activated() ),
825 mView, SLOT( cloneIncidence() ) ); 821 mView, SLOT( cloneIncidence() ) );
826 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 822 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
827 mMoveAction->addTo( mCurrentItemMenu ); 823 mMoveAction->addTo( mCurrentItemMenu );
828 connect( mMoveAction, SIGNAL( activated() ), 824 connect( mMoveAction, SIGNAL( activated() ),
829 mView, SLOT( moveIncidence() ) ); 825 mView, SLOT( moveIncidence() ) );
830 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 826 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
831 mBeamAction->addTo(mCurrentItemMenu ); 827 mBeamAction->addTo(mCurrentItemMenu );
832 connect( mBeamAction, SIGNAL( activated() ), 828 connect( mBeamAction, SIGNAL( activated() ),
833 mView, SLOT( beamIncidence() ) ); 829 mView, SLOT( beamIncidence() ) );
834 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 830 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
835 mCancelAction->addTo( mCurrentItemMenu ); 831 mCancelAction->addTo( mCurrentItemMenu );
836 connect( mCancelAction, SIGNAL( activated() ), 832 connect( mCancelAction, SIGNAL( activated() ),
837 mView, SLOT( toggleCancelIncidence() ) ); 833 mView, SLOT( toggleCancelIncidence() ) );
838#ifdef DESKTOP_VERSION 834#ifdef DESKTOP_VERSION
839 actionMenu->insertSeparator(); 835 actionMenu->insertSeparator();
840#endif 836#endif
841 837
842 838
843 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 839 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
844 ne_action->addTo( actionMenu ); 840 ne_action->addTo( actionMenu );
845 connect( ne_action, SIGNAL( activated() ), 841 connect( ne_action, SIGNAL( activated() ),
846 mView, SLOT( newEvent() ) ); 842 mView, SLOT( newEvent() ) );
847 icon = loadPixmap( pathString + "newtodo" ); 843 icon = loadPixmap( pathString + "newtodo" );
848 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 844 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
849 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 845 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
850 nt_action->addTo( actionMenu ); 846 nt_action->addTo( actionMenu );
851 connect( nt_action, SIGNAL( activated() ), 847 connect( nt_action, SIGNAL( activated() ),
852 mView, SLOT( newTodo() ) ); 848 mView, SLOT( newTodo() ) );
853 849
854 850
855 851
856 // *********************** 852 // ***********************
857 if ( KOPrefs::instance()->mVerticalScreen ) { 853 if ( KOPrefs::instance()->mVerticalScreen ) {
858 icon = SmallIcon( "1updownarrow" ); 854 icon = SmallIcon( "1updownarrow" );
859 } else { 855 } else {
@@ -1346,1249 +1342,1248 @@ void MainWindow::initActions()
1346 } 1342 }
1347 else { 1343 else {
1348 iconToolBar->setHorizontalStretchable (true ); 1344 iconToolBar->setHorizontalStretchable (true );
1349 viewToolBar->setHorizontalStretchable (true ); 1345 viewToolBar->setHorizontalStretchable (true );
1350 navigatorToolBar->setHorizontalStretchable (true ); 1346 navigatorToolBar->setHorizontalStretchable (true );
1351 iconToolBar->setVerticalStretchable (true ); 1347 iconToolBar->setVerticalStretchable (true );
1352 viewToolBar->setVerticalStretchable (true ); 1348 viewToolBar->setVerticalStretchable (true );
1353 navigatorToolBar->setVerticalStretchable (true ); 1349 navigatorToolBar->setVerticalStretchable (true );
1354 configureToolBarMenu->setItemChecked( 5, true ); 1350 configureToolBarMenu->setItemChecked( 5, true );
1355 } 1351 }
1356 if (p-> mShowIconFilter) 1352 if (p-> mShowIconFilter)
1357 configureToolBarMenu->setItemChecked( 7, true ); 1353 configureToolBarMenu->setItemChecked( 7, true );
1358 if (p-> mShowIconOnetoolbar) 1354 if (p-> mShowIconOnetoolbar)
1359 configureToolBarMenu->setItemChecked( 6, true ); 1355 configureToolBarMenu->setItemChecked( 6, true );
1360 1356
1361 1357
1362 if ( filterMenubar ) { 1358 if ( filterMenubar ) {
1363 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); 1359 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) );
1364 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) ); 1360 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) );
1365 } 1361 }
1366 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1362 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1367 configureAgenda( p->mHourSize ); 1363 configureAgenda( p->mHourSize );
1368 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1364 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1369} 1365}
1370 1366
1371void MainWindow::exportToPhone( int mode ) 1367void MainWindow::exportToPhone( int mode )
1372{ 1368{
1373 1369
1374 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1370 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1375 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1371 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1376 KOex2phonePrefs ex2phone; 1372 KOex2phonePrefs ex2phone;
1377 1373
1378 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1374 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1379 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1375 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1380 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1376 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1381 if ( mode == 1 ) 1377 if ( mode == 1 )
1382 ex2phone.setCaption(i18n("Export complete calendar")); 1378 ex2phone.setCaption(i18n("Export complete calendar"));
1383 if ( mode == 2 ) 1379 if ( mode == 2 )
1384 ex2phone.setCaption(i18n("Export filtered calendar")); 1380 ex2phone.setCaption(i18n("Export filtered calendar"));
1385 1381
1386 if ( !ex2phone.exec() ) { 1382 if ( !ex2phone.exec() ) {
1387 return; 1383 return;
1388 } 1384 }
1389 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1385 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1390 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1386 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1391 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1387 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1392 1388
1393 int inFuture = 0; 1389 int inFuture = 0;
1394 if ( ex2phone.mWriteBackFuture->isChecked() ) 1390 if ( ex2phone.mWriteBackFuture->isChecked() )
1395 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1391 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1396 QPtrList<Incidence> delSel; 1392 QPtrList<Incidence> delSel;
1397 if ( mode == 1 ) 1393 if ( mode == 1 )
1398 delSel = mCalendar->rawIncidences(); 1394 delSel = mCalendar->rawIncidences();
1399 if ( mode == 2 ) 1395 if ( mode == 2 )
1400 delSel = mCalendar->incidences(); 1396 delSel = mCalendar->incidences();
1401 CalendarLocal* cal = new CalendarLocal(); 1397 CalendarLocal* cal = new CalendarLocal();
1402 cal->setLocalTime(); 1398 cal->setLocalTime();
1403 Incidence *incidence = delSel.first(); 1399 Incidence *incidence = delSel.first();
1404 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1400 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1405 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1401 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1406 while ( incidence ) { 1402 while ( incidence ) {
1407 if ( incidence->typeID() != journalID ) { 1403 if ( incidence->typeID() != journalID ) {
1408 bool add = true; 1404 bool add = true;
1409 if ( inFuture ) { 1405 if ( inFuture ) {
1410 QDateTime dt; 1406 QDateTime dt;
1411 if ( incidence->typeID() == todoID ) { 1407 if ( incidence->typeID() == todoID ) {
1412 Todo * t = (Todo*)incidence; 1408 Todo * t = (Todo*)incidence;
1413 if ( t->hasDueDate() ) 1409 if ( t->hasDueDate() )
1414 dt = t->dtDue(); 1410 dt = t->dtDue();
1415 else 1411 else
1416 dt = cur.addSecs( 62 ); 1412 dt = cur.addSecs( 62 );
1417 } 1413 }
1418 else { 1414 else {
1419 bool ok; 1415 bool ok;
1420 dt = incidence->getNextOccurence( cur, &ok ); 1416 dt = incidence->getNextOccurence( cur, &ok );
1421 if ( !ok ) 1417 if ( !ok )
1422 dt = cur.addSecs( -62 ); 1418 dt = cur.addSecs( -62 );
1423 } 1419 }
1424 if ( dt < cur || dt > end ) { 1420 if ( dt < cur || dt > end ) {
1425 add = false; 1421 add = false;
1426 } 1422 }
1427 } 1423 }
1428 if ( add ) { 1424 if ( add ) {
1429 Incidence *in = incidence->clone(); 1425 Incidence *in = incidence->clone();
1430 cal->addIncidence( in ); 1426 cal->addIncidence( in );
1431 } 1427 }
1432 } 1428 }
1433 incidence = delSel.next(); 1429 incidence = delSel.next();
1434 } 1430 }
1435 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1431 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1436 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1432 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1437 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1433 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1438 1434
1439 setCaption( i18n("Writing to phone...")); 1435 setCaption( i18n("Writing to phone..."));
1440 if ( PhoneFormat::writeToPhone( cal ) ) 1436 if ( PhoneFormat::writeToPhone( cal ) )
1441 setCaption( i18n("Export to phone successful!")); 1437 setCaption( i18n("Export to phone successful!"));
1442 else 1438 else
1443 setCaption( i18n("Error exporting to phone!")); 1439 setCaption( i18n("Error exporting to phone!"));
1444 delete cal; 1440 delete cal;
1445} 1441}
1446 1442
1447 1443
1448void MainWindow::setDefaultPreferences() 1444void MainWindow::setDefaultPreferences()
1449{ 1445{
1450 KOPrefs *p = KOPrefs::instance(); 1446 KOPrefs *p = KOPrefs::instance();
1451 1447
1452 p->mCompactDialogs = true; 1448 p->mCompactDialogs = true;
1453 p->mConfirm = true; 1449 p->mConfirm = true;
1454 // p->mEnableQuickTodo = false; 1450 // p->mEnableQuickTodo = false;
1455 1451
1456} 1452}
1457 1453
1458QString MainWindow::resourcePath() 1454QString MainWindow::resourcePath()
1459{ 1455{
1460 return KGlobal::iconLoader()->iconPath(); 1456 return KGlobal::iconLoader()->iconPath();
1461} 1457}
1462 1458
1463void MainWindow::displayText( QString text ,QString cap ) 1459void MainWindow::displayText( QString text ,QString cap )
1464{ 1460{
1465 QDialog dia( this, "name", true ); ; 1461 QDialog dia( this, "name", true ); ;
1466 dia.setCaption( cap ); 1462 dia.setCaption( cap );
1467 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1463 QVBoxLayout* lay = new QVBoxLayout( &dia );
1468 lay->setSpacing( 3 ); 1464 lay->setSpacing( 3 );
1469 lay->setMargin( 3 ); 1465 lay->setMargin( 3 );
1470 QTextBrowser tb ( &dia ); 1466 QTextBrowser tb ( &dia );
1471 lay->addWidget( &tb ); 1467 lay->addWidget( &tb );
1472 tb.setText( text ); 1468 tb.setText( text );
1473#ifdef DESKTOP_VERSION 1469#ifdef DESKTOP_VERSION
1474 dia.resize( 640, 480); 1470 dia.resize( 640, 480);
1475#else 1471#else
1476 dia.showMaximized(); 1472 dia.showMaximized();
1477#endif 1473#endif
1478 dia.exec(); 1474 dia.exec();
1479} 1475}
1480 1476
1481void MainWindow::features() 1477void MainWindow::features()
1482{ 1478{
1483 1479
1484 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1480 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1485} 1481}
1486 1482
1487void MainWindow::usertrans() 1483void MainWindow::usertrans()
1488{ 1484{
1489 1485
1490 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1486 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1491} 1487}
1492 1488
1493void MainWindow::storagehowto() 1489void MainWindow::storagehowto()
1494{ 1490{
1495 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); 1491 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" );
1496} 1492}
1497void MainWindow::timetrackinghowto() 1493void MainWindow::timetrackinghowto()
1498{ 1494{
1499 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); 1495 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" );
1500} 1496}
1501void MainWindow::kdesynchowto() 1497void MainWindow::kdesynchowto()
1502{ 1498{
1503 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1499 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1504} 1500}
1505void MainWindow::multisynchowto() 1501void MainWindow::multisynchowto()
1506{ 1502{
1507 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1503 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1508} 1504}
1509void MainWindow::synchowto() 1505void MainWindow::synchowto()
1510{ 1506{
1511 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1507 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1512} 1508}
1513void MainWindow::faq() 1509void MainWindow::faq()
1514{ 1510{
1515 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1511 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1516 1512
1517} 1513}
1518void MainWindow::whatsNew() 1514void MainWindow::whatsNew()
1519{ 1515{
1520 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1516 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1521 1517
1522} 1518}
1523void MainWindow::licence() 1519void MainWindow::licence()
1524{ 1520{
1525 KApplication::showLicence(); 1521 KApplication::showLicence();
1526 1522
1527} 1523}
1528void MainWindow::about() 1524void MainWindow::about()
1529{ 1525{
1530 QString version; 1526 QString version;
1531#include <../version> 1527#include <../version>
1532 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1528 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1533 i18n("KOrganizer/Platform-independent\n") + 1529 i18n("KOrganizer/Platform-independent\n") +
1534 "(KO/Pi) " + version + " - " + 1530 "(KO/Pi) " + version + " - " +
1535 1531
1536#ifdef DESKTOP_VERSION 1532#ifdef DESKTOP_VERSION
1537 i18n("Desktop Edition\n") + 1533 i18n("Desktop Edition\n") +
1538#else 1534#else
1539 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1535 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1540#endif 1536#endif
1541 i18n("(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.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); 1537 i18n("(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.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") );
1542} 1538}
1543void MainWindow::keyBindings() 1539void MainWindow::keyBindings()
1544{ 1540{
1545 QString cap = i18n("KO/Pi Keys + Colors"); 1541 QString cap = i18n("KO/Pi Keys + Colors");
1546 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1542 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1547 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1543 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1548 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + 1544 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") +
1549 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + 1545 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") +
1550 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1546 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1551 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1547 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1552 i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ 1548 i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+
1553 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1549 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1554 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1550 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1555 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ 1551 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+
1556 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1552 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1557 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1553 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1558 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1554 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1559 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ 1555 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+
1560 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1556 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1561 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1557 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1562 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ 1558 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+
1563 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1559 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1564 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1560 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1565 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1561 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1566 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1562 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1567 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1563 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1568 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1564 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1569 i18n("<p><h3>In agenda view:</h3></p>\n") + 1565 i18n("<p><h3>In agenda view:</h3></p>\n") +
1570 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1566 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1571 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1567 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1572 i18n("<p><h3>In todo view:</h3></p>\n") + 1568 i18n("<p><h3>In todo view:</h3></p>\n") +
1573 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1569 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1574 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1570 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1575 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1571 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1576 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1572 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1577 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1573 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1578 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1574 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1579 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1575 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1580 i18n("<p><h3>In list view:</h3></p>\n") + 1576 i18n("<p><h3>In list view:</h3></p>\n") +
1581 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1577 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1582 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1578 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1583 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1579 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1584 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1580 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1585 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1581 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1586 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1582 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1587 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1583 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1588 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1584 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1589 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1585 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1590 i18n("<p><b>E</b>: Edit item</p>\n") + 1586 i18n("<p><b>E</b>: Edit item</p>\n") +
1591 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1587 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1592 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1588 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1593 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1589 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1594 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1590 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1595 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1591 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1596 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1592 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1597 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1593 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1598 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1594 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1599 i18n("<p><b>White</b>: Item readonly</p>\n"); 1595 i18n("<p><b>White</b>: Item readonly</p>\n");
1600 displayText( text, cap); 1596 displayText( text, cap);
1601} 1597}
1602void MainWindow::aboutAutoSaving() 1598void MainWindow::aboutAutoSaving()
1603{ 1599{
1604 QString text = i18n("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"); 1600 QString text = i18n("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");
1605 1601
1606 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1602 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1607 1603
1608} 1604}
1609void MainWindow::aboutKnownBugs() 1605void MainWindow::aboutKnownBugs()
1610{ 1606{
1611 QMessageBox* msg; 1607 QMessageBox* msg;
1612 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1608 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1613 i18n("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")+ 1609 i18n("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")+
1614 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1610 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1615 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + 1611 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") +
1616 i18n("\nor report them in the bugtracker on\n") + 1612 i18n("\nor report them in the bugtracker on\n") +
1617 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1613 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1618 QMessageBox::NoIcon, 1614 QMessageBox::NoIcon,
1619 QMessageBox::Ok, 1615 QMessageBox::Ok,
1620 QMessageBox::NoButton, 1616 QMessageBox::NoButton,
1621 QMessageBox::NoButton); 1617 QMessageBox::NoButton);
1622 msg->exec(); 1618 msg->exec();
1623 delete msg; 1619 delete msg;
1624 1620
1625} 1621}
1626 1622
1627QString MainWindow::defaultFileName() 1623QString MainWindow::defaultFileName()
1628{ 1624{
1629 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1625 return locateLocal( "data", "korganizer/mycalendar.ics" );
1630} 1626}
1631QString MainWindow::syncFileName() 1627QString MainWindow::syncFileName()
1632{ 1628{
1633#ifdef DESKTOP_VERSION 1629#ifdef DESKTOP_VERSION
1634 return locateLocal( "tmp", "synccalendar.ics" ); 1630 return locateLocal( "tmp", "synccalendar.ics" );
1635#else 1631#else
1636 return QString( "/tmp/synccalendar.ics" ); 1632 return QString( "/tmp/synccalendar.ics" );
1637#endif 1633#endif
1638} 1634}
1639#include "koglobals.h" 1635#include "koglobals.h"
1640#include <kcalendarsystem.h> 1636#include <kcalendarsystem.h>
1641void MainWindow::updateWeek(QDate seda) 1637void MainWindow::updateWeek(QDate seda)
1642{ 1638{
1643 int weekNum = KGlobal::locale()->weekNum ( seda ); 1639 int weekNum = KGlobal::locale()->weekNum ( seda );
1644 mWeekPixmap.fill( mWeekBgColor ); 1640 mWeekPixmap.fill( mWeekBgColor );
1645 QPainter p ( &mWeekPixmap ); 1641 QPainter p ( &mWeekPixmap );
1646 p.setFont( mWeekFont ); 1642 p.setFont( mWeekFont );
1647 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1643 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1648 p.end(); 1644 p.end();
1649 QIconSet icon3 ( mWeekPixmap ); 1645 QIconSet icon3 ( mWeekPixmap );
1650 mWeekAction->setIconSet ( icon3 ); 1646 mWeekAction->setIconSet ( icon3 );
1651 1647
1652} 1648}
1653void MainWindow::updateWeekNum(const DateList &selectedDates) 1649void MainWindow::updateWeekNum(const DateList &selectedDates)
1654{ 1650{
1655 updateWeek( selectedDates.first() ); 1651 updateWeek( selectedDates.first() );
1656} 1652}
1657void MainWindow::processIncidenceSelection( Incidence *incidence ) 1653void MainWindow::processIncidenceSelection( Incidence *incidence )
1658{ 1654{
1659 1655
1660 if ( !incidence ) { 1656 if ( !incidence ) {
1661 enableIncidenceActions( false ); 1657 enableIncidenceActions( false );
1662 1658
1663 mNewSubTodoAction->setEnabled( false ); 1659 mNewSubTodoAction->setEnabled( false );
1664 setCaptionToDates(); 1660 setCaptionToDates();
1665 return; 1661 return;
1666 1662
1667 } 1663 }
1668 1664
1669 //KGlobal::locale()->formatDateTime(nextA, true); 1665 //KGlobal::locale()->formatDateTime(nextA, true);
1670 QString startString = ""; 1666 QString startString = "";
1671 if ( incidence->typeID() != todoID ) { 1667 if ( incidence->typeID() != todoID ) {
1672 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1668 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1673 if ( incidence->doesFloat() ) { 1669 if ( incidence->doesFloat() ) {
1674 startString += ": "+incidence->dtStartDateStr( true ); 1670 startString += ": "+incidence->dtStartDateStr( true );
1675 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1671 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1676 1672
1677 } else { 1673 } else {
1678 startString = ": "+incidence->dtStartStr(true); 1674 startString = ": "+incidence->dtStartStr(true);
1679 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1675 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1680 1676
1681 } 1677 }
1682 1678
1683 } else { 1679 } else {
1684 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1680 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1685 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1681 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1686 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1682 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1687 1683
1688 if ( incidence->isBirthday() || incidence->isAnniversary() ) { 1684 if ( incidence->isBirthday() || incidence->isAnniversary() ) {
1689 bool ok; 1685 bool ok;
1690 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1686 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1691 if ( ok ) { 1687 if ( ok ) {
1692 int years = noc.date().year() - incidence->dtStart().date().year(); 1688 int years = noc.date().year() - incidence->dtStart().date().year();
1693 startString += i18n(" (%1 y.)"). arg( years ); 1689 startString += i18n(" (%1 y.)"). arg( years );
1694 } 1690 }
1695 } 1691 }
1696 else 1692 else
1697 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1693 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1698 } 1694 }
1699 1695
1700 } 1696 }
1701 else 1697 else
1702 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1698 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1703 if ( !incidence->location().isEmpty() ) 1699 if ( !incidence->location().isEmpty() )
1704 startString += " (" +incidence->location()+")"; 1700 startString += " (" +incidence->location()+")";
1705 setCaption( incidence->summary()+startString); 1701 setCaption( incidence->summary()+startString);
1706 1702
1707 enableIncidenceActions( true ); 1703 enableIncidenceActions( true );
1708 1704
1709 if ( incidence->typeID() == eventID ) { 1705 if ( incidence->typeID() == eventID ) {
1710 mShowAction->setText( i18n("Show Event...") ); 1706 mShowAction->setText( i18n("Show Event...") );
1711 mEditAction->setText( i18n("Edit Event...") ); 1707 mEditAction->setText( i18n("Edit Event...") );
1712 mDeleteAction->setText( i18n("Delete Event...") ); 1708 mDeleteAction->setText( i18n("Delete Event...") );
1713 1709
1714 mNewSubTodoAction->setEnabled( false ); 1710 mNewSubTodoAction->setEnabled( false );
1715 } else if ( incidence->typeID() == todoID ) { 1711 } else if ( incidence->typeID() == todoID ) {
1716 mShowAction->setText( i18n("Show Todo...") ); 1712 mShowAction->setText( i18n("Show Todo...") );
1717 mEditAction->setText( i18n("Edit Todo...") ); 1713 mEditAction->setText( i18n("Edit Todo...") );
1718 mDeleteAction->setText( i18n("Delete Todo...") ); 1714 mDeleteAction->setText( i18n("Delete Todo...") );
1719 1715
1720 mNewSubTodoAction->setEnabled( true ); 1716 mNewSubTodoAction->setEnabled( true );
1721 } else { 1717 } else {
1722 mShowAction->setText( i18n("Show...") ); 1718 mShowAction->setText( i18n("Show...") );
1723 mShowAction->setText( i18n("Edit...") ); 1719 mShowAction->setText( i18n("Edit...") );
1724 mShowAction->setText( i18n("Delete...") ); 1720 mShowAction->setText( i18n("Delete...") );
1725 1721
1726 mNewSubTodoAction->setEnabled( false ); 1722 mNewSubTodoAction->setEnabled( false );
1727 } 1723 }
1728} 1724}
1729 1725
1730void MainWindow::enableIncidenceActions( bool enabled ) 1726void MainWindow::enableIncidenceActions( bool enabled )
1731{ 1727{
1732 1728
1733#ifndef DESKTOP_VERSION 1729#ifndef DESKTOP_VERSION
1734 mCurrentItemMenu->setEnabled( enabled ); 1730 mCurrentItemMenu->setEnabled( enabled );
1735#else 1731#else
1736 mShowAction->setEnabled( enabled ); 1732 mShowAction->setEnabled( enabled );
1737 mEditAction->setEnabled( enabled ); 1733 mEditAction->setEnabled( enabled );
1738 mDeleteAction->setEnabled( enabled ); 1734 mDeleteAction->setEnabled( enabled );
1739 1735
1740 mCloneAction->setEnabled( enabled ); 1736 mCloneAction->setEnabled( enabled );
1741 mMoveAction->setEnabled( enabled ); 1737 mMoveAction->setEnabled( enabled );
1742 mBeamAction->setEnabled( enabled ); 1738 mBeamAction->setEnabled( enabled );
1743 mCancelAction->setEnabled( enabled ); 1739 mCancelAction->setEnabled( enabled );
1744#endif 1740#endif
1745} 1741}
1746 1742
1747void MainWindow::importOL() 1743void MainWindow::importOL()
1748{ 1744{
1749#ifdef _OL_IMPORT_ 1745#ifdef _OL_IMPORT_
1750 mView->clearAllViews(); 1746 mView->clearAllViews();
1751 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1747 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1752 id->exec(); 1748 id->exec();
1753 delete id; 1749 delete id;
1754 mView->calendar()->checkAlarmForIncidence( 0, true ); 1750 mView->calendar()->checkAlarmForIncidence( 0, true );
1755 mView->updateView(); 1751 mView->updateView();
1756#endif 1752#endif
1757} 1753}
1758void MainWindow::importBday() 1754void MainWindow::importBday()
1759{ 1755{
1760 int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), 1756 int result = QMessageBox::warning( this, i18n("KO/Pi import information!"),
1761 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1757 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1762 i18n("Import!"), i18n("Cancel"), 0, 1758 i18n("Import!"), i18n("Cancel"), 0,
1763 0, 1 ); 1759 0, 1 );
1764 if ( result == 0 ) { 1760 if ( result == 0 ) {
1765 mView->importBday(); 1761 mView->importBday();
1766 1762
1767 } 1763 }
1768 1764
1769 1765
1770} 1766}
1771void MainWindow::importQtopia() 1767void MainWindow::importQtopia()
1772{ 1768{
1773 //#ifndef DESKTOP_VERSION 1769 //#ifndef DESKTOP_VERSION
1774 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); 1770 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing");
1775#ifdef DESKTOP_VERSION 1771#ifdef DESKTOP_VERSION
1776 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); 1772 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml");
1777#endif 1773#endif
1778 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1774 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1779 i18n("Import!"), i18n("Cancel"), 0, 1775 i18n("Import!"), i18n("Cancel"), 0,
1780 0, 1 ); 1776 0, 1 );
1781 if ( result == 0 ) { 1777 if ( result == 0 ) {
1782#ifndef DESKTOP_VERSION 1778#ifndef DESKTOP_VERSION
1783 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1779 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1784 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1780 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1785 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1781 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1786#else 1782#else
1787 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1783 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1788 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1784 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1789 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1785 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1790#endif 1786#endif
1791 mView->importQtopia( categories, datebook, todolist ); 1787 mView->importQtopia( categories, datebook, todolist );
1792 } 1788 }
1793 mView->calendar()->reInitAlarmSettings(); 1789 mView->calendar()->reInitAlarmSettings();
1794#if 0 1790#if 0
1795 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1791 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1796 i18n("Not supported \non desktop!\n"), 1792 i18n("Not supported \non desktop!\n"),
1797 i18n("Ok"), i18n("Cancel"), 0, 1793 i18n("Ok"), i18n("Cancel"), 0,
1798 0, 1 ); 1794 0, 1 );
1799 1795
1800#endif 1796#endif
1801} 1797}
1802 1798
1803void MainWindow::saveOnClose() 1799void MainWindow::saveOnClose()
1804{ 1800{
1805 KOPrefs *p = KOPrefs::instance(); 1801 KOPrefs *p = KOPrefs::instance();
1806 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1802 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1807 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); 1803 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
1808 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); 1804 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal );
1809 if ( filterToolBar ) { 1805 if ( filterToolBar ) {
1810 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); 1806 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
1811 } 1807 }
1812#ifdef DESKTOP_VERSION 1808#ifdef DESKTOP_VERSION
1813 1809
1814 QPoint myP; 1810 QPoint myP;
1815 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); 1811 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) );
1816 if ( p->mToolBarHor ) 1812 if ( p->mToolBarHor )
1817 p->mToolBarUp = myP.y() > height()/2; 1813 p->mToolBarUp = myP.y() > height()/2;
1818 else 1814 else
1819 p->mToolBarUp = myP.x() > width()/2; 1815 p->mToolBarUp = myP.x() > width()/2;
1820 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); 1816 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) );
1821 if ( p->mToolBarHorV ) 1817 if ( p->mToolBarHorV )
1822 p->mToolBarUpV = myP.y() > height()/2; 1818 p->mToolBarUpV = myP.y() > height()/2;
1823 else 1819 else
1824 p->mToolBarUpV = myP.x() > width()/2 ; 1820 p->mToolBarUpV = myP.x() > width()/2 ;
1825 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); 1821 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) );
1826 if ( p->mToolBarHorN ) 1822 if ( p->mToolBarHorN )
1827 p->mToolBarUpN = myP.y() > height()/2; 1823 p->mToolBarUpN = myP.y() > height()/2;
1828 else 1824 else
1829 p->mToolBarUpN = myP.x() > width()/2 ; 1825 p->mToolBarUpN = myP.x() > width()/2 ;
1830 if ( filterToolBar ) { 1826 if ( filterToolBar ) {
1831 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); 1827 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) );
1832 if ( p->mToolBarHorF ) 1828 if ( p->mToolBarHorF )
1833 p->mToolBarUpF = myP.y() > height()/2; 1829 p->mToolBarUpF = myP.y() > height()/2;
1834 else 1830 else
1835 p->mToolBarUpF = myP.x() > width()/2 ; 1831 p->mToolBarUpF = myP.x() > width()/2 ;
1836 } 1832 }
1837#else 1833#else
1838 if ( p->mToolBarHor ) 1834 if ( p->mToolBarHor )
1839 p->mToolBarUp = iconToolBar->y() > height()/2; 1835 p->mToolBarUp = iconToolBar->y() > height()/2;
1840 else 1836 else
1841 p->mToolBarUp = iconToolBar->x() > width()/2; 1837 p->mToolBarUp = iconToolBar->x() > width()/2;
1842 if ( p->mToolBarHorV ) 1838 if ( p->mToolBarHorV )
1843 p->mToolBarUpV = viewToolBar->y() > height()/2; 1839 p->mToolBarUpV = viewToolBar->y() > height()/2;
1844 else 1840 else
1845 p->mToolBarUpV = viewToolBar->x() > width()/2 ; 1841 p->mToolBarUpV = viewToolBar->x() > width()/2 ;
1846 1842
1847 if ( p->mToolBarHorN ) 1843 if ( p->mToolBarHorN )
1848 p->mToolBarUpN = navigatorToolBar->y() > height()/2; 1844 p->mToolBarUpN = navigatorToolBar->y() > height()/2;
1849 else 1845 else
1850 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; 1846 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
1851 if ( filterToolBar ) { 1847 if ( filterToolBar ) {
1852 if ( p->mToolBarHorF ) 1848 if ( p->mToolBarHorF )
1853 p->mToolBarUpF = filterToolBar->y() > height()/2; 1849 p->mToolBarUpF = filterToolBar->y() > height()/2;
1854 else 1850 else
1855 p->mToolBarUpF = filterToolBar->x() > width()/2 ; 1851 p->mToolBarUpF = filterToolBar->x() > width()/2 ;
1856 } 1852 }
1857#endif 1853#endif
1858
1859 save(); 1854 save();
1860 mView->writeSettings(); 1855 mView->writeSettings();
1856 mView->checkSuspendAlarm();
1861} 1857}
1862void MainWindow::slotModifiedChanged( bool changed ) 1858void MainWindow::slotModifiedChanged( bool )
1863{ 1859{
1864 if ( mBlockAtStartup ) 1860 if ( mBlockAtStartup )
1865 return; 1861 return;
1866 1862
1867 int msec; 1863 int msec;
1868 // we store the changes after 1 minute, 1864 // we store the changes after 1 minute,
1869 // and for safety reasons after 10 minutes again 1865 // and for safety reasons after 10 minutes again
1870 if ( !mSyncManager->blockSave() ) 1866 if ( !mSyncManager->blockSave() )
1871 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1867 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1872 else 1868 else
1873 msec = 1000 * 600; 1869 msec = 1000 * 600;
1874 mSaveTimer.start( msec, true ); // 1 minute 1870 mSaveTimer.start( msec, true ); // 1 minute
1875 qDebug("KO: Saving File in %d secs!", msec/1000); 1871 qDebug("KO: Saving File in %d secs!", msec/1000);
1876 mCalendarModifiedFlag = true; 1872 mCalendarModifiedFlag = true;
1877} 1873}
1878void MainWindow::saveStopTimer() 1874void MainWindow::saveStopTimer()
1879{ 1875{
1880 mSaveTimer.stop(); 1876 mSaveTimer.stop();
1881} 1877}
1882void MainWindow::backupAllFiles() 1878void MainWindow::backupAllFiles()
1883{ 1879{
1884 QDate reference ( 2000,1,1); 1880 QDate reference ( 2000,1,1);
1885 int daysTo = reference.daysTo ( QDate::currentDate() ); 1881 int daysTo = reference.daysTo ( QDate::currentDate() );
1886 setCaption(i18n("Creating backup ... please wait ..." )); 1882 setCaption(i18n("Creating backup ... please wait ..." ));
1887 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); 1883 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate);
1888 // we need the file path, the backup dir and the number of bups as param 1884 // we need the file path, the backup dir and the number of bups as param
1889 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 1885 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
1890 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 1886 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
1891 bupDir = KGlobalSettings::backupDataDir(); 1887 bupDir = KGlobalSettings::backupDataDir();
1892 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1888 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1893 if ( retval == 0 ) { 1889 if ( retval == 0 ) {
1894 setCaption(i18n("Backup cancelled" )); 1890 setCaption(i18n("Backup cancelled" ));
1895 qDebug("KO: Backup cancelled. Will try again tomorrow "); 1891 qDebug("KO: Backup cancelled. Will try again tomorrow ");
1896 // retval == 0 : backup skipped for today, try again tomorrow 1892 // retval == 0 : backup skipped for today, try again tomorrow
1897 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; 1893 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1;
1898 } else if ( retval == 1 ){ 1894 } else if ( retval == 1 ){
1899 qDebug("KO: Backup created."); 1895 qDebug("KO: Backup created.");
1900 // backup ok 1896 // backup ok
1901 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 1897 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
1902 KopiCalendarFile * cal = calendars.first(); 1898 KopiCalendarFile * cal = calendars.first();
1903 cal = calendars.next(); 1899 cal = calendars.next();
1904 while ( cal ) { 1900 while ( cal ) {
1905 if ( !cal->mErrorOnLoad ) { 1901 if ( !cal->mErrorOnLoad ) {
1906 int retval = KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1902 KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1907 } 1903 }
1908 cal = calendars.next(); 1904 cal = calendars.next();
1909 } 1905 }
1910 KOPrefs::instance()->mLastBackupDate = daysTo; 1906 KOPrefs::instance()->mLastBackupDate = daysTo;
1911 setCaption(i18n("Backup succesfully finished" )); 1907 setCaption(i18n("Backup succesfully finished" ));
1912 } else if ( retval == 2 ){ 1908 } else if ( retval == 2 ){
1913 setCaption(i18n("Backup globally disabled" )); 1909 setCaption(i18n("Backup globally disabled" ));
1914 qDebug("KO: Backup globally cancelled."); 1910 qDebug("KO: Backup globally cancelled.");
1915 // backup globally cancelled 1911 // backup globally cancelled
1916 KPimGlobalPrefs::instance()->mBackupEnabled = false; 1912 KPimGlobalPrefs::instance()->mBackupEnabled = false;
1917 } 1913 }
1918 // retval == 3: do nothing, try again later 1914 // retval == 3: do nothing, try again later
1919} 1915}
1920void MainWindow::save() 1916void MainWindow::save()
1921{ 1917{
1922 if ( mView->viewManager()->journalView() ) 1918 if ( mView->viewManager()->journalView() )
1923 mView->viewManager()->journalView()->checkModified(); 1919 mView->viewManager()->journalView()->checkModified();
1924 if ( !mCalendarModifiedFlag ) { 1920 if ( !mCalendarModifiedFlag ) {
1925 qDebug("KO: Calendar not modified. Nothing saved."); 1921 qDebug("KO: Calendar not modified. Nothing saved.");
1926 return; 1922 return;
1927 } 1923 }
1928 if ( mSyncManager->blockSave() ) 1924 if ( mSyncManager->blockSave() )
1929 return; 1925 return;
1930 mSyncManager->setBlockSave(true); 1926 mSyncManager->setBlockSave(true);
1931 if ( mView->checkAllFileVersions() ) { 1927 if ( mView->checkAllFileVersions() ) {
1932 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ 1928 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){
1933 QDate reference ( 2000,1,1); 1929 QDate reference ( 2000,1,1);
1934 int daysTo = reference.daysTo ( QDate::currentDate() ); 1930 int daysTo = reference.daysTo ( QDate::currentDate() );
1935 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { 1931 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) {
1936 backupAllFiles(); 1932 backupAllFiles();
1937 } 1933 }
1938 ; // KPimGlobalPrefs::instance()->mLastBackupDate 1934 ; // KPimGlobalPrefs::instance()->mLastBackupDate
1939 } 1935 }
1940 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1936 QTime neededSaveTime = QDateTime::currentDateTime().time();
1941 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1937 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1942 qDebug("KO: Start saving data to file!"); 1938 qDebug("KO: Start saving data to file!");
1943 mView->saveCalendars(); 1939 mView->saveCalendars();
1944 mCalendarModifiedFlag = false; 1940 mCalendarModifiedFlag = false;
1945 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1941 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1946 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1942 qDebug("KO: Needed %d ms for saving.",msNeeded );
1947 QString savemes; 1943 QString savemes;
1948 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1944 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1949 setCaption(savemes); 1945 setCaption(savemes);
1950 } else 1946 } else
1951 setCaption(i18n("Saving cancelled!")); 1947 setCaption(i18n("Saving cancelled!"));
1952 mSyncManager->setBlockSave( false ); 1948 mSyncManager->setBlockSave( false );
1953} 1949}
1954 1950
1955void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1951void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1956{ 1952{
1957 if ( !e->isAutoRepeat() ) { 1953 if ( !e->isAutoRepeat() ) {
1958 mFlagKeyPressed = false; 1954 mFlagKeyPressed = false;
1959 } 1955 }
1960} 1956}
1961void MainWindow::keyPressEvent ( QKeyEvent * e ) 1957void MainWindow::keyPressEvent ( QKeyEvent * e )
1962{ 1958{
1963 qApp->processEvents(); 1959 qApp->processEvents();
1964 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1960 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1965 e->ignore(); 1961 e->ignore();
1966 // qDebug(" ignore %d",e->isAutoRepeat() ); 1962 // qDebug(" ignore %d",e->isAutoRepeat() );
1967 return; 1963 return;
1968 } 1964 }
1969 if (! e->isAutoRepeat() ) 1965 if (! e->isAutoRepeat() )
1970 mFlagKeyPressed = true; 1966 mFlagKeyPressed = true;
1971 KOPrefs *p = KOPrefs::instance(); 1967 KOPrefs *p = KOPrefs::instance();
1972 bool showSelectedDates = false; 1968 bool showSelectedDates = false;
1973 int size; 1969 int size;
1974 int pro = 0; 1970 int pro = 0;
1975 //qDebug("MainWindow::keyPressEvent "); 1971 //qDebug("MainWindow::keyPressEvent ");
1976 switch ( e->key() ) { 1972 switch ( e->key() ) {
1977 case Qt::Key_Right: 1973 case Qt::Key_Right:
1978 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1974 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1979 mView->goNextMonth(); 1975 mView->goNextMonth();
1980 else 1976 else
1981 mView->goNext(); 1977 mView->goNext();
1982 showSelectedDates = true; 1978 showSelectedDates = true;
1983 break; 1979 break;
1984 case Qt::Key_Left: 1980 case Qt::Key_Left:
1985 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1981 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1986 mView->goPreviousMonth(); 1982 mView->goPreviousMonth();
1987 else 1983 else
1988 mView->goPrevious(); 1984 mView->goPrevious();
1989 showSelectedDates = true; 1985 showSelectedDates = true;
1990 break; 1986 break;
1991 case Qt::Key_Down: 1987 case Qt::Key_Down:
1992 mView->viewManager()->agendaView()->scrollOneHourDown(); 1988 mView->viewManager()->agendaView()->scrollOneHourDown();
1993 break; 1989 break;
1994 case Qt::Key_Up: 1990 case Qt::Key_Up:
1995 mView->viewManager()->agendaView()->scrollOneHourUp(); 1991 mView->viewManager()->agendaView()->scrollOneHourUp();
1996 break; 1992 break;
1997 case Qt::Key_K: 1993 case Qt::Key_K:
1998 mView->viewManager()->showMonthViewWeek(); 1994 mView->viewManager()->showMonthViewWeek();
1999 break; 1995 break;
2000 case Qt::Key_I: 1996 case Qt::Key_I:
2001 mView->showIncidence(); 1997 mView->showIncidence();
2002 break; 1998 break;
2003 case Qt::Key_Delete: 1999 case Qt::Key_Delete:
2004 case Qt::Key_Backspace: 2000 case Qt::Key_Backspace:
2005 mView->deleteIncidence(); 2001 mView->deleteIncidence();
2006 break; 2002 break;
2007 case Qt::Key_D: 2003 case Qt::Key_D:
2008 mView->viewManager()->showDayView(); 2004 mView->viewManager()->showDayView();
2009 showSelectedDates = true; 2005 showSelectedDates = true;
2010 break; 2006 break;
2011 case Qt::Key_O: 2007 case Qt::Key_O:
2012 mView->toggleFilerEnabled( ); 2008 mView->toggleFilerEnabled( );
2013 break; 2009 break;
2014 case Qt::Key_0: 2010 case Qt::Key_0:
2015 case Qt::Key_1: 2011 case Qt::Key_1:
2016 case Qt::Key_2: 2012 case Qt::Key_2:
2017 case Qt::Key_3: 2013 case Qt::Key_3:
2018 case Qt::Key_4: 2014 case Qt::Key_4:
2019 case Qt::Key_5: 2015 case Qt::Key_5:
2020 case Qt::Key_6: 2016 case Qt::Key_6:
2021 case Qt::Key_7: 2017 case Qt::Key_7:
2022 case Qt::Key_8: 2018 case Qt::Key_8:
2023 case Qt::Key_9: 2019 case Qt::Key_9:
2024 pro = e->key()-48; 2020 pro = e->key()-48;
2025 if ( pro == 0 ) 2021 if ( pro == 0 )
2026 pro = 10; 2022 pro = 10;
2027 if ( e->state() == Qt::ControlButton) 2023 if ( e->state() == Qt::ControlButton)
2028 pro += 10; 2024 pro += 10;
2029 break; 2025 break;
2030 case Qt::Key_M: 2026 case Qt::Key_M:
2031 mView->viewManager()->showMonthView(); 2027 mView->viewManager()->showMonthView();
2032 showSelectedDates = true; 2028 showSelectedDates = true;
2033 break; 2029 break;
2034 case Qt::Key_Insert: 2030 case Qt::Key_Insert:
2035 mView->newEvent(); 2031 mView->newEvent();
2036 break; 2032 break;
2037 case Qt::Key_S : 2033 case Qt::Key_S :
2038 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 2034 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
2039 mView->newSubTodo(); 2035 mView->newSubTodo();
2040 else 2036 else
2041 mView->dialogManager()->showSearchDialog(); 2037 mView->dialogManager()->showSearchDialog();
2042 break; 2038 break;
2043 case Qt::Key_Y : 2039 case Qt::Key_Y :
2044 case Qt::Key_Z : 2040 case Qt::Key_Z :
2045 mView->viewManager()->showWorkWeekView(); 2041 mView->viewManager()->showWorkWeekView();
2046 showSelectedDates = true; 2042 showSelectedDates = true;
2047 break; 2043 break;
2048 case Qt::Key_U : 2044 case Qt::Key_U :
2049 mView->viewManager()->showWeekView(); 2045 mView->viewManager()->showWeekView();
2050 showSelectedDates = true; 2046 showSelectedDates = true;
2051 break; 2047 break;
2052 case Qt::Key_H : 2048 case Qt::Key_H :
2053 keyBindings(); 2049 keyBindings();
2054 break; 2050 break;
2055 case Qt::Key_W: 2051 case Qt::Key_W:
2056 mView->viewManager()->showWhatsNextView(); 2052 mView->viewManager()->showWhatsNextView();
2057 break; 2053 break;
2058 case Qt::Key_L: 2054 case Qt::Key_L:
2059 mView->viewManager()->showListView(); 2055 mView->viewManager()->showListView();
2060 break; 2056 break;
2061 case Qt::Key_N: 2057 case Qt::Key_N:
2062 mView->viewManager()->showNextView(); 2058 mView->viewManager()->showNextView();
2063 break; 2059 break;
2064 case Qt::Key_V: 2060 case Qt::Key_V:
2065 mView->viewManager()->showTodoView(); 2061 mView->viewManager()->showTodoView();
2066 break; 2062 break;
2067 case Qt::Key_C: 2063 case Qt::Key_C:
2068 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 2064 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
2069 break; 2065 break;
2070 case Qt::Key_P: 2066 case Qt::Key_P:
2071 mView->showDatePicker( ); 2067 mView->showDatePicker( );
2072 break; 2068 break;
2073 case Qt::Key_F: 2069 case Qt::Key_F:
2074 mView->editFilters(); 2070 mView->editFilters();
2075 break; 2071 break;
2076 case Qt::Key_R: 2072 case Qt::Key_R:
2077 mView->toggleFilter(); 2073 mView->toggleFilter();
2078 break; 2074 break;
2079 case Qt::Key_X: 2075 case Qt::Key_X:
2080 if ( e->state() == Qt::ControlButton ) 2076 if ( e->state() == Qt::ControlButton )
2081 mView->toggleDateNavigatorWidget(); 2077 mView->toggleDateNavigatorWidget();
2082 else { 2078 else {
2083 mView->viewManager()->showNextXView(); 2079 mView->viewManager()->showNextXView();
2084 showSelectedDates = true; 2080 showSelectedDates = true;
2085 } 2081 }
2086 break; 2082 break;
2087 case Qt::Key_Space: 2083 case Qt::Key_Space:
2088 mView->toggleExpand(); 2084 mView->toggleExpand();
2089 break; 2085 break;
2090 case Qt::Key_A: 2086 case Qt::Key_A:
2091 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) 2087 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton )
2092 mView->showNextAlarms(); 2088 mView->showNextAlarms();
2093 else 2089 else
2094 mView->toggleAllDaySize(); 2090 mView->toggleAllDaySize();
2095 break; 2091 break;
2096 case Qt::Key_T: 2092 case Qt::Key_T:
2097 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2093 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2098 mView->newTodo(); 2094 mView->newTodo();
2099 else { 2095 else {
2100 mView->goToday(); 2096 mView->goToday();
2101 showSelectedDates = true; 2097 showSelectedDates = true;
2102 } 2098 }
2103 break; 2099 break;
2104 case Qt::Key_J: 2100 case Qt::Key_J:
2105 mView->viewManager()->showJournalView(); 2101 mView->viewManager()->showJournalView();
2106 break; 2102 break;
2107 case Qt::Key_B: 2103 case Qt::Key_B:
2108 mView->editIncidenceDescription();; 2104 mView->editIncidenceDescription();;
2109 break; 2105 break;
2110 // case Qt::Key_Return: 2106 // case Qt::Key_Return:
2111 case Qt::Key_E: 2107 case Qt::Key_E:
2112 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2108 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2113 mView->newEvent(); 2109 mView->newEvent();
2114 else 2110 else
2115 mView->editIncidence(); 2111 mView->editIncidence();
2116 break; 2112 break;
2117 case Qt::Key_Plus: 2113 case Qt::Key_Plus:
2118 size = p->mHourSize +2; 2114 size = p->mHourSize +2;
2119 if ( size <= 22 ) 2115 if ( size <= 22 )
2120 configureAgenda( size ); 2116 configureAgenda( size );
2121 break; 2117 break;
2122 case Qt::Key_Minus: 2118 case Qt::Key_Minus:
2123 size = p->mHourSize - 2; 2119 size = p->mHourSize - 2;
2124 if ( size >= 4 ) 2120 if ( size >= 4 )
2125 configureAgenda( size ); 2121 configureAgenda( size );
2126 break; 2122 break;
2127 2123
2128 2124
2129 default: 2125 default:
2130 e->ignore(); 2126 e->ignore();
2131 } 2127 }
2132 if ( pro > 0 ) { 2128 if ( pro > 0 ) {
2133 selectFilter( pro+1 ); 2129 selectFilter( pro+1 );
2134 } 2130 }
2135 if ( showSelectedDates ) { 2131 if ( showSelectedDates ) {
2136 ;// setCaptionToDates(); 2132 ;// setCaptionToDates();
2137 } 2133 }
2138 2134
2139} 2135}
2140void MainWindow::fillFilterMenuTB() 2136void MainWindow::fillFilterMenuTB()
2141{ 2137{
2142 selectFilterMenuTB->clear(); 2138 selectFilterMenuTB->clear();
2143 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); 2139 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 );
2144 selectFilterMenuTB->insertSeparator(); 2140 selectFilterMenuTB->insertSeparator();
2145 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); 2141 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 );
2146 2142
2147 selectFilterMenuTB->insertSeparator(); 2143 selectFilterMenuTB->insertSeparator();
2148 QPtrList<CalFilter> fili = mView->filters(); 2144 QPtrList<CalFilter> fili = mView->filters();
2149 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2145 CalFilter *curfilter = mView->filterView()->selectedFilter();
2150 CalFilter *filter = fili.first(); 2146 CalFilter *filter = fili.first();
2151 int iii = 2; 2147 int iii = 2;
2152 bool checkitem = mView->filterView()->filtersEnabled(); 2148 bool checkitem = mView->filterView()->filtersEnabled();
2153 while(filter) { 2149 while(filter) {
2154 selectFilterMenuTB->insertItem( filter->name(), iii ); 2150 selectFilterMenuTB->insertItem( filter->name(), iii );
2155 if ( filter == curfilter) 2151 if ( filter == curfilter)
2156 selectFilterMenuTB->setItemChecked( iii, checkitem ); 2152 selectFilterMenuTB->setItemChecked( iii, checkitem );
2157 filter = fili.next(); 2153 filter = fili.next();
2158 ++iii; 2154 ++iii;
2159 } 2155 }
2160 if ( !checkitem ) 2156 if ( !checkitem )
2161 selectFilterMenuTB->setItemChecked( 1, true ); 2157 selectFilterMenuTB->setItemChecked( 1, true );
2162 2158
2163 int x = 0; 2159 int x = 0;
2164 int y = iconToolBar->height(); 2160 int y = iconToolBar->height();
2165 int dX = 0; 2161 int dX = 0;
2166 int dY = 0; 2162 int dY = 0;
2167 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2163 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2168 if ( iconToolBar->y() > height()/2 ) { 2164 if ( iconToolBar->y() > height()/2 ) {
2169 dY = selectFilterMenuTB->sizeHint().height()+8; 2165 dY = selectFilterMenuTB->sizeHint().height()+8;
2170 y = 0; 2166 y = 0;
2171 } 2167 }
2172 } else { 2168 } else {
2173 if ( iconToolBar->x() > width()/2 ) { // right side 2169 if ( iconToolBar->x() > width()/2 ) { // right side
2174 x=0; 2170 x=0;
2175 dX= selectFilterMenuTB->sizeHint().width()+8; 2171 dX= selectFilterMenuTB->sizeHint().width()+8;
2176 y = 0; 2172 y = 0;
2177 } else { 2173 } else {
2178 x= iconToolBar->width(); 2174 x= iconToolBar->width();
2179 y = 0; 2175 y = 0;
2180 } 2176 }
2181 } 2177 }
2182 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2178 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2183 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); 2179 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)));
2184} 2180}
2185void MainWindow::fillFilterMenu() 2181void MainWindow::fillFilterMenu()
2186{ 2182{
2187 selectFilterMenu->clear(); 2183 selectFilterMenu->clear();
2188 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 2184 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
2189 selectFilterMenu->insertSeparator(); 2185 selectFilterMenu->insertSeparator();
2190 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); 2186 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 );
2191 2187
2192 selectFilterMenu->insertSeparator(); 2188 selectFilterMenu->insertSeparator();
2193 QPtrList<CalFilter> fili = mView->filters(); 2189 QPtrList<CalFilter> fili = mView->filters();
2194 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2190 CalFilter *curfilter = mView->filterView()->selectedFilter();
2195 CalFilter *filter = fili.first(); 2191 CalFilter *filter = fili.first();
2196 int iii = 2; 2192 int iii = 2;
2197 bool checkitem = mView->filterView()->filtersEnabled(); 2193 bool checkitem = mView->filterView()->filtersEnabled();
2198 while(filter) { 2194 while(filter) {
2199 selectFilterMenu->insertItem( filter->name(), iii ); 2195 selectFilterMenu->insertItem( filter->name(), iii );
2200 if ( filter == curfilter) 2196 if ( filter == curfilter)
2201 selectFilterMenu->setItemChecked( iii, checkitem ); 2197 selectFilterMenu->setItemChecked( iii, checkitem );
2202 filter = fili.next(); 2198 filter = fili.next();
2203 ++iii; 2199 ++iii;
2204 } 2200 }
2205 if ( !checkitem ) 2201 if ( !checkitem )
2206 selectFilterMenu->setItemChecked( 1, true ); 2202 selectFilterMenu->setItemChecked( 1, true );
2207} 2203}
2208void MainWindow::fillFilterMenuPopup() 2204void MainWindow::fillFilterMenuPopup()
2209{ 2205{
2210 filterPopupMenu->clear(); 2206 filterPopupMenu->clear();
2211 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); 2207 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 );
2212 2208
2213 filterPopupMenu->insertSeparator(); 2209 filterPopupMenu->insertSeparator();
2214 QPtrList<CalFilter> fili = mView->filters(); 2210 QPtrList<CalFilter> fili = mView->filters();
2215 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2211 CalFilter *curfilter = mView->filterView()->selectedFilter();
2216 CalFilter *filter = fili.first(); 2212 CalFilter *filter = fili.first();
2217 int iii = 1; 2213 int iii = 1;
2218 bool checkitem = mView->filterView()->filtersEnabled(); 2214 bool checkitem = mView->filterView()->filtersEnabled();
2219 while(filter) { 2215 while(filter) {
2220 filterPopupMenu->insertItem( filter->name(), iii ); 2216 filterPopupMenu->insertItem( filter->name(), iii );
2221 if ( filter == curfilter) 2217 if ( filter == curfilter)
2222 filterPopupMenu->setItemChecked( iii, checkitem ); 2218 filterPopupMenu->setItemChecked( iii, checkitem );
2223 filter = fili.next(); 2219 filter = fili.next();
2224 ++iii; 2220 ++iii;
2225 } 2221 }
2226 if ( !checkitem ) 2222 if ( !checkitem )
2227 filterPopupMenu->setItemChecked( 0, true ); 2223 filterPopupMenu->setItemChecked( 0, true );
2228} 2224}
2229void MainWindow::selectFilter( int fil ) 2225void MainWindow::selectFilter( int fil )
2230{ 2226{
2231 2227
2232 if ( fil == 0 ) { 2228 if ( fil == 0 ) {
2233 mView->editFilters( ); 2229 mView->editFilters( );
2234 } else if ( fil == 1 ){ 2230 } else if ( fil == 1 ){
2235 if ( mView->filterView()->filtersEnabled() ) 2231 if ( mView->filterView()->filtersEnabled() )
2236 mView->toggleFilerEnabled( ); 2232 mView->toggleFilerEnabled( );
2237 } else { 2233 } else {
2238 if ( !mView->filterView()->filtersEnabled() ) { 2234 if ( !mView->filterView()->filtersEnabled() ) {
2239 mView->filterView()->blockSignals( true ); 2235 mView->filterView()->blockSignals( true );
2240 mView->toggleFilerEnabled( ); 2236 mView->toggleFilerEnabled( );
2241 mView->filterView()->blockSignals( false ); 2237 mView->filterView()->blockSignals( false );
2242 } 2238 }
2243 mView->selectFilter( fil-2 ); 2239 mView->selectFilter( fil-2 );
2244 } 2240 }
2245} 2241}
2246void MainWindow::updateFilterToolbar() 2242void MainWindow::updateFilterToolbar()
2247{ 2243{
2248 if ( filterMenubar ) { 2244 if ( filterMenubar ) {
2249 if ( !mView->filterView()->filtersEnabled() ) { 2245 if ( !mView->filterView()->filtersEnabled() ) {
2250 filterMenubar->changeItem( 0, i18n("No Filter") ); 2246 filterMenubar->changeItem( 0, i18n("No Filter") );
2251 } else { 2247 } else {
2252 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2248 CalFilter *curfilter = mView->filterView()->selectedFilter();
2253 if ( curfilter ) { 2249 if ( curfilter ) {
2254 filterMenubar->changeItem( 0, curfilter->name() ); 2250 filterMenubar->changeItem( 0, curfilter->name() );
2255 } 2251 }
2256 } 2252 }
2257 } 2253 }
2258} 2254}
2259void MainWindow::selectFilterPopup( int fil ) 2255void MainWindow::selectFilterPopup( int fil )
2260{ 2256{
2261 selectFilter( fil + 1 ); 2257 selectFilter( fil + 1 );
2262 2258
2263} 2259}
2264void MainWindow::configureToolBar( int item ) 2260void MainWindow::configureToolBar( int item )
2265{ 2261{
2266 2262
2267 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 2263 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
2268 KOPrefs *p = KOPrefs::instance(); 2264 KOPrefs *p = KOPrefs::instance();
2269 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 2265 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
2270 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); 2266 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 );
2271 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); 2267 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 );
2272 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 2268 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
2273 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 2269 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
2274 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); 2270 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 );
2275 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); 2271 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 );
2276 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); 2272 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 );
2277 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); 2273 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 );
2278 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 2274 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
2279 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 2275 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
2280 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 2276 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
2281 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 2277 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
2282 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); 2278 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 );
2283 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 2279 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
2284 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 2280 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
2285 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 2281 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
2286 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 2282 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
2287 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 2283 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
2288 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 2284 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
2289 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 2285 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
2290 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 2286 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
2291 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 2287 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
2292 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 2288 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
2293 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 2289 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
2294 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 2290 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
2295 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); 2291 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 );
2296 // initActions(); 2292 // initActions();
2297 setCaption ( i18n("Toolbar changes needs a restart!") ); 2293 setCaption ( i18n("Toolbar changes needs a restart!") );
2298} 2294}
2299void MainWindow::setCaption ( const QString & c ) 2295void MainWindow::setCaption ( const QString & c )
2300{ 2296{
2301 QString cap = c; 2297 QString cap = c;
2302 cap.replace( QRegExp("\n"), " " ); 2298 cap.replace( QRegExp("\n"), " " );
2303 cap = cap.stripWhiteSpace(); 2299 cap = cap.stripWhiteSpace();
2304 if ( cap.isEmpty() ) 2300 if ( cap.isEmpty() )
2305 cap = "KO/Pi"; 2301 cap = "KO/Pi";
2306 QWidget::setCaption( cap ); 2302 QWidget::setCaption( cap );
2307} 2303}
2308void MainWindow::setCaptionToDates() 2304void MainWindow::setCaptionToDates()
2309{ 2305{
2310 QString selDates; 2306 QString selDates;
2311 QDate date = mView->startDate(); 2307 QDate date = mView->startDate();
2312 if ( ! date.isValid() ) { 2308 if ( ! date.isValid() ) {
2313 setCaption(""); 2309 setCaption("");
2314 return; 2310 return;
2315 } 2311 }
2316 selDates = KGlobal::locale()->formatDate( date, true); 2312 selDates = KGlobal::locale()->formatDate( date, true);
2317 if (mView->startDate() < mView->endDate() ) 2313 if (mView->startDate() < mView->endDate() )
2318 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 2314 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
2319 else { 2315 else {
2320 QString addString; 2316 QString addString;
2321 if ( date == QDateTime::currentDateTime().date() ) 2317 if ( date == QDateTime::currentDateTime().date() )
2322 addString = i18n("Today"); 2318 addString = i18n("Today");
2323 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 2319 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
2324 addString = i18n("Tomorrow"); 2320 addString = i18n("Tomorrow");
2325 if ( !addString.isEmpty() ) 2321 if ( !addString.isEmpty() )
2326 selDates = addString+", "+selDates ; 2322 selDates = addString+", "+selDates ;
2327 } 2323 }
2328 setCaption( i18n("Dates: ") + selDates ); 2324 setCaption( i18n("Dates: ") + selDates );
2329 2325
2330} 2326}
2331void MainWindow::showConfigureAgenda( ) 2327void MainWindow::showConfigureAgenda( )
2332{ 2328{
2333 int iii; 2329 int iii;
2334 for ( iii = 1;iii<= 10 ;++iii ){ 2330 for ( iii = 1;iii<= 10 ;++iii ){
2335 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 2331 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
2336 } 2332 }
2337 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 2333 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
2338} 2334}
2339void MainWindow::configureAgenda( int item ) 2335void MainWindow::configureAgenda( int item )
2340{ 2336{
2341 if ( KOPrefs::instance()->mHourSize == item ) 2337 if ( KOPrefs::instance()->mHourSize == item )
2342 return; 2338 return;
2343 KOPrefs::instance()->mHourSize=item; 2339 KOPrefs::instance()->mHourSize=item;
2344 mView->viewManager()->agendaView()->updateConfig(); 2340 mView->viewManager()->agendaView()->updateConfig();
2345} 2341}
2346 2342
2347void MainWindow::saveCalendar() 2343void MainWindow::saveCalendar()
2348{ 2344{
2349 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 2345 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
2350 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 2346 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
2351 bupDir = KGlobalSettings::backupDataDir(); 2347 bupDir = KGlobalSettings::backupDataDir();
2352 bupDir = KGlobal::formatMessage ( bupDir, 0 ); 2348 bupDir = KGlobal::formatMessage ( bupDir, 0 );
2353 QString bupHint; 2349 QString bupHint;
2354 if ( !KPimGlobalPrefs::instance()->mBackupEnabled ) 2350 if ( !KPimGlobalPrefs::instance()->mBackupEnabled )
2355 bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)"); 2351 bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)");
2356 if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return; 2352 if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return;
2357 bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled; 2353 bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled;
2358 KPimGlobalPrefs::instance()->mBackupEnabled = false; 2354 KPimGlobalPrefs::instance()->mBackupEnabled = false;
2359 save(); 2355 save();
2360 KPimGlobalPrefs::instance()->mBackupEnabled = enabled; 2356 KPimGlobalPrefs::instance()->mBackupEnabled = enabled;
2361 backupAllFiles(); 2357 backupAllFiles();
2362} 2358}
2363void MainWindow::loadCalendar() 2359void MainWindow::loadCalendar()
2364{ 2360{
2365 2361
2366 2362
2367#if 0 2363#if 0
2368 QString fn = KOPrefs::instance()->mLastLoadFile; 2364 QString fn = KOPrefs::instance()->mLastLoadFile;
2369 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 2365 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
2370 2366
2371 if ( fn == "" ) 2367 if ( fn == "" )
2372 return; 2368 return;
2373 QFileInfo info; 2369 QFileInfo info;
2374 info.setFile( fn ); 2370 info.setFile( fn );
2375 QString mess; 2371 QString mess;
2376 bool loadbup = true; 2372 bool loadbup = true;
2377 if ( info. exists() ) { 2373 if ( info. exists() ) {
2378 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2374 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2379 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 2375 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
2380 mess, 2376 mess,
2381 i18n("Load!"), i18n("Cancel"), 0, 2377 i18n("Load!"), i18n("Cancel"), 0,
2382 0, 1 ); 2378 0, 1 );
2383 if ( result != 0 ) { 2379 if ( result != 0 ) {
2384 loadbup = false; 2380 loadbup = false;
2385 } 2381 }
2386 } else { 2382 } else {
2387 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2383 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2388 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 2384 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
2389 0, 1 ); 2385 0, 1 );
2390 2386
2391 return; 2387 return;
2392 } 2388 }
2393 if ( loadbup ) { 2389 if ( loadbup ) {
2394 mView->openCalendar( fn ); 2390 mView->openCalendar( fn );
2395 KOPrefs::instance()->mLastLoadFile = fn; 2391 KOPrefs::instance()->mLastLoadFile = fn;
2396 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 2392 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
2397 setCaption(mess); 2393 setCaption(mess);
2398 } 2394 }
2399#endif 2395#endif
2400 2396
2401} 2397}
2402void MainWindow::quickImportIcal() 2398void MainWindow::quickImportIcal()
2403{ 2399{
2404 importFile( KOPrefs::instance()->mLastImportFile, false ); 2400 importFile( KOPrefs::instance()->mLastImportFile, false );
2405} 2401}
2406void MainWindow::importFile( QString fn, bool quick ) 2402void MainWindow::importFile( QString fn, bool quick )
2407{ 2403{
2408 QFileInfo info; 2404 QFileInfo info;
2409 info.setFile( fn ); 2405 info.setFile( fn );
2410 QString mess; 2406 QString mess;
2411 bool loadbup = true;
2412 if ( !info. exists() ) { 2407 if ( !info. exists() ) {
2413 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 2408 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
2414 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2409 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2415 mess ); 2410 mess );
2416 return; 2411 return;
2417 } 2412 }
2418 int result = 0; 2413 int result = 0;
2419 if ( !quick ) { 2414 if ( !quick ) {
2420 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2415 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2421 result = QMessageBox::warning( this, "KO/Pi: Warning!", 2416 result = QMessageBox::warning( this, "KO/Pi: Warning!",
2422 mess, 2417 mess,
2423 "Import", "Cancel", 0, 2418 "Import", "Cancel", 0,
2424 0, 1 ); 2419 0, 1 );
2425 } 2420 }
2426 if ( result == 0 ) { 2421 if ( result == 0 ) {
2427 if ( mView->openCalendar( fn, true )) { 2422 if ( mView->openCalendar( fn, true )) {
2428 KOPrefs::instance()->mLastImportFile = fn; 2423 KOPrefs::instance()->mLastImportFile = fn;
2429 setCaption(i18n("Imported file successfully")); 2424 setCaption(i18n("Imported file successfully"));
2430 } else { 2425 } else {
2431 setCaption(i18n("Error importing file")); 2426 setCaption(i18n("Error importing file"));
2432 } 2427 }
2433 } 2428 }
2434} 2429}
2435 2430
2436void MainWindow::importIcal() 2431void MainWindow::importIcal()
2437{ 2432{
2438 2433
2439 QString fn =KOPrefs::instance()->mLastImportFile; 2434 QString fn =KOPrefs::instance()->mLastImportFile;
2440 2435
2441 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 2436 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
2442 if ( fn == "" ) 2437 if ( fn == "" )
2443 return; 2438 return;
2444 importFile( fn, true ); 2439 importFile( fn, true );
2445 2440
2446} 2441}
2447 2442
2448void MainWindow::exportVCalendar() 2443void MainWindow::exportVCalendar()
2449{ 2444{
2450 QString fn = KOPrefs::instance()->mLastVcalFile; 2445 QString fn = KOPrefs::instance()->mLastVcalFile;
2451 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 2446 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
2452 if ( fn == "" ) 2447 if ( fn == "" )
2453 return; 2448 return;
2454 QFileInfo info; 2449 QFileInfo info;
2455 info.setFile( fn ); 2450 info.setFile( fn );
2456 QString mes; 2451 QString mes;
2457 bool createbup = true; 2452 bool createbup = true;
2458 if ( info. exists() ) { 2453 if ( info. exists() ) {
2459 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 2454 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
2460 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2455 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2461 i18n("Overwrite!"), i18n("Cancel"), 0, 2456 i18n("Overwrite!"), i18n("Cancel"), 0,
2462 0, 1 ); 2457 0, 1 );
2463 if ( result != 0 ) { 2458 if ( result != 0 ) {
2464 createbup = false; 2459 createbup = false;
2465 } 2460 }
2466 } 2461 }
2467 if ( createbup ) { 2462 if ( createbup ) {
2468 if ( mView->exportVCalendar( fn ) ) { 2463 if ( mView->exportVCalendar( fn ) ) {
2469 KOPrefs::instance()->mLastVcalFile = fn; 2464 KOPrefs::instance()->mLastVcalFile = fn;
2470 if ( fn.length() > 20 ) 2465 if ( fn.length() > 20 )
2471 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 2466 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
2472 else 2467 else
2473 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 2468 mes = i18n("KO/Pi:Exported to %1").arg(fn );
2474 setCaption(mes); 2469 setCaption(mes);
2475 } 2470 }
2476 } 2471 }
2477 2472
2478} 2473}
2479QString MainWindow::sentSyncFile() 2474QString MainWindow::sentSyncFile()
2480{ 2475{
2481#ifdef DESKTOP_VERSION 2476#ifdef DESKTOP_VERSION
2482 return locateLocal( "tmp", "copysynccal.ics" ); 2477 return locateLocal( "tmp", "copysynccal.ics" );
2483#else 2478#else
2484 return QString( "/tmp/copysynccal.ics" ); 2479 return QString( "/tmp/copysynccal.ics" );
2485#endif 2480#endif
2486} 2481}
2487 2482
2488void MainWindow::syncFileRequest() 2483void MainWindow::syncFileRequest()
2489{ 2484{
2490 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2485 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2491 mSyncManager->slotSyncMenu( 999 ); 2486 mSyncManager->slotSyncMenu( 999 );
2492 } 2487 }
2493 2488
2494 setCaption(i18n("Saving Data to temp file ..." )); 2489 setCaption(i18n("Saving Data to temp file ..." ));
2495 mView->saveCalendar( sentSyncFile() ); 2490 mView->saveCalendar( sentSyncFile() );
2496 setCaption(i18n("Data saved to temp file!" )); 2491 setCaption(i18n("Data saved to temp file!" ));
2497 2492
2498} 2493}
2499void MainWindow::getFile( bool success ) 2494void MainWindow::getFile( bool success )
2500{ 2495{
2501 if ( ! success ) { 2496 if ( ! success ) {
2502 setCaption( i18n("Error receiving file. Nothing changed!") ); 2497 setCaption( i18n("Error receiving file. Nothing changed!") );
2503 return; 2498 return;
2504 } 2499 }
2505 mView->openCalendar( sentSyncFile() ); 2500 mView->openCalendar( sentSyncFile() );
2506 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2501 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2507 mSyncManager->slotSyncMenu( 999 ); 2502 mSyncManager->slotSyncMenu( 999 );
2508 } 2503 }
2509 setCaption( i18n("Pi-Sync successful!") ); 2504 setCaption( i18n("Pi-Sync successful!") );
2510} 2505}
2511void MainWindow::printListView() 2506void MainWindow::printListView()
2512{ 2507{
2513 2508
2514 QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items."); 2509 QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items.");
2515 2510
2516 KMessageBox::information( this, message); 2511 KMessageBox::information( this, message);
2517} 2512}
2518void MainWindow::printSel( ) 2513void MainWindow::printSel( )
2519{ 2514{
2520 mView->viewManager()->agendaView()->agenda()->printSelection(); 2515 mView->viewManager()->agendaView()->agenda()->printSelection();
2521} 2516}
2522 2517
2523void MainWindow::printCal() 2518void MainWindow::printCal()
2524{ 2519{
2525 mView->print();//mCp->showDialog(); 2520 mView->print();//mCp->showDialog();
2526} 2521}
2527 2522
2528 2523
2529#include "libkdepim/kdatepicker.h" 2524#include "libkdepim/kdatepicker.h"
2530#include <kdatetbl.h> 2525#include <kdatetbl.h>
2531 2526
2532void MainWindow::weekAction() 2527void MainWindow::weekAction()
2533{ 2528{
2534 int month; 2529 int month;
2535 KPopupFrame* popup = new KPopupFrame(this); 2530 KPopupFrame* popup = new KPopupFrame(this);
2536 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); 2531 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2537 // ----- 2532 // -----
2538 picker->resize(picker->sizeHint()); 2533 picker->resize(picker->sizeHint());
2539 popup->setMainWidget(picker); 2534 popup->setMainWidget(picker);
2540 picker->setFocus(); 2535 picker->setFocus();
2541 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2536 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2542 int x = 0; 2537 int x = 0;
2543 int y = iconToolBar->height(); 2538 int y = iconToolBar->height();
2544 int dX = 0; 2539 int dX = 0;
2545 int dY = 0; 2540 int dY = 0;
2546 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2541 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2547 if ( iconToolBar->y() > height()/2 ) { 2542 if ( iconToolBar->y() > height()/2 ) {
2548 dY = picker->sizeHint().height()+8; 2543 dY = picker->sizeHint().height()+8;
2549 y = 0; 2544 y = 0;
2550 } 2545 }
2551 } else { 2546 } else {
2552 if ( iconToolBar->x() > width()/2 ) { // right side 2547 if ( iconToolBar->x() > width()/2 ) { // right side
2553 x=0; 2548 x=0;
2554 dX= picker->sizeHint().width()+8; 2549 dX= picker->sizeHint().width()+8;
2555 y = 0; 2550 y = 0;
2556 } else { 2551 } else {
2557 x= iconToolBar->width(); 2552 x= iconToolBar->width();
2558 y = 0; 2553 y = 0;
2559 } 2554 }
2560 } 2555 }
2561 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2556 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2562 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2557 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2563 { 2558 {
2564 month = picker->getResult(); 2559 month = picker->getResult();
2565 emit selectWeek ( month ); 2560 emit selectWeek ( month );
2566 //qDebug("weekSelected %d ", month); 2561 //qDebug("weekSelected %d ", month);
2567 } 2562 }
2568 delete popup; 2563 delete popup;
2569} 2564}
2570 2565
2571void MainWindow::hideEvent ( QHideEvent * ) 2566void MainWindow::hideEvent ( QHideEvent * )
2572{ 2567{
2573 QString message; 2568 QString message;
2574 QDateTime nextA = mCalendar->nextAlarmEventDateTime(); 2569 QDateTime nextA = mCalendar->nextAlarmEventDateTime();
2575 if ( nextA.isValid() ) { 2570 if ( nextA.isValid() ) {
2576 QString sum = mCalendar->nextSummary(); 2571 QString sum = mCalendar->nextSummary();
2577 2572
2578 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); 2573 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false));
2579 setCaption( message ); 2574 setCaption( message );
2580 } 2575 }
2581} 2576}
2582 2577
2583void MainWindow::resizeEvent( QResizeEvent* e) 2578void MainWindow::resizeEvent( QResizeEvent* e)
2584{ 2579{
2585#ifndef DESKTOP_VERSION 2580#ifndef DESKTOP_VERSION
2586 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { 2581 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) {
2587 if (QApplication::desktop()->width() > QApplication::desktop()->height() ) 2582 if (QApplication::desktop()->width() > QApplication::desktop()->height() )
2588 filterToolBar->hide(); 2583 filterToolBar->hide();
2589 else 2584 else
2590 filterToolBar->show(); 2585 filterToolBar->show();
2591 } 2586 }
2592#endif 2587#endif
2593 QMainWindow::resizeEvent( e); 2588 QMainWindow::resizeEvent( e);
2594} 2589}
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 953774f..a948a52 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,172 +1,172 @@
1#ifndef KORGE_MAINWINDOW_H 1#ifndef KORGE_MAINWINDOW_H
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <qdict.h>
7#include <qfile.h> 7#include <qfile.h>
8#include <qmenubar.h> 8#include <qmenubar.h>
9#include <qtextstream.h> 9#include <qtextstream.h>
10#include <qregexp.h> 10#include <qregexp.h>
11 11
12#include <libkcal/incidence.h> 12#include <libkcal/incidence.h>
13#include <ksyncmanager.h> 13#include <ksyncmanager.h>
14#ifndef DESKTOP_VERSION 14#ifndef DESKTOP_VERSION
15#include <qcopchannel_qws.h> 15#include <qcopchannel_qws.h>
16#endif 16#endif
17class QAction; 17class QAction;
18class CalendarView; 18class CalendarView;
19class KSyncProfile; 19class KSyncProfile;
20#ifdef DESKTOP_VERSION 20#ifdef DESKTOP_VERSION
21 21
22#define QPEToolBar QToolBar 22#define QPEToolBar QToolBar
23#define QPEMenuBar QMenuBar 23#define QPEMenuBar QMenuBar
24#endif 24#endif
25class QPEToolBar; 25class QPEToolBar;
26class QPEMenuBar; 26class QPEMenuBar;
27 27
28 28
29namespace KCal { 29namespace KCal {
30class CalendarLocal; 30class CalendarLocal;
31} 31}
32 32
33using namespace KCal; 33using namespace KCal;
34 34
35class MainWindow : public QMainWindow 35class MainWindow : public QMainWindow
36{ 36{
37 Q_OBJECT 37 Q_OBJECT
38 public: 38 public:
39 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 39 MainWindow( QWidget *parent = 0, const char *name = 0 );
40 ~MainWindow(); 40 ~MainWindow();
41 bool beamReceiveEnabled(); 41 bool beamReceiveEnabled();
42 static QString defaultFileName(); 42 static QString defaultFileName();
43 static QString syncFileName(); 43 static QString syncFileName();
44 static QString resourcePath(); 44 static QString resourcePath();
45 public slots: 45 public slots:
46 void setUsesBigPixmaps ( bool ); 46 void setUsesBigPixmaps ( bool );
47 void setCaption ( const QString & ); 47 void setCaption ( const QString & );
48 void updateWeekNum(const KCal::DateList &); 48 void updateWeekNum(const KCal::DateList &);
49 void updateWeek(QDate); 49 void updateWeek(QDate);
50 void updateFilterToolbar(); 50 void updateFilterToolbar();
51 virtual void showMaximized (); 51 virtual void showMaximized ();
52 void configureAgenda( int ); 52 void configureAgenda( int );
53 void recieve( const QCString& msg, const QByteArray& data ); 53 void recieve( const QCString& msg, const QByteArray& data );
54 protected slots: 54 protected slots:
55 void startMultiSync(); 55 void startMultiSync();
56 void setCaptionToDates(); 56 void setCaptionToDates();
57 void weekAction(); 57 void weekAction();
58 void about(); 58 void about();
59 void licence(); 59 void licence();
60 void faq(); 60 void faq();
61 void usertrans(); 61 void usertrans();
62 void features(); 62 void features();
63 void synchowto(); 63 void synchowto();
64 void storagehowto(); 64 void storagehowto();
65 void timetrackinghowto(); 65 void timetrackinghowto();
66 void kdesynchowto(); 66 void kdesynchowto();
67 void multisynchowto(); 67 void multisynchowto();
68 void whatsNew(); 68 void whatsNew();
69 void keyBindings(); 69 void keyBindings();
70 void aboutAutoSaving();; 70 void aboutAutoSaving();;
71 void aboutKnownBugs(); 71 void aboutKnownBugs();
72 72
73 void processIncidenceSelection( Incidence * ); 73 void processIncidenceSelection( Incidence * );
74 74
75 void importQtopia(); 75 void importQtopia();
76 void importBday(); 76 void importBday();
77 void importOL(); 77 void importOL();
78 void importIcal(); 78 void importIcal();
79 void importFile( QString, bool ); 79 void importFile( QString, bool );
80 void quickImportIcal(); 80 void quickImportIcal();
81 81
82 void slotModifiedChanged( bool ); 82 void slotModifiedChanged( bool );
83 83
84 void save(); 84 void save();
85 void backupAllFiles(); 85 void backupAllFiles();
86 void saveStopTimer(); 86 void saveStopTimer();
87 void configureToolBar( int ); 87 void configureToolBar( int );
88 void printSel(); 88 void printSel();
89 void printCal(); 89 void printCal();
90 void printListView(); 90 void printListView();
91 void saveCalendar(); 91 void saveCalendar();
92 void loadCalendar(); 92 void loadCalendar();
93 void exportVCalendar(); 93 void exportVCalendar();
94 void fillFilterMenu(); 94 void fillFilterMenu();
95 void fillFilterMenuTB(); 95 void fillFilterMenuTB();
96 void selectFilter( int ); 96 void selectFilter( int );
97 void fillFilterMenuPopup(); 97 void fillFilterMenuPopup();
98 void selectFilterPopup( int ); 98 void selectFilterPopup( int );
99 void exportToPhone( int ); 99 void exportToPhone( int );
100 void toggleBeamReceive(); 100 void toggleBeamReceive();
101 void disableBR(bool); 101 void disableBR(bool);
102 signals: 102 signals:
103 void selectWeek ( int ); 103 void selectWeek ( int );
104 private slots: 104 private slots:
105 void showConfigureAgenda(); 105 void showConfigureAgenda();
106 void getFile( bool ); 106 void getFile( bool );
107 void syncFileRequest(); 107 void syncFileRequest();
108 108
109 protected: 109 protected:
110 void hideEvent ( QHideEvent * ); 110 void hideEvent ( QHideEvent * );
111 QString sentSyncFile(); 111 QString sentSyncFile();
112 void displayText( QString, QString); 112 void displayText( QString, QString);
113 void enableIncidenceActions( bool ); 113 void enableIncidenceActions( bool );
114 114
115 private: 115 private:
116 bool mBRdisabled; 116 bool mBRdisabled;
117#ifndef DESKTOP_VERSION 117#ifndef DESKTOP_VERSION
118 QCopChannel* infrared; 118 QCopChannel* infrared;
119#endif 119#endif
120 QAction* brAction; 120 QAction* brAction;
121 KSyncManager* mSyncManager; 121 KSyncManager* mSyncManager;
122 bool mClosed; 122 bool mClosed;
123 void saveOnClose(); 123 void saveOnClose();
124 bool mFlagKeyPressed; 124 bool mFlagKeyPressed;
125 bool mBlockAtStartup; 125 bool mBlockAtStartup;
126 QPEToolBar *iconToolBar; 126 QPEToolBar *iconToolBar;
127 QPEToolBar *viewToolBar; 127 QPEToolBar *viewToolBar;
128 QPEToolBar *navigatorToolBar; 128 QPEToolBar *navigatorToolBar;
129 QPEToolBar *filterToolBar; 129 QPEToolBar *filterToolBar;
130 QMenuBar *filterMenubar; 130 QMenuBar *filterMenubar;
131 QPopupMenu * filterPopupMenu; 131 QPopupMenu * filterPopupMenu;
132 QPopupMenu * mCurrentItemMenu; 132 QPopupMenu * mCurrentItemMenu;
133 void initActions(); 133 void initActions();
134 void setDefaultPreferences(); 134 void setDefaultPreferences();
135 void resizeEvent( QResizeEvent* e); 135 void resizeEvent( QResizeEvent* e);
136 void keyPressEvent ( QKeyEvent * ) ; 136 void keyPressEvent ( QKeyEvent * ) ;
137 void keyReleaseEvent ( QKeyEvent * ) ; 137 void keyReleaseEvent ( QKeyEvent * ) ;
138 QPopupMenu *configureToolBarMenu; 138 QPopupMenu *configureToolBarMenu;
139 QPopupMenu *selectFilterMenu; 139 QPopupMenu *selectFilterMenu;
140 QPopupMenu *selectFilterMenuTB; 140 QPopupMenu *selectFilterMenuTB;
141 QPopupMenu *configureAgendaMenu, *syncMenu; 141 QPopupMenu *configureAgendaMenu, *syncMenu;
142 CalendarLocal *mCalendar; 142 CalendarLocal *mCalendar;
143 CalendarView *mView; 143 CalendarView *mView;
144 QAction *mNewSubTodoAction; 144 QAction *mNewSubTodoAction;
145 QAction *mWeekAction; 145 QAction *mWeekAction;
146 QFont mWeekFont; 146 QFont mWeekFont;
147 QPixmap mWeekPixmap; 147 QPixmap mWeekPixmap;
148 QColor mWeekBgColor; 148 QColor mWeekBgColor;
149 149
150 QAction *mShowAction; 150 QAction *mShowAction;
151 QAction *mEditAction; 151 QAction *mEditAction;
152 QAction *mDeleteAction; 152 QAction *mDeleteAction;
153 QAction *mCloneAction; 153 QAction *mCloneAction;
154 QAction *mMoveAction; 154 QAction *mMoveAction;
155 QAction *mBeamAction; 155 QAction *mBeamAction;
156 QAction *mCancelAction; 156 QAction *mCancelAction;
157 157
158 QAction *mToggleNav; 158 QAction *mToggleNav;
159 QAction *mToggleFilter; 159 QAction *mToggleFilter;
160 QAction *mToggleAllday; 160 QAction *mToggleAllday;
161 QAction *actionFilterMenuTB; 161 QAction *actionFilterMenuTB;
162 162
163 void closeEvent( QCloseEvent* ce ); 163 void closeEvent( QCloseEvent* ce );
164 QTimer mSaveTimer; 164 QTimer mSaveTimer;
165 //bool mBlockSaveFlag; 165 //bool mBlockSaveFlag;
166 bool mCalendarModifiedFlag; 166 bool mCalendarModifiedFlag;
167 QPixmap loadPixmap( QString ); 167 QPixmap loadPixmap( QString );
168 QPixmap listviewPix, listviewPix0, listviewPix20, listviewPix40, listviewPix60, listviewPix80; 168 QPixmap listviewPix, listviewPix0, listviewPix20, listviewPix40, listviewPix60, listviewPix80;
169}; 169};
170 170
171 171
172#endif 172#endif