summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-29 16:41:15 (UTC)
committer zautrix <zautrix>2005-01-29 16:41:15 (UTC)
commit41baa2e15a1ec5e14750297e0a21020c9e53d953 (patch) (unidiff)
tree2a1a1ae20928d4f2dc3ac73e9be82f04563b3604
parentc6548bb194a5e73b9b72505c2e952ef6346dec46 (diff)
downloadkdepimpi-41baa2e15a1ec5e14750297e0a21020c9e53d953.zip
kdepimpi-41baa2e15a1ec5e14750297e0a21020c9e53d953.tar.gz
kdepimpi-41baa2e15a1ec5e14750297e0a21020c9e53d953.tar.bz2
fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt8
-rw-r--r--korganizer/calendarview.cpp1
-rw-r--r--korganizer/koagenda.cpp59
-rw-r--r--korganizer/koagenda.h1
-rw-r--r--korganizer/koagendaview.cpp3
-rw-r--r--korganizer/koagendaview.h1
-rw-r--r--korganizer/koviewmanager.cpp50
-rw-r--r--korganizer/koviewmanager.h1
8 files changed, 93 insertions, 31 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index 6a20868..8572bf9 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1,1201 +1,1205 @@
1{ "10 minutes","10 Minuten" }, 1{ "10 minutes","10 Minuten" },
2{ "10th","10." }, 2{ "10th","10." },
3{ "11th","11." }, 3{ "11th","11." },
4{ "12 pm Format","12 AM/PM Format" }, 4{ "12 pm Format","12 AM/PM Format" },
5{ "12th","12." }, 5{ "12th","12." },
6{ "13th","13." }, 6{ "13th","13." },
7{ "14th","14." }, 7{ "14th","14." },
8{ "15th","15." }, 8{ "15th","15." },
9{ "16th","16." }, 9{ "16th","16." },
10{ "17th","17." }, 10{ "17th","17." },
11{ "18th","18." }, 11{ "18th","18." },
12{ "19th","19." }, 12{ "19th","19." },
13{ "1 Day","1 Tag" }, 13{ "1 Day","1 Tag" },
14{ "1 h","1 Std" }, 14{ "1 h","1 Std" },
15{ "1 (high)","1 (hoch)" }, 15{ "1 (high)","1 (hoch)" },
16{ "5 (low)","5" }, 16{ "5 (low)","5" },
17{ "1st","1." }, 17{ "1st","1." },
18{ "20th","20." }, 18{ "20th","20." },
19{ "21st","21." }, 19{ "21st","21." },
20{ "22nd","22." }, 20{ "22nd","22." },
21{ "23rd","23." }, 21{ "23rd","23." },
22{ "24:00 Hour Format","24:00 Stunden Format" }, 22{ "24:00 Hour Format","24:00 Stunden Format" },
23{ "24th","24." }, 23{ "24th","24." },
24{ "25th","25." }, 24{ "25th","25." },
25{ "26th","26." }, 25{ "26th","26." },
26{ "27th","27." }, 26{ "27th","27." },
27{ "28th","28." }, 27{ "28th","28." },
28{ "29th","29." }, 28{ "29th","29." },
29{ "2nd","2." }, 29{ "2nd","2." },
30{ "30 minutes","30 Minuten" }, 30{ "30 minutes","30 Minuten" },
31{ "30th","30." }, 31{ "30th","30." },
32{ "31st","31." }, 32{ "31st","31." },
33{ "3rd","3." }, 33{ "3rd","3." },
34{ "4th","4." }, 34{ "4th","4." },
35{ "5 (lowest)","5 (Niedrigster)" }, 35{ "5 (lowest)","5 (Niedrigster)" },
36{ "5th","5." }, 36{ "5th","5." },
37{ "6th","6." }, 37{ "6th","6." },
38{ "7th","7." }, 38{ "7th","7." },
39{ "8th","8." }, 39{ "8th","8." },
40{ "9th","9." }, 40{ "9th","9." },
41{ "About...","Über..." }, 41{ "About...","Über..." },
42{ "&Accept","&Akzeptieren" }, 42{ "&Accept","&Akzeptieren" },
43{ "Accept","Akzeptieren" }, 43{ "Accept","Akzeptieren" },
44{ "Accept A&ll","A&lles Akzepieren" }, 44{ "Accept A&ll","A&lles Akzepieren" },
45{ "Access:","Zugriff:" }, 45{ "Access:","Zugriff:" },
46{ "A corresponding event is missing in your calendar!","Ein zugehöriger Termin fehlt in ihrem Kalender!" }, 46{ "A corresponding event is missing in your calendar!","Ein zugehöriger Termin fehlt in ihrem Kalender!" },
47{ "Actions","Aktionen" }, 47{ "Actions","Aktionen" },
48{ "Add Filter","Filter Hinzufügen" }, 48{ "Add Filter","Filter Hinzufügen" },
49{ "&Add","Hinzufügen" }, 49{ "&Add","Hinzufügen" },
50{ "Add","Hinzufügen" }, 50{ "Add","Hinzufügen" },
51{ "Additional email addresses:","Zusätzliche E-Mail Adressen:" }, 51{ "Additional email addresses:","Zusätzliche E-Mail Adressen:" },
52{ "Additional email address:","Zusätzliche E-Mail Adresse:" }, 52{ "Additional email address:","Zusätzliche E-Mail Adresse:" },
53{ "&Addressbook","&Adressbuch" }, 53{ "&Addressbook","&Adressbuch" },
54{ "Address &Book...","Adress&buch..." }, 54{ "Address &Book...","Adress&buch..." },
55{ "Agenda Size","Agende Größe" }, 55{ "Agenda Size","Agende Größe" },
56{ "Agenda Size:","Größe der Agenda:" }, 56{ "Agenda Size:","Größe der Agenda:" },
57{ "Agenda view:","Agenda Ansicht:" }, 57{ "Agenda view:","Agenda Ansicht:" },
58{ "Agenda view background color:","Hintergrund der Agenda Ansicht:" }, 58{ "Agenda view background color:","Hintergrund der Agenda Ansicht:" },
59{ "All attendees","Alle Teilnehmer" }, 59{ "All attendees","Alle Teilnehmer" },
60{ "AllDayAgenda Height:","Höhe Ganztages Agenda:" }, 60{ "AllDayAgenda Height:","Höhe Ganztages Agenda:" },
61{ "All day event","Ganztägig" }, 61{ "All day event","Ganztägig" },
62{ "Anonymous","Anonym" }, 62{ "Anonymous","Anonym" },
63{ "Apply","Anwenden" }, 63{ "Apply","Anwenden" },
64{ "Apr","Apr" }, 64{ "Apr","Apr" },
65{ "April","April" }, 65{ "April","April" },
66{"Ask for every entry on conflict","Frage bei Konflikten nach"}, 66{"Ask for every entry on conflict","Frage bei Konflikten nach"},
67{ "Ask for preferences before syncing","Vor dem Syncronisieren nachfragen" }, 67{ "Ask for preferences before syncing","Vor dem Syncronisieren nachfragen" },
68{ "Ask for quit when closing KO/Pi","Vor dem Beenden von KO/Pi nachfragen" }, 68{ "Ask for quit when closing KO/Pi","Vor dem Beenden von KO/Pi nachfragen" },
69{ "Attendees","Teilnehmer" }, 69{ "Attendees","Teilnehmer" },
70{ "Aug","Aug" }, 70{ "Aug","Aug" },
71{ "August","August" }, 71{ "August","August" },
72{ "Auto-Save","Automatisches Abspeichern" }, 72{ "Auto-Save","Automatisches Abspeichern" },
73{ "Auto save delay in minutes:","Verzög.autom.Speichern in Min" }, 73{ "Auto save delay in minutes:","Verzög.autom.Speichern in Min" },
74{ "Auto saving...","Automatische Sicherung..." }, 74{ "Auto saving...","Automatische Sicherung..." },
75{ "Begin on:","Starte mit:" }, 75{ "Begin on:","Starte mit:" },
76{ "Begins on: %1","Starte mit: %1" }, 76{ "Begins on: %1","Starte mit: %1" },
77{ "<b>From:</b> %1 <b>To:</b> %2","<b>Vom:</b> %1 <b>Zum:</b> %2" }, 77{ "<b>From:</b> %1 <b>To:</b> %2","<b>Vom:</b> %1 <b>Zum:</b> %2" },
78{ "<b>On:</b> %1","<b>Am:</b> %1" }, 78{ "<b>On:</b> %1","<b>Am:</b> %1" },
79{ "<b>On:</b> %1 <b>From:S</b> %2 <b>To:</b> %3","<b>Am:</b> %1 <b>Vom:S</b> %2 <b>Zum:</b> %3" }, 79{ "<b>On:</b> %1 <b>From:S</b> %2 <b>To:</b> %3","<b>Am:</b> %1 <b>Vom:S</b> %2 <b>Zum:</b> %3" },
80{ "<b>Original event:</b><p>","<b>Original Termin:</b><p>" }, 80{ "<b>Original event:</b><p>","<b>Original Termin:</b><p>" },
81{ " - both are modified after last sync"," - beide wurden nach der letzten Syncronisation verändert" }, 81{ " - both are modified after last sync"," - beide wurden nach der letzten Syncronisation verändert" },
82{ "Busy","Belegt" }, 82{ "Busy","Belegt" },
83{ "&Cancel","Abbre&chen" }, 83{ "&Cancel","Abbre&chen" },
84{ "Cancel","Abbrechen" }, 84{ "Cancel","Abbrechen" },
85{ "Cannot delete To-Do\nwhich has children.","Kann Todo nicht löschen,\n da noch Einträge vorhanden sind" }, 85{ "Cannot delete To-Do\nwhich has children.","Kann Todo nicht löschen,\n da noch Einträge vorhanden sind" },
86{ "Can't generate mail:\nNo event selected.","Kann e-Mail nicht erstellen:\nKein Termin ausgewählt." }, 86{ "Can't generate mail:\nNo event selected.","Kann e-Mail nicht erstellen:\nKein Termin ausgewählt." },
87{ "Categories...","Kategorien..." }, 87{ "Categories...","Kategorien..." },
88{ "Categories","Kategorien" }, 88{ "Categories","Kategorien" },
89{ "Category","Kategorie" }, 89{ "Category","Kategorie" },
90{ "Center View","Zentriere Ansicht" }, 90{ "Center View","Zentriere Ansicht" },
91{ "Change","Ändere" }, 91{ "Change","Ändere" },
92{ "Cinema","Kino" }, 92{ "Cinema","Kino" },
93{ "Click to add a new Todo","Hier klicken, um ein neues Todo anzulegen" }, 93{ "Click to add a new Todo","Hier klicken, um ein neues Todo anzulegen" },
94{ "Clone Item","Klone Eintrag" }, 94{ "Clone Item","Klone Eintrag" },
95{ "&Close","S&chließen" }, 95{ "&Close","S&chließen" },
96{ "Close","Schließen" }, 96{ "Close","Schließen" },
97{ "Close this dialog to abort deletion!","Zum Abbrechen des Löschvorganges Dialog schließen!" }, 97{ "Close this dialog to abort deletion!","Zum Abbrechen des Löschvorganges Dialog schließen!" },
98{ "Colors","Farben" }, 98{ "Colors","Farben" },
99{ "completed","erledigt" }, 99{ "completed","erledigt" },
100{ "completed on %1","erledigt am %1" }, 100{ "completed on %1","erledigt am %1" },
101{ "Complete","Erledigt" }, 101{ "Complete","Erledigt" },
102{ "Confidential","Vertraulich" }, 102{ "Confidential","Vertraulich" },
103{ "Configure...","Einstellungen..." }, 103{ "Configure...","Einstellungen..." },
104{ "Confirm &deletes","Löschvogang bestätigen" }, 104{ "Confirm &deletes","Löschvogang bestätigen" },
105{ "Couldn't load calendar\n '%1'.","Kann Kalender\n '%1' nicht laden." }, 105{ "Couldn't load calendar\n '%1'.","Kann Kalender\n '%1' nicht laden." },
106{ "Counter-event Viewer","Terminzähler Ansicht" }, 106{ "Counter-event Viewer","Terminzähler Ansicht" },
107{ "Daily ending hour:","Feierabend:" }, 107{ "Daily ending hour:","Feierabend:" },
108{ "Daily starting hour:","Anfangszeit:" }, 108{ "Daily starting hour:","Anfangszeit:" },
109{ "Daily","Täglich" }, 109{ "Daily","Täglich" },
110{ "Date Format","Datums Format" }, 110{ "Date Format","Datums Format" },
111{ "Date Format:","Datums Format:" }, 111{ "Date Format:","Datums Format:" },
112{ "DateNavigator:(nr)","Datums Navigator" }, 112{ "DateNavigator:(nr)","Datums Navigator" },
113{ "Dates: ","Datum: " }, 113{ "Dates: ","Datum: " },
114{ "Date && Time","Datum && Zeit" }, 114{ "Date && Time","Datum && Zeit" },
115{ "Day begins at:","Der Tag beginnt um:" }, 115{ "Day begins at:","Der Tag beginnt um:" },
116{ "Days in Next-X-Days:","Tage in Nächste-X-Tage:" }, 116{ "Days in Next-X-Days:","Tage in Nächste-X-Tage:" },
117{ "Days in What's Next:","Tage in What's Next:" }, 117{ "Days in What's Next:","Tage in What's Next:" },
118{ "day(s)","Tag(e)" }, 118{ "day(s)","Tag(e)" },
119{ "Days to show in Next-X-Days view:","Welche Tage in Nächste-X-Tagen anzeigen:" }, 119{ "Days to show in Next-X-Days view:","Welche Tage in Nächste-X-Tagen anzeigen:" },
120{ "day","Tag" }, 120{ "day","Tag" },
121{ "Dec","Dez" }, 121{ "Dec","Dez" },
122{ "December","Dezember" }, 122{ "December","Dezember" },
123{ "Default alarm time:","Standard Alarmzeit:" }, 123{ "Default alarm time:","Standard Alarmzeit:" },
124{ "Default appointment time:","Standard Termin Startzeit:" }, 124{ "Default appointment time:","Standard Termin Startzeit:" },
125{ "Default event color:","Standard Terminfarbe:" }, 125{ "Default event color:","Standard Terminfarbe:" },
126{ "Default","Standard" }, 126{ "Default","Standard" },
127{ "Def. duration of new app.:","Standard Termin Länge:" }, 127{ "Def. duration of new app.:","Standard Termin Länge:" },
128{ "Delete all completed To-Dos?","Alle bereits erledigten Todos löschen?" }, 128{ "Delete all completed To-Dos?","Alle bereits erledigten Todos löschen?" },
129{ "Delete All","Lösche alles" }, 129{ "Delete All","Lösche alles" },
130{ "Delete all selected","Lösche alle Selektierten" }, 130{ "Delete all selected","Lösche alle Selektierten" },
131{ "Delete Current","Aktuellen löschen" }, 131{ "Delete Current","Aktuellen löschen" },
132{ "Delete Event...","Lösche Termin..." }, 132{ "Delete Event...","Lösche Termin..." },
133{ "Delete Event","Lösche Termin" }, 133{ "Delete Event","Lösche Termin" },
134{ "&Delete","Löschen" }, 134{ "&Delete","Löschen" },
135{ "Delete...","Löschen..." }, 135{ "Delete...","Löschen..." },
136{ "Delete","Löschen" }, 136{ "Delete","Löschen" },
137{ "Delete Todo...","Lösche Todo..." }, 137{ "Delete Todo...","Lösche Todo..." },
138{ "Delete To-Do","Lösche Todo" }, 138{ "Delete To-Do","Lösche Todo" },
139{ "Deleting item %d ...","Lösche Eintrag %d..." }, 139{ "Deleting item %d ...","Lösche Eintrag %d..." },
140{ "Descriptions","Beschreibungen" }, 140{ "Descriptions","Beschreibungen" },
141{ "Deselect All","Deselektiere Alle" }, 141{ "Deselect All","Deselektiere Alle" },
142{ "Details","Details" }, 142{ "Details","Details" },
143{ "Dinner","Abendessen" }, 143{ "Dinner","Abendessen" },
144{ "Do you really want\nto close KO/Pi?","Möchten Sie wirklich\nKO/PI verlassen?" }, 144{ "Do you really want\nto close KO/Pi?","Möchten Sie wirklich\nKO/PI verlassen?" },
145{ "Due Date","Fällig am" }, 145{ "Due Date","Fällig am" },
146{ "Due: ","Fällig: "}, 146{ "Due: ","Fällig: "},
147{ "Due Time","Fällig um" }, 147{ "Due Time","Fällig um" },
148{ "Due:","Fällig:"}, 148{ "Due:","Fällig:"},
149{ "Duration: ","Dauer: " }, 149{ "Duration: ","Dauer: " },
150{ "Edit...","Bearbeite..." }, 150{ "Edit...","Bearbeite..." },
151{ "Edit","Bearbeite" }, 151{ "Edit","Bearbeite" },
152{ "Edit Event...","Bearbeite Termin..." }, 152{ "Edit Event...","Bearbeite Termin..." },
153{ "Edit Event","Bearbeite Termin" }, 153{ "Edit Event","Bearbeite Termin" },
154{ "Edit exceptions","Bearbeite Ausnahmen" }, 154{ "Edit exceptions","Bearbeite Ausnahmen" },
155{ "EditorBox:","Editor Fenster:" }, 155{ "EditorBox:","Editor Fenster:" },
156{ "Edit Recurrence Range","Bearbeite Wiederholung" }, 156{ "Edit Recurrence Range","Bearbeite Wiederholung" },
157{ "Edit Todo...","Berabeite Todo..." }, 157{ "Edit Todo...","Berabeite Todo..." },
158{ "Edit To-Do","Todo bearbeiten" }, 158{ "Edit To-Do","Todo bearbeiten" },
159{ "E&mail address:","E&mail Adresse:" }, 159{ "E&mail address:","E&mail Adresse:" },
160{ "(EmptyEmail)","(KeineEmail)" }, 160{ "(EmptyEmail)","(KeineEmail)" },
161{ "(EmptyName)","(KeinName)" }, 161{ "(EmptyName)","(KeinName)" },
162{ "Enable Recurrence","Wiederholender Termin" }, 162{ "Enable Recurrence","Wiederholender Termin" },
163{ "End after","Endet nach"}, 163{ "End after","Endet nach"},
164{ "End by:","Endet am"}, 164{ "End by:","Endet am"},
165{ "End Date","End Datum" }, 165{ "End Date","End Datum" },
166{ "End:","Ende:" }, 166{ "End:","Ende:" },
167{ "End Time","End Zeit" }, 167{ "End Time","End Zeit" },
168{ "English","Englisch" }, 168{ "English","Englisch" },
169{ "Event","Termin" }, 169{ "Event","Termin" },
170{ "Event list","Termin Liste" }, 170{ "Event list","Termin Liste" },
171{ "Events","Termine" }, 171{ "Events","Termine" },
172{ "Event Viewer:","Termin Übersicht:" }, 172{ "Event Viewer:","Termin Übersicht:" },
173{ "every","jede" }, 173{ "every","jede" },
174{ "Exceptions...","Ausnahmen..." }, 174{ "Exceptions...","Ausnahmen..." },
175{ "Exceptions","Ausnahmen" }, 175{ "Exceptions","Ausnahmen" },
176{ "Exclude holidays","Ohne freie Tage" }, 176{ "Exclude holidays","Ohne freie Tage" },
177{ "Exclude Saturdays","Ohne Samstage" }, 177{ "Exclude Saturdays","Ohne Samstage" },
178{ "Feb","Feb" }, 178{ "Feb","Feb" },
179{ "February","Februar" }, 179{ "February","Februar" },
180{ "&Find","Suche!" }, 180{ "&Find","Suche!" },
181{ "Fonts","Schriftart" }, 181{ "Fonts","Schriftart" },
182{ "Force take local entry always","Erzwinge:Nimm immer lokalen Eintrag" }, 182{ "Force take local entry always","Erzwinge:Nimm immer lokalen Eintrag" },
183{ "Force take remote entry always","Erzwinge:Nimm immer fernen Eintrag"}, 183{ "Force take remote entry always","Erzwinge:Nimm immer fernen Eintrag"},
184{ "Free","Frei" }, 184{ "Free","Frei" },
185{ "Friday","Freitag" }, 185{ "Friday","Freitag" },
186{ "Fri","Fr" }, 186{ "Fri","Fr" },
187{ "From:","Vom:" }, 187{ "From:","Vom:" },
188{ "Full &name:","Vor- und &Nachname:" }, 188{ "Full &name:","Vor- und &Nachname:" },
189{ "General","Allgemein" }, 189{ "General","Allgemein" },
190{ "German","Deutsch" }, 190{ "German","Deutsch" },
191{ "Gifts","Geschenke" }, 191{ "Gifts","Geschenke" },
192{ "Go to Today","Heute anzeigen" }, 192{ "Go to Today","Heute anzeigen" },
193{ "Help","Hilfe" }, 193{ "Help","Hilfe" },
194{ "Hide Dates","Daten ausblenden" }, 194{ "Hide Dates","Daten ausblenden" },
195{ "Highlight color:","Markierungen:" }, 195{ "Highlight color:","Markierungen:" },
196{ "Holiday color:","Freie Tage:" }, 196{ "Holiday color:","Freie Tage:" },
197{ "hour(s)","Stunde(n)" }, 197{ "hour(s)","Stunde(n)" },
198{ "In %1 days: ","In %1 Tagen: " }, 198{ "In %1 days: ","In %1 Tagen: " },
199{ "Incomplete Todo:","Unerledigte Aufgaben:" }, 199{ "Incomplete Todo:","Unerledigte Aufgaben:" },
200{ "Information","Information" }, 200{ "Information","Information" },
201{ "Invalid search expression,\ncannot perform ","Kann Suche nicht ausführen" }, 201{ "Invalid search expression,\ncannot perform ","Kann Suche nicht ausführen" },
202{ "Jan","Jan" }, 202{ "Jan","Jan" },
203{ "January","Januar" }, 203{ "January","Januar" },
204{ "JournalView:","Journal Ansicht:" }, 204{ "JournalView:","Journal Ansicht:" },
205{ "Journals","Journale" }, 205{ "Journals","Journale" },
206{ "Jul","Jul" }, 206{ "Jul","Jul" },
207{ "July","Juli" }, 207{ "July","Juli" },
208{ "Jump to date","Springe zum Datum" }, 208{ "Jump to date","Springe zum Datum" },
209{ "June","Juni" }, 209{ "June","Juni" },
210{ "Jun","Jun" }, 210{ "Jun","Jun" },
211{ "Key Bindings...","Tastenzuordnung..." }, 211{ "Key Bindings...","Tastenzuordnung..." },
212{ "Kids","Kinder" }, 212{ "Kids","Kinder" },
213{ "Known Problems...","Bekannte Probleme..." }, 213{ "Known Problems...","Bekannte Probleme..." },
214{ "KO/Pi Find ","KO/Pi Suchdialog " }, 214{ "KO/Pi Find ","KO/Pi Suchdialog " },
215{ "KO/Pi Find: ","KO/Pi Suchen: " }, 215{ "KO/Pi Find: ","KO/Pi Suchen: " },
216{ "KO/Pi is starting ... "," KO/Pi startet ... \n... Zeit für eine Kaffeepause ..." }, 216{ "KO/Pi is starting ... "," KO/Pi startet ... \n... Zeit für eine Kaffeepause ..." },
217{ "Language:(needs restart)","Sprache (Neustart!)" }, 217{ "Language:(needs restart)","Sprache (Neustart!)" },
218{ "Language:","Sprache" }, 218{ "Language:","Sprache" },
219{ "Large","Etwas mehr" }, 219{ "Large","Etwas mehr" },
220{ "List View:","Listenansicht:" }, 220{ "List View:","Listenansicht:" },
221{ "List View","Listenansicht" }, 221{ "List View","Listenansicht" },
222{ "Load/Save","Laden/Speichern" }, 222{ "Load/Save","Laden/Speichern" },
223{ "Load Template","Lade Vorlage" }, 223{ "Load Template","Lade Vorlage" },
224{ "Locale","Localisation" }, 224{ "Locale","Localisation" },
225{ "Local temp file:","Lokale temp. Datei:" }, 225{ "Local temp file:","Lokale temp. Datei:" },
226{ "Location: ","Ort: " }, 226{ "Location: ","Ort: " },
227{ "Location:","Ort:" }, 227{ "Location:","Ort:" },
228{ "Mail client","Mail Programm" }, 228{ "Mail client","Mail Programm" },
229{ "Mail Client","Mail Programm" }, 229{ "Mail Client","Mail Programm" },
230{ "March","März" }, 230{ "March","März" },
231{ "Mar","Mär" }, 231{ "Mar","Mär" },
232{ "May","Mai" }, 232{ "May","Mai" },
233{ "M. Bains line:","M. Bains Linie:" }, 233{ "M. Bains line:","M. Bains Linie:" },
234{ "Medium","Medium" }, 234{ "Medium","Medium" },
235{ "Method","Methode" }, 235{ "Method","Methode" },
236{ "minute(s)","Minute(n)" }, 236{ "minute(s)","Minute(n)" },
237{ "Monday","Montag" }, 237{ "Monday","Montag" },
238{ "Mon","Mo" }, 238{ "Mon","Mo" },
239{ "Monthly","Monatlich" }, 239{ "Monthly","Monatlich" },
240{ "Month not long enough","Monat ist nicht lang genug" }, 240{ "Month not long enough","Monat ist nicht lang genug" },
241{ "month(s)","Monat(e)" }, 241{ "month(s)","Monat(e)" },
242{ "Month view:","Monatsansicht:" }, 242{ "Month view:","Monatsansicht:" },
243{ "Month view uses category colors","Monatsansicht zeigt Kategorie Farben" }, 243{ "Month view uses category colors","Monatsansicht zeigt Kategorie Farben" },
244{ "Todo view uses category colors","To-Do Ansicht zeigt Kategorie Farben" }, 244{ "Todo view uses category colors","To-Do Ansicht zeigt Kategorie Farben" },
245{ "Move &Down","Nach unten verschieben" }, 245{ "Move &Down","Nach unten verschieben" },
246{ "Move &Up","Nach oben verschieben" }, 246{ "Move &Up","Nach oben verschieben" },
247{ "Name:","Name:" }, 247{ "Name:","Name:" },
248{ "Name","Name" }, 248{ "Name","Name" },
249{ "\nAre you sure you want\nto delete this event?","\nSind Sie sicher, dass Sie\nden Termin löschen möchten?" }, 249{ "\nAre you sure you want\nto delete this event?","\nSind Sie sicher, dass Sie\nden Termin löschen möchten?" },
250{ "%n Days","%n Tage" }, 250{ "%n Days","%n Tage" },
251{ "Never","Nie" }, 251{ "Never","Nie" },
252{ "New event...","Neuer Termin..." }, 252{ "New event...","Neuer Termin..." },
253{ "New event","Neuer Termin" }, 253{ "New event","Neuer Termin" },
254{ "New Event...","Neuer Termin..." }, 254{ "New Event...","Neuer Termin..." },
255{ "New Events/Todos should","Neue Termine/Todos sollten" }, 255{ "New Events/Todos should","Neue Termine/Todos sollten" },
256{ "&New","&Neu" }, 256{ "&New","&Neu" },
257{ "New","Neu", }, 257{ "New","Neu", },
258{ "New Sub-Todo...","Neues Sub-Todo..." }, 258{ "New Sub-Todo...","Neues Sub-Todo..." },
259{ "New Todo...","Neues Todo..." }, 259{ "New Todo...","Neues Todo..." },
260{ "Next Alarm: ","Nächster Alarm: ", }, 260{ "Next Alarm: ","Nächster Alarm: ", },
261{ "&Next Day","&Nächster Tag", }, 261{ "&Next Day","&Nächster Tag", },
262{ "Next days view uses full window","Nächste-X-Tage nutzt Vollbild" }, 262{ "Next days view uses full window","Nächste-X-Tage nutzt Vollbild" },
263{ "Next month","Nächster Monat" }, 263{ "Next month","Nächster Monat" },
264{ "&Next Week","&Nächste Woche" }, 264{ "&Next Week","&Nächste Woche" },
265{ "Next year","Nächstes Jahr" }, 265{ "Next year","Nächstes Jahr" },
266{ "Next Year","Nächstes Jahr" }, 266{ "Next Year","Nächstes Jahr" },
267{ "%n h","%n Std" }, 267{ "%n h","%n Std" },
268{ "No ending date","Kein End-Datum", }, 268{ "No ending date","Kein End-Datum", },
269{ "No event, nothing to do.","Kein Termin, nichts zu tun.", }, 269{ "No event, nothing to do.","Kein Termin, nichts zu tun.", },
270{ "No event selected.","Kein Termin selektiert" }, 270{ "No event selected.","Kein Termin selektiert" },
271{ "No","Nein" }, 271{ "No","Nein" },
272{ "No program set","Kein Programm ausgewählt", }, 272{ "No program set","Kein Programm ausgewählt", },
273{ "Normal","Normal" }, 273{ "Normal","Normal" },
274{ "[No selection]","Keine Selektion", }, 274{ "[No selection]","Keine Selektion", },
275{ "No sound set","Kein Sound ausgewählt", }, 275{ "No sound set","Kein Sound ausgewählt", },
276{ "no time ","keine Zeit ", }, 276{ "no time ","keine Zeit ", },
277{ "no time","keine Zeit", }, 277{ "no time","keine Zeit", },
278{ "No Time","Keine Zeit" }, 278{ "No Time","Keine Zeit" },
279{ "November","November" }, 279{ "November","November" },
280{ "Nov","Nov", }, 280{ "Nov","Nov", },
281{ "\nThis event recurs\nover multiple dates.\n","\nDieser Termin wiederholt sich an mehreren Tagen.\n" }, 281{ "\nThis event recurs\nover multiple dates.\n","\nDieser Termin wiederholt sich an mehreren Tagen.\n" },
282{ "occurrence(s)","Vorkommen" }, 282{ "occurrence(s)","Vorkommen" },
283{ "October","Oktober" }, 283{ "October","Oktober" },
284{ "Oct","Okt", }, 284{ "Oct","Okt", },
285{ "O-due!","Ü-fällig! " }, 285{ "O-due!","Ü-fällig! " },
286{ "&OK","&OK" }, 286{ "&OK","&OK" },
287{ "Ok+Show!","Ok+Anzeigen" }, 287{ "Ok+Show!","Ok+Anzeigen" },
288{ "Organizer: %1","Organisator %1" }, 288{ "Organizer: %1","Organisator %1" },
289{ "Organizer","Organisator" }, 289{ "Organizer","Organisator" },
290{ "Owner: ","Besitzer: " }, 290{ "Owner: ","Besitzer: " },
291{ "Owner:","Besitzer:" }, 291{ "Owner:","Besitzer:" },
292{ "<p><b>Priority:</b> %2</p>","<p><b>Priorität:</b> %2</p>" }, 292{ "<p><b>Priority:</b> %2</p>","<p><b>Priorität:</b> %2</p>" },
293{ "Pick a date to display","Wähle einen Tag zum anzeigen aus" }, 293{ "Pick a date to display","Wähle einen Tag zum anzeigen aus" },
294{ "Please specify a valid due date.","Bitte gültiges Fälligkeitsdatum angeben."}, 294{ "Please specify a valid due date.","Bitte gültiges Fälligkeitsdatum angeben."},
295{ "Please specify a valid end date, for example '%1'.","Bitte gültiges Enddatum angeben, z.B.'%1'." }, 295{ "Please specify a valid end date, for example '%1'.","Bitte gültiges Enddatum angeben, z.B.'%1'." },
296{ "Please specify a valid start date.","Bitte gültiges Startdatum angeben." }, 296{ "Please specify a valid start date.","Bitte gültiges Startdatum angeben." },
297{ "Please specify a valid start date, for example '%1'.","Bitte gültiges Startdatum angeben, z.B. '%1'." }, 297{ "Please specify a valid start date, for example '%1'.","Bitte gültiges Startdatum angeben, z.B. '%1'." },
298{ "Please specify a valid start time.","Bitte gültige Startzeit angeben."}, 298{ "Please specify a valid start time.","Bitte gültige Startzeit angeben."},
299{ "Please specify a valid start time, for example '%1'.","Bitte gültige Startzeit angeben, z.B. '%1'." }, 299{ "Please specify a valid start time, for example '%1'.","Bitte gültige Startzeit angeben, z.B. '%1'." },
300{ "Preferences - some settings need a restart (nr)","Einstellungen - teilweise Neustart erforderlich (bn)" }, 300{ "Preferences - some settings need a restart (nr)","Einstellungen - teilweise Neustart erforderlich (bn)" },
301{ "&Previous Day","Vorheriger Tag" }, 301{ "&Previous Day","Vorheriger Tag" },
302{ "Previous month","Vorheriger Monat" }, 302{ "Previous month","Vorheriger Monat" },
303{ "Previous Month","Vorheriger Monat" }, 303{ "Previous Month","Vorheriger Monat" },
304{ "&Previous Week","Vorherige Woche" }, 304{ "&Previous Week","Vorherige Woche" },
305{ "Previous year","Vorheriges Jahr" }, 305{ "Previous year","Vorheriges Jahr" },
306{ "Previous Year","Vorheriges Jahr" }, 306{ "Previous Year","Vorheriges Jahr" },
307{ "Printing","Drucken" }, 307{ "Printing","Drucken" },
308{ "Priority:","Priorität:" }, 308{ "Priority:","Priorität:" },
309{ "Private","Privat" }, 309{ "Private","Privat" },
310{ "Proceed","Weiter" }, 310{ "Proceed","Weiter" },
311{ "Public","Öffentlich" }, 311{ "Public","Öffentlich" },
312{ "Purge","Entferne" }, 312{ "Purge","Entferne" },
313{ "Purge Completed","Entferne erledigte ToDos" }, 313{ "Purge Completed","Entferne erledigte ToDos" },
314{ "Purge To-Dos","Todos bereinigen" }, 314{ "Purge To-Dos","Todos bereinigen" },
315{ "read-only","schreibgeschützt" }, 315{ "read-only","schreibgeschützt" },
316{ "Recur every","Wiederh. alle" }, 316{ "Recur every","Wiederh. alle" },
317{ "Recur in the month of","Wiederh. im Monat" }, 317{ "Recur in the month of","Wiederh. im Monat" },
318{ "Recur on the","Wiederh. am" }, 318{ "Recur on the","Wiederh. am" },
319{ "Recur on this day","Wiederh. am diesen Tag" }, 319{ "Recur on this day","Wiederh. am diesen Tag" },
320{ "Recurrence Range...","Wiederholungs Zeitraum..." }, 320{ "Recurrence Range...","Wiederholungs Zeitraum..." },
321{ "Recurrence Range","Wiederholungs Zeitraum" }, 321{ "Recurrence Range","Wiederholungs Zeitraum" },
322{ "Recurrence Rule","Wiederholungs Regel" }, 322{ "Recurrence Rule","Wiederholungs Regel" },
323{ "Recurrence","Wiederholung" }, 323{ "Recurrence","Wiederholung" },
324{ "Recurs","Wiederholung" }, 324{ "Recurs","Wiederholung" },
325{"&Reject","Abweisen"}, 325{"&Reject","Abweisen"},
326{ "Reminder:","Alarm:" }, 326{ "Reminder:","Alarm:" },
327{ "Rem.:","Alarm:" }, 327{ "Rem.:","Alarm:" },
328{ "Rem.","Alarm:" }, 328{ "Rem.","Alarm:" },
329{ "Remote file:","Remote Datei:"}, 329{ "Remote file:","Remote Datei:"},
330{ "Remote IP:","Remote (ferne) IP:" }, 330{ "Remote IP:","Remote (ferne) IP:" },
331{ "Remote syncing (via ssh/scp) network settings ","Remote Sync (via ssh/scp) Netzwerk Einstellungen " }, 331{ "Remote syncing (via ssh/scp) network settings ","Remote Sync (via ssh/scp) Netzwerk Einstellungen " },
332{ "Remote user:","Remote Benutzer"}, 332{ "Remote user:","Remote Benutzer"},
333{ "&Remove","Entfe&rnen" }, 333{ "&Remove","Entfe&rnen" },
334{ "Remove","Entfernen" }, 334{ "Remove","Entfernen" },
335{ "Request response","Bemerkung anfordern" }, 335{ "Request response","Bemerkung anfordern" },
336{ "Role:","Rolle:" }, 336{ "Role:","Rolle:" },
337{ "Role","Rolle" }, 337{ "Role","Rolle" },
338{ "Sat","Sa" }, 338{ "Sat","Sa" },
339{ "Saturday","Samstag" }, 339{ "Saturday","Samstag" },
340{ "Search for:","Suche nach:" }, 340{ "Search for:","Suche nach:" },
341{ "Search In","Suche in" }, 341{ "Search In","Suche in" },
342{ "Search...","Suche..." }, 342{ "Search...","Suche..." },
343{ "Search","Suche" }, 343{ "Search","Suche" },
344{ "Select Addresses","Wähle Adressen" }, 344{ "Select Addresses","Wähle Adressen" },
345{ "Select all","Selektiere Alle" }, 345{ "Select all","Selektiere Alle" },
346{ "Select a month","Wähle Monat" }, 346{ "Select a month","Wähle Monat" },
347{ "Select a week","Wähle Woche" }, 347{ "Select a week","Wähle Woche" },
348{ "Select a year","Wähle Jahr" }, 348{ "Select a year","Wähle Jahr" },
349{ "Send directly","Sende direkt" }, 349{ "Send directly","Sende direkt" },
350{ "&Send Messages","&Sende Nachrichten", }, 350{ "&Send Messages","&Sende Nachrichten", },
351{ "Sep","Sep" }, 351{ "Sep","Sep" },
352{ "September","September" }, 352{ "September","September" },
353{ "Shopping","Einkaufen" }, 353{ "Shopping","Einkaufen" },
354{ "Use short date in (WN/E) view","Kurzdatum in (WN/Termin) Ansicht" }, 354{ "Use short date in (WN/E) view","Kurzdatum in (WN/Termin) Ansicht" },
355{ "Show Dates","Zeige Daten" }, 355{ "Show Dates","Zeige Daten" },
356{ "Show events that recur daily in date nav.","Zeige tägl.wiederh.Term.in Datums Nav." }, 356{ "Show events that recur daily in date nav.","Zeige tägl.wiederh.Term.in Datums Nav." },
357{ "Show Event...","Zeige Termin..." }, 357{ "Show Event...","Zeige Termin..." },
358{ "Show ev. that recur weekly in date nav.","Zeige wöch.wiederh.Term.in Datums Nav." }, 358{ "Show ev. that recur weekly in date nav.","Zeige wöch.wiederh.Term.in Datums Nav." },
359{ "Show Marcus Bains line","Zeige Marcus Bains Linie" }, 359{ "Show Marcus Bains line","Zeige Marcus Bains Linie" },
360{ "Show summary after syncing","Zeige Zusammenfassung nach Sync." }, 360{ "Show summary after syncing","Zeige Zusammenfassung nach Sync." },
361{ "Show time as:","Zeige Zeit als" }, 361{ "Show time as:","Zeige Zeit als" },
362{ "Show Todo...","Zeige To-Do" }, 362{ "Show Todo...","Zeige To-Do" },
363{ "Show topmost todo prios in What's N.:","Anz. höchster Prios in What's N.:"}, 363{ "Show topmost todo prios in What's N.:","Anz. höchster Prios in What's N.:"},
364{ "Show topmost todo prios in What's Next:","Anz. höchster Prios in What's Next:"}, 364{ "Show topmost todo prios in What's Next:","Anz. höchster Prios in What's Next:"},
365{ "Show vertical screen (Needs restart)","Vertikaler Bildschirm-Layout (Neustart!)" }, 365{ "Show vertical screen (Needs restart)","Vertikaler Bildschirm-Layout (Neustart!)" },
366{ "&Show","Zeige" }, 366{ "&Show","Zeige" },
367{ "Show...","Zeige..." }, 367{ "Show...","Zeige..." },
368{ "Show","Zeige" }, 368{ "Show","Zeige" },
369{ "Small","Klein" }, 369{ "Small","Klein" },
370{ "Sorry","Entschuldigung" }, 370{ "Sorry","Entschuldigung" },
371{"Sorry, the copy command failed!\nCommand was:\n","Der Kopierbefehl schlug fehl!\nBefehl war:\n"}, 371{"Sorry, the copy command failed!\nCommand was:\n","Der Kopierbefehl schlug fehl!\nBefehl war:\n"},
372{ "Start:","Start:" }, 372{ "Start:","Start:" },
373{ "Start Date","Start Datum" }, 373{ "Start Date","Start Datum" },
374{ "Start date: %1","Start Datum: %1" }, 374{ "Start date: %1","Start Datum: %1" },
375{ "Start Time","Start Zeit" }, 375{ "Start Time","Start Zeit" },
376{ "Status:","Status:" }, 376{ "Status:","Status:" },
377{ "Status","Status:" }, 377{ "Status","Status:" },
378{ "Summaries","Titel" }, 378{ "Summaries","Titel" },
379{ "Summary:","Titel:" }, 379{ "Summary:","Titel:" },
380{ "Summary","Titel" }, 380{ "Summary","Titel" },
381{ "Sunday","Sonntag" }, 381{ "Sunday","Sonntag" },
382{ "Sun","So" }, 382{ "Sun","So" },
383{ "Sync preferences:","Sync Einstellungen" }, 383{ "Sync preferences:","Sync Einstellungen" },
384{ "Sync Prefs","Sync Einstellungen" }, 384{ "Sync Prefs","Sync Einstellungen" },
385{ "Syncronize","Daten abgleich" }, 385{ "Syncronize","Daten abgleich" },
386{ "Take local entry on conflict","Nimm lokalen Eintrag beim Konflikt" }, 386{ "Take local entry on conflict","Nimm lokalen Eintrag beim Konflikt" },
387{ "Take newest entry on conflict","Nimm neuesten Eintrag beim Konflikt" }, 387{ "Take newest entry on conflict","Nimm neuesten Eintrag beim Konflikt" },
388{ "Take remote entry on conflict","Nimm fernen Eintrag beim Konflikt" }, 388{ "Take remote entry on conflict","Nimm fernen Eintrag beim Konflikt" },
389{ "Template '%1' does not contain a valid Todo.","Template '%1' enthält kein gültiges To-Do" }, 389{ "Template '%1' does not contain a valid Todo.","Template '%1' enthält kein gültiges To-Do" },
390{ "Template does not contain a valid Event.","Template '%1' enthält keinen gültigen Termin" }, 390{ "Template does not contain a valid Event.","Template '%1' enthält keinen gültigen Termin" },
391{ "Template...","Vorlage..." }, 391{ "Template...","Vorlage..." },
392{ "This day","Dieser Tag" }, 392{ "This day","Dieser Tag" },
393{ "This is an experimental feature. ","Dieses Feature ist experimentel" }, 393{ "This is an experimental feature. ","Dieses Feature ist experimentel" },
394{ "This item will be\npermanently deleted.","Dieser Eintrag wird\nkomplett gelöscht." }, 394{ "This item will be\npermanently deleted.","Dieser Eintrag wird\nkomplett gelöscht." },
395{ "This item will be permanently deleted.", "Dieser Eintrag wird komplett gelöscht." }, 395{ "This item will be permanently deleted.", "Dieser Eintrag wird komplett gelöscht." },
396{ "Thu","Do" }, 396{ "Thu","Do" },
397{ "Thursday","Donnerstag" }, 397{ "Thursday","Donnerstag" },
398{ "Time associated","Mit Zeit" }, 398{ "Time associated","Mit Zeit" },
399{ "Time bar:","Uhrzeit Zeile:" }, 399{ "Time bar:","Uhrzeit Zeile:" },
400{ "Time && Date","Zeit und Datum" }, 400{ "Time && Date","Zeit und Datum" },
401{ "Time Format","Zeit Format" }, 401{ "Time Format","Zeit Format" },
402{ "Time Format(nr):","Zeit Format(Neustart!)" }, 402{ "Time Format(nr):","Zeit Format(Neustart!)" },
403{ "Date Labels:","Datumsleiste:" }, 403{ "Date Labels:","Datumsleiste:" },
404{ "Time: ","Zeit: " }, 404{ "Time: ","Zeit: " },
405{ "Timezone:","Zeitzone:" }, 405{ "Timezone:","Zeitzone:" },
406{ "To: ","Bis: " }, 406{ "To: ","Bis: " },
407{ "To:","Bis:" }, 407{ "To:","Bis:" },
408{ "Today: ","Heute: " }, 408{ "Today: ","Heute: " },
409{ "Todo due today color:","Heute fällige To-Do's" }, 409{ "Todo due today color:","Heute fällige To-Do's" },
410{ "To-do items:","To-Do items:" }, 410{ "To-do items:","To-Do items:" },
411{ "Todo overdue color:","Überfällige To-Do's" }, 411{ "Todo overdue color:","Überfällige To-Do's" },
412{ "Todo","Todo" }, 412{ "Todo","Todo" },
413{ "To-do view shows completed Todos","To-do Ansicht zeigt erledigte To-dos" }, 413{ "To-do view shows completed Todos","To-do Ansicht zeigt erledigte To-dos" },
414{ "ToDoView:","Todo Ansicht:" }, 414{ "ToDoView:","Todo Ansicht:" },
415{ "Toggle Alarm","Wechsle Alarm" }, 415{ "Toggle Alarm","Wechsle Alarm" },
416{ "Toggle Allday","Umschalten Ganztag" }, 416{ "Toggle Allday","Umschalten Ganztag" },
417{ "Tomorrow: ","Morgen: " }, 417{ "Tomorrow: ","Morgen: " },
418{ "Tue","Di" }, 418{ "Tue","Di" },
419{ "Tuesday","Dienstag" }, 419{ "Tuesday","Dienstag" },
420{ "Two entries are in conflict, if: ","Zwei Einträge haben einen Konflikt, wenn:" }, 420{ "Two entries are in conflict, if: ","Zwei Einträge haben einen Konflikt, wenn:" },
421{ "Unable to find template '%1'.","Kann Vorlage '%1' nicht finden." }, 421{ "Unable to find template '%1'.","Kann Vorlage '%1' nicht finden." },
422{ "Unknown","Unbekannt" }, 422{ "Unknown","Unbekannt" },
423{ "Up","Hinauf" }, 423{ "Up","Hinauf" },
424{ "Use password (if not, ask when syncing)","Passwort: (sonst jedesmal anfragen)" }, 424{ "Use password (if not, ask when syncing)","Passwort: (sonst jedesmal anfragen)" },
425{ "User defined","Benutzerdefiniert" }, 425{ "User defined","Benutzerdefiniert" },
426{ "User long date:","Format langes Datum:" }, 426{ "User long date:","Format langes Datum:" },
427{ "User short date:","Forma kurzes Datum:" }, 427{ "User short date:","Forma kurzes Datum:" },
428{ "View","Ansicht" }, 428{ "View","Ansicht" },
429{ "View Fonts","Schriftarten Ansichten" }, 429{ "View Fonts","Schriftarten Ansichten" },
430{ "Views","Ansichten" }, 430{ "Views","Ansichten" },
431{ "Wed","Mi" }, 431{ "Wed","Mi" },
432{ "Wednesday","Mittwoch" }, 432{ "Wednesday","Mittwoch" },
433{ "Week %1","Woche %1" }, 433{ "Week %1","Woche %1" },
434{ "Weekly","Wöchentlich" }, 434{ "Weekly","Wöchentlich" },
435{ "Week starts on Sunday","Woche beginnt Sonntags" }, 435{ "Week starts on Sunday","Woche beginnt Sonntags" },
436{ "What's Next View:","What's Next Anz." }, 436{ "What's Next View:","What's Next Anz." },
437{ "What's next ?","Was kommt als nächstes?(What's Next)" }, 437{ "What's next ?","Was kommt als nächstes?(What's Next)" },
438{ "Working Hours","Tägliche Arbeitszeit" }, 438{ "Working Hours","Tägliche Arbeitszeit" },
439{ "Working hours color:","Arbeitszeit in der Agenda Ansicht:" }, 439{ "Working hours color:","Arbeitszeit in der Agenda Ansicht:" },
440{ "Write back existing entries only","Nur exisitierende Einträge zurückschreiben" }, 440{ "Write back existing entries only","Nur exisitierende Einträge zurückschreiben" },
441{ "Write back synced file","Syncronisierte Datei zurückschreiben" }, 441{ "Write back synced file","Syncronisierte Datei zurückschreiben" },
442{ "Yearly","Jährlich" }, 442{ "Yearly","Jährlich" },
443{ "year(s)","Jahr(e)" }, 443{ "year(s)","Jahr(e)" },
444{ "Yes","Ja" }, 444{ "Yes","Ja" },
445{ "You have %d item(s) selected.\n","Sie haben %d Einträge ausgewählt.\n" }, 445{ "You have %d item(s) selected.\n","Sie haben %d Einträge ausgewählt.\n" },
446{ "You have to restart KOrganizer for this setting to take effect.","Sie müssem Korganizer neu starten, damit diese Einstellung aktiviert wird." }, 446{ "You have to restart KOrganizer for this setting to take effect.","Sie müssem Korganizer neu starten, damit diese Einstellung aktiviert wird." },
447{ "week(s) on:","Woche(n) am: " }, 447{ "week(s) on:","Woche(n) am: " },
448{ "Full menu bar(nr)","Volle Menuleiste(bn)" }, 448{ "Full menu bar(nr)","Volle Menuleiste(bn)" },
449{ "Timezone has daylight saving","Zeitzone hat Sommerzeit" }, 449{ "Timezone has daylight saving","Zeitzone hat Sommerzeit" },
450{ "Actual start and end is the\nsunday before this date.","Tatsächlicher Beginn/Ende ist der\nSonntag vor diesem Datum!" }, 450{ "Actual start and end is the\nsunday before this date.","Tatsächlicher Beginn/Ende ist der\nSonntag vor diesem Datum!" },
451{ "The year in the date is ignored.","Das Jahr vom Datum wird ignoriert." }, 451{ "The year in the date is ignored.","Das Jahr vom Datum wird ignoriert." },
452{ "Daylight start:","Sommerzeit Beginn:" }, 452{ "Daylight start:","Sommerzeit Beginn:" },
453{ "Daylight end:","Sommerzeit Ende:" }, 453{ "Daylight end:","Sommerzeit Ende:" },
454{ "Time Zone","Zeitzone" }, 454{ "Time Zone","Zeitzone" },
455{ "Monday 19 April 2004: %A %d %B %Y","Montag 19 April 2004: %A %d %B %Y" }, 455{ "Monday 19 April 2004: %A %d %B %Y","Montag 19 April 2004: %A %d %B %Y" },
456{ "%A: Monday --- %a: Mon","%A: Montag --- %a: Mon" }, 456{ "%A: Monday --- %a: Mon","%A: Montag --- %a: Mon" },
457{ "minutely","minütlich" }, 457{ "minutely","minütlich" },
458{ "hourly","stündlich" }, 458{ "hourly","stündlich" },
459{ "daily","täglich" }, 459{ "daily","täglich" },
460{ "weekly","wöchentlich" }, 460{ "weekly","wöchentlich" },
461{ "monthly","monatlich" }, 461{ "monthly","monatlich" },
462{ "day-monthly","tag-monatlich" }, 462{ "day-monthly","tag-monatlich" },
463{ "month-yearly","monat-jährlich" }, 463{ "month-yearly","monat-jährlich" },
464{ "day-yearly","tag-jährlich" }, 464{ "day-yearly","tag-jährlich" },
465{ "position-yearly","pos-jährlich" }, 465{ "position-yearly","pos-jährlich" },
466{ "Edit item on doubleclick (if not, show)","Editiere mit Doppelklick(wenn nicht, zeige)" }, 466{ "Edit item on doubleclick (if not, show)","Editiere mit Doppelklick(wenn nicht, zeige)" },
467{ "Highlight current day in agenda","Hebe >>heute<< in Agenda hervor" }, 467{ "Highlight current day in agenda","Hebe >>heute<< in Agenda hervor" },
468{ "Use light color for highlight current day","Helle Farbe für >>heute<< Hervorhebung" }, 468{ "Use light color for highlight current day","Helle Farbe für >>heute<< Hervorhebung" },
469{ "Highlight selection in Time Edit","Hebe Auswahl in Zeit Edit hervor" }, 469{ "Highlight selection in Time Edit","Hebe Auswahl in Zeit Edit hervor" },
470{ "Hold fullscreen on view change","Behalte Vollbild bei Ansichswechsel" }, 470{ "Hold fullscreen on view change","Behalte Vollbild bei Ansichswechsel" },
471{ "Hold non-fullscreen on view change","Behalte Nicht-Vollbild bei Ansichtsw." }, 471{ "Hold non-fullscreen on view change","Behalte Nicht-Vollbild bei Ansichtsw." },
472{ "Event list view uses full window","Listenansicht nutzt Vollbild" }, 472{ "Event list view uses full window","Listenansicht nutzt Vollbild" },
473{ "Set agenda to DayBeginsAt on change","Setze Agenda auf TagBeginntUm bei Wechsel" }, 473{ "Set agenda to DayBeginsAt on change","Setze Agenda auf TagBeginntUm bei Wechsel" },
474{ "Set agenda to current time on change","Setze Agenda auf gegenw.Zeit bei Wechsel" }, 474{ "Set agenda to current time on change","Setze Agenda auf gegenw.Zeit bei Wechsel" },
475{ "Listview uses monthly timespan","Listenansicht zeigt monatliche Zeitspanne" }, 475{ "Listview uses monthly timespan","Listenansicht zeigt monatliche Zeitspanne" },
476{ "ViewChange","Ansichtswechsel" }, 476{ "ViewChange","Ansichtswechsel" },
477{ "Default alarm *.wav file:","Standard Alarm *.wav Datei:" }, 477{ "Default alarm *.wav file:","Standard Alarm *.wav Datei:" },
478{ "This setting is useless for 5500 user!","Diese Einst. ist nutzlos für 5500 Nutzer" }, 478{ "This setting is useless for 5500 user!","Diese Einst. ist nutzlos für 5500 Nutzer" },
479{ "File","Datei" }, 479{ "File","Datei" },
480{ "Clone...","Dupliziere.." }, 480{ "Clone...","Dupliziere.." },
481{ "Move...","Bewege..." }, 481{ "Move...","Bewege..." },
482{ "Beam...","Sende via IR..." }, 482{ "Beam...","Sende via IR..." },
483{ "&Clone...","Dupliziere.." }, 483{ "&Clone...","Dupliziere.." },
484{ "&Move...","Bewege..." }, 484{ "&Move...","Bewege..." },
485{ "&Beam...","Sende via IR..." }, 485{ "&Beam...","Sende via IR..." },
486{ "Show Completed","Zeige erledigte Todos" }, 486{ "Show Completed","Zeige erledigte Todos" },
487{ "Show Quick Todo","Zeige Quick Todo" }, 487{ "Show Quick Todo","Zeige Quick Todo" },
488{ "Unparent Todo","Un-sub Todo" }, 488{ "Unparent Todo","Un-sub Todo" },
489{ "Save selected to file...","Speichere Selektierte..." }, 489{ "Save selected to file...","Speichere Selektierte..." },
490{ "Add Categ. to selected...","Füge zu Selekt. Kateg. hinzu..." }, 490{ "Add Categ. to selected...","Füge zu Selekt. Kateg. hinzu..." },
491{ "Set Categ. for selected...","Setze Kateg. für Selekt." }, 491{ "Set Categ. for selected...","Setze Kateg. für Selekt." },
492{ "Beam selected via IR","Sende Selekt. via IR..." }, 492{ "Beam selected via IR","Sende Selekt. via IR..." },
493{ "Search","Suchen" }, 493{ "Search","Suchen" },
494{ "Date Picker","Datum auswählen" }, 494{ "Date Picker","Datum auswählen" },
495{ "Day View","Tagesansicht" }, 495{ "Day View","Tagesansicht" },
496{ "Work Week","Arbeitswoche" }, 496{ "Work Week","Arbeitswoche" },
497{ "Week","Wochenansicht" }, 497{ "Week","Wochenansicht" },
498{ "Month","Monatsansicht" }, 498{ "Month","Monatsansicht" },
499{ "Todo View","Todo Liste" }, 499{ "Todo View","Todo Liste" },
500{ "Journal","Journal Ansicht" }, 500{ "Journal","Journal Ansicht" },
501{ "Next days","Nächste Tage" }, 501{ "Next days","Nächste Tage" },
502{ "Print agenda selection...","Drucke Agendaselektion..." }, 502{ "Print agenda selection...","Drucke Agendaselektion..." },
503{ "Toggle DateNavigator","Navigator umschalten" }, 503{ "Toggle DateNavigator","Navigator umschalten" },
504{ "Toggle FilterView","Filteransicht umschalten" }, 504{ "Toggle FilterView","Filteransicht umschalten" },
505{ "Prev. month","Vorheriger Monat" }, 505{ "Prev. month","Vorheriger Monat" },
506{ "Go backward","Gehe zurück" }, 506{ "Go backward","Gehe zurück" },
507{ "Go forward","Gehe weiter" }, 507{ "Go forward","Gehe weiter" },
508{ "Synchronize","Synchronisieren" }, 508{ "Synchronize","Synchronisieren" },
509{ "AgendaSize","Agendagröße" }, 509{ "AgendaSize","Agendagröße" },
510{ "Import (*.ics/*.vcs) file","Importiere (*.ics/*.vcs) Datei" }, 510{ "Import (*.ics/*.vcs) file","Importiere (*.ics/*.vcs) Datei" },
511{ "Import last file","Importiere letzte Datei" }, 511{ "Import last file","Importiere letzte Datei" },
512{ "Import Opie/Qtopia Cal.","Importiere Opie/Qtopia Kal." }, 512{ "Import Opie/Qtopia Cal.","Importiere Opie/Qtopia Kal." },
513{ "Load Calendar Backup","Lade Kalender Backup" }, 513{ "Load Calendar Backup","Lade Kalender Backup" },
514{ "Save Calendar Backup","Speichere Kalender Backup" }, 514{ "Save Calendar Backup","Speichere Kalender Backup" },
515{ "Export VCalendar","Exportiere VCalendar" }, 515{ "Export VCalendar","Exportiere VCalendar" },
516{ "Manage new categories...","Verwalte neue Kategorien..." }, 516{ "Manage new categories...","Verwalte neue Kategorien..." },
517{ "Beam complete calendar...","Sende kompletten Kalender via IR" }, 517{ "Beam complete calendar...","Sende kompletten Kalender via IR" },
518{ "Beam filtered calendar...","Sende gefilterten Kalender via IR" }, 518{ "Beam filtered calendar...","Sende gefilterten Kalender via IR" },
519{ "Remote via ssh","Über Netzwerk via ssh" }, 519{ "Remote via ssh","Über Netzwerk via ssh" },
520{ "With local file","Mit lokaler Datei" }, 520{ "With local file","Mit lokaler Datei" },
521{ "With last file","Mit letzter Datei" }, 521{ "With last file","Mit letzter Datei" },
522{ "KO/Pi: Ready for beaming","KO/Pi: Bereit zum Senden" }, 522{ "KO/Pi: Ready for beaming","KO/Pi: Bereit zum Senden" },
523{ "KO/Pi:Beaming done","KO/Pi: Senden erfolgt" }, 523{ "KO/Pi:Beaming done","KO/Pi: Senden erfolgt" },
524{ "Save filename","Speichern: Dateinamen wählen" }, 524{ "Save filename","Speichern: Dateinamen wählen" },
525{ "File already exists!\nOld file from:\n%1\nOverwrite?\n","Dateiname existiert bereits!\nAlte Datei vom:\n%1\nÜberschreiben?\n" }, 525{ "File already exists!\nOld file from:\n%1\nOverwrite?\n","Dateiname existiert bereits!\nAlte Datei vom:\n%1\nÜberschreiben?\n" },
526{ "KO/Pi: Warning!","KO/Pi: Warnung!" }, 526{ "KO/Pi: Warning!","KO/Pi: Warnung!" },
527{ "Overwrite!","Überschreibe!" }, 527{ "Overwrite!","Überschreibe!" },
528{ "KO/Pi:Saved %1","KO/Pi:Gespeichert %1" }, 528{ "KO/Pi:Saved %1","KO/Pi:Gespeichert %1" },
529{ "All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n","Alle selektierten Einträge werden\nunwiederbringlich gelöscht.\n(Löschen kann auf dem\nPDA einige Zeit dauern)\n" }, 529{ "All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n","Alle selektierten Einträge werden\nunwiederbringlich gelöscht.\n(Löschen kann auf dem\nPDA einige Zeit dauern)\n" },
530{ "KO/Pi Confirmation","KO/Pi Bestätigung" }, 530{ "KO/Pi Confirmation","KO/Pi Bestätigung" },
531{ "Close dialog to abort deletion!","Schließe Dialog um das Löschen abzubrechen!" }, 531{ "Close dialog to abort deletion!","Schließe Dialog um das Löschen abzubrechen!" },
532{ "Deleting item %d ...","Lösche Eintrag %d ..." }, 532{ "Deleting item %d ...","Lösche Eintrag %d ..." },
533{ "%d items remaining in list.","%d Einträge sind in der Liste verblieben." }, 533{ "%d items remaining in list.","%d Einträge sind in der Liste verblieben." },
534{ "Size","Größe" }, 534{ "Size","Größe" },
535{ "Date","Datum" }, 535{ "Date","Datum" },
536{ "Mime Type","Datei Typ" }, 536{ "Mime Type","Datei Typ" },
537{ "All Files","Alle Dateien" }, 537{ "All Files","Alle Dateien" },
538{ "Files","Dateien" }, 538{ "Files","Dateien" },
539{ "Documents","DoKumente" }, 539{ "Documents","DoKumente" },
540{ "Select Categories","Selektiere Kategorien" }, 540{ "Select Categories","Selektiere Kategorien" },
541{ " &Deselect All "," Auswahl aufheben " }, 541{ " &Deselect All "," Auswahl aufheben " },
542{ "A&dd","Hinzu" }, 542{ "A&dd","Hinzu" },
543{ "&Modify","Ändern" }, 543{ "&Modify","Ändern" },
544{ "Edit Categories","Editiere Kategorien" }, 544{ "Edit Categories","Editiere Kategorien" },
545{ " &Edit Categories "," &Editiere Kategorien " }, 545{ " &Edit Categories "," &Editiere Kategorien " },
546{ "Beam Options","Beam Einstellungen" }, 546{ "Beam Options","Beam Einstellungen" },
547{ " With timezone "," Mit Zeitzone " }, 547{ " With timezone "," Mit Zeitzone " },
548{ " Local time ", " Lokale Zeit " }, 548{ " Local time ", " Lokale Zeit " },
549{ "Manage new Categories","Verwalte neue Kategorien" }, 549{ "Manage new Categories","Verwalte neue Kategorien" },
550{ "Add to category list","Füge zur Kategorieliste hinzu" }, 550{ "Add to category list","Füge zur Kategorieliste hinzu" },
551{ "Remove from Events/Todos","Entferne von Terminen/Todos" }, 551{ "Remove from Events/Todos","Entferne von Terminen/Todos" },
552{ "After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n ","Nach dem Importieren/Laden/Syncen\nkann es neue Kategorien in den \nTerminen oder Todos geben, die nicht\nin der Kategorieliste enthalten sind.\nBitte wählen Sie, was passieren soll:\n " }, 552{ "After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n ","Nach dem Importieren/Laden/Syncen\nkann es neue Kategorien in den \nTerminen oder Todos geben, die nicht\nin der Kategorieliste enthalten sind.\nBitte wählen Sie, was passieren soll:\n " },
553{ "New categories not in list:","Kategorien, die nicht in der Liste sind:" }, 553{ "New categories not in list:","Kategorien, die nicht in der Liste sind:" },
554{ "File format","Datei Format" }, 554{ "File format","Datei Format" },
555{ "Time format","Zeit Format" }, 555{ "Time format","Zeit Format" },
556{ "Delete all\ncompleted To-Dos?","Lösche alle\nerledigten To-Dos?" }, 556{ "Delete all\ncompleted To-Dos?","Lösche alle\nerledigten To-Dos?" },
557{ "KO/Pi:Saving Data to File ...","KO/Pi: Speichere Kalender in Datei ..." }, 557{ "KO/Pi:Saving Data to File ...","KO/Pi: Speichere Kalender in Datei ..." },
558{ "KO/Pi:File Saved. Needed %d sec, %d ms","KO/Pi: Abgespeichert in %d sec, %d ms" }, 558{ "KO/Pi:File Saved. Needed %d sec, %d ms","KO/Pi: Abgespeichert in %d sec, %d ms" },
559{ "h","Std" }, 559{ "h","Std" },
560{ "min","Min" }, 560{ "min","Min" },
561{ "hou","Std" }, 561{ "hou","Std" },
562{ "day","Tag" }, 562{ "day","Tag" },
563{ "French","Französich" }, 563{ "French","Französich" },
564{ "Time","Zeit" }, 564{ "Time","Zeit" },
565{ "Event Viewer","Termin Ansicht" }, 565{ "Event Viewer","Termin Ansicht" },
566{ "Cancel Sync","Sync Abbrechen" }, 566{ "Cancel Sync","Sync Abbrechen" },
567{ "Remote","Fern" }, 567{ "Remote","Fern" },
568{ "Local","Lokal" }, 568{ "Local","Lokal" },
569{ "Conflict! Please choose entry","Konflikt! Bitte Eintrag wählen" }, 569{ "Conflict! Please choose entry","Konflikt! Bitte Eintrag wählen" },
570{ "Local: ","Lokal: " }, 570{ "Local: ","Lokal: " },
571{ "Remote: ","Fern: " }, 571{ "Remote: ","Fern: " },
572{ "Last modified: ","Zuletzt geändert: " }, 572{ "Last modified: ","Zuletzt geändert: " },
573{ "Location: ","Ort: " }, 573{ "Location: ","Ort: " },
574{ "<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>","<p><b>Von:</b> %1 </p><p><b>Bis:</b> %2</p>" }, 574{ "<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>","<p><b>Von:</b> %1 </p><p><b>Bis:</b> %2</p>" },
575{ "<p><b>On:</b> %1</p>","<p><b>Am:</b> %1</p>" }, 575{ "<p><b>On:</b> %1</p>","<p><b>Am:</b> %1</p>" },
576{ "<p><b>From:</b> %1</p> ","<p><b>Von:</b> %1</p> " }, 576{ "<p><b>From:</b> %1</p> ","<p><b>Von:</b> %1</p> " },
577{ "<p><b>To:</b> %1</p>","<p><b>Bis:</b> %1</p>" }, 577{ "<p><b>To:</b> %1</p>","<p><b>Bis:</b> %1</p>" },
578{ "<p><b>On:</b> %1</p> ","<p><b>Am:</b> %1</p> " }, 578{ "<p><b>On:</b> %1</p> ","<p><b>Am:</b> %1</p> " },
579{ "<p><b>From:</b> %1 <b>To:</b> %2</p>","<p><b>Von:</b> %1 <b>Bis:</b> %2</p>" }, 579{ "<p><b>From:</b> %1 <b>To:</b> %2</p>","<p><b>Von:</b> %1 <b>Bis:</b> %2</p>" },
580{ "This is a %1 recurring event.","Das ist ein %1 wiederholender Termin." }, 580{ "This is a %1 recurring event.","Das ist ein %1 wiederholender Termin." },
581{ "<b>Next recurrence is on:</b>","<b>Nächste Wiederholung ist am:</b>" }, 581{ "<b>Next recurrence is on:</b>","<b>Nächste Wiederholung ist am:</b>" },
582{ "<b>Last recurrence was on:</b>","<b>Letzte Wiederholung war am:</b>" }, 582{ "<b>Last recurrence was on:</b>","<b>Letzte Wiederholung war am:</b>" },
583{ "( %1 min before )","( %1 min vorher )" }, 583{ "( %1 min before )","( %1 min vorher )" },
584{ "<b>Alarm on: ","<b>Alarm am: " }, 584{ "<b>Alarm on: ","<b>Alarm am: " },
585{ "<b>Details: </b>","<b>Details: </b>" }, 585{ "<b>Details: </b>","<b>Details: </b>" },
586{ "<p><b>Priority:</b> %2</p>","<p><b>Priorität:</b> %2</p>" }, 586{ "<p><b>Priority:</b> %2</p>","<p><b>Priorität:</b> %2</p>" },
587{ "<p><i>%1 % completed</i></p>","<p><i>%1 % erledigt</i></p>" }, 587{ "<p><i>%1 % completed</i></p>","<p><i>%1 % erledigt</i></p>" },
588{ "Organizer","Organisator" }, 588{ "Organizer","Organisator" },
589{ "Save","Speichern" }, 589{ "Save","Speichern" },
590{ "Exit (+save)","Beenden (+ speichern)" }, 590{ "Exit (+save)","Beenden (+ speichern)" },
591{ "Home","Zuhause" }, 591{ "Home","Zuhause" },
592{ "Office","Büro" }, 592{ "Office","Büro" },
593{ "Libary","Bücherei" }, 593{ "Libary","Bücherei" },
594{ "Doctor","Arzt" }, 594{ "Doctor","Arzt" },
595{ "Beach","Strand" }, 595{ "Beach","Strand" },
596{ "Conference room","Konferenzraum" }, 596{ "Conference room","Konferenzraum" },
597{ "Drive Home","Heimfahrt" }, 597{ "Drive Home","Heimfahrt" },
598{ "Watch TV","Tv gucken" }, 598{ "Watch TV","Tv gucken" },
599{ "Phone call","Telefonanruf" }, 599{ "Phone call","Telefonanruf" },
600{ "Pay bill","Rechnung bezahlen" }, 600{ "Pay bill","Rechnung bezahlen" },
601{ "Read book","Buch lesen" }, 601{ "Read book","Buch lesen" },
602{ "Watering plants","Pflanzen giessen" }, 602{ "Watering plants","Pflanzen giessen" },
603{"Appointment","Verabredung" }, 603{"Appointment","Verabredung" },
604{"Birthday","Geburtstag" }, 604{"Birthday","Geburtstag" },
605{"Business","Geschäft" }, 605{"Business","Geschäft" },
606{"Business Travel","Geschäftsreise" }, 606{"Business Travel","Geschäftsreise" },
607{"Cinema","Kino" }, 607{"Cinema","Kino" },
608{"Customer","Kunde" }, 608{"Customer","Kunde" },
609{"Break","Pause" }, 609{"Break","Pause" },
610{"Breakfast","Frühstück" }, 610{"Breakfast","Frühstück" },
611{"Competition","Wettkampf" }, 611{"Competition","Wettkampf" },
612{"Dinner","Abendessen" }, 612{"Dinner","Abendessen" },
613{"Education","Erziehung" }, 613{"Education","Erziehung" },
614{"Family","Familie" }, 614{"Family","Familie" },
615{"Favorites","Favoriten" }, 615{"Favorites","Favoriten" },
616{"Festival","Festival" }, 616{"Festival","Festival" },
617{"Fishing","Angeln" }, 617{"Fishing","Angeln" },
618{"Flight","Flug" }, 618{"Flight","Flug" },
619{"Gifts","Geschenk" }, 619{"Gifts","Geschenk" },
620{"Holiday","Feiertag" }, 620{"Holiday","Feiertag" },
621{"Holiday Cards","Ansichtskarten" }, 621{"Holiday Cards","Ansichtskarten" },
622{"Hot Contacts","Heisse Kontakte" }, 622{"Hot Contacts","Heisse Kontakte" },
623{"Hiking","Wandern" }, 623{"Hiking","Wandern" },
624{"Hunting","Jagen" }, 624{"Hunting","Jagen" },
625{"Key Customer","Wichtiger Kunde" }, 625{"Key Customer","Wichtiger Kunde" },
626{"Kids","Kinder" }, 626{"Kids","Kinder" },
627{"Lunch","Mittagessen" }, 627{"Lunch","Mittagessen" },
628{"Meeting","Treffen" }, 628{"Meeting","Treffen" },
629{"Miscellaneous","Verschiedenes" }, 629{"Miscellaneous","Verschiedenes" },
630{"Partner","Partner" }, 630{"Partner","Partner" },
631{"Party","Partie" }, 631{"Party","Partie" },
632{"Personal","Privat" }, 632{"Personal","Privat" },
633{"Personal Travel","Privatreise"}, 633{"Personal Travel","Privatreise"},
634{"PHB","PHB" }, 634{"PHB","PHB" },
635{"Phone Calls","Telefonanruf" }, 635{"Phone Calls","Telefonanruf" },
636{"Projects","Projekt" }, 636{"Projects","Projekt" },
637{"Recurring","Wiederholend" }, 637{"Recurring","Wiederholend" },
638{"School","Schule" }, 638{"School","Schule" },
639{"Shopping","Einkaufen" }, 639{"Shopping","Einkaufen" },
640{"Speach","Rede" }, 640{"Speach","Rede" },
641{"Special Occasion","Spez.Gelegenheit" }, 641{"Special Occasion","Spez.Gelegenheit" },
642{"Sports","Sport" }, 642{"Sports","Sport" },
643{"Talk","Vortrag" }, 643{"Talk","Vortrag" },
644{"Travel","Reise" }, 644{"Travel","Reise" },
645{"TV","TV" }, 645{"TV","TV" },
646{"Germany","Deutschland" }, 646{"Germany","Deutschland" },
647{"Sweden","Schweden" }, 647{"Sweden","Schweden" },
648{"Forest","Wald" }, 648{"Forest","Wald" },
649{ "Desert","Wüste" }, 649{ "Desert","Wüste" },
650{ "Kitchen","Küche" }, 650{ "Kitchen","Küche" },
651{ "Lake","See" }, 651{ "Lake","See" },
652{"University","Universität"}, 652{"University","Universität"},
653{"Vacation","Urlaub" }, 653{"Vacation","Urlaub" },
654{"VIP","VIP" }, 654{"VIP","VIP" },
655{ "Import Sharp Calendar","Importiere Sharp Kalender" }, 655{ "Import Sharp Calendar","Importiere Sharp Kalender" },
656{ "This todo has been cancelled!","Dieses Todo wurde gecancelt!" }, 656{ "This todo has been cancelled!","Dieses Todo wurde gecancelt!" },
657{ "This event has been cancelled!","Dieser Termin wurde gecancelt!" }, 657{ "This event has been cancelled!","Dieser Termin wurde gecancelt!" },
658{ "Cancelled","Gecancelt" }, 658{ "Cancelled","Gecancelt" },
659{ "Multiple sync","Mehrfach Sync" }, 659{ "Multiple sync","Mehrfach Sync" },
660{ "Local file","Lokale Datei" }, 660{ "Local file","Lokale Datei" },
661{ "Last file","Letzte Datei" }, 661{ "Last file","Letzte Datei" },
662{ "Keys + Colors...","Tasten + Farben..." }, 662{ "Keys + Colors...","Tasten + Farben..." },
663{ "Mini icons in toolbar(nr)","Mini Icons in ToolBar(bn)" }, 663{ "Mini icons in toolbar(nr)","Mini Icons in ToolBar(bn)" },
664{ "Quick load/save (w/o Unicode)","Schnelles Laden/Speichern (o Unicode)" }, 664{ "Quick load/save (w/o Unicode)","Schnelles Laden/Speichern (o Unicode)" },
665{ "Choose...","Wähle..." }, 665{ "Choose...","Wähle..." },
666{ "Use colors for application:","Setze Farben für Programm:" }, 666{ "Use colors for application:","Setze Farben für Programm:" },
667{ "Buttons, menus, etc.:","Knöpfe, Menu, etc.:" }, 667{ "Buttons, menus, etc.:","Knöpfe, Menu, etc.:" },
668{ "Frames, labels, etc.:","Rahmen, Label, etc.:" }, 668{ "Frames, labels, etc.:","Rahmen, Label, etc.:" },
669{ "Show parent To-Do's in What's Next view","Zeige Ober-Todo in What's Next Anz." }, 669{ "Show parent To-Do's in What's Next view","Zeige Ober-Todo in What's Next Anz." },
670{ "Show location in What's Next view","Zeige Ort in What's Next Anz." }, 670{ "Show location in What's Next view","Zeige Ort in What's Next Anz." },
671{ "Show events that recur ","Zeige Termine, die sich wiederholen:" }, 671{ "Show events that recur ","Zeige Termine, die sich wiederholen:" },
672{ "Show in every cell ","Zeige in jeder Zelle " }, 672{ "Show in every cell ","Zeige in jeder Zelle " },
673{ "short month","kurzen Monat" }, 673{ "short month","kurzen Monat" },
674{ "icons","Icons" }, 674{ "icons","Icons" },
675{ "Show Sat/Sun together","Zeige Sam/Son zusammen" }, 675{ "Show Sat/Sun together","Zeige Sam/Son zusammen" },
676{ "Categorie colors are applied to text","Kategorie Farben färben Text" }, 676{ "Categorie colors are applied to text","Kategorie Farben färben Text" },
677{ "Month view uses day colors","Monatsansicht zeigt Tagesfarben" }, 677{ "Month view uses day colors","Monatsansicht zeigt Tagesfarben" },
678{ "Day color odd months","Tagesfarbe ungerade Monate" }, 678{ "Day color odd months","Tagesfarbe ungerade Monate" },
679{ "Day color even months","Tagesfarbe gerade Monate" }, 679{ "Day color even months","Tagesfarbe gerade Monate" },
680{ "Color for Sundays + category \"Holiday\"","Farbe für Sonntag + Kateg.\" Feiertag\"" }, 680{ "Color for Sundays + category \"Holiday\"","Farbe für Sonntag + Kateg.\" Feiertag\"" },
681{ "To-do view shows complete as 'xx %'","Zeige Prozent erledigt als 'xx %'" }, 681{ "To-do view shows complete as 'xx %'","Zeige Prozent erledigt als 'xx %'" },
682{ "Small To-do view uses smaller font","Kleine To-do Ansicht nutzt kleineren Font" }, 682{ "Small To-do view uses smaller font","Kleine To-do Ansicht nutzt kleineren Font" },
683{ "Colors are applied to text","Farben werden auf Text angewendet" }, 683{ "Colors are applied to text","Farben werden auf Text angewendet" },
684{ "Use internal alarm notification","Nutze interne Alarm Benachrichtigung" }, 684{ "Use internal alarm notification","Nutze interne Alarm Benachrichtigung" },
685{ "Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n","Achtung: KO/Pi muß ausgeführt werden damit die Benachrichtigung funktioniert. Empfehlung für Zaurus: Diese Option nicht wählen und KO/Pi Alarm Applet installieren.\n" }, 685{ "Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n","Achtung: KO/Pi muß ausgeführt werden damit die Benachrichtigung funktioniert. Empfehlung für Zaurus: Diese Option nicht wählen und KO/Pi Alarm Applet installieren.\n" },
686{ "Play beeps count:","Anzahl der Alarmpiepse: " }, 686{ "Play beeps count:","Anzahl der Alarmpiepse: " },
687{ "Beeps interval in sec:","Zeitintervall der Alarmpiepse: " }, 687{ "Beeps interval in sec:","Zeitintervall der Alarmpiepse: " },
688{ "Default suspend time in min:","Standard Supendierungs Zeit: " }, 688{ "Default suspend time in min:","Standard Supendierungs Zeit: " },
689{ "Auto suspend count:","Anzahl der auto Suspendierungen" }, 689{ "Auto suspend count:","Anzahl der auto Suspendierungen" },
690{ "Alarm *.wav file for newly created alarm:","Alarm *.wav Datei für neu angelegte Alarme:" }, 690{ "Alarm *.wav file for newly created alarm:","Alarm *.wav Datei für neu angelegte Alarme:" },
691{ "New profile","Neues Profil" }, 691{ "New profile","Neues Profil" },
692{ "Clone profile","Klone Profil" }, 692{ "Clone profile","Klone Profil" },
693{ "Delete profile","Lösche Profil" }, 693{ "Delete profile","Lösche Profil" },
694{ "Profile:","Profil:" }, 694{ "Profile:","Profil:" },
695{ "Include in multiple sync","Beziehe Profil in mehrfach Sync mit ein" }, 695{ "Include in multiple sync","Beziehe Profil in mehrfach Sync mit ein" },
696{ "Force: Take local entry always","Erzwinge: Nimm immer lokalen Eintrag" }, 696{ "Force: Take local entry always","Erzwinge: Nimm immer lokalen Eintrag" },
697{ "Force: Take remote entry always","Erzwinge: Nimm immer fernen Eintrag" }, 697{ "Force: Take remote entry always","Erzwinge: Nimm immer fernen Eintrag" },
698{ "Show summary after sync","Zeige Zusammenfassung nach dem Synchronisieren" }, 698{ "Show summary after sync","Zeige Zusammenfassung nach dem Synchronisieren" },
699{ "Write back file","Schreibe Datei zurück" }, 699{ "Write back file","Schreibe Datei zurück" },
700{ "Remote file (w down/upload command)","Entfernte Datei (via down/upload Kommando)" }, 700{ "Remote file (w down/upload command)","Entfernte Datei (via down/upload Kommando)" },
701{ "Pre sync (download) command:","Bevor Sync (download) Kommando:" }, 701{ "Pre sync (download) command:","Bevor Sync (download) Kommando:" },
702{ "Local device name:","Name dieses Gerätes:" }, 702{ "Local device name:","Name dieses Gerätes:" },
703{ "Ask for preferences before sync","Frage nach Synchronisationseinstellungen vor dem Syncen" }, 703{ "Ask for preferences before sync","Frage nach Synchronisationseinstellungen vor dem Syncen" },
704{ "Sync preferences","Synchronisations Einstellungen" }, 704{ "Sync preferences","Synchronisations Einstellungen" },
705{ "Profile kind","Profil Art" }, 705{ "Profile kind","Profil Art" },
706{ "Local file","Lokale Datei" }, 706{ "Local file","Lokale Datei" },
707{ "Local file:","Lokale Datei:" }, 707{ "Local file:","Lokale Datei:" },
708{ "Post sync (upload) command:","Nach Sync (upload) Kommando:" }, 708{ "Post sync (upload) command:","Nach Sync (upload) Kommando:" },
709{ "Fill in default values for:","Setze Beispiel Werte ein für:" }, 709{ "Fill in default values for:","Setze Beispiel Werte ein für:" },
710{ "Hint: Use $PWD$ for placeholder of password!","Hinweis: Benutze $PWD$ als Platzhalter für ein Passwort!" }, 710{ "Hint: Use $PWD$ for placeholder of password!","Hinweis: Benutze $PWD$ als Platzhalter für ein Passwort!" },
711{ "Synchronization Preferences","Einstellungen der Synchronisationsprofile"}, 711{ "Synchronization Preferences","Einstellungen der Synchronisationsprofile"},
712{ "Device","Gerät:" }, 712{ "Device","Gerät:" },
713{ "Sync with file \n...%1\nfrom:\n%2\n","Sync mit Datei \n...%1\nvom:\n%2\n" }, 713{ "Sync with file \n...%1\nfrom:\n%2\n","Sync mit Datei \n...%1\nvom:\n%2\n" },
714{ "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","Synchronisationsübersicht:\n\n %d items lokal hinzugefügt\n %d items entfernt hinzugefügt\n %d items lokal geändert\n %d items entfernt geändert\n %d items lokal gelöscht\n %d items entfernt gelöscht\n" }, 714{ "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","Synchronisationsübersicht:\n\n %d items lokal hinzugefügt\n %d items entfernt hinzugefügt\n %d items lokal geändert\n %d items entfernt geändert\n %d items lokal gelöscht\n %d items entfernt gelöscht\n" },
715{ "Synchronization successful","Synchronisation erfolgreich" }, 715{ "Synchronization successful","Synchronisation erfolgreich" },
716{ "Sync cancelled or failed. Nothing synced.","Sync abgebrochen oder fehlgeschlagen. Nichts wurde gesynced." }, 716{ "Sync cancelled or failed. Nothing synced.","Sync abgebrochen oder fehlgeschlagen. Nichts wurde gesynced." },
717{ "Sync file \n...%1\ndoes not exist!\nNothing synced!\n","Sync Datei \n...%1\nexistiert nicht!\nNichts wurde gesynced!\n" }, 717{ "Sync file \n...%1\ndoes not exist!\nNothing synced!\n","Sync Datei \n...%1\nexistiert nicht!\nNichts wurde gesynced!\n" },
718{ "Sync filename(*.ics/*.vcs)","Sync Dateiname(*.ics/*.vcs)" }, 718{ "Sync filename(*.ics/*.vcs)","Sync Dateiname(*.ics/*.vcs)" },
719{ "Enter password","Passwort eingeben" }, 719{ "Enter password","Passwort eingeben" },
720{ "Do you really want\nto remote sync\nwith profile \n","Wollen Sie wirklich\nmit dem entfernten\nProfil syncen: \n" }, 720{ "Do you really want\nto remote sync\nwith profile \n","Wollen Sie wirklich\nmit dem entfernten\nProfil syncen: \n" },
721{ "Copy remote file to local machine...","Kopiere entfernte Datei auf lokalen Rechner..." }, 721{ "Copy remote file to local machine...","Kopiere entfernte Datei auf lokalen Rechner..." },
722{ "Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n","Sorry, das Kopierkommando schlug fehl!\nKommando war:\n%1\n \nVersuche Kommando von Kosole um\nDetails für das Fehlschlagen\nzu erfahren.\n" }, 722{ "Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n","Sorry, das Kopierkommando schlug fehl!\nKommando war:\n%1\n \nVersuche Kommando von Kosole um\nDetails für das Fehlschlagen\nzu erfahren.\n" },
723{ "Writing back file result: ","Resultat des Dateizurückschreibens: " }, 723{ "Writing back file result: ","Resultat des Dateizurückschreibens: " },
724{ "Syncronization sucessfully completed","Synchronisation erfolgreich abgeschlossen" }, 724{ "Syncronization sucessfully completed","Synchronisation erfolgreich abgeschlossen" },
725{ "Edit Calendar Filters","Editiere Kalendar Filter" }, 725{ "Edit Calendar Filters","Editiere Kalendar Filter" },
726{ "Enter filter name:","Neuer Filter Name:" }, 726{ "Enter filter name:","Neuer Filter Name:" },
727{ "Add Filter","Filter hinzufügen" }, 727{ "Add Filter","Filter hinzufügen" },
728{ "Question","Frage" }, 728{ "Question","Frage" },
729{ "Filter position: ","Filter Position: " }, 729{ "Filter position: ","Filter Position: " },
730{ "Month View","Monatsansicht" }, 730{ "Month View","Monatsansicht" },
731{ "This profil cannot be deleted!\n","Dieses Profil kann\nnicht gelöscht werden!" }, 731{ "This profil cannot be deleted!\n","Dieses Profil kann\nnicht gelöscht werden!" },
732{ "KO/Pi config error","KO/Pi Konfig. Fehler" }, 732{ "KO/Pi config error","KO/Pi Konfig. Fehler" },
733{ "Local device name undefined!\nPlease define device name!","Name dieses Gerätes undefiniert!\nBitte Namen angeben!" }, 733{ "Local device name undefined!\nPlease define device name!","Name dieses Gerätes undefiniert!\nBitte Namen angeben!" },
734{ "Multiple profiles with same name!\nPlease use unique profile names!","Mehrere Profile haben denselben Namen!\nBitte unterschiedliche Namen wählen!" }, 734{ "Multiple profiles with same name!\nPlease use unique profile names!","Mehrere Profile haben denselben Namen!\nBitte unterschiedliche Namen wählen!" },
735{ "Access: ","Zugriff: " }, 735{ "Access: ","Zugriff: " },
736{ "Needs Action","Aktion notwendig" }, 736{ "Needs Action","Aktion notwendig" },
737{ "Accepted","Akzeptiert" }, 737{ "Accepted","Akzeptiert" },
738{ "Declined","Abgelehnt" }, 738{ "Declined","Abgelehnt" },
739{ "Tentative","Vorläufig" }, 739{ "Tentative","Vorläufig" },
740{ "Delegated","Beauftragt" }, 740{ "Delegated","Beauftragt" },
741{ "Completed","Vollständig" }, 741{ "Completed","Vollständig" },
742{ "In Process","In Bearbeitung" }, 742{ "In Process","In Bearbeitung" },
743{ "Participant","Teilnehmer" }, 743{ "Participant","Teilnehmer" },
744{ "Optional Participant","Möglicher Teilnehmer" }, 744{ "Optional Participant","Möglicher Teilnehmer" },
745{ "Observer","Beobachter" }, 745{ "Observer","Beobachter" },
746{ "Chair","Vorsitzender" }, 746{ "Chair","Vorsitzender" },
747{ "Not supported \non desktop!\n","" }, 747{ "Not supported \non desktop!\n","" },
748{ "Nothing selected!\n\nThis prints the full width of the Agenda view as you see it!\n\nTo determine the vertical range of the printing, please select\na vertical range (with the left mouse button down) in one column. ","Es ist nichts selektiert!\nDieses druckt die volle Breite der Agenda View, so wie man sie sieht.\nUm die verticale Auswahl zum Drucken zu bestimmen,\nbitte einen verticalen Zeitraum (mit gedrückter linker Maustaste)\nin einer Spalte auswählen. " }, 748{ "Nothing selected!\n\nThis prints the full width of the Agenda view as you see it!\n\nTo determine the vertical range of the printing, please select\na vertical range (with the left mouse button down) in one column. ","Es ist nichts selektiert!\nDieses druckt die volle Breite der Agenda View, so wie man sie sieht.\nUm die verticale Auswahl zum Drucken zu bestimmen,\nbitte einen verticalen Zeitraum (mit gedrückter linker Maustaste)\nin einer Spalte auswählen. " },
749{ "Date range: ","Datums Zeitspanne: " }, 749{ "Date range: ","Datums Zeitspanne: " },
750{ "Not supported \non PDA!\n","Nicht verfügbar\nauf dem PDA. " }, 750{ "Not supported \non PDA!\n","Nicht verfügbar\nauf dem PDA. " },
751{ "Syncing - close to abort!","Syncing-schließe um abzubrechen." }, 751{ "Syncing - close to abort!","Syncing-schließe um abzubrechen." },
752{ "Add / remove events","Add./entferne Termine" }, 752{ "Add / remove events","Add./entferne Termine" },
753{ "File does not exist:\n '%1'.","Datei existiert nicht:\n '%1'." }, 753{ "File does not exist:\n '%1'.","Datei existiert nicht:\n '%1'." },
754{ "Couldn't load calendar\n '%1'.","Kann Kalender nicht laden:\n '%1'." }, 754{ "Couldn't load calendar\n '%1'.","Kann Kalender nicht laden:\n '%1'." },
755{ "\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n","\nDie gepeicherte Datei wurde verändert!\nDatei Grösse: %1 Bytes.\nZuletzt geändert: %2\nMöchten Sie:\n\n - Speichern und die Datei überschreiben?\n - Mit Datei Synchronisieren, dann speichern?\n - Abbrechen ohne zu speichern? \n" }, 755{ "\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n","\nDie gepeicherte Datei wurde verändert!\nDatei Grösse: %1 Bytes.\nZuletzt geändert: %2\nMöchten Sie:\n\n - Speichern und die Datei überschreiben?\n - Mit Datei Synchronisieren, dann speichern?\n - Abbrechen ohne zu speichern? \n" },
756{ "Overwrite","Überschreiben" }, 756{ "Overwrite","Überschreiben" },
757{ "Sync+save","Syncen+speichern" }, 757{ "Sync+save","Syncen+speichern" },
758{ "Default","Standard" }, 758{ "Default","Standard" },
759{ " Categories added to list! "," Kategorien zur Liste hinzugefügt! " }, 759{ " Categories added to list! "," Kategorien zur Liste hinzugefügt! " },
760{ " %d items?"," %d Einträge?" }, 760{ " %d items?"," %d Einträge?" },
761{ "\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?","\nDieses ist ein\nwiederholender Termin!.\nSind Sie sicher, dass Sie\ndiesen Termin und alle\nWiederholungen löschen möchten?" }, 761{ "\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?","\nDieses ist ein\nwiederholender Termin!.\nSind Sie sicher, dass Sie\ndiesen Termin und alle\nWiederholungen löschen möchten?" },
762{ " ?\n\nDelete:\n"," ?\n\nLösche:\n" }, 762{ " ?\n\nDelete:\n"," ?\n\nLösche:\n" },
763{ "Current","Aktuelle" }, 763{ "Current","Aktuelle" },
764{ "\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n","\nDieses ist ein\nwiederholender Termin!\nMöchten sie alle Wiederholungen\nlöschen, oder nur die aktuelle am:\n" }, 764{ "\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n","\nDieses ist ein\nwiederholender Termin!\nMöchten sie alle Wiederholungen\nlöschen, oder nur die aktuelle am:\n" },
765{ "All","Alle" }, 765{ "All","Alle" },
766{ "Data Loss Warning","Datenverlust Warnung" }, 766{ "Data Loss Warning","Datenverlust Warnung" },
767{ "Proceed","Weitermachen" }, 767{ "Proceed","Weitermachen" },
768{ "The journal entries can not be\nexported to a vCalendar file.","Die Journal Einträge können\nnicht in eine vCalendar\nDatei exportiert werden!" }, 768{ "The journal entries can not be\nexported to a vCalendar file.","Die Journal Einträge können\nnicht in eine vCalendar\nDatei exportiert werden!" },
769{ "Filter disabled ","Filter abgeschaltet" }, 769{ "Filter disabled ","Filter abgeschaltet" },
770{ "Filter selected: ","Gewählter Filter: " }, 770{ "Filter selected: ","Gewählter Filter: " },
771{ "Toggle Cancel","Gecancelt ändern" }, 771{ "Toggle Cancel","Gecancelt ändern" },
772{ "&Toggle Cancel","Gecancel&t ändern" }, 772{ "&Toggle Cancel","Gecancel&t ändern" },
773{ "Configure Toolbar","Konfiguriere Toolbar" }, 773{ "Configure Toolbar","Konfiguriere Toolbar" },
774{ "Stretched TB","Gedehnte TB" }, 774{ "Stretched TB","Gedehnte TB" },
775{ "Import file \n...%1\ndoes not exist!\nNothing imported!\n","Import Datei \n...%1\nexistiert nicht!\nNichts importiert!\n" }, 775{ "Import file \n...%1\ndoes not exist!\nNothing imported!\n","Import Datei \n...%1\nexistiert nicht!\nNichts importiert!\n" },
776{ "Import filename(*.ics/*.vcs)","Import Dateiname(*.ics/*.vcs)" }, 776{ "Import filename(*.ics/*.vcs)","Import Dateiname(*.ics/*.vcs)" },
777{ "When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing","Wenn ein Kalender doppelt importiert\nwird, werden doppelte Einträge ignoriert!\nSie können eine Backup Datei anlegen unter\nDatei - Speichere Kalender Backup\num den Import rückgängig machen zu können.\n" }, 777{ "When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing","Wenn ein Kalender doppelt importiert\nwird, werden doppelte Einträge ignoriert!\nSie können eine Backup Datei anlegen unter\nDatei - Speichere Kalender Backup\num den Import rückgängig machen zu können.\n" },
778{ "Not supported \non desktop!\n","Nur verfügbar auf PDA!" }, 778{ "Not supported \non desktop!\n","Nur verfügbar auf PDA!" },
779{ "Imported file successfully","Datei erfolgreich importiert" }, 779{ "Imported file successfully","Datei erfolgreich importiert" },
780{ "Error importing file","Fehler beim Importieren der Datei" }, 780{ "Error importing file","Fehler beim Importieren der Datei" },
781{ "Export vcal filename(*.vcs)","Export vcal Dateiname(*.vcs)" }, 781{ "Export vcal filename(*.vcs)","Export vcal Dateiname(*.vcs)" },
782{ "Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n","Zu speichernde Datei\existiert bereits!\nExist. Datei vom:\n%1\nÜberschreiben?\n" }, 782{ "Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n","Zu speichernde Datei\existiert bereits!\nExist. Datei vom:\n%1\nÜberschreiben?\n" },
783{ "Overwrite!","Überschreiben!" }, 783{ "Overwrite!","Überschreiben!" },
784{ "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n","Import Datei \n...%1\nvom:\n%2\nDuplizierte Einträge\nwerden nicht importiert!\n" }, 784{ "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n","Import Datei \n...%1\nvom:\n%2\nDuplizierte Einträge\nwerden nicht importiert!\n" },
785{ "Load backup filename","Lade Backup Dateiname" }, 785{ "Load backup filename","Lade Backup Dateiname" },
786{ "Backup file\ndoes not exist!\nNothing loaded!","Backup Datei\nexistiert nicht!\nNichts geladen!" }, 786{ "Backup file\ndoes not exist!\nNothing loaded!","Backup Datei\nexistiert nicht!\nNichts geladen!" },
787{ "KO/Pi:Loaded %1","KO/Pi:Geladen %1" }, 787{ "KO/Pi:Loaded %1","KO/Pi:Geladen %1" },
788{ "Save backup filename","Speichere Backup Dateiname" }, 788{ "Save backup filename","Speichere Backup Dateiname" },
789{ "Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n","Backup Datei\nexistiert bereits!\nAlte Backup Datei vom:\n%1\nÜberschreiben?\n" }, 789{ "Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n","Backup Datei\nexistiert bereits!\nAlte Backup Datei vom:\n%1\nÜberschreiben?\n" },
790{ "KO/Pi:Saved %1","KO/Pi:Gespeichert %1" }, 790{ "KO/Pi:Saved %1","KO/Pi:Gespeichert %1" },
791{ "Details of attendee","Teilnehmerdetails" }, 791{ "Details of attendee","Teilnehmerdetails" },
792{ "Work phone:\n","Telefon Arbeit:\n" }, 792{ "Work phone:\n","Telefon Arbeit:\n" },
793{ "Work mobile phone:\n","Mobiltelefon Arbeit:\n" }, 793{ "Work mobile phone:\n","Mobiltelefon Arbeit:\n" },
794{ "Home phone:\n","Telefon privat:\n" }, 794{ "Home phone:\n","Telefon privat:\n" },
795{ "Mobile home phone:\n","Mobiltelefon privat:\n" }, 795{ "Mobile home phone:\n","Mobiltelefon privat:\n" },
796{ "Email:\n","Email:\n" }, 796{ "Email:\n","Email:\n" },
797{ "Alarm disabled for this item","Alarm deaktiviert für dieses Item" }, 797{ "Alarm disabled for this item","Alarm deaktiviert für dieses Item" },
798{ "Audio Al.: ","Audio Al.: " }, 798{ "Audio Al.: ","Audio Al.: " },
799{ "Proc.Al.: ","Proz.Al.: " }, 799{ "Proc.Al.: ","Proz.Al.: " },
800{ "No sound set","Kein Sound definiert" }, 800{ "No sound set","Kein Sound definiert" },
801{ "*.wav|Wav Files","*.wav|Wav Dateien" }, 801{ "*.wav|Wav Files","*.wav|Wav Dateien" },
802{ "No program set","Kein Programm definiert" }, 802{ "No program set","Kein Programm definiert" },
803{ "Running '%1'","Ausführen '%1'" }, 803{ "Running '%1'","Ausführen '%1'" },
804{ "Playing '%1'","Abspielen '%1'" }, 804{ "Playing '%1'","Abspielen '%1'" },
805{ "Show Sync Events in WN/Agenda view","Zeige Sync Events in WN/Agenda Ansicht" }, 805{ "Show Sync Events in WN/Agenda view","Zeige Sync Events in WN/Agenda Ansicht" },
806{ "User defined (usertranslation.txt)","Benutzerdefiniert (usertranslation.txt)" }, 806{ "User defined (usertranslation.txt)","Benutzerdefiniert (usertranslation.txt)" },
807{ "Load!","Laden!" }, 807{ "Load!","Laden!" },
808{ "Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n","Backup Datei vom:\n%1\nDas Laden der Backup Datei\nlöscht die aktuellen Daten!\n" }, 808{ "Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n","Backup Datei vom:\n%1\nDas Laden der Backup Datei\nlöscht die aktuellen Daten!\n" },
809{ "KO/Pi Features and hints","KO/Pi Eigenschaften und Tipps" }, 809{ "KO/Pi Features and hints","KO/Pi Eigenschaften und Tipps" },
810{ "KO/Pi User translation HowTo","KO/Pi Benutzer-Übersetzung HowTo" }, 810{ "KO/Pi User translation HowTo","KO/Pi Benutzer-Übersetzung HowTo" },
811{ "KO/Pi Synchronization HowTo","KO/Pi Synchronisation HowTo" }, 811{ "KO/Pi Synchronization HowTo","KO/Pi Synchronisation HowTo" },
812{ "Features + hints...","Eigenschaften + Tipps..." }, 812{ "Features + hints...","Eigenschaften + Tipps..." },
813{ "User translation...","Benutzer Übersetzung..." }, 813{ "User translation...","Benutzer Übersetzung..." },
814{ "Sync HowTo...","Synchronisation HowTo..." }, 814{ "Sync HowTo...","Synchronisation HowTo..." },
815{ "Print calendar...","Drucke Kalender..." }, 815{ "Print calendar...","Drucke Kalender..." },
816{ "Anniversary","Jahrestag" }, 816{ "Anniversary","Jahrestag" },
817{ "When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n","Wenn Geburtstage mehrfach importiert\nwerden, werden doppelte Einträge ignoriert\nwenn sie nicht verändert wurden.\n" }, 817{ "When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n","Wenn Geburtstage mehrfach importiert\nwerden, werden doppelte Einträge ignoriert\nwenn sie nicht verändert wurden.\n" },
818{ "Import Birthdays (KA/Pi)","Importiere Geburtstage (KA/Pi)" }, 818{ "Import Birthdays (KA/Pi)","Importiere Geburtstage (KA/Pi)" },
819{ "Next recurrence is on: ","Nächste Wiederholung ist am:" }, 819{ "Next recurrence is on: ","Nächste Wiederholung ist am:" },
820{ "<b>Alarm on: </b>","<b>Alarm am: </b>" }, 820{ "<b>Alarm on: </b>","<b>Alarm am: </b>" },
821{ "<b>Access: </b>","<b>Zugriff: </b>" }, 821{ "<b>Access: </b>","<b>Zugriff: </b>" },
822{ "(%1 min before)","(%1 min vorher)" }, 822{ "(%1 min before)","(%1 min vorher)" },
823{ "<b>Categories: </b>","<b>Kategorien: </b>" }, 823{ "<b>Categories: </b>","<b>Kategorien: </b>" },
824{ "Save Journal/Description...","Speichere Journal/Details..." }, 824{ "Save Journal/Description...","Speichere Journal/Details..." },
825{ "This saves the text/details of selected\nJournals and Events/Todos\nto a text file.","Das speichert den Text bzw.\ndie Details von selektierten\nJournalen und Events/Todos\nin eine Textdatei." }, 825{ "This saves the text/details of selected\nJournals and Events/Todos\nto a text file.","Das speichert den Text bzw.\ndie Details von selektierten\nJournalen und Events/Todos\nin eine Textdatei." },
826{ "Continue","Weitermachen" }, 826{ "Continue","Weitermachen" },
827{ " birthdays/anniversaries added!"," Geburts-/Jahrestage hinzugefügt" }, 827{ " birthdays/anniversaries added!"," Geburts-/Jahrestage hinzugefügt" },
828{ "Attendee:","Teilnehmer:" }, 828{ "Attendee:","Teilnehmer:" },
829{ "Click OK to search ->","Klicke zum Suchen auf OK ->" }, 829{ "Click OK to search ->","Klicke zum Suchen auf OK ->" },
830{ "On day ","Am Tag " }, 830{ "On day ","Am Tag " },
831{ "%1 of ","%1 des Monats" }, 831{ "%1 of ","%1 des Monats" },
832{ "%1 of the year","%1 des Jahres" }, 832{ "%1 of the year","%1 des Jahres" },
833{ "Anonymous","Anonymo" }, 833{ "Anonymous","Anonymo" },
834{ "nobody@nowhere","niemand@nirgendwo" }, 834{ "nobody@nowhere","niemand@nirgendwo" },
835{ "calendar.html","calendar.html" }, 835{ "calendar.html","calendar.html" },
836{ " Local Time"," Locale Zeit" }, 836{ " Local Time"," Locale Zeit" },
837{ "Unknown Name","Unbekannter Name" }, 837{ "Unknown Name","Unbekannter Name" },
838{ "unknown@nowhere","unbekannt@nirgendwo" }, 838{ "unknown@nowhere","unbekannt@nirgendwo" },
839{ "Beam via IR!","Beam via IR!" }, 839{ "Beam via IR!","Beam via IR!" },
840{ "Next Month","Nächster Monat" }, 840{ "Next Month","Nächster Monat" },
841{ "Prio","Prio" }, 841{ "Prio","Prio" },
842{ "Reparent Todo","Mache Sub-Todo" }, 842{ "Reparent Todo","Mache Sub-Todo" },
843{ "tomorrow","morgen" }, 843{ "tomorrow","morgen" },
844{ "today","heute" }, 844{ "today","heute" },
845{ "yesterday","gestern" }, 845{ "yesterday","gestern" },
846{ "Ok","Ok" }, 846{ "Ok","Ok" },
847{ "Ok+Agenda","Ok+Agenda" }, 847{ "Ok+Agenda","Ok+Agenda" },
848{ "Email","Email" }, 848{ "Email","Email" },
849{ "RSVP","RSVP" }, 849{ "RSVP","RSVP" },
850{ "Email:","Email:" }, 850{ "Email:","Email:" },
851{ "Appointment Time ","Termin Zeit " }, 851{ "Appointment Time ","Termin Zeit " },
852{ "2","2" }, 852{ "2","2" },
853{ "3","3" }, 853{ "3","3" },
854{ "4","4" }, 854{ "4","4" },
855{ " 0 %"," 0 %" }, 855{ " 0 %"," 0 %" },
856{ " 20 %"," 20 %" }, 856{ " 20 %"," 20 %" },
857{ " 40 %"," 40 %" }, 857{ " 40 %"," 40 %" },
858{ " 60 %"," 60 %" }, 858{ " 60 %"," 60 %" },
859{ " 80 %"," 80 %" }, 859{ " 80 %"," 80 %" },
860{ "100 %","100 %" }, 860{ "100 %","100 %" },
861{ "Filter","Filter" }, 861{ "Filter","Filter" },
862{ "Configure","Konfiguriere" }, 862{ "Configure","Konfiguriere" },
863{ "What's Next","What's Next" }, 863{ "What's Next","What's Next" },
864{ "Complete calendar...","Kompletten Kalender..." }, 864{ "Complete calendar...","Kompletten Kalender..." },
865{ "Filtered calendar...","Gefilterten Kalender..." }, 865{ "Filtered calendar...","Gefilterten Kalender..." },
866{ "Export to phone","Exportiere zum Handy" }, 866{ "Export to phone","Exportiere zum Handy" },
867{ "Beam receive enabled","Beam Empfang an" }, 867{ "Beam receive enabled","Beam Empfang an" },
868{ "What's new?","Was ist neu?" }, 868{ "What's new?","Was ist neu?" },
869{ "FAQ...","FAQ..." }, 869{ "FAQ...","FAQ..." },
870{ "Licence...","Licence..." }, 870{ "Licence...","Licence..." },
871{ "What's This?","What's This?" }, 871{ "What's This?","What's This?" },
872{ "&Edit...","&Editiere..." }, 872{ "&Edit...","&Editiere..." },
873{ "Oktober","Oktober" }, 873{ "Oktober","Oktober" },
874{ "Title","Titel" }, 874{ "Title","Titel" },
875{ "%1 %","%1 %" }, 875{ "%1 %","%1 %" },
876{ "Enable Pi-Sync","Schalte Pi-Sync an" }, 876{ "Enable Pi-Sync","Schalte Pi-Sync an" },
877{ "Import!","Importiere!" }, 877{ "Import!","Importiere!" },
878{ "inserting birthdays - close to abort!","Burzeltage werden eingefügt - schließe um abzubrechen!" }, 878{ "inserting birthdays - close to abort!","Burzeltage werden eingefügt - schließe um abzubrechen!" },
879{ "Export to phone options","Export ans Handy Optionen" }, 879{ "Export to phone options","Export ans Handy Optionen" },
880{ "Please read Help-Sync Howto\nto know what settings to use.","Bitte lese Hilfe-Sync Howto\num zu erfahren welche Einstellungen\ndie richtigen sind." }, 880{ "Please read Help-Sync Howto\nto know what settings to use.","Bitte lese Hilfe-Sync Howto\num zu erfahren welche Einstellungen\ndie richtigen sind." },
881{ "I/O device: ","I/O device: " }, 881{ "I/O device: ","I/O device: " },
882{ "Connection: ","Connection: " }, 882{ "Connection: ","Connection: " },
883{ "Model(opt.): ","Model(opt.): " }, 883{ "Model(opt.): ","Model(opt.): " },
884{ "Write back events in future only","Schreibe nur zukünftige Termine zurück" }, 884{ "Write back events in future only","Schreibe nur zukünftige Termine zurück" },
885{ "Max. weeks in future: ","Max. Wochen in der Zukunft: " }, 885{ "Max. weeks in future: ","Max. Wochen in der Zukunft: " },
886{ "NOTE: This will remove all old\ntodo/calendar data on phone!","ACHTUNG: Das löscht alle alten\nToDo/Kalender Daten auf dem Handy!" }, 886{ "NOTE: This will remove all old\ntodo/calendar data on phone!","ACHTUNG: Das löscht alle alten\nToDo/Kalender Daten auf dem Handy!" },
887{ "Export to mobile phone!","Exportiere auf das Handy!" }, 887{ "Export to mobile phone!","Exportiere auf das Handy!" },
888{ "Export complete calendar","Exportiere kompletten Kalender" }, 888{ "Export complete calendar","Exportiere kompletten Kalender" },
889{ "Writing to phone...","Sende Daten ans Handy..." }, 889{ "Writing to phone...","Sende Daten ans Handy..." },
890{ " This may take 1-3 minutes!"," Das kann 1-3 Minuten dauern!" }, 890{ " This may take 1-3 minutes!"," Das kann 1-3 Minuten dauern!" },
891{ "Retry","Nochmal versuchen" }, 891{ "Retry","Nochmal versuchen" },
892{ "KDE/Pim phone access","KDE/Pim Handy Zugriff" }, 892{ "KDE/Pim phone access","KDE/Pim Handy Zugriff" },
893{ "Error accessing device!\nPlease turn on connection\nand retry!","Fehler beim Zugriff auf das Gerät!\nBitte die Verbindung aktivieren\nund nochmal versuchen!" }, 893{ "Error accessing device!\nPlease turn on connection\nand retry!","Fehler beim Zugriff auf das Gerät!\nBitte die Verbindung aktivieren\nund nochmal versuchen!" },
894{ "Error exporting to phone!","Fehler beim Export auf das Handy!" }, 894{ "Error exporting to phone!","Fehler beim Export auf das Handy!" },
895{ "Export filtered calendar","Exportiere gefilterten Kalender" }, 895{ "Export filtered calendar","Exportiere gefilterten Kalender" },
896{ "Preferences","Vorlieben" }, 896{ "Preferences","Vorlieben" },
897{ "Global","Global" }, 897{ "Global","Global" },
898{ "Phone","Phone" }, 898{ "Phone","Phone" },
899{ "SMS","SMS" }, 899{ "SMS","SMS" },
900{ "Fax","Fax" }, 900{ "Fax","Fax" },
901{ "Pager","Pager" }, 901{ "Pager","Pager" },
902{ "SIP","SIP" }, 902{ "SIP","SIP" },
903{ "Italian","Italienisch" }, 903{ "Italian","Italienisch" },
904{ "24:00","24:00" }, 904{ "24:00","24:00" },
905{ "12:00am","12:00am" }, 905{ "12:00am","12:00am" },
906{ "24.03.2004 (%d.%m.%Y|%A %d %B %Y)","24.03.2004 (%d.%m.%Y|%A %d %B %Y)" }, 906{ "24.03.2004 (%d.%m.%Y|%A %d %B %Y)","24.03.2004 (%d.%m.%Y|%A %d %B %Y)" },
907{ "03.24.2004 (%m.%d.%Y|%A %B %d %Y)","03.24.2004 (%m.%d.%Y|%A %B %d %Y)" }, 907{ "03.24.2004 (%m.%d.%Y|%A %B %d %Y)","03.24.2004 (%m.%d.%Y|%A %B %d %Y)" },
908{ "2004-03-24 (%Y-%m-%d|%A %Y %B %d)","2004-03-24 (%Y-%m-%d|%A %Y %B %d)" }, 908{ "2004-03-24 (%Y-%m-%d|%A %Y %B %d)","2004-03-24 (%Y-%m-%d|%A %Y %B %d)" },
909{ "Mon 19.04.04: %a %d.%m.%y","Mon 19.04.04: %a %d.%m.%y" }, 909{ "Mon 19.04.04: %a %d.%m.%y","Mon 19.04.04: %a %d.%m.%y" },
910{ "Mon, 19.Apr.04: %a, %d.%b.%y","Mon, 19.Apr.04: %a, %d.%b.%y" }, 910{ "Mon, 19.Apr.04: %a, %d.%b.%y","Mon, 19.Apr.04: %a, %d.%b.%y" },
911{ "Add 30 min to selected Timezone","Addiere 30 min zur Zeitzone" }, 911{ "Add 30 min to selected Timezone","Addiere 30 min zur Zeitzone" },
912{ "Used Mail Client","Benutzter Mail Client" }, 912{ "Used Mail Client","Benutzter Mail Client" },
913{ "Channel:","Channel:" }, 913{ "Channel:","Channel:" },
914{ "Message:","Message:" }, 914{ "Message:","Message:" },
915{ "Parameters:","Parameter:" }, 915{ "Parameters:","Parameter:" },
916{ "HINT: Delimiter=; Name=%1,Email=%2","Hinweis: Begrenzer=; Name=%1,Email=%2" }, 916{ "HINT: Delimiter=; Name=%1,Email=%2","Hinweis: Begrenzer=; Name=%1,Email=%2" },
917{ "extra Message:","extra Message:" }, 917{ "extra Message:","extra Message:" },
918{ "extra Parameters:","extra Parameter:" }, 918{ "extra Parameters:","extra Parameter:" },
919{ "HINT: Emails=%1,Attachments=%2","Hinweis: Emails=%1,Attachments=%2" }, 919{ "HINT: Emails=%1,Attachments=%2","Hinweis: Emails=%1,Attachments=%2" },
920{ "External Apps.","Externe Appl." }, 920{ "External Apps.","Externe Appl." },
921{ "24 hours","24 Std." }, 921{ "24 hours","24 Std." },
922{ "3 hours","3 Std." }, 922{ "3 hours","3 Std." },
923{ "1 hour","1 Std." }, 923{ "1 hour","1 Std." },
924{ "15 minutes","15 Min." }, 924{ "15 minutes","15 Min." },
925{ "5 minutes","5 Min." }, 925{ "5 minutes","5 Min." },
926{ "1 minute","1 Min." }, 926{ "1 minute","1 Min." },
927{ "23","23" }, 927{ "23","23" },
928{ "Mon 15","Mon 15" }, 928{ "Mon 15","Mon 15" },
929{ "Configure KO","Konfiguriere KO" }, 929{ "Configure KO","Konfiguriere KO" },
930{ "Event text","Termin Text" }, 930{ "Event text","Termin Text" },
931{ "ToDo","ToDo" }, 931{ "ToDo","ToDo" },
932{ "Today","Heute" }, 932{ "Today","Heute" },
933{ "What's Next View","What's Next Ansicht" }, 933{ "What's Next View","What's Next Ansicht" },
934{ "Show Sync Events in \nWhat's Next/Agenda view","Zeige Sync Termine in \nWhat's Next/Agenda view" }, 934{ "Show Sync Events in \nWhat's Next/Agenda view","Zeige Sync Termine in \nWhat's Next/Agenda view" },
935{ "Use short date in \nWhat's Next/Event view","Zeige Kurzdatum in \nWhat's Next/Event view" }, 935{ "Use short date in \nWhat's Next/Event view","Zeige Kurzdatum in \nWhat's Next/Event view" },
936{ "Allday Agenda view shows todos","Ganztag Agenda zeigt Todos" }, 936{ "Allday Agenda view shows todos","Ganztag Agenda zeigt Todos" },
937{ "Alarm","Alarm" }, 937{ "Alarm","Alarm" },
938{ "Used %1 Client","Benutzter %1 Client" }, 938{ "Used %1 Client","Benutzter %1 Client" },
939{ "No email client installed","Kein Email Klient installiert" }, 939{ "No email client installed","Kein Email Klient installiert" },
940{ "Userdefined email client","Benutzerdef. Email Klient" }, 940{ "Userdefined email client","Benutzerdef. Email Klient" },
941{ "OM/Pi email client","OM/Pi Email Klient" }, 941{ "OM/Pi email client","OM/Pi Email Klient" },
942{ "Include in multiple ","Beziehe in multiple " }, 942{ "Include in multiple ","Beziehe in multiple " },
943{ "calendar ","Kalender " }, 943{ "calendar ","Kalender " },
944{ "addressbook ","Adressbuch " }, 944{ "addressbook ","Adressbuch " },
945{ "pwmanager","PWmanager" }, 945{ "pwmanager","PWmanager" },
946{ " sync"," Sync ein" }, 946{ " sync"," Sync ein" },
947{ "Write back synced data","Schreibe gesyncte Daten zurück" }, 947{ "Write back synced data","Schreibe gesyncte Daten zurück" },
948{ "-- Write back (on remote) existing entries only","-- Schreibe nur existierende (entfernte) Einträge zurück" }, 948{ "-- Write back (on remote) existing entries only","-- Schreibe nur existierende (entfernte) Einträge zurück" },
949{ "-- Write back (calendar) entries in future only","-- Schreibe nur zukünftige Kalender-Einträge zurück" }, 949{ "-- Write back (calendar) entries in future only","-- Schreibe nur zukünftige Kalender-Einträge zurück" },
950{ "---- Max. weeks in future: ","---- Max. wochen in der Zukunft: " }, 950{ "---- Max. weeks in future: ","---- Max. wochen in der Zukunft: " },
951{ "Pi-Sync ( direct Kx/Pi to Kx/Pi sync )","Pi-Sync ( direktes Kx/Pi zu Kx/Pi sync )" }, 951{ "Pi-Sync ( direct Kx/Pi to Kx/Pi sync )","Pi-Sync ( direktes Kx/Pi zu Kx/Pi sync )" },
952{ "Mobile device (cell phone)","Mobiles Gerät (Handy)" }, 952{ "Mobile device (cell phone)","Mobiles Gerät (Handy)" },
953{ "Help...","Hilfe..." }, 953{ "Help...","Hilfe..." },
954{ "Local file Cal:","Lokale Datei Kal:" }, 954{ "Local file Cal:","Lokale Datei Kal:" },
955{ "Local file ABook:","Lokale Datei ABuch:" }, 955{ "Local file ABook:","Lokale Datei ABuch:" },
956{ "Local file PWMgr:","Lokale Datei PWMgr:" }, 956{ "Local file PWMgr:","Lokale Datei PWMgr:" },
957{ "Addressbook file (*.vcf) is used by KA/Pi","Adressbuch Datei (*.vcf) wird von KA/Pi genutzt" }, 957{ "Addressbook file (*.vcf) is used by KA/Pi","Adressbuch Datei (*.vcf) wird von KA/Pi genutzt" },
958{ "Calendar:","Kalender:" }, 958{ "Calendar:","Kalender:" },
959{ "AddressBook:","AdressBuch:" }, 959{ "AddressBook:","AdressBuch:" },
960{ "PWManager:","PWManager:" }, 960{ "PWManager:","PWManager:" },
961{ "Addressbook file is used by KA/Pi","Adressbuch Datei wird von KA/Pi genutzt" }, 961{ "Addressbook file is used by KA/Pi","Adressbuch Datei wird von KA/Pi genutzt" },
962{ "ssh/scp","ssh/scp" }, 962{ "ssh/scp","ssh/scp" },
963{ "ftp","ftp" }, 963{ "ftp","ftp" },
964{ "Password for remote access: (could be the same for each)","Passwort für entfernten Zugriff: (kann dasselbe sein für alle)" }, 964{ "Password for remote access: (could be the same for each)","Passwort für entfernten Zugriff: (kann dasselbe sein für alle)" },
965{ "Remote IP address: (could be the same for each)","Entfernte IP Adresse: (kann dasselbe sein für alle)" }, 965{ "Remote IP address: (could be the same for each)","Entfernte IP Adresse: (kann dasselbe sein für alle)" },
966{ "Remote port number: (should be different for each)","Entfernte Port Nummer: (Sollte für alle unterschiedlich sein)" }, 966{ "Remote port number: (should be different for each)","Entfernte Port Nummer: (Sollte für alle unterschiedlich sein)" },
967{ "command for downloading remote file to local device","Kommando zum Download der entfernten Datei zum lokalen Gerät" }, 967{ "command for downloading remote file to local device","Kommando zum Download der entfernten Datei zum lokalen Gerät" },
968{ "command for uploading local temp file to remote device","Kommando zum Upload der lokalen temp. Datei zum entfernten Gerät" }, 968{ "command for uploading local temp file to remote device","Kommando zum Upload der lokalen temp. Datei zum entfernten Gerät" },
969{ "Insert device where\nphone is connected. E.g.:\n","Füge Device ein, an dem\ndas Handy angeschlossen ist. Z.B.:\n" }, 969{ "Insert device where\nphone is connected. E.g.:\n","Füge Device ein, an dem\ndas Handy angeschlossen ist. Z.B.:\n" },
970{ "KDE-Pim sync config","KDE-Pim sync Konfig" }, 970{ "KDE-Pim sync config","KDE-Pim sync Konfig" },
971{ "Insert kind of connection,e.g.:\n","Füge Art der Verbindung ein,z.B.:\n" }, 971{ "Insert kind of connection,e.g.:\n","Füge Art der Verbindung ein,z.B.:\n" },
972{ "Recommended: Leave empty!\n(Such that model can\nbe auto detected)\nOr insert name of model:\n","Empfohlen: Leer lassen!\n(So dass das Model\nautomatisch erkannt\nwerden kann)\nOder füge Model Name ein:\n" }, 972{ "Recommended: Leave empty!\n(Such that model can\nbe auto detected)\nOr insert name of model:\n","Empfohlen: Leer lassen!\n(So dass das Model\nautomatisch erkannt\nwerden kann)\nOder füge Model Name ein:\n" },
973{ "Port number (Default: %1)","Port Nummer (Default: %1)" }, 973{ "Port number (Default: %1)","Port Nummer (Default: %1)" },
974{ "Password to enable\naccess from remote:","Passwort um entfernten\nZugriff zuzulassen:" }, 974{ "Password to enable\naccess from remote:","Passwort um entfernten\nZugriff zuzulassen:" },
975{ "Automatically start\nat application startup","Starte automatisch\nbeim Programmstart" }, 975{ "Automatically start\nat application startup","Starte automatisch\nbeim Programmstart" },
976{ "Automatically sync\nwith KDE-Desktop","Automatischer Sync\nmit dem KDE-Desktop" }, 976{ "Automatically sync\nwith KDE-Desktop","Automatischer Sync\nmit dem KDE-Desktop" },
977{ "Enter port for Pi-Sync","Port Nummer für Pi-Sync" }, 977{ "Enter port for Pi-Sync","Port Nummer für Pi-Sync" },
978{ "Disable Pi-Sync","Schalte Pi-Sync aus" }, 978{ "Disable Pi-Sync","Schalte Pi-Sync aus" },
979{ "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!" }, 979{ "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!" },
980{ "KDE-Pim Sync","KDE-Pim Sync" }, 980{ "KDE-Pim Sync","KDE-Pim Sync" },
981{ "Multiple profiles","Multi-Sync Profile" }, 981{ "Multiple profiles","Multi-Sync Profile" },
982{ "Device: ","Gerät: " }, 982{ "Device: ","Gerät: " },
983{ "Multiple sync started.","Multi-Sync gestartet." }, 983{ "Multiple sync started.","Multi-Sync gestartet." },
984{ "Nothing synced! No profiles defined for multisync!","Nichts gesynct! Keine Profile\nselektiert für Multi-Sync" }, 984{ "Nothing synced! No profiles defined for multisync!","Nichts gesynct! Keine Profile\nselektiert für Multi-Sync" },
985{ "Turn filter on","Schalte Filter an" }, 985{ "Turn filter on","Schalte Filter an" },
986{ "Turn filter off","Schalte Filter aus" }, 986{ "Turn filter off","Schalte Filter aus" },
987{ "Key bindings KOrganizer/Pi","Tastatur Belegung KOrganizer/Pi" }, 987{ "Key bindings KOrganizer/Pi","Tastatur Belegung KOrganizer/Pi" },
988{ "<p><b>White</b>: Item readonly</p>\n","<p><b>Weiss</b>: Eintrag schreibgeschützt</p>\n" }, 988{ "<p><b>White</b>: Item readonly</p>\n","<p><b>Weiss</b>: Eintrag schreibgeschützt</p>\n" },
989{ "<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n","<p><b>Dunkelgelb</b>: Termin/Todo mit Teilnehmern.</p>\n" }, 989{ "<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n","<p><b>Dunkelgelb</b>: Termin/Todo mit Teilnehmern.</p>\n" },
990{ "<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" }, 990{ "<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" },
991{ "<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" }, 991{ "<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" },
992{ "<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" }, 992{ "<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" },
993{ "<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" }, 993{ "<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" },
994{ "<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" }, 994{ "<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" },
995{ "<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" }, 995{ "<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" },
996{ "<p><h2>KO/Pi icon colors:</h2></p>\n","<p><h2>KO/Pi Icon Farben:</h2></p>\n" }, 996{ "<p><h2>KO/Pi icon colors:</h2></p>\n","<p><h2>KO/Pi Icon Farben:</h2></p>\n" },
997{ "<p><b>E</b>: Edit item</p>\n","<p><b>E</b>: Editiere Eintrag</p>\n" }, 997{ "<p><b>E</b>: Edit item</p>\n","<p><b>E</b>: Editiere Eintrag</p>\n" },
998{ "<p><b>A</b>: Show agenda view.</p>\n","<p><b>A</b>: Zeige Agenda Ansicht.</p>\n" }, 998{ "<p><b>A</b>: Show agenda view.</p>\n","<p><b>A</b>: Zeige Agenda Ansicht.</p>\n" },
999{ "<p><b>I,C</b>: Close dialog.</p>\n","<p><b>I,C</b>: Schließe Dialog.</p>\n" }, 999{ "<p><b>I,C</b>: Close dialog.</p>\n","<p><b>I,C</b>: Schließe Dialog.</p>\n" },
1000{ "<p><h3>In event/todo viewer:</h3></p>\n","<p><h3>In Termin/Todo Detail-Anzeige:</h3></p>\n" }, 1000{ "<p><h3>In event/todo viewer:</h3></p>\n","<p><h3>In Termin/Todo Detail-Anzeige:</h3></p>\n" },
1001{ "<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" }, 1001{ "<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" },
1002{ "<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" }, 1002{ "<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" },
1003{ "<p><b>up/down</b>: Next/prev item</p>\n","<p><b>up/down</b>: Nächster/vorheriger Eintrag</p>\n" }, 1003{ "<p><b>up/down</b>: Next/prev item</p>\n","<p><b>up/down</b>: Nächster/vorheriger Eintrag</p>\n" },
1004{ "<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" }, 1004{ "<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" },
1005{ "<p><b>return</b>: Select item+one step down</p>\n","<p><b>return</b>: Selektiere Item+Cursor einen Eintrag runter</p>\n" }, 1005{ "<p><b>return</b>: Select item+one step down</p>\n","<p><b>return</b>: Selektiere Item+Cursor einen Eintrag runter</p>\n" },
1006{ "<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" }, 1006{ "<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" },
1007{ "<p><h3>In list view:</h3></p>\n","<p><h3>In Listen Ansicht:</h3></p>\n" }, 1007{ "<p><h3>In list view:</h3></p>\n","<p><h3>In Listen Ansicht:</h3></p>\n" },
1008{ "<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" }, 1008{ "<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" },
1009{ "<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" }, 1009{ "<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" },
1010{ "<p><b>Q</b>: Toggle quick todo line edit.</p>\n","<p><b>Q</b>: Zeige/verstecke Quick Todo Eingabe Zeile.</p>\n" }, 1010{ "<p><b>Q</b>: Toggle quick todo line edit.</p>\n","<p><b>Q</b>: Zeige/verstecke Quick Todo Eingabe Zeile.</p>\n" },
1011{ "<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" }, 1011{ "<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" },
1012{ "<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" }, 1012{ "<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" },
1013{ "<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" }, 1013{ "<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" },
1014{ "<p><h3>In todo view:</h3></p>\n","<p><h3>In Todo Anzige:</h3></p>\n" }, 1014{ "<p><h3>In todo view:</h3></p>\n","<p><h3>In Todo Anzige:</h3></p>\n" },
1015{ "<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n","<p><b>ctrl+up/down</b>: Scrolle kleine Todo Ansicht</p>\n" }, 1015{ "<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n","<p><b>ctrl+up/down</b>: Scrolle kleine Todo Ansicht</p>\n" },
1016{ "<p><b>up/down</b>: Scroll agenda view</p>\n","<p><b>up/down</b>: Scrolle Agenda Ansicht</p>\n" }, 1016{ "<p><b>up/down</b>: Scroll agenda view</p>\n","<p><b>up/down</b>: Scrolle Agenda Ansicht</p>\n" },
1017{ "<p><h3>In agenda view:</h3></p>\n","<p><h3>In Agenda Ansicht:</h3></p>\n" }, 1017{ "<p><h3>In agenda view:</h3></p>\n","<p><h3>In Agenda Ansicht:</h3></p>\n" },
1018{ "<p><b>del,backspace</b>: Delete selected item</p>\n","<p><b>del,backspace</b>: Lösche selektiertes Item</p>\n" }, 1018{ "<p><b>del,backspace</b>: Delete selected item</p>\n","<p><b>del,backspace</b>: Lösche selektiertes Item</p>\n" },
1019{ "<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n","<p><b>left</b>: Vorh. Woche | <b>left+ctrl</b>: Vorh. Monat</p>\n" }, 1019{ "<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n","<p><b>left</b>: Vorh. Woche | <b>left+ctrl</b>: Vorh. Monat</p>\n" },
1020{ "<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n","<p><b>right</b>: Nächste Woche | <b>right+ctrl</b>: Nächste Woche</p>\n" }, 1020{ "<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n","<p><b>right</b>: Nächste Woche | <b>right+ctrl</b>: Nächste Woche</p>\n" },
1021{ "<p><b>B</b>: Edit description (details) of selected item</p>\n","<p><b>B</b>: Editiere Beschreibung (Details) des selektierten Items</p>\n" }, 1021{ "<p><b>B</b>: Edit description (details) of selected item</p>\n","<p><b>B</b>: Editiere Beschreibung (Details) des selektierten Items</p>\n" },
1022{ "<p><b>C</b>: Show current time in agenda view</p>\n","<p><b>C</b>: Zeige aktuelle Zeit in Agenda Ansicht</p>\n" }, 1022{ "<p><b>C</b>: Show current time in agenda view</p>\n","<p><b>C</b>: Zeige aktuelle Zeit in Agenda Ansicht</p>\n" },
1023{ "<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n","<p><b>+,-</b> : Zoom rein/raus Agenda | <b>A</b>: Wechsle Ganztag Agenda Höhe</p>\n" }, 1023{ "<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n","<p><b>+,-</b> : Zoom rein/raus Agenda | <b>A</b>: Wechsle Ganztag Agenda Höhe</p>\n" },
1024{ "<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n","<p><b>S+ctrl</b>: Füge Sub-Todo hinzu | <b>X</b>: Zeige/verstecke Datenavigator</p>\n" }, 1024{ "<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n","<p><b>S+ctrl</b>: Füge Sub-Todo hinzu | <b>X</b>: Zeige/verstecke Datenavigator</p>\n" },
1025{ "<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n","<p><b>T</b>: Gehe zu Heute | <b>T+ctrl</b>: Neues Todo</p>\n" }, 1025{ "<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n","<p><b>T</b>: Gehe zu Heute | <b>T+ctrl</b>: Neues Todo</p>\n" },
1026{ "<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n","<p><b>E</b>: Editiere selektiertes Item |<b> E+ctrl</b>: Neuer Termin</p>\n" }, 1026{ "<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n","<p><b>E</b>: Editiere selektiertes Item |<b> E+ctrl</b>: Neuer Termin</p>\n" },
1027{ "<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n","<p><b>D</b>: Ein-Tages Ansicht | <b>M</b>: Monats Ansicht</p>\n" }, 1027{ "<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n","<p><b>D</b>: Ein-Tages Ansicht | <b>M</b>: Monats Ansicht</p>\n" },
1028{ "<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n","<p><b>Z,Y</b>: Arbeitswochen Ansicht | <b>U</b>: Wochen Ansicht</p>\n" }, 1028{ "<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n","<p><b>Z,Y</b>: Arbeitswochen Ansicht | <b>U</b>: Wochen Ansicht</p>\n" },
1029{ "<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n","<p><b>V</b>: Todo Ansicht | <b>L</b>: Termin Listen Ansicht</p>\n" }, 1029{ "<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n","<p><b>V</b>: Todo Ansicht | <b>L</b>: Termin Listen Ansicht</p>\n" },
1030{ "<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ","<p><b>N</b>: Nächste-Tage Ansicht days view| <b>W</b>: What's next Ansicht\n " }, 1030{ "<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ","<p><b>N</b>: Nächste-Tage Ansicht days view| <b>W</b>: What's next Ansicht\n " },
1031{ "<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n","<p><b>1-0</b> (+<b>ctrl</b>): Selektiere Filter 1-10 (11-20)</p>\n" }, 1031{ "<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n","<p><b>1-0</b> (+<b>ctrl</b>): Selektiere Filter 1-10 (11-20)</p>\n" },
1032{ "<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n","<p><b>O</b>: Filter An/Aus | <b>J</b>: Journal Ansicht</p>\n" }, 1032{ "<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n","<p><b>O</b>: Filter An/Aus | <b>J</b>: Journal Ansicht</p>\n" },
1033{ "<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n","<p><b>F</b>: Zeige/verstecke Filter Ansicht |<b>F+ctrl</b>: Editiere Filter </p>\n" }, 1033{ "<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n","<p><b>F</b>: Zeige/verstecke Filter Ansicht |<b>F+ctrl</b>: Editiere Filter </p>\n" },
1034{ "<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n","<p><b>Space</b>: Zeige fullscreen | <b>P</b>: Datums Picker</p>\n" }, 1034{ "<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n","<p><b>Space</b>: Zeige fullscreen | <b>P</b>: Datums Picker</p>\n" },
1035{ "<p><b>I</b>: Show info for selected event/todo</p>\n","<p><b>I</b>: Zeige Info (Details) für selektiertes Item</p>\n" }, 1035{ "<p><b>I</b>: Show info for selected event/todo</p>\n","<p><b>I</b>: Zeige Info (Details) für selektiertes Item</p>\n" },
1036{ "<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n","<p><b>H</b>: Dieser Hilfe Dialog | <b>S</b>: Such Dialog</p>\n" }, 1036{ "<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n","<p><b>H</b>: Dieser Hilfe Dialog | <b>S</b>: Such Dialog</p>\n" },
1037{ "<p><h2>KO/Pi key shortcuts:</h2></p>\n","<p><h2>KO/Pi Tastatur Kurzbefehle:</h2></p>\n" }, 1037{ "<p><h2>KO/Pi key shortcuts:</h2></p>\n","<p><h2>KO/Pi Tastatur Kurzbefehle:</h2></p>\n" },
1038{ "After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n","Nachdem etwas geändert wurde, werden die\nDaten automatisch in die Datei abgespeichert\n~/kdepim/apps/korganizer/mycalendar.ics\nnach (konfigurierbar) drei Minuten.\nAus Sicherheitsgründen wird noch einmal\nnach 10 Min. abgespeichert, wenn keine\nÄnderungen vorgenommen wurden. Die \nDaten werden automatisch gespeichert,\nwenn KO/Pi beendet wird.\nSie können eine Backup-Datei erstellen im\nMenu: Datei - Speichere Kalender Backup\n" }, 1038{ "After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n","Nachdem etwas geändert wurde, werden die\nDaten automatisch in die Datei abgespeichert\n~/kdepim/apps/korganizer/mycalendar.ics\nnach (konfigurierbar) drei Minuten.\nAus Sicherheitsgründen wird noch einmal\nnach 10 Min. abgespeichert, wenn keine\nÄnderungen vorgenommen wurden. Die \nDaten werden automatisch gespeichert,\nwenn KO/Pi beendet wird.\nSie können eine Backup-Datei erstellen im\nMenu: Datei - Speichere Kalender Backup\n" },
1039{ "Auto Saving in KOrganizer/Pi","Auto Speichern in KOrganizer/Pi" }, 1039{ "Auto Saving in KOrganizer/Pi","Auto Speichern in KOrganizer/Pi" },
1040{ "\nhttp://sourceforge.net/projects/kdepimpi\n","\nhttp://sourceforge.net/projects/kdepimpi\n" }, 1040{ "\nhttp://sourceforge.net/projects/kdepimpi\n","\nhttp://sourceforge.net/projects/kdepimpi\n" },
1041{ "\nor report them in the bugtracker on\n","\noder trage sie in dem Bugtracker ein auf\n" }, 1041{ "\nor report them in the bugtracker on\n","\noder trage sie in dem Bugtracker ein auf\n" },
1042{ "\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n","\nBitte melde fehlerhaftes Verhalten an\nlutz@pi-sync.net\n" }, 1042{ "\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n","\nBitte melde fehlerhaftes Verhalten an\nlutz@pi-sync.net\n" },
1043{ "2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n","2) Ein Audio Alarm Daemon\nfür den Zaurus ist verfügbar\nals zusätzliche Anwendung\n" }, 1043{ "2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n","2) Ein Audio Alarm Daemon\nfür den Zaurus ist verfügbar\nals zusätzliche Anwendung\n" },
1044{ "1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n","1) Importieren von *.vcs oder *.ics Dateien von\nanderen Anwendungen kann möglicherweise\n nicht richtig funktionieren,\nwenn die Termine Eigenschaften haben,\ndie KO/Pi nicht unterstützt.\n" }, 1044{ "1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n","1) Importieren von *.vcs oder *.ics Dateien von\nanderen Anwendungen kann möglicherweise\n nicht richtig funktionieren,\nwenn die Termine Eigenschaften haben,\ndie KO/Pi nicht unterstützt.\n" },
1045{ "Known Problems in KOrganizer/Pi","Bekannte Probleme in KOrganizer/Pi" }, 1045{ "Known Problems in KOrganizer/Pi","Bekannte Probleme in KOrganizer/Pi" },
1046{ "KO/Pi FAQ","KO/Pi FAQ" }, 1046{ "KO/Pi FAQ","KO/Pi FAQ" },
1047{ "(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n","(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi basiert auf KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi ist lizensiert unter der GPL.\nKO/Pi kann kompiliert werden für\nLinux, Zaurus-PDA und Windows\nwww.korganizer.org\nwww.pi-sync.net\n" }, 1047{ "(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n","(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi basiert auf KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi ist lizensiert unter der GPL.\nKO/Pi kann kompiliert werden für\nLinux, Zaurus-PDA und Windows\nwww.korganizer.org\nwww.pi-sync.net\n" },
1048{ "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n","PDA-Edition\nfür: Zaurus 5x00 / 7x0 / 8x0\n" }, 1048{ "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n","PDA-Edition\nfür: Zaurus 5x00 / 7x0 / 8x0\n" },
1049{ "KOrganizer/Platform-independent\n","KOrganizer/Platform-independent\n" }, 1049{ "KOrganizer/Platform-independent\n","KOrganizer/Platform-independent\n" },
1050{ "About KOrganizer/Pi","Über KOrganizer/Pi" }, 1050{ "About KOrganizer/Pi","Über KOrganizer/Pi" },
1051{ "From: ","Von: " }, 1051{ "From: ","Von: " },
1052{ "Remove sync info","Entferne Sync Info" }, 1052{ "Remove sync info","Entferne Sync Info" },
1053{ "For all profiles","Für alle Profile" }, 1053{ "For all profiles","Für alle Profile" },
1054{ "Hide not Running","Verstecke nicht Laufende" }, 1054{ "Hide not Running","Verstecke nicht Laufende" },
1055{ "ME","ME" }, 1055{ "ME","ME" },
1056{ "Toolbar","Toolbar" }, 1056{ "Toolbar","Toolbar" },
1057{ "Undo Delete...","Löschen rückgängig machen..." }, 1057{ "Undo Delete...","Löschen rückgängig machen..." },
1058{ "Undo Delete","Löschen rückgängig machen" }, 1058{ "Undo Delete","Löschen rückgängig machen" },
1059{ "KDE Sync HowTo...","KDE Sync HowTo..." }, 1059{ "KDE Sync HowTo...","KDE Sync HowTo..." },
1060{ "Multi Sync HowTo...","Multi Sync HowTo..." }, 1060{ "Multi Sync HowTo...","Multi Sync HowTo..." },
1061{ "Januar","Januar" }, 1061{ "Januar","Januar" },
1062{ "KO/Pi Keys + Colors","KO/Pi Tasten + Farben" }, 1062{ "KO/Pi Keys + Colors","KO/Pi Tasten + Farben" },
1063{ "No Filter","Kein Filter" }, 1063{ "No Filter","Kein Filter" },
1064{ "Multiple Sync options","Multi Sync Optionen" }, 1064{ "Multiple Sync options","Multi Sync Optionen" },
1065{ "Sync algo options","Sync Ablauf Optionen" }, 1065{ "Sync algo options","Sync Ablauf Optionen" },
1066{ "Apply filter when adding data to local:","Filter für das Hinzufügen von Daten zu Lokal:" }, 1066{ "Apply filter when adding data to local:","Filter für das Hinzufügen von Daten zu Lokal:" },
1067{ "Incoming calendar filter:","Eingehender Kalender Filter:" }, 1067{ "Incoming calendar filter:","Eingehender Kalender Filter:" },
1068{ "Incoming addressbook filter:","Eingehender Adressbuch Filter:" }, 1068{ "Incoming addressbook filter:","Eingehender Adressbuch Filter:" },
1069{ "Write back options","Optionen zum Zurückschreiben" }, 1069{ "Write back options","Optionen zum Zurückschreiben" },
1070{ "Write back (on remote) existing entries only","Schreibe nur existierende (auf Entfernt) Einträge zurück" }, 1070{ "Write back (on remote) existing entries only","Schreibe nur existierende (auf Entfernt) Einträge zurück" },
1071{ "Apply filter when adding data to remote:","Filter für das Hinzufügen von Daten zu Entfernt:" }, 1071{ "Apply filter when adding data to remote:","Filter für das Hinzufügen von Daten zu Entfernt:" },
1072{ "Outgoing calendar filter:","Ausgehender Kalender Filter:" }, 1072{ "Outgoing calendar filter:","Ausgehender Kalender Filter:" },
1073{ "Outgoing addressbook filter:","Ausgehender Adressbuch Filter:" }, 1073{ "Outgoing addressbook filter:","Ausgehender Adressbuch Filter:" },
1074{ "Write back (calendar) entries for time period only","Schreibe nur Kalender Einträge für Zeitspanne zurück" }, 1074{ "Write back (calendar) entries for time period only","Schreibe nur Kalender Einträge für Zeitspanne zurück" },
1075{ "Time period","Zeitspanne" }, 1075{ "Time period","Zeitspanne" },
1076{ "From ","Von " }, 1076{ "From ","Von " },
1077{ " weeks in the past to "," Wochen in der Vergangenheit bis zu " }, 1077{ " weeks in the past to "," Wochen in der Vergangenheit bis zu " },
1078{ " weeks in the future "," Wochen in der Zukunft " }, 1078{ " weeks in the future "," Wochen in der Zukunft " },
1079{ "Profile kind specific settings","Profil Art abhängige Einstellungen" }, 1079{ "Profile kind specific settings","Profil Art abhängige Einstellungen" },
1080{ "Local temp file:","Lokale temp Datei:" }, 1080{ "Local temp file:","Lokale temp Datei:" },
1081{ "Multiple profiles with same name!\nPlease use unique profile names!","Mehrere Profile mit demselben Namen!\nBitte verschiedene Namen benutzen!" }, 1081{ "Multiple profiles with same name!\nPlease use unique profile names!","Mehrere Profile mit demselben Namen!\nBitte verschiedene Namen benutzen!" },
1082{ "Aborted! Nothing synced!","Abgebrochen! Nichts wurde gesynct!" }, 1082{ "Aborted! Nothing synced!","Abgebrochen! Nichts wurde gesynct!" },
1083{ "Language","Sprache" }, 1083{ "Language","Sprache" },
1084{ "Time Format","Zeit Format" }, 1084{ "Time Format","Zeit Format" },
1085{ "Time Zone","Zeit Zone" }, 1085{ "Time Zone","Zeit Zone" },
1086{ "%1 groups subscribed","%1 Guppen abboniert" }, 1086{ "%1 groups subscribed","%1 Guppen abboniert" },
1087{ "Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail","Aktuelles Speicherverzeichnis ist:\n%1\nIhre Mail wird gespeichert in:\n(speicherverz.)/apps/kopiemail/localmail" }, 1087{ "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" },
1088{ "<b>New data storage dir:</b>","<b>Neues Datenspeicherverzeichnis:</b>" }, 1088{ "<b>New data storage dir:</b>","<b>Neues Datenspeicherverzeichnis:</b>" },
1089{ "New dirs are created automatically","Neue Verzeichnisse werden aut. erstellt" }, 1089{ "New dirs are created automatically","Neue Verzeichnisse werden aut. erstellt" },
1090{ "Save settings","Speichere Einstellungen" }, 1090{ "Save settings","Speichere Einstellungen" },
1091{ "Save standard","Speichere Standard" }, 1091{ "Save standard","Speichere Standard" },
1092{ "<b>New settings are used\nafter a restart</b>","<b>Neue Einstellungen werden nach\neinem Neustart genutzt</b>" }, 1092{ "<b>New settings are used\nafter a restart</b>","<b>Neue Einstellungen werden nach\neinem Neustart genutzt</b>" },
1093{ "Settings are stored in\n%1","Einstellungen werden gespeichert in:\n%1" }, 1093{ "Settings are stored in\n%1","Einstellungen werden gespeichert in:\n%1" },
1094{ "Data storage path","Daten Speicherpfad" }, 1094{ "Data storage path","Daten Speicherpfad" },
1095{ "Language","Sprache" }, 1095{ "Language","Sprache" },
1096{ "Show time in agenda items","Zeige Zeit in Agenda Items" }, 1096{ "Show time in agenda items","Zeige Zeit in Agenda Items" },
1097{ "Color for Sundays + category "Holiday"","Farbe für Sonntags + Kategorie "Feiertag"" }, 1097{ "Color for Sundays + category "Holiday"","Farbe für Sonntags + Kategorie "Feiertag"" },
1098{ "Show events, that are done in \nWhat's Next view","Zeige abgelaufene Termine in\nWhat's Next Ansicht" }, 1098{ "Show events, that are done in \nWhat's Next view","Zeige abgelaufene Termine in\nWhat's Next Ansicht" },
1099{ "Hide not running Todos in To-do view","Verstecke nicht laufende Todos" }, 1099{ "Hide not running Todos in To-do view","Verstecke nicht laufende Todos" },
1100{ "+01:00 Europe/Oslo(CET)","+01:00 Europe/Oslo(CET)" }, 1100{ "+01:00 Europe/Oslo(CET)","+01:00 Europe/Oslo(CET)" },
1101{ "KO/Pi","KO/Pi" }, 1101{ "KO/Pi","KO/Pi" },
1102{ "There is nothing to undo!","Es gibt nichts zum\nRückgängigmachen!" }, 1102{ "There is nothing to undo!","Es gibt nichts zum\nRückgängigmachen!" },
1103{ "Recreating edit dialog. Please wait...","Recreating edit dialog. Please wait..." }, 1103{ "Recreating edit dialog. Please wait...","Recreating edit dialog. Please wait..." },
1104{ "Sound.Al.: ","Sound.Al.: " }, 1104{ "Sound.Al.: ","Sound.Al.: " },
1105{ "From: %1 To: %2 %3","Von: %1 Bis: %2 %3" }, 1105{ "From: %1 To: %2 %3","Von: %1 Bis: %2 %3" },
1106{ "Restore","Wiederherstellen" }, 1106{ "Restore","Wiederherstellen" },
1107{ "\nAre you sure you want\nto restore this?","\nMöchten Sie das wirklicht\nwiederherstellen?" }, 1107{ "\nAre you sure you want\nto restore this?","\nMöchten Sie das wirklicht\nwiederherstellen?" },
1108{ "% completed","% komplett" }, 1108{ "% completed","% komplett" },
1109{ "%d item(s) found.","%d Item(s) gefunden." }, 1109{ "%d item(s) found.","%d Item(s) gefunden." },
1110{ "Set complete","Setze auf erledigt" }, 1110{ "Set complete","Setze auf erledigt" },
1111{ "(cancelled)","(gecancelt)" }, 1111{ "(cancelled)","(gecancelt)" },
1112{ "Click on the week number to\nshow week in agenda view","Klicke auf die Wochennummer\num die Woche in der Agenda anzuzeigen" }, 1112{ "Click on the week number to\nshow week in agenda view","Klicke auf die Wochennummer\num die Woche in der Agenda anzuzeigen" },
1113{ " Local time "," Locale Zeit " }, 1113{ " Local time "," Locale Zeit " },
1114{ "Form2","Form2" }, 1114{ "Form2","Form2" },
1115{ "Filter enabled","Filter angeschaltet" }, 1115{ "Filter enabled","Filter angeschaltet" },
1116{ "Edit Filters","Ändere Filter" }, 1116{ "Edit Filters","Ändere Filter" },
1117{ "Print What's Next View...","Drucke What's Next Ansicht..." }, 1117{ "Print What's Next View...","Drucke What's Next Ansicht..." },
1118{ "Agenda","Agenda" }, 1118{ "Agenda","Agenda" },
1119{ " ("," (" }, 1119{ " ("," (" },
1120{ "<p><b>Due on:</b> %1</p>","<p><b>Fällig am:</b> %1</p>" }, 1120{ "<p><b>Due on:</b> %1</p>","<p><b>Fällig am:</b> %1</p>" },
1121{ "Print","Print" }, 1121{ "Print","Print" },
1122{ "&Setup Printer...","Drucker &Setup..." }, 1122{ "&Setup Printer...","Drucker &Setup..." },
1123{ "View Type","Zeige Typ" }, 1123{ "View Type","Zeige Typ" },
1124{ "Page &orientation:","Seiten Ausrichtung:" }, 1124{ "Page &orientation:","Seiten Ausrichtung:" },
1125{ "Use Default of Selected Style","Default des selektierten Stils" }, 1125{ "Use Default of Selected Style","Default des selektierten Stils" },
1126{ "Use Default Setting of Printer","Default Einstellung des Druckers" }, 1126{ "Use Default Setting of Printer","Default Einstellung des Druckers" },
1127{ "Portrait","Portrait" }, 1127{ "Portrait","Portrait" },
1128{ "Landscape","Landschaft" }, 1128{ "Landscape","Landschaft" },
1129{ "Print day","Drucke Tag" }, 1129{ "Print day","Drucke Tag" },
1130{ "CalPrintDay_Base","CalPrintDay_Base" }, 1130{ "CalPrintDay_Base","CalPrintDay_Base" },
1131{ "Date && Time Range","Datum && Zeitspanne" }, 1131{ "Date && Time Range","Datum && Zeitspanne" },
1132{ "&End date:","&Enddatum:" }, 1132{ "&End date:","&Enddatum:" },
1133{ "&Start date:","&Startdatum:" }, 1133{ "&Start date:","&Startdatum:" },
1134{ "Start &time:","Startzeit:" }, 1134{ "Start &time:","Startzeit:" },
1135{ "End ti&me:","Endzeit:" }, 1135{ "End ti&me:","Endzeit:" },
1136{ "E&xtend time range to include all events","Erweitere Zeitspanne um alle Termine einzuschliessen" }, 1136{ "E&xtend time range to include all events","Erweitere Zeitspanne um alle Termine einzuschliessen" },
1137{ "Include to&dos that are due on the printed day(s)","Inclusive To&dos, die an den selektierten Tagen fällig sind" }, 1137{ "Include to&dos that are due on the printed day(s)","Inclusive To&dos, die an den selektierten Tagen fällig sind" },
1138{ "Alt+D","Alt+D" }, 1138{ "Alt+D","Alt+D" },
1139{ "&Use colors","Nutze Farben" }, 1139{ "&Use colors","Nutze Farben" },
1140{ "Alt+U","Alt+U" }, 1140{ "Alt+U","Alt+U" },
1141{ "Print week","Drucke Woche" }, 1141{ "Print week","Drucke Woche" },
1142{ "CalPrintWeek_Base","CalPrintWeek_Base" }, 1142{ "CalPrintWeek_Base","CalPrintWeek_Base" },
1143{ "Use &colors","Nutze Farben" }, 1143{ "Use &colors","Nutze Farben" },
1144{ "Type of View","Typ der Ansicht" }, 1144{ "Type of View","Typ der Ansicht" },
1145{ "Print as &Filofax page","Drucke als &Filofax Seite" }, 1145{ "Print as &Filofax page","Drucke als &Filofax Seite" },
1146{ "Alt+F","Alt+F" }, 1146{ "Alt+F","Alt+F" },
1147{ "Print as &timetable view:","Drucke als Zeittabelle:" }, 1147{ "Print as &timetable view:","Drucke als Zeittabelle:" },
1148{ "Alt+T","Alt+T" }, 1148{ "Alt+T","Alt+T" },
1149{ "Print as split week view","Drucke als gesplittete Wochenansicht" }, 1149{ "Print as split week view","Drucke als gesplittete Wochenansicht" },
1150{ "Print month","Drucke Monat" }, 1150{ "Print month","Drucke Monat" },
1151{ "CalPrintMonth_Base","CalPrintMonth_Base" }, 1151{ "CalPrintMonth_Base","CalPrintMonth_Base" },
1152{ "&Start month:","&Startmonat:" }, 1152{ "&Start month:","&Startmonat:" },
1153{ "&End month:","&Endmonat:" }, 1153{ "&End month:","&Endmonat:" },
1154{ "Print week &numbers","Drucke Wochen Nummer(n)" }, 1154{ "Print week &numbers","Drucke Wochen Nummer(n)" },
1155{ "Print todos","Drucke Todos" }, 1155{ "Print todos","Drucke Todos" },
1156{ "CalPrintTodoConfig_Base","CalPrintTodoConfig_Base" }, 1156{ "CalPrintTodoConfig_Base","CalPrintTodoConfig_Base" },
1157{ "Include &description of the item","Inclusive Itembeschreibung" }, 1157{ "Include &description of the item","Inclusive Itembeschreibung" },
1158{ "Include d&ue date of the item","Inclusive Fälligkeitsdatum des Items" }, 1158{ "Include d&ue date of the item","Inclusive Fälligkeitsdatum des Items" },
1159{ "Include &priority of the item","Inclusive Priorität des Items" }, 1159{ "Include &priority of the item","Inclusive Priorität des Items" },
1160{ "Items to Print","Zu druckende Items" }, 1160{ "Items to Print","Zu druckende Items" },
1161{ "&From:","Von:" }, 1161{ "&From:","Von:" },
1162{ "&To:","Bis:" }, 1162{ "&To:","Bis:" },
1163{ "Print &all todo items","Drucke alle Todo Items" }, 1163{ "Print &all todo items","Drucke alle Todo Items" },
1164{ "Print only &uncompleted items","Drucke nur nicht erledigte Todos" }, 1164{ "Print only &uncompleted items","Drucke nur nicht erledigte Todos" },
1165{ "Only items due in the &range:","Nur Items in dem Zeitraum:" }, 1165{ "Only items due in the &range:","Nur Items in dem Zeitraum:" },
1166{ "Todo List","Todo Liste" }, 1166{ "Todo List","Todo Liste" },
1167{ "&Title:","&Titel:" }, 1167{ "&Title:","&Titel:" },
1168{ "Co&nnect subtodos with its parent","Verbinde Unter-Todos mit ihren Ober-Todos" }, 1168{ "Co&nnect subtodos with its parent","Verbinde Unter-Todos mit ihren Ober-Todos" },
1169{ "Todo list","Todo Liste" }, 1169{ "Todo list","Todo Liste" },
1170{ "&Print...","Drucke..." }, 1170{ "&Print...","Drucke..." },
1171{ "<qt>Printing on printer <b>%1</b></qt>","<qt>Drucke auf Drucker <b>%1</b></qt>" }, 1171{ "<qt>Printing on printer <b>%1</b></qt>","<qt>Drucke auf Drucker <b>%1</b></qt>" },
1172{ "[Unconfigured]","[Unkonfiguriert]" }, 1172{ "[Unconfigured]","[Unkonfiguriert]" },
1173{ "OK","OK" }, 1173{ "OK","OK" },
1174{ "FilterEditor","FilterEditor" }, 1174{ "FilterEditor","FilterEditor" },
1175{ "Include","Inclusive" }, 1175{ "Include","Inclusive" },
1176{ "Exclude","Exclusive" }, 1176{ "Exclude","Exclusive" },
1177{ "Edit Selection...","Editiere Auswahl" }, 1177{ "Edit Selection...","Editiere Auswahl" },
1178{ "recurring events","wiederholende Termine" }, 1178{ "recurring events","wiederholende Termine" },
1179{ "recurr. events","wiederh.Termine" }, 1179{ "recurr. events","wiederh.Termine" },
1180{ "completed to-dos","erledigte Todos" }, 1180{ "completed to-dos","erledigte Todos" },
1181{ "events","Termine" }, 1181{ "events","Termine" },
1182{ "todos","Todos" }, 1182{ "todos","Todos" },
1183{ "journals","Journale" }, 1183{ "journals","Journale" },
1184{ "public","öffentl." }, 1184{ "public","öffentl." },
1185{ "private","privat" }, 1185{ "private","privat" },
1186{ "confidential","vertraul." }, 1186{ "confidential","vertraul." },
1187{ "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Unter-Todos.\nAlle erledigten Unter-Todos\nwerden auch gelöscht!" }, 1187{ "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Unter-Todos.\nAlle erledigten Unter-Todos\nwerden auch gelöscht!" },
1188{ "Yesterday","Gestern" }, 1188{ "Yesterday","Gestern" },
1189{ "Day after tomorrow","Übermorgen" }, 1189{ "Day after tomorrow","Übermorgen" },
1190{ "Tomorrow","Morgen" }, 1190{ "Tomorrow","Morgen" },
1191{ "Day before yesterday","Vorgestern" }, 1191{ "Day before yesterday","Vorgestern" },
1192{ "Size %1","Größe %1" }, 1192{ "Size %1","Größe %1" },
1193{ "New Agendasize: %1","Neue Agendagröße: %1" }, 1193{ "New Agendasize: %1","Neue Agendagröße: %1" },
1194{ " (%1 y.)"," (%1 J.)" }, 1194{ " (%1 y.)"," (%1 J.)" },
1195{ "Allday:","Ganztägig:" }, 1195{ "Allday:","Ganztägig:" },
1196{ "compl.todos","erled.Todos" }, 1196{ "compl.todos","erled.Todos" },
1197{ "","" }, 1197{ "Day view","Tagesansicht" },
1198{ "","" }, 1198{ "Next days","Nächste Tage" },
1199{ "Next week","Nächste Woche" },
1200{ "Next two weeks","Nächste zwei Wochen" },
1201{ "Next month","Nächster Monat" },
1202{ "Journal view","Journal" },
1199{ "","" }, 1203{ "","" },
1200{ "","" }, 1204{ "","" },
1201{ "","" }, 1205{ "","" },
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 035d630..e7b6755 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1,3918 +1,3917 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Requires the Qt and KDE widget libraries, available at no cost at 4 Requires the Qt and KDE widget libraries, available at no cost at
5 http://www.troll.no and http://www.kde.org respectively 5 http://www.troll.no and http://www.kde.org respectively
6 6
7 Copyright (c) 1997, 1998, 1999 7 Copyright (c) 1997, 1998, 1999
8 Preston Brown (preston.brown@yale.edu) 8 Preston Brown (preston.brown@yale.edu)
9 Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl) 9 Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl)
10 Ian Dawes (iadawes@globalserve.net) 10 Ian Dawes (iadawes@globalserve.net)
11 Laszlo Boloni (boloni@cs.purdue.edu) 11 Laszlo Boloni (boloni@cs.purdue.edu)
12 12
13 Copyright (c) 2000, 2001, 2002 13 Copyright (c) 2000, 2001, 2002
14 Cornelius Schumacher <schumacher@kde.org> 14 Cornelius Schumacher <schumacher@kde.org>
15 15
16 This program is free software; you can redistribute it and/or modify 16 This program is free software; you can redistribute it and/or modify
17 it under the terms of the GNU General Public License as published by 17 it under the terms of the GNU General Public License as published by
18 the Free Software Foundation; either version 2 of the License, or 18 the Free Software Foundation; either version 2 of the License, or
19 (at your option) any later version. 19 (at your option) any later version.
20 20
21 This program is distributed in the hope that it will be useful, 21 This program is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of 22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
24 GNU General Public License for more details. 24 GNU General Public License for more details.
25 25
26 You should have received a copy of the GNU General Public License 26 You should have received a copy of the GNU General Public License
27 along with this program; if not, write to the Free Software 27 along with this program; if not, write to the Free Software
28 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 28 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29*/ 29*/
30 30
31#include <stdlib.h> 31#include <stdlib.h>
32 32
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qradiobutton.h> 34#include <qradiobutton.h>
35#include <qbuttongroup.h> 35#include <qbuttongroup.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qclipboard.h> 37#include <qclipboard.h>
38#include <qcursor.h> 38#include <qcursor.h>
39#include <qmessagebox.h> 39#include <qmessagebox.h>
40#include <qprogressbar.h> 40#include <qprogressbar.h>
41#include <qmultilineedit.h> 41#include <qmultilineedit.h>
42#include <qtimer.h> 42#include <qtimer.h>
43#include <qwidgetstack.h> 43#include <qwidgetstack.h>
44#include <qptrlist.h> 44#include <qptrlist.h>
45#include <qregexp.h> 45#include <qregexp.h>
46#include <qgroupbox.h> 46#include <qgroupbox.h>
47#include <qfile.h> 47#include <qfile.h>
48#include <qdir.h> 48#include <qdir.h>
49#ifndef KORG_NOSPLITTER 49#ifndef KORG_NOSPLITTER
50#include <qsplitter.h> 50#include <qsplitter.h>
51#endif 51#endif
52 52
53#include <kglobal.h> 53#include <kglobal.h>
54#include <kdebug.h> 54#include <kdebug.h>
55#include <kstandarddirs.h> 55#include <kstandarddirs.h>
56#include <kfiledialog.h> 56#include <kfiledialog.h>
57#include <kmessagebox.h> 57#include <kmessagebox.h>
58#include <knotifyclient.h> 58#include <knotifyclient.h>
59#include <kconfig.h> 59#include <kconfig.h>
60 60
61#include <libkdepim/ksyncprefsdialog.h> 61#include <libkdepim/ksyncprefsdialog.h>
62#include <krun.h> 62#include <krun.h>
63#include <kdirwatch.h> 63#include <kdirwatch.h>
64#include <libkdepim/kdatepicker.h> 64#include <libkdepim/kdatepicker.h>
65#include <libkdepim/ksyncprofile.h> 65#include <libkdepim/ksyncprofile.h>
66#include <libkdepim/kpimglobalprefs.h> 66#include <libkdepim/kpimglobalprefs.h>
67 67
68#include <libkcal/vcaldrag.h> 68#include <libkcal/vcaldrag.h>
69#include <libkcal/icaldrag.h> 69#include <libkcal/icaldrag.h>
70#include <libkcal/icalformat.h> 70#include <libkcal/icalformat.h>
71#include <libkcal/vcalformat.h> 71#include <libkcal/vcalformat.h>
72#include <libkcal/scheduler.h> 72#include <libkcal/scheduler.h>
73#include <libkcal/calendarlocal.h> 73#include <libkcal/calendarlocal.h>
74#include <libkcal/journal.h> 74#include <libkcal/journal.h>
75#include <libkcal/calfilter.h> 75#include <libkcal/calfilter.h>
76#include <libkcal/attendee.h> 76#include <libkcal/attendee.h>
77#include <libkcal/dndfactory.h> 77#include <libkcal/dndfactory.h>
78#include <libkcal/freebusy.h> 78#include <libkcal/freebusy.h>
79#include <libkcal/filestorage.h> 79#include <libkcal/filestorage.h>
80#include <libkcal/calendarresources.h> 80#include <libkcal/calendarresources.h>
81#include <libkcal/qtopiaformat.h> 81#include <libkcal/qtopiaformat.h>
82#include "../kalarmd/alarmdialog.h" 82#include "../kalarmd/alarmdialog.h"
83 83
84#ifndef DESKTOP_VERSION 84#ifndef DESKTOP_VERSION
85#include <libkcal/sharpformat.h> 85#include <libkcal/sharpformat.h>
86#include <externalapphandler.h> 86#include <externalapphandler.h>
87#endif 87#endif
88#include <libkcal/phoneformat.h> 88#include <libkcal/phoneformat.h>
89#ifndef KORG_NOMAIL 89#ifndef KORG_NOMAIL
90#include "komailclient.h" 90#include "komailclient.h"
91#endif 91#endif
92#ifndef KORG_NOPRINTER 92#ifndef KORG_NOPRINTER
93#include "calprinter.h" 93#include "calprinter.h"
94#endif 94#endif
95#ifndef KORG_NOPLUGINS 95#ifndef KORG_NOPLUGINS
96#include "kocore.h" 96#include "kocore.h"
97#endif 97#endif
98#include "koeventeditor.h" 98#include "koeventeditor.h"
99#include "kotodoeditor.h" 99#include "kotodoeditor.h"
100#include "koprefs.h" 100#include "koprefs.h"
101#include "koeventviewerdialog.h" 101#include "koeventviewerdialog.h"
102#include "publishdialog.h" 102#include "publishdialog.h"
103#include "kofilterview.h" 103#include "kofilterview.h"
104#include "koglobals.h" 104#include "koglobals.h"
105#include "koviewmanager.h" 105#include "koviewmanager.h"
106#include "koagendaview.h" 106#include "koagendaview.h"
107#include "kodialogmanager.h" 107#include "kodialogmanager.h"
108#include "outgoingdialog.h" 108#include "outgoingdialog.h"
109#include "incomingdialog.h" 109#include "incomingdialog.h"
110#include "statusdialog.h" 110#include "statusdialog.h"
111#include "kdatenavigator.h" 111#include "kdatenavigator.h"
112#include "kotodoview.h" 112#include "kotodoview.h"
113#include "datenavigator.h" 113#include "datenavigator.h"
114#include "resourceview.h" 114#include "resourceview.h"
115#include "navigatorbar.h" 115#include "navigatorbar.h"
116#include "searchdialog.h" 116#include "searchdialog.h"
117#include "mainwindow.h" 117#include "mainwindow.h"
118 118
119#include "calendarview.h" 119#include "calendarview.h"
120#ifndef DESKTOP_VERSION 120#ifndef DESKTOP_VERSION
121#include <qtopia/alarmserver.h> 121#include <qtopia/alarmserver.h>
122#endif 122#endif
123#ifndef _WIN32_ 123#ifndef _WIN32_
124#include <stdlib.h> 124#include <stdlib.h>
125#include <stdio.h> 125#include <stdio.h>
126#include <unistd.h> 126#include <unistd.h>
127#else 127#else
128#include <qprocess.h> 128#include <qprocess.h>
129#endif 129#endif
130 130
131#ifdef DESKTOP_VERSION 131#ifdef DESKTOP_VERSION
132#include <kabc/stdaddressbook.h> 132#include <kabc/stdaddressbook.h>
133#endif 133#endif
134using namespace KOrg; 134using namespace KOrg;
135using namespace KCal; 135using namespace KCal;
136extern int globalFlagBlockAgenda; 136extern int globalFlagBlockAgenda;
137extern int globalFlagBlockStartup; 137extern int globalFlagBlockStartup;
138 138
139 139
140 140
141class KOBeamPrefs : public QDialog 141class KOBeamPrefs : public QDialog
142{ 142{
143 public: 143 public:
144 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : 144 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
145 QDialog( parent, name, true ) 145 QDialog( parent, name, true )
146 { 146 {
147 setCaption( i18n("Beam Options") ); 147 setCaption( i18n("Beam Options") );
148 QVBoxLayout* lay = new QVBoxLayout( this ); 148 QVBoxLayout* lay = new QVBoxLayout( this );
149 lay->setSpacing( 3 ); 149 lay->setSpacing( 3 );
150 lay->setMargin( 3 ); 150 lay->setMargin( 3 );
151 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); 151 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
152 lay->addWidget( format ); 152 lay->addWidget( format );
153 format->setExclusive ( true ) ; 153 format->setExclusive ( true ) ;
154 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); 154 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
155 lay->addWidget( time ); time->setExclusive ( true ) ; 155 lay->addWidget( time ); time->setExclusive ( true ) ;
156 vcal = new QRadioButton(" vCalendar ", format ); 156 vcal = new QRadioButton(" vCalendar ", format );
157 ical = new QRadioButton(" iCalendar ", format ); 157 ical = new QRadioButton(" iCalendar ", format );
158 vcal->setChecked( true ); 158 vcal->setChecked( true );
159 tz = new QRadioButton(i18n(" With timezone "), time ); 159 tz = new QRadioButton(i18n(" With timezone "), time );
160 local = new QRadioButton(i18n(" Local time "), time ); 160 local = new QRadioButton(i18n(" Local time "), time );
161 tz->setChecked( true ); 161 tz->setChecked( true );
162 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); 162 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
163 lay->addWidget( ok ); 163 lay->addWidget( ok );
164 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 164 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
165 lay->addWidget( cancel ); 165 lay->addWidget( cancel );
166 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 166 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
167 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 167 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
168 resize( 200, 200 ); 168 resize( 200, 200 );
169 } 169 }
170 170
171 bool beamVcal() { return vcal->isChecked(); } 171 bool beamVcal() { return vcal->isChecked(); }
172 bool beamLocal() { return local->isChecked(); } 172 bool beamLocal() { return local->isChecked(); }
173private: 173private:
174 QRadioButton* vcal, *ical, *local, *tz; 174 QRadioButton* vcal, *ical, *local, *tz;
175}; 175};
176class KOCatPrefs : public QDialog 176class KOCatPrefs : public QDialog
177{ 177{
178 public: 178 public:
179 KOCatPrefs( QWidget *parent=0, const char *name=0 ) : 179 KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
180 QDialog( parent, name, true ) 180 QDialog( parent, name, true )
181 { 181 {
182 setCaption( i18n("Manage new Categories") ); 182 setCaption( i18n("Manage new Categories") );
183 QVBoxLayout* lay = new QVBoxLayout( this ); 183 QVBoxLayout* lay = new QVBoxLayout( this );
184 lay->setSpacing( 3 ); 184 lay->setSpacing( 3 );
185 lay->setMargin( 3 ); 185 lay->setMargin( 3 );
186 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); 186 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
187 lay->addWidget( lab ); 187 lay->addWidget( lab );
188 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 188 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
189 lay->addWidget( format ); 189 lay->addWidget( format );
190 format->setExclusive ( true ) ; 190 format->setExclusive ( true ) ;
191 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 191 addCatBut = new QRadioButton(i18n("Add to category list"), format );
192 new QRadioButton(i18n("Remove from Events/Todos"), format ); 192 new QRadioButton(i18n("Remove from Events/Todos"), format );
193 addCatBut->setChecked( true ); 193 addCatBut->setChecked( true );
194 QPushButton * ok = new QPushButton( i18n("OK"), this ); 194 QPushButton * ok = new QPushButton( i18n("OK"), this );
195 lay->addWidget( ok ); 195 lay->addWidget( ok );
196 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 196 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
197 lay->addWidget( cancel ); 197 lay->addWidget( cancel );
198 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 198 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
199 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 199 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
200 resize( 200, 200 ); 200 resize( 200, 200 );
201 } 201 }
202 202
203 bool addCat() { return addCatBut->isChecked(); } 203 bool addCat() { return addCatBut->isChecked(); }
204private: 204private:
205 QRadioButton* addCatBut; 205 QRadioButton* addCatBut;
206}; 206};
207 207
208 208
209 209
210CalendarView::CalendarView( CalendarResources *calendar, 210CalendarView::CalendarView( CalendarResources *calendar,
211 QWidget *parent, const char *name ) 211 QWidget *parent, const char *name )
212 : CalendarViewBase( parent, name ), 212 : CalendarViewBase( parent, name ),
213 mCalendar( calendar ), 213 mCalendar( calendar ),
214 mResourceManager( calendar->resourceManager() ) 214 mResourceManager( calendar->resourceManager() )
215{ 215{
216 216
217 mEventEditor = 0; 217 mEventEditor = 0;
218 mTodoEditor = 0; 218 mTodoEditor = 0;
219 219
220 init(); 220 init();
221} 221}
222 222
223CalendarView::CalendarView( Calendar *calendar, 223CalendarView::CalendarView( Calendar *calendar,
224 QWidget *parent, const char *name ) 224 QWidget *parent, const char *name )
225 : CalendarViewBase( parent, name ), 225 : CalendarViewBase( parent, name ),
226 mCalendar( calendar ), 226 mCalendar( calendar ),
227 mResourceManager( 0 ) 227 mResourceManager( 0 )
228{ 228{
229 229
230 mEventEditor = 0; 230 mEventEditor = 0;
231 mTodoEditor = 0; 231 mTodoEditor = 0;
232 init();} 232 init();}
233 233
234void CalendarView::init() 234void CalendarView::init()
235{ 235{
236 mBlockShowDates = false; 236 mBlockShowDates = false;
237 beamDialog = new KOBeamPrefs(); 237 beamDialog = new KOBeamPrefs();
238 mDatePickerMode = 0; 238 mDatePickerMode = 0;
239 mCurrentSyncDevice = ""; 239 mCurrentSyncDevice = "";
240 writeLocale(); 240 writeLocale();
241 mViewManager = new KOViewManager( this ); 241 mViewManager = new KOViewManager( this );
242 mDialogManager = new KODialogManager( this ); 242 mDialogManager = new KODialogManager( this );
243 mEventViewerDialog = 0; 243 mEventViewerDialog = 0;
244 mModified = false; 244 mModified = false;
245 mReadOnly = false; 245 mReadOnly = false;
246 mSelectedIncidence = 0; 246 mSelectedIncidence = 0;
247 mCalPrinter = 0; 247 mCalPrinter = 0;
248 mFilters.setAutoDelete(true); 248 mFilters.setAutoDelete(true);
249 249
250 mCalendar->registerObserver( this ); 250 mCalendar->registerObserver( this );
251 // TODO: Make sure that view is updated, when calendar is changed. 251 // TODO: Make sure that view is updated, when calendar is changed.
252 252
253 mStorage = new FileStorage( mCalendar ); 253 mStorage = new FileStorage( mCalendar );
254 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 254 mNavigator = new DateNavigator( this, "datevav", mViewManager );
255 255
256 QBoxLayout *topLayout = (QBoxLayout*)layout(); 256 QBoxLayout *topLayout = (QBoxLayout*)layout();
257#ifndef KORG_NOSPLITTER 257#ifndef KORG_NOSPLITTER
258 // create the main layout frames. 258 // create the main layout frames.
259 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 259 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
260 topLayout->addWidget(mPanner); 260 topLayout->addWidget(mPanner);
261 261
262 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 262 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
263 "CalendarView::LeftFrame"); 263 "CalendarView::LeftFrame");
264 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 264 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
265 265
266 mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, 266 mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE,
267 "CalendarView::DateNavigator", QDate::currentDate() ); 267 "CalendarView::DateNavigator", QDate::currentDate() );
268 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 268 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
269 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 269 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
270 mTodoList->setNavigator( mNavigator ); 270 mTodoList->setNavigator( mNavigator );
271 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 271 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
272 272
273#ifdef KORG_NORESOURCEVIEW 273#ifdef KORG_NORESOURCEVIEW
274 mResourceView = 0; 274 mResourceView = 0;
275#else 275#else
276 if ( mResourceManager ) { 276 if ( mResourceManager ) {
277 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 277 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
278 mResourceView->updateView(); 278 mResourceView->updateView();
279 connect( mResourceView, SIGNAL( resourcesChanged() ), 279 connect( mResourceView, SIGNAL( resourcesChanged() ),
280 SLOT( updateView() ) ); 280 SLOT( updateView() ) );
281 } else { 281 } else {
282 mResourceView = 0; 282 mResourceView = 0;
283 } 283 }
284#endif 284#endif
285 QWidget *rightBox = new QWidget( mPanner ); 285 QWidget *rightBox = new QWidget( mPanner );
286 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 286 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
287 287
288 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); 288 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" );
289 rightLayout->addWidget( mNavigatorBar ); 289 rightLayout->addWidget( mNavigatorBar );
290 290
291 mRightFrame = new QWidgetStack( rightBox ); 291 mRightFrame = new QWidgetStack( rightBox );
292 rightLayout->addWidget( mRightFrame, 1 ); 292 rightLayout->addWidget( mRightFrame, 1 );
293 293
294 mLeftFrame = mLeftSplitter; 294 mLeftFrame = mLeftSplitter;
295#else 295#else
296 QWidget *mainBox = new QWidget( this ); 296 QWidget *mainBox = new QWidget( this );
297 QWidget *leftFrame = new QWidget( mainBox ); 297 QWidget *leftFrame = new QWidget( mainBox );
298 298
299 QBoxLayout * mainBoxLayout; 299 QBoxLayout * mainBoxLayout;
300 QBoxLayout * leftFrameLayout; 300 QBoxLayout * leftFrameLayout;
301 if ( KOPrefs::instance()->mVerticalScreen ) { 301 if ( KOPrefs::instance()->mVerticalScreen ) {
302 mainBoxLayout = new QVBoxLayout(mainBox); 302 mainBoxLayout = new QVBoxLayout(mainBox);
303 leftFrameLayout = new QHBoxLayout(leftFrame ); 303 leftFrameLayout = new QHBoxLayout(leftFrame );
304 } else { 304 } else {
305 mainBoxLayout = new QHBoxLayout(mainBox); 305 mainBoxLayout = new QHBoxLayout(mainBox);
306 leftFrameLayout = new QVBoxLayout(leftFrame ); 306 leftFrameLayout = new QVBoxLayout(leftFrame );
307 } 307 }
308 topLayout->addWidget( mainBox ); 308 topLayout->addWidget( mainBox );
309 mainBoxLayout->addWidget (leftFrame); 309 mainBoxLayout->addWidget (leftFrame);
310 mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, 310 mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE,
311 "CalendarView::DateNavigator", QDate::currentDate()); 311 "CalendarView::DateNavigator", QDate::currentDate());
312 // mDateNavigator->blockSignals( true ); 312 // mDateNavigator->blockSignals( true );
313 leftFrameLayout->addWidget( mDateNavigator ); 313 leftFrameLayout->addWidget( mDateNavigator );
314 mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); 314 mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView");
315 mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); 315 mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall");
316 mTodoList->setNavigator( mNavigator ); 316 mTodoList->setNavigator( mNavigator );
317 317
318 if ( QApplication::desktop()->width() < 480 ) { 318 if ( QApplication::desktop()->width() < 480 ) {
319 leftFrameLayout->addWidget(mFilterView); 319 leftFrameLayout->addWidget(mFilterView);
320 leftFrameLayout->addWidget(mTodoList, 2 ); 320 leftFrameLayout->addWidget(mTodoList, 2 );
321 321
322 } else { 322 } else {
323 leftFrameLayout->addWidget(mTodoList,2 ); 323 leftFrameLayout->addWidget(mTodoList,2 );
324 leftFrameLayout->addWidget(mFilterView ); 324 leftFrameLayout->addWidget(mFilterView );
325 } 325 }
326 mFilterView->hide(); 326 mFilterView->hide();
327 QWidget *rightBox = new QWidget( mainBox ); 327 QWidget *rightBox = new QWidget( mainBox );
328 mainBoxLayout->addWidget ( rightBox, 10 ); 328 mainBoxLayout->addWidget ( rightBox, 10 );
329 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 329 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
330 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); 330 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" );
331 mRightFrame = new QWidgetStack( rightBox ); 331 mRightFrame = new QWidgetStack( rightBox );
332 rightLayout->addWidget( mNavigatorBar ); 332 rightLayout->addWidget( mNavigatorBar );
333 rightLayout->addWidget( mRightFrame, 10 ); 333 rightLayout->addWidget( mRightFrame, 10 );
334 334
335 mLeftFrame = leftFrame; 335 mLeftFrame = leftFrame;
336 if ( KOPrefs::instance()->mVerticalScreen ) { 336 if ( KOPrefs::instance()->mVerticalScreen ) {
337 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 337 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
338 leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 338 leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
339 } else { 339 } else {
340 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 340 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
341 leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 341 leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
342 } 342 }
343 if ( !KOPrefs::instance()->mShowDateNavigator) 343 if ( !KOPrefs::instance()->mShowDateNavigator)
344 mDateNavigator->hide(); 344 mDateNavigator->hide();
345 //qDebug("Calendarview Size %d %d ", width(), height()); 345 //qDebug("Calendarview Size %d %d ", width(), height());
346#endif 346#endif
347 347
348 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 348 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
349 SLOT( showDates( const KCal::DateList & ) ) ); 349 SLOT( showDates( const KCal::DateList & ) ) );
350 350
351 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 351 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
352 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 352 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
353 connect( mNavigatorBar, SIGNAL( goPrevYear() ), 353 connect( mNavigatorBar, SIGNAL( goPrevYear() ),
354 mNavigator, SLOT( selectPreviousYear() ) ); 354 mNavigator, SLOT( selectPreviousYear() ) );
355 connect( mNavigatorBar, SIGNAL( goNextYear() ), 355 connect( mNavigatorBar, SIGNAL( goNextYear() ),
356 mNavigator, SLOT( selectNextYear() ) ); 356 mNavigator, SLOT( selectNextYear() ) );
357 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), 357 connect( mNavigatorBar, SIGNAL( goPrevMonth() ),
358 mNavigator, SLOT( selectPreviousMonth() ) ); 358 mNavigator, SLOT( selectPreviousMonth() ) );
359 connect( mNavigatorBar, SIGNAL( goNextMonth() ), 359 connect( mNavigatorBar, SIGNAL( goNextMonth() ),
360 mNavigator, SLOT( selectNextMonth() ) ); 360 mNavigator, SLOT( selectNextMonth() ) );
361 361
362 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 362 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
363 mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); 363 mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) );
364 364
365 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 365 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
366 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 366 mNavigator, SLOT( selectWeek( const QDate & ) ) );
367 367
368 connect( mDateNavigator, SIGNAL( goPrevYear() ), 368 connect( mDateNavigator, SIGNAL( goPrevYear() ),
369 mNavigator, SLOT( selectPreviousYear() ) ); 369 mNavigator, SLOT( selectPreviousYear() ) );
370 connect( mDateNavigator, SIGNAL( goNextYear() ), 370 connect( mDateNavigator, SIGNAL( goNextYear() ),
371 mNavigator, SLOT( selectNextYear() ) ); 371 mNavigator, SLOT( selectNextYear() ) );
372 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 372 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
373 mNavigator, SLOT( selectPreviousMonth() ) ); 373 mNavigator, SLOT( selectPreviousMonth() ) );
374 connect( mDateNavigator, SIGNAL( goNextMonth() ), 374 connect( mDateNavigator, SIGNAL( goNextMonth() ),
375 mNavigator, SLOT( selectNextMonth() ) ); 375 mNavigator, SLOT( selectNextMonth() ) );
376 376
377 connect( mDateNavigator, SIGNAL( goPrevious() ), 377 connect( mDateNavigator, SIGNAL( goPrevious() ),
378 mNavigator, SLOT( selectPrevious() ) ); 378 mNavigator, SLOT( selectPrevious() ) );
379 connect( mDateNavigator, SIGNAL( goNext() ), 379 connect( mDateNavigator, SIGNAL( goNext() ),
380 mNavigator, SLOT( selectNext() ) ); 380 mNavigator, SLOT( selectNext() ) );
381 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 381 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
382 mNavigator, SLOT( slotMonthSelect( int ) ) ); 382 mNavigator, SLOT( slotMonthSelect( int ) ) );
383 connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), 383 connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ),
384 mNavigator, SLOT( slotMonthSelect( int ) ) ); 384 mNavigator, SLOT( slotMonthSelect( int ) ) );
385 385
386 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 386 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
387 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 387 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
388 388
389 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), 389 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ),
390 SLOT( eventAdded( Event *) ) ); 390 SLOT( eventAdded( Event *) ) );
391 391
392 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 392 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
393 393
394 connect( this, SIGNAL( configChanged() ), 394 connect( this, SIGNAL( configChanged() ),
395 mDateNavigator, SLOT( updateConfig() ) ); 395 mDateNavigator, SLOT( updateConfig() ) );
396 396
397 connect( mTodoList, SIGNAL( newTodoSignal() ), 397 connect( mTodoList, SIGNAL( newTodoSignal() ),
398 SLOT( newTodo() ) ); 398 SLOT( newTodo() ) );
399 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 399 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
400 SLOT( newSubTodo( Todo * ) ) ); 400 SLOT( newSubTodo( Todo * ) ) );
401 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 401 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
402 SLOT( editTodo( Todo * ) ) ); 402 SLOT( editTodo( Todo * ) ) );
403 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 403 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
404 SLOT( showTodo( Todo *) ) ); 404 SLOT( showTodo( Todo *) ) );
405 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 405 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
406 SLOT( deleteTodo( Todo *) ) ); 406 SLOT( deleteTodo( Todo *) ) );
407 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 407 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
408 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 408 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
409 SLOT( purgeCompleted() ) ); 409 SLOT( purgeCompleted() ) );
410 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 410 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
411 SIGNAL( todoModified( Todo *, int ) ) ); 411 SIGNAL( todoModified( Todo *, int ) ) );
412 412
413 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 413 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
414 this, SLOT ( cloneIncidence( Incidence * ) ) ); 414 this, SLOT ( cloneIncidence( Incidence * ) ) );
415 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 415 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
416 this, SLOT (cancelIncidence( Incidence * ) ) ); 416 this, SLOT (cancelIncidence( Incidence * ) ) );
417 417
418 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 418 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
419 this, SLOT ( moveIncidence( Incidence * ) ) ); 419 this, SLOT ( moveIncidence( Incidence * ) ) );
420 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 420 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
421 this, SLOT ( beamIncidence( Incidence * ) ) ); 421 this, SLOT ( beamIncidence( Incidence * ) ) );
422 422
423 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 423 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
424 this, SLOT ( todo_unsub( Todo * ) ) ); 424 this, SLOT ( todo_unsub( Todo * ) ) );
425 425
426 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 426 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
427 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 427 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
428 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 428 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
429 SLOT( updateTodo( Todo *, int ) ) ); 429 SLOT( updateTodo( Todo *, int ) ) );
430 connect( this, SIGNAL( todoModified( Todo *, int )), this, 430 connect( this, SIGNAL( todoModified( Todo *, int )), this,
431 SLOT( changeTodoDisplay( Todo *, int ) ) ); 431 SLOT( changeTodoDisplay( Todo *, int ) ) );
432 432
433 433
434 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 434 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
435 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 435 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
436 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 436 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
437 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 437 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
438 438
439 439
440 440
441 441
442 442
443 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 443 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
444 SLOT(checkClipboard())); 444 SLOT(checkClipboard()));
445 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 445 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
446 SLOT( processTodoListSelection( Incidence * ) ) ); 446 SLOT( processTodoListSelection( Incidence * ) ) );
447 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 447 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
448 448
449 // kdDebug() << "CalendarView::CalendarView() done" << endl; 449 // kdDebug() << "CalendarView::CalendarView() done" << endl;
450 450
451 mDateFrame = new QVBox(0,0,WType_Popup); 451 mDateFrame = new QVBox(0,0,WType_Popup);
452 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 452 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
453 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 453 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
454 mDateFrame->setLineWidth(3); 454 mDateFrame->setLineWidth(3);
455 mDateFrame->hide(); 455 mDateFrame->hide();
456 mDateFrame->setCaption( i18n( "Pick a date to display")); 456 mDateFrame->setCaption( i18n( "Pick a date to display"));
457 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 457 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
458 458
459 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 459 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
460 460
461 mEventEditor = mDialogManager->getEventEditor(); 461 mEventEditor = mDialogManager->getEventEditor();
462 mTodoEditor = mDialogManager->getTodoEditor(); 462 mTodoEditor = mDialogManager->getTodoEditor();
463 463
464 mFlagEditDescription = false; 464 mFlagEditDescription = false;
465 465
466 mSuspendTimer = new QTimer( this ); 466 mSuspendTimer = new QTimer( this );
467 mAlarmTimer = new QTimer( this ); 467 mAlarmTimer = new QTimer( this );
468 mRecheckAlarmTimer = new QTimer( this ); 468 mRecheckAlarmTimer = new QTimer( this );
469 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 469 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
470 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 470 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
471 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 471 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
472 mAlarmDialog = new AlarmDialog( this ); 472 mAlarmDialog = new AlarmDialog( this );
473 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 473 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
474 mAlarmDialog->setServerNotification( false ); 474 mAlarmDialog->setServerNotification( false );
475 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 475 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
476 476
477 477
478#ifndef DESKTOP_VERSION 478#ifndef DESKTOP_VERSION
479//US listen for arriving address resultsets 479//US listen for arriving address resultsets
480 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 480 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
481 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 481 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
482#endif 482#endif
483 483
484} 484}
485 485
486 486
487CalendarView::~CalendarView() 487CalendarView::~CalendarView()
488{ 488{
489 // kdDebug() << "~CalendarView()" << endl; 489 // kdDebug() << "~CalendarView()" << endl;
490 //qDebug("CalendarView::~CalendarView() "); 490 //qDebug("CalendarView::~CalendarView() ");
491 delete mDialogManager; 491 delete mDialogManager;
492 delete mViewManager; 492 delete mViewManager;
493 delete mStorage; 493 delete mStorage;
494 delete mDateFrame ; 494 delete mDateFrame ;
495 delete beamDialog; 495 delete beamDialog;
496 //kdDebug() << "~CalendarView() done" << endl; 496 //kdDebug() << "~CalendarView() done" << endl;
497} 497}
498 498
499void CalendarView::showDay( QDate d ) 499void CalendarView::showDay( QDate d )
500{ 500{
501 dateNavigator()->blockSignals( true ); 501 dateNavigator()->blockSignals( true );
502 dateNavigator()->selectDate( d ); 502 dateNavigator()->selectDate( d );
503 dateNavigator()->blockSignals( false ); 503 dateNavigator()->blockSignals( false );
504 mViewManager->showDayView(); 504 mViewManager->showDayView();
505 //dateNavigator()->selectDate( d ); 505 //dateNavigator()->selectDate( d );
506} 506}
507void CalendarView::timerAlarm() 507void CalendarView::timerAlarm()
508{ 508{
509 //qDebug("CalendarView::timerAlarm() "); 509 //qDebug("CalendarView::timerAlarm() ");
510 computeAlarm(mAlarmNotification ); 510 computeAlarm(mAlarmNotification );
511} 511}
512 512
513void CalendarView::suspendAlarm() 513void CalendarView::suspendAlarm()
514{ 514{
515 //qDebug(" CalendarView::suspendAlarm() "); 515 //qDebug(" CalendarView::suspendAlarm() ");
516 computeAlarm(mSuspendAlarmNotification ); 516 computeAlarm(mSuspendAlarmNotification );
517 517
518} 518}
519 519
520void CalendarView::startAlarm( QString mess , QString filename) 520void CalendarView::startAlarm( QString mess , QString filename)
521{ 521{
522 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 522 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
523 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 523 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
524 524
525} 525}
526 526
527void CalendarView::checkNextTimerAlarm() 527void CalendarView::checkNextTimerAlarm()
528{ 528{
529 mCalendar->checkAlarmForIncidence( 0, true ); 529 mCalendar->checkAlarmForIncidence( 0, true );
530} 530}
531 531
532void CalendarView::computeAlarm( QString msg ) 532void CalendarView::computeAlarm( QString msg )
533{ 533{
534 534
535 QString mess = msg; 535 QString mess = msg;
536 QString mAlarmMessage = mess.mid( 9 ); 536 QString mAlarmMessage = mess.mid( 9 );
537 QString filename = MainWindow::resourcePath(); 537 QString filename = MainWindow::resourcePath();
538 filename += "koalarm.wav"; 538 filename += "koalarm.wav";
539 QString tempfilename; 539 QString tempfilename;
540 if ( mess.left( 13 ) == "suspend_alarm") { 540 if ( mess.left( 13 ) == "suspend_alarm") {
541 bool error = false; 541 bool error = false;
542 int len = mess.mid( 13 ).find("+++"); 542 int len = mess.mid( 13 ).find("+++");
543 if ( len < 2 ) 543 if ( len < 2 )
544 error = true; 544 error = true;
545 else { 545 else {
546 tempfilename = mess.mid( 13, len ); 546 tempfilename = mess.mid( 13, len );
547 if ( !QFile::exists( tempfilename ) ) 547 if ( !QFile::exists( tempfilename ) )
548 error = true; 548 error = true;
549 } 549 }
550 if ( ! error ) { 550 if ( ! error ) {
551 filename = tempfilename; 551 filename = tempfilename;
552 } 552 }
553 mAlarmMessage = mess.mid( 13+len+3 ); 553 mAlarmMessage = mess.mid( 13+len+3 );
554 //qDebug("suspend file %s ",tempfilename.latin1() ); 554 //qDebug("suspend file %s ",tempfilename.latin1() );
555 startAlarm( mAlarmMessage, filename); 555 startAlarm( mAlarmMessage, filename);
556 return; 556 return;
557 } 557 }
558 if ( mess.left( 11 ) == "timer_alarm") { 558 if ( mess.left( 11 ) == "timer_alarm") {
559 //mTimerTime = 0; 559 //mTimerTime = 0;
560 startAlarm( mess.mid( 11 ), filename ); 560 startAlarm( mess.mid( 11 ), filename );
561 return; 561 return;
562 } 562 }
563 if ( mess.left( 10 ) == "proc_alarm") { 563 if ( mess.left( 10 ) == "proc_alarm") {
564 bool error = false; 564 bool error = false;
565 int len = mess.mid( 10 ).find("+++"); 565 int len = mess.mid( 10 ).find("+++");
566 if ( len < 2 ) 566 if ( len < 2 )
567 error = true; 567 error = true;
568 else { 568 else {
569 tempfilename = mess.mid( 10, len ); 569 tempfilename = mess.mid( 10, len );
570 if ( !QFile::exists( tempfilename ) ) 570 if ( !QFile::exists( tempfilename ) )
571 error = true; 571 error = true;
572 } 572 }
573 if ( error ) { 573 if ( error ) {
574 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 574 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
575 mAlarmMessage += mess.mid( 10+len+3+9 ); 575 mAlarmMessage += mess.mid( 10+len+3+9 );
576 } else { 576 } else {
577 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 577 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
578 //qDebug("-----system command %s ",tempfilename.latin1() ); 578 //qDebug("-----system command %s ",tempfilename.latin1() );
579#ifndef _WIN32_ 579#ifndef _WIN32_
580 if ( vfork () == 0 ) { 580 if ( vfork () == 0 ) {
581 execl ( tempfilename.latin1(), 0 ); 581 execl ( tempfilename.latin1(), 0 );
582 return; 582 return;
583 } 583 }
584#else 584#else
585 QProcess* p = new QProcess(); 585 QProcess* p = new QProcess();
586 p->addArgument( tempfilename.latin1() ); 586 p->addArgument( tempfilename.latin1() );
587 p->start(); 587 p->start();
588 return; 588 return;
589#endif 589#endif
590 590
591 return; 591 return;
592 } 592 }
593 593
594 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 594 //qDebug("+++++++system command %s ",tempfilename.latin1() );
595 } 595 }
596 if ( mess.left( 11 ) == "audio_alarm") { 596 if ( mess.left( 11 ) == "audio_alarm") {
597 bool error = false; 597 bool error = false;
598 int len = mess.mid( 11 ).find("+++"); 598 int len = mess.mid( 11 ).find("+++");
599 if ( len < 2 ) 599 if ( len < 2 )
600 error = true; 600 error = true;
601 else { 601 else {
602 tempfilename = mess.mid( 11, len ); 602 tempfilename = mess.mid( 11, len );
603 if ( !QFile::exists( tempfilename ) ) 603 if ( !QFile::exists( tempfilename ) )
604 error = true; 604 error = true;
605 } 605 }
606 if ( ! error ) { 606 if ( ! error ) {
607 filename = tempfilename; 607 filename = tempfilename;
608 } 608 }
609 mAlarmMessage = mess.mid( 11+len+3+9 ); 609 mAlarmMessage = mess.mid( 11+len+3+9 );
610 //qDebug("audio file command %s ",tempfilename.latin1() ); 610 //qDebug("audio file command %s ",tempfilename.latin1() );
611 } 611 }
612 if ( mess.left( 9 ) == "cal_alarm") { 612 if ( mess.left( 9 ) == "cal_alarm") {
613 mAlarmMessage = mess.mid( 9 ) ; 613 mAlarmMessage = mess.mid( 9 ) ;
614 } 614 }
615 615
616 startAlarm( mAlarmMessage, filename ); 616 startAlarm( mAlarmMessage, filename );
617 617
618 618
619} 619}
620 620
621void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti ) 621void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
622{ 622{
623 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 623 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
624 624
625 mSuspendAlarmNotification = noti; 625 mSuspendAlarmNotification = noti;
626 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 626 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
627 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 627 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
628 mSuspendTimer->start( ms , true ); 628 mSuspendTimer->start( ms , true );
629 629
630} 630}
631 631
632void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 632void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
633{ 633{
634 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 634 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
635 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 635 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
636#ifndef DESKTOP_VERSION 636#ifndef DESKTOP_VERSION
637 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); 637 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() );
638#endif 638#endif
639 return; 639 return;
640 } 640 }
641 int maxSec; 641 int maxSec;
642 //maxSec = 5; //testing only 642 //maxSec = 5; //testing only
643 maxSec = 86400+3600; // one day+1hour 643 maxSec = 86400+3600; // one day+1hour
644 mAlarmNotification = noti; 644 mAlarmNotification = noti;
645 int sec = QDateTime::currentDateTime().secsTo( qdt ); 645 int sec = QDateTime::currentDateTime().secsTo( qdt );
646 if ( sec > maxSec ) { 646 if ( sec > maxSec ) {
647 mRecheckAlarmTimer->start( maxSec * 1000 ); 647 mRecheckAlarmTimer->start( maxSec * 1000 );
648 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 648 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
649 return; 649 return;
650 } else { 650 } else {
651 mRecheckAlarmTimer->stop(); 651 mRecheckAlarmTimer->stop();
652 } 652 }
653 //qDebug("Alarm timer started with secs: %d ", sec); 653 //qDebug("Alarm timer started with secs: %d ", sec);
654 mAlarmTimer->start( sec *1000 , true ); 654 mAlarmTimer->start( sec *1000 , true );
655 655
656} 656}
657// called by mRecheckAlarmTimer to get next alarm 657// called by mRecheckAlarmTimer to get next alarm
658// we need this, because a QTimer has only a max range of 25 days 658// we need this, because a QTimer has only a max range of 25 days
659void CalendarView::recheckTimerAlarm() 659void CalendarView::recheckTimerAlarm()
660{ 660{
661 mAlarmTimer->stop(); 661 mAlarmTimer->stop();
662 mRecheckAlarmTimer->stop(); 662 mRecheckAlarmTimer->stop();
663 mCalendar->checkAlarmForIncidence( 0, true ); 663 mCalendar->checkAlarmForIncidence( 0, true );
664} 664}
665void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti ) 665void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
666{ 666{
667 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 667 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
668 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 668 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
669#ifndef DESKTOP_VERSION 669#ifndef DESKTOP_VERSION
670 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); 670 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() );
671#endif 671#endif
672 return; 672 return;
673 } 673 }
674 mAlarmTimer->stop(); 674 mAlarmTimer->stop();
675} 675}
676void CalendarView::selectWeekNum ( int num ) 676void CalendarView::selectWeekNum ( int num )
677{ 677{
678 dateNavigator()->blockSignals( true ); 678 dateNavigator()->blockSignals( true );
679 dateNavigator()->selectWeek( num ); 679 dateNavigator()->selectWeek( num );
680 dateNavigator()->blockSignals( false ); 680 dateNavigator()->blockSignals( false );
681 mViewManager->showWeekView(); 681 mViewManager->showWeekView();
682} 682}
683KOViewManager *CalendarView::viewManager() 683KOViewManager *CalendarView::viewManager()
684{ 684{
685 return mViewManager; 685 return mViewManager;
686} 686}
687 687
688KODialogManager *CalendarView::dialogManager() 688KODialogManager *CalendarView::dialogManager()
689{ 689{
690 return mDialogManager; 690 return mDialogManager;
691} 691}
692 692
693QDate CalendarView::startDate() 693QDate CalendarView::startDate()
694{ 694{
695 DateList dates = mNavigator->selectedDates(); 695 DateList dates = mNavigator->selectedDates();
696 696
697 return dates.first(); 697 return dates.first();
698} 698}
699 699
700QDate CalendarView::endDate() 700QDate CalendarView::endDate()
701{ 701{
702 DateList dates = mNavigator->selectedDates(); 702 DateList dates = mNavigator->selectedDates();
703 703
704 return dates.last(); 704 return dates.last();
705} 705}
706 706
707 707
708void CalendarView::createPrinter() 708void CalendarView::createPrinter()
709{ 709{
710#ifndef KORG_NOPRINTER 710#ifndef KORG_NOPRINTER
711 if (!mCalPrinter) { 711 if (!mCalPrinter) {
712 mCalPrinter = new CalPrinter(this, mCalendar); 712 mCalPrinter = new CalPrinter(this, mCalendar);
713 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); 713 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig()));
714 } 714 }
715#endif 715#endif
716} 716}
717 717
718 718
719//KOPrefs::instance()->mWriteBackFile 719//KOPrefs::instance()->mWriteBackFile
720//KOPrefs::instance()->mWriteBackExistingOnly 720//KOPrefs::instance()->mWriteBackExistingOnly
721 721
722// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 722// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
723// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 723// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
724// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 724// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
725// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 725// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
726// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 726// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
727// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 727// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
728 728
729int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) 729int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full )
730{ 730{
731 731
732 // 0 equal 732 // 0 equal
733 // 1 take local 733 // 1 take local
734 // 2 take remote 734 // 2 take remote
735 // 3 cancel 735 // 3 cancel
736 QDateTime lastSync = mLastCalendarSync; 736 QDateTime lastSync = mLastCalendarSync;
737 QDateTime localMod = local->lastModified(); 737 QDateTime localMod = local->lastModified();
738 QDateTime remoteMod = remote->lastModified(); 738 QDateTime remoteMod = remote->lastModified();
739 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 739 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
740 bool remCh, locCh; 740 bool remCh, locCh;
741 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 741 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
742 //if ( remCh ) 742 //if ( remCh )
743 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 743 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
744 locCh = ( localMod > mLastCalendarSync ); 744 locCh = ( localMod > mLastCalendarSync );
745 if ( !remCh && ! locCh ) { 745 if ( !remCh && ! locCh ) {
746 //qDebug("both not changed "); 746 //qDebug("both not changed ");
747 lastSync = localMod.addDays(1); 747 lastSync = localMod.addDays(1);
748 if ( mode <= SYNC_PREF_ASK ) 748 if ( mode <= SYNC_PREF_ASK )
749 return 0; 749 return 0;
750 } else { 750 } else {
751 if ( locCh ) { 751 if ( locCh ) {
752 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); 752 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1());
753 lastSync = localMod.addDays( -1 ); 753 lastSync = localMod.addDays( -1 );
754 if ( !remCh ) 754 if ( !remCh )
755 remoteMod = ( lastSync.addDays( -1 ) ); 755 remoteMod = ( lastSync.addDays( -1 ) );
756 } else { 756 } else {
757 //qDebug(" not loc changed "); 757 //qDebug(" not loc changed ");
758 lastSync = localMod.addDays( 1 ); 758 lastSync = localMod.addDays( 1 );
759 if ( remCh ) 759 if ( remCh )
760 remoteMod =( lastSync.addDays( 1 ) ); 760 remoteMod =( lastSync.addDays( 1 ) );
761 761
762 } 762 }
763 } 763 }
764 full = true; 764 full = true;
765 if ( mode < SYNC_PREF_ASK ) 765 if ( mode < SYNC_PREF_ASK )
766 mode = SYNC_PREF_ASK; 766 mode = SYNC_PREF_ASK;
767 } else { 767 } else {
768 if ( localMod == remoteMod ) 768 if ( localMod == remoteMod )
769 // if ( local->revision() == remote->revision() ) 769 // if ( local->revision() == remote->revision() )
770 return 0; 770 return 0;
771 771
772 } 772 }
773 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 773 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
774 774
775 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); 775 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision());
776 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); 776 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() );
777 //full = true; //debug only 777 //full = true; //debug only
778 if ( full ) { 778 if ( full ) {
779 bool equ = false; 779 bool equ = false;
780 if ( local->type() == "Event" ) { 780 if ( local->type() == "Event" ) {
781 equ = (*((Event*) local) == *((Event*) remote)); 781 equ = (*((Event*) local) == *((Event*) remote));
782 } 782 }
783 else if ( local->type() =="Todo" ) 783 else if ( local->type() =="Todo" )
784 equ = (*((Todo*) local) == (*(Todo*) remote)); 784 equ = (*((Todo*) local) == (*(Todo*) remote));
785 else if ( local->type() =="Journal" ) 785 else if ( local->type() =="Journal" )
786 equ = (*((Journal*) local) == *((Journal*) remote)); 786 equ = (*((Journal*) local) == *((Journal*) remote));
787 if ( equ ) { 787 if ( equ ) {
788 //qDebug("equal "); 788 //qDebug("equal ");
789 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 789 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
790 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 790 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
791 } 791 }
792 if ( mode < SYNC_PREF_FORCE_LOCAL ) 792 if ( mode < SYNC_PREF_FORCE_LOCAL )
793 return 0; 793 return 0;
794 794
795 }//else //debug only 795 }//else //debug only
796 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 796 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
797 } 797 }
798 int result; 798 int result;
799 bool localIsNew; 799 bool localIsNew;
800 //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() ); 800 //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() );
801 801
802 if ( full && mode < SYNC_PREF_NEWEST ) 802 if ( full && mode < SYNC_PREF_NEWEST )
803 mode = SYNC_PREF_ASK; 803 mode = SYNC_PREF_ASK;
804 804
805 switch( mode ) { 805 switch( mode ) {
806 case SYNC_PREF_LOCAL: 806 case SYNC_PREF_LOCAL:
807 if ( lastSync > remoteMod ) 807 if ( lastSync > remoteMod )
808 return 1; 808 return 1;
809 if ( lastSync > localMod ) 809 if ( lastSync > localMod )
810 return 2; 810 return 2;
811 return 1; 811 return 1;
812 break; 812 break;
813 case SYNC_PREF_REMOTE: 813 case SYNC_PREF_REMOTE:
814 if ( lastSync > remoteMod ) 814 if ( lastSync > remoteMod )
815 return 1; 815 return 1;
816 if ( lastSync > localMod ) 816 if ( lastSync > localMod )
817 return 2; 817 return 2;
818 return 2; 818 return 2;
819 break; 819 break;
820 case SYNC_PREF_NEWEST: 820 case SYNC_PREF_NEWEST:
821 if ( localMod > remoteMod ) 821 if ( localMod > remoteMod )
822 return 1; 822 return 1;
823 else 823 else
824 return 2; 824 return 2;
825 break; 825 break;
826 case SYNC_PREF_ASK: 826 case SYNC_PREF_ASK:
827 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 827 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
828 if ( lastSync > remoteMod ) 828 if ( lastSync > remoteMod )
829 return 1; 829 return 1;
830 if ( lastSync > localMod ) 830 if ( lastSync > localMod )
831 return 2; 831 return 2;
832 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 832 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
833 localIsNew = localMod >= remoteMod; 833 localIsNew = localMod >= remoteMod;
834 if ( localIsNew ) 834 if ( localIsNew )
835 getEventViewerDialog()->setColorMode( 1 ); 835 getEventViewerDialog()->setColorMode( 1 );
836 else 836 else
837 getEventViewerDialog()->setColorMode( 2 ); 837 getEventViewerDialog()->setColorMode( 2 );
838 getEventViewerDialog()->setIncidence(local); 838 getEventViewerDialog()->setIncidence(local);
839 if ( localIsNew ) 839 if ( localIsNew )
840 getEventViewerDialog()->setColorMode( 2 ); 840 getEventViewerDialog()->setColorMode( 2 );
841 else 841 else
842 getEventViewerDialog()->setColorMode( 1 ); 842 getEventViewerDialog()->setColorMode( 1 );
843 getEventViewerDialog()->addIncidence(remote); 843 getEventViewerDialog()->addIncidence(remote);
844 getEventViewerDialog()->setColorMode( 0 ); 844 getEventViewerDialog()->setColorMode( 0 );
845 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); 845 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() );
846 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); 846 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!"));
847 getEventViewerDialog()->showMe(); 847 getEventViewerDialog()->showMe();
848 result = getEventViewerDialog()->executeS( localIsNew ); 848 result = getEventViewerDialog()->executeS( localIsNew );
849 return result; 849 return result;
850 850
851 break; 851 break;
852 case SYNC_PREF_FORCE_LOCAL: 852 case SYNC_PREF_FORCE_LOCAL:
853 return 1; 853 return 1;
854 break; 854 break;
855 case SYNC_PREF_FORCE_REMOTE: 855 case SYNC_PREF_FORCE_REMOTE:
856 return 2; 856 return 2;
857 break; 857 break;
858 858
859 default: 859 default:
860 // SYNC_PREF_TAKE_BOTH not implemented 860 // SYNC_PREF_TAKE_BOTH not implemented
861 break; 861 break;
862 } 862 }
863 return 0; 863 return 0;
864} 864}
865Event* CalendarView::getLastSyncEvent() 865Event* CalendarView::getLastSyncEvent()
866{ 866{
867 Event* lse; 867 Event* lse;
868 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 868 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
869 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); 869 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice );
870 if (!lse) { 870 if (!lse) {
871 lse = new Event(); 871 lse = new Event();
872 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); 872 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice );
873 QString sum = ""; 873 QString sum = "";
874 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) 874 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
875 sum = "E: "; 875 sum = "E: ";
876 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); 876 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
877 lse->setDtStart( mLastCalendarSync ); 877 lse->setDtStart( mLastCalendarSync );
878 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 878 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
879 lse->setCategories( i18n("SyncEvent") ); 879 lse->setCategories( i18n("SyncEvent") );
880 lse->setReadOnly( true ); 880 lse->setReadOnly( true );
881 mCalendar->addEvent( lse ); 881 mCalendar->addEvent( lse );
882 } 882 }
883 883
884 return lse; 884 return lse;
885 885
886} 886}
887 887
888// we check, if the to delete event has a id for a profile 888// we check, if the to delete event has a id for a profile
889// if yes, we set this id in the profile to delete 889// if yes, we set this id in the profile to delete
890void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) 890void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete )
891{ 891{
892 if ( lastSync.count() == 0 ) { 892 if ( lastSync.count() == 0 ) {
893 //qDebug(" lastSync.count() == 0"); 893 //qDebug(" lastSync.count() == 0");
894 return; 894 return;
895 } 895 }
896 if ( toDelete->type() == "Journal" ) 896 if ( toDelete->type() == "Journal" )
897 return; 897 return;
898 898
899 Event* eve = lastSync.first(); 899 Event* eve = lastSync.first();
900 900
901 while ( eve ) { 901 while ( eve ) {
902 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name 902 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
903 if ( !id.isEmpty() ) { 903 if ( !id.isEmpty() ) {
904 QString des = eve->description(); 904 QString des = eve->description();
905 QString pref = "e"; 905 QString pref = "e";
906 if ( toDelete->type() == "Todo" ) 906 if ( toDelete->type() == "Todo" )
907 pref = "t"; 907 pref = "t";
908 des += pref+ id + ","; 908 des += pref+ id + ",";
909 eve->setReadOnly( false ); 909 eve->setReadOnly( false );
910 eve->setDescription( des ); 910 eve->setDescription( des );
911 //qDebug("setdes %s ", des.latin1()); 911 //qDebug("setdes %s ", des.latin1());
912 eve->setReadOnly( true ); 912 eve->setReadOnly( true );
913 } 913 }
914 eve = lastSync.next(); 914 eve = lastSync.next();
915 } 915 }
916 916
917} 917}
918void CalendarView::checkExternalId( Incidence * inc ) 918void CalendarView::checkExternalId( Incidence * inc )
919{ 919{
920 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; 920 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ;
921 checkExternSyncEvent( lastSync, inc ); 921 checkExternSyncEvent( lastSync, inc );
922 922
923} 923}
924bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) 924bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
925{ 925{
926 bool syncOK = true; 926 bool syncOK = true;
927 int addedEvent = 0; 927 int addedEvent = 0;
928 int addedEventR = 0; 928 int addedEventR = 0;
929 int deletedEventR = 0; 929 int deletedEventR = 0;
930 int deletedEventL = 0; 930 int deletedEventL = 0;
931 int changedLocal = 0; 931 int changedLocal = 0;
932 int changedRemote = 0; 932 int changedRemote = 0;
933 int filteredIN = 0; 933 int filteredIN = 0;
934 int filteredOUT = 0; 934 int filteredOUT = 0;
935 //QPtrList<Event> el = local->rawEvents(); 935 //QPtrList<Event> el = local->rawEvents();
936 Event* eventR; 936 Event* eventR;
937 QString uid; 937 QString uid;
938 int take; 938 int take;
939 Event* eventL; 939 Event* eventL;
940 Event* eventRSync; 940 Event* eventRSync;
941 Event* eventLSync; 941 Event* eventLSync;
942 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); 942 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
943 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); 943 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
944 bool fullDateRange = false; 944 bool fullDateRange = false;
945 local->resetTempSyncStat(); 945 local->resetTempSyncStat();
946 mLastCalendarSync = QDateTime::currentDateTime(); 946 mLastCalendarSync = QDateTime::currentDateTime();
947 if ( mSyncManager->syncWithDesktop() ) { 947 if ( mSyncManager->syncWithDesktop() ) {
948 remote->resetPilotStat(1); 948 remote->resetPilotStat(1);
949 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 949 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
950 mLastCalendarSync = KSyncManager::mRequestedSyncEvent; 950 mLastCalendarSync = KSyncManager::mRequestedSyncEvent;
951 qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); 951 qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() );
952 } else { 952 } else {
953 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); 953 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime ");
954 } 954 }
955 } 955 }
956 QDateTime modifiedCalendar = mLastCalendarSync; 956 QDateTime modifiedCalendar = mLastCalendarSync;
957 eventLSync = getLastSyncEvent(); 957 eventLSync = getLastSyncEvent();
958 eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); 958 eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
959 if ( eventR ) { 959 if ( eventR ) {
960 eventRSync = (Event*) eventR->clone(); 960 eventRSync = (Event*) eventR->clone();
961 remote->deleteEvent(eventR ); 961 remote->deleteEvent(eventR );
962 962
963 } else { 963 } else {
964 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { 964 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) {
965 eventRSync = (Event*)eventLSync->clone(); 965 eventRSync = (Event*)eventLSync->clone();
966 } else { 966 } else {
967 fullDateRange = true; 967 fullDateRange = true;
968 eventRSync = new Event(); 968 eventRSync = new Event();
969 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); 969 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
970 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); 970 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName );
971 eventRSync->setDtStart( mLastCalendarSync ); 971 eventRSync->setDtStart( mLastCalendarSync );
972 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 972 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
973 eventRSync->setCategories( i18n("SyncEvent") ); 973 eventRSync->setCategories( i18n("SyncEvent") );
974 } 974 }
975 } 975 }
976 if ( eventLSync->dtStart() == mLastCalendarSync ) 976 if ( eventLSync->dtStart() == mLastCalendarSync )
977 fullDateRange = true; 977 fullDateRange = true;
978 978
979 if ( ! fullDateRange ) { 979 if ( ! fullDateRange ) {
980 if ( eventLSync->dtStart() != eventRSync->dtStart() ) { 980 if ( eventLSync->dtStart() != eventRSync->dtStart() ) {
981 981
982 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); 982 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() );
983 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); 983 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec());
984 fullDateRange = true; 984 fullDateRange = true;
985 } 985 }
986 } 986 }
987 if ( mSyncManager->syncWithDesktop() ) { 987 if ( mSyncManager->syncWithDesktop() ) {
988 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); 988 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync );
989 } 989 }
990 if ( fullDateRange ) 990 if ( fullDateRange )
991 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); 991 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
992 else 992 else
993 mLastCalendarSync = eventLSync->dtStart(); 993 mLastCalendarSync = eventLSync->dtStart();
994 // for resyncing if own file has changed 994 // for resyncing if own file has changed
995 if ( mCurrentSyncDevice == "deleteaftersync" ) { 995 if ( mCurrentSyncDevice == "deleteaftersync" ) {
996 mLastCalendarSync = loadedFileVersion; 996 mLastCalendarSync = loadedFileVersion;
997 //qDebug("setting mLastCalendarSync "); 997 //qDebug("setting mLastCalendarSync ");
998 } 998 }
999 //qDebug("*************************** "); 999 //qDebug("*************************** ");
1000 qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); 1000 qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange);
1001 QPtrList<Incidence> er = remote->rawIncidences(); 1001 QPtrList<Incidence> er = remote->rawIncidences();
1002 Incidence* inR = er.first(); 1002 Incidence* inR = er.first();
1003 Incidence* inL; 1003 Incidence* inL;
1004 QProgressBar bar( er.count(),0 ); 1004 QProgressBar bar( er.count(),0 );
1005 bar.setCaption (i18n("Syncing - close to abort!") ); 1005 bar.setCaption (i18n("Syncing - close to abort!") );
1006 1006
1007 // ************** setting up filter ************* 1007 // ************** setting up filter *************
1008 CalFilter *filterIN = 0; 1008 CalFilter *filterIN = 0;
1009 CalFilter *filterOUT = 0; 1009 CalFilter *filterOUT = 0;
1010 CalFilter *filter = mFilters.first(); 1010 CalFilter *filter = mFilters.first();
1011 while(filter) { 1011 while(filter) {
1012 if ( filter->name() == mSyncManager->mFilterInCal ) 1012 if ( filter->name() == mSyncManager->mFilterInCal )
1013 filterIN = filter; 1013 filterIN = filter;
1014 if ( filter->name() == mSyncManager->mFilterOutCal ) 1014 if ( filter->name() == mSyncManager->mFilterOutCal )
1015 filterOUT = filter; 1015 filterOUT = filter;
1016 filter = mFilters.next(); 1016 filter = mFilters.next();
1017 } 1017 }
1018 int w = 300; 1018 int w = 300;
1019 if ( QApplication::desktop()->width() < 320 ) 1019 if ( QApplication::desktop()->width() < 320 )
1020 w = 220; 1020 w = 220;
1021 int h = bar.sizeHint().height() ; 1021 int h = bar.sizeHint().height() ;
1022 int dw = QApplication::desktop()->width(); 1022 int dw = QApplication::desktop()->width();
1023 int dh = QApplication::desktop()->height(); 1023 int dh = QApplication::desktop()->height();
1024 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1024 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1025 bar.show(); 1025 bar.show();
1026 int modulo = (er.count()/10)+1; 1026 int modulo = (er.count()/10)+1;
1027 int incCounter = 0; 1027 int incCounter = 0;
1028 while ( inR ) { 1028 while ( inR ) {
1029 if ( ! bar.isVisible() ) 1029 if ( ! bar.isVisible() )
1030 return false; 1030 return false;
1031 if ( incCounter % modulo == 0 ) 1031 if ( incCounter % modulo == 0 )
1032 bar.setProgress( incCounter ); 1032 bar.setProgress( incCounter );
1033 ++incCounter; 1033 ++incCounter;
1034 uid = inR->uid(); 1034 uid = inR->uid();
1035 bool skipIncidence = false; 1035 bool skipIncidence = false;
1036 if ( uid.left(15) == QString("last-syncEvent-") ) 1036 if ( uid.left(15) == QString("last-syncEvent-") )
1037 skipIncidence = true; 1037 skipIncidence = true;
1038 QString idS; 1038 QString idS;
1039 qApp->processEvents(); 1039 qApp->processEvents();
1040 if ( !skipIncidence ) { 1040 if ( !skipIncidence ) {
1041 inL = local->incidence( uid ); 1041 inL = local->incidence( uid );
1042 if ( inL ) { // maybe conflict - same uid in both calendars 1042 if ( inL ) { // maybe conflict - same uid in both calendars
1043 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { 1043 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) {
1044 //qDebug("take %d %s ", take, inL->summary().latin1()); 1044 //qDebug("take %d %s ", take, inL->summary().latin1());
1045 if ( take == 3 ) 1045 if ( take == 3 )
1046 return false; 1046 return false;
1047 if ( take == 1 ) {// take local ********************** 1047 if ( take == 1 ) {// take local **********************
1048 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 1048 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
1049 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1049 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1050 else 1050 else
1051 idS = inR->IDStr(); 1051 idS = inR->IDStr();
1052 remote->deleteIncidence( inR ); 1052 remote->deleteIncidence( inR );
1053 inR = inL->clone(); 1053 inR = inL->clone();
1054 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1054 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1055 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) 1055 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL )
1056 inR->setIDStr( idS ); 1056 inR->setIDStr( idS );
1057 remote->addIncidence( inR ); 1057 remote->addIncidence( inR );
1058 if ( mSyncManager->syncWithDesktop() ) 1058 if ( mSyncManager->syncWithDesktop() )
1059 inR->setPilotId( 2 ); 1059 inR->setPilotId( 2 );
1060 ++changedRemote; 1060 ++changedRemote;
1061 } else {// take remote ********************** 1061 } else {// take remote **********************
1062 idS = inL->IDStr(); 1062 idS = inL->IDStr();
1063 int pid = inL->pilotId(); 1063 int pid = inL->pilotId();
1064 local->deleteIncidence( inL ); 1064 local->deleteIncidence( inL );
1065 inL = inR->clone(); 1065 inL = inR->clone();
1066 if ( mSyncManager->syncWithDesktop() ) 1066 if ( mSyncManager->syncWithDesktop() )
1067 inL->setPilotId( pid ); 1067 inL->setPilotId( pid );
1068 inL->setIDStr( idS ); 1068 inL->setIDStr( idS );
1069 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1069 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1070 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1070 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1071 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1071 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1072 } 1072 }
1073 local->addIncidence( inL ); 1073 local->addIncidence( inL );
1074 ++changedLocal; 1074 ++changedLocal;
1075 } 1075 }
1076 } 1076 }
1077 } else { // no conflict ********** add or delete remote 1077 } else { // no conflict ********** add or delete remote
1078 if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ 1078 if ( !filterIN || filterIN->filterCalendarItem( inR ) ){
1079 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1079 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1080 QString des = eventLSync->description(); 1080 QString des = eventLSync->description();
1081 QString pref = "e"; 1081 QString pref = "e";
1082 if ( inR->type() == "Todo" ) 1082 if ( inR->type() == "Todo" )
1083 pref = "t"; 1083 pref = "t";
1084 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 1084 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
1085 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 1085 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
1086 //remote->deleteIncidence( inR ); 1086 //remote->deleteIncidence( inR );
1087 ++deletedEventR; 1087 ++deletedEventR;
1088 } else { 1088 } else {
1089 inR->setLastModified( modifiedCalendar ); 1089 inR->setLastModified( modifiedCalendar );
1090 inL = inR->clone(); 1090 inL = inR->clone();
1091 inL->setIDStr( ":" ); 1091 inL->setIDStr( ":" );
1092 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1092 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1093 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1093 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1094 local->addIncidence( inL ); 1094 local->addIncidence( inL );
1095 ++addedEvent; 1095 ++addedEvent;
1096 1096
1097 } 1097 }
1098 } else { 1098 } else {
1099 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { 1099 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
1100 inR->setLastModified( modifiedCalendar ); 1100 inR->setLastModified( modifiedCalendar );
1101 inL = inR->clone(); 1101 inL = inR->clone();
1102 inL->setIDStr( ":" ); 1102 inL->setIDStr( ":" );
1103 local->addIncidence( inL ); 1103 local->addIncidence( inL );
1104 ++addedEvent; 1104 ++addedEvent;
1105 1105
1106 } else { 1106 } else {
1107 checkExternSyncEvent(eventRSyncSharp, inR); 1107 checkExternSyncEvent(eventRSyncSharp, inR);
1108 remote->deleteIncidence( inR ); 1108 remote->deleteIncidence( inR );
1109 ++deletedEventR; 1109 ++deletedEventR;
1110 } 1110 }
1111 } 1111 }
1112 } else { 1112 } else {
1113 ++filteredIN; 1113 ++filteredIN;
1114 } 1114 }
1115 } 1115 }
1116 } 1116 }
1117 inR = er.next(); 1117 inR = er.next();
1118 } 1118 }
1119 QPtrList<Incidence> el = local->rawIncidences(); 1119 QPtrList<Incidence> el = local->rawIncidences();
1120 inL = el.first(); 1120 inL = el.first();
1121 modulo = (el.count()/10)+1; 1121 modulo = (el.count()/10)+1;
1122 bar.setCaption (i18n("Add / remove events") ); 1122 bar.setCaption (i18n("Add / remove events") );
1123 bar.setTotalSteps ( el.count() ) ; 1123 bar.setTotalSteps ( el.count() ) ;
1124 bar.show(); 1124 bar.show();
1125 incCounter = 0; 1125 incCounter = 0;
1126 1126
1127 while ( inL ) { 1127 while ( inL ) {
1128 1128
1129 qApp->processEvents(); 1129 qApp->processEvents();
1130 if ( ! bar.isVisible() ) 1130 if ( ! bar.isVisible() )
1131 return false; 1131 return false;
1132 if ( incCounter % modulo == 0 ) 1132 if ( incCounter % modulo == 0 )
1133 bar.setProgress( incCounter ); 1133 bar.setProgress( incCounter );
1134 ++incCounter; 1134 ++incCounter;
1135 uid = inL->uid(); 1135 uid = inL->uid();
1136 bool skipIncidence = false; 1136 bool skipIncidence = false;
1137 if ( uid.left(15) == QString("last-syncEvent-") ) 1137 if ( uid.left(15) == QString("last-syncEvent-") )
1138 skipIncidence = true; 1138 skipIncidence = true;
1139 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) 1139 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
1140 skipIncidence = true; 1140 skipIncidence = true;
1141 if ( !skipIncidence ) { 1141 if ( !skipIncidence ) {
1142 inR = remote->incidence( uid ); 1142 inR = remote->incidence( uid );
1143 if ( ! inR ) { 1143 if ( ! inR ) {
1144 if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ 1144 if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){
1145 // no conflict ********** add or delete local 1145 // no conflict ********** add or delete local
1146 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1146 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1147 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 1147 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
1148 checkExternSyncEvent(eventLSyncSharp, inL); 1148 checkExternSyncEvent(eventLSyncSharp, inL);
1149 local->deleteIncidence( inL ); 1149 local->deleteIncidence( inL );
1150 ++deletedEventL; 1150 ++deletedEventL;
1151 } else { 1151 } else {
1152 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1152 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1153 inL->removeID(mCurrentSyncDevice ); 1153 inL->removeID(mCurrentSyncDevice );
1154 ++addedEventR; 1154 ++addedEventR;
1155 //qDebug("remote added Incidence %s ", inL->summary().latin1()); 1155 //qDebug("remote added Incidence %s ", inL->summary().latin1());
1156 inL->setLastModified( modifiedCalendar ); 1156 inL->setLastModified( modifiedCalendar );
1157 inR = inL->clone(); 1157 inR = inL->clone();
1158 inR->setIDStr( ":" ); 1158 inR->setIDStr( ":" );
1159 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1159 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1160 remote->addIncidence( inR ); 1160 remote->addIncidence( inR );
1161 } 1161 }
1162 } 1162 }
1163 } else { 1163 } else {
1164 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { 1164 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
1165 checkExternSyncEvent(eventLSyncSharp, inL); 1165 checkExternSyncEvent(eventLSyncSharp, inL);
1166 local->deleteIncidence( inL ); 1166 local->deleteIncidence( inL );
1167 ++deletedEventL; 1167 ++deletedEventL;
1168 } else { 1168 } else {
1169 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1169 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1170 ++addedEventR; 1170 ++addedEventR;
1171 inL->setLastModified( modifiedCalendar ); 1171 inL->setLastModified( modifiedCalendar );
1172 inR = inL->clone(); 1172 inR = inL->clone();
1173 inR->setIDStr( ":" ); 1173 inR->setIDStr( ":" );
1174 remote->addIncidence( inR ); 1174 remote->addIncidence( inR );
1175 } 1175 }
1176 } 1176 }
1177 } 1177 }
1178 } else { 1178 } else {
1179 ++filteredOUT; 1179 ++filteredOUT;
1180 } 1180 }
1181 } 1181 }
1182 } 1182 }
1183 inL = el.next(); 1183 inL = el.next();
1184 } 1184 }
1185 int delFut = 0; 1185 int delFut = 0;
1186 int remRem = 0; 1186 int remRem = 0;
1187 if ( mSyncManager->mWriteBackInFuture ) { 1187 if ( mSyncManager->mWriteBackInFuture ) {
1188 er = remote->rawIncidences(); 1188 er = remote->rawIncidences();
1189 remRem = er.count(); 1189 remRem = er.count();
1190 inR = er.first(); 1190 inR = er.first();
1191 QDateTime dt; 1191 QDateTime dt;
1192 QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); 1192 QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) );
1193 QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); 1193 QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 );
1194 while ( inR ) { 1194 while ( inR ) {
1195 if ( inR->type() == "Todo" ) { 1195 if ( inR->type() == "Todo" ) {
1196 Todo * t = (Todo*)inR; 1196 Todo * t = (Todo*)inR;
1197 if ( t->hasDueDate() ) 1197 if ( t->hasDueDate() )
1198 dt = t->dtDue(); 1198 dt = t->dtDue();
1199 else 1199 else
1200 dt = cur.addSecs( 62 ); 1200 dt = cur.addSecs( 62 );
1201 } 1201 }
1202 else if (inR->type() == "Event" ) { 1202 else if (inR->type() == "Event" ) {
1203 bool ok; 1203 bool ok;
1204 dt = inR->getNextOccurence( cur, &ok ); 1204 dt = inR->getNextOccurence( cur, &ok );
1205 if ( !ok ) 1205 if ( !ok )
1206 dt = cur.addSecs( -62 ); 1206 dt = cur.addSecs( -62 );
1207 } 1207 }
1208 else 1208 else
1209 dt = inR->dtStart(); 1209 dt = inR->dtStart();
1210 if ( dt < cur || dt > end ) { 1210 if ( dt < cur || dt > end ) {
1211 remote->deleteIncidence( inR ); 1211 remote->deleteIncidence( inR );
1212 ++delFut; 1212 ++delFut;
1213 } 1213 }
1214 inR = er.next(); 1214 inR = er.next();
1215 } 1215 }
1216 } 1216 }
1217 bar.hide(); 1217 bar.hide();
1218 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1218 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1219 eventLSync->setReadOnly( false ); 1219 eventLSync->setReadOnly( false );
1220 eventLSync->setDtStart( mLastCalendarSync ); 1220 eventLSync->setDtStart( mLastCalendarSync );
1221 eventRSync->setDtStart( mLastCalendarSync ); 1221 eventRSync->setDtStart( mLastCalendarSync );
1222 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1222 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1223 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1223 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1224 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1224 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1225 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1225 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1226 eventLSync->setReadOnly( true ); 1226 eventLSync->setReadOnly( true );
1227 qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL ); 1227 qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL );
1228 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... 1228 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal...
1229 remote->addEvent( eventRSync ); 1229 remote->addEvent( eventRSync );
1230 else 1230 else
1231 delete eventRSync; 1231 delete eventRSync;
1232 qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() ); 1232 qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() );
1233 QString mes; 1233 QString mes;
1234 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 ); 1234 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 );
1235 QString delmess; 1235 QString delmess;
1236 if ( delFut ) { 1236 if ( delFut ) {
1237 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); 1237 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);
1238 mes += delmess; 1238 mes += delmess;
1239 } 1239 }
1240 mes = i18n("Local calendar changed!\n") +mes; 1240 mes = i18n("Local calendar changed!\n") +mes;
1241 mCalendar->checkAlarmForIncidence( 0, true ); 1241 mCalendar->checkAlarmForIncidence( 0, true );
1242 qDebug( mes ); 1242 qDebug( mes );
1243 if ( mSyncManager->mShowSyncSummary ) { 1243 if ( mSyncManager->mShowSyncSummary ) {
1244 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, 1244 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
1245 i18n("KO/Pi Synchronization"),i18n("Write back"))) { 1245 i18n("KO/Pi Synchronization"),i18n("Write back"))) {
1246 qDebug("KO: WB cancelled "); 1246 qDebug("KO: WB cancelled ");
1247 return false; 1247 return false;
1248 } 1248 }
1249 } 1249 }
1250 return syncOK; 1250 return syncOK;
1251} 1251}
1252 1252
1253void CalendarView::setSyncDevice( QString s ) 1253void CalendarView::setSyncDevice( QString s )
1254{ 1254{
1255 mCurrentSyncDevice= s; 1255 mCurrentSyncDevice= s;
1256} 1256}
1257void CalendarView::setSyncName( QString s ) 1257void CalendarView::setSyncName( QString s )
1258{ 1258{
1259 mCurrentSyncName= s; 1259 mCurrentSyncName= s;
1260} 1260}
1261bool CalendarView::syncCalendar(QString filename, int mode) 1261bool CalendarView::syncCalendar(QString filename, int mode)
1262{ 1262{
1263 //qDebug("syncCalendar %s ", filename.latin1()); 1263 //qDebug("syncCalendar %s ", filename.latin1());
1264 mGlobalSyncMode = SYNC_MODE_NORMAL; 1264 mGlobalSyncMode = SYNC_MODE_NORMAL;
1265 CalendarLocal* calendar = new CalendarLocal(); 1265 CalendarLocal* calendar = new CalendarLocal();
1266 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1266 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1267 FileStorage* storage = new FileStorage( calendar ); 1267 FileStorage* storage = new FileStorage( calendar );
1268 bool syncOK = false; 1268 bool syncOK = false;
1269 storage->setFileName( filename ); 1269 storage->setFileName( filename );
1270 // qDebug("loading ... "); 1270 // qDebug("loading ... ");
1271 if ( storage->load() ) { 1271 if ( storage->load() ) {
1272 getEventViewerDialog()->setSyncMode( true ); 1272 getEventViewerDialog()->setSyncMode( true );
1273 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1273 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1274 getEventViewerDialog()->setSyncMode( false ); 1274 getEventViewerDialog()->setSyncMode( false );
1275 if ( syncOK ) { 1275 if ( syncOK ) {
1276 if ( mSyncManager->mWriteBackFile ) 1276 if ( mSyncManager->mWriteBackFile )
1277 { 1277 {
1278 storage->setSaveFormat( new ICalFormat() ); 1278 storage->setSaveFormat( new ICalFormat() );
1279 storage->save(); 1279 storage->save();
1280 } 1280 }
1281 } 1281 }
1282 setModified( true ); 1282 setModified( true );
1283 } 1283 }
1284 delete storage; 1284 delete storage;
1285 delete calendar; 1285 delete calendar;
1286 if ( syncOK ) 1286 if ( syncOK )
1287 updateView(); 1287 updateView();
1288 return syncOK; 1288 return syncOK;
1289} 1289}
1290 1290
1291void CalendarView::syncExternal( int mode ) 1291void CalendarView::syncExternal( int mode )
1292{ 1292{
1293 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1293 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1294 1294
1295 qApp->processEvents(); 1295 qApp->processEvents();
1296 CalendarLocal* calendar = new CalendarLocal(); 1296 CalendarLocal* calendar = new CalendarLocal();
1297 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1297 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1298 bool syncOK = false; 1298 bool syncOK = false;
1299 bool loadSuccess = false; 1299 bool loadSuccess = false;
1300 PhoneFormat* phoneFormat = 0; 1300 PhoneFormat* phoneFormat = 0;
1301 emit tempDisableBR(true); 1301 emit tempDisableBR(true);
1302#ifndef DESKTOP_VERSION 1302#ifndef DESKTOP_VERSION
1303 SharpFormat* sharpFormat = 0; 1303 SharpFormat* sharpFormat = 0;
1304 if ( mode == 0 ) { // sharp 1304 if ( mode == 0 ) { // sharp
1305 sharpFormat = new SharpFormat () ; 1305 sharpFormat = new SharpFormat () ;
1306 loadSuccess = sharpFormat->load( calendar, mCalendar ); 1306 loadSuccess = sharpFormat->load( calendar, mCalendar );
1307 1307
1308 } else 1308 } else
1309#endif 1309#endif
1310 if ( mode == 1 ) { // phone 1310 if ( mode == 1 ) { // phone
1311 phoneFormat = new PhoneFormat (mCurrentSyncDevice, 1311 phoneFormat = new PhoneFormat (mCurrentSyncDevice,
1312 mSyncManager->mPhoneDevice, 1312 mSyncManager->mPhoneDevice,
1313 mSyncManager->mPhoneConnection, 1313 mSyncManager->mPhoneConnection,
1314 mSyncManager->mPhoneModel); 1314 mSyncManager->mPhoneModel);
1315 loadSuccess = phoneFormat->load( calendar,mCalendar); 1315 loadSuccess = phoneFormat->load( calendar,mCalendar);
1316 1316
1317 } else { 1317 } else {
1318 emit tempDisableBR(false); 1318 emit tempDisableBR(false);
1319 return; 1319 return;
1320 } 1320 }
1321 if ( loadSuccess ) { 1321 if ( loadSuccess ) {
1322 getEventViewerDialog()->setSyncMode( true ); 1322 getEventViewerDialog()->setSyncMode( true );
1323 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1323 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1324 getEventViewerDialog()->setSyncMode( false ); 1324 getEventViewerDialog()->setSyncMode( false );
1325 qApp->processEvents(); 1325 qApp->processEvents();
1326 if ( syncOK ) { 1326 if ( syncOK ) {
1327 if ( mSyncManager->mWriteBackFile ) 1327 if ( mSyncManager->mWriteBackFile )
1328 { 1328 {
1329 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1329 QPtrList<Incidence> iL = mCalendar->rawIncidences();
1330 Incidence* inc = iL.first(); 1330 Incidence* inc = iL.first();
1331 if ( phoneFormat ) { 1331 if ( phoneFormat ) {
1332 while ( inc ) { 1332 while ( inc ) {
1333 inc->removeID(mCurrentSyncDevice); 1333 inc->removeID(mCurrentSyncDevice);
1334 inc = iL.next(); 1334 inc = iL.next();
1335 } 1335 }
1336 } 1336 }
1337#ifndef DESKTOP_VERSION 1337#ifndef DESKTOP_VERSION
1338 if ( sharpFormat ) 1338 if ( sharpFormat )
1339 sharpFormat->save(calendar); 1339 sharpFormat->save(calendar);
1340#endif 1340#endif
1341 if ( phoneFormat ) 1341 if ( phoneFormat )
1342 phoneFormat->save(calendar); 1342 phoneFormat->save(calendar);
1343 iL = calendar->rawIncidences(); 1343 iL = calendar->rawIncidences();
1344 inc = iL.first(); 1344 inc = iL.first();
1345 Incidence* loc; 1345 Incidence* loc;
1346 while ( inc ) { 1346 while ( inc ) {
1347 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 1347 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
1348 loc = mCalendar->incidence(inc->uid() ); 1348 loc = mCalendar->incidence(inc->uid() );
1349 if ( loc ) { 1349 if ( loc ) {
1350 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); 1350 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
1351 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); 1351 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
1352 } 1352 }
1353 } 1353 }
1354 inc = iL.next(); 1354 inc = iL.next();
1355 } 1355 }
1356 Incidence* lse = getLastSyncEvent(); 1356 Incidence* lse = getLastSyncEvent();
1357 if ( lse ) { 1357 if ( lse ) {
1358 lse->setReadOnly( false ); 1358 lse->setReadOnly( false );
1359 lse->setDescription( "" ); 1359 lse->setDescription( "" );
1360 lse->setReadOnly( true ); 1360 lse->setReadOnly( true );
1361 } 1361 }
1362 } 1362 }
1363 } else { 1363 } else {
1364 topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); 1364 topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") );
1365 } 1365 }
1366 setModified( true ); 1366 setModified( true );
1367 } else { 1367 } else {
1368 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; 1368 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
1369 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), 1369 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
1370 question, i18n("Ok")) ; 1370 question, i18n("Ok")) ;
1371 1371
1372 } 1372 }
1373 delete calendar; 1373 delete calendar;
1374 updateView(); 1374 updateView();
1375 emit tempDisableBR(false); 1375 emit tempDisableBR(false);
1376 return ;//syncOK; 1376 return ;//syncOK;
1377 1377
1378} 1378}
1379 1379
1380bool CalendarView::importBday() 1380bool CalendarView::importBday()
1381{ 1381{
1382#ifndef KORG_NOKABC 1382#ifndef KORG_NOKABC
1383 1383
1384#ifdef DESKTOP_VERSION 1384#ifdef DESKTOP_VERSION
1385 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 1385 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
1386 KABC::AddressBook::Iterator it; 1386 KABC::AddressBook::Iterator it;
1387 int count = 0; 1387 int count = 0;
1388 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1388 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1389 ++count; 1389 ++count;
1390 } 1390 }
1391 QProgressBar bar(count,0 ); 1391 QProgressBar bar(count,0 );
1392 int w = 300; 1392 int w = 300;
1393 if ( QApplication::desktop()->width() < 320 ) 1393 if ( QApplication::desktop()->width() < 320 )
1394 w = 220; 1394 w = 220;
1395 int h = bar.sizeHint().height() ; 1395 int h = bar.sizeHint().height() ;
1396 int dw = QApplication::desktop()->width(); 1396 int dw = QApplication::desktop()->width();
1397 int dh = QApplication::desktop()->height(); 1397 int dh = QApplication::desktop()->height();
1398 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1398 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1399 bar.show(); 1399 bar.show();
1400 bar.setCaption (i18n("Reading addressbook - close to abort!") ); 1400 bar.setCaption (i18n("Reading addressbook - close to abort!") );
1401 qApp->processEvents(); 1401 qApp->processEvents();
1402 count = 0; 1402 count = 0;
1403 int addCount = 0; 1403 int addCount = 0;
1404 KCal::Attendee* a = 0; 1404 KCal::Attendee* a = 0;
1405 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1405 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1406 if ( ! bar.isVisible() ) 1406 if ( ! bar.isVisible() )
1407 return false; 1407 return false;
1408 bar.setProgress( count++ ); 1408 bar.setProgress( count++ );
1409 qApp->processEvents(); 1409 qApp->processEvents();
1410 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); 1410 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() );
1411 if ( (*it).birthday().date().isValid() ){ 1411 if ( (*it).birthday().date().isValid() ){
1412 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1412 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1413 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) 1413 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) )
1414 ++addCount; 1414 ++addCount;
1415 } 1415 }
1416 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); 1416 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d");
1417 if ( anni.isValid() ){ 1417 if ( anni.isValid() ){
1418 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1418 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1419 if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) 1419 if ( addAnniversary( anni, (*it).assembledName(), a, false ) )
1420 ++addCount; 1420 ++addCount;
1421 } 1421 }
1422 } 1422 }
1423 updateView(); 1423 updateView();
1424 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1424 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1425#else //DESKTOP_VERSION 1425#else //DESKTOP_VERSION
1426 1426
1427 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 1427 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
1428 // the result should now arrive through method insertBirthdays 1428 // the result should now arrive through method insertBirthdays
1429 1429
1430#endif //DESKTOP_VERSION 1430#endif //DESKTOP_VERSION
1431 1431
1432#endif //KORG_NOKABC 1432#endif //KORG_NOKABC
1433 1433
1434 1434
1435 return true; 1435 return true;
1436} 1436}
1437 1437
1438// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI 1438// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI
1439void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, 1439void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList,
1440 const QStringList& anniversaryList, const QStringList& realNameList, 1440 const QStringList& anniversaryList, const QStringList& realNameList,
1441 const QStringList& emailList, const QStringList& assembledNameList, 1441 const QStringList& emailList, const QStringList& assembledNameList,
1442 const QStringList& uidList) 1442 const QStringList& uidList)
1443{ 1443{
1444 //qDebug("KO::CalendarView::insertBirthdays"); 1444 //qDebug("KO::CalendarView::insertBirthdays");
1445 if (uid == this->name()) 1445 if (uid == this->name())
1446 { 1446 {
1447 int count = birthdayList.count(); 1447 int count = birthdayList.count();
1448 int addCount = 0; 1448 int addCount = 0;
1449 KCal::Attendee* a = 0; 1449 KCal::Attendee* a = 0;
1450 1450
1451 //qDebug("CalView 1 %i", count); 1451 //qDebug("CalView 1 %i", count);
1452 1452
1453 QProgressBar bar(count,0 ); 1453 QProgressBar bar(count,0 );
1454 int w = 300; 1454 int w = 300;
1455 if ( QApplication::desktop()->width() < 320 ) 1455 if ( QApplication::desktop()->width() < 320 )
1456 w = 220; 1456 w = 220;
1457 int h = bar.sizeHint().height() ; 1457 int h = bar.sizeHint().height() ;
1458 int dw = QApplication::desktop()->width(); 1458 int dw = QApplication::desktop()->width();
1459 int dh = QApplication::desktop()->height(); 1459 int dh = QApplication::desktop()->height();
1460 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1460 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1461 bar.show(); 1461 bar.show();
1462 bar.setCaption (i18n("inserting birthdays - close to abort!") ); 1462 bar.setCaption (i18n("inserting birthdays - close to abort!") );
1463 qApp->processEvents(); 1463 qApp->processEvents();
1464 1464
1465 QDate birthday; 1465 QDate birthday;
1466 QDate anniversary; 1466 QDate anniversary;
1467 QString realName; 1467 QString realName;
1468 QString email; 1468 QString email;
1469 QString assembledName; 1469 QString assembledName;
1470 QString uid; 1470 QString uid;
1471 bool ok = true; 1471 bool ok = true;
1472 for ( int i = 0; i < count; i++) 1472 for ( int i = 0; i < count; i++)
1473 { 1473 {
1474 if ( ! bar.isVisible() ) 1474 if ( ! bar.isVisible() )
1475 return; 1475 return;
1476 bar.setProgress( i ); 1476 bar.setProgress( i );
1477 qApp->processEvents(); 1477 qApp->processEvents();
1478 1478
1479 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); 1479 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok);
1480 if (!ok) { 1480 if (!ok) {
1481 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); 1481 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1());
1482 } 1482 }
1483 1483
1484 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); 1484 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok);
1485 if (!ok) { 1485 if (!ok) {
1486 ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); 1486 ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1());
1487 } 1487 }
1488 realName = realNameList[i]; 1488 realName = realNameList[i];
1489 email = emailList[i]; 1489 email = emailList[i];
1490 assembledName = assembledNameList[i]; 1490 assembledName = assembledNameList[i];
1491 uid = uidList[i]; 1491 uid = uidList[i];
1492 //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); 1492 //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() );
1493 1493
1494 if ( birthday.isValid() ){ 1494 if ( birthday.isValid() ){
1495 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, 1495 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1496 KCal::Attendee::ReqParticipant,uid) ; 1496 KCal::Attendee::ReqParticipant,uid) ;
1497 if ( addAnniversary( birthday, assembledName, a, true ) ) 1497 if ( addAnniversary( birthday, assembledName, a, true ) )
1498 ++addCount; 1498 ++addCount;
1499 } 1499 }
1500 1500
1501 if ( anniversary.isValid() ){ 1501 if ( anniversary.isValid() ){
1502 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, 1502 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1503 KCal::Attendee::ReqParticipant,uid) ; 1503 KCal::Attendee::ReqParticipant,uid) ;
1504 if ( addAnniversary( anniversary, assembledName, a, false ) ) 1504 if ( addAnniversary( anniversary, assembledName, a, false ) )
1505 ++addCount; 1505 ++addCount;
1506 } 1506 }
1507 } 1507 }
1508 1508
1509 updateView(); 1509 updateView();
1510 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1510 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1511 1511
1512 } 1512 }
1513 1513
1514} 1514}
1515 1515
1516 1516
1517 1517
1518bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) 1518bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday)
1519{ 1519{
1520 //qDebug("addAnni "); 1520 //qDebug("addAnni ");
1521 Event * ev = new Event(); 1521 Event * ev = new Event();
1522 if ( a ) { 1522 if ( a ) {
1523 ev->addAttendee( a ); 1523 ev->addAttendee( a );
1524 } 1524 }
1525 QString kind; 1525 QString kind;
1526 if ( birthday ) { 1526 if ( birthday ) {
1527 kind = i18n( "Birthday" ); 1527 kind = i18n( "Birthday" );
1528 ev->setSummary( name + " (" + QString::number(date.year()) +")"); 1528 ev->setSummary( name + " (" + QString::number(date.year()) +")");
1529 } 1529 }
1530 else { 1530 else {
1531 kind = i18n( "Anniversary" ); 1531 kind = i18n( "Anniversary" );
1532 ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); 1532 ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind );
1533 } 1533 }
1534 ev->setOrganizer(a->email()); 1534 ev->setOrganizer(a->email());
1535 ev->setCategories( kind ); 1535 ev->setCategories( kind );
1536 ev->setDtStart( QDateTime(date) ); 1536 ev->setDtStart( QDateTime(date) );
1537 ev->setDtEnd( QDateTime(date) ); 1537 ev->setDtEnd( QDateTime(date) );
1538 ev->setFloats( true ); 1538 ev->setFloats( true );
1539 Recurrence * rec = ev->recurrence(); 1539 Recurrence * rec = ev->recurrence();
1540 rec->setYearly(Recurrence::rYearlyMonth,1,-1); 1540 rec->setYearly(Recurrence::rYearlyMonth,1,-1);
1541 rec->addYearlyNum( date.month() ); 1541 rec->addYearlyNum( date.month() );
1542 if ( !mCalendar->addAnniversaryNoDup( ev ) ) { 1542 if ( !mCalendar->addAnniversaryNoDup( ev ) ) {
1543 delete ev; 1543 delete ev;
1544 return false; 1544 return false;
1545 } 1545 }
1546 return true; 1546 return true;
1547 1547
1548} 1548}
1549bool CalendarView::importQtopia( const QString &categories, 1549bool CalendarView::importQtopia( const QString &categories,
1550 const QString &datebook, 1550 const QString &datebook,
1551 const QString &todolist ) 1551 const QString &todolist )
1552{ 1552{
1553 1553
1554 QtopiaFormat qtopiaFormat; 1554 QtopiaFormat qtopiaFormat;
1555 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1555 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1556 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); 1556 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories );
1557 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); 1557 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook );
1558 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); 1558 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist );
1559 1559
1560 updateView(); 1560 updateView();
1561 return true; 1561 return true;
1562 1562
1563#if 0 1563#if 0
1564 mGlobalSyncMode = SYNC_MODE_QTOPIA; 1564 mGlobalSyncMode = SYNC_MODE_QTOPIA;
1565 mCurrentSyncDevice = "qtopia-XML"; 1565 mCurrentSyncDevice = "qtopia-XML";
1566 if ( mSyncManager->mAskForPreferences ) 1566 if ( mSyncManager->mAskForPreferences )
1567 edit_sync_options(); 1567 edit_sync_options();
1568 qApp->processEvents(); 1568 qApp->processEvents();
1569 CalendarLocal* calendar = new CalendarLocal(); 1569 CalendarLocal* calendar = new CalendarLocal();
1570 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1570 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1571 bool syncOK = false; 1571 bool syncOK = false;
1572 QtopiaFormat qtopiaFormat; 1572 QtopiaFormat qtopiaFormat;
1573 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1573 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1574 bool loadOk = true; 1574 bool loadOk = true;
1575 if ( !categories.isEmpty() ) 1575 if ( !categories.isEmpty() )
1576 loadOk = qtopiaFormat.load( calendar, categories ); 1576 loadOk = qtopiaFormat.load( calendar, categories );
1577 if ( loadOk && !datebook.isEmpty() ) 1577 if ( loadOk && !datebook.isEmpty() )
1578 loadOk = qtopiaFormat.load( calendar, datebook ); 1578 loadOk = qtopiaFormat.load( calendar, datebook );
1579 if ( loadOk && !todolist.isEmpty() ) 1579 if ( loadOk && !todolist.isEmpty() )
1580 loadOk = qtopiaFormat.load( calendar, todolist ); 1580 loadOk = qtopiaFormat.load( calendar, todolist );
1581 1581
1582 if ( loadOk ) { 1582 if ( loadOk ) {
1583 getEventViewerDialog()->setSyncMode( true ); 1583 getEventViewerDialog()->setSyncMode( true );
1584 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1584 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1585 getEventViewerDialog()->setSyncMode( false ); 1585 getEventViewerDialog()->setSyncMode( false );
1586 qApp->processEvents(); 1586 qApp->processEvents();
1587 if ( syncOK ) { 1587 if ( syncOK ) {
1588 if ( mSyncManager->mWriteBackFile ) 1588 if ( mSyncManager->mWriteBackFile )
1589 { 1589 {
1590 // write back XML file 1590 // write back XML file
1591 1591
1592 } 1592 }
1593 setModified( true ); 1593 setModified( true );
1594 } 1594 }
1595 } else { 1595 } else {
1596 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; 1596 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ;
1597 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), 1597 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"),
1598 question, i18n("Ok")) ; 1598 question, i18n("Ok")) ;
1599 } 1599 }
1600 delete calendar; 1600 delete calendar;
1601 updateView(); 1601 updateView();
1602 return syncOK; 1602 return syncOK;
1603 1603
1604 1604
1605#endif 1605#endif
1606 1606
1607} 1607}
1608 1608
1609void CalendarView::setSyncEventsReadOnly() 1609void CalendarView::setSyncEventsReadOnly()
1610{ 1610{
1611 Event * ev; 1611 Event * ev;
1612 QPtrList<Event> eL = mCalendar->rawEvents(); 1612 QPtrList<Event> eL = mCalendar->rawEvents();
1613 ev = eL.first(); 1613 ev = eL.first();
1614 while ( ev ) { 1614 while ( ev ) {
1615 if ( ev->uid().left(15) == QString("last-syncEvent-") ) 1615 if ( ev->uid().left(15) == QString("last-syncEvent-") )
1616 ev->setReadOnly( true ); 1616 ev->setReadOnly( true );
1617 ev = eL.next(); 1617 ev = eL.next();
1618 } 1618 }
1619} 1619}
1620bool CalendarView::openCalendar(QString filename, bool merge) 1620bool CalendarView::openCalendar(QString filename, bool merge)
1621{ 1621{
1622 1622
1623 if (filename.isEmpty()) { 1623 if (filename.isEmpty()) {
1624 return false; 1624 return false;
1625 } 1625 }
1626 1626
1627 if (!QFile::exists(filename)) { 1627 if (!QFile::exists(filename)) {
1628 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); 1628 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename));
1629 return false; 1629 return false;
1630 } 1630 }
1631 1631
1632 globalFlagBlockAgenda = 1; 1632 globalFlagBlockAgenda = 1;
1633 if (!merge) mCalendar->close(); 1633 if (!merge) mCalendar->close();
1634 1634
1635 mStorage->setFileName( filename ); 1635 mStorage->setFileName( filename );
1636 1636
1637 if ( mStorage->load() ) { 1637 if ( mStorage->load() ) {
1638 if ( merge ) ;//setModified( true ); 1638 if ( merge ) ;//setModified( true );
1639 else { 1639 else {
1640 //setModified( true ); 1640 //setModified( true );
1641 mViewManager->setDocumentId( filename ); 1641 mViewManager->setDocumentId( filename );
1642 mDialogManager->setDocumentId( filename ); 1642 mDialogManager->setDocumentId( filename );
1643 mTodoList->setDocumentId( filename ); 1643 mTodoList->setDocumentId( filename );
1644 } 1644 }
1645 globalFlagBlockAgenda = 2; 1645 globalFlagBlockAgenda = 2;
1646 // if ( getLastSyncEvent() ) 1646 // if ( getLastSyncEvent() )
1647 // getLastSyncEvent()->setReadOnly( true ); 1647 // getLastSyncEvent()->setReadOnly( true );
1648 mCalendar->reInitAlarmSettings(); 1648 mCalendar->reInitAlarmSettings();
1649 setSyncEventsReadOnly(); 1649 setSyncEventsReadOnly();
1650 updateUnmanagedViews(); 1650 updateUnmanagedViews();
1651 updateView(); 1651 updateView();
1652 if ( filename != MainWindow::defaultFileName() ) { 1652 if ( filename != MainWindow::defaultFileName() ) {
1653 saveCalendar( MainWindow::defaultFileName() ); 1653 saveCalendar( MainWindow::defaultFileName() );
1654 } else { 1654 } else {
1655 QFileInfo finf ( MainWindow::defaultFileName()); 1655 QFileInfo finf ( MainWindow::defaultFileName());
1656 if ( finf.exists() ) { 1656 if ( finf.exists() ) {
1657 setLoadedFileVersion( finf.lastModified () ); 1657 setLoadedFileVersion( finf.lastModified () );
1658 } 1658 }
1659 } 1659 }
1660 return true; 1660 return true;
1661 } else { 1661 } else {
1662 // while failing to load, the calendar object could 1662 // while failing to load, the calendar object could
1663 // have become partially populated. Clear it out. 1663 // have become partially populated. Clear it out.
1664 if ( !merge ) { 1664 if ( !merge ) {
1665 mCalendar->close(); 1665 mCalendar->close();
1666 mViewManager->setDocumentId( filename ); 1666 mViewManager->setDocumentId( filename );
1667 mDialogManager->setDocumentId( filename ); 1667 mDialogManager->setDocumentId( filename );
1668 mTodoList->setDocumentId( filename ); 1668 mTodoList->setDocumentId( filename );
1669 } 1669 }
1670 1670
1671 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); 1671 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename));
1672 1672
1673 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); 1673 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) );
1674 globalFlagBlockAgenda = 2; 1674 globalFlagBlockAgenda = 2;
1675 mCalendar->reInitAlarmSettings(); 1675 mCalendar->reInitAlarmSettings();
1676 setSyncEventsReadOnly(); 1676 setSyncEventsReadOnly();
1677 updateUnmanagedViews(); 1677 updateUnmanagedViews();
1678 updateView(); 1678 updateView();
1679 } 1679 }
1680 return false; 1680 return false;
1681} 1681}
1682void CalendarView::showOpenError() 1682void CalendarView::showOpenError()
1683{ 1683{
1684 KMessageBox::error(this,i18n("Couldn't load calendar\n.")); 1684 KMessageBox::error(this,i18n("Couldn't load calendar\n."));
1685} 1685}
1686void CalendarView::setLoadedFileVersion(QDateTime dt) 1686void CalendarView::setLoadedFileVersion(QDateTime dt)
1687{ 1687{
1688 loadedFileVersion = dt; 1688 loadedFileVersion = dt;
1689} 1689}
1690bool CalendarView::checkFileChanged(QString fn) 1690bool CalendarView::checkFileChanged(QString fn)
1691{ 1691{
1692 QFileInfo finf ( fn ); 1692 QFileInfo finf ( fn );
1693 if ( !finf.exists() ) 1693 if ( !finf.exists() )
1694 return true; 1694 return true;
1695 QDateTime dt = finf.lastModified (); 1695 QDateTime dt = finf.lastModified ();
1696 if ( dt <= loadedFileVersion ) 1696 if ( dt <= loadedFileVersion )
1697 return false; 1697 return false;
1698 return true; 1698 return true;
1699 1699
1700} 1700}
1701void CalendarView::watchSavedFile() 1701void CalendarView::watchSavedFile()
1702{ 1702{
1703 QFileInfo finf ( MainWindow::defaultFileName()); 1703 QFileInfo finf ( MainWindow::defaultFileName());
1704 if ( !finf.exists() ) 1704 if ( !finf.exists() )
1705 return; 1705 return;
1706 QDateTime dt = finf.lastModified (); 1706 QDateTime dt = finf.lastModified ();
1707 if ( dt < loadedFileVersion ) { 1707 if ( dt < loadedFileVersion ) {
1708 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); 1708 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1());
1709 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); 1709 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) );
1710 return; 1710 return;
1711 } 1711 }
1712 loadedFileVersion = dt; 1712 loadedFileVersion = dt;
1713} 1713}
1714 1714
1715bool CalendarView::checkFileVersion(QString fn) 1715bool CalendarView::checkFileVersion(QString fn)
1716{ 1716{
1717 QFileInfo finf ( fn ); 1717 QFileInfo finf ( fn );
1718 if ( !finf.exists() ) 1718 if ( !finf.exists() )
1719 return true; 1719 return true;
1720 QDateTime dt = finf.lastModified (); 1720 QDateTime dt = finf.lastModified ();
1721 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); 1721 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1());
1722 //qDebug("file on disk version %s",dt.toString().latin1()); 1722 //qDebug("file on disk version %s",dt.toString().latin1());
1723 if ( dt <= loadedFileVersion ) 1723 if ( dt <= loadedFileVersion )
1724 return true; 1724 return true;
1725 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , 1725 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) ,
1726 i18n("KO/Pi Warning"),i18n("Overwrite"), 1726 i18n("KO/Pi Warning"),i18n("Overwrite"),
1727 i18n("Sync+save")); 1727 i18n("Sync+save"));
1728 1728
1729 if ( km == KMessageBox::Cancel ) 1729 if ( km == KMessageBox::Cancel )
1730 return false; 1730 return false;
1731 if ( km == KMessageBox::Yes ) 1731 if ( km == KMessageBox::Yes )
1732 return true; 1732 return true;
1733 1733
1734 setSyncDevice("deleteaftersync" ); 1734 setSyncDevice("deleteaftersync" );
1735 mSyncManager->mAskForPreferences = true; 1735 mSyncManager->mAskForPreferences = true;
1736 mSyncManager->mSyncAlgoPrefs = 3; 1736 mSyncManager->mSyncAlgoPrefs = 3;
1737 mSyncManager->mWriteBackFile = false; 1737 mSyncManager->mWriteBackFile = false;
1738 mSyncManager->mWriteBackExistingOnly = false; 1738 mSyncManager->mWriteBackExistingOnly = false;
1739 mSyncManager->mShowSyncSummary = false; 1739 mSyncManager->mShowSyncSummary = false;
1740 syncCalendar( fn, 3 ); 1740 syncCalendar( fn, 3 );
1741 Event * e = getLastSyncEvent(); 1741 Event * e = getLastSyncEvent();
1742 mCalendar->deleteEvent ( e ); 1742 mCalendar->deleteEvent ( e );
1743 updateView(); 1743 updateView();
1744 return true; 1744 return true;
1745} 1745}
1746 1746
1747bool CalendarView::saveCalendar( QString filename ) 1747bool CalendarView::saveCalendar( QString filename )
1748{ 1748{
1749 1749
1750 // Store back all unsaved data into calendar object 1750 // Store back all unsaved data into calendar object
1751 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); 1751 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() );
1752 if ( mViewManager->currentView() ) 1752 if ( mViewManager->currentView() )
1753 mViewManager->currentView()->flushView(); 1753 mViewManager->currentView()->flushView();
1754 1754
1755 1755
1756 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); 1756 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2);
1757 mStorage->setSaveFormat( new ICalFormat() ); 1757 mStorage->setSaveFormat( new ICalFormat() );
1758 mStorage->setFileName( filename ); 1758 mStorage->setFileName( filename );
1759 bool success; 1759 bool success;
1760 success = mStorage->save(); 1760 success = mStorage->save();
1761 if ( !success ) { 1761 if ( !success ) {
1762 return false; 1762 return false;
1763 } 1763 }
1764 if ( filename == MainWindow::defaultFileName() ) { 1764 if ( filename == MainWindow::defaultFileName() ) {
1765 setLoadedFileVersion( lfv ); 1765 setLoadedFileVersion( lfv );
1766 watchSavedFile(); 1766 watchSavedFile();
1767 } 1767 }
1768 return true; 1768 return true;
1769} 1769}
1770 1770
1771void CalendarView::closeCalendar() 1771void CalendarView::closeCalendar()
1772{ 1772{
1773 1773
1774 // child windows no longer valid 1774 // child windows no longer valid
1775 emit closingDown(); 1775 emit closingDown();
1776 1776
1777 mCalendar->close(); 1777 mCalendar->close();
1778 setModified(false); 1778 setModified(false);
1779 updateView(); 1779 updateView();
1780} 1780}
1781 1781
1782void CalendarView::archiveCalendar() 1782void CalendarView::archiveCalendar()
1783{ 1783{
1784 mDialogManager->showArchiveDialog(); 1784 mDialogManager->showArchiveDialog();
1785} 1785}
1786 1786
1787 1787
1788void CalendarView::readSettings() 1788void CalendarView::readSettings()
1789{ 1789{
1790 1790
1791 1791
1792 // mViewManager->showAgendaView(); 1792 // mViewManager->showAgendaView();
1793 QString str; 1793 QString str;
1794 //qDebug("CalendarView::readSettings() "); 1794 //qDebug("CalendarView::readSettings() ");
1795 // read settings from the KConfig, supplying reasonable 1795 // read settings from the KConfig, supplying reasonable
1796 // defaults where none are to be found 1796 // defaults where none are to be found
1797 KConfig *config = KOGlobals::config(); 1797 KConfig *config = KOGlobals::config();
1798#ifndef KORG_NOSPLITTER 1798#ifndef KORG_NOSPLITTER
1799 config->setGroup("KOrganizer Geometry"); 1799 config->setGroup("KOrganizer Geometry");
1800 1800
1801 QValueList<int> sizes = config->readIntListEntry("Separator1"); 1801 QValueList<int> sizes = config->readIntListEntry("Separator1");
1802 if (sizes.count() != 2) { 1802 if (sizes.count() != 2) {
1803 sizes << mDateNavigator->minimumSizeHint().width(); 1803 sizes << mDateNavigator->minimumSizeHint().width();
1804 sizes << 300; 1804 sizes << 300;
1805 } 1805 }
1806 mPanner->setSizes(sizes); 1806 mPanner->setSizes(sizes);
1807 1807
1808 sizes = config->readIntListEntry("Separator2"); 1808 sizes = config->readIntListEntry("Separator2");
1809 if ( ( mResourceView && sizes.count() == 4 ) || 1809 if ( ( mResourceView && sizes.count() == 4 ) ||
1810 ( !mResourceView && sizes.count() == 3 ) ) { 1810 ( !mResourceView && sizes.count() == 3 ) ) {
1811 mLeftSplitter->setSizes(sizes); 1811 mLeftSplitter->setSizes(sizes);
1812 } 1812 }
1813#endif 1813#endif
1814 globalFlagBlockAgenda = 1; 1814 globalFlagBlockAgenda = 1;
1815 mViewManager->showAgendaView(); 1815 mViewManager->showAgendaView();
1816 //mViewManager->readSettings( config ); 1816 //mViewManager->readSettings( config );
1817 mTodoList->restoreLayout(config,QString("Todo Layout")); 1817 mTodoList->restoreLayout(config,QString("Todo Layout"));
1818 readFilterSettings(config); 1818 readFilterSettings(config);
1819 config->setGroup( "Views" ); 1819 config->setGroup( "Views" );
1820 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 1820 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
1821 if ( dateCount == 5 ) mNavigator->selectWorkWeek(); 1821 if ( dateCount == 5 ) mNavigator->selectWorkWeek();
1822 else if ( dateCount == 7 ) mNavigator->selectWeek(); 1822 else if ( dateCount == 7 ) mNavigator->selectWeek();
1823 else mNavigator->selectDates( dateCount ); 1823 else mNavigator->selectDates( dateCount );
1824 // mViewManager->readSettings( config ); 1824 // mViewManager->readSettings( config );
1825 updateConfig(); 1825 updateConfig();
1826 globalFlagBlockAgenda = 2; 1826 globalFlagBlockAgenda = 2;
1827 mViewManager->readSettings( config ); 1827 mViewManager->readSettings( config );
1828#ifdef DESKTOP_VERSION 1828#ifdef DESKTOP_VERSION
1829 config->setGroup("WidgetLayout"); 1829 config->setGroup("WidgetLayout");
1830 QStringList list; 1830 QStringList list;
1831 list = config->readListEntry("MainLayout"); 1831 list = config->readListEntry("MainLayout");
1832 int x,y,w,h; 1832 int x,y,w,h;
1833 if ( ! list.isEmpty() ) { 1833 if ( ! list.isEmpty() ) {
1834 x = list[0].toInt(); 1834 x = list[0].toInt();
1835 y = list[1].toInt(); 1835 y = list[1].toInt();
1836 w = list[2].toInt(); 1836 w = list[2].toInt();
1837 h = list[3].toInt(); 1837 h = list[3].toInt();
1838 topLevelWidget()->setGeometry(x,y,w,h); 1838 topLevelWidget()->setGeometry(x,y,w,h);
1839 1839
1840 } else { 1840 } else {
1841 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 1841 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
1842 } 1842 }
1843 list = config->readListEntry("EditEventLayout"); 1843 list = config->readListEntry("EditEventLayout");
1844 if ( ! list.isEmpty() ) { 1844 if ( ! list.isEmpty() ) {
1845 x = list[0].toInt(); 1845 x = list[0].toInt();
1846 y = list[1].toInt(); 1846 y = list[1].toInt();
1847 w = list[2].toInt(); 1847 w = list[2].toInt();
1848 h = list[3].toInt(); 1848 h = list[3].toInt();
1849 mEventEditor->setGeometry(x,y,w,h); 1849 mEventEditor->setGeometry(x,y,w,h);
1850 1850
1851 } 1851 }
1852 list = config->readListEntry("EditTodoLayout"); 1852 list = config->readListEntry("EditTodoLayout");
1853 if ( ! list.isEmpty() ) { 1853 if ( ! list.isEmpty() ) {
1854 x = list[0].toInt(); 1854 x = list[0].toInt();
1855 y = list[1].toInt(); 1855 y = list[1].toInt();
1856 w = list[2].toInt(); 1856 w = list[2].toInt();
1857 h = list[3].toInt(); 1857 h = list[3].toInt();
1858 mTodoEditor->setGeometry(x,y,w,h); 1858 mTodoEditor->setGeometry(x,y,w,h);
1859 1859
1860 } 1860 }
1861 list = config->readListEntry("ViewerLayout"); 1861 list = config->readListEntry("ViewerLayout");
1862 if ( ! list.isEmpty() ) { 1862 if ( ! list.isEmpty() ) {
1863 x = list[0].toInt(); 1863 x = list[0].toInt();
1864 y = list[1].toInt(); 1864 y = list[1].toInt();
1865 w = list[2].toInt(); 1865 w = list[2].toInt();
1866 h = list[3].toInt(); 1866 h = list[3].toInt();
1867 getEventViewerDialog()->setGeometry(x,y,w,h); 1867 getEventViewerDialog()->setGeometry(x,y,w,h);
1868 } 1868 }
1869#endif 1869#endif
1870 1870
1871} 1871}
1872 1872
1873 1873
1874void CalendarView::writeSettings() 1874void CalendarView::writeSettings()
1875{ 1875{
1876 // kdDebug() << "CalendarView::writeSettings" << endl; 1876 // kdDebug() << "CalendarView::writeSettings" << endl;
1877 1877
1878 KConfig *config = KOGlobals::config(); 1878 KConfig *config = KOGlobals::config();
1879 1879
1880#ifndef KORG_NOSPLITTER 1880#ifndef KORG_NOSPLITTER
1881 config->setGroup("KOrganizer Geometry"); 1881 config->setGroup("KOrganizer Geometry");
1882 1882
1883 QValueList<int> list = mPanner->sizes(); 1883 QValueList<int> list = mPanner->sizes();
1884 config->writeEntry("Separator1",list); 1884 config->writeEntry("Separator1",list);
1885 1885
1886 list = mLeftSplitter->sizes(); 1886 list = mLeftSplitter->sizes();
1887 config->writeEntry("Separator2",list); 1887 config->writeEntry("Separator2",list);
1888#endif 1888#endif
1889 1889
1890 mViewManager->writeSettings( config ); 1890 mViewManager->writeSettings( config );
1891 mTodoList->saveLayout(config,QString("Todo Layout")); 1891 mTodoList->saveLayout(config,QString("Todo Layout"));
1892 mDialogManager->writeSettings( config ); 1892 mDialogManager->writeSettings( config );
1893 //KOPrefs::instance()->usrWriteConfig(); 1893 //KOPrefs::instance()->usrWriteConfig();
1894 KOPrefs::instance()->writeConfig(); 1894 KOPrefs::instance()->writeConfig();
1895 1895
1896 writeFilterSettings(config); 1896 writeFilterSettings(config);
1897 1897
1898 config->setGroup( "Views" ); 1898 config->setGroup( "Views" );
1899 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); 1899 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
1900 1900
1901#ifdef DESKTOP_VERSION 1901#ifdef DESKTOP_VERSION
1902 config->setGroup("WidgetLayout"); 1902 config->setGroup("WidgetLayout");
1903 QStringList list ;//= config->readListEntry("MainLayout"); 1903 QStringList list ;//= config->readListEntry("MainLayout");
1904 int x,y,w,h; 1904 int x,y,w,h;
1905 QWidget* wid; 1905 QWidget* wid;
1906 wid = topLevelWidget(); 1906 wid = topLevelWidget();
1907 x = wid->geometry().x(); 1907 x = wid->geometry().x();
1908 y = wid->geometry().y(); 1908 y = wid->geometry().y();
1909 w = wid->width(); 1909 w = wid->width();
1910 h = wid->height(); 1910 h = wid->height();
1911 list.clear(); 1911 list.clear();
1912 list << QString::number( x ); 1912 list << QString::number( x );
1913 list << QString::number( y ); 1913 list << QString::number( y );
1914 list << QString::number( w ); 1914 list << QString::number( w );
1915 list << QString::number( h ); 1915 list << QString::number( h );
1916 config->writeEntry("MainLayout",list ); 1916 config->writeEntry("MainLayout",list );
1917 1917
1918 wid = mEventEditor; 1918 wid = mEventEditor;
1919 x = wid->geometry().x(); 1919 x = wid->geometry().x();
1920 y = wid->geometry().y(); 1920 y = wid->geometry().y();
1921 w = wid->width(); 1921 w = wid->width();
1922 h = wid->height(); 1922 h = wid->height();
1923 list.clear(); 1923 list.clear();
1924 list << QString::number( x ); 1924 list << QString::number( x );
1925 list << QString::number( y ); 1925 list << QString::number( y );
1926 list << QString::number( w ); 1926 list << QString::number( w );
1927 list << QString::number( h ); 1927 list << QString::number( h );
1928 config->writeEntry("EditEventLayout",list ); 1928 config->writeEntry("EditEventLayout",list );
1929 1929
1930 wid = mTodoEditor; 1930 wid = mTodoEditor;
1931 x = wid->geometry().x(); 1931 x = wid->geometry().x();
1932 y = wid->geometry().y(); 1932 y = wid->geometry().y();
1933 w = wid->width(); 1933 w = wid->width();
1934 h = wid->height(); 1934 h = wid->height();
1935 list.clear(); 1935 list.clear();
1936 list << QString::number( x ); 1936 list << QString::number( x );
1937 list << QString::number( y ); 1937 list << QString::number( y );
1938 list << QString::number( w ); 1938 list << QString::number( w );
1939 list << QString::number( h ); 1939 list << QString::number( h );
1940 config->writeEntry("EditTodoLayout",list ); 1940 config->writeEntry("EditTodoLayout",list );
1941 wid = getEventViewerDialog(); 1941 wid = getEventViewerDialog();
1942 x = wid->geometry().x(); 1942 x = wid->geometry().x();
1943 y = wid->geometry().y(); 1943 y = wid->geometry().y();
1944 w = wid->width(); 1944 w = wid->width();
1945 h = wid->height(); 1945 h = wid->height();
1946 list.clear(); 1946 list.clear();
1947 list << QString::number( x ); 1947 list << QString::number( x );
1948 list << QString::number( y ); 1948 list << QString::number( y );
1949 list << QString::number( w ); 1949 list << QString::number( w );
1950 list << QString::number( h ); 1950 list << QString::number( h );
1951 config->writeEntry("ViewerLayout",list ); 1951 config->writeEntry("ViewerLayout",list );
1952 wid = mDialogManager->getSearchDialog(); 1952 wid = mDialogManager->getSearchDialog();
1953 if ( wid ) { 1953 if ( wid ) {
1954 x = wid->geometry().x(); 1954 x = wid->geometry().x();
1955 y = wid->geometry().y(); 1955 y = wid->geometry().y();
1956 w = wid->width(); 1956 w = wid->width();
1957 h = wid->height(); 1957 h = wid->height();
1958 list.clear(); 1958 list.clear();
1959 list << QString::number( x ); 1959 list << QString::number( x );
1960 list << QString::number( y ); 1960 list << QString::number( y );
1961 list << QString::number( w ); 1961 list << QString::number( w );
1962 list << QString::number( h ); 1962 list << QString::number( h );
1963 config->writeEntry("SearchLayout",list ); 1963 config->writeEntry("SearchLayout",list );
1964 } 1964 }
1965#endif 1965#endif
1966 1966
1967 1967
1968 config->sync(); 1968 config->sync();
1969} 1969}
1970 1970
1971void CalendarView::readFilterSettings(KConfig *config) 1971void CalendarView::readFilterSettings(KConfig *config)
1972{ 1972{
1973 // kdDebug() << "CalendarView::readFilterSettings()" << endl; 1973 // kdDebug() << "CalendarView::readFilterSettings()" << endl;
1974 1974
1975 mFilters.clear(); 1975 mFilters.clear();
1976 1976
1977 config->setGroup("General"); 1977 config->setGroup("General");
1978 QStringList filterList = config->readListEntry("CalendarFilters"); 1978 QStringList filterList = config->readListEntry("CalendarFilters");
1979 1979
1980 QStringList::ConstIterator it = filterList.begin(); 1980 QStringList::ConstIterator it = filterList.begin();
1981 QStringList::ConstIterator end = filterList.end(); 1981 QStringList::ConstIterator end = filterList.end();
1982 while(it != end) { 1982 while(it != end) {
1983 // kdDebug() << " filter: " << (*it) << endl; 1983 // kdDebug() << " filter: " << (*it) << endl;
1984 1984
1985 CalFilter *filter; 1985 CalFilter *filter;
1986 filter = new CalFilter(*it); 1986 filter = new CalFilter(*it);
1987 config->setGroup("Filter_" + (*it)); 1987 config->setGroup("Filter_" + (*it));
1988 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); 1988 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) );
1989 filter->setCriteria(config->readNumEntry("Criteria",0)); 1989 filter->setCriteria(config->readNumEntry("Criteria",0));
1990 filter->setCategoryList(config->readListEntry("CategoryList")); 1990 filter->setCategoryList(config->readListEntry("CategoryList"));
1991 mFilters.append(filter); 1991 mFilters.append(filter);
1992 1992
1993 ++it; 1993 ++it;
1994 } 1994 }
1995 1995
1996 if (mFilters.count() == 0) { 1996 if (mFilters.count() == 0) {
1997 CalFilter *filter = new CalFilter(i18n("Default")); 1997 CalFilter *filter = new CalFilter(i18n("Default"));
1998 mFilters.append(filter); 1998 mFilters.append(filter);
1999 } 1999 }
2000 mFilterView->updateFilters(); 2000 mFilterView->updateFilters();
2001 config->setGroup("FilterView"); 2001 config->setGroup("FilterView");
2002 2002
2003 mFilterView->blockSignals(true); 2003 mFilterView->blockSignals(true);
2004 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); 2004 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled"));
2005 mFilterView->setSelectedFilter(config->readEntry("Current Filter")); 2005 mFilterView->setSelectedFilter(config->readEntry("Current Filter"));
2006 mFilterView->blockSignals(false); 2006 mFilterView->blockSignals(false);
2007 // We do it manually to avoid it being done twice by the above calls 2007 // We do it manually to avoid it being done twice by the above calls
2008 updateFilter(); 2008 updateFilter();
2009} 2009}
2010 2010
2011void CalendarView::writeFilterSettings(KConfig *config) 2011void CalendarView::writeFilterSettings(KConfig *config)
2012{ 2012{
2013 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 2013 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
2014 2014
2015 QStringList filterList; 2015 QStringList filterList;
2016 2016
2017 CalFilter *filter = mFilters.first(); 2017 CalFilter *filter = mFilters.first();
2018 while(filter) { 2018 while(filter) {
2019 // kdDebug() << " fn: " << filter->name() << endl; 2019 // kdDebug() << " fn: " << filter->name() << endl;
2020 filterList << filter->name(); 2020 filterList << filter->name();
2021 config->setGroup("Filter_" + filter->name()); 2021 config->setGroup("Filter_" + filter->name());
2022 config->writeEntry("Criteria",filter->criteria()); 2022 config->writeEntry("Criteria",filter->criteria());
2023 config->writeEntry("CategoryList",filter->categoryList()); 2023 config->writeEntry("CategoryList",filter->categoryList());
2024 filter = mFilters.next(); 2024 filter = mFilters.next();
2025 } 2025 }
2026 config->setGroup("General"); 2026 config->setGroup("General");
2027 config->writeEntry("CalendarFilters",filterList); 2027 config->writeEntry("CalendarFilters",filterList);
2028 2028
2029 config->setGroup("FilterView"); 2029 config->setGroup("FilterView");
2030 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 2030 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
2031 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 2031 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
2032} 2032}
2033 2033
2034 2034
2035void CalendarView::goToday() 2035void CalendarView::goToday()
2036{ 2036{
2037 if ( mViewManager->currentView()->isMonthView() ) 2037 if ( mViewManager->currentView()->isMonthView() )
2038 mNavigator->selectTodayMonth(); 2038 mNavigator->selectTodayMonth();
2039 else 2039 else
2040 mNavigator->selectToday(); 2040 mNavigator->selectToday();
2041} 2041}
2042 2042
2043void CalendarView::goNext() 2043void CalendarView::goNext()
2044{ 2044{
2045 mNavigator->selectNext(); 2045 mNavigator->selectNext();
2046} 2046}
2047 2047
2048void CalendarView::goPrevious() 2048void CalendarView::goPrevious()
2049{ 2049{
2050 mNavigator->selectPrevious(); 2050 mNavigator->selectPrevious();
2051} 2051}
2052void CalendarView::goNextMonth() 2052void CalendarView::goNextMonth()
2053{ 2053{
2054 mNavigator->selectNextMonth(); 2054 mNavigator->selectNextMonth();
2055} 2055}
2056 2056
2057void CalendarView::goPreviousMonth() 2057void CalendarView::goPreviousMonth()
2058{ 2058{
2059 mNavigator->selectPreviousMonth(); 2059 mNavigator->selectPreviousMonth();
2060} 2060}
2061void CalendarView::writeLocale() 2061void CalendarView::writeLocale()
2062{ 2062{
2063 //KPimGlobalPrefs::instance()->setGlobalConfig(); 2063 //KPimGlobalPrefs::instance()->setGlobalConfig();
2064#if 0 2064#if 0
2065 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); 2065 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
2066 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); 2066 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
2067 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); 2067 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
2068 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); 2068 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
2069 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 2069 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
2070 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 2070 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
2071 dummy = KOPrefs::instance()->mUserDateFormatShort; 2071 dummy = KOPrefs::instance()->mUserDateFormatShort;
2072 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 2072 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
2073 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 2073 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
2074 KOPrefs::instance()->mDaylightsavingStart, 2074 KOPrefs::instance()->mDaylightsavingStart,
2075 KOPrefs::instance()->mDaylightsavingEnd ); 2075 KOPrefs::instance()->mDaylightsavingEnd );
2076 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); 2076 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId );
2077#endif 2077#endif
2078} 2078}
2079void CalendarView::updateConfig() 2079void CalendarView::updateConfig()
2080{ 2080{
2081 writeLocale(); 2081 writeLocale();
2082 if ( KOPrefs::instance()->mUseAppColors ) 2082 if ( KOPrefs::instance()->mUseAppColors )
2083 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2083 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2084 emit configChanged(); 2084 emit configChanged();
2085 mTodoList->updateConfig(); 2085 mTodoList->updateConfig();
2086 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2086 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2087 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2087 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2088 // To make the "fill window" configurations work 2088 // To make the "fill window" configurations work
2089 //mViewManager->raiseCurrentView(); 2089 //mViewManager->raiseCurrentView();
2090} 2090}
2091 2091
2092 2092
2093void CalendarView::eventChanged(Event *event) 2093void CalendarView::eventChanged(Event *event)
2094{ 2094{
2095 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2095 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2096 //updateUnmanagedViews(); 2096 //updateUnmanagedViews();
2097} 2097}
2098 2098
2099void CalendarView::eventAdded(Event *event) 2099void CalendarView::eventAdded(Event *event)
2100{ 2100{
2101 changeEventDisplay(event,KOGlobals::EVENTADDED); 2101 changeEventDisplay(event,KOGlobals::EVENTADDED);
2102} 2102}
2103 2103
2104void CalendarView::eventToBeDeleted(Event *) 2104void CalendarView::eventToBeDeleted(Event *)
2105{ 2105{
2106 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2106 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2107} 2107}
2108 2108
2109void CalendarView::eventDeleted() 2109void CalendarView::eventDeleted()
2110{ 2110{
2111 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2111 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2112} 2112}
2113void CalendarView::changeTodoDisplay(Todo *which, int action) 2113void CalendarView::changeTodoDisplay(Todo *which, int action)
2114{ 2114{
2115 changeIncidenceDisplay((Incidence *)which, action); 2115 changeIncidenceDisplay((Incidence *)which, action);
2116 mDateNavigator->updateView(); //LR 2116 mDateNavigator->updateView(); //LR
2117 //mDialogManager->updateSearchDialog(); 2117 //mDialogManager->updateSearchDialog();
2118 2118
2119 if (which) { 2119 if (which) {
2120 mViewManager->updateWNview(); 2120 mViewManager->updateWNview();
2121 //mTodoList->updateView(); 2121 //mTodoList->updateView();
2122 } 2122 }
2123 2123
2124} 2124}
2125 2125
2126void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2126void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2127{ 2127{
2128 updateUnmanagedViews(); 2128 updateUnmanagedViews();
2129 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2129 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2130 if ( action == KOGlobals::EVENTDELETED ) { //delete 2130 if ( action == KOGlobals::EVENTDELETED ) { //delete
2131 mCalendar->checkAlarmForIncidence( 0, true ); 2131 mCalendar->checkAlarmForIncidence( 0, true );
2132 if ( mEventViewerDialog ) 2132 if ( mEventViewerDialog )
2133 mEventViewerDialog->hide(); 2133 mEventViewerDialog->hide();
2134 } 2134 }
2135 else 2135 else
2136 mCalendar->checkAlarmForIncidence( which , false ); 2136 mCalendar->checkAlarmForIncidence( which , false );
2137} 2137}
2138 2138
2139// most of the changeEventDisplays() right now just call the view's 2139// most of the changeEventDisplays() right now just call the view's
2140// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2140// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2141void CalendarView::changeEventDisplay(Event *which, int action) 2141void CalendarView::changeEventDisplay(Event *which, int action)
2142{ 2142{
2143 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2143 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2144 changeIncidenceDisplay((Incidence *)which, action); 2144 changeIncidenceDisplay((Incidence *)which, action);
2145 mDateNavigator->updateView(); 2145 mDateNavigator->updateView();
2146 //mDialogManager->updateSearchDialog(); 2146 //mDialogManager->updateSearchDialog();
2147 2147
2148 if (which) { 2148 if (which) {
2149 // If there is an event view visible update the display 2149 // If there is an event view visible update the display
2150 mViewManager->currentView()->changeEventDisplay(which,action); 2150 mViewManager->currentView()->changeEventDisplay(which,action);
2151 // TODO: check, if update needed 2151 // TODO: check, if update needed
2152 // if (which->getTodoStatus()) { 2152 // if (which->getTodoStatus()) {
2153 mTodoList->updateView(); 2153 mTodoList->updateView();
2154 // } 2154 // }
2155 } else { 2155 } else {
2156 mViewManager->currentView()->updateView(); 2156 mViewManager->currentView()->updateView();
2157 } 2157 }
2158} 2158}
2159 2159
2160 2160
2161void CalendarView::updateTodoViews() 2161void CalendarView::updateTodoViews()
2162{ 2162{
2163 2163
2164 mTodoList->updateView(); 2164 mTodoList->updateView();
2165 mViewManager->currentView()->updateView(); 2165 mViewManager->currentView()->updateView();
2166 2166
2167} 2167}
2168 2168
2169 2169
2170void CalendarView::updateView(const QDate &start, const QDate &end) 2170void CalendarView::updateView(const QDate &start, const QDate &end)
2171{ 2171{
2172 mTodoList->updateView(); 2172 mTodoList->updateView();
2173 mViewManager->updateView(start, end); 2173 mViewManager->updateView(start, end);
2174 //mDateNavigator->updateView(); 2174 //mDateNavigator->updateView();
2175} 2175}
2176 2176
2177void CalendarView::updateView() 2177void CalendarView::updateView()
2178{ 2178{
2179 DateList tmpList = mNavigator->selectedDates(); 2179 DateList tmpList = mNavigator->selectedDates();
2180 2180
2181 if ( KOPrefs::instance()->mHideNonStartedTodos ) 2181 if ( KOPrefs::instance()->mHideNonStartedTodos )
2182 mTodoList->updateView(); 2182 mTodoList->updateView();
2183 // We assume that the navigator only selects consecutive days. 2183 // We assume that the navigator only selects consecutive days.
2184 updateView( tmpList.first(), tmpList.last() ); 2184 updateView( tmpList.first(), tmpList.last() );
2185} 2185}
2186 2186
2187void CalendarView::updateUnmanagedViews() 2187void CalendarView::updateUnmanagedViews()
2188{ 2188{
2189 mDateNavigator->updateDayMatrix(); 2189 mDateNavigator->updateDayMatrix();
2190} 2190}
2191 2191
2192int CalendarView::msgItemDelete(const QString name) 2192int CalendarView::msgItemDelete(const QString name)
2193{ 2193{
2194 return KMessageBox::warningContinueCancel(this,name +"\n\n"+ 2194 return KMessageBox::warningContinueCancel(this,name +"\n\n"+
2195 i18n("This item will be\npermanently deleted."), 2195 i18n("This item will be\npermanently deleted."),
2196 i18n("KO/Pi Confirmation"),i18n("Delete")); 2196 i18n("KO/Pi Confirmation"),i18n("Delete"));
2197} 2197}
2198 2198
2199 2199
2200void CalendarView::edit_cut() 2200void CalendarView::edit_cut()
2201{ 2201{
2202 Event *anEvent=0; 2202 Event *anEvent=0;
2203 2203
2204 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2204 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2205 2205
2206 if (mViewManager->currentView()->isEventView()) { 2206 if (mViewManager->currentView()->isEventView()) {
2207 if ( incidence && incidence->type() == "Event" ) { 2207 if ( incidence && incidence->type() == "Event" ) {
2208 anEvent = static_cast<Event *>(incidence); 2208 anEvent = static_cast<Event *>(incidence);
2209 } 2209 }
2210 } 2210 }
2211 2211
2212 if (!anEvent) { 2212 if (!anEvent) {
2213 KNotifyClient::beep(); 2213 KNotifyClient::beep();
2214 return; 2214 return;
2215 } 2215 }
2216 DndFactory factory( mCalendar ); 2216 DndFactory factory( mCalendar );
2217 factory.cutEvent(anEvent); 2217 factory.cutEvent(anEvent);
2218 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2218 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2219} 2219}
2220 2220
2221void CalendarView::edit_copy() 2221void CalendarView::edit_copy()
2222{ 2222{
2223 Event *anEvent=0; 2223 Event *anEvent=0;
2224 2224
2225 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2225 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2226 2226
2227 if (mViewManager->currentView()->isEventView()) { 2227 if (mViewManager->currentView()->isEventView()) {
2228 if ( incidence && incidence->type() == "Event" ) { 2228 if ( incidence && incidence->type() == "Event" ) {
2229 anEvent = static_cast<Event *>(incidence); 2229 anEvent = static_cast<Event *>(incidence);
2230 } 2230 }
2231 } 2231 }
2232 2232
2233 if (!anEvent) { 2233 if (!anEvent) {
2234 KNotifyClient::beep(); 2234 KNotifyClient::beep();
2235 return; 2235 return;
2236 } 2236 }
2237 DndFactory factory( mCalendar ); 2237 DndFactory factory( mCalendar );
2238 factory.copyEvent(anEvent); 2238 factory.copyEvent(anEvent);
2239} 2239}
2240 2240
2241void CalendarView::edit_paste() 2241void CalendarView::edit_paste()
2242{ 2242{
2243 QDate date = mNavigator->selectedDates().first(); 2243 QDate date = mNavigator->selectedDates().first();
2244 2244
2245 DndFactory factory( mCalendar ); 2245 DndFactory factory( mCalendar );
2246 Event *pastedEvent = factory.pasteEvent( date ); 2246 Event *pastedEvent = factory.pasteEvent( date );
2247 2247
2248 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2248 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2249} 2249}
2250 2250
2251void CalendarView::edit_options() 2251void CalendarView::edit_options()
2252{ 2252{
2253 mDialogManager->showOptionsDialog(); 2253 mDialogManager->showOptionsDialog();
2254 //writeSettings(); 2254 //writeSettings();
2255} 2255}
2256 2256
2257 2257
2258void CalendarView::slotSelectPickerDate( QDate d) 2258void CalendarView::slotSelectPickerDate( QDate d)
2259{ 2259{
2260 mDateFrame->hide(); 2260 mDateFrame->hide();
2261 if ( mDatePickerMode == 1 ) { 2261 if ( mDatePickerMode == 1 ) {
2262 mNavigator->slotDaySelect( d ); 2262 mNavigator->slotDaySelect( d );
2263 } else if ( mDatePickerMode == 2 ) { 2263 } else if ( mDatePickerMode == 2 ) {
2264 if ( mMoveIncidence->type() == "Todo" ) { 2264 if ( mMoveIncidence->type() == "Todo" ) {
2265 Todo * to = (Todo *) mMoveIncidence; 2265 Todo * to = (Todo *) mMoveIncidence;
2266 QTime tim; 2266 QTime tim;
2267 if ( to->hasDueDate() ) 2267 if ( to->hasDueDate() )
2268 tim = to->dtDue().time(); 2268 tim = to->dtDue().time();
2269 else { 2269 else {
2270 tim = QTime ( 0,0,0 ); 2270 tim = QTime ( 0,0,0 );
2271 to->setFloats( true ); 2271 to->setFloats( true );
2272 to->setHasDueDate( true ); 2272 to->setHasDueDate( true );
2273 } 2273 }
2274 QDateTime dt ( d,tim ); 2274 QDateTime dt ( d,tim );
2275 to->setDtDue( dt ); 2275 to->setDtDue( dt );
2276 todoChanged( to ); 2276 todoChanged( to );
2277 } else { 2277 } else {
2278 if ( mMoveIncidence->doesRecur() ) { 2278 if ( mMoveIncidence->doesRecur() ) {
2279#if 0 2279#if 0
2280 // PENDING implement this 2280 // PENDING implement this
2281 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); 2281 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate );
2282 mCalendar()->addIncidence( newInc ); 2282 mCalendar()->addIncidence( newInc );
2283 if ( mMoveIncidence->type() == "Todo" ) 2283 if ( mMoveIncidence->type() == "Todo" )
2284 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); 2284 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
2285 else 2285 else
2286 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); 2286 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED);
2287 mMoveIncidence = newInc; 2287 mMoveIncidence = newInc;
2288 2288
2289#endif 2289#endif
2290 } 2290 }
2291 QTime tim = mMoveIncidence->dtStart().time(); 2291 QTime tim = mMoveIncidence->dtStart().time();
2292 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2292 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2293 QDateTime dt ( d,tim ); 2293 QDateTime dt ( d,tim );
2294 mMoveIncidence->setDtStart( dt ); 2294 mMoveIncidence->setDtStart( dt );
2295 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2295 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2296 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2296 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2297 } 2297 }
2298 2298
2299 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2299 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2300 } 2300 }
2301} 2301}
2302 2302
2303void CalendarView::removeCategories() 2303void CalendarView::removeCategories()
2304{ 2304{
2305 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2305 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2306 QStringList catList = KOPrefs::instance()->mCustomCategories; 2306 QStringList catList = KOPrefs::instance()->mCustomCategories;
2307 QStringList catIncList; 2307 QStringList catIncList;
2308 QStringList newCatList; 2308 QStringList newCatList;
2309 Incidence* inc = incList.first(); 2309 Incidence* inc = incList.first();
2310 int i; 2310 int i;
2311 int count = 0; 2311 int count = 0;
2312 while ( inc ) { 2312 while ( inc ) {
2313 newCatList.clear(); 2313 newCatList.clear();
2314 catIncList = inc->categories() ; 2314 catIncList = inc->categories() ;
2315 for( i = 0; i< catIncList.count(); ++i ) { 2315 for( i = 0; i< catIncList.count(); ++i ) {
2316 if ( catList.contains (catIncList[i])) 2316 if ( catList.contains (catIncList[i]))
2317 newCatList.append( catIncList[i] ); 2317 newCatList.append( catIncList[i] );
2318 } 2318 }
2319 newCatList.sort(); 2319 newCatList.sort();
2320 inc->setCategories( newCatList.join(",") ); 2320 inc->setCategories( newCatList.join(",") );
2321 inc = incList.next(); 2321 inc = incList.next();
2322 } 2322 }
2323} 2323}
2324 2324
2325int CalendarView::addCategories() 2325int CalendarView::addCategories()
2326{ 2326{
2327 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2327 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2328 QStringList catList = KOPrefs::instance()->mCustomCategories; 2328 QStringList catList = KOPrefs::instance()->mCustomCategories;
2329 QStringList catIncList; 2329 QStringList catIncList;
2330 Incidence* inc = incList.first(); 2330 Incidence* inc = incList.first();
2331 int i; 2331 int i;
2332 int count = 0; 2332 int count = 0;
2333 while ( inc ) { 2333 while ( inc ) {
2334 catIncList = inc->categories() ; 2334 catIncList = inc->categories() ;
2335 for( i = 0; i< catIncList.count(); ++i ) { 2335 for( i = 0; i< catIncList.count(); ++i ) {
2336 if ( !catList.contains (catIncList[i])) { 2336 if ( !catList.contains (catIncList[i])) {
2337 catList.append( catIncList[i] ); 2337 catList.append( catIncList[i] );
2338 //qDebug("add cat %s ", catIncList[i].latin1()); 2338 //qDebug("add cat %s ", catIncList[i].latin1());
2339 ++count; 2339 ++count;
2340 } 2340 }
2341 } 2341 }
2342 inc = incList.next(); 2342 inc = incList.next();
2343 } 2343 }
2344 catList.sort(); 2344 catList.sort();
2345 KOPrefs::instance()->mCustomCategories = catList; 2345 KOPrefs::instance()->mCustomCategories = catList;
2346 return count; 2346 return count;
2347} 2347}
2348 2348
2349void CalendarView::manageCategories() 2349void CalendarView::manageCategories()
2350{ 2350{
2351 KOCatPrefs* cp = new KOCatPrefs(); 2351 KOCatPrefs* cp = new KOCatPrefs();
2352 cp->show(); 2352 cp->show();
2353 int w =cp->sizeHint().width() ; 2353 int w =cp->sizeHint().width() ;
2354 int h = cp->sizeHint().height() ; 2354 int h = cp->sizeHint().height() ;
2355 int dw = QApplication::desktop()->width(); 2355 int dw = QApplication::desktop()->width();
2356 int dh = QApplication::desktop()->height(); 2356 int dh = QApplication::desktop()->height();
2357 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2357 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2358 if ( !cp->exec() ) { 2358 if ( !cp->exec() ) {
2359 delete cp; 2359 delete cp;
2360 return; 2360 return;
2361 } 2361 }
2362 int count = 0; 2362 int count = 0;
2363 if ( cp->addCat() ) { 2363 if ( cp->addCat() ) {
2364 count = addCategories(); 2364 count = addCategories();
2365 if ( count ) { 2365 if ( count ) {
2366 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2366 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2367 writeSettings(); 2367 writeSettings();
2368 } else 2368 } else
2369 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); 2369 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! "));
2370 } else { 2370 } else {
2371 removeCategories(); 2371 removeCategories();
2372 updateView(); 2372 updateView();
2373 } 2373 }
2374 delete cp; 2374 delete cp;
2375} 2375}
2376 2376
2377void CalendarView::beamIncidence(Incidence * Inc) 2377void CalendarView::beamIncidence(Incidence * Inc)
2378{ 2378{
2379 QPtrList<Incidence> delSel ; 2379 QPtrList<Incidence> delSel ;
2380 delSel.append(Inc); 2380 delSel.append(Inc);
2381 beamIncidenceList( delSel ); 2381 beamIncidenceList( delSel );
2382} 2382}
2383void CalendarView::beamCalendar() 2383void CalendarView::beamCalendar()
2384{ 2384{
2385 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2385 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2386 //qDebug("beamCalendar() "); 2386 //qDebug("beamCalendar() ");
2387 beamIncidenceList( delSel ); 2387 beamIncidenceList( delSel );
2388} 2388}
2389void CalendarView::beamFilteredCalendar() 2389void CalendarView::beamFilteredCalendar()
2390{ 2390{
2391 QPtrList<Incidence> delSel = mCalendar->incidences(); 2391 QPtrList<Incidence> delSel = mCalendar->incidences();
2392 //qDebug("beamFilteredCalendar() "); 2392 //qDebug("beamFilteredCalendar() ");
2393 beamIncidenceList( delSel ); 2393 beamIncidenceList( delSel );
2394} 2394}
2395void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2395void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2396{ 2396{
2397 if ( beamDialog->exec () == QDialog::Rejected ) 2397 if ( beamDialog->exec () == QDialog::Rejected )
2398 return; 2398 return;
2399#ifdef DESKTOP_VERSION 2399#ifdef DESKTOP_VERSION
2400 QString fn = locateLocal( "tmp", "kopibeamfile" ); 2400 QString fn = locateLocal( "tmp", "kopibeamfile" );
2401#else 2401#else
2402 QString fn = "/tmp/kopibeamfile"; 2402 QString fn = "/tmp/kopibeamfile";
2403#endif 2403#endif
2404 QString mes; 2404 QString mes;
2405 bool createbup = true; 2405 bool createbup = true;
2406 if ( createbup ) { 2406 if ( createbup ) {
2407 QString description = "\n"; 2407 QString description = "\n";
2408 CalendarLocal* cal = new CalendarLocal(); 2408 CalendarLocal* cal = new CalendarLocal();
2409 if ( beamDialog->beamLocal() ) 2409 if ( beamDialog->beamLocal() )
2410 cal->setLocalTime(); 2410 cal->setLocalTime();
2411 else 2411 else
2412 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2412 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2413 Incidence *incidence = delSel.first(); 2413 Incidence *incidence = delSel.first();
2414 bool addText = false; 2414 bool addText = false;
2415 if ( delSel.count() < 10 ) 2415 if ( delSel.count() < 10 )
2416 addText = true; 2416 addText = true;
2417 else { 2417 else {
2418 description.sprintf(i18n(" %d items?"),delSel.count() ); 2418 description.sprintf(i18n(" %d items?"),delSel.count() );
2419 } 2419 }
2420 while ( incidence ) { 2420 while ( incidence ) {
2421 Incidence *in = incidence->clone(); 2421 Incidence *in = incidence->clone();
2422 if ( ! in->summary().isEmpty() ) { 2422 if ( ! in->summary().isEmpty() ) {
2423 in->setDescription(""); 2423 in->setDescription("");
2424 } else { 2424 } else {
2425 in->setSummary( in->description().left(20)); 2425 in->setSummary( in->description().left(20));
2426 in->setDescription(""); 2426 in->setDescription("");
2427 } 2427 }
2428 if ( addText ) 2428 if ( addText )
2429 description += in->summary() + "\n"; 2429 description += in->summary() + "\n";
2430 cal->addIncidence( in ); 2430 cal->addIncidence( in );
2431 incidence = delSel.next(); 2431 incidence = delSel.next();
2432 } 2432 }
2433 if ( beamDialog->beamVcal() ) { 2433 if ( beamDialog->beamVcal() ) {
2434 fn += ".vcs"; 2434 fn += ".vcs";
2435 FileStorage storage( cal, fn, new VCalFormat ); 2435 FileStorage storage( cal, fn, new VCalFormat );
2436 storage.save(); 2436 storage.save();
2437 } else { 2437 } else {
2438 fn += ".ics"; 2438 fn += ".ics";
2439 FileStorage storage( cal, fn, new ICalFormat( ) ); 2439 FileStorage storage( cal, fn, new ICalFormat( ) );
2440 storage.save(); 2440 storage.save();
2441 } 2441 }
2442 delete cal; 2442 delete cal;
2443 mes = i18n("KO/Pi: Ready for beaming"); 2443 mes = i18n("KO/Pi: Ready for beaming");
2444 topLevelWidget()->setCaption(mes); 2444 topLevelWidget()->setCaption(mes);
2445 KApplication::convert2latin1( fn ); 2445 KApplication::convert2latin1( fn );
2446#ifndef DESKTOP_VERSION 2446#ifndef DESKTOP_VERSION
2447 Ir *ir = new Ir( this ); 2447 Ir *ir = new Ir( this );
2448 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2448 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2449 ir->send( fn, description, "text/x-vCalendar" ); 2449 ir->send( fn, description, "text/x-vCalendar" );
2450#endif 2450#endif
2451 } 2451 }
2452} 2452}
2453void CalendarView::beamDone( Ir *ir ) 2453void CalendarView::beamDone( Ir *ir )
2454{ 2454{
2455#ifndef DESKTOP_VERSION 2455#ifndef DESKTOP_VERSION
2456 delete ir; 2456 delete ir;
2457#endif 2457#endif
2458 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); 2458 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
2459 topLevelWidget()->raise(); 2459 topLevelWidget()->raise();
2460} 2460}
2461 2461
2462void CalendarView::moveIncidence(Incidence * inc ) 2462void CalendarView::moveIncidence(Incidence * inc )
2463{ 2463{
2464 if ( !inc ) return; 2464 if ( !inc ) return;
2465 // qDebug("showDatePickerForIncidence( ) "); 2465 // qDebug("showDatePickerForIncidence( ) ");
2466 if ( mDateFrame->isVisible() ) 2466 if ( mDateFrame->isVisible() )
2467 mDateFrame->hide(); 2467 mDateFrame->hide();
2468 else { 2468 else {
2469 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; 2469 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ;
2470 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; 2470 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ;
2471 int dw = QApplication::desktop()->width(); 2471 int dw = QApplication::desktop()->width();
2472 int dh = QApplication::desktop()->height(); 2472 int dh = QApplication::desktop()->height();
2473 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2473 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2474 mDateFrame->show(); 2474 mDateFrame->show();
2475 } 2475 }
2476 mDatePickerMode = 2; 2476 mDatePickerMode = 2;
2477 mMoveIncidence = inc ; 2477 mMoveIncidence = inc ;
2478 QDate da; 2478 QDate da;
2479 if ( mMoveIncidence->type() == "Todo" ) { 2479 if ( mMoveIncidence->type() == "Todo" ) {
2480 Todo * to = (Todo *) mMoveIncidence; 2480 Todo * to = (Todo *) mMoveIncidence;
2481 if ( to->hasDueDate() ) 2481 if ( to->hasDueDate() )
2482 da = to->dtDue().date(); 2482 da = to->dtDue().date();
2483 else 2483 else
2484 da = QDate::currentDate(); 2484 da = QDate::currentDate();
2485 } else { 2485 } else {
2486 da = mMoveIncidence->dtStart().date(); 2486 da = mMoveIncidence->dtStart().date();
2487 } 2487 }
2488 //PENDING set date for recurring incidence to date of recurrence 2488 //PENDING set date for recurring incidence to date of recurrence
2489 //mMoveIncidenceOldDate; 2489 //mMoveIncidenceOldDate;
2490 mDatePicker->setDate( da ); 2490 mDatePicker->setDate( da );
2491} 2491}
2492void CalendarView::showDatePicker( ) 2492void CalendarView::showDatePicker( )
2493{ 2493{
2494 //qDebug("CalendarView::showDatePicker( ) "); 2494 //qDebug("CalendarView::showDatePicker( ) ");
2495 if ( mDateFrame->isVisible() ) 2495 if ( mDateFrame->isVisible() )
2496 mDateFrame->hide(); 2496 mDateFrame->hide();
2497 else { 2497 else {
2498 int w =mDatePicker->sizeHint().width() ; 2498 int w =mDatePicker->sizeHint().width() ;
2499 int h = mDatePicker->sizeHint().height() ; 2499 int h = mDatePicker->sizeHint().height() ;
2500 int dw = QApplication::desktop()->width(); 2500 int dw = QApplication::desktop()->width();
2501 int dh = QApplication::desktop()->height(); 2501 int dh = QApplication::desktop()->height();
2502 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2502 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2503 mDateFrame->show(); 2503 mDateFrame->show();
2504 } 2504 }
2505 mDatePickerMode = 1; 2505 mDatePickerMode = 1;
2506 mDatePicker->setDate( mNavigator->selectedDates().first() ); 2506 mDatePicker->setDate( mNavigator->selectedDates().first() );
2507} 2507}
2508 2508
2509void CalendarView::showEventEditor() 2509void CalendarView::showEventEditor()
2510{ 2510{
2511#ifdef DESKTOP_VERSION 2511#ifdef DESKTOP_VERSION
2512 mEventEditor->show(); 2512 mEventEditor->show();
2513#else 2513#else
2514 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { 2514 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) {
2515 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 2515 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2516 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); 2516 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() );
2517 qApp->processEvents(); 2517 qApp->processEvents();
2518 delete mEventEditor; 2518 delete mEventEditor;
2519 mEventEditor = mDialogManager->getEventEditor(); 2519 mEventEditor = mDialogManager->getEventEditor();
2520 topLevelWidget()->setCaption( i18n("") ); 2520 topLevelWidget()->setCaption( i18n("") );
2521 } 2521 }
2522 mEventEditor->showMaximized(); 2522 mEventEditor->showMaximized();
2523#endif 2523#endif
2524} 2524}
2525void CalendarView::showTodoEditor() 2525void CalendarView::showTodoEditor()
2526{ 2526{
2527#ifdef DESKTOP_VERSION 2527#ifdef DESKTOP_VERSION
2528 mTodoEditor->show(); 2528 mTodoEditor->show();
2529#else 2529#else
2530 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { 2530 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) {
2531 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 2531 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2532 qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); 2532 qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() );
2533 qApp->processEvents(); 2533 qApp->processEvents();
2534 delete mTodoEditor; 2534 delete mTodoEditor;
2535 mTodoEditor = mDialogManager->getTodoEditor(); 2535 mTodoEditor = mDialogManager->getTodoEditor();
2536 topLevelWidget()->setCaption( i18n("") ); 2536 topLevelWidget()->setCaption( i18n("") );
2537 } 2537 }
2538 mTodoEditor->showMaximized(); 2538 mTodoEditor->showMaximized();
2539#endif 2539#endif
2540} 2540}
2541 2541
2542void CalendarView::cloneIncidence() 2542void CalendarView::cloneIncidence()
2543{ 2543{
2544 Incidence *incidence = currentSelection(); 2544 Incidence *incidence = currentSelection();
2545 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2545 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2546 if ( incidence ) { 2546 if ( incidence ) {
2547 cloneIncidence(incidence); 2547 cloneIncidence(incidence);
2548 } 2548 }
2549} 2549}
2550void CalendarView::moveIncidence() 2550void CalendarView::moveIncidence()
2551{ 2551{
2552 Incidence *incidence = currentSelection(); 2552 Incidence *incidence = currentSelection();
2553 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2553 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2554 if ( incidence ) { 2554 if ( incidence ) {
2555 moveIncidence(incidence); 2555 moveIncidence(incidence);
2556 } 2556 }
2557} 2557}
2558void CalendarView::beamIncidence() 2558void CalendarView::beamIncidence()
2559{ 2559{
2560 Incidence *incidence = currentSelection(); 2560 Incidence *incidence = currentSelection();
2561 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2561 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2562 if ( incidence ) { 2562 if ( incidence ) {
2563 beamIncidence(incidence); 2563 beamIncidence(incidence);
2564 } 2564 }
2565} 2565}
2566void CalendarView::toggleCancelIncidence() 2566void CalendarView::toggleCancelIncidence()
2567{ 2567{
2568 Incidence *incidence = currentSelection(); 2568 Incidence *incidence = currentSelection();
2569 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2569 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2570 if ( incidence ) { 2570 if ( incidence ) {
2571 cancelIncidence(incidence); 2571 cancelIncidence(incidence);
2572 } 2572 }
2573} 2573}
2574 2574
2575 2575
2576void CalendarView::cancelIncidence(Incidence * inc ) 2576void CalendarView::cancelIncidence(Incidence * inc )
2577{ 2577{
2578 inc->setCancelled( ! inc->cancelled() ); 2578 inc->setCancelled( ! inc->cancelled() );
2579 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); 2579 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED );
2580 updateView(); 2580 updateView();
2581} 2581}
2582void CalendarView::cloneIncidence(Incidence * orgInc ) 2582void CalendarView::cloneIncidence(Incidence * orgInc )
2583{ 2583{
2584 Incidence * newInc = orgInc->clone(); 2584 Incidence * newInc = orgInc->clone();
2585 newInc->recreate(); 2585 newInc->recreate();
2586 2586
2587 if ( newInc->type() == "Todo" ) { 2587 if ( newInc->type() == "Todo" ) {
2588 Todo* t = (Todo*) newInc; 2588 Todo* t = (Todo*) newInc;
2589 showTodoEditor(); 2589 showTodoEditor();
2590 mTodoEditor->editTodo( t ); 2590 mTodoEditor->editTodo( t );
2591 if ( mTodoEditor->exec() ) { 2591 if ( mTodoEditor->exec() ) {
2592 mCalendar->addTodo( t ); 2592 mCalendar->addTodo( t );
2593 updateView(); 2593 updateView();
2594 } else { 2594 } else {
2595 delete t; 2595 delete t;
2596 } 2596 }
2597 } 2597 }
2598 else { 2598 else {
2599 Event* e = (Event*) newInc; 2599 Event* e = (Event*) newInc;
2600 showEventEditor(); 2600 showEventEditor();
2601 mEventEditor->editEvent( e ); 2601 mEventEditor->editEvent( e );
2602 if ( mEventEditor->exec() ) { 2602 if ( mEventEditor->exec() ) {
2603 mCalendar->addEvent( e ); 2603 mCalendar->addEvent( e );
2604 updateView(); 2604 updateView();
2605 } else { 2605 } else {
2606 delete e; 2606 delete e;
2607 } 2607 }
2608 } 2608 }
2609} 2609}
2610 2610
2611void CalendarView::newEvent() 2611void CalendarView::newEvent()
2612{ 2612{
2613 // TODO: Replace this code by a common eventDurationHint of KOBaseView. 2613 // TODO: Replace this code by a common eventDurationHint of KOBaseView.
2614 KOAgendaView *aView = mViewManager->agendaView(); 2614 KOAgendaView *aView = mViewManager->agendaView();
2615 if (aView) { 2615 if (aView) {
2616 if (aView->selectionStart().isValid()) { 2616 if (aView->selectionStart().isValid()) {
2617 if (aView->selectedIsAllDay()) { 2617 if (aView->selectedIsAllDay()) {
2618 newEvent(aView->selectionStart(),aView->selectionEnd(),true); 2618 newEvent(aView->selectionStart(),aView->selectionEnd(),true);
2619 } else { 2619 } else {
2620 newEvent(aView->selectionStart(),aView->selectionEnd()); 2620 newEvent(aView->selectionStart(),aView->selectionEnd());
2621 } 2621 }
2622 return; 2622 return;
2623 } 2623 }
2624 } 2624 }
2625 2625
2626 QDate date = mNavigator->selectedDates().first(); 2626 QDate date = mNavigator->selectedDates().first();
2627 QDateTime current = QDateTime::currentDateTime(); 2627 QDateTime current = QDateTime::currentDateTime();
2628 if ( date <= current.date() ) { 2628 if ( date <= current.date() ) {
2629 int hour = current.time().hour() +1; 2629 int hour = current.time().hour() +1;
2630 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), 2630 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ),
2631 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2631 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2632 } else 2632 } else
2633 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), 2633 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ),
2634 QDateTime( date, QTime( KOPrefs::instance()->mStartTime + 2634 QDateTime( date, QTime( KOPrefs::instance()->mStartTime +
2635 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2635 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2636} 2636}
2637 2637
2638void CalendarView::newEvent(QDateTime fh) 2638void CalendarView::newEvent(QDateTime fh)
2639{ 2639{
2640 newEvent(fh, 2640 newEvent(fh,
2641 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); 2641 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration)));
2642} 2642}
2643 2643
2644void CalendarView::newEvent(QDate dt) 2644void CalendarView::newEvent(QDate dt)
2645{ 2645{
2646 newEvent(QDateTime(dt, QTime(0,0,0)), 2646 newEvent(QDateTime(dt, QTime(0,0,0)),
2647 QDateTime(dt, QTime(0,0,0)), true); 2647 QDateTime(dt, QTime(0,0,0)), true);
2648} 2648}
2649void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint) 2649void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint)
2650{ 2650{
2651 newEvent(fromHint, toHint, false); 2651 newEvent(fromHint, toHint, false);
2652} 2652}
2653void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) 2653void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay)
2654{ 2654{
2655 2655
2656 showEventEditor(); 2656 showEventEditor();
2657 mEventEditor->newEvent(fromHint,toHint,allDay); 2657 mEventEditor->newEvent(fromHint,toHint,allDay);
2658 if ( mFilterView->filtersEnabled() ) { 2658 if ( mFilterView->filtersEnabled() ) {
2659 CalFilter *filter = mFilterView->selectedFilter(); 2659 CalFilter *filter = mFilterView->selectedFilter();
2660 if (filter && filter->showCategories()) { 2660 if (filter && filter->showCategories()) {
2661 mEventEditor->setCategories(filter->categoryList().join(",") ); 2661 mEventEditor->setCategories(filter->categoryList().join(",") );
2662 } 2662 }
2663 if ( filter ) 2663 if ( filter )
2664 mEventEditor->setSecrecy( filter->getSecrecy() ); 2664 mEventEditor->setSecrecy( filter->getSecrecy() );
2665 } 2665 }
2666} 2666}
2667void CalendarView::todoAdded(Todo * t) 2667void CalendarView::todoAdded(Todo * t)
2668{ 2668{
2669 2669
2670 changeTodoDisplay ( t ,KOGlobals::EVENTADDED); 2670 changeTodoDisplay ( t ,KOGlobals::EVENTADDED);
2671 updateTodoViews(); 2671 updateTodoViews();
2672} 2672}
2673void CalendarView::todoChanged(Todo * t) 2673void CalendarView::todoChanged(Todo * t)
2674{ 2674{
2675 emit todoModified( t, 4 ); 2675 emit todoModified( t, 4 );
2676 // updateTodoViews(); 2676 // updateTodoViews();
2677} 2677}
2678void CalendarView::todoToBeDeleted(Todo *) 2678void CalendarView::todoToBeDeleted(Todo *)
2679{ 2679{
2680 //qDebug("todoToBeDeleted(Todo *) "); 2680 //qDebug("todoToBeDeleted(Todo *) ");
2681 updateTodoViews(); 2681 updateTodoViews();
2682} 2682}
2683void CalendarView::todoDeleted() 2683void CalendarView::todoDeleted()
2684{ 2684{
2685 //qDebug(" todoDeleted()"); 2685 //qDebug(" todoDeleted()");
2686 updateTodoViews(); 2686 updateTodoViews();
2687} 2687}
2688 2688
2689 2689
2690void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) 2690void CalendarView::newTodoDateTime( QDateTime dt, bool allday )
2691{ 2691{
2692 qDebug("datetime ");
2693 showTodoEditor(); 2692 showTodoEditor();
2694 mTodoEditor->newTodo(dt,0,allday); 2693 mTodoEditor->newTodo(dt,0,allday);
2695 if ( mFilterView->filtersEnabled() ) { 2694 if ( mFilterView->filtersEnabled() ) {
2696 CalFilter *filter = mFilterView->selectedFilter(); 2695 CalFilter *filter = mFilterView->selectedFilter();
2697 if (filter && filter->showCategories()) { 2696 if (filter && filter->showCategories()) {
2698 mTodoEditor->setCategories(filter->categoryList().join(",") ); 2697 mTodoEditor->setCategories(filter->categoryList().join(",") );
2699 } 2698 }
2700 if ( filter ) 2699 if ( filter )
2701 mTodoEditor->setSecrecy( filter->getSecrecy() ); 2700 mTodoEditor->setSecrecy( filter->getSecrecy() );
2702 } 2701 }
2703} 2702}
2704 2703
2705void CalendarView::newTodo() 2704void CalendarView::newTodo()
2706{ 2705{
2707 newTodoDateTime( QDateTime(),true ); 2706 newTodoDateTime( QDateTime(),true );
2708} 2707}
2709 2708
2710void CalendarView::newSubTodo() 2709void CalendarView::newSubTodo()
2711{ 2710{
2712 Todo *todo = selectedTodo(); 2711 Todo *todo = selectedTodo();
2713 if ( todo ) newSubTodo( todo ); 2712 if ( todo ) newSubTodo( todo );
2714} 2713}
2715 2714
2716void CalendarView::newSubTodo(Todo *parentEvent) 2715void CalendarView::newSubTodo(Todo *parentEvent)
2717{ 2716{
2718 2717
2719 showTodoEditor(); 2718 showTodoEditor();
2720 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true); 2719 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true);
2721} 2720}
2722 2721
2723void CalendarView::newFloatingEvent() 2722void CalendarView::newFloatingEvent()
2724{ 2723{
2725 DateList tmpList = mNavigator->selectedDates(); 2724 DateList tmpList = mNavigator->selectedDates();
2726 QDate date = tmpList.first(); 2725 QDate date = tmpList.first();
2727 2726
2728 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), 2727 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ),
2729 QDateTime( date, QTime( 12, 0, 0 ) ), true ); 2728 QDateTime( date, QTime( 12, 0, 0 ) ), true );
2730} 2729}
2731 2730
2732 2731
2733void CalendarView::editEvent( Event *event ) 2732void CalendarView::editEvent( Event *event )
2734{ 2733{
2735 2734
2736 if ( !event ) return; 2735 if ( !event ) return;
2737 if ( event->isReadOnly() ) { 2736 if ( event->isReadOnly() ) {
2738 showEvent( event ); 2737 showEvent( event );
2739 return; 2738 return;
2740 } 2739 }
2741 showEventEditor(); 2740 showEventEditor();
2742 mEventEditor->editEvent( event , mFlagEditDescription); 2741 mEventEditor->editEvent( event , mFlagEditDescription);
2743} 2742}
2744void CalendarView::editJournal( Journal *jour ) 2743void CalendarView::editJournal( Journal *jour )
2745{ 2744{
2746 if ( !jour ) return; 2745 if ( !jour ) return;
2747 mDialogManager->hideSearchDialog(); 2746 mDialogManager->hideSearchDialog();
2748 mViewManager->showJournalView(); 2747 mViewManager->showJournalView();
2749 mNavigator->slotDaySelect( jour->dtStart().date() ); 2748 mNavigator->slotDaySelect( jour->dtStart().date() );
2750} 2749}
2751void CalendarView::editTodo( Todo *todo ) 2750void CalendarView::editTodo( Todo *todo )
2752{ 2751{
2753 if ( !todo ) return; 2752 if ( !todo ) return;
2754 2753
2755 if ( todo->isReadOnly() ) { 2754 if ( todo->isReadOnly() ) {
2756 showTodo( todo ); 2755 showTodo( todo );
2757 return; 2756 return;
2758 } 2757 }
2759 showTodoEditor(); 2758 showTodoEditor();
2760 mTodoEditor->editTodo( todo ,mFlagEditDescription); 2759 mTodoEditor->editTodo( todo ,mFlagEditDescription);
2761 2760
2762} 2761}
2763 2762
2764KOEventViewerDialog* CalendarView::getEventViewerDialog() 2763KOEventViewerDialog* CalendarView::getEventViewerDialog()
2765{ 2764{
2766 if ( !mEventViewerDialog ) { 2765 if ( !mEventViewerDialog ) {
2767 mEventViewerDialog = new KOEventViewerDialog(this); 2766 mEventViewerDialog = new KOEventViewerDialog(this);
2768 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); 2767 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) );
2769 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); 2768 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig()));
2770 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), 2769 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)),
2771 dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 2770 dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
2772 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), 2771 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ),
2773 viewManager(), SLOT( showAgendaView( bool ) ) ); 2772 viewManager(), SLOT( showAgendaView( bool ) ) );
2774 connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), 2773 connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ),
2775 this, SLOT( todoChanged(Todo *) ) ); 2774 this, SLOT( todoChanged(Todo *) ) );
2776 mEventViewerDialog->resize( 640, 480 ); 2775 mEventViewerDialog->resize( 640, 480 );
2777 2776
2778 } 2777 }
2779 return mEventViewerDialog; 2778 return mEventViewerDialog;
2780} 2779}
2781void CalendarView::showEvent(Event *event) 2780void CalendarView::showEvent(Event *event)
2782{ 2781{
2783 getEventViewerDialog()->setEvent(event); 2782 getEventViewerDialog()->setEvent(event);
2784 getEventViewerDialog()->showMe(); 2783 getEventViewerDialog()->showMe();
2785} 2784}
2786 2785
2787void CalendarView::showTodo(Todo *event) 2786void CalendarView::showTodo(Todo *event)
2788{ 2787{
2789 getEventViewerDialog()->setTodo(event); 2788 getEventViewerDialog()->setTodo(event);
2790 getEventViewerDialog()->showMe(); 2789 getEventViewerDialog()->showMe();
2791} 2790}
2792void CalendarView::showJournal( Journal *jour ) 2791void CalendarView::showJournal( Journal *jour )
2793{ 2792{
2794 getEventViewerDialog()->setJournal(jour); 2793 getEventViewerDialog()->setJournal(jour);
2795 getEventViewerDialog()->showMe(); 2794 getEventViewerDialog()->showMe();
2796 2795
2797} 2796}
2798// void CalendarView::todoModified (Todo *event, int changed) 2797// void CalendarView::todoModified (Todo *event, int changed)
2799// { 2798// {
2800// // if (mDialogList.find (event) != mDialogList.end ()) { 2799// // if (mDialogList.find (event) != mDialogList.end ()) {
2801// // kdDebug() << "Todo modified and open" << endl; 2800// // kdDebug() << "Todo modified and open" << endl;
2802// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; 2801// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event];
2803// // temp->modified (changed); 2802// // temp->modified (changed);
2804 2803
2805// // } 2804// // }
2806 2805
2807// mViewManager->updateView(); 2806// mViewManager->updateView();
2808// } 2807// }
2809 2808
2810void CalendarView::appointment_show() 2809void CalendarView::appointment_show()
2811{ 2810{
2812 Event *anEvent = 0; 2811 Event *anEvent = 0;
2813 2812
2814 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2813 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2815 2814
2816 if (mViewManager->currentView()->isEventView()) { 2815 if (mViewManager->currentView()->isEventView()) {
2817 if ( incidence && incidence->type() == "Event" ) { 2816 if ( incidence && incidence->type() == "Event" ) {
2818 anEvent = static_cast<Event *>(incidence); 2817 anEvent = static_cast<Event *>(incidence);
2819 } 2818 }
2820 } 2819 }
2821 2820
2822 if (!anEvent) { 2821 if (!anEvent) {
2823 KNotifyClient::beep(); 2822 KNotifyClient::beep();
2824 return; 2823 return;
2825 } 2824 }
2826 2825
2827 showEvent(anEvent); 2826 showEvent(anEvent);
2828} 2827}
2829 2828
2830void CalendarView::appointment_edit() 2829void CalendarView::appointment_edit()
2831{ 2830{
2832 Event *anEvent = 0; 2831 Event *anEvent = 0;
2833 2832
2834 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2833 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2835 2834
2836 if (mViewManager->currentView()->isEventView()) { 2835 if (mViewManager->currentView()->isEventView()) {
2837 if ( incidence && incidence->type() == "Event" ) { 2836 if ( incidence && incidence->type() == "Event" ) {
2838 anEvent = static_cast<Event *>(incidence); 2837 anEvent = static_cast<Event *>(incidence);
2839 } 2838 }
2840 } 2839 }
2841 2840
2842 if (!anEvent) { 2841 if (!anEvent) {
2843 KNotifyClient::beep(); 2842 KNotifyClient::beep();
2844 return; 2843 return;
2845 } 2844 }
2846 2845
2847 editEvent(anEvent); 2846 editEvent(anEvent);
2848} 2847}
2849 2848
2850void CalendarView::appointment_delete() 2849void CalendarView::appointment_delete()
2851{ 2850{
2852 Event *anEvent = 0; 2851 Event *anEvent = 0;
2853 2852
2854 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2853 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2855 2854
2856 if (mViewManager->currentView()->isEventView()) { 2855 if (mViewManager->currentView()->isEventView()) {
2857 if ( incidence && incidence->type() == "Event" ) { 2856 if ( incidence && incidence->type() == "Event" ) {
2858 anEvent = static_cast<Event *>(incidence); 2857 anEvent = static_cast<Event *>(incidence);
2859 } 2858 }
2860 } 2859 }
2861 2860
2862 if (!anEvent) { 2861 if (!anEvent) {
2863 KNotifyClient::beep(); 2862 KNotifyClient::beep();
2864 return; 2863 return;
2865 } 2864 }
2866 2865
2867 deleteEvent(anEvent); 2866 deleteEvent(anEvent);
2868} 2867}
2869 2868
2870void CalendarView::todo_resub( Todo * parent, Todo * sub ) 2869void CalendarView::todo_resub( Todo * parent, Todo * sub )
2871{ 2870{
2872 if (!sub) return; 2871 if (!sub) return;
2873 if (!parent) return; 2872 if (!parent) return;
2874 if ( sub->relatedTo() ) 2873 if ( sub->relatedTo() )
2875 sub->relatedTo()->removeRelation(sub); 2874 sub->relatedTo()->removeRelation(sub);
2876 sub->setRelatedTo(parent); 2875 sub->setRelatedTo(parent);
2877 sub->setRelatedToUid(parent->uid()); 2876 sub->setRelatedToUid(parent->uid());
2878 parent->addRelation(sub); 2877 parent->addRelation(sub);
2879 sub->updated(); 2878 sub->updated();
2880 parent->updated(); 2879 parent->updated();
2881 setModified(true); 2880 setModified(true);
2882 updateView(); 2881 updateView();
2883} 2882}
2884void CalendarView::todo_unsub(Todo *anTodo ) 2883void CalendarView::todo_unsub(Todo *anTodo )
2885{ 2884{
2886 // Todo *anTodo = selectedTodo(); 2885 // Todo *anTodo = selectedTodo();
2887 if (!anTodo) return; 2886 if (!anTodo) return;
2888 if (!anTodo->relatedTo()) return; 2887 if (!anTodo->relatedTo()) return;
2889 anTodo->relatedTo()->removeRelation(anTodo); 2888 anTodo->relatedTo()->removeRelation(anTodo);
2890 anTodo->setRelatedTo(0); 2889 anTodo->setRelatedTo(0);
2891 anTodo->updated(); 2890 anTodo->updated();
2892 anTodo->setRelatedToUid(""); 2891 anTodo->setRelatedToUid("");
2893 setModified(true); 2892 setModified(true);
2894 updateView(); 2893 updateView();
2895} 2894}
2896 2895
2897void CalendarView::deleteTodo(Todo *todo) 2896void CalendarView::deleteTodo(Todo *todo)
2898{ 2897{
2899 if (!todo) { 2898 if (!todo) {
2900 KNotifyClient::beep(); 2899 KNotifyClient::beep();
2901 return; 2900 return;
2902 } 2901 }
2903 if (KOPrefs::instance()->mConfirm) { 2902 if (KOPrefs::instance()->mConfirm) {
2904 QString text = todo->summary().left(20); 2903 QString text = todo->summary().left(20);
2905 if (!todo->relations().isEmpty()) { 2904 if (!todo->relations().isEmpty()) {
2906 text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); 2905 text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!");
2907 2906
2908 } 2907 }
2909 switch (msgItemDelete(text)) { 2908 switch (msgItemDelete(text)) {
2910 case KMessageBox::Continue: // OK 2909 case KMessageBox::Continue: // OK
2911 bool deleteT = false; 2910 bool deleteT = false;
2912 if (!todo->relations().isEmpty()) { 2911 if (!todo->relations().isEmpty()) {
2913 deleteT = removeCompletedSubTodos( todo ); 2912 deleteT = removeCompletedSubTodos( todo );
2914 } 2913 }
2915 // deleteT == true: todo already deleted in removeCompletedSubTodos 2914 // deleteT == true: todo already deleted in removeCompletedSubTodos
2916 if ( !deleteT ) { 2915 if ( !deleteT ) {
2917 checkExternalId( todo ); 2916 checkExternalId( todo );
2918 calendar()->deleteTodo(todo); 2917 calendar()->deleteTodo(todo);
2919 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 2918 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
2920 updateView(); 2919 updateView();
2921 } 2920 }
2922 break; 2921 break;
2923 } // switch 2922 } // switch
2924 } else { 2923 } else {
2925 checkExternalId( todo ); 2924 checkExternalId( todo );
2926 mCalendar->deleteTodo(todo); 2925 mCalendar->deleteTodo(todo);
2927 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 2926 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
2928 updateView(); 2927 updateView();
2929 } 2928 }
2930 2929
2931 emit updateSearchDialog(); 2930 emit updateSearchDialog();
2932} 2931}
2933void CalendarView::deleteJournal(Journal *jour) 2932void CalendarView::deleteJournal(Journal *jour)
2934{ 2933{
2935 if (!jour) { 2934 if (!jour) {
2936 KNotifyClient::beep(); 2935 KNotifyClient::beep();
2937 return; 2936 return;
2938 } 2937 }
2939 if (KOPrefs::instance()->mConfirm) { 2938 if (KOPrefs::instance()->mConfirm) {
2940 switch (msgItemDelete( jour->description().left(20))) { 2939 switch (msgItemDelete( jour->description().left(20))) {
2941 case KMessageBox::Continue: // OK 2940 case KMessageBox::Continue: // OK
2942 calendar()->deleteJournal(jour); 2941 calendar()->deleteJournal(jour);
2943 updateView(); 2942 updateView();
2944 break; 2943 break;
2945 } // switch 2944 } // switch
2946 } else { 2945 } else {
2947 calendar()->deleteJournal(jour);; 2946 calendar()->deleteJournal(jour);;
2948 updateView(); 2947 updateView();
2949 } 2948 }
2950 emit updateSearchDialog(); 2949 emit updateSearchDialog();
2951} 2950}
2952 2951
2953void CalendarView::deleteEvent(Event *anEvent) 2952void CalendarView::deleteEvent(Event *anEvent)
2954{ 2953{
2955 if (!anEvent) { 2954 if (!anEvent) {
2956 KNotifyClient::beep(); 2955 KNotifyClient::beep();
2957 return; 2956 return;
2958 } 2957 }
2959 2958
2960 if (anEvent->recurrence()->doesRecur()) { 2959 if (anEvent->recurrence()->doesRecur()) {
2961 QDate itemDate = mViewManager->currentSelectionDate(); 2960 QDate itemDate = mViewManager->currentSelectionDate();
2962 int km; 2961 int km;
2963 if (!itemDate.isValid()) { 2962 if (!itemDate.isValid()) {
2964 //kdDebug() << "Date Not Valid" << endl; 2963 //kdDebug() << "Date Not Valid" << endl;
2965 if (KOPrefs::instance()->mConfirm) { 2964 if (KOPrefs::instance()->mConfirm) {
2966 km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + 2965 km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) +
2967 i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), 2966 i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"),
2968 i18n("KO/Pi Confirmation"),i18n("Delete All")); 2967 i18n("KO/Pi Confirmation"),i18n("Delete All"));
2969 if ( km == KMessageBox::Continue ) 2968 if ( km == KMessageBox::Continue )
2970 km = KMessageBox::No; // No = all below 2969 km = KMessageBox::No; // No = all below
2971 } else 2970 } else
2972 km = KMessageBox::No; 2971 km = KMessageBox::No;
2973 } else { 2972 } else {
2974 km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) + 2973 km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) +
2975 i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ 2974 i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+
2976 KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), 2975 KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"),
2977 i18n("KO/Pi Confirmation"),i18n("Current"), 2976 i18n("KO/Pi Confirmation"),i18n("Current"),
2978 i18n("All")); 2977 i18n("All"));
2979 } 2978 }
2980 switch(km) { 2979 switch(km) {
2981 2980
2982 case KMessageBox::No: // Continue // all 2981 case KMessageBox::No: // Continue // all
2983 //qDebug("KMessageBox::No "); 2982 //qDebug("KMessageBox::No ");
2984 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 2983 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
2985 schedule(Scheduler::Cancel,anEvent); 2984 schedule(Scheduler::Cancel,anEvent);
2986 2985
2987 checkExternalId( anEvent); 2986 checkExternalId( anEvent);
2988 mCalendar->deleteEvent(anEvent); 2987 mCalendar->deleteEvent(anEvent);
2989 changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); 2988 changeEventDisplay(anEvent,KOGlobals::EVENTDELETED);
2990 break; 2989 break;
2991 2990
2992 // Disabled because it does not work 2991 // Disabled because it does not work
2993 //#if 0 2992 //#if 0
2994 case KMessageBox::Yes: // just this one 2993 case KMessageBox::Yes: // just this one
2995 //QDate qd = mNavigator->selectedDates().first(); 2994 //QDate qd = mNavigator->selectedDates().first();
2996 //if (!qd.isValid()) { 2995 //if (!qd.isValid()) {
2997 // kdDebug() << "no date selected, or invalid date" << endl; 2996 // kdDebug() << "no date selected, or invalid date" << endl;
2998 // KNotifyClient::beep(); 2997 // KNotifyClient::beep();
2999 // return; 2998 // return;
3000 //} 2999 //}
3001 //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); 3000 //while (!anEvent->recursOn(qd)) qd = qd.addDays(1);
3002 if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { 3001 if (itemDate!=QDate(1,1,1) || itemDate.isValid()) {
3003 anEvent->addExDate(itemDate); 3002 anEvent->addExDate(itemDate);
3004 int duration = anEvent->recurrence()->duration(); 3003 int duration = anEvent->recurrence()->duration();
3005 if ( duration > 0 ) { 3004 if ( duration > 0 ) {
3006 anEvent->recurrence()->setDuration( duration - 1 ); 3005 anEvent->recurrence()->setDuration( duration - 1 );
3007 } 3006 }
3008 changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); 3007 changeEventDisplay(anEvent, KOGlobals::EVENTEDITED);
3009 } 3008 }
3010 break; 3009 break;
3011 //#endif 3010 //#endif
3012 } // switch 3011 } // switch
3013 } else { 3012 } else {
3014 if (KOPrefs::instance()->mConfirm) { 3013 if (KOPrefs::instance()->mConfirm) {
3015 switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + 3014 switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) +
3016 i18n("\nAre you sure you want\nto delete this event?"), 3015 i18n("\nAre you sure you want\nto delete this event?"),
3017 i18n("KO/Pi Confirmation"),i18n("Delete"))) { 3016 i18n("KO/Pi Confirmation"),i18n("Delete"))) {
3018 case KMessageBox::Continue: // OK 3017 case KMessageBox::Continue: // OK
3019 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 3018 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
3020 schedule(Scheduler::Cancel,anEvent); 3019 schedule(Scheduler::Cancel,anEvent);
3021 checkExternalId( anEvent); 3020 checkExternalId( anEvent);
3022 mCalendar->deleteEvent(anEvent); 3021 mCalendar->deleteEvent(anEvent);
3023 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 3022 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
3024 break; 3023 break;
3025 } // switch 3024 } // switch
3026 } else { 3025 } else {
3027 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 3026 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
3028 schedule(Scheduler::Cancel,anEvent); 3027 schedule(Scheduler::Cancel,anEvent);
3029 checkExternalId( anEvent); 3028 checkExternalId( anEvent);
3030 mCalendar->deleteEvent(anEvent); 3029 mCalendar->deleteEvent(anEvent);
3031 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 3030 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
3032 } 3031 }
3033 } // if-else 3032 } // if-else
3034 emit updateSearchDialog(); 3033 emit updateSearchDialog();
3035} 3034}
3036 3035
3037bool CalendarView::deleteEvent(const QString &uid) 3036bool CalendarView::deleteEvent(const QString &uid)
3038{ 3037{
3039 Event *ev = mCalendar->event(uid); 3038 Event *ev = mCalendar->event(uid);
3040 if (ev) { 3039 if (ev) {
3041 deleteEvent(ev); 3040 deleteEvent(ev);
3042 return true; 3041 return true;
3043 } else { 3042 } else {
3044 return false; 3043 return false;
3045 } 3044 }
3046} 3045}
3047 3046
3048/*****************************************************************************/ 3047/*****************************************************************************/
3049 3048
3050void CalendarView::action_mail() 3049void CalendarView::action_mail()
3051{ 3050{
3052#ifndef KORG_NOMAIL 3051#ifndef KORG_NOMAIL
3053 KOMailClient mailClient; 3052 KOMailClient mailClient;
3054 3053
3055 Incidence *incidence = currentSelection(); 3054 Incidence *incidence = currentSelection();
3056 3055
3057 if (!incidence) { 3056 if (!incidence) {
3058 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 3057 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
3059 return; 3058 return;
3060 } 3059 }
3061 if(incidence->attendeeCount() == 0 ) { 3060 if(incidence->attendeeCount() == 0 ) {
3062 KMessageBox::sorry(this, 3061 KMessageBox::sorry(this,
3063 i18n("Can't generate mail:\nNo attendees defined.\n")); 3062 i18n("Can't generate mail:\nNo attendees defined.\n"));
3064 return; 3063 return;
3065 } 3064 }
3066 3065
3067 CalendarLocal cal_tmp; 3066 CalendarLocal cal_tmp;
3068 Event *event = 0; 3067 Event *event = 0;
3069 Event *ev = 0; 3068 Event *ev = 0;
3070 if ( incidence && incidence->type() == "Event" ) { 3069 if ( incidence && incidence->type() == "Event" ) {
3071 event = static_cast<Event *>(incidence); 3070 event = static_cast<Event *>(incidence);
3072 ev = new Event(*event); 3071 ev = new Event(*event);
3073 cal_tmp.addEvent(ev); 3072 cal_tmp.addEvent(ev);
3074 } 3073 }
3075 ICalFormat mForm(); 3074 ICalFormat mForm();
3076 QString attachment = mForm.toString( &cal_tmp ); 3075 QString attachment = mForm.toString( &cal_tmp );
3077 if (ev) delete(ev); 3076 if (ev) delete(ev);
3078 3077
3079 mailClient.mailAttendees(currentSelection(), attachment); 3078 mailClient.mailAttendees(currentSelection(), attachment);
3080 3079
3081#endif 3080#endif
3082 3081
3083#if 0 3082#if 0
3084 Event *anEvent = 0; 3083 Event *anEvent = 0;
3085 if (mViewManager->currentView()->isEventView()) { 3084 if (mViewManager->currentView()->isEventView()) {
3086 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); 3085 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first());
3087 } 3086 }
3088 3087
3089 if (!anEvent) { 3088 if (!anEvent) {
3090 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 3089 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
3091 return; 3090 return;
3092 } 3091 }
3093 if(anEvent->attendeeCount() == 0 ) { 3092 if(anEvent->attendeeCount() == 0 ) {
3094 KMessageBox::sorry(this, 3093 KMessageBox::sorry(this,
3095 i18n("Can't generate mail:\nNo attendees defined.\n")); 3094 i18n("Can't generate mail:\nNo attendees defined.\n"));
3096 return; 3095 return;
3097 } 3096 }
3098 3097
3099 mailobject.emailEvent(anEvent); 3098 mailobject.emailEvent(anEvent);
3100#endif 3099#endif
3101} 3100}
3102 3101
3103 3102
3104void CalendarView::schedule_publish(Incidence *incidence) 3103void CalendarView::schedule_publish(Incidence *incidence)
3105{ 3104{
3106 Event *event = 0; 3105 Event *event = 0;
3107 Todo *todo = 0; 3106 Todo *todo = 0;
3108 3107
3109 if (incidence == 0) { 3108 if (incidence == 0) {
3110 incidence = mViewManager->currentView()->selectedIncidences().first(); 3109 incidence = mViewManager->currentView()->selectedIncidences().first();
3111 if (incidence == 0) { 3110 if (incidence == 0) {
3112 incidence = mTodoList->selectedIncidences().first(); 3111 incidence = mTodoList->selectedIncidences().first();
3113 } 3112 }
3114 } 3113 }
3115 if ( incidence && incidence->type() == "Event" ) { 3114 if ( incidence && incidence->type() == "Event" ) {
3116 event = static_cast<Event *>(incidence); 3115 event = static_cast<Event *>(incidence);
3117 } else { 3116 } else {
3118 if ( incidence && incidence->type() == "Todo" ) { 3117 if ( incidence && incidence->type() == "Todo" ) {
3119 todo = static_cast<Todo *>(incidence); 3118 todo = static_cast<Todo *>(incidence);
3120 } 3119 }
3121 } 3120 }
3122 3121
3123 if (!event && !todo) { 3122 if (!event && !todo) {
3124 KMessageBox::sorry(this,i18n("No event selected.")); 3123 KMessageBox::sorry(this,i18n("No event selected."));
3125 return; 3124 return;
3126 } 3125 }
3127 3126
3128 PublishDialog *publishdlg = new PublishDialog(); 3127 PublishDialog *publishdlg = new PublishDialog();
3129 if (incidence->attendeeCount()>0) { 3128 if (incidence->attendeeCount()>0) {
3130 QPtrList<Attendee> attendees = incidence->attendees(); 3129 QPtrList<Attendee> attendees = incidence->attendees();
3131 attendees.first(); 3130 attendees.first();
3132 while ( attendees.current()!=0 ) { 3131 while ( attendees.current()!=0 ) {
3133 publishdlg->addAttendee(attendees.current()); 3132 publishdlg->addAttendee(attendees.current());
3134 attendees.next(); 3133 attendees.next();
3135 } 3134 }
3136 } 3135 }
3137 bool send = true; 3136 bool send = true;
3138 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { 3137 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) {
3139 if ( publishdlg->exec() != QDialog::Accepted ) 3138 if ( publishdlg->exec() != QDialog::Accepted )
3140 send = false; 3139 send = false;
3141 } 3140 }
3142 if ( send ) { 3141 if ( send ) {
3143 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3142 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3144 if ( event ) { 3143 if ( event ) {
3145 Event *ev = new Event(*event); 3144 Event *ev = new Event(*event);
3146 ev->registerObserver(0); 3145 ev->registerObserver(0);
3147 ev->clearAttendees(); 3146 ev->clearAttendees();
3148 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { 3147 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
3149 delete(ev); 3148 delete(ev);
3150 } 3149 }
3151 } else { 3150 } else {
3152 if ( todo ) { 3151 if ( todo ) {
3153 Todo *ev = new Todo(*todo); 3152 Todo *ev = new Todo(*todo);
3154 ev->registerObserver(0); 3153 ev->registerObserver(0);
3155 ev->clearAttendees(); 3154 ev->clearAttendees();
3156 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { 3155 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
3157 delete(ev); 3156 delete(ev);
3158 } 3157 }
3159 } 3158 }
3160 } 3159 }
3161 } 3160 }
3162 delete publishdlg; 3161 delete publishdlg;
3163} 3162}
3164 3163
3165void CalendarView::schedule_request(Incidence *incidence) 3164void CalendarView::schedule_request(Incidence *incidence)
3166{ 3165{
3167 schedule(Scheduler::Request,incidence); 3166 schedule(Scheduler::Request,incidence);
3168} 3167}
3169 3168
3170void CalendarView::schedule_refresh(Incidence *incidence) 3169void CalendarView::schedule_refresh(Incidence *incidence)
3171{ 3170{
3172 schedule(Scheduler::Refresh,incidence); 3171 schedule(Scheduler::Refresh,incidence);
3173} 3172}
3174 3173
3175void CalendarView::schedule_cancel(Incidence *incidence) 3174void CalendarView::schedule_cancel(Incidence *incidence)
3176{ 3175{
3177 schedule(Scheduler::Cancel,incidence); 3176 schedule(Scheduler::Cancel,incidence);
3178} 3177}
3179 3178
3180void CalendarView::schedule_add(Incidence *incidence) 3179void CalendarView::schedule_add(Incidence *incidence)
3181{ 3180{
3182 schedule(Scheduler::Add,incidence); 3181 schedule(Scheduler::Add,incidence);
3183} 3182}
3184 3183
3185void CalendarView::schedule_reply(Incidence *incidence) 3184void CalendarView::schedule_reply(Incidence *incidence)
3186{ 3185{
3187 schedule(Scheduler::Reply,incidence); 3186 schedule(Scheduler::Reply,incidence);
3188} 3187}
3189 3188
3190void CalendarView::schedule_counter(Incidence *incidence) 3189void CalendarView::schedule_counter(Incidence *incidence)
3191{ 3190{
3192 schedule(Scheduler::Counter,incidence); 3191 schedule(Scheduler::Counter,incidence);
3193} 3192}
3194 3193
3195void CalendarView::schedule_declinecounter(Incidence *incidence) 3194void CalendarView::schedule_declinecounter(Incidence *incidence)
3196{ 3195{
3197 schedule(Scheduler::Declinecounter,incidence); 3196 schedule(Scheduler::Declinecounter,incidence);
3198} 3197}
3199 3198
3200void CalendarView::schedule_publish_freebusy(int daysToPublish) 3199void CalendarView::schedule_publish_freebusy(int daysToPublish)
3201{ 3200{
3202 QDateTime start = QDateTime::currentDateTime(); 3201 QDateTime start = QDateTime::currentDateTime();
3203 QDateTime end = start.addDays(daysToPublish); 3202 QDateTime end = start.addDays(daysToPublish);
3204 3203
3205 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); 3204 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end);
3206 freebusy->setOrganizer(KOPrefs::instance()->email()); 3205 freebusy->setOrganizer(KOPrefs::instance()->email());
3207 3206
3208 3207
3209 PublishDialog *publishdlg = new PublishDialog(); 3208 PublishDialog *publishdlg = new PublishDialog();
3210 if ( publishdlg->exec() == QDialog::Accepted ) { 3209 if ( publishdlg->exec() == QDialog::Accepted ) {
3211 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3210 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3212 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { 3211 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) {
3213 delete(freebusy); 3212 delete(freebusy);
3214 } 3213 }
3215 } 3214 }
3216 delete publishdlg; 3215 delete publishdlg;
3217} 3216}
3218 3217
3219void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) 3218void CalendarView::schedule(Scheduler::Method method, Incidence *incidence)
3220{ 3219{
3221 Event *event = 0; 3220 Event *event = 0;
3222 Todo *todo = 0; 3221 Todo *todo = 0;
3223 3222
3224 if (incidence == 0) { 3223 if (incidence == 0) {
3225 incidence = mViewManager->currentView()->selectedIncidences().first(); 3224 incidence = mViewManager->currentView()->selectedIncidences().first();
3226 if (incidence == 0) { 3225 if (incidence == 0) {
3227 incidence = mTodoList->selectedIncidences().first(); 3226 incidence = mTodoList->selectedIncidences().first();
3228 } 3227 }
3229 } 3228 }
3230 if ( incidence && incidence->type() == "Event" ) { 3229 if ( incidence && incidence->type() == "Event" ) {
3231 event = static_cast<Event *>(incidence); 3230 event = static_cast<Event *>(incidence);
3232 } 3231 }
3233 if ( incidence && incidence->type() == "Todo" ) { 3232 if ( incidence && incidence->type() == "Todo" ) {
3234 todo = static_cast<Todo *>(incidence); 3233 todo = static_cast<Todo *>(incidence);
3235 } 3234 }
3236 3235
3237 if (!event && !todo) { 3236 if (!event && !todo) {
3238 KMessageBox::sorry(this,i18n("No event selected.")); 3237 KMessageBox::sorry(this,i18n("No event selected."));
3239 return; 3238 return;
3240 } 3239 }
3241 3240
3242 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { 3241 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) {
3243 KMessageBox::sorry(this,i18n("The event has no attendees.")); 3242 KMessageBox::sorry(this,i18n("The event has no attendees."));
3244 return; 3243 return;
3245 } 3244 }
3246 3245
3247 Event *ev = 0; 3246 Event *ev = 0;
3248 if (event) ev = new Event(*event); 3247 if (event) ev = new Event(*event);
3249 Todo *to = 0; 3248 Todo *to = 0;
3250 if (todo) to = new Todo(*todo); 3249 if (todo) to = new Todo(*todo);
3251 3250
3252 if (method == Scheduler::Reply || method == Scheduler::Refresh) { 3251 if (method == Scheduler::Reply || method == Scheduler::Refresh) {
3253 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 3252 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
3254 if (!me) { 3253 if (!me) {
3255 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); 3254 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails."));
3256 return; 3255 return;
3257 } 3256 }
3258 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { 3257 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) {
3259 StatusDialog *statdlg = new StatusDialog(this); 3258 StatusDialog *statdlg = new StatusDialog(this);
3260 if (!statdlg->exec()==QDialog::Accepted) return; 3259 if (!statdlg->exec()==QDialog::Accepted) return;
3261 me->setStatus( statdlg->status() ); 3260 me->setStatus( statdlg->status() );
3262 delete(statdlg); 3261 delete(statdlg);
3263 } 3262 }
3264 Attendee *menew = new Attendee(*me); 3263 Attendee *menew = new Attendee(*me);
3265 if (ev) { 3264 if (ev) {
3266 ev->clearAttendees(); 3265 ev->clearAttendees();
3267 ev->addAttendee(menew,false); 3266 ev->addAttendee(menew,false);
3268 } else { 3267 } else {
3269 if (to) { 3268 if (to) {
3270 todo->clearAttendees(); 3269 todo->clearAttendees();
3271 todo->addAttendee(menew,false); 3270 todo->addAttendee(menew,false);
3272 } 3271 }
3273 } 3272 }
3274 } 3273 }
3275 3274
3276 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3275 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3277 if (ev) { 3276 if (ev) {
3278 if ( !dlg->addMessage(ev,method) ) delete(ev); 3277 if ( !dlg->addMessage(ev,method) ) delete(ev);
3279 } else { 3278 } else {
3280 if (to) { 3279 if (to) {
3281 if ( !dlg->addMessage(to,method) ) delete(to); 3280 if ( !dlg->addMessage(to,method) ) delete(to);
3282 } 3281 }
3283 } 3282 }
3284} 3283}
3285 3284
3286void CalendarView::openAddressbook() 3285void CalendarView::openAddressbook()
3287{ 3286{
3288 KRun::runCommand("kaddressbook"); 3287 KRun::runCommand("kaddressbook");
3289} 3288}
3290 3289
3291void CalendarView::setModified(bool modified) 3290void CalendarView::setModified(bool modified)
3292{ 3291{
3293 if ( modified ) 3292 if ( modified )
3294 emit signalmodified(); 3293 emit signalmodified();
3295 if (mModified != modified) { 3294 if (mModified != modified) {
3296 mModified = modified; 3295 mModified = modified;
3297 emit modifiedChanged(mModified); 3296 emit modifiedChanged(mModified);
3298 } 3297 }
3299} 3298}
3300 3299
3301bool CalendarView::isReadOnly() 3300bool CalendarView::isReadOnly()
3302{ 3301{
3303 return mReadOnly; 3302 return mReadOnly;
3304} 3303}
3305 3304
3306void CalendarView::setReadOnly(bool readOnly) 3305void CalendarView::setReadOnly(bool readOnly)
3307{ 3306{
3308 if (mReadOnly != readOnly) { 3307 if (mReadOnly != readOnly) {
3309 mReadOnly = readOnly; 3308 mReadOnly = readOnly;
3310 emit readOnlyChanged(mReadOnly); 3309 emit readOnlyChanged(mReadOnly);
3311 } 3310 }
3312} 3311}
3313 3312
3314bool CalendarView::isModified() 3313bool CalendarView::isModified()
3315{ 3314{
3316 return mModified; 3315 return mModified;
3317} 3316}
3318 3317
3319void CalendarView::printSetup() 3318void CalendarView::printSetup()
3320{ 3319{
3321#ifndef KORG_NOPRINTER 3320#ifndef KORG_NOPRINTER
3322 createPrinter(); 3321 createPrinter();
3323 3322
3324 mCalPrinter->setupPrinter(); 3323 mCalPrinter->setupPrinter();
3325#endif 3324#endif
3326} 3325}
3327 3326
3328void CalendarView::print() 3327void CalendarView::print()
3329{ 3328{
3330#ifndef KORG_NOPRINTER 3329#ifndef KORG_NOPRINTER
3331 createPrinter(); 3330 createPrinter();
3332 3331
3333 DateList tmpDateList = mNavigator->selectedDates(); 3332 DateList tmpDateList = mNavigator->selectedDates();
3334 mCalPrinter->print(CalPrinter::Month, 3333 mCalPrinter->print(CalPrinter::Month,
3335 tmpDateList.first(), tmpDateList.last()); 3334 tmpDateList.first(), tmpDateList.last());
3336#endif 3335#endif
3337} 3336}
3338 3337
3339void CalendarView::printPreview() 3338void CalendarView::printPreview()
3340{ 3339{
3341#ifndef KORG_NOPRINTER 3340#ifndef KORG_NOPRINTER
3342 kdDebug() << "CalendarView::printPreview()" << endl; 3341 kdDebug() << "CalendarView::printPreview()" << endl;
3343 3342
3344 createPrinter(); 3343 createPrinter();
3345 3344
3346 DateList tmpDateList = mNavigator->selectedDates(); 3345 DateList tmpDateList = mNavigator->selectedDates();
3347 3346
3348 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), 3347 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(),
3349 tmpDateList.last()); 3348 tmpDateList.last());
3350#endif 3349#endif
3351} 3350}
3352 3351
3353void CalendarView::exportICalendar() 3352void CalendarView::exportICalendar()
3354{ 3353{
3355 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); 3354 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this);
3356 3355
3357 // Force correct extension 3356 // Force correct extension
3358 if (filename.right(4) != ".ics") filename += ".ics"; 3357 if (filename.right(4) != ".ics") filename += ".ics";
3359 3358
3360 FileStorage storage( mCalendar, filename, new ICalFormat() ); 3359 FileStorage storage( mCalendar, filename, new ICalFormat() );
3361 storage.save(); 3360 storage.save();
3362} 3361}
3363 3362
3364bool CalendarView::exportVCalendar( QString filename ) 3363bool CalendarView::exportVCalendar( QString filename )
3365{ 3364{
3366 if (mCalendar->journals().count() > 0) { 3365 if (mCalendar->journals().count() > 0) {
3367 int result = KMessageBox::warningContinueCancel(this, 3366 int result = KMessageBox::warningContinueCancel(this,
3368 i18n("The journal entries can not be\nexported to a vCalendar file."), 3367 i18n("The journal entries can not be\nexported to a vCalendar file."),
3369 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), 3368 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
3370 true); 3369 true);
3371 if (result != KMessageBox::Continue) return false; 3370 if (result != KMessageBox::Continue) return false;
3372 } 3371 }
3373 3372
3374 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); 3373 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this);
3375 3374
3376 // Force correct extension 3375 // Force correct extension
3377 if (filename.right(4) != ".vcs") filename += ".vcs"; 3376 if (filename.right(4) != ".vcs") filename += ".vcs";
3378 3377
3379 FileStorage storage( mCalendar, filename, new VCalFormat ); 3378 FileStorage storage( mCalendar, filename, new VCalFormat );
3380 return storage.save(); 3379 return storage.save();
3381 3380
3382} 3381}
3383 3382
3384void CalendarView::eventUpdated(Incidence *) 3383void CalendarView::eventUpdated(Incidence *)
3385{ 3384{
3386 setModified(); 3385 setModified();
3387 // Don't call updateView here. The code, which has caused the update of the 3386 // Don't call updateView here. The code, which has caused the update of the
3388 // event is responsible for updating the view. 3387 // event is responsible for updating the view.
3389 // updateView(); 3388 // updateView();
3390} 3389}
3391 3390
3392void CalendarView::adaptNavigationUnits() 3391void CalendarView::adaptNavigationUnits()
3393{ 3392{
3394 if (mViewManager->currentView()->isEventView()) { 3393 if (mViewManager->currentView()->isEventView()) {
3395 int days = mViewManager->currentView()->currentDateCount(); 3394 int days = mViewManager->currentView()->currentDateCount();
3396 if (days == 1) { 3395 if (days == 1) {
3397 emit changeNavStringPrev(i18n("&Previous Day")); 3396 emit changeNavStringPrev(i18n("&Previous Day"));
3398 emit changeNavStringNext(i18n("&Next Day")); 3397 emit changeNavStringNext(i18n("&Next Day"));
3399 } else { 3398 } else {
3400 emit changeNavStringPrev(i18n("&Previous Week")); 3399 emit changeNavStringPrev(i18n("&Previous Week"));
3401 emit changeNavStringNext(i18n("&Next Week")); 3400 emit changeNavStringNext(i18n("&Next Week"));
3402 } 3401 }
3403 } 3402 }
3404} 3403}
3405 3404
3406void CalendarView::processMainViewSelection( Incidence *incidence ) 3405void CalendarView::processMainViewSelection( Incidence *incidence )
3407{ 3406{
3408 if ( incidence ) mTodoList->clearSelection(); 3407 if ( incidence ) mTodoList->clearSelection();
3409 processIncidenceSelection( incidence ); 3408 processIncidenceSelection( incidence );
3410} 3409}
3411 3410
3412void CalendarView::processTodoListSelection( Incidence *incidence ) 3411void CalendarView::processTodoListSelection( Incidence *incidence )
3413{ 3412{
3414 if ( incidence && mViewManager->currentView() ) { 3413 if ( incidence && mViewManager->currentView() ) {
3415 mViewManager->currentView()->clearSelection(); 3414 mViewManager->currentView()->clearSelection();
3416 } 3415 }
3417 processIncidenceSelection( incidence ); 3416 processIncidenceSelection( incidence );
3418} 3417}
3419 3418
3420void CalendarView::processIncidenceSelection( Incidence *incidence ) 3419void CalendarView::processIncidenceSelection( Incidence *incidence )
3421{ 3420{
3422 if ( incidence == mSelectedIncidence ) return; 3421 if ( incidence == mSelectedIncidence ) return;
3423 3422
3424 mSelectedIncidence = incidence; 3423 mSelectedIncidence = incidence;
3425 3424
3426 emit incidenceSelected( mSelectedIncidence ); 3425 emit incidenceSelected( mSelectedIncidence );
3427 3426
3428 if ( incidence && incidence->type() == "Event" ) { 3427 if ( incidence && incidence->type() == "Event" ) {
3429 Event *event = static_cast<Event *>( incidence ); 3428 Event *event = static_cast<Event *>( incidence );
3430 if ( event->organizer() == KOPrefs::instance()->email() ) { 3429 if ( event->organizer() == KOPrefs::instance()->email() ) {
3431 emit organizerEventsSelected( true ); 3430 emit organizerEventsSelected( true );
3432 } else { 3431 } else {
3433 emit organizerEventsSelected(false); 3432 emit organizerEventsSelected(false);
3434 } 3433 }
3435 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3434 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3436 KOPrefs::instance()->email() ) ) { 3435 KOPrefs::instance()->email() ) ) {
3437 emit groupEventsSelected( true ); 3436 emit groupEventsSelected( true );
3438 } else { 3437 } else {
3439 emit groupEventsSelected(false); 3438 emit groupEventsSelected(false);
3440 } 3439 }
3441 return; 3440 return;
3442 } else { 3441 } else {
3443 if ( incidence && incidence->type() == "Todo" ) { 3442 if ( incidence && incidence->type() == "Todo" ) {
3444 emit todoSelected( true ); 3443 emit todoSelected( true );
3445 Todo *event = static_cast<Todo *>( incidence ); 3444 Todo *event = static_cast<Todo *>( incidence );
3446 if ( event->organizer() == KOPrefs::instance()->email() ) { 3445 if ( event->organizer() == KOPrefs::instance()->email() ) {
3447 emit organizerEventsSelected( true ); 3446 emit organizerEventsSelected( true );
3448 } else { 3447 } else {
3449 emit organizerEventsSelected(false); 3448 emit organizerEventsSelected(false);
3450 } 3449 }
3451 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3450 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3452 KOPrefs::instance()->email() ) ) { 3451 KOPrefs::instance()->email() ) ) {
3453 emit groupEventsSelected( true ); 3452 emit groupEventsSelected( true );
3454 } else { 3453 } else {
3455 emit groupEventsSelected(false); 3454 emit groupEventsSelected(false);
3456 } 3455 }
3457 return; 3456 return;
3458 } else { 3457 } else {
3459 emit todoSelected( false ); 3458 emit todoSelected( false );
3460 emit organizerEventsSelected(false); 3459 emit organizerEventsSelected(false);
3461 emit groupEventsSelected(false); 3460 emit groupEventsSelected(false);
3462 } 3461 }
3463 return; 3462 return;
3464 } 3463 }
3465 3464
3466 /* if ( incidence && incidence->type() == "Todo" ) { 3465 /* if ( incidence && incidence->type() == "Todo" ) {
3467 emit todoSelected( true ); 3466 emit todoSelected( true );
3468 } else { 3467 } else {
3469 emit todoSelected( false ); 3468 emit todoSelected( false );
3470 }*/ 3469 }*/
3471} 3470}
3472 3471
3473 3472
3474void CalendarView::checkClipboard() 3473void CalendarView::checkClipboard()
3475{ 3474{
3476#ifndef KORG_NODND 3475#ifndef KORG_NODND
3477 if (ICalDrag::canDecode(QApplication::clipboard()->data())) { 3476 if (ICalDrag::canDecode(QApplication::clipboard()->data())) {
3478 emit pasteEnabled(true); 3477 emit pasteEnabled(true);
3479 } else { 3478 } else {
3480 emit pasteEnabled(false); 3479 emit pasteEnabled(false);
3481 } 3480 }
3482#endif 3481#endif
3483} 3482}
3484 3483
3485void CalendarView::showDates(const DateList &selectedDates) 3484void CalendarView::showDates(const DateList &selectedDates)
3486{ 3485{
3487 // kdDebug() << "CalendarView::selectDates()" << endl; 3486 // kdDebug() << "CalendarView::selectDates()" << endl;
3488 3487
3489 3488
3490 if ( !mBlockShowDates ) { 3489 if ( !mBlockShowDates ) {
3491 if ( mViewManager->currentView() ) { 3490 if ( mViewManager->currentView() ) {
3492 updateView( selectedDates.first(), selectedDates.last() ); 3491 updateView( selectedDates.first(), selectedDates.last() );
3493 } else { 3492 } else {
3494 mViewManager->showAgendaView(); 3493 mViewManager->showAgendaView();
3495 } 3494 }
3496 } 3495 }
3497 3496
3498 QString selDates; 3497 QString selDates;
3499 selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); 3498 selDates = KGlobal::locale()->formatDate( selectedDates.first(), true);
3500 if (selectedDates.first() < selectedDates.last() ) 3499 if (selectedDates.first() < selectedDates.last() )
3501 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); 3500 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true);
3502 else { 3501 else {
3503 QString addString; 3502 QString addString;
3504 if ( selectedDates.first() == QDateTime::currentDateTime().date() ) 3503 if ( selectedDates.first() == QDateTime::currentDateTime().date() )
3505 addString = i18n("Today"); 3504 addString = i18n("Today");
3506 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) 3505 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(1) )
3507 addString = i18n("Tomorrow"); 3506 addString = i18n("Tomorrow");
3508 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) 3507 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) )
3509 addString = i18n("Yesterday"); 3508 addString = i18n("Yesterday");
3510 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) 3509 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) )
3511 addString = i18n("Day before yesterday"); 3510 addString = i18n("Day before yesterday");
3512 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) 3511 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(2) )
3513 addString = i18n("Day after tomorrow"); 3512 addString = i18n("Day after tomorrow");
3514 if ( !addString.isEmpty() ) { 3513 if ( !addString.isEmpty() ) {
3515 topLevelWidget()->setCaption( addString+", " + selDates ); 3514 topLevelWidget()->setCaption( addString+", " + selDates );
3516 return; 3515 return;
3517 } 3516 }
3518 } 3517 }
3519 topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); 3518 topLevelWidget()->setCaption( i18n("Dates: ") + selDates );
3520 3519
3521} 3520}
3522 3521
3523QPtrList<CalFilter> CalendarView::filters() 3522QPtrList<CalFilter> CalendarView::filters()
3524{ 3523{
3525 return mFilters; 3524 return mFilters;
3526 3525
3527} 3526}
3528void CalendarView::editFilters() 3527void CalendarView::editFilters()
3529{ 3528{
3530 // kdDebug() << "CalendarView::editFilters()" << endl; 3529 // kdDebug() << "CalendarView::editFilters()" << endl;
3531 3530
3532 CalFilter *filter = mFilters.first(); 3531 CalFilter *filter = mFilters.first();
3533 while(filter) { 3532 while(filter) {
3534 kdDebug() << " Filter: " << filter->name() << endl; 3533 kdDebug() << " Filter: " << filter->name() << endl;
3535 filter = mFilters.next(); 3534 filter = mFilters.next();
3536 } 3535 }
3537 3536
3538 mDialogManager->showFilterEditDialog(&mFilters); 3537 mDialogManager->showFilterEditDialog(&mFilters);
3539} 3538}
3540void CalendarView::toggleFilter() 3539void CalendarView::toggleFilter()
3541{ 3540{
3542 showFilter(! mFilterView->isVisible()); 3541 showFilter(! mFilterView->isVisible());
3543} 3542}
3544 3543
3545KOFilterView *CalendarView::filterView() 3544KOFilterView *CalendarView::filterView()
3546{ 3545{
3547 return mFilterView; 3546 return mFilterView;
3548} 3547}
3549void CalendarView::selectFilter( int fil ) 3548void CalendarView::selectFilter( int fil )
3550{ 3549{
3551 mFilterView->setSelectedFilter( fil ); 3550 mFilterView->setSelectedFilter( fil );
3552} 3551}
3553void CalendarView::showFilter(bool visible) 3552void CalendarView::showFilter(bool visible)
3554{ 3553{
3555 if (visible) mFilterView->show(); 3554 if (visible) mFilterView->show();
3556 else mFilterView->hide(); 3555 else mFilterView->hide();
3557} 3556}
3558void CalendarView::toggleFilerEnabled( ) 3557void CalendarView::toggleFilerEnabled( )
3559{ 3558{
3560 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); 3559 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() );
3561 if ( !mFilterView->filtersEnabled() ) 3560 if ( !mFilterView->filtersEnabled() )
3562 topLevelWidget()->setCaption( i18n("Filter disabled ") ); 3561 topLevelWidget()->setCaption( i18n("Filter disabled ") );
3563 3562
3564} 3563}
3565void CalendarView::updateFilter() 3564void CalendarView::updateFilter()
3566{ 3565{
3567 CalFilter *filter = mFilterView->selectedFilter(); 3566 CalFilter *filter = mFilterView->selectedFilter();
3568 if (filter) { 3567 if (filter) {
3569 if (mFilterView->filtersEnabled()) { 3568 if (mFilterView->filtersEnabled()) {
3570 topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() ); 3569 topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() );
3571 filter->setEnabled(true); 3570 filter->setEnabled(true);
3572 } 3571 }
3573 else filter->setEnabled(false); 3572 else filter->setEnabled(false);
3574 mCalendar->setFilter(filter); 3573 mCalendar->setFilter(filter);
3575 updateView(); 3574 updateView();
3576 } 3575 }
3577} 3576}
3578 3577
3579void CalendarView::filterEdited() 3578void CalendarView::filterEdited()
3580{ 3579{
3581 mFilterView->updateFilters(); 3580 mFilterView->updateFilters();
3582 updateFilter(); 3581 updateFilter();
3583 writeSettings(); 3582 writeSettings();
3584} 3583}
3585 3584
3586 3585
3587void CalendarView::takeOverEvent() 3586void CalendarView::takeOverEvent()
3588{ 3587{
3589 Incidence *incidence = currentSelection(); 3588 Incidence *incidence = currentSelection();
3590 3589
3591 if (!incidence) return; 3590 if (!incidence) return;
3592 3591
3593 incidence->setOrganizer(KOPrefs::instance()->email()); 3592 incidence->setOrganizer(KOPrefs::instance()->email());
3594 incidence->recreate(); 3593 incidence->recreate();
3595 incidence->setReadOnly(false); 3594 incidence->setReadOnly(false);
3596 3595
3597 updateView(); 3596 updateView();
3598} 3597}
3599 3598
3600void CalendarView::takeOverCalendar() 3599void CalendarView::takeOverCalendar()
3601{ 3600{
3602 // TODO: Create Calendar::allIncidences() function and use it here 3601 // TODO: Create Calendar::allIncidences() function and use it here
3603 3602
3604 QPtrList<Event> events = mCalendar->events(); 3603 QPtrList<Event> events = mCalendar->events();
3605 for(uint i=0; i<events.count(); ++i) { 3604 for(uint i=0; i<events.count(); ++i) {
3606 events.at(i)->setOrganizer(KOPrefs::instance()->email()); 3605 events.at(i)->setOrganizer(KOPrefs::instance()->email());
3607 events.at(i)->recreate(); 3606 events.at(i)->recreate();
3608 events.at(i)->setReadOnly(false); 3607 events.at(i)->setReadOnly(false);
3609 } 3608 }
3610 3609
3611 QPtrList<Todo> todos = mCalendar->todos(); 3610 QPtrList<Todo> todos = mCalendar->todos();
3612 for(uint i=0; i<todos.count(); ++i) { 3611 for(uint i=0; i<todos.count(); ++i) {
3613 todos.at(i)->setOrganizer(KOPrefs::instance()->email()); 3612 todos.at(i)->setOrganizer(KOPrefs::instance()->email());
3614 todos.at(i)->recreate(); 3613 todos.at(i)->recreate();
3615 todos.at(i)->setReadOnly(false); 3614 todos.at(i)->setReadOnly(false);
3616 } 3615 }
3617 3616
3618 QPtrList<Journal> journals = mCalendar->journals(); 3617 QPtrList<Journal> journals = mCalendar->journals();
3619 for(uint i=0; i<journals.count(); ++i) { 3618 for(uint i=0; i<journals.count(); ++i) {
3620 journals.at(i)->setOrganizer(KOPrefs::instance()->email()); 3619 journals.at(i)->setOrganizer(KOPrefs::instance()->email());
3621 journals.at(i)->recreate(); 3620 journals.at(i)->recreate();
3622 journals.at(i)->setReadOnly(false); 3621 journals.at(i)->setReadOnly(false);
3623 } 3622 }
3624 3623
3625 updateView(); 3624 updateView();
3626} 3625}
3627 3626
3628void CalendarView::showIntro() 3627void CalendarView::showIntro()
3629{ 3628{
3630 kdDebug() << "To be implemented." << endl; 3629 kdDebug() << "To be implemented." << endl;
3631} 3630}
3632 3631
3633QWidgetStack *CalendarView::viewStack() 3632QWidgetStack *CalendarView::viewStack()
3634{ 3633{
3635 return mRightFrame; 3634 return mRightFrame;
3636} 3635}
3637 3636
3638QWidget *CalendarView::leftFrame() 3637QWidget *CalendarView::leftFrame()
3639{ 3638{
3640 return mLeftFrame; 3639 return mLeftFrame;
3641} 3640}
3642 3641
3643DateNavigator *CalendarView::dateNavigator() 3642DateNavigator *CalendarView::dateNavigator()
3644{ 3643{
3645 return mNavigator; 3644 return mNavigator;
3646} 3645}
3647 3646
3648KDateNavigator* CalendarView::dateNavigatorWidget() 3647KDateNavigator* CalendarView::dateNavigatorWidget()
3649{ 3648{
3650 return mDateNavigator; 3649 return mDateNavigator;
3651} 3650}
3652void CalendarView::toggleDateNavigatorWidget() 3651void CalendarView::toggleDateNavigatorWidget()
3653{ 3652{
3654 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; 3653 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ;
3655 if (!KOPrefs::instance()->mShowDateNavigator ) 3654 if (!KOPrefs::instance()->mShowDateNavigator )
3656 mDateNavigator->hide(); 3655 mDateNavigator->hide();
3657 else 3656 else
3658 mDateNavigator->show(); 3657 mDateNavigator->show();
3659} 3658}
3660void CalendarView::addView(KOrg::BaseView *view) 3659void CalendarView::addView(KOrg::BaseView *view)
3661{ 3660{
3662 mViewManager->addView(view); 3661 mViewManager->addView(view);
3663} 3662}
3664 3663
3665void CalendarView::showView(KOrg::BaseView *view) 3664void CalendarView::showView(KOrg::BaseView *view)
3666{ 3665{
3667 mViewManager->showView(view, mLeftFrame->isVisible()); 3666 mViewManager->showView(view, mLeftFrame->isVisible());
3668} 3667}
3669 3668
3670Incidence *CalendarView::currentSelection() 3669Incidence *CalendarView::currentSelection()
3671{ 3670{
3672 return mViewManager->currentSelection(); 3671 return mViewManager->currentSelection();
3673} 3672}
3674void CalendarView::toggleAllDaySize() 3673void CalendarView::toggleAllDaySize()
3675{ 3674{
3676 /* 3675 /*
3677 if ( KOPrefs::instance()->mAllDaySize > 47 ) 3676 if ( KOPrefs::instance()->mAllDaySize > 47 )
3678 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; 3677 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2;
3679 else 3678 else
3680 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; 3679 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2;
3681 */ 3680 */
3682 viewManager()->agendaView()->toggleAllDay(); 3681 viewManager()->agendaView()->toggleAllDay();
3683} 3682}
3684void CalendarView::toggleExpand() 3683void CalendarView::toggleExpand()
3685{ 3684{
3686 // if ( mLeftFrame->isHidden() ) { 3685 // if ( mLeftFrame->isHidden() ) {
3687 // mLeftFrame->show(); 3686 // mLeftFrame->show();
3688 // emit calendarViewExpanded( false ); 3687 // emit calendarViewExpanded( false );
3689 // } else { 3688 // } else {
3690 // mLeftFrame->hide(); 3689 // mLeftFrame->hide();
3691 // emit calendarViewExpanded( true ); 3690 // emit calendarViewExpanded( true );
3692 // } 3691 // }
3693 3692
3694 globalFlagBlockAgenda = 1; 3693 globalFlagBlockAgenda = 1;
3695 emit calendarViewExpanded( !mLeftFrame->isHidden() ); 3694 emit calendarViewExpanded( !mLeftFrame->isHidden() );
3696 globalFlagBlockAgenda = 5; 3695 globalFlagBlockAgenda = 5;
3697 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); 3696 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() );
3698 //mViewManager->showView( 0, true ); 3697 //mViewManager->showView( 0, true );
3699} 3698}
3700 3699
3701void CalendarView::calendarModified( bool modified, Calendar * ) 3700void CalendarView::calendarModified( bool modified, Calendar * )
3702{ 3701{
3703 setModified( modified ); 3702 setModified( modified );
3704} 3703}
3705 3704
3706Todo *CalendarView::selectedTodo() 3705Todo *CalendarView::selectedTodo()
3707{ 3706{
3708 Incidence *incidence = currentSelection(); 3707 Incidence *incidence = currentSelection();
3709 if ( incidence && incidence->type() == "Todo" ) { 3708 if ( incidence && incidence->type() == "Todo" ) {
3710 return static_cast<Todo *>( incidence ); 3709 return static_cast<Todo *>( incidence );
3711 } 3710 }
3712 3711
3713 incidence = mTodoList->selectedIncidences().first(); 3712 incidence = mTodoList->selectedIncidences().first();
3714 if ( incidence && incidence->type() == "Todo" ) { 3713 if ( incidence && incidence->type() == "Todo" ) {
3715 return static_cast<Todo *>( incidence ); 3714 return static_cast<Todo *>( incidence );
3716 } 3715 }
3717 3716
3718 return 0; 3717 return 0;
3719} 3718}
3720 3719
3721void CalendarView::dialogClosing(Incidence *in) 3720void CalendarView::dialogClosing(Incidence *in)
3722{ 3721{
3723 // mDialogList.remove(in); 3722 // mDialogList.remove(in);
3724} 3723}
3725 3724
3726void CalendarView::showIncidence() 3725void CalendarView::showIncidence()
3727{ 3726{
3728 Incidence *incidence = currentSelection(); 3727 Incidence *incidence = currentSelection();
3729 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3728 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3730 if ( incidence ) { 3729 if ( incidence ) {
3731 ShowIncidenceVisitor v; 3730 ShowIncidenceVisitor v;
3732 v.act( incidence, this ); 3731 v.act( incidence, this );
3733 } 3732 }
3734} 3733}
3735void CalendarView::editIncidenceDescription() 3734void CalendarView::editIncidenceDescription()
3736{ 3735{
3737 mFlagEditDescription = true; 3736 mFlagEditDescription = true;
3738 editIncidence(); 3737 editIncidence();
3739 mFlagEditDescription = false; 3738 mFlagEditDescription = false;
3740} 3739}
3741void CalendarView::editIncidence() 3740void CalendarView::editIncidence()
3742{ 3741{
3743 // qDebug("editIncidence() "); 3742 // qDebug("editIncidence() ");
3744 Incidence *incidence = currentSelection(); 3743 Incidence *incidence = currentSelection();
3745 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3744 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3746 if ( incidence ) { 3745 if ( incidence ) {
3747 EditIncidenceVisitor v; 3746 EditIncidenceVisitor v;
3748 v.act( incidence, this ); 3747 v.act( incidence, this );
3749 } 3748 }
3750} 3749}
3751 3750
3752void CalendarView::deleteIncidence() 3751void CalendarView::deleteIncidence()
3753{ 3752{
3754 Incidence *incidence = currentSelection(); 3753 Incidence *incidence = currentSelection();
3755 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3754 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3756 if ( incidence ) { 3755 if ( incidence ) {
3757 deleteIncidence(incidence); 3756 deleteIncidence(incidence);
3758 } 3757 }
3759} 3758}
3760 3759
3761void CalendarView::showIncidence(Incidence *incidence) 3760void CalendarView::showIncidence(Incidence *incidence)
3762{ 3761{
3763 if ( incidence ) { 3762 if ( incidence ) {
3764 ShowIncidenceVisitor v; 3763 ShowIncidenceVisitor v;
3765 v.act( incidence, this ); 3764 v.act( incidence, this );
3766 } 3765 }
3767} 3766}
3768 3767
3769void CalendarView::editIncidence(Incidence *incidence) 3768void CalendarView::editIncidence(Incidence *incidence)
3770{ 3769{
3771 if ( incidence ) { 3770 if ( incidence ) {
3772 3771
3773 EditIncidenceVisitor v; 3772 EditIncidenceVisitor v;
3774 v.act( incidence, this ); 3773 v.act( incidence, this );
3775 3774
3776 } 3775 }
3777} 3776}
3778 3777
3779void CalendarView::deleteIncidence(Incidence *incidence) 3778void CalendarView::deleteIncidence(Incidence *incidence)
3780{ 3779{
3781 //qDebug(" CalendarView::deleteIncidence "); 3780 //qDebug(" CalendarView::deleteIncidence ");
3782 if ( incidence ) { 3781 if ( incidence ) {
3783 DeleteIncidenceVisitor v; 3782 DeleteIncidenceVisitor v;
3784 v.act( incidence, this ); 3783 v.act( incidence, this );
3785 } 3784 }
3786} 3785}
3787 3786
3788 3787
3789void CalendarView::lookForOutgoingMessages() 3788void CalendarView::lookForOutgoingMessages()
3790{ 3789{
3791 OutgoingDialog *ogd = mDialogManager->outgoingDialog(); 3790 OutgoingDialog *ogd = mDialogManager->outgoingDialog();
3792 ogd->loadMessages(); 3791 ogd->loadMessages();
3793} 3792}
3794 3793
3795void CalendarView::lookForIncomingMessages() 3794void CalendarView::lookForIncomingMessages()
3796{ 3795{
3797 IncomingDialog *icd = mDialogManager->incomingDialog(); 3796 IncomingDialog *icd = mDialogManager->incomingDialog();
3798 icd->retrieve(); 3797 icd->retrieve();
3799} 3798}
3800 3799
3801bool CalendarView::removeCompletedSubTodos( Todo* t ) 3800bool CalendarView::removeCompletedSubTodos( Todo* t )
3802{ 3801{
3803 bool deleteTodo = true; 3802 bool deleteTodo = true;
3804 QPtrList<Incidence> subTodos; 3803 QPtrList<Incidence> subTodos;
3805 Incidence *aTodo; 3804 Incidence *aTodo;
3806 subTodos = t->relations(); 3805 subTodos = t->relations();
3807 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 3806 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
3808 if (! removeCompletedSubTodos( (Todo*) aTodo )) 3807 if (! removeCompletedSubTodos( (Todo*) aTodo ))
3809 deleteTodo = false; 3808 deleteTodo = false;
3810 } 3809 }
3811 if ( deleteTodo ) { 3810 if ( deleteTodo ) {
3812 if ( t->isCompleted() ) { 3811 if ( t->isCompleted() ) {
3813 checkExternalId( t ); 3812 checkExternalId( t );
3814 mCalendar->deleteTodo( t ); 3813 mCalendar->deleteTodo( t );
3815 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 3814 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
3816 } 3815 }
3817 else 3816 else
3818 deleteTodo = false; 3817 deleteTodo = false;
3819 } 3818 }
3820 return deleteTodo; 3819 return deleteTodo;
3821 3820
3822} 3821}
3823void CalendarView::purgeCompleted() 3822void CalendarView::purgeCompleted()
3824{ 3823{
3825 int result = KMessageBox::warningContinueCancel(this, 3824 int result = KMessageBox::warningContinueCancel(this,
3826 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); 3825 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge"));
3827 3826
3828 if (result == KMessageBox::Continue) { 3827 if (result == KMessageBox::Continue) {
3829 3828
3830 QPtrList<Todo> todoCal; 3829 QPtrList<Todo> todoCal;
3831 QPtrList<Todo> rootTodos; 3830 QPtrList<Todo> rootTodos;
3832 //QPtrList<Incidence> rel; 3831 //QPtrList<Incidence> rel;
3833 Todo *aTodo;//, *rTodo; 3832 Todo *aTodo;//, *rTodo;
3834 Incidence *rIncidence; 3833 Incidence *rIncidence;
3835 bool childDelete = false; 3834 bool childDelete = false;
3836 bool deletedOne = true; 3835 bool deletedOne = true;
3837 todoCal = calendar()->todos(); 3836 todoCal = calendar()->todos();
3838 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 3837 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
3839 if ( !aTodo->relatedTo() ) 3838 if ( !aTodo->relatedTo() )
3840 rootTodos.append( aTodo ); 3839 rootTodos.append( aTodo );
3841 } 3840 }
3842 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 3841 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
3843 removeCompletedSubTodos( aTodo ); 3842 removeCompletedSubTodos( aTodo );
3844 } 3843 }
3845 3844
3846 updateView(); 3845 updateView();
3847 } 3846 }
3848} 3847}
3849 3848
3850void CalendarView::slotCalendarChanged() 3849void CalendarView::slotCalendarChanged()
3851{ 3850{
3852 ; 3851 ;
3853} 3852}
3854 3853
3855NavigatorBar *CalendarView::navigatorBar() 3854NavigatorBar *CalendarView::navigatorBar()
3856{ 3855{
3857 return mNavigatorBar; 3856 return mNavigatorBar;
3858} 3857}
3859 3858
3860 3859
3861 3860
3862void CalendarView::keyPressEvent ( QKeyEvent *e) 3861void CalendarView::keyPressEvent ( QKeyEvent *e)
3863{ 3862{
3864 //qDebug(" alendarView::keyPressEvent "); 3863 //qDebug(" alendarView::keyPressEvent ");
3865 e->ignore(); 3864 e->ignore();
3866} 3865}
3867 3866
3868 3867
3869bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 3868bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
3870{ 3869{
3871 // mSyncManager = manager; 3870 // mSyncManager = manager;
3872 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { 3871 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
3873 qDebug("KO: SyncKDE request detected!"); 3872 qDebug("KO: SyncKDE request detected!");
3874 } 3873 }
3875 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 3874 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
3876 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 3875 mCurrentSyncName = mSyncManager->getCurrentSyncName();
3877 return syncCalendar( filename, mode ); 3876 return syncCalendar( filename, mode );
3878} 3877}
3879bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 3878bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
3880{ 3879{
3881 //mSyncManager = manager; 3880 //mSyncManager = manager;
3882 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 3881 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
3883 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 3882 mCurrentSyncName = mSyncManager->getCurrentSyncName();
3884 if ( resource == "sharp" ) 3883 if ( resource == "sharp" )
3885 syncExternal( 0 ); 3884 syncExternal( 0 );
3886 if ( resource == "phone" ) 3885 if ( resource == "phone" )
3887 syncExternal( 1 ); 3886 syncExternal( 1 );
3888 // pending setmodified 3887 // pending setmodified
3889 return true; 3888 return true;
3890} 3889}
3891void CalendarView::setSyncManager(KSyncManager* manager) 3890void CalendarView::setSyncManager(KSyncManager* manager)
3892{ 3891{
3893 mSyncManager = manager; 3892 mSyncManager = manager;
3894} 3893}
3895 3894
3896void CalendarView::removeSyncInfo( QString syncProfile) 3895void CalendarView::removeSyncInfo( QString syncProfile)
3897{ 3896{
3898 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); 3897 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1());
3899 mCalendar->removeSyncInfo( syncProfile ); 3898 mCalendar->removeSyncInfo( syncProfile );
3900 3899
3901} 3900}
3902 3901
3903void CalendarView::undo_delete() 3902void CalendarView::undo_delete()
3904{ 3903{
3905 //qDebug("undo_delete() "); 3904 //qDebug("undo_delete() ");
3906 Incidence* undo = mCalendar->undoIncidence(); 3905 Incidence* undo = mCalendar->undoIncidence();
3907 if ( !undo ) { 3906 if ( !undo ) {
3908 KMessageBox::sorry(this,i18n("There is nothing to undo!"), 3907 KMessageBox::sorry(this,i18n("There is nothing to undo!"),
3909 i18n("KO/Pi")); 3908 i18n("KO/Pi"));
3910 return; 3909 return;
3911 } 3910 }
3912 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + 3911 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) +
3913 i18n("\nAre you sure you want\nto restore this?"), 3912 i18n("\nAre you sure you want\nto restore this?"),
3914 i18n("KO/Pi Confirmation"),i18n("Restore"))) { 3913 i18n("KO/Pi Confirmation"),i18n("Restore"))) {
3915 mCalendar->undoDeleteIncidence(); 3914 mCalendar->undoDeleteIncidence();
3916 updateView(); 3915 updateView();
3917 } 3916 }
3918} 3917}
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 73ee5cb..0eeacb3 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -1,1988 +1,1993 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 Marcus Bains line. 5 Marcus Bains line.
6 Copyright (c) 2001 Ali Rahimi 6 Copyright (c) 2001 Ali Rahimi
7 7
8 This program is free software; you can redistribute it and/or modify 8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or 10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version. 11 (at your option) any later version.
12 12
13 This program is distributed in the hope that it will be useful, 13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details. 16 GNU General Public License for more details.
17 17
18 You should have received a copy of the GNU General Public License 18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software 19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 21
22 As a special exception, permission is given to link this program 22 As a special exception, permission is given to link this program
23 with any edition of Qt, and distribute the resulting executable, 23 with any edition of Qt, and distribute the resulting executable,
24 without including the source code for Qt in the source distribution. 24 without including the source code for Qt in the source distribution.
25*/ 25*/
26 26
27#ifndef _WIN32_ 27#ifndef _WIN32_
28#define protected public 28#define protected public
29#include <qwidget.h> 29#include <qwidget.h>
30#undef protected 30#undef protected
31#endif 31#endif
32#include <qintdict.h> 32#include <qintdict.h>
33#include <qdatetime.h> 33#include <qdatetime.h>
34#include <qapplication.h> 34#include <qapplication.h>
35#include <qpopupmenu.h> 35#include <qpopupmenu.h>
36#include <qcursor.h> 36#include <qcursor.h>
37#include <qpainter.h> 37#include <qpainter.h>
38 38
39#include <kdebug.h> 39#include <kdebug.h>
40#include <klocale.h> 40#include <klocale.h>
41#include <kiconloader.h> 41#include <kiconloader.h>
42#include <kglobal.h> 42#include <kglobal.h>
43 43
44#include "koagendaitem.h" 44#include "koagendaitem.h"
45#include "koprefs.h" 45#include "koprefs.h"
46#include "koglobals.h" 46#include "koglobals.h"
47 47
48#include "koagenda.h" 48#include "koagenda.h"
49 49
50#include <libkcal/event.h> 50#include <libkcal/event.h>
51#include <libkcal/todo.h> 51#include <libkcal/todo.h>
52 52
53#ifndef DESKTOP_VERSION 53#ifndef DESKTOP_VERSION
54#include <qpe/qpeapplication.h> 54#include <qpe/qpeapplication.h>
55#endif 55#endif
56 56
57//extern bool globalFlagBlockPainting; 57//extern bool globalFlagBlockPainting;
58extern int globalFlagBlockAgenda; 58extern int globalFlagBlockAgenda;
59extern int globalFlagBlockAgendaItemPaint; 59extern int globalFlagBlockAgendaItemPaint;
60extern int globalFlagBlockAgendaItemUpdate; 60extern int globalFlagBlockAgendaItemUpdate;
61extern int globalFlagBlockStartup; 61extern int globalFlagBlockStartup;
62 62
63//////////////////////////////////////////////////////////////////////////// 63////////////////////////////////////////////////////////////////////////////
64MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) 64MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name)
65 : QFrame(_agenda->viewport(),name), agenda(_agenda) 65 : QFrame(_agenda->viewport(),name), agenda(_agenda)
66{ 66{
67 setLineWidth(0); 67 setLineWidth(0);
68 setMargin(0); 68 setMargin(0);
69 setBackgroundColor(Qt::red); 69 setBackgroundColor(Qt::red);
70 minutes = new QTimer(this); 70 minutes = new QTimer(this);
71 connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc())); 71 connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc()));
72 minutes->start(0, true); 72 minutes->start(0, true);
73 73
74 mTimeBox = new QLabel(this); 74 mTimeBox = new QLabel(this);
75 mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom); 75 mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom);
76 QPalette pal = mTimeBox->palette(); 76 QPalette pal = mTimeBox->palette();
77 pal.setColor(QColorGroup::Foreground, Qt::red); 77 pal.setColor(QColorGroup::Foreground, Qt::red);
78 mTimeBox->setPalette(pal); 78 mTimeBox->setPalette(pal);
79 //mTimeBox->setAutoMask(true); 79 //mTimeBox->setAutoMask(true);
80 80
81 agenda->addChild(mTimeBox); 81 agenda->addChild(mTimeBox);
82 82
83 oldToday = -1; 83 oldToday = -1;
84} 84}
85 85
86MarcusBains::~MarcusBains() 86MarcusBains::~MarcusBains()
87{ 87{
88 delete minutes; 88 delete minutes;
89} 89}
90 90
91int MarcusBains::todayColumn() 91int MarcusBains::todayColumn()
92{ 92{
93 QDate currentDate = QDate::currentDate(); 93 QDate currentDate = QDate::currentDate();
94 94
95 DateList dateList = agenda->dateList(); 95 DateList dateList = agenda->dateList();
96 DateList::ConstIterator it; 96 DateList::ConstIterator it;
97 int col = 0; 97 int col = 0;
98 for(it = dateList.begin(); it != dateList.end(); ++it) { 98 for(it = dateList.begin(); it != dateList.end(); ++it) {
99 if((*it) == currentDate) 99 if((*it) == currentDate)
100 return KOGlobals::self()->reverseLayout() ? 100 return KOGlobals::self()->reverseLayout() ?
101 agenda->columns() - 1 - col : col; 101 agenda->columns() - 1 - col : col;
102 ++col; 102 ++col;
103 } 103 }
104 104
105 return -1; 105 return -1;
106} 106}
107void MarcusBains::updateLoc() 107void MarcusBains::updateLoc()
108{ 108{
109 updateLocation(); 109 updateLocation();
110} 110}
111void MarcusBains::updateLocation(bool recalculate) 111void MarcusBains::updateLocation(bool recalculate)
112{ 112{
113 113
114 QTime tim = QTime::currentTime(); 114 QTime tim = QTime::currentTime();
115 //qDebug(" MarcusBains::updateLocation %s ", tim.toString().latin1()); 115 //qDebug(" MarcusBains::updateLocation %s ", tim.toString().latin1());
116 if((tim.hour() == 0) && (oldTime.hour()==23)) 116 if((tim.hour() == 0) && (oldTime.hour()==23))
117 recalculate = true; 117 recalculate = true;
118 118
119 int mins = tim.hour()*60 + tim.minute(); 119 int mins = tim.hour()*60 + tim.minute();
120 int minutesPerCell = 24 * 60 / agenda->rows(); 120 int minutesPerCell = 24 * 60 / agenda->rows();
121 int y = mins*agenda->gridSpacingY()/minutesPerCell; 121 int y = mins*agenda->gridSpacingY()/minutesPerCell;
122 int today = recalculate ? todayColumn() : oldToday; 122 int today = recalculate ? todayColumn() : oldToday;
123 int x = agenda->gridSpacingX()*today; 123 int x = agenda->gridSpacingX()*today;
124 bool disabled = !(KOPrefs::instance()->mMarcusBainsEnabled); 124 bool disabled = !(KOPrefs::instance()->mMarcusBainsEnabled);
125 125
126 oldTime = tim; 126 oldTime = tim;
127 oldToday = today; 127 oldToday = today;
128 128
129 if(disabled || (today<0)) { 129 if(disabled || (today<0)) {
130 hide(); mTimeBox->hide(); 130 hide(); mTimeBox->hide();
131 return; 131 return;
132 } else { 132 } else {
133 show(); mTimeBox->show(); 133 show(); mTimeBox->show();
134 } 134 }
135 135
136 if(recalculate) 136 if(recalculate)
137 setFixedSize(agenda->gridSpacingX(),1); 137 setFixedSize(agenda->gridSpacingX(),1);
138 agenda->moveChild(this, x, y); 138 agenda->moveChild(this, x, y);
139 raise(); 139 raise();
140 140
141 if(recalculate) 141 if(recalculate)
142 //mTimeBox->setFont(QFont("helvetica",10)); 142 //mTimeBox->setFont(QFont("helvetica",10));
143 mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont); 143 mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont);
144 144
145 mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds)); 145 mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds));
146 mTimeBox->adjustSize(); 146 mTimeBox->adjustSize();
147 // the -2 below is there because there is a bug in this program 147 // the -2 below is there because there is a bug in this program
148 // somewhere, where the last column of this widget is a few pixels 148 // somewhere, where the last column of this widget is a few pixels
149 // narrower than the other columns. 149 // narrower than the other columns.
150 int offs = (today==agenda->columns()-1) ? -4 : 0; 150 int offs = (today==agenda->columns()-1) ? -4 : 0;
151 agenda->moveChild(mTimeBox, 151 agenda->moveChild(mTimeBox,
152 x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, 152 x+agenda->gridSpacingX()-mTimeBox->width()+offs-1,
153 y-mTimeBox->height()); 153 y-mTimeBox->height());
154 154
155 mTimeBox->raise(); 155 mTimeBox->raise();
156 //mTimeBox->setAutoMask(true); 156 //mTimeBox->setAutoMask(true);
157 minutes->start(5000,true); 157 minutes->start(5000,true);
158} 158}
159 159
160 160
161//////////////////////////////////////////////////////////////////////////// 161////////////////////////////////////////////////////////////////////////////
162 162
163 163
164/* 164/*
165 Create an agenda widget with rows rows and columns columns. 165 Create an agenda widget with rows rows and columns columns.
166*/ 166*/
167KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, 167KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent,
168 const char *name,WFlags f) : 168 const char *name,WFlags f) :
169 QScrollView(parent,name,f) 169 QScrollView(parent,name,f)
170{ 170{
171 mNewItemPopup = new QPopupMenu( this ); 171
172 connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) );
173 QString pathString = "";
174 if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
175 if ( QApplication::desktop()->width() < 480 )
176 pathString += "icons16/";
177 } else
178 pathString += "iconsmini/";
179
180 mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 );
181 mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 );
182 172
183 mColumns = columns; 173 mColumns = columns;
184 mRows = rows; 174 mRows = rows;
185 mGridSpacingY = rowSize; 175 mGridSpacingY = rowSize;
186 mAllDayMode = false; 176 mAllDayMode = false;
187#ifndef DESKTOP_VERSION 177#ifndef DESKTOP_VERSION
188 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 178 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
189#endif 179#endif
190 mHolidayMask = 0; 180 mHolidayMask = 0;
191 init(); 181 init();
192} 182}
193 183
194/* 184/*
195 Create an agenda widget with columns columns and one row. This is used for 185 Create an agenda widget with columns columns and one row. This is used for
196 all-day events. 186 all-day events.
197*/ 187*/
198KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : 188KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) :
199 QScrollView(parent,name,f) 189 QScrollView(parent,name,f)
200{ 190{
201 mNewItemPopup = new QPopupMenu( this );
202 connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) );
203 QString pathString = "";
204 if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
205 if ( QApplication::desktop()->width() < 480 )
206 pathString += "icons16/";
207 } else
208 pathString += "iconsmini/";
209 mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."),1 );
210 mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 );
211 blockResize = false; 191 blockResize = false;
212 mColumns = columns; 192 mColumns = columns;
213 mRows = 1; 193 mRows = 1;
214 //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); 194 //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize);
215 mGridSpacingY = KOPrefs::instance()->mAllDaySize; 195 mGridSpacingY = KOPrefs::instance()->mAllDaySize;
216 mAllDayMode = true; 196 mAllDayMode = true;
217#ifndef DESKTOP_VERSION 197#ifndef DESKTOP_VERSION
218 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 198 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
219#endif 199#endif
220 mHolidayMask = 0; 200 mHolidayMask = 0;
221 init(); 201 init();
222} 202}
223 203
224 204
225KOAgenda::~KOAgenda() 205KOAgenda::~KOAgenda()
226{ 206{
227 if(mMarcusBains) delete mMarcusBains; 207 if(mMarcusBains) delete mMarcusBains;
228 208
229} 209}
230 210
231Incidence *KOAgenda::selectedIncidence() const 211Incidence *KOAgenda::selectedIncidence() const
232{ 212{
233 return (mSelectedItem ? mSelectedItem->incidence() : 0); 213 return (mSelectedItem ? mSelectedItem->incidence() : 0);
234} 214}
235 215
236 216
237QDate KOAgenda::selectedIncidenceDate() const 217QDate KOAgenda::selectedIncidenceDate() const
238{ 218{
239 return (mSelectedItem ? mSelectedItem->itemDate() : QDate()); 219 return (mSelectedItem ? mSelectedItem->itemDate() : QDate());
240} 220}
241 221
242 222
243void KOAgenda::init() 223void KOAgenda::init()
244{ 224{
225 mNewItemPopup = new QPopupMenu( this );
226 connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) );
227 QString pathString = "";
228 if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
229 if ( QApplication::desktop()->width() < 480 )
230 pathString += "icons16/";
231 } else
232 pathString += "iconsmini/";
233
234 mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 );
235 mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 );
236 mNewItemPopup->insertSeparator ( );
237 mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 );
238 mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 );
239 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 );
240 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 );
241 mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next month"),6 );
242 mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 );
245#ifndef _WIN32_ 243#ifndef _WIN32_
246 int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase 244 int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase
247 viewport()->setWFlags ( wflags); 245 viewport()->setWFlags ( wflags);
248#endif 246#endif
249 mGridSpacingX = 80; 247 mGridSpacingX = 80;
250 mResizeBorderWidth = 8; 248 mResizeBorderWidth = 8;
251 mScrollBorderWidth = 8; 249 mScrollBorderWidth = 8;
252 mScrollDelay = 30; 250 mScrollDelay = 30;
253 mScrollOffset = 10; 251 mScrollOffset = 10;
254 mPaintPixmap.resize( 20,20); 252 mPaintPixmap.resize( 20,20);
255 //enableClipper(true); 253 //enableClipper(true);
256 254
257 // Grab key strokes for keyboard navigation of agenda. Seems to have no 255 // Grab key strokes for keyboard navigation of agenda. Seems to have no
258 // effect. Has to be fixed. 256 // effect. Has to be fixed.
259 setFocusPolicy(WheelFocus); 257 setFocusPolicy(WheelFocus);
260 258
261 connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp())); 259 connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp()));
262 connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown())); 260 connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown()));
263 connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize())); 261 connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize()));
264 262
265 mStartCellX = 0; 263 mStartCellX = 0;
266 mStartCellY = 0; 264 mStartCellY = 0;
267 mCurrentCellX = 0; 265 mCurrentCellX = 0;
268 mCurrentCellY = 0; 266 mCurrentCellY = 0;
269 267
270 mSelectionCellX = 0; 268 mSelectionCellX = 0;
271 mSelectionYTop = 0; 269 mSelectionYTop = 0;
272 mSelectionHeight = 0; 270 mSelectionHeight = 0;
273 271
274 mOldLowerScrollValue = -1; 272 mOldLowerScrollValue = -1;
275 mOldUpperScrollValue = -1; 273 mOldUpperScrollValue = -1;
276 274
277 mClickedItem = 0; 275 mClickedItem = 0;
278 276
279 mActionItem = 0; 277 mActionItem = 0;
280 mActionType = NOP; 278 mActionType = NOP;
281 mItemMoved = false; 279 mItemMoved = false;
282 280
283 mSelectedItem = 0; 281 mSelectedItem = 0;
284 282
285 // mItems.setAutoDelete(true); 283 // mItems.setAutoDelete(true);
286 284
287 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); 285 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
288 286
289 viewport()->update(); 287 viewport()->update();
290 288
291 setMinimumSize(30, 1); 289 setMinimumSize(30, 1);
292// setMaximumHeight(mGridSpacingY * mRows + 5); 290// setMaximumHeight(mGridSpacingY * mRows + 5);
293 291
294 // Disable horizontal scrollbar. This is a hack. The geometry should be 292 // Disable horizontal scrollbar. This is a hack. The geometry should be
295 // controlled in a way that the contents horizontally always fits. Then it is 293 // controlled in a way that the contents horizontally always fits. Then it is
296 // not necessary to turn off the scrollbar. 294 // not necessary to turn off the scrollbar.
297 setHScrollBarMode(AlwaysOff); 295 setHScrollBarMode(AlwaysOff);
298 if ( ! mAllDayMode ) 296 if ( ! mAllDayMode )
299 setVScrollBarMode(AlwaysOn); 297 setVScrollBarMode(AlwaysOn);
300 else 298 else
301 setVScrollBarMode(AlwaysOff); 299 setVScrollBarMode(AlwaysOff);
302 300
303 setStartHour(KOPrefs::instance()->mDayBegins); 301 setStartHour(KOPrefs::instance()->mDayBegins);
304 302
305 calculateWorkingHours(); 303 calculateWorkingHours();
306 304
307 connect(verticalScrollBar(),SIGNAL(valueChanged(int)), 305 connect(verticalScrollBar(),SIGNAL(valueChanged(int)),
308 SLOT(checkScrollBoundaries(int))); 306 SLOT(checkScrollBoundaries(int)));
309 307
310 // Create the Marcus Bains line. 308 // Create the Marcus Bains line.
311 if(mAllDayMode) 309 if(mAllDayMode)
312 mMarcusBains = 0; 310 mMarcusBains = 0;
313 else { 311 else {
314 mMarcusBains = new MarcusBains(this); 312 mMarcusBains = new MarcusBains(this);
315 addChild(mMarcusBains); 313 addChild(mMarcusBains);
316 } 314 }
317} 315}
318 316
319void KOAgenda::clear() 317void KOAgenda::clear()
320{ 318{
321 KOAgendaItem *item; 319 KOAgendaItem *item;
322 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 320 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
323 mUnusedItems.append( item ); 321 mUnusedItems.append( item );
324 //item->hide(); 322 //item->hide();
325 } 323 }
326 mItems.clear(); 324 mItems.clear();
327 mSelectedItem = 0; 325 mSelectedItem = 0;
328 clearSelection(); 326 clearSelection();
329} 327}
330 328
331void KOAgenda::clearSelection() 329void KOAgenda::clearSelection()
332{ 330{
333 mSelectionCellX = 0; 331 mSelectionCellX = 0;
334 mSelectionYTop = 0; 332 mSelectionYTop = 0;
335 mSelectionHeight = 0; 333 mSelectionHeight = 0;
336} 334}
337 335
338void KOAgenda::marcus_bains() 336void KOAgenda::marcus_bains()
339{ 337{
340 if(mMarcusBains) mMarcusBains->updateLocation(true); 338 if(mMarcusBains) mMarcusBains->updateLocation(true);
341} 339}
342 340
343 341
344void KOAgenda::changeColumns(int columns) 342void KOAgenda::changeColumns(int columns)
345{ 343{
346 if (columns == 0) { 344 if (columns == 0) {
347 kdDebug() << "KOAgenda::changeColumns() called with argument 0" << endl; 345 kdDebug() << "KOAgenda::changeColumns() called with argument 0" << endl;
348 return; 346 return;
349 } 347 }
350 348
351 clear(); 349 clear();
352 350
353 mColumns = columns; 351 mColumns = columns;
354// setMinimumSize(mColumns * 10, mGridSpacingY + 1); 352// setMinimumSize(mColumns * 10, mGridSpacingY + 1);
355// init(); 353// init();
356// update(); 354// update();
357 //qDebug("KOAgenda::changeColumns "); 355 //qDebug("KOAgenda::changeColumns ");
358 computeSizes(); 356 computeSizes();
359 // QResizeEvent event( size(), size() ); 357 // QResizeEvent event( size(), size() );
360 358
361 //QApplication::sendEvent( this, &event ); 359 //QApplication::sendEvent( this, &event );
362} 360}
363 361
364/* 362/*
365 This is the eventFilter function, which gets all events from the KOAgendaItems 363 This is the eventFilter function, which gets all events from the KOAgendaItems
366 contained in the agenda. It has to handle moving and resizing for all items. 364 contained in the agenda. It has to handle moving and resizing for all items.
367*/ 365*/
368bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) 366bool KOAgenda::eventFilter ( QObject *object, QEvent *event )
369{ 367{
370// kdDebug() << "KOAgenda::eventFilter" << endl; 368// kdDebug() << "KOAgenda::eventFilter" << endl;
371 switch(event->type()) { 369 switch(event->type()) {
372 case QEvent::MouseButtonPress: 370 case QEvent::MouseButtonPress:
373 case QEvent::MouseButtonDblClick: 371 case QEvent::MouseButtonDblClick:
374 case QEvent::MouseButtonRelease: 372 case QEvent::MouseButtonRelease:
375 case QEvent::MouseMove: 373 case QEvent::MouseMove:
376 return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); 374 return eventFilter_mouse(object, static_cast<QMouseEvent *>(event));
377 375
378 case (QEvent::Leave): 376 case (QEvent::Leave):
379 if (!mActionItem) 377 if (!mActionItem)
380 setCursor(arrowCursor); 378 setCursor(arrowCursor);
381 return true; 379 return true;
382 380
383 default: 381 default:
384 return QScrollView::eventFilter(object,event); 382 return QScrollView::eventFilter(object,event);
385 } 383 }
386} 384}
387 385
388 386
389bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) 387bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
390{ 388{
391 //qDebug("KOAgenda::eventFilter_mous "); 389 //qDebug("KOAgenda::eventFilter_mous ");
392 QPoint viewportPos; 390 QPoint viewportPos;
393 if (object != viewport()) { 391 if (object != viewport()) {
394 viewportPos = ((QWidget *)object)->mapToParent(me->pos()); 392 viewportPos = ((QWidget *)object)->mapToParent(me->pos());
395 } else { 393 } else {
396 viewportPos = me->pos(); 394 viewportPos = me->pos();
397 } 395 }
398 static int startX = 0; 396 static int startX = 0;
399 static int startY = 0; 397 static int startY = 0;
400 static bool block = true; 398 static bool block = true;
401 switch (me->type()) { 399 switch (me->type()) {
402 case QEvent::MouseButtonPress: 400 case QEvent::MouseButtonPress:
403 //qDebug("QEvent::MouseButtonPress: "); 401 //qDebug("QEvent::MouseButtonPress: ");
404 // kdDebug() << "koagenda: filtered button press" << endl; 402 // kdDebug() << "koagenda: filtered button press" << endl;
405 if (object != viewport()) { 403 if (object != viewport()) {
406 if (me->button() == RightButton) { 404 if (me->button() == RightButton) {
407 405
408 mClickedItem = (KOAgendaItem *)object; 406 mClickedItem = (KOAgendaItem *)object;
409 if (mClickedItem) { 407 if (mClickedItem) {
410 selectItem(mClickedItem); 408 selectItem(mClickedItem);
411 // emit showIncidencePopupSignal(mClickedItem->incidence()); 409 // emit showIncidencePopupSignal(mClickedItem->incidence());
412 } 410 }
413 //mItemPopup->popup(QCursor::pos()); 411 //mItemPopup->popup(QCursor::pos());
414 } else { 412 } else {
415 mActionItem = (KOAgendaItem *)object; 413 mActionItem = (KOAgendaItem *)object;
416 if (mActionItem) { 414 if (mActionItem) {
417 if ( mSelectionHeight > 0 ) { 415 if ( mSelectionHeight > 0 ) {
418 int selectionCellX = mSelectionCellX * mGridSpacingX; 416 int selectionCellX = mSelectionCellX * mGridSpacingX;
419 int selectionYTop = mSelectionYTop; 417 int selectionYTop = mSelectionYTop;
420 int gridSpacingX = mGridSpacingX; 418 int gridSpacingX = mGridSpacingX;
421 int selectionHeight = mSelectionHeight; 419 int selectionHeight = mSelectionHeight;
422 clearSelection(); 420 clearSelection();
423 repaintContents( selectionCellX, selectionYTop, 421 repaintContents( selectionCellX, selectionYTop,
424 gridSpacingX, selectionHeight,false ); 422 gridSpacingX, selectionHeight,false );
425 } 423 }
426 selectItem(mActionItem); 424 selectItem(mActionItem);
427 Incidence *incidence = mActionItem->incidence(); 425 Incidence *incidence = mActionItem->incidence();
428 if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { 426 if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) {
429 mActionItem = 0; 427 mActionItem = 0;
430 } else { 428 } else {
431 startItemAction(viewportPos); 429 startItemAction(viewportPos);
432 startX = viewportPos.x(); 430 startX = viewportPos.x();
433 startY = viewportPos.y(); 431 startY = viewportPos.y();
434 block = true; 432 block = true;
435 } 433 }
436 } 434 }
437 } 435 }
438 } else { 436 } else {
439 selectItem(0); 437 selectItem(0);
440 mActionItem = 0; 438 mActionItem = 0;
441 if (me->button() == RightButton ) { 439 if (me->button() == RightButton ) {
442 blockNewEvent = true; 440 blockNewEvent = true;
443 qDebug("right "); 441 qDebug("right ");
444 int x,y; 442 int x,y;
445 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 443 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
446 int gx,gy; 444 int gx,gy;
447 contentsToGrid(x,y,gx,gy); 445 contentsToGrid(x,y,gx,gy);
448 mStartCellX = gx; 446 mStartCellX = gx;
449 mStartCellY = gy; 447 mStartCellY = gy;
450 mCurrentCellX = gx; 448 mCurrentCellX = gx;
451 mCurrentCellY = gy; 449 mCurrentCellY = gy;
452 mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) ); 450 mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) );
453 451
454 } else { 452 } else {
455 blockNewEvent = false; 453 blockNewEvent = false;
456 setCursor(arrowCursor); 454 setCursor(arrowCursor);
457 startSelectAction(viewportPos); 455 startSelectAction(viewportPos);
458 } 456 }
459 } 457 }
460 break; 458 break;
461 459
462 case QEvent::MouseButtonRelease: 460 case QEvent::MouseButtonRelease:
463 //qDebug("QEvent::MouseButtonRelease: "); 461 //qDebug("QEvent::MouseButtonRelease: ");
464 if (me->button() == RightButton && block ) { 462 if (me->button() == RightButton && block ) {
465 if (object != viewport()) { 463 if (object != viewport()) {
466 mClickedItem = (KOAgendaItem *)object; 464 mClickedItem = (KOAgendaItem *)object;
467 if (mActionItem ) { 465 if (mActionItem ) {
468 endItemAction(); 466 endItemAction();
469 } 467 }
470 if (mClickedItem) { 468 if (mClickedItem) {
471 selectItem(mClickedItem); 469 selectItem(mClickedItem);
472 emit showIncidencePopupSignal(mClickedItem->incidence()); 470 emit showIncidencePopupSignal(mClickedItem->incidence());
473 } 471 }
474 } 472 }
475 break; 473 break;
476 } 474 }
477 block = true; 475 block = true;
478 if (mActionItem) { 476 if (mActionItem) {
479 QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); 477 QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos));
480 //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); 478 //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 );
481 if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { 479 if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) {
482 mScrollUpTimer.stop(); 480 mScrollUpTimer.stop();
483 mScrollDownTimer.stop(); 481 mScrollDownTimer.stop();
484 mActionItem->resetMove(); 482 mActionItem->resetMove();
485 placeSubCells( mActionItem ); 483 placeSubCells( mActionItem );
486 // emit startDragSignal( mActionItem->incidence() ); 484 // emit startDragSignal( mActionItem->incidence() );
487 setCursor( arrowCursor ); 485 setCursor( arrowCursor );
488 mActionItem = 0; 486 mActionItem = 0;
489 mActionType = NOP; 487 mActionType = NOP;
490 mItemMoved = 0; 488 mItemMoved = 0;
491 return true; 489 return true;
492 } 490 }
493 endItemAction(); 491 endItemAction();
494 } else if ( mActionType == SELECT ) { 492 } else if ( mActionType == SELECT ) {
495 if (me->button() == RightButton ) { 493 if (me->button() == RightButton ) {
496 494
497 } else { 495 } else {
498 endSelectAction( !blockNewEvent ); 496 endSelectAction( !blockNewEvent );
499 } 497 }
500 } 498 }
501 break; 499 break;
502 500
503 case QEvent::MouseMove: 501 case QEvent::MouseMove:
504 if (object != viewport()) { 502 if (object != viewport()) {
505 KOAgendaItem *moveItem = (KOAgendaItem *)object; 503 KOAgendaItem *moveItem = (KOAgendaItem *)object;
506 //qDebug("moveItem %d ",moveItem ); 504 //qDebug("moveItem %d ",moveItem );
507 if (!moveItem->incidence()->isReadOnly() /*&& 505 if (!moveItem->incidence()->isReadOnly() /*&&
508 !moveItem->incidence()->recurrence()->doesRecur()*/ ) 506 !moveItem->incidence()->recurrence()->doesRecur()*/ )
509 if (!mActionItem) 507 if (!mActionItem)
510 setNoActionCursor(moveItem,viewportPos); 508 setNoActionCursor(moveItem,viewportPos);
511 else { 509 else {
512 if ( block ) { 510 if ( block ) {
513 int dX, dY; 511 int dX, dY;
514 dX = startX - viewportPos.x(); 512 dX = startX - viewportPos.x();
515 if ( dX < 0 ) 513 if ( dX < 0 )
516 dX = -dX; 514 dX = -dX;
517 dY = viewportPos.y() - startY; 515 dY = viewportPos.y() - startY;
518 if ( dY < 0 ) 516 if ( dY < 0 )
519 dY = -dY; 517 dY = -dY;
520 int diff = 30; 518 int diff = 30;
521 if ( QApplication::desktop()->width() < 480 ) 519 if ( QApplication::desktop()->width() < 480 )
522 diff = 15; 520 diff = 15;
523 // qDebug(" %d %d ",dX, dY ); 521 // qDebug(" %d %d ",dX, dY );
524 if ( dX > diff || dY > diff ) { 522 if ( dX > diff || dY > diff ) {
525 block = false; 523 block = false;
526 } 524 }
527 } 525 }
528 if ( !block ) 526 if ( !block )
529 performItemAction(viewportPos); 527 performItemAction(viewportPos);
530 } 528 }
531 } else { 529 } else {
532 if ( mActionType == SELECT ) { 530 if ( mActionType == SELECT ) {
533 performSelectAction( viewportPos ); 531 performSelectAction( viewportPos );
534 } 532 }
535 } 533 }
536 break; 534 break;
537 535
538 case QEvent::MouseButtonDblClick: 536 case QEvent::MouseButtonDblClick:
539 if (object == viewport()) { 537 if (object == viewport()) {
540 selectItem(0); 538 selectItem(0);
541 int x,y; 539 int x,y;
542 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 540 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
543 int gx,gy; 541 int gx,gy;
544 contentsToGrid(x,y,gx,gy); 542 contentsToGrid(x,y,gx,gy);
545 emit newEventSignal(gx,gy); 543 emit newEventSignal(gx,gy);
546 } else { 544 } else {
547 KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; 545 KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object;
548 selectItem(doubleClickedItem); 546 selectItem(doubleClickedItem);
549 if ( KOPrefs::instance()->mEditOnDoubleClick ) 547 if ( KOPrefs::instance()->mEditOnDoubleClick )
550 emit editIncidenceSignal(doubleClickedItem->incidence()); 548 emit editIncidenceSignal(doubleClickedItem->incidence());
551 else 549 else
552 emit showIncidenceSignal(doubleClickedItem->incidence()); 550 emit showIncidenceSignal(doubleClickedItem->incidence());
553 } 551 }
554 break; 552 break;
555 553
556 default: 554 default:
557 break; 555 break;
558 } 556 }
559 557
560 return true; 558 return true;
561} 559}
562 560
563void KOAgenda::newItem( int item ) 561void KOAgenda::newItem( int item )
564{ 562{
565 qDebug("new %d ", item);
566 if ( item == 1 ) { //new event 563 if ( item == 1 ) { //new event
567 newEventSignal(mStartCellX ,mStartCellY ); 564 newEventSignal(mStartCellX ,mStartCellY );
568 } 565 } else
569 if ( item == 2 ) { //new event 566 if ( item == 2 ) { //new event
570 newTodoSignal(mStartCellX ,mStartCellY ); 567 newTodoSignal(mStartCellX ,mStartCellY );
571 } 568 } else
569 {
570 QDate day = mSelectedDates[mStartCellX];
571 emit showDateView( item, day );
572 // 3Day view
573 // 4Week view
574 // 5Month view
575 // 6Journal view
576 }
572} 577}
573void KOAgenda::startSelectAction(QPoint viewportPos) 578void KOAgenda::startSelectAction(QPoint viewportPos)
574{ 579{
575 //emit newStartSelectSignal(); 580 //emit newStartSelectSignal();
576 581
577 mActionType = SELECT; 582 mActionType = SELECT;
578 583
579 int x,y; 584 int x,y;
580 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 585 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
581 int gx,gy; 586 int gx,gy;
582 contentsToGrid(x,y,gx,gy); 587 contentsToGrid(x,y,gx,gy);
583 588
584 mStartCellX = gx; 589 mStartCellX = gx;
585 mStartCellY = gy; 590 mStartCellY = gy;
586 mCurrentCellX = gx; 591 mCurrentCellX = gx;
587 mCurrentCellY = gy; 592 mCurrentCellY = gy;
588 593
589 // Store coordinates of old selection 594 // Store coordinates of old selection
590 int selectionX = mSelectionCellX * mGridSpacingX; 595 int selectionX = mSelectionCellX * mGridSpacingX;
591 int selectionYTop = mSelectionYTop; 596 int selectionYTop = mSelectionYTop;
592 int selectionHeight = mSelectionHeight; 597 int selectionHeight = mSelectionHeight;
593 598
594 // Store new selection 599 // Store new selection
595 mSelectionCellX = gx; 600 mSelectionCellX = gx;
596 mSelectionYTop = gy * mGridSpacingY; 601 mSelectionYTop = gy * mGridSpacingY;
597 mSelectionHeight = mGridSpacingY; 602 mSelectionHeight = mGridSpacingY;
598 603
599 // Clear old selection 604 // Clear old selection
600 repaintContents( selectionX, selectionYTop, 605 repaintContents( selectionX, selectionYTop,
601 mGridSpacingX, selectionHeight,false ); 606 mGridSpacingX, selectionHeight,false );
602 607
603 // Paint new selection 608 // Paint new selection
604 // repaintContents( mSelectionCellX * mGridSpacingX, mSelectionYTop, 609 // repaintContents( mSelectionCellX * mGridSpacingX, mSelectionYTop,
605 // mGridSpacingX, mSelectionHeight ); 610 // mGridSpacingX, mSelectionHeight );
606} 611}
607 612
608void KOAgenda::performSelectAction(QPoint viewportPos) 613void KOAgenda::performSelectAction(QPoint viewportPos)
609{ 614{
610 int x,y; 615 int x,y;
611 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 616 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
612 int gx,gy; 617 int gx,gy;
613 contentsToGrid(x,y,gx,gy); 618 contentsToGrid(x,y,gx,gy);
614 619
615 QPoint clipperPos = clipper()-> 620 QPoint clipperPos = clipper()->
616 mapFromGlobal(viewport()->mapToGlobal(viewportPos)); 621 mapFromGlobal(viewport()->mapToGlobal(viewportPos));
617 622
618 // Scroll if cursor was moved to upper or lower end of agenda. 623 // Scroll if cursor was moved to upper or lower end of agenda.
619 if (clipperPos.y() < mScrollBorderWidth) { 624 if (clipperPos.y() < mScrollBorderWidth) {
620 mScrollUpTimer.start(mScrollDelay); 625 mScrollUpTimer.start(mScrollDelay);
621 } else if (visibleHeight() - clipperPos.y() < 626 } else if (visibleHeight() - clipperPos.y() <
622 mScrollBorderWidth) { 627 mScrollBorderWidth) {
623 mScrollDownTimer.start(mScrollDelay); 628 mScrollDownTimer.start(mScrollDelay);
624 } else { 629 } else {
625 mScrollUpTimer.stop(); 630 mScrollUpTimer.stop();
626 mScrollDownTimer.stop(); 631 mScrollDownTimer.stop();
627 } 632 }
628 633
629 if ( gy > mCurrentCellY ) { 634 if ( gy > mCurrentCellY ) {
630 mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; 635 mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop;
631 636
632#if 0 637#if 0
633 // FIXME: Repaint only the newly selected region 638 // FIXME: Repaint only the newly selected region
634 repaintContents( mSelectionCellX * mGridSpacingX, 639 repaintContents( mSelectionCellX * mGridSpacingX,
635 mCurrentCellY + mGridSpacingY, 640 mCurrentCellY + mGridSpacingY,
636 mGridSpacingX, 641 mGridSpacingX,
637 mSelectionHeight - ( gy - mCurrentCellY - 1 ) * mGridSpacingY ); 642 mSelectionHeight - ( gy - mCurrentCellY - 1 ) * mGridSpacingY );
638#else 643#else
639 repaintContents( (KOGlobals::self()->reverseLayout() ? 644 repaintContents( (KOGlobals::self()->reverseLayout() ?
640 mColumns - 1 - mSelectionCellX : mSelectionCellX) * 645 mColumns - 1 - mSelectionCellX : mSelectionCellX) *
641 mGridSpacingX, mSelectionYTop, 646 mGridSpacingX, mSelectionYTop,
642 mGridSpacingX, mSelectionHeight , false); 647 mGridSpacingX, mSelectionHeight , false);
643#endif 648#endif
644 649
645 mCurrentCellY = gy; 650 mCurrentCellY = gy;
646 } else if ( gy < mCurrentCellY ) { 651 } else if ( gy < mCurrentCellY ) {
647 if ( gy >= mStartCellY ) { 652 if ( gy >= mStartCellY ) {
648 int selectionHeight = mSelectionHeight; 653 int selectionHeight = mSelectionHeight;
649 mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; 654 mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop;
650 655
651 repaintContents( (KOGlobals::self()->reverseLayout() ? 656 repaintContents( (KOGlobals::self()->reverseLayout() ?
652 mColumns - 1 - mSelectionCellX : mSelectionCellX) * 657 mColumns - 1 - mSelectionCellX : mSelectionCellX) *
653 mGridSpacingX, mSelectionYTop, 658 mGridSpacingX, mSelectionYTop,
654 mGridSpacingX, selectionHeight,false ); 659 mGridSpacingX, selectionHeight,false );
655 660
656 mCurrentCellY = gy; 661 mCurrentCellY = gy;
657 } else { 662 } else {
658 } 663 }
659 } 664 }
660} 665}
661 666
662void KOAgenda::endSelectAction( bool emitNewEvent ) 667void KOAgenda::endSelectAction( bool emitNewEvent )
663{ 668{
664 mActionType = NOP; 669 mActionType = NOP;
665 mScrollUpTimer.stop(); 670 mScrollUpTimer.stop();
666 mScrollDownTimer.stop(); 671 mScrollDownTimer.stop();
667 672
668 emit newTimeSpanSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); 673 emit newTimeSpanSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY);
669 if ( emitNewEvent && mStartCellY < mCurrentCellY ) 674 if ( emitNewEvent && mStartCellY < mCurrentCellY )
670 emit newEventSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); 675 emit newEventSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY);
671} 676}
672 677
673void KOAgenda::startItemAction(QPoint viewportPos) 678void KOAgenda::startItemAction(QPoint viewportPos)
674{ 679{
675 int x,y; 680 int x,y;
676 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 681 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
677 int gx,gy; 682 int gx,gy;
678 contentsToGrid(x,y,gx,gy); 683 contentsToGrid(x,y,gx,gy);
679 684
680 mStartCellX = gx; 685 mStartCellX = gx;
681 mStartCellY = gy; 686 mStartCellY = gy;
682 mCurrentCellX = gx; 687 mCurrentCellX = gx;
683 mCurrentCellY = gy; 688 mCurrentCellY = gy;
684 689
685 if (mAllDayMode) { 690 if (mAllDayMode) {
686 int gridDistanceX = (x - gx * mGridSpacingX); 691 int gridDistanceX = (x - gx * mGridSpacingX);
687 if (gridDistanceX < mResizeBorderWidth && 692 if (gridDistanceX < mResizeBorderWidth &&
688 mActionItem->cellX() == mCurrentCellX) { 693 mActionItem->cellX() == mCurrentCellX) {
689 mActionType = RESIZELEFT; 694 mActionType = RESIZELEFT;
690 setCursor(sizeHorCursor); 695 setCursor(sizeHorCursor);
691 } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && 696 } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth &&
692 mActionItem->cellXWidth() == mCurrentCellX) { 697 mActionItem->cellXWidth() == mCurrentCellX) {
693 mActionType = RESIZERIGHT; 698 mActionType = RESIZERIGHT;
694 setCursor(sizeHorCursor); 699 setCursor(sizeHorCursor);
695 } else { 700 } else {
696 mActionType = MOVE; 701 mActionType = MOVE;
697 mActionItem->startMove(); 702 mActionItem->startMove();
698 setCursor(sizeAllCursor); 703 setCursor(sizeAllCursor);
699 } 704 }
700 } else { 705 } else {
701 int gridDistanceY = (y - gy * mGridSpacingY); 706 int gridDistanceY = (y - gy * mGridSpacingY);
702 bool allowResize = ( mActionItem->incidence()->type() != "Todo" ); 707 bool allowResize = ( mActionItem->incidence()->type() != "Todo" );
703 if (allowResize && gridDistanceY < mResizeBorderWidth && 708 if (allowResize && gridDistanceY < mResizeBorderWidth &&
704 mActionItem->cellYTop() == mCurrentCellY && 709 mActionItem->cellYTop() == mCurrentCellY &&
705 !mActionItem->firstMultiItem()) { 710 !mActionItem->firstMultiItem()) {
706 mActionType = RESIZETOP; 711 mActionType = RESIZETOP;
707 setCursor(sizeVerCursor); 712 setCursor(sizeVerCursor);
708 } else if (allowResize &&(mGridSpacingY - gridDistanceY) < mResizeBorderWidth && 713 } else if (allowResize &&(mGridSpacingY - gridDistanceY) < mResizeBorderWidth &&
709 mActionItem->cellYBottom() == mCurrentCellY && 714 mActionItem->cellYBottom() == mCurrentCellY &&
710 !mActionItem->lastMultiItem()) { 715 !mActionItem->lastMultiItem()) {
711 mActionType = RESIZEBOTTOM; 716 mActionType = RESIZEBOTTOM;
712 setCursor(sizeVerCursor); 717 setCursor(sizeVerCursor);
713 } else { 718 } else {
714 mActionType = MOVE; 719 mActionType = MOVE;
715 mActionItem->startMove(); 720 mActionItem->startMove();
716 setCursor(sizeAllCursor); 721 setCursor(sizeAllCursor);
717 } 722 }
718 } 723 }
719} 724}
720 725
721void KOAgenda::performItemAction(QPoint viewportPos) 726void KOAgenda::performItemAction(QPoint viewportPos)
722{ 727{
723// kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; 728// kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl;
724// QPoint point = viewport()->mapToGlobal(viewportPos); 729// QPoint point = viewport()->mapToGlobal(viewportPos);
725// kdDebug() << "Global: " << point.x() << "," << point.y() << endl; 730// kdDebug() << "Global: " << point.x() << "," << point.y() << endl;
726// point = clipper()->mapFromGlobal(point); 731// point = clipper()->mapFromGlobal(point);
727// kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; 732// kdDebug() << "clipper: " << point.x() << "," << point.y() << endl;
728// kdDebug() << "visible height: " << visibleHeight() << endl; 733// kdDebug() << "visible height: " << visibleHeight() << endl;
729 int x,y; 734 int x,y;
730 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 735 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
731// kdDebug() << "contents: " << x << "," << y << "\n" << endl; 736// kdDebug() << "contents: " << x << "," << y << "\n" << endl;
732 int gx,gy; 737 int gx,gy;
733 contentsToGrid(x,y,gx,gy); 738 contentsToGrid(x,y,gx,gy);
734 QPoint clipperPos = clipper()-> 739 QPoint clipperPos = clipper()->
735 mapFromGlobal(viewport()->mapToGlobal(viewportPos)); 740 mapFromGlobal(viewport()->mapToGlobal(viewportPos));
736 741
737 // Cursor left active agenda area. 742 // Cursor left active agenda area.
738 // This starts a drag. 743 // This starts a drag.
739 if ( /*clipperPos.y() < 0 || clipperPos.y() > visibleHeight() ||*/ 744 if ( /*clipperPos.y() < 0 || clipperPos.y() > visibleHeight() ||*/
740 clipperPos.x() < 0 || clipperPos.x() > visibleWidth() ) { 745 clipperPos.x() < 0 || clipperPos.x() > visibleWidth() ) {
741 if ( mActionType == MOVE ) { 746 if ( mActionType == MOVE ) {
742 mScrollUpTimer.stop(); 747 mScrollUpTimer.stop();
743 mScrollDownTimer.stop(); 748 mScrollDownTimer.stop();
744 mActionItem->resetMove(); 749 mActionItem->resetMove();
745 placeSubCells( mActionItem ); 750 placeSubCells( mActionItem );
746 // emit startDragSignal( mActionItem->incidence() ); 751 // emit startDragSignal( mActionItem->incidence() );
747 setCursor( arrowCursor ); 752 setCursor( arrowCursor );
748 mActionItem = 0; 753 mActionItem = 0;
749 mActionType = NOP; 754 mActionType = NOP;
750 mItemMoved = 0; 755 mItemMoved = 0;
751 return; 756 return;
752 } 757 }
753 } else { 758 } else {
754 switch ( mActionType ) { 759 switch ( mActionType ) {
755 case MOVE: 760 case MOVE:
756 setCursor( sizeAllCursor ); 761 setCursor( sizeAllCursor );
757 break; 762 break;
758 case RESIZETOP: 763 case RESIZETOP:
759 case RESIZEBOTTOM: 764 case RESIZEBOTTOM:
760 setCursor( sizeVerCursor ); 765 setCursor( sizeVerCursor );
761 break; 766 break;
762 case RESIZELEFT: 767 case RESIZELEFT:
763 case RESIZERIGHT: 768 case RESIZERIGHT:
764 setCursor( sizeHorCursor ); 769 setCursor( sizeHorCursor );
765 break; 770 break;
766 default: 771 default:
767 setCursor( arrowCursor ); 772 setCursor( arrowCursor );
768 } 773 }
769 } 774 }
770 775
771 // Scroll if item was moved to upper or lower end of agenda. 776 // Scroll if item was moved to upper or lower end of agenda.
772 if (clipperPos.y() < mScrollBorderWidth) { 777 if (clipperPos.y() < mScrollBorderWidth) {
773 mScrollUpTimer.start(mScrollDelay); 778 mScrollUpTimer.start(mScrollDelay);
774 } else if (visibleHeight() - clipperPos.y() < 779 } else if (visibleHeight() - clipperPos.y() <
775 mScrollBorderWidth) { 780 mScrollBorderWidth) {
776 mScrollDownTimer.start(mScrollDelay); 781 mScrollDownTimer.start(mScrollDelay);
777 } else { 782 } else {
778 mScrollUpTimer.stop(); 783 mScrollUpTimer.stop();
779 mScrollDownTimer.stop(); 784 mScrollDownTimer.stop();
780 } 785 }
781 786
782 // Move or resize item if necessary 787 // Move or resize item if necessary
783 if (mCurrentCellX != gx || mCurrentCellY != gy) { 788 if (mCurrentCellX != gx || mCurrentCellY != gy) {
784 mItemMoved = true; 789 mItemMoved = true;
785 mActionItem->raise(); 790 mActionItem->raise();
786 if (mActionType == MOVE) { 791 if (mActionType == MOVE) {
787 // Move all items belonging to a multi item 792 // Move all items belonging to a multi item
788 KOAgendaItem *moveItem = mActionItem->firstMultiItem(); 793 KOAgendaItem *moveItem = mActionItem->firstMultiItem();
789 bool isMultiItem = (moveItem || mActionItem->lastMultiItem()); 794 bool isMultiItem = (moveItem || mActionItem->lastMultiItem());
790 if (!moveItem) moveItem = mActionItem; 795 if (!moveItem) moveItem = mActionItem;
791 while (moveItem) { 796 while (moveItem) {
792 int dy; 797 int dy;
793 if (isMultiItem) dy = 0; 798 if (isMultiItem) dy = 0;
794 else dy = gy - mCurrentCellY; 799 else dy = gy - mCurrentCellY;
795 moveItem->moveRelative(gx - mCurrentCellX,dy); 800 moveItem->moveRelative(gx - mCurrentCellX,dy);
796 int x,y; 801 int x,y;
797 gridToContents(moveItem->cellX(),moveItem->cellYTop(),x,y); 802 gridToContents(moveItem->cellX(),moveItem->cellYTop(),x,y);
798 moveItem->resize(mGridSpacingX * moveItem->cellWidth(), 803 moveItem->resize(mGridSpacingX * moveItem->cellWidth(),
799 mGridSpacingY * moveItem->cellHeight()); 804 mGridSpacingY * moveItem->cellHeight());
800 moveChild(moveItem,x,y); 805 moveChild(moveItem,x,y);
801 moveItem = moveItem->nextMultiItem(); 806 moveItem = moveItem->nextMultiItem();
802 } 807 }
803 } else if (mActionType == RESIZETOP) { 808 } else if (mActionType == RESIZETOP) {
804 if (mCurrentCellY <= mActionItem->cellYBottom()) { 809 if (mCurrentCellY <= mActionItem->cellYBottom()) {
805 mActionItem->expandTop(gy - mCurrentCellY); 810 mActionItem->expandTop(gy - mCurrentCellY);
806 mActionItem->resize(mActionItem->width(), 811 mActionItem->resize(mActionItem->width(),
807 mGridSpacingY * mActionItem->cellHeight()); 812 mGridSpacingY * mActionItem->cellHeight());
808 int x,y; 813 int x,y;
809 gridToContents(mCurrentCellX,mActionItem->cellYTop(),x,y); 814 gridToContents(mCurrentCellX,mActionItem->cellYTop(),x,y);
810 //moveChild(mActionItem,childX(mActionItem),y); 815 //moveChild(mActionItem,childX(mActionItem),y);
811 QScrollView::moveChild( mActionItem,childX(mActionItem),y ); 816 QScrollView::moveChild( mActionItem,childX(mActionItem),y );
812 } 817 }
813 } else if (mActionType == RESIZEBOTTOM) { 818 } else if (mActionType == RESIZEBOTTOM) {
814 if (mCurrentCellY >= mActionItem->cellYTop()) { 819 if (mCurrentCellY >= mActionItem->cellYTop()) {
815 mActionItem->expandBottom(gy - mCurrentCellY); 820 mActionItem->expandBottom(gy - mCurrentCellY);
816 mActionItem->resize(mActionItem->width(), 821 mActionItem->resize(mActionItem->width(),
817 mGridSpacingY * mActionItem->cellHeight()); 822 mGridSpacingY * mActionItem->cellHeight());
818 } 823 }
819 } else if (mActionType == RESIZELEFT) { 824 } else if (mActionType == RESIZELEFT) {
820 if (mCurrentCellX <= mActionItem->cellXWidth()) { 825 if (mCurrentCellX <= mActionItem->cellXWidth()) {
821 mActionItem->expandLeft(gx - mCurrentCellX); 826 mActionItem->expandLeft(gx - mCurrentCellX);
822 mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), 827 mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(),
823 mActionItem->height()); 828 mActionItem->height());
824 int x,y; 829 int x,y;
825 gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y); 830 gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y);
826 moveChild(mActionItem,x,childY(mActionItem)); 831 moveChild(mActionItem,x,childY(mActionItem));
827 } 832 }
828 } else if (mActionType == RESIZERIGHT) { 833 } else if (mActionType == RESIZERIGHT) {
829 if (mCurrentCellX >= mActionItem->cellX()) { 834 if (mCurrentCellX >= mActionItem->cellX()) {
830 mActionItem->expandRight(gx - mCurrentCellX); 835 mActionItem->expandRight(gx - mCurrentCellX);
831 mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), 836 mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(),
832 mActionItem->height()); 837 mActionItem->height());
833 } 838 }
834 } 839 }
835 mCurrentCellX = gx; 840 mCurrentCellX = gx;
836 mCurrentCellY = gy; 841 mCurrentCellY = gy;
837 } 842 }
838} 843}
839 844
840void KOAgenda::endItemAction() 845void KOAgenda::endItemAction()
841{ 846{
842 847
843 if ( mItemMoved ) { 848 if ( mItemMoved ) {
844 KOAgendaItem *placeItem = mActionItem->firstMultiItem(); 849 KOAgendaItem *placeItem = mActionItem->firstMultiItem();
845 if ( !placeItem ) { 850 if ( !placeItem ) {
846 placeItem = mActionItem; 851 placeItem = mActionItem;
847 } 852 }
848 if ( placeItem->incidence()->recurrence()->doesRecur() ) { 853 if ( placeItem->incidence()->recurrence()->doesRecur() ) {
849 Incidence* oldInc = placeItem->incidence(); 854 Incidence* oldInc = placeItem->incidence();
850 placeItem->recreateIncidence(); 855 placeItem->recreateIncidence();
851 emit addToCalSignal(placeItem->incidence(), oldInc ); 856 emit addToCalSignal(placeItem->incidence(), oldInc );
852 } 857 }
853 int type = mActionType; 858 int type = mActionType;
854 if ( mAllDayMode ) 859 if ( mAllDayMode )
855 type = -1; 860 type = -1;
856 KOAgendaItem *modifiedItem = placeItem; 861 KOAgendaItem *modifiedItem = placeItem;
857 //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */); 862 //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */);
858 QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems(); 863 QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems();
859 KOAgendaItem *item; 864 KOAgendaItem *item;
860 865
861 if ( placeItem->incidence()->type() == "Todo" ) { 866 if ( placeItem->incidence()->type() == "Todo" ) {
862 mSelectedItem = 0; 867 mSelectedItem = 0;
863 //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth()); 868 //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth());
864 modifiedItem->mLastMoveXPos = mCurrentCellX; 869 modifiedItem->mLastMoveXPos = mCurrentCellX;
865 emit itemModified( modifiedItem, mActionType ); 870 emit itemModified( modifiedItem, mActionType );
866 } 871 }
867 else { 872 else {
868#if 0 873#if 0
869 for ( item=oldconflictItems.first(); item != 0; 874 for ( item=oldconflictItems.first(); item != 0;
870 item=oldconflictItems.next() ) { 875 item=oldconflictItems.next() ) {
871 placeSubCells(item); 876 placeSubCells(item);
872 } 877 }
873 while ( placeItem ) { 878 while ( placeItem ) {
874 //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); 879 //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1());
875 placeSubCells( placeItem ); 880 placeSubCells( placeItem );
876 placeItem = placeItem->nextMultiItem(); 881 placeItem = placeItem->nextMultiItem();
877 } 882 }
878#endif 883#endif
879 884
880 globalFlagBlockAgendaItemPaint = 1; 885 globalFlagBlockAgendaItemPaint = 1;
881 for ( item=oldconflictItems.first(); item != 0; 886 for ( item=oldconflictItems.first(); item != 0;
882 item=oldconflictItems.next() ) { 887 item=oldconflictItems.next() ) {
883 placeSubCells(item); 888 placeSubCells(item);
884 } 889 }
885 while ( placeItem ) { 890 while ( placeItem ) {
886 //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); 891 //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1());
887 oldconflictItems = placeItem->conflictItems(); 892 oldconflictItems = placeItem->conflictItems();
888 for ( item=oldconflictItems.first(); item != 0; 893 for ( item=oldconflictItems.first(); item != 0;
889 item=oldconflictItems.next() ) { 894 item=oldconflictItems.next() ) {
890 placeSubCells(item); 895 placeSubCells(item);
891 } 896 }
892 placeSubCells( placeItem ); 897 placeSubCells( placeItem );
893 placeItem = placeItem->nextMultiItem(); 898 placeItem = placeItem->nextMultiItem();
894 } 899 }
895 globalFlagBlockAgendaItemPaint = 0; 900 globalFlagBlockAgendaItemPaint = 0;
896 for ( item=oldconflictItems.first(); item != 0; 901 for ( item=oldconflictItems.first(); item != 0;
897 item=oldconflictItems.next() ) { 902 item=oldconflictItems.next() ) {
898 globalFlagBlockAgendaItemUpdate = 0; 903 globalFlagBlockAgendaItemUpdate = 0;
899 item->repaintMe(); 904 item->repaintMe();
900 globalFlagBlockAgendaItemUpdate = 1; 905 globalFlagBlockAgendaItemUpdate = 1;
901 item->repaint( false ); 906 item->repaint( false );
902 } 907 }
903 placeItem = modifiedItem; 908 placeItem = modifiedItem;
904 909
905 while ( placeItem ) { 910 while ( placeItem ) {
906 //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); 911 //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1());
907 globalFlagBlockAgendaItemUpdate = 0; 912 globalFlagBlockAgendaItemUpdate = 0;
908 placeItem->repaintMe(); 913 placeItem->repaintMe();
909 globalFlagBlockAgendaItemUpdate = 1; 914 globalFlagBlockAgendaItemUpdate = 1;
910 placeItem->repaint(false); 915 placeItem->repaint(false);
911 placeItem = placeItem->nextMultiItem(); 916 placeItem = placeItem->nextMultiItem();
912 } 917 }
913 emit itemModified( modifiedItem, mActionType ); 918 emit itemModified( modifiedItem, mActionType );
914 919
915 920
916 placeItem = modifiedItem; 921 placeItem = modifiedItem;
917 while ( placeItem ) { 922 while ( placeItem ) {
918 oldconflictItems = placeItem->conflictItems(); 923 oldconflictItems = placeItem->conflictItems();
919 for ( item=oldconflictItems.first(); item != 0; 924 for ( item=oldconflictItems.first(); item != 0;
920 item=oldconflictItems.next() ) { 925 item=oldconflictItems.next() ) {
921 placeSubCells(item); 926 placeSubCells(item);
922 } 927 }
923 placeSubCells( placeItem ); 928 placeSubCells( placeItem );
924 placeItem = placeItem->nextMultiItem(); 929 placeItem = placeItem->nextMultiItem();
925 930
926 } 931 }
927 placeItem = modifiedItem; 932 placeItem = modifiedItem;
928 while ( placeItem ) { 933 while ( placeItem ) {
929 oldconflictItems = placeItem->conflictItems(); 934 oldconflictItems = placeItem->conflictItems();
930 for ( item=oldconflictItems.first(); item != 0; 935 for ( item=oldconflictItems.first(); item != 0;
931 item=oldconflictItems.next() ) { 936 item=oldconflictItems.next() ) {
932 globalFlagBlockAgendaItemUpdate = 0; 937 globalFlagBlockAgendaItemUpdate = 0;
933 item->repaintMe(); 938 item->repaintMe();
934 globalFlagBlockAgendaItemUpdate = 1; 939 globalFlagBlockAgendaItemUpdate = 1;
935 item->repaint(false); 940 item->repaint(false);
936 } 941 }
937 placeItem = placeItem->nextMultiItem(); 942 placeItem = placeItem->nextMultiItem();
938 } 943 }
939 /* 944 /*
940 945
941 oldconflictItems = modifiedItem->conflictItems(); 946 oldconflictItems = modifiedItem->conflictItems();
942 for ( item=oldconflictItems.first(); item != 0; 947 for ( item=oldconflictItems.first(); item != 0;
943 item=oldconflictItems.next() ) { 948 item=oldconflictItems.next() ) {
944 globalFlagBlockAgendaItemUpdate = 0; 949 globalFlagBlockAgendaItemUpdate = 0;
945 item->paintMe(false); 950 item->paintMe(false);
946 globalFlagBlockAgendaItemUpdate = 1; 951 globalFlagBlockAgendaItemUpdate = 1;
947 item->repaint(false); 952 item->repaint(false);
948 } 953 }
949 */ 954 */
950 955
951 956
952 } 957 }
953 958
954 } 959 }
955 960
956 mScrollUpTimer.stop(); 961 mScrollUpTimer.stop();
957 mScrollDownTimer.stop(); 962 mScrollDownTimer.stop();
958 setCursor( arrowCursor ); 963 setCursor( arrowCursor );
959 mActionItem = 0; 964 mActionItem = 0;
960 mActionType = NOP; 965 mActionType = NOP;
961 mItemMoved = 0; 966 mItemMoved = 0;
962 967
963} 968}
964 969
965void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos) 970void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos)
966{ 971{
967// kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; 972// kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl;
968// QPoint point = viewport()->mapToGlobal(viewportPos); 973// QPoint point = viewport()->mapToGlobal(viewportPos);
969// kdDebug() << "Global: " << point.x() << "," << point.y() << endl; 974// kdDebug() << "Global: " << point.x() << "," << point.y() << endl;
970// point = clipper()->mapFromGlobal(point); 975// point = clipper()->mapFromGlobal(point);
971// kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; 976// kdDebug() << "clipper: " << point.x() << "," << point.y() << endl;
972 977
973 int x,y; 978 int x,y;
974 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 979 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
975// kdDebug() << "contents: " << x << "," << y << "\n" << endl; 980// kdDebug() << "contents: " << x << "," << y << "\n" << endl;
976 int gx,gy; 981 int gx,gy;
977 contentsToGrid(x,y,gx,gy); 982 contentsToGrid(x,y,gx,gy);
978 983
979 // Change cursor to resize cursor if appropriate 984 // Change cursor to resize cursor if appropriate
980 if (mAllDayMode) { 985 if (mAllDayMode) {
981 int gridDistanceX = (x - gx * mGridSpacingX); 986 int gridDistanceX = (x - gx * mGridSpacingX);
982 if (gridDistanceX < mResizeBorderWidth && 987 if (gridDistanceX < mResizeBorderWidth &&
983 moveItem->cellX() == gx) { 988 moveItem->cellX() == gx) {
984 setCursor(sizeHorCursor); 989 setCursor(sizeHorCursor);
985 } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && 990 } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth &&
986 moveItem->cellXWidth() == gx) { 991 moveItem->cellXWidth() == gx) {
987 setCursor(sizeHorCursor); 992 setCursor(sizeHorCursor);
988 } else { 993 } else {
989 setCursor(arrowCursor); 994 setCursor(arrowCursor);
990 } 995 }
991 } else { 996 } else {
992 int gridDistanceY = (y - gy * mGridSpacingY); 997 int gridDistanceY = (y - gy * mGridSpacingY);
993 if (gridDistanceY < mResizeBorderWidth && 998 if (gridDistanceY < mResizeBorderWidth &&
994 moveItem->cellYTop() == gy && 999 moveItem->cellYTop() == gy &&
995 !moveItem->firstMultiItem()) { 1000 !moveItem->firstMultiItem()) {
996 setCursor(sizeVerCursor); 1001 setCursor(sizeVerCursor);
997 } else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth && 1002 } else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth &&
998 moveItem->cellYBottom() == gy && 1003 moveItem->cellYBottom() == gy &&
999 !moveItem->lastMultiItem()) { 1004 !moveItem->lastMultiItem()) {
1000 setCursor(sizeVerCursor); 1005 setCursor(sizeVerCursor);
1001 } else { 1006 } else {
1002 setCursor(arrowCursor); 1007 setCursor(arrowCursor);
1003 } 1008 }
1004 } 1009 }
1005} 1010}
1006 1011
1007 1012
1008/* 1013/*
1009 Place item in cell and take care that multiple items using the same cell do 1014 Place item in cell and take care that multiple items using the same cell do
1010 not overlap. This method is not yet optimal. It doesn´t use the maximum space 1015 not overlap. This method is not yet optimal. It doesn´t use the maximum space
1011 it can get in all cases. 1016 it can get in all cases.
1012 At the moment the method has a bug: When an item is placed only the sub cell 1017 At the moment the method has a bug: When an item is placed only the sub cell
1013 widths of the items are changed, which are within the Y region the item to 1018 widths of the items are changed, which are within the Y region the item to
1014 place spans. When the sub cell width change of one of this items affects a 1019 place spans. When the sub cell width change of one of this items affects a
1015 cell, where other items are, which do not overlap in Y with the item to place, 1020 cell, where other items are, which do not overlap in Y with the item to place,
1016 the display gets corrupted, although the corruption looks quite nice. 1021 the display gets corrupted, although the corruption looks quite nice.
1017*/ 1022*/
1018void KOAgenda::placeSubCells(KOAgendaItem *placeItem) 1023void KOAgenda::placeSubCells(KOAgendaItem *placeItem)
1019{ 1024{
1020 1025
1021 QPtrList<KOAgendaItem> conflictItems; 1026 QPtrList<KOAgendaItem> conflictItems;
1022 int maxSubCells = 0; 1027 int maxSubCells = 0;
1023 QIntDict<KOAgendaItem> subCellDict(5); 1028 QIntDict<KOAgendaItem> subCellDict(5);
1024 1029
1025 KOAgendaItem *item; 1030 KOAgendaItem *item;
1026 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1031 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1027 if (item != placeItem) { 1032 if (item != placeItem) {
1028 if (placeItem->cellX() <= item->cellXWidth() && 1033 if (placeItem->cellX() <= item->cellXWidth() &&
1029 placeItem->cellXWidth() >= item->cellX()) { 1034 placeItem->cellXWidth() >= item->cellX()) {
1030 if ((placeItem->cellYTop() <= item->cellYBottom()) && 1035 if ((placeItem->cellYTop() <= item->cellYBottom()) &&
1031 (placeItem->cellYBottom() >= item->cellYTop())) { 1036 (placeItem->cellYBottom() >= item->cellYTop())) {
1032 conflictItems.append(item); 1037 conflictItems.append(item);
1033 if (item->subCells() > maxSubCells) 1038 if (item->subCells() > maxSubCells)
1034 maxSubCells = item->subCells(); 1039 maxSubCells = item->subCells();
1035 subCellDict.insert(item->subCell(),item); 1040 subCellDict.insert(item->subCell(),item);
1036 } 1041 }
1037 } 1042 }
1038 } 1043 }
1039 } 1044 }
1040 1045
1041 if (conflictItems.count() > 0) { 1046 if (conflictItems.count() > 0) {
1042 // Look for unused sub cell and insert item 1047 // Look for unused sub cell and insert item
1043 int i; 1048 int i;
1044 for(i=0;i<maxSubCells;++i) { 1049 for(i=0;i<maxSubCells;++i) {
1045 if (!subCellDict.find(i)) { 1050 if (!subCellDict.find(i)) {
1046 placeItem->setSubCell(i); 1051 placeItem->setSubCell(i);
1047 break; 1052 break;
1048 } 1053 }
1049 } 1054 }
1050 if (i == maxSubCells) { 1055 if (i == maxSubCells) {
1051 placeItem->setSubCell(maxSubCells); 1056 placeItem->setSubCell(maxSubCells);
1052 maxSubCells++; // add new item to number of sub cells 1057 maxSubCells++; // add new item to number of sub cells
1053 } 1058 }
1054 1059
1055 // Prepare for sub cell geometry adjustment 1060 // Prepare for sub cell geometry adjustment
1056 int newSubCellWidth; 1061 int newSubCellWidth;
1057 if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells; 1062 if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells;
1058 else newSubCellWidth = mGridSpacingX / maxSubCells; 1063 else newSubCellWidth = mGridSpacingX / maxSubCells;
1059 conflictItems.append(placeItem); 1064 conflictItems.append(placeItem);
1060 1065
1061 1066
1062 // Adjust sub cell geometry of all items 1067 // Adjust sub cell geometry of all items
1063 for ( item=conflictItems.first(); item != 0; 1068 for ( item=conflictItems.first(); item != 0;
1064 item=conflictItems.next() ) { 1069 item=conflictItems.next() ) {
1065 item->setSubCells(maxSubCells); 1070 item->setSubCells(maxSubCells);
1066 if (mAllDayMode) { 1071 if (mAllDayMode) {
1067 item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); 1072 item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth);
1068 } else { 1073 } else {
1069 item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); 1074 item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY);
1070 } 1075 }
1071 int x,y; 1076 int x,y;
1072 gridToContents(item->cellX(),item->cellYTop(),x,y); 1077 gridToContents(item->cellX(),item->cellYTop(),x,y);
1073 if (mAllDayMode) { 1078 if (mAllDayMode) {
1074 y += item->subCell() * newSubCellWidth; 1079 y += item->subCell() * newSubCellWidth;
1075 } else { 1080 } else {
1076 x += item->subCell() * newSubCellWidth; 1081 x += item->subCell() * newSubCellWidth;
1077 } 1082 }
1078 moveChild(item,x,y); 1083 moveChild(item,x,y);
1079 // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y); 1084 // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y);
1080 //item->updateItem(); 1085 //item->updateItem();
1081 } 1086 }
1082 1087
1083 } else { 1088 } else {
1084 placeItem->setSubCell(0); 1089 placeItem->setSubCell(0);
1085 placeItem->setSubCells(1); 1090 placeItem->setSubCells(1);
1086 if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); 1091 if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY);
1087 else placeItem->resize(mGridSpacingX,placeItem->height()); 1092 else placeItem->resize(mGridSpacingX,placeItem->height());
1088 int x,y; 1093 int x,y;
1089 gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); 1094 gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y);
1090 moveChild(placeItem,x,y); 1095 moveChild(placeItem,x,y);
1091 } 1096 }
1092 placeItem->setConflictItems(conflictItems); 1097 placeItem->setConflictItems(conflictItems);
1093 // for ( item=conflictItems.first(); item != 0; 1098 // for ( item=conflictItems.first(); item != 0;
1094// item=conflictItems.next() ) { 1099// item=conflictItems.next() ) {
1095// //item->updateItem(); 1100// //item->updateItem();
1096// //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); 1101// //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() );
1097// } 1102// }
1098// placeItem->updateItem(); 1103// placeItem->updateItem();
1099} 1104}
1100 1105
1101void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) 1106void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
1102{ 1107{
1103 if ( globalFlagBlockAgenda ) 1108 if ( globalFlagBlockAgenda )
1104 return; 1109 return;
1105 //qDebug("KOAgenda::drawContents "); 1110 //qDebug("KOAgenda::drawContents ");
1106 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) 1111 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() )
1107 ;//drawContentsToPainter(); 1112 ;//drawContentsToPainter();
1108 1113
1109 QPaintDevice* pd = p->device(); 1114 QPaintDevice* pd = p->device();
1110 p->end(); 1115 p->end();
1111 int vx, vy; 1116 int vx, vy;
1112 int selectionX = KOGlobals::self()->reverseLayout() ? 1117 int selectionX = KOGlobals::self()->reverseLayout() ?
1113 (mColumns - 1 - mSelectionCellX) * mGridSpacingX : 1118 (mColumns - 1 - mSelectionCellX) * mGridSpacingX :
1114 mSelectionCellX * mGridSpacingX; 1119 mSelectionCellX * mGridSpacingX;
1115 contentsToViewport ( cx, cy, vx,vy); 1120 contentsToViewport ( cx, cy, vx,vy);
1116 // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; 1121 // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ;
1117 if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) 1122 if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) )
1118 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); 1123 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP);
1119 1124
1120 if ( mSelectionHeight > 0 ) { 1125 if ( mSelectionHeight > 0 ) {
1121 //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); 1126 //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight );
1122 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && 1127 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
1123 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { 1128 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) {
1124 contentsToViewport ( selectionX, mSelectionYTop, vx,vy); 1129 contentsToViewport ( selectionX, mSelectionYTop, vx,vy);
1125 bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); 1130 bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP);
1126 } 1131 }
1127 } 1132 }
1128 //qDebug("btbl "); 1133 //qDebug("btbl ");
1129 p->begin( pd ); 1134 p->begin( pd );
1130 //qDebug("end "); 1135 //qDebug("end ");
1131} 1136}
1132 1137
1133void KOAgenda::finishUpdate() 1138void KOAgenda::finishUpdate()
1134{ 1139{
1135 1140
1136 KOAgendaItem *item; 1141 KOAgendaItem *item;
1137 globalFlagBlockAgendaItemPaint = 1; 1142 globalFlagBlockAgendaItemPaint = 1;
1138 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1143 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1139 if ( !item->isVisible() ) 1144 if ( !item->isVisible() )
1140 item->show(); 1145 item->show();
1141 1146
1142 } 1147 }
1143 globalFlagBlockAgendaItemUpdate = 0; 1148 globalFlagBlockAgendaItemUpdate = 0;
1144 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1149 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1145 item->repaintMe( ); 1150 item->repaintMe( );
1146 } 1151 }
1147 globalFlagBlockAgendaItemUpdate = 1; 1152 globalFlagBlockAgendaItemUpdate = 1;
1148 qApp->processEvents(); 1153 qApp->processEvents();
1149 globalFlagBlockAgendaItemPaint = 0; 1154 globalFlagBlockAgendaItemPaint = 0;
1150 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1155 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1151 item->repaint( false ); 1156 item->repaint( false );
1152 } 1157 }
1153 1158
1154} 1159}
1155 1160
1156/* 1161/*
1157 Draw grid in the background of the agenda. 1162 Draw grid in the background of the agenda.
1158*/ 1163*/
1159void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) 1164void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch)
1160{ 1165{
1161 1166
1162 1167
1163 if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) 1168 if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask )
1164 return; 1169 return;
1165 if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) 1170 if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 )
1166 return; 1171 return;
1167 int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight(); 1172 int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight();
1168 if ( ch < 1 ) 1173 if ( ch < 1 )
1169 ch = 1; 1174 ch = 1;
1170 if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) { 1175 if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) {
1171 mPaintPixmap.resize( contentsWidth()+42, ch ); 1176 mPaintPixmap.resize( contentsWidth()+42, ch );
1172 } 1177 }
1173 mCurPixWid = contentsWidth(); 1178 mCurPixWid = contentsWidth();
1174 mCurPixHei = ch; 1179 mCurPixHei = ch;
1175 if ( mHighlightPixmap.width() < mGridSpacingX-1 || mHighlightPixmap.height() < ch ) { 1180 if ( mHighlightPixmap.width() < mGridSpacingX-1 || mHighlightPixmap.height() < ch ) {
1176 mHighlightPixmap.resize( mGridSpacingX-1, ch ); 1181 mHighlightPixmap.resize( mGridSpacingX-1, ch );
1177 mHighlightPixmap.fill ( KOPrefs::instance()->mHighlightColor ); 1182 mHighlightPixmap.fill ( KOPrefs::instance()->mHighlightColor );
1178 } 1183 }
1179 mPixPainter.begin( &mPaintPixmap) ; 1184 mPixPainter.begin( &mPaintPixmap) ;
1180 //qDebug("wid %d hei %d ",mPaintPixmap.width(),mPaintPixmap.height() ); 1185 //qDebug("wid %d hei %d ",mPaintPixmap.width(),mPaintPixmap.height() );
1181 QPainter * p ; 1186 QPainter * p ;
1182 if (paint == 0) { 1187 if (paint == 0) {
1183 mPaintPixmap.fill(KOPrefs::instance()->mAgendaBgColor); 1188 mPaintPixmap.fill(KOPrefs::instance()->mAgendaBgColor);
1184 p = &mPixPainter; 1189 p = &mPixPainter;
1185 } 1190 }
1186 else 1191 else
1187 p = paint ; 1192 p = paint ;
1188 // qDebug("++++++KOAgenda::drawContentsTo Painter %d %d %d %d ", cx, cy, cw, ch); 1193 // qDebug("++++++KOAgenda::drawContentsTo Painter %d %d %d %d ", cx, cy, cw, ch);
1189 1194
1190 //--cx;++cw; 1195 //--cx;++cw;
1191 int lGridSpacingY = mGridSpacingY*2; 1196 int lGridSpacingY = mGridSpacingY*2;
1192 int selDay; 1197 int selDay;
1193 if ( !backgroundOnly ) 1198 if ( !backgroundOnly )
1194 for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) 1199 for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay)
1195 { 1200 {
1196 if ( mSelectedDates[selDay] == QDateTime::currentDateTime ().date() && KOPrefs::instance()->mHighlightCurrentDay) { 1201 if ( mSelectedDates[selDay] == QDateTime::currentDateTime ().date() && KOPrefs::instance()->mHighlightCurrentDay) {
1197 int x1 = cx; 1202 int x1 = cx;
1198 int y1 = 0; 1203 int y1 = 0;
1199 if (y1 < cy) y1 = cy; 1204 if (y1 < cy) y1 = cy;
1200 int x2 = cx+cw-1; 1205 int x2 = cx+cw-1;
1201 int y2 = contentsHeight(); 1206 int y2 = contentsHeight();
1202 if (y2 > cy+ch-1) y2=cy+ch-1; 1207 if (y2 > cy+ch-1) y2=cy+ch-1;
1203 if (x2 >= x1 && y2 >= y1) { 1208 if (x2 >= x1 && y2 >= y1) {
1204 int gxStart = selDay; 1209 int gxStart = selDay;
1205 int gxEnd = gxStart ; 1210 int gxEnd = gxStart ;
1206 int xStart = KOGlobals::self()->reverseLayout() ? 1211 int xStart = KOGlobals::self()->reverseLayout() ?
1207 (mColumns - 1 - gxStart)*mGridSpacingX : 1212 (mColumns - 1 - gxStart)*mGridSpacingX :
1208 gxStart*mGridSpacingX; 1213 gxStart*mGridSpacingX;
1209 if (xStart < x1) xStart = x1; 1214 if (xStart < x1) xStart = x1;
1210 int xEnd = KOGlobals::self()->reverseLayout() ? 1215 int xEnd = KOGlobals::self()->reverseLayout() ?
1211 (mColumns - gxStart)*mGridSpacingX-1 : 1216 (mColumns - gxStart)*mGridSpacingX-1 :
1212 (gxStart+1)*mGridSpacingX-1; 1217 (gxStart+1)*mGridSpacingX-1;
1213 if (xEnd > x2) xEnd = x2; 1218 if (xEnd > x2) xEnd = x2;
1214 if ( KOPrefs::instance()->mUseHighlightLightColor ) 1219 if ( KOPrefs::instance()->mUseHighlightLightColor )
1215 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, 1220 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
1216 KOPrefs::instance()->mAgendaBgColor.light()); 1221 KOPrefs::instance()->mAgendaBgColor.light());
1217 else 1222 else
1218 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, 1223 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
1219 KOPrefs::instance()->mAgendaBgColor.dark()); 1224 KOPrefs::instance()->mAgendaBgColor.dark());
1220 1225
1221 } 1226 }
1222 } 1227 }
1223 } 1228 }
1224 // Highlight working hours 1229 // Highlight working hours
1225 1230
1226 if ( !backgroundOnly ) 1231 if ( !backgroundOnly )
1227 if (mWorkingHoursEnable) { 1232 if (mWorkingHoursEnable) {
1228 int x1 = cx; 1233 int x1 = cx;
1229 int y1 = mWorkingHoursYTop; 1234 int y1 = mWorkingHoursYTop;
1230 if (y1 < cy) y1 = cy; 1235 if (y1 < cy) y1 = cy;
1231 int x2 = cx+cw-1; 1236 int x2 = cx+cw-1;
1232 // int x2 = mGridSpacingX * 5 - 1; 1237 // int x2 = mGridSpacingX * 5 - 1;
1233 // if (x2 > cx+cw-1) x2 = cx + cw - 1; 1238 // if (x2 > cx+cw-1) x2 = cx + cw - 1;
1234 int y2 = mWorkingHoursYBottom; 1239 int y2 = mWorkingHoursYBottom;
1235 if (y2 > cy+ch-1) y2=cy+ch-1; 1240 if (y2 > cy+ch-1) y2=cy+ch-1;
1236 1241
1237 if (x2 >= x1 && y2 >= y1) { 1242 if (x2 >= x1 && y2 >= y1) {
1238 // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX ); 1243 // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX );
1239 int gxStart = x1/mGridSpacingX; 1244 int gxStart = x1/mGridSpacingX;
1240 int gxEnd = x2/mGridSpacingX; 1245 int gxEnd = x2/mGridSpacingX;
1241 while(gxStart <= gxEnd) { 1246 while(gxStart <= gxEnd) {
1242 if (gxStart < int(mHolidayMask->count()) && 1247 if (gxStart < int(mHolidayMask->count()) &&
1243 !mHolidayMask->at(gxStart)) { 1248 !mHolidayMask->at(gxStart)) {
1244 int xStart = KOGlobals::self()->reverseLayout() ? 1249 int xStart = KOGlobals::self()->reverseLayout() ?
1245 (mColumns - 1 - gxStart)*mGridSpacingX : 1250 (mColumns - 1 - gxStart)*mGridSpacingX :
1246 gxStart*mGridSpacingX; 1251 gxStart*mGridSpacingX;
1247 if (xStart < x1) xStart = x1; 1252 if (xStart < x1) xStart = x1;
1248 int xEnd = KOGlobals::self()->reverseLayout() ? 1253 int xEnd = KOGlobals::self()->reverseLayout() ?
1249 (mColumns - gxStart)*mGridSpacingX-1 : 1254 (mColumns - gxStart)*mGridSpacingX-1 :
1250 (gxStart+1)*mGridSpacingX-1; 1255 (gxStart+1)*mGridSpacingX-1;
1251 if (xEnd > x2) xEnd = x2; 1256 if (xEnd > x2) xEnd = x2;
1252 if ( mSelectedDates[gxStart] == QDateTime::currentDateTime ().date()&& KOPrefs::instance()->mHighlightCurrentDay ) { 1257 if ( mSelectedDates[gxStart] == QDateTime::currentDateTime ().date()&& KOPrefs::instance()->mHighlightCurrentDay ) {
1253 if ( KOPrefs::instance()->mUseHighlightLightColor ) 1258 if ( KOPrefs::instance()->mUseHighlightLightColor )
1254 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, 1259 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
1255 KOPrefs::instance()->mWorkingHoursColor.light()); 1260 KOPrefs::instance()->mWorkingHoursColor.light());
1256 else 1261 else
1257 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, 1262 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
1258 KOPrefs::instance()->mWorkingHoursColor.dark()); 1263 KOPrefs::instance()->mWorkingHoursColor.dark());
1259 } else { 1264 } else {
1260 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, 1265 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
1261 KOPrefs::instance()->mWorkingHoursColor); 1266 KOPrefs::instance()->mWorkingHoursColor);
1262 } 1267 }
1263 } 1268 }
1264 ++gxStart; 1269 ++gxStart;
1265 } 1270 }
1266 } 1271 }
1267 } 1272 }
1268 /* 1273 /*
1269 int selectionX = KOGlobals::self()->reverseLayout() ? 1274 int selectionX = KOGlobals::self()->reverseLayout() ?
1270 (mColumns - 1 - mSelectionCellX) * mGridSpacingX : 1275 (mColumns - 1 - mSelectionCellX) * mGridSpacingX :
1271 mSelectionCellX * mGridSpacingX; 1276 mSelectionCellX * mGridSpacingX;
1272 1277
1273 // Draw selection 1278 // Draw selection
1274 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && 1279 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
1275 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { 1280 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) {
1276 // TODO: paint only part within cx,cy,cw,ch 1281 // TODO: paint only part within cx,cy,cw,ch
1277 p->fillRect( selectionX, mSelectionYTop, mGridSpacingX, 1282 p->fillRect( selectionX, mSelectionYTop, mGridSpacingX,
1278 mSelectionHeight, KOPrefs::instance()->mHighlightColor ); 1283 mSelectionHeight, KOPrefs::instance()->mHighlightColor );
1279 } 1284 }
1280 */ 1285 */
1281 // Draw vertical lines of grid 1286 // Draw vertical lines of grid
1282 1287
1283 int x = ((int)(cx/mGridSpacingX))*mGridSpacingX; 1288 int x = ((int)(cx/mGridSpacingX))*mGridSpacingX;
1284 if ( mGridSpacingX > 0 ) { 1289 if ( mGridSpacingX > 0 ) {
1285 while (x < cx + cw) { 1290 while (x < cx + cw) {
1286 p->drawLine(x,cy,x,cy+ch); 1291 p->drawLine(x,cy,x,cy+ch);
1287 x+=mGridSpacingX; 1292 x+=mGridSpacingX;
1288 } 1293 }
1289 } 1294 }
1290 // Draw horizontal lines of grid 1295 // Draw horizontal lines of grid
1291 int y = ((int)(cy/lGridSpacingY))*lGridSpacingY; 1296 int y = ((int)(cy/lGridSpacingY))*lGridSpacingY;
1292 if ( lGridSpacingY > 0 ) { 1297 if ( lGridSpacingY > 0 ) {
1293 while (y < cy + ch) { 1298 while (y < cy + ch) {
1294 p->setPen( SolidLine ); 1299 p->setPen( SolidLine );
1295 p->drawLine(cx,y,cx+cw,y); 1300 p->drawLine(cx,y,cx+cw,y);
1296 y+=lGridSpacingY; 1301 y+=lGridSpacingY;
1297 p->setPen( DotLine ); 1302 p->setPen( DotLine );
1298 p->drawLine(cx,y,cx+cw,y); 1303 p->drawLine(cx,y,cx+cw,y);
1299 y+=lGridSpacingY; 1304 y+=lGridSpacingY;
1300 } 1305 }
1301 p->setPen( SolidLine ); 1306 p->setPen( SolidLine );
1302 } 1307 }
1303 mPixPainter.end() ; 1308 mPixPainter.end() ;
1304} 1309}
1305 1310
1306/* 1311/*
1307 Convert srcollview contents coordinates to agenda grid coordinates. 1312 Convert srcollview contents coordinates to agenda grid coordinates.
1308*/ 1313*/
1309void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy) 1314void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy)
1310{ 1315{
1311 gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX : 1316 gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX :
1312 x/mGridSpacingX; 1317 x/mGridSpacingX;
1313 gy = y/mGridSpacingY; 1318 gy = y/mGridSpacingY;
1314} 1319}
1315 1320
1316/* 1321/*
1317 Convert agenda grid coordinates to scrollview contents coordinates. 1322 Convert agenda grid coordinates to scrollview contents coordinates.
1318*/ 1323*/
1319void KOAgenda::gridToContents (int gx, int gy, int& x, int& y) 1324void KOAgenda::gridToContents (int gx, int gy, int& x, int& y)
1320{ 1325{
1321 x = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gx)*mGridSpacingX: 1326 x = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gx)*mGridSpacingX:
1322 gx*mGridSpacingX; 1327 gx*mGridSpacingX;
1323 y = gy*mGridSpacingY; 1328 y = gy*mGridSpacingY;
1324} 1329}
1325 1330
1326 1331
1327/* 1332/*
1328 Return Y coordinate corresponding to time. Coordinates are rounded to fit into 1333 Return Y coordinate corresponding to time. Coordinates are rounded to fit into
1329 the grid. 1334 the grid.
1330*/ 1335*/
1331int KOAgenda::timeToY(const QTime &time) 1336int KOAgenda::timeToY(const QTime &time)
1332{ 1337{
1333 int minutesPerCell = 24 * 60 / mRows; 1338 int minutesPerCell = 24 * 60 / mRows;
1334 int timeMinutes = time.hour() * 60 + time.minute(); 1339 int timeMinutes = time.hour() * 60 + time.minute();
1335 int Y = (timeMinutes + (minutesPerCell / 2)) / minutesPerCell; 1340 int Y = (timeMinutes + (minutesPerCell / 2)) / minutesPerCell;
1336 return Y; 1341 return Y;
1337} 1342}
1338 1343
1339 1344
1340/* 1345/*
1341 Return time corresponding to cell y coordinate. Coordinates are rounded to 1346 Return time corresponding to cell y coordinate. Coordinates are rounded to
1342 fit into the grid. 1347 fit into the grid.
1343*/ 1348*/
1344QTime KOAgenda::gyToTime(int gy) 1349QTime KOAgenda::gyToTime(int gy)
1345{ 1350{
1346 1351
1347 int secondsPerCell = 24 * 60 * 60/ mRows; 1352 int secondsPerCell = 24 * 60 * 60/ mRows;
1348 1353
1349 int timeSeconds = secondsPerCell * gy; 1354 int timeSeconds = secondsPerCell * gy;
1350 1355
1351 QTime time( 0, 0, 0 ); 1356 QTime time( 0, 0, 0 );
1352 if ( timeSeconds < 24 * 60 * 60 ) { 1357 if ( timeSeconds < 24 * 60 * 60 ) {
1353 time = time.addSecs(timeSeconds); 1358 time = time.addSecs(timeSeconds);
1354 } else { 1359 } else {
1355 time.setHMS( 23, 59, 59 ); 1360 time.setHMS( 23, 59, 59 );
1356 } 1361 }
1357 1362
1358 return time; 1363 return time;
1359} 1364}
1360 1365
1361void KOAgenda::setStartHour(int startHour) 1366void KOAgenda::setStartHour(int startHour)
1362{ 1367{
1363 int startCell = startHour * mRows / 24; 1368 int startCell = startHour * mRows / 24;
1364 setContentsPos(0,startCell * gridSpacingY()); 1369 setContentsPos(0,startCell * gridSpacingY());
1365} 1370}
1366void KOAgenda::hideUnused() 1371void KOAgenda::hideUnused()
1367{ 1372{
1368 // experimental only 1373 // experimental only
1369 // return; 1374 // return;
1370 KOAgendaItem *item; 1375 KOAgendaItem *item;
1371 for ( item=mUnusedItems.first(); item != 0; item=mUnusedItems.next() ) { 1376 for ( item=mUnusedItems.first(); item != 0; item=mUnusedItems.next() ) {
1372 item->hide(); 1377 item->hide();
1373 } 1378 }
1374} 1379}
1375 1380
1376 1381
1377KOAgendaItem *KOAgenda::getNewItem(Incidence * event,QDate qd, QWidget* view) 1382KOAgendaItem *KOAgenda::getNewItem(Incidence * event,QDate qd, QWidget* view)
1378{ 1383{
1379 1384
1380 KOAgendaItem *fi; 1385 KOAgendaItem *fi;
1381 for ( fi=mUnusedItems.first(); fi != 0; fi=mUnusedItems.next() ) { 1386 for ( fi=mUnusedItems.first(); fi != 0; fi=mUnusedItems.next() ) {
1382 if ( fi->incidence() == event ) { 1387 if ( fi->incidence() == event ) {
1383 mUnusedItems.remove(); 1388 mUnusedItems.remove();
1384 fi->init( event, qd ); 1389 fi->init( event, qd );
1385 return fi; 1390 return fi;
1386 } 1391 }
1387 } 1392 }
1388 fi=mUnusedItems.first(); 1393 fi=mUnusedItems.first();
1389 if ( fi ) { 1394 if ( fi ) {
1390 mUnusedItems.remove(); 1395 mUnusedItems.remove();
1391 fi->init( event, qd ); 1396 fi->init( event, qd );
1392 return fi; 1397 return fi;
1393 } 1398 }
1394 // qDebug("new KOAgendaItem "); 1399 // qDebug("new KOAgendaItem ");
1395 1400
1396 KOAgendaItem* agendaItem = new KOAgendaItem( event, qd, view, mAllDayMode ); 1401 KOAgendaItem* agendaItem = new KOAgendaItem( event, qd, view, mAllDayMode );
1397 agendaItem->installEventFilter(this); 1402 agendaItem->installEventFilter(this);
1398 addChild(agendaItem,0,0); 1403 addChild(agendaItem,0,0);
1399 return agendaItem; 1404 return agendaItem;
1400} 1405}
1401KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo ) 1406KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo )
1402{ 1407{
1403 KOAgendaItem *item; 1408 KOAgendaItem *item;
1404 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1409 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1405 if ( item->incidence() == todo ) { 1410 if ( item->incidence() == todo ) {
1406 mItems.remove(); 1411 mItems.remove();
1407 return item; 1412 return item;
1408 } 1413 }
1409 } 1414 }
1410 return 0; 1415 return 0;
1411} 1416}
1412 1417
1413 1418
1414void KOAgenda::updateTodo( Todo * todo, int days, bool remove) 1419void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
1415{ 1420{
1416 1421
1417 KOAgendaItem *item; 1422 KOAgendaItem *item;
1418 item = getItemForTodo ( todo ); 1423 item = getItemForTodo ( todo );
1419 //qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove); 1424 //qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove);
1420 if ( item ) { 1425 if ( item ) {
1421 blockSignals( true ); 1426 blockSignals( true );
1422 //qDebug("item found "); 1427 //qDebug("item found ");
1423 item->hide(); 1428 item->hide();
1424 item->setCellX(-2, -1 ); 1429 item->setCellX(-2, -1 );
1425 item->select(false); 1430 item->select(false);
1426 mUnusedItems.append( item ); 1431 mUnusedItems.append( item );
1427 mItems.remove( item ); 1432 mItems.remove( item );
1428 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); 1433 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
1429 KOAgendaItem *itemit; 1434 KOAgendaItem *itemit;
1430 //globalFlagBlockAgendaItemPaint = 1; 1435 //globalFlagBlockAgendaItemPaint = 1;
1431 for ( itemit=oldconflictItems.first(); itemit != 0; 1436 for ( itemit=oldconflictItems.first(); itemit != 0;
1432 itemit=oldconflictItems.next() ) { 1437 itemit=oldconflictItems.next() ) {
1433 if ( itemit != item ) 1438 if ( itemit != item )
1434 placeSubCells(itemit); 1439 placeSubCells(itemit);
1435 } 1440 }
1436 qApp->processEvents(); 1441 qApp->processEvents();
1437 //globalFlagBlockAgendaItemPaint = 0; 1442 //globalFlagBlockAgendaItemPaint = 0;
1438 for ( itemit=oldconflictItems.first(); itemit != 0; 1443 for ( itemit=oldconflictItems.first(); itemit != 0;
1439 itemit=oldconflictItems.next() ) { 1444 itemit=oldconflictItems.next() ) {
1440 globalFlagBlockAgendaItemUpdate = 0; 1445 globalFlagBlockAgendaItemUpdate = 0;
1441 if ( itemit != item ) 1446 if ( itemit != item )
1442 itemit->repaintMe(); 1447 itemit->repaintMe();
1443 globalFlagBlockAgendaItemUpdate = 1; 1448 globalFlagBlockAgendaItemUpdate = 1;
1444 itemit->repaint(); 1449 itemit->repaint();
1445 } 1450 }
1446 blockSignals( false ); 1451 blockSignals( false );
1447 } 1452 }
1448 if ( remove ) { 1453 if ( remove ) {
1449 //qDebug("remove****************************************** "); 1454 //qDebug("remove****************************************** ");
1450 return; 1455 return;
1451 } 1456 }
1452 //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ "); 1457 //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ ");
1453 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < QDate::currentDate())&& ( KOPrefs::instance()->mShowTodoInAgenda ); 1458 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < QDate::currentDate())&& ( KOPrefs::instance()->mShowTodoInAgenda );
1454 QDate currentDate; 1459 QDate currentDate;
1455 if ( overdue ) { 1460 if ( overdue ) {
1456 currentDate = QDate::currentDate(); 1461 currentDate = QDate::currentDate();
1457 days += todo->dtDue().date().daysTo( currentDate ); 1462 days += todo->dtDue().date().daysTo( currentDate );
1458 } 1463 }
1459 else 1464 else
1460 currentDate = todo->dtDue().date(); 1465 currentDate = todo->dtDue().date();
1461 1466
1462 if ( todo->doesFloat() || overdue ) { 1467 if ( todo->doesFloat() || overdue ) {
1463 if ( ! mAllDayMode ) return; 1468 if ( ! mAllDayMode ) return;
1464 // aldayagenda 1469 // aldayagenda
1465 globalFlagBlockAgendaItemPaint = 1; 1470 globalFlagBlockAgendaItemPaint = 1;
1466 item = insertAllDayItem(todo, currentDate,days, days); 1471 item = insertAllDayItem(todo, currentDate,days, days);
1467 item->show(); 1472 item->show();
1468 1473
1469 } 1474 }
1470 else { 1475 else {
1471 if ( mAllDayMode ) return; 1476 if ( mAllDayMode ) return;
1472 // mAgenda 1477 // mAgenda
1473 globalFlagBlockAgendaItemPaint = 1; 1478 globalFlagBlockAgendaItemPaint = 1;
1474 int endY = timeToY(todo->dtDue().time()) - 1; 1479 int endY = timeToY(todo->dtDue().time()) - 1;
1475 int hi = 12/KOPrefs::instance()->mHourSize; 1480 int hi = 12/KOPrefs::instance()->mHourSize;
1476 int startY = endY - 1-hi; 1481 int startY = endY - 1-hi;
1477 item = insertItem(todo,currentDate,days,startY,endY); 1482 item = insertItem(todo,currentDate,days,startY,endY);
1478 item->show(); 1483 item->show();
1479 } 1484 }
1480 qApp->processEvents(); 1485 qApp->processEvents();
1481 globalFlagBlockAgendaItemPaint = 0; 1486 globalFlagBlockAgendaItemPaint = 0;
1482 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); 1487 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
1483 KOAgendaItem *itemit; 1488 KOAgendaItem *itemit;
1484 for ( itemit=oldconflictItems.first(); itemit != 0; 1489 for ( itemit=oldconflictItems.first(); itemit != 0;
1485 itemit=oldconflictItems.next() ) { 1490 itemit=oldconflictItems.next() ) {
1486 globalFlagBlockAgendaItemUpdate = 0; 1491 globalFlagBlockAgendaItemUpdate = 0;
1487 itemit->repaintMe(); 1492 itemit->repaintMe();
1488 globalFlagBlockAgendaItemUpdate = 1; 1493 globalFlagBlockAgendaItemUpdate = 1;
1489 itemit->repaint(); 1494 itemit->repaint();
1490 } 1495 }
1491 globalFlagBlockAgendaItemUpdate = 0; 1496 globalFlagBlockAgendaItemUpdate = 0;
1492 item->repaintMe(); 1497 item->repaintMe();
1493 globalFlagBlockAgendaItemUpdate = 1; 1498 globalFlagBlockAgendaItemUpdate = 1;
1494 item->repaint(); 1499 item->repaint();
1495} 1500}
1496/* 1501/*
1497 Insert KOAgendaItem into agenda. 1502 Insert KOAgendaItem into agenda.
1498*/ 1503*/
1499KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom) 1504KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom)
1500{ 1505{
1501 //kdDebug() << "KOAgenda::insertItem:" << event->summary() << "-" << qd.toString() << " ;top, bottom:" << YTop << "," << YBottom << endl; 1506 //kdDebug() << "KOAgenda::insertItem:" << event->summary() << "-" << qd.toString() << " ;top, bottom:" << YTop << "," << YBottom << endl;
1502 1507
1503 if (mAllDayMode) { 1508 if (mAllDayMode) {
1504 kdDebug() << "KOAgenda: calling insertItem in all-day mode is illegal." << endl; 1509 kdDebug() << "KOAgenda: calling insertItem in all-day mode is illegal." << endl;
1505 return 0; 1510 return 0;
1506 } 1511 }
1507 1512
1508 KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); 1513 KOAgendaItem *agendaItem = getNewItem(event,qd,viewport());
1509 //agendaItem->setFrameStyle(WinPanel|Raised); 1514 //agendaItem->setFrameStyle(WinPanel|Raised);
1510 1515
1511 int YSize = YBottom - YTop + 1; 1516 int YSize = YBottom - YTop + 1;
1512 if (YSize < 0) { 1517 if (YSize < 0) {
1513 kdDebug() << "KOAgenda::insertItem(): Text: " << agendaItem->text() << " YSize<0" << endl; 1518 kdDebug() << "KOAgenda::insertItem(): Text: " << agendaItem->text() << " YSize<0" << endl;
1514 YSize = 1; 1519 YSize = 1;
1515 } 1520 }
1516 int iheight = mGridSpacingY * YSize; 1521 int iheight = mGridSpacingY * YSize;
1517 1522
1518 agendaItem->resize(mGridSpacingX,iheight ); 1523 agendaItem->resize(mGridSpacingX,iheight );
1519 agendaItem->setCellXY(X,YTop,YBottom); 1524 agendaItem->setCellXY(X,YTop,YBottom);
1520 agendaItem->setCellXWidth(X); 1525 agendaItem->setCellXWidth(X);
1521 1526
1522 //addChild(agendaItem,X*mGridSpacingX,YTop*mGridSpacingY); 1527 //addChild(agendaItem,X*mGridSpacingX,YTop*mGridSpacingY);
1523 mItems.append(agendaItem); 1528 mItems.append(agendaItem);
1524 1529
1525 placeSubCells(agendaItem); 1530 placeSubCells(agendaItem);
1526 1531
1527 //agendaItem->show(); 1532 //agendaItem->show();
1528 1533
1529 marcus_bains(); 1534 marcus_bains();
1530 1535
1531 return agendaItem; 1536 return agendaItem;
1532} 1537}
1533 1538
1534 1539
1535/* 1540/*
1536 Insert all-day KOAgendaItem into agenda. 1541 Insert all-day KOAgendaItem into agenda.
1537*/ 1542*/
1538KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd) 1543KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd)
1539{ 1544{
1540 if (!mAllDayMode) { 1545 if (!mAllDayMode) {
1541 return 0; 1546 return 0;
1542 } 1547 }
1543 1548
1544 KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); 1549 KOAgendaItem *agendaItem = getNewItem(event,qd,viewport());
1545 1550
1546 agendaItem->setCellXY(XBegin,0,0); 1551 agendaItem->setCellXY(XBegin,0,0);
1547 agendaItem->setCellXWidth(XEnd); 1552 agendaItem->setCellXWidth(XEnd);
1548 agendaItem->resize(mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY); 1553 agendaItem->resize(mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY);
1549 1554
1550 //addChild(agendaItem,XBegin*mGridSpacingX,0); 1555 //addChild(agendaItem,XBegin*mGridSpacingX,0);
1551 mItems.append(agendaItem); 1556 mItems.append(agendaItem);
1552 1557
1553 placeSubCells(agendaItem); 1558 placeSubCells(agendaItem);
1554 1559
1555 //agendaItem->show(); 1560 //agendaItem->show();
1556 1561
1557 return agendaItem; 1562 return agendaItem;
1558} 1563}
1559 1564
1560 1565
1561void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, 1566void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd,
1562 int YTop,int YBottom) 1567 int YTop,int YBottom)
1563{ 1568{
1564 if (mAllDayMode) { 1569 if (mAllDayMode) {
1565 ; 1570 ;
1566 return; 1571 return;
1567 } 1572 }
1568 1573
1569 int cellX,cellYTop,cellYBottom; 1574 int cellX,cellYTop,cellYBottom;
1570 QString newtext; 1575 QString newtext;
1571 int width = XEnd - XBegin + 1; 1576 int width = XEnd - XBegin + 1;
1572 int count = 0; 1577 int count = 0;
1573 KOAgendaItem *current = 0; 1578 KOAgendaItem *current = 0;
1574 QPtrList<KOAgendaItem> multiItems; 1579 QPtrList<KOAgendaItem> multiItems;
1575 for (cellX = XBegin;cellX <= XEnd;++cellX) { 1580 for (cellX = XBegin;cellX <= XEnd;++cellX) {
1576 if (cellX == XBegin) cellYTop = YTop; 1581 if (cellX == XBegin) cellYTop = YTop;
1577 else cellYTop = 0; 1582 else cellYTop = 0;
1578 if (cellX == XEnd) cellYBottom = YBottom; 1583 if (cellX == XEnd) cellYBottom = YBottom;
1579 else cellYBottom = rows() - 1; 1584 else cellYBottom = rows() - 1;
1580 newtext = QString("(%1/%2): ").arg(++count).arg(width); 1585 newtext = QString("(%1/%2): ").arg(++count).arg(width);
1581 newtext.append(event->summary()); 1586 newtext.append(event->summary());
1582 current = insertItem(event,qd,cellX,cellYTop,cellYBottom); 1587 current = insertItem(event,qd,cellX,cellYTop,cellYBottom);
1583 current->setText(newtext); 1588 current->setText(newtext);
1584 multiItems.append(current); 1589 multiItems.append(current);
1585 } 1590 }
1586 1591
1587 KOAgendaItem *next = 0; 1592 KOAgendaItem *next = 0;
1588 KOAgendaItem *last = multiItems.last(); 1593 KOAgendaItem *last = multiItems.last();
1589 KOAgendaItem *first = multiItems.first(); 1594 KOAgendaItem *first = multiItems.first();
1590 KOAgendaItem *setFirst,*setLast; 1595 KOAgendaItem *setFirst,*setLast;
1591 current = first; 1596 current = first;
1592 while (current) { 1597 while (current) {
1593 next = multiItems.next(); 1598 next = multiItems.next();
1594 if (current == first) setFirst = 0; 1599 if (current == first) setFirst = 0;
1595 else setFirst = first; 1600 else setFirst = first;
1596 if (current == last) setLast = 0; 1601 if (current == last) setLast = 0;
1597 else setLast = last; 1602 else setLast = last;
1598 1603
1599 current->setMultiItem(setFirst,next,setLast); 1604 current->setMultiItem(setFirst,next,setLast);
1600 current = next; 1605 current = next;
1601 } 1606 }
1602 1607
1603 marcus_bains(); 1608 marcus_bains();
1604} 1609}
1605 1610
1606 1611
1607//QSizePolicy KOAgenda::sizePolicy() const 1612//QSizePolicy KOAgenda::sizePolicy() const
1608//{ 1613//{
1609 // Thought this would make the all-day event agenda minimum size and the 1614 // Thought this would make the all-day event agenda minimum size and the
1610 // normal agenda take the remaining space. But it doesn´t work. The QSplitter 1615 // normal agenda take the remaining space. But it doesn´t work. The QSplitter
1611 // don´t seem to think that an Expanding widget needs more space than a 1616 // don´t seem to think that an Expanding widget needs more space than a
1612 // Preferred one. 1617 // Preferred one.
1613 // But it doesn´t hurt, so it stays. 1618 // But it doesn´t hurt, so it stays.
1614// if (mAllDayMode) { 1619// if (mAllDayMode) {
1615// return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); 1620// return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
1616// } else { 1621// } else {
1617// return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); 1622// return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
1618// } 1623// }
1619//} 1624//}
1620void KOAgenda::finishResize ( ) 1625void KOAgenda::finishResize ( )
1621{ 1626{
1622 //qDebug("finishResize+++++++++++++++++++++++++++++++ ( ) "); 1627 //qDebug("finishResize+++++++++++++++++++++++++++++++ ( ) ");
1623 if ( globalFlagBlockAgenda == 0 ) { 1628 if ( globalFlagBlockAgenda == 0 ) {
1624 finishUpdate(); 1629 finishUpdate();
1625 //qDebug("finishUpdate() called "); 1630 //qDebug("finishUpdate() called ");
1626 } 1631 }
1627} 1632}
1628/* 1633/*
1629 Overridden from QScrollView to provide proper resizing of KOAgendaItems. 1634 Overridden from QScrollView to provide proper resizing of KOAgendaItems.
1630*/ 1635*/
1631void KOAgenda::resizeEvent ( QResizeEvent *ev ) 1636void KOAgenda::resizeEvent ( QResizeEvent *ev )
1632{ 1637{
1633 1638
1634 mResizeTimer.start( 150 , true ); 1639 mResizeTimer.start( 150 , true );
1635 computeSizes(); 1640 computeSizes();
1636 return; 1641 return;
1637 1642
1638} 1643}
1639void KOAgenda::computeSizes() 1644void KOAgenda::computeSizes()
1640{ 1645{
1641 if ( globalFlagBlockStartup ) 1646 if ( globalFlagBlockStartup )
1642 return; 1647 return;
1643 1648
1644 if (mAllDayMode) { 1649 if (mAllDayMode) {
1645 mGridSpacingX = (width()-3) / mColumns; 1650 mGridSpacingX = (width()-3) / mColumns;
1646 mGridSpacingY = height() - 2 * frameWidth() - 1; 1651 mGridSpacingY = height() - 2 * frameWidth() - 1;
1647 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY + 1); 1652 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY + 1);
1648// mGridSpacingY = height(); 1653// mGridSpacingY = height();
1649// resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); 1654// resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
1650 1655
1651 KOAgendaItem *item; 1656 KOAgendaItem *item;
1652 int subCellWidth; 1657 int subCellWidth;
1653 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1658 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1654 subCellWidth = mGridSpacingY / item->subCells(); 1659 subCellWidth = mGridSpacingY / item->subCells();
1655 item->resize(mGridSpacingX * item->cellWidth(),subCellWidth); 1660 item->resize(mGridSpacingX * item->cellWidth(),subCellWidth);
1656 moveChild(item,KOGlobals::self()->reverseLayout() ? 1661 moveChild(item,KOGlobals::self()->reverseLayout() ?
1657 (mColumns - 1 - item->cellX()) * mGridSpacingX : 1662 (mColumns - 1 - item->cellX()) * mGridSpacingX :
1658 item->cellX() * mGridSpacingX, 1663 item->cellX() * mGridSpacingX,
1659 item->subCell() * subCellWidth); 1664 item->subCell() * subCellWidth);
1660 } 1665 }
1661 KOPrefs::instance()->mAllDaySize = mGridSpacingY; 1666 KOPrefs::instance()->mAllDaySize = mGridSpacingY;
1662 } else { 1667 } else {
1663 mGridSpacingX = (width() - verticalScrollBar()->width()-3)/mColumns; 1668 mGridSpacingX = (width() - verticalScrollBar()->width()-3)/mColumns;
1664 if (height() > mGridSpacingY * mRows + 1 ) { 1669 if (height() > mGridSpacingY * mRows + 1 ) {
1665 KOPrefs::instance()->mHourSize = ((height())/mRows)+1; 1670 KOPrefs::instance()->mHourSize = ((height())/mRows)+1;
1666 mGridSpacingY = KOPrefs::instance()->mHourSize ; 1671 mGridSpacingY = KOPrefs::instance()->mHourSize ;
1667 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); 1672 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
1668 emit resizedSignal(); 1673 emit resizedSignal();
1669 } else 1674 } else
1670 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); 1675 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
1671 KOAgendaItem *item; 1676 KOAgendaItem *item;
1672 int subCellWidth; 1677 int subCellWidth;
1673 1678
1674 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1679 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1675 subCellWidth = mGridSpacingX / item->subCells(); 1680 subCellWidth = mGridSpacingX / item->subCells();
1676 item->resize(subCellWidth,item->height()); 1681 item->resize(subCellWidth,item->height());
1677 moveChild(item,(KOGlobals::self()->reverseLayout() ? 1682 moveChild(item,(KOGlobals::self()->reverseLayout() ?
1678 (mColumns - 1 - item->cellX()) * mGridSpacingX : 1683 (mColumns - 1 - item->cellX()) * mGridSpacingX :
1679 item->cellX() * mGridSpacingX) + 1684 item->cellX() * mGridSpacingX) +
1680 item->subCell() * subCellWidth,childY(item)); 1685 item->subCell() * subCellWidth,childY(item));
1681 } 1686 }
1682 } 1687 }
1683 int cw = contentsWidth(); 1688 int cw = contentsWidth();
1684 int ch = contentsHeight(); 1689 int ch = contentsHeight();
1685 if ( mAllDayMode ) { 1690 if ( mAllDayMode ) {
1686 QPixmap* paintPixAll = KOAgendaItem::paintPixAllday(); 1691 QPixmap* paintPixAll = KOAgendaItem::paintPixAllday();
1687 if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 ) 1692 if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 )
1688 paintPixAll->resize( cw, ch ); 1693 paintPixAll->resize( cw, ch );
1689 } else { 1694 } else {
1690 QPixmap* paintPix = KOAgendaItem::paintPix(); 1695 QPixmap* paintPix = KOAgendaItem::paintPix();
1691 if ( paintPix->width() < cw || paintPix->height() < ch ) 1696 if ( paintPix->width() < cw || paintPix->height() < ch )
1692 KOAgendaItem::resizePixmap( cw , ch ); 1697 KOAgendaItem::resizePixmap( cw , ch );
1693 } 1698 }
1694 1699
1695 checkScrollBoundaries(); 1700 checkScrollBoundaries();
1696 marcus_bains(); 1701 marcus_bains();
1697 drawContentsToPainter(); 1702 drawContentsToPainter();
1698 viewport()->repaint(false); 1703 viewport()->repaint(false);
1699} 1704}
1700 1705
1701void KOAgenda::scrollUp() 1706void KOAgenda::scrollUp()
1702{ 1707{
1703 scrollBy(0,-mScrollOffset); 1708 scrollBy(0,-mScrollOffset);
1704} 1709}
1705 1710
1706 1711
1707void KOAgenda::scrollDown() 1712void KOAgenda::scrollDown()
1708{ 1713{
1709 scrollBy(0,mScrollOffset); 1714 scrollBy(0,mScrollOffset);
1710} 1715}
1711 1716
1712void KOAgenda::popupAlarm() 1717void KOAgenda::popupAlarm()
1713{ 1718{
1714 if (!mClickedItem) { 1719 if (!mClickedItem) {
1715 qDebug("KOAgenda::popupAlarm() called without having a clicked item "); 1720 qDebug("KOAgenda::popupAlarm() called without having a clicked item ");
1716 return; 1721 return;
1717 } 1722 }
1718// TODO: deal correctly with multiple alarms 1723// TODO: deal correctly with multiple alarms
1719 Alarm* alarm; 1724 Alarm* alarm;
1720 QPtrList<Alarm> list(mClickedItem->incidence()->alarms()); 1725 QPtrList<Alarm> list(mClickedItem->incidence()->alarms());
1721 for(alarm=list.first();alarm;alarm=list.next()) { 1726 for(alarm=list.first();alarm;alarm=list.next()) {
1722 alarm->toggleAlarm(); 1727 alarm->toggleAlarm();
1723 } 1728 }
1724 emit itemModified( mClickedItem , KOGlobals::EVENTEDITED ); 1729 emit itemModified( mClickedItem , KOGlobals::EVENTEDITED );
1725 mClickedItem->paintMe( true ); 1730 mClickedItem->paintMe( true );
1726 mClickedItem->repaint( false ); 1731 mClickedItem->repaint( false );
1727} 1732}
1728 1733
1729/* 1734/*
1730 Calculates the minimum width 1735 Calculates the minimum width
1731*/ 1736*/
1732int KOAgenda::minimumWidth() const 1737int KOAgenda::minimumWidth() const
1733{ 1738{
1734 // TODO:: develop a way to dynamically determine the minimum width 1739 // TODO:: develop a way to dynamically determine the minimum width
1735 int min = 100; 1740 int min = 100;
1736 1741
1737 return min; 1742 return min;
1738} 1743}
1739 1744
1740void KOAgenda::updateConfig() 1745void KOAgenda::updateConfig()
1741{ 1746{
1742 if ( viewport()->backgroundColor() != KOPrefs::instance()->mAgendaBgColor) 1747 if ( viewport()->backgroundColor() != KOPrefs::instance()->mAgendaBgColor)
1743 viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor); 1748 viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor);
1744 if ( mAllDayMode ) { 1749 if ( mAllDayMode ) {
1745 mGridSpacingY = height() - 1 ;// KOPrefs::instance()->mAllDaySize; 1750 mGridSpacingY = height() - 1 ;// KOPrefs::instance()->mAllDaySize;
1746 //mGridSpacingY = KOPrefs::instance()->mAllDaySize; 1751 //mGridSpacingY = KOPrefs::instance()->mAllDaySize;
1747 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY+1 ); 1752 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY+1 );
1748 // setMaximumHeight( mGridSpacingY+1 ); 1753 // setMaximumHeight( mGridSpacingY+1 );
1749 viewport()->repaint( false ); 1754 viewport()->repaint( false );
1750 //setFixedHeight( mGridSpacingY+1 ); 1755 //setFixedHeight( mGridSpacingY+1 );
1751 //qDebug("KOPrefs:aaaaa:instance()->mAllDaySize %d ", KOPrefs::instance()->mAllDaySize); 1756 //qDebug("KOPrefs:aaaaa:instance()->mAllDaySize %d ", KOPrefs::instance()->mAllDaySize);
1752 } 1757 }
1753 else { 1758 else {
1754 mGridSpacingY = KOPrefs::instance()->mHourSize; 1759 mGridSpacingY = KOPrefs::instance()->mHourSize;
1755 calculateWorkingHours(); 1760 calculateWorkingHours();
1756 marcus_bains(); 1761 marcus_bains();
1757 } 1762 }
1758} 1763}
1759 1764
1760void KOAgenda::checkScrollBoundaries() 1765void KOAgenda::checkScrollBoundaries()
1761{ 1766{
1762 // Invalidate old values to force update 1767 // Invalidate old values to force update
1763 mOldLowerScrollValue = -1; 1768 mOldLowerScrollValue = -1;
1764 mOldUpperScrollValue = -1; 1769 mOldUpperScrollValue = -1;
1765 1770
1766 checkScrollBoundaries(verticalScrollBar()->value()); 1771 checkScrollBoundaries(verticalScrollBar()->value());
1767} 1772}
1768 1773
1769void KOAgenda::checkScrollBoundaries(int v) 1774void KOAgenda::checkScrollBoundaries(int v)
1770{ 1775{
1771 if ( mGridSpacingY == 0 ) 1776 if ( mGridSpacingY == 0 )
1772 return; 1777 return;
1773 int yMin = v/mGridSpacingY; 1778 int yMin = v/mGridSpacingY;
1774 int yMax = (v+visibleHeight())/mGridSpacingY; 1779 int yMax = (v+visibleHeight())/mGridSpacingY;
1775 1780
1776// kdDebug() << "--- yMin: " << yMin << " yMax: " << yMax << endl; 1781// kdDebug() << "--- yMin: " << yMin << " yMax: " << yMax << endl;
1777 1782
1778 if (yMin != mOldLowerScrollValue) { 1783 if (yMin != mOldLowerScrollValue) {
1779 mOldLowerScrollValue = yMin; 1784 mOldLowerScrollValue = yMin;
1780 emit lowerYChanged(yMin); 1785 emit lowerYChanged(yMin);
1781 } 1786 }
1782 if (yMax != mOldUpperScrollValue) { 1787 if (yMax != mOldUpperScrollValue) {
1783 mOldUpperScrollValue = yMax; 1788 mOldUpperScrollValue = yMax;
1784 emit upperYChanged(yMax); 1789 emit upperYChanged(yMax);
1785 } 1790 }
1786} 1791}
1787 1792
1788void KOAgenda::deselectItem() 1793void KOAgenda::deselectItem()
1789{ 1794{
1790 if (mSelectedItem.isNull()) return; 1795 if (mSelectedItem.isNull()) return;
1791 mSelectedItem->select(false); 1796 mSelectedItem->select(false);
1792 mSelectedItem = 0; 1797 mSelectedItem = 0;
1793} 1798}
1794 1799
1795void KOAgenda::selectItem(KOAgendaItem *item) 1800void KOAgenda::selectItem(KOAgendaItem *item)
1796{ 1801{
1797 if ((KOAgendaItem *)mSelectedItem == item) return; 1802 if ((KOAgendaItem *)mSelectedItem == item) return;
1798 deselectItem(); 1803 deselectItem();
1799 if (item == 0) { 1804 if (item == 0) {
1800 emit incidenceSelected( 0 ); 1805 emit incidenceSelected( 0 );
1801 return; 1806 return;
1802 } 1807 }
1803 mSelectedItem = item; 1808 mSelectedItem = item;
1804 mSelectedItem->select(); 1809 mSelectedItem->select();
1805 emit incidenceSelected( mSelectedItem->incidence() ); 1810 emit incidenceSelected( mSelectedItem->incidence() );
1806} 1811}
1807 1812
1808// This function seems never be called. 1813// This function seems never be called.
1809void KOAgenda::keyPressEvent( QKeyEvent *kev ) 1814void KOAgenda::keyPressEvent( QKeyEvent *kev )
1810{ 1815{
1811 switch(kev->key()) { 1816 switch(kev->key()) {
1812 case Key_PageDown: 1817 case Key_PageDown:
1813 verticalScrollBar()->addPage(); 1818 verticalScrollBar()->addPage();
1814 break; 1819 break;
1815 case Key_PageUp: 1820 case Key_PageUp:
1816 verticalScrollBar()->subtractPage(); 1821 verticalScrollBar()->subtractPage();
1817 break; 1822 break;
1818 case Key_Down: 1823 case Key_Down:
1819 verticalScrollBar()->addLine(); 1824 verticalScrollBar()->addLine();
1820 break; 1825 break;
1821 case Key_Up: 1826 case Key_Up:
1822 verticalScrollBar()->subtractLine(); 1827 verticalScrollBar()->subtractLine();
1823 break; 1828 break;
1824 default: 1829 default:
1825 ; 1830 ;
1826 } 1831 }
1827} 1832}
1828 1833
1829void KOAgenda::calculateWorkingHours() 1834void KOAgenda::calculateWorkingHours()
1830{ 1835{
1831// mWorkingHoursEnable = KOPrefs::instance()->mEnableWorkingHours; 1836// mWorkingHoursEnable = KOPrefs::instance()->mEnableWorkingHours;
1832 mWorkingHoursEnable = !mAllDayMode; 1837 mWorkingHoursEnable = !mAllDayMode;
1833 1838
1834 mWorkingHoursYTop = mGridSpacingY * 1839 mWorkingHoursYTop = mGridSpacingY *
1835 KOPrefs::instance()->mWorkingHoursStart * 4; 1840 KOPrefs::instance()->mWorkingHoursStart * 4;
1836 mWorkingHoursYBottom = mGridSpacingY * 1841 mWorkingHoursYBottom = mGridSpacingY *
1837 KOPrefs::instance()->mWorkingHoursEnd * 4 - 1; 1842 KOPrefs::instance()->mWorkingHoursEnd * 4 - 1;
1838} 1843}
1839 1844
1840 1845
1841DateList KOAgenda::dateList() const 1846DateList KOAgenda::dateList() const
1842{ 1847{
1843 return mSelectedDates; 1848 return mSelectedDates;
1844} 1849}
1845 1850
1846void KOAgenda::setDateList(const DateList &selectedDates) 1851void KOAgenda::setDateList(const DateList &selectedDates)
1847{ 1852{
1848 mSelectedDates = selectedDates; 1853 mSelectedDates = selectedDates;
1849 marcus_bains(); 1854 marcus_bains();
1850} 1855}
1851 1856
1852void KOAgenda::setHolidayMask(QMemArray<bool> *mask) 1857void KOAgenda::setHolidayMask(QMemArray<bool> *mask)
1853{ 1858{
1854 mHolidayMask = mask; 1859 mHolidayMask = mask;
1855 1860
1856/* 1861/*
1857 kdDebug() << "HolidayMask: "; 1862 kdDebug() << "HolidayMask: ";
1858 for(uint i=0;i<mask->count();++i) { 1863 for(uint i=0;i<mask->count();++i) {
1859 kdDebug() << (mask->at(i) ? "*" : "o"); 1864 kdDebug() << (mask->at(i) ? "*" : "o");
1860 } 1865 }
1861 kdDebug() << endl; 1866 kdDebug() << endl;
1862*/ 1867*/
1863} 1868}
1864 1869
1865void KOAgenda::contentsMousePressEvent ( QMouseEvent *event ) 1870void KOAgenda::contentsMousePressEvent ( QMouseEvent *event )
1866{ 1871{
1867 1872
1868 QScrollView::contentsMousePressEvent(event); 1873 QScrollView::contentsMousePressEvent(event);
1869} 1874}
1870 1875
1871void KOAgenda::storePosition() 1876void KOAgenda::storePosition()
1872{ 1877{
1873 //mContentPosition 1878 //mContentPosition
1874 int max = mGridSpacingY*4*24; 1879 int max = mGridSpacingY*4*24;
1875 if ( contentsY() < 5 && max > viewport()->height()*3/2 ) 1880 if ( contentsY() < 5 && max > viewport()->height()*3/2 )
1876 mContentPosition = 0; 1881 mContentPosition = 0;
1877 else if ( contentsY() + viewport()->height() > max - 5 && max > viewport()->height()*3/2) 1882 else if ( contentsY() + viewport()->height() > max - 5 && max > viewport()->height()*3/2)
1878 mContentPosition = -1.0; 1883 mContentPosition = -1.0;
1879 else 1884 else
1880 mContentPosition = ((float) max)/ ((float)(contentsY()+ ( viewport()->height()/2))); 1885 mContentPosition = ((float) max)/ ((float)(contentsY()+ ( viewport()->height()/2)));
1881 //qDebug("mContentPosition %f %d %d %d",mContentPosition , max, contentsY() ,viewport()->height()); 1886 //qDebug("mContentPosition %f %d %d %d",mContentPosition , max, contentsY() ,viewport()->height());
1882 1887
1883} 1888}
1884void KOAgenda::restorePosition() 1889void KOAgenda::restorePosition()
1885{ 1890{
1886 int posY; 1891 int posY;
1887 int max = mGridSpacingY*4*24; 1892 int max = mGridSpacingY*4*24;
1888 if ( mContentPosition < 0 ) 1893 if ( mContentPosition < 0 )
1889 posY = max-viewport()->height(); 1894 posY = max-viewport()->height();
1890 else 1895 else
1891 if ( mContentPosition == 0 ) 1896 if ( mContentPosition == 0 )
1892 posY = 0; 1897 posY = 0;
1893 else 1898 else
1894 posY = (max/mContentPosition)-(viewport()->height()/2); 1899 posY = (max/mContentPosition)-(viewport()->height()/2);
1895 setContentsPos (0, posY ); 1900 setContentsPos (0, posY );
1896 //qDebug("posY %d hei %d", posY, max); 1901 //qDebug("posY %d hei %d", posY, max);
1897 1902
1898} 1903}
1899void KOAgenda::moveChild( QWidget *w, int x , int y ) 1904void KOAgenda::moveChild( QWidget *w, int x , int y )
1900{ 1905{
1901 ++x; 1906 ++x;
1902 QScrollView::moveChild( w, x , y ); 1907 QScrollView::moveChild( w, x , y );
1903} 1908}
1904#include <qmessagebox.h> 1909#include <qmessagebox.h>
1905#ifdef DESKTOP_VERSION 1910#ifdef DESKTOP_VERSION
1906#include <qprinter.h> 1911#include <qprinter.h>
1907#include <qpainter.h> 1912#include <qpainter.h>
1908#include <qpaintdevicemetrics.h> 1913#include <qpaintdevicemetrics.h>
1909 1914
1910#endif 1915#endif
1911void KOAgenda::printSelection() 1916void KOAgenda::printSelection()
1912{ 1917{
1913#ifdef DESKTOP_VERSION 1918#ifdef DESKTOP_VERSION
1914 if ( mStartCellY == mCurrentCellY ) { 1919 if ( mStartCellY == mCurrentCellY ) {
1915 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1920 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1916 i18n("Nothing selected!\n\nThis prints the full width of the Agenda view as you see it!\n\nTo determine the vertical range of the printing, please select\na vertical range (with the left mouse button down) in one column. "), 1921 i18n("Nothing selected!\n\nThis prints the full width of the Agenda view as you see it!\n\nTo determine the vertical range of the printing, please select\na vertical range (with the left mouse button down) in one column. "),
1917 i18n("OK"), 0, 0, 1922 i18n("OK"), 0, 0,
1918 0, 1 ); 1923 0, 1 );
1919 return; 1924 return;
1920 } 1925 }
1921 1926
1922 float dx, dy; 1927 float dx, dy;
1923 int x,y,w,h; 1928 int x,y,w,h;
1924 x= 0; 1929 x= 0;
1925 w= contentsWidth()+2; 1930 w= contentsWidth()+2;
1926 // h= contentsHeight(); 1931 // h= contentsHeight();
1927 y = mGridSpacingY*mStartCellY; 1932 y = mGridSpacingY*mStartCellY;
1928 h = mGridSpacingY*(mCurrentCellY+1)-y+2; 1933 h = mGridSpacingY*(mCurrentCellY+1)-y+2;
1929 1934
1930 //return; 1935 //return;
1931 QPrinter* printer = new QPrinter(); 1936 QPrinter* printer = new QPrinter();
1932 if ( !printer->setup()) { 1937 if ( !printer->setup()) {
1933 delete printer; 1938 delete printer;
1934 return; 1939 return;
1935 } 1940 }
1936 QPainter p( printer ); 1941 QPainter p( printer );
1937 QPaintDeviceMetrics m = QPaintDeviceMetrics ( printer ); 1942 QPaintDeviceMetrics m = QPaintDeviceMetrics ( printer );
1938 QString date = i18n("Date range: ")+KGlobal::locale()->formatDate( mSelectedDates.first() )+" - "+KGlobal::locale()->formatDate( mSelectedDates.last() ); 1943 QString date = i18n("Date range: ")+KGlobal::locale()->formatDate( mSelectedDates.first() )+" - "+KGlobal::locale()->formatDate( mSelectedDates.last() );
1939 date += " --- printing time: " + KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), true ); 1944 date += " --- printing time: " + KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), true );
1940 int hei = p.boundingRect(0,0, 5, 5, Qt::AlignLeft, date ).height(); 1945 int hei = p.boundingRect(0,0, 5, 5, Qt::AlignLeft, date ).height();
1941 // p.drawText( 0, 0, date ); 1946 // p.drawText( 0, 0, date );
1942 int offset = m.width()/8; 1947 int offset = m.width()/8;
1943 // compute the scale 1948 // compute the scale
1944 dx = ((float) m.width()-offset) / (float)w; 1949 dx = ((float) m.width()-offset) / (float)w;
1945 dy = (float)(m.height() - ( 2 * hei )-offset ) / (float)h; 1950 dy = (float)(m.height() - ( 2 * hei )-offset ) / (float)h;
1946 float scale; 1951 float scale;
1947 // scale to fit the width or height of the paper 1952 // scale to fit the width or height of the paper
1948 if ( dx < dy ) 1953 if ( dx < dy )
1949 scale = dx; 1954 scale = dx;
1950 else 1955 else
1951 scale = dy; 1956 scale = dy;
1952 // set the scale 1957 // set the scale
1953 p.drawText( offset* scale, offset* scale*3/4, date ); 1958 p.drawText( offset* scale, offset* scale*3/4, date );
1954 1959
1955 int selDay; 1960 int selDay;
1956 float widOffset = ((float) m.width()-offset) / ((float)(mSelectedDates.count())); 1961 float widOffset = ((float) m.width()-offset) / ((float)(mSelectedDates.count()));
1957 float startX = 1; 1962 float startX = 1;
1958 for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) 1963 for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay)
1959 { 1964 {
1960 QString text = KGlobal::locale()->formatDate( mSelectedDates[selDay],true ); 1965 QString text = KGlobal::locale()->formatDate( mSelectedDates[selDay],true );
1961 p.setClipRect(offset* scale+startX , 0, widOffset-4, offset* scale+(2*hei* scale) ); 1966 p.setClipRect(offset* scale+startX , 0, widOffset-4, offset* scale+(2*hei* scale) );
1962 p.drawText( offset* scale+startX, (offset+hei)* scale, text ); 1967 p.drawText( offset* scale+startX, (offset+hei)* scale, text );
1963 startX += widOffset; 1968 startX += widOffset;
1964 1969
1965 } 1970 }
1966 p.translate( offset* scale,offset* scale+ (-y * scale)+(2*hei* scale)); 1971 p.translate( offset* scale,offset* scale+ (-y * scale)+(2*hei* scale));
1967 p.scale( scale, scale ); 1972 p.scale( scale, scale );
1968 p.setClipRect( offset* scale, offset* scale+(2*hei* scale), w*scale, h*scale ); 1973 p.setClipRect( offset* scale, offset* scale+(2*hei* scale), w*scale, h*scale );
1969 // now printing with y offset: 2 hei 1974 // now printing with y offset: 2 hei
1970 // p.translate( 0, -y*scale); 1975 // p.translate( 0, -y*scale);
1971 1976
1972 drawContentsToPainter(&p, true ); 1977 drawContentsToPainter(&p, true );
1973 globalFlagBlockAgendaItemUpdate = false; 1978 globalFlagBlockAgendaItemUpdate = false;
1974 KOAgendaItem *item; 1979 KOAgendaItem *item;
1975 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1980 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1976 item->select(false); 1981 item->select(false);
1977 item->paintMe( false, &p ); 1982 item->paintMe( false, &p );
1978 } 1983 }
1979 globalFlagBlockAgendaItemUpdate = true; 1984 globalFlagBlockAgendaItemUpdate = true;
1980 p.end(); 1985 p.end();
1981 delete printer; 1986 delete printer;
1982#else 1987#else
1983 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1988 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1984 i18n("Not supported \non PDA!\n"), 1989 i18n("Not supported \non PDA!\n"),
1985 i18n("OK"), 0, 0, 1990 i18n("OK"), 0, 0,
1986 0, 1 ); 1991 0, 1 );
1987#endif 1992#endif
1988} 1993}
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h
index 12943d7..2069b22 100644
--- a/korganizer/koagenda.h
+++ b/korganizer/koagenda.h
@@ -1,290 +1,291 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KOAGENDA_H 23#ifndef KOAGENDA_H
24#define KOAGENDA_H 24#define KOAGENDA_H
25 25
26#include <qscrollview.h> 26#include <qscrollview.h>
27#include <qtimer.h> 27#include <qtimer.h>
28#include <qmemarray.h> 28#include <qmemarray.h>
29#include <qpainter.h> 29#include <qpainter.h>
30#include <qpixmap.h> 30#include <qpixmap.h>
31#include <qguardedptr.h> 31#include <qguardedptr.h>
32 32
33#include "koagendaitem.h" 33#include "koagendaitem.h"
34 34
35class QPopupMenu; 35class QPopupMenu;
36class QTime; 36class QTime;
37class KConfig; 37class KConfig;
38class QFrame; 38class QFrame;
39class KOAgenda; 39class KOAgenda;
40class KCal::Event; 40class KCal::Event;
41class KCal::Todo; 41class KCal::Todo;
42 42
43using namespace KCal; 43using namespace KCal;
44 44
45class MarcusBains : public QFrame { 45class MarcusBains : public QFrame {
46 Q_OBJECT 46 Q_OBJECT
47 public: 47 public:
48 MarcusBains(KOAgenda *agenda=0,const char *name=0); 48 MarcusBains(KOAgenda *agenda=0,const char *name=0);
49 virtual ~MarcusBains(); 49 virtual ~MarcusBains();
50 50
51 public slots: 51 public slots:
52 void updateLocation(bool recalculate=false); 52 void updateLocation(bool recalculate=false);
53 void updateLoc(); 53 void updateLoc();
54 54
55 private: 55 private:
56 int todayColumn(); 56 int todayColumn();
57 QTimer *minutes; 57 QTimer *minutes;
58 QLabel *mTimeBox; 58 QLabel *mTimeBox;
59 KOAgenda *agenda; 59 KOAgenda *agenda;
60 QTime oldTime; 60 QTime oldTime;
61 int oldToday; 61 int oldToday;
62}; 62};
63 63
64 64
65class KOAgenda : public QScrollView 65class KOAgenda : public QScrollView
66{ 66{
67 Q_OBJECT 67 Q_OBJECT
68 public: 68 public:
69 enum MouseActionType { NOP, MOVE, SELECT, 69 enum MouseActionType { NOP, MOVE, SELECT,
70 RESIZETOP, RESIZEBOTTOM, RESIZELEFT, RESIZERIGHT }; 70 RESIZETOP, RESIZEBOTTOM, RESIZELEFT, RESIZERIGHT };
71 71
72 KOAgenda ( int columns, int rows, int columnSize, QWidget * parent=0, 72 KOAgenda ( int columns, int rows, int columnSize, QWidget * parent=0,
73 const char * name=0, WFlags f=0 ); 73 const char * name=0, WFlags f=0 );
74 KOAgenda ( int columns, QWidget * parent=0, 74 KOAgenda ( int columns, QWidget * parent=0,
75 const char * name=0, WFlags f=0 ); 75 const char * name=0, WFlags f=0 );
76 virtual ~KOAgenda(); 76 virtual ~KOAgenda();
77 77
78 Incidence *selectedIncidence() const; 78 Incidence *selectedIncidence() const;
79 QDate selectedIncidenceDate() const; 79 QDate selectedIncidenceDate() const;
80 80
81 virtual bool eventFilter ( QObject *, QEvent * ); 81 virtual bool eventFilter ( QObject *, QEvent * );
82 82
83 void contentsToGrid (int x, int y, int& gx, int& gy); 83 void contentsToGrid (int x, int y, int& gx, int& gy);
84 void gridToContents (int gx, int gy, int& x, int& y); 84 void gridToContents (int gx, int gy, int& x, int& y);
85 85
86 int timeToY (const QTime &time); 86 int timeToY (const QTime &time);
87 QTime gyToTime (int y); 87 QTime gyToTime (int y);
88 88
89 void setStartHour(int startHour); 89 void setStartHour(int startHour);
90 90
91 KOAgendaItem *insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom); 91 KOAgendaItem *insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom);
92 KOAgendaItem *insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd); 92 KOAgendaItem *insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd);
93 void insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, 93 void insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd,
94 int YTop,int YBottom); 94 int YTop,int YBottom);
95 95
96 void changeColumns(int columns); 96 void changeColumns(int columns);
97 97
98 int columns() { return mColumns; } 98 int columns() { return mColumns; }
99 int rows() { return mRows; } 99 int rows() { return mRows; }
100 100
101 int gridSpacingX() const { return mGridSpacingX; } 101 int gridSpacingX() const { return mGridSpacingX; }
102 int gridSpacingY() const { return mGridSpacingY; } 102 int gridSpacingY() const { return mGridSpacingY; }
103 103
104// virtual QSizePolicy sizePolicy() const; 104// virtual QSizePolicy sizePolicy() const;
105 105
106 void clear(); 106 void clear();
107 107
108 void clearSelection(); 108 void clearSelection();
109 void hideUnused(); 109 void hideUnused();
110 110
111 /** Calculates the minimum width */ 111 /** Calculates the minimum width */
112 virtual int minimumWidth() const; 112 virtual int minimumWidth() const;
113 /** Update configuration from preference settings */ 113 /** Update configuration from preference settings */
114 void updateConfig(); 114 void updateConfig();
115 115
116 void checkScrollBoundaries(); 116 void checkScrollBoundaries();
117 117
118 void setHolidayMask(QMemArray<bool> *); 118 void setHolidayMask(QMemArray<bool> *);
119 void setDateList(const DateList &selectedDates); 119 void setDateList(const DateList &selectedDates);
120 DateList dateList() const; 120 DateList dateList() const;
121 void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false); 121 void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false);
122 void finishUpdate(); 122 void finishUpdate();
123 void printSelection(); 123 void printSelection();
124 void storePosition(); 124 void storePosition();
125 void restorePosition(); 125 void restorePosition();
126 126
127 127
128 public slots: 128 public slots:
129 void newItem( int ); 129 void newItem( int );
130 void moveChild( QWidget *, int, int ); 130 void moveChild( QWidget *, int, int );
131 void scrollUp(); 131 void scrollUp();
132 void scrollDown(); 132 void scrollDown();
133 void updateTodo( Todo * t, int , bool ); 133 void updateTodo( Todo * t, int , bool );
134 void popupAlarm(); 134 void popupAlarm();
135 135
136 void checkScrollBoundaries(int); 136 void checkScrollBoundaries(int);
137 137
138 /** Deselect selected items. This function does not emit any signals. */ 138 /** Deselect selected items. This function does not emit any signals. */
139 void deselectItem(); 139 void deselectItem();
140 /** Select item. If the argument is 0, the currently selected item gets 140 /** Select item. If the argument is 0, the currently selected item gets
141 deselected. This function emits the itemSelected(bool) signal to inform 141 deselected. This function emits the itemSelected(bool) signal to inform
142 about selection/deseelction of events. */ 142 about selection/deseelction of events. */
143 void selectItem(KOAgendaItem *); 143 void selectItem(KOAgendaItem *);
144 void finishResize(); 144 void finishResize();
145 145
146 signals: 146 signals:
147 void showDateView( int, QDate );
147 void newEventSignal(); 148 void newEventSignal();
148 void newEventSignal(int gx,int gy); 149 void newEventSignal(int gx,int gy);
149 void newTodoSignal(int gx,int gy); 150 void newTodoSignal(int gx,int gy);
150 void newEventSignal(int gxStart, int gyStart, int gxEnd, int gyEnd); 151 void newEventSignal(int gxStart, int gyStart, int gxEnd, int gyEnd);
151 void newTimeSpanSignal(int gxStart, int gyStart, int gxEnd, int gyEnd); 152 void newTimeSpanSignal(int gxStart, int gyStart, int gxEnd, int gyEnd);
152 void newStartSelectSignal(); 153 void newStartSelectSignal();
153 void showIncidenceSignal(Incidence *); 154 void showIncidenceSignal(Incidence *);
154 void editIncidenceSignal(Incidence *); 155 void editIncidenceSignal(Incidence *);
155 void deleteIncidenceSignal(Incidence *); 156 void deleteIncidenceSignal(Incidence *);
156 void showIncidencePopupSignal(Incidence *); 157 void showIncidencePopupSignal(Incidence *);
157 158
158 void itemModified(KOAgendaItem *item, int ); 159 void itemModified(KOAgendaItem *item, int );
159 void incidenceSelected(Incidence *); 160 void incidenceSelected(Incidence *);
160 161
161 void lowerYChanged(int); 162 void lowerYChanged(int);
162 void upperYChanged(int); 163 void upperYChanged(int);
163 164
164 void startDragSignal(Incidence *); 165 void startDragSignal(Incidence *);
165 void addToCalSignal(Incidence *, Incidence *); 166 void addToCalSignal(Incidence *, Incidence *);
166 void resizedSignal(); 167 void resizedSignal();
167 168
168 protected: 169 protected:
169 QPainter mPixPainter; 170 QPainter mPixPainter;
170 QPixmap mPaintPixmap; 171 QPixmap mPaintPixmap;
171 QPixmap mHighlightPixmap; 172 QPixmap mHighlightPixmap;
172 void drawContents(QPainter *p,int cx, int cy, int cw, int ch); 173 void drawContents(QPainter *p,int cx, int cy, int cw, int ch);
173 virtual void resizeEvent ( QResizeEvent * ); 174 virtual void resizeEvent ( QResizeEvent * );
174 175
175 /** Handles mouse events. Called from eventFilter */ 176 /** Handles mouse events. Called from eventFilter */
176 virtual bool eventFilter_mouse ( QObject *, QMouseEvent * ); 177 virtual bool eventFilter_mouse ( QObject *, QMouseEvent * );
177 178
178 /** Start selecting time span. */ 179 /** Start selecting time span. */
179 void startSelectAction(QPoint viewportPos); 180 void startSelectAction(QPoint viewportPos);
180 181
181 /** Select time span. */ 182 /** Select time span. */
182 void performSelectAction(QPoint viewportPos); 183 void performSelectAction(QPoint viewportPos);
183 184
184 /** Emd selecting time span. */ 185 /** Emd selecting time span. */
185 void endSelectAction( bool emitNewEvent = false ); 186 void endSelectAction( bool emitNewEvent = false );
186 187
187 /** Start moving/resizing agenda item */ 188 /** Start moving/resizing agenda item */
188 void startItemAction(QPoint viewportPos); 189 void startItemAction(QPoint viewportPos);
189 190
190 /** Move/resize agenda item */ 191 /** Move/resize agenda item */
191 void performItemAction(QPoint viewportPos); 192 void performItemAction(QPoint viewportPos);
192 193
193 /** End moving/resizing agenda item */ 194 /** End moving/resizing agenda item */
194 void endItemAction(); 195 void endItemAction();
195 196
196 /** Set cursor, when no item action is in progress */ 197 /** Set cursor, when no item action is in progress */
197 void setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos); 198 void setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos);
198 199
199 /** Place agenda item in agenda and adjust other cells if necessary */ 200 /** Place agenda item in agenda and adjust other cells if necessary */
200 void placeSubCells(KOAgendaItem *placeItem); 201 void placeSubCells(KOAgendaItem *placeItem);
201 202
202 /** Process the keyevent, including the ignored keyevents of eventwidgets. 203 /** Process the keyevent, including the ignored keyevents of eventwidgets.
203 * Implements pgup/pgdn and cursor key navigation in the view. 204 * Implements pgup/pgdn and cursor key navigation in the view.
204 */ 205 */
205 void keyPressEvent( QKeyEvent * ); 206 void keyPressEvent( QKeyEvent * );
206 207
207 void calculateWorkingHours(); 208 void calculateWorkingHours();
208 209
209 virtual void contentsMousePressEvent ( QMouseEvent * ); 210 virtual void contentsMousePressEvent ( QMouseEvent * );
210 211
211 private: 212 private:
212 bool blockNewEvent; 213 bool blockNewEvent;
213 void init(); 214 void init();
214 void marcus_bains(); 215 void marcus_bains();
215 bool mAllDayMode; 216 bool mAllDayMode;
216 bool blockResize; 217 bool blockResize;
217 QTimer mResizeTimer; 218 QTimer mResizeTimer;
218 double mContentPosition; 219 double mContentPosition;
219 220
220 // Width and height of agenda cells 221 // Width and height of agenda cells
221 int mGridSpacingX; 222 int mGridSpacingX;
222 int mGridSpacingY; 223 int mGridSpacingY;
223 224
224 // size of border, where mouse action will resize the KOAgendaItem 225 // size of border, where mouse action will resize the KOAgendaItem
225 int mResizeBorderWidth; 226 int mResizeBorderWidth;
226 227
227 // size of border, where mouse mve will cause a scroll of the agenda 228 // size of border, where mouse mve will cause a scroll of the agenda
228 int mScrollBorderWidth; 229 int mScrollBorderWidth;
229 int mScrollDelay; 230 int mScrollDelay;
230 int mScrollOffset; 231 int mScrollOffset;
231 232
232 QTimer mScrollUpTimer; 233 QTimer mScrollUpTimer;
233 QTimer mScrollDownTimer; 234 QTimer mScrollDownTimer;
234 235
235 // Number of Columns/Rows of agenda grid 236 // Number of Columns/Rows of agenda grid
236 int mColumns; 237 int mColumns;
237 int mRows; 238 int mRows;
238 239
239 // Cells to store Move and Resize coordiantes 240 // Cells to store Move and Resize coordiantes
240 int mStartCellX; 241 int mStartCellX;
241 int mStartCellY; 242 int mStartCellY;
242 int mCurrentCellX; 243 int mCurrentCellX;
243 int mCurrentCellY; 244 int mCurrentCellY;
244 245
245 // Working Hour coordiantes 246 // Working Hour coordiantes
246 bool mWorkingHoursEnable; 247 bool mWorkingHoursEnable;
247 int mWorkingHoursYTop; 248 int mWorkingHoursYTop;
248 int mWorkingHoursYBottom; 249 int mWorkingHoursYBottom;
249 250
250 // Selection 251 // Selection
251 int mSelectionCellX; 252 int mSelectionCellX;
252 int mSelectionYTop; 253 int mSelectionYTop;
253 int mSelectionHeight; 254 int mSelectionHeight;
254 255
255 // List of dates to be displayed 256 // List of dates to be displayed
256 DateList mSelectedDates; 257 DateList mSelectedDates;
257 258
258 // The KOAgendaItem, which has been right-clicked last 259 // The KOAgendaItem, which has been right-clicked last
259 KOAgendaItem *mClickedItem; 260 KOAgendaItem *mClickedItem;
260 261
261 // The KOAgendaItem, which is being moved/resized 262 // The KOAgendaItem, which is being moved/resized
262 QGuardedPtr<KOAgendaItem> mActionItem; 263 QGuardedPtr<KOAgendaItem> mActionItem;
263 264
264 // Currently selected item 265 // Currently selected item
265 QGuardedPtr<KOAgendaItem> mSelectedItem; 266 QGuardedPtr<KOAgendaItem> mSelectedItem;
266 267
267 // The Marcus Bains Line widget. 268 // The Marcus Bains Line widget.
268 MarcusBains *mMarcusBains; 269 MarcusBains *mMarcusBains;
269 void computeSizes(); 270 void computeSizes();
270 271
271 MouseActionType mActionType; 272 MouseActionType mActionType;
272 273
273 bool mItemMoved; 274 bool mItemMoved;
274 275
275 // List of all Items contained in agenda 276 // List of all Items contained in agenda
276 QPtrList<KOAgendaItem> mItems; 277 QPtrList<KOAgendaItem> mItems;
277 QPtrList<KOAgendaItem> mUnusedItems; 278 QPtrList<KOAgendaItem> mUnusedItems;
278 KOAgendaItem* getNewItem(Incidence * event,QDate qd, QWidget* viewport); 279 KOAgendaItem* getNewItem(Incidence * event,QDate qd, QWidget* viewport);
279 QPopupMenu *mItemPopup; // Right mouse button popup menu for KOAgendaItems 280 QPopupMenu *mItemPopup; // Right mouse button popup menu for KOAgendaItems
280 QPopupMenu *mNewItemPopup; 281 QPopupMenu *mNewItemPopup;
281 282
282 int mOldLowerScrollValue; 283 int mOldLowerScrollValue;
283 int mOldUpperScrollValue; 284 int mOldUpperScrollValue;
284 KOAgendaItem * getItemForTodo ( Todo * todo ); 285 KOAgendaItem * getItemForTodo ( Todo * todo );
285 QMemArray<bool> *mHolidayMask; 286 QMemArray<bool> *mHolidayMask;
286 int mCurPixWid; 287 int mCurPixWid;
287 int mCurPixHei; 288 int mCurPixHei;
288}; 289};
289 290
290#endif // KOAGENDA_H 291#endif // KOAGENDA_H
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 60ae41f..e0a1a21 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -1,1530 +1,1533 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qhbox.h> 24#include <qhbox.h>
25#include <qvbox.h> 25#include <qvbox.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qframe.h> 27#include <qframe.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#ifndef KORG_NOSPLITTER 29#ifndef KORG_NOSPLITTER
30#include <qsplitter.h> 30#include <qsplitter.h>
31#endif 31#endif
32#include <qfont.h> 32#include <qfont.h>
33#include <qfontmetrics.h> 33#include <qfontmetrics.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35#include <qtooltip.h> 35#include <qtooltip.h>
36#include <qpainter.h> 36#include <qpainter.h>
37#include <qpushbutton.h> 37#include <qpushbutton.h>
38#include <qapplication.h> 38#include <qapplication.h>
39 39
40#include <kapplication.h> 40#include <kapplication.h>
41#include <KDGanttMinimizeSplitter.h> 41#include <KDGanttMinimizeSplitter.h>
42#include <kdebug.h> 42#include <kdebug.h>
43#include <kstandarddirs.h> 43#include <kstandarddirs.h>
44#include <kiconloader.h> 44#include <kiconloader.h>
45#include <klocale.h> 45#include <klocale.h>
46#include <kconfig.h> 46#include <kconfig.h>
47#include <kglobal.h> 47#include <kglobal.h>
48#include "calendarview.h" 48#include "calendarview.h"
49#include "koviewmanager.h" 49#include "koviewmanager.h"
50 50
51#include <libkcal/calendar.h> 51#include <libkcal/calendar.h>
52#include <libkcal/icaldrag.h> 52#include <libkcal/icaldrag.h>
53#include <libkcal/dndfactory.h> 53#include <libkcal/dndfactory.h>
54 54
55#include <kcalendarsystem.h> 55#include <kcalendarsystem.h>
56 56
57#include "koglobals.h" 57#include "koglobals.h"
58#ifndef KORG_NOPLUGINS 58#ifndef KORG_NOPLUGINS
59#include "kocore.h" 59#include "kocore.h"
60#endif 60#endif
61#include "koprefs.h" 61#include "koprefs.h"
62#include "koagenda.h" 62#include "koagenda.h"
63#include "koagendaitem.h" 63#include "koagendaitem.h"
64#ifndef KORG_NOPRINTER 64#ifndef KORG_NOPRINTER
65#include "calprinter.h" 65#include "calprinter.h"
66#endif 66#endif
67 67
68#include "koagendaview.h" 68#include "koagendaview.h"
69//#include "koagendaview.moc" 69//#include "koagendaview.moc"
70 70
71//extern bool globalFlagBlockPainting; 71//extern bool globalFlagBlockPainting;
72extern int globalFlagBlockAgenda; 72extern int globalFlagBlockAgenda;
73extern int globalFlagBlockStartup; 73extern int globalFlagBlockStartup;
74extern int globalFlagBlockAgendaItemPaint; 74extern int globalFlagBlockAgendaItemPaint;
75extern int globalFlagBlockAgendaItemUpdate; 75extern int globalFlagBlockAgendaItemUpdate;
76extern int globalFlagBlockLabel; 76extern int globalFlagBlockLabel;
77using namespace KOrg; 77using namespace KOrg;
78 78
79TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : 79TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) :
80 QScrollView(parent,name,f) 80 QScrollView(parent,name,f)
81{ 81{
82 mRows = rows; 82 mRows = rows;
83 83
84 setMinimumHeight( 20 ); 84 setMinimumHeight( 20 );
85 mCellHeight = KOPrefs::instance()->mHourSize*4; 85 mCellHeight = KOPrefs::instance()->mHourSize*4;
86 86
87 enableClipper(true); 87 enableClipper(true);
88 88
89 setHScrollBarMode(AlwaysOff); 89 setHScrollBarMode(AlwaysOff);
90 setVScrollBarMode(AlwaysOff); 90 setVScrollBarMode(AlwaysOff);
91 91
92 resizeContents(50,mRows * mCellHeight); 92 resizeContents(50,mRows * mCellHeight);
93 93
94 viewport()->setBackgroundMode( PaletteBackground ); 94 viewport()->setBackgroundMode( PaletteBackground );
95} 95}
96 96
97void TimeLabels::setCellHeight(int height) 97void TimeLabels::setCellHeight(int height)
98{ 98{
99 mCellHeight = height; 99 mCellHeight = height;
100} 100}
101 101
102/* 102/*
103 Optimization so that only the "dirty" portion of the scroll view 103 Optimization so that only the "dirty" portion of the scroll view
104 is redrawn. Unfortunately, this is not called by default paintEvent() method. 104 is redrawn. Unfortunately, this is not called by default paintEvent() method.
105*/ 105*/
106void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) 106void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
107{ 107{
108 108
109 // if ( globalFlagBlockAgenda ) 109 // if ( globalFlagBlockAgenda )
110 // return; 110 // return;
111 // bug: the parameters cx, cy, cw, ch are the areas that need to be 111 // bug: the parameters cx, cy, cw, ch are the areas that need to be
112 // redrawn, not the area of the widget. unfortunately, this 112 // redrawn, not the area of the widget. unfortunately, this
113 // code assumes the latter... 113 // code assumes the latter...
114 114
115 // now, for a workaround... 115 // now, for a workaround...
116 // these two assignments fix the weird redraw bug 116 // these two assignments fix the weird redraw bug
117 cx = contentsX() + 2; 117 cx = contentsX() + 2;
118 cw = contentsWidth() - 2; 118 cw = contentsWidth() - 2;
119 // end of workaround 119 // end of workaround
120 120
121 int cell = ((int)(cy/mCellHeight)); 121 int cell = ((int)(cy/mCellHeight));
122 int y = cell * mCellHeight; 122 int y = cell * mCellHeight;
123 QFontMetrics fm = fontMetrics(); 123 QFontMetrics fm = fontMetrics();
124 QString hour; 124 QString hour;
125 QString suffix; 125 QString suffix;
126 QString fullTime; 126 QString fullTime;
127 int tW = fm.width("24:00i"); 127 int tW = fm.width("24:00i");
128 128
129 while (y < cy + ch) { 129 while (y < cy + ch) {
130 p->drawLine(cx,y,cx+tW,y); 130 p->drawLine(cx,y,cx+tW,y);
131 hour.setNum(cell); 131 hour.setNum(cell);
132 suffix = "am"; 132 suffix = "am";
133 133
134 // handle 24h and am/pm time formats 134 // handle 24h and am/pm time formats
135 if (KGlobal::locale()->use12Clock()) { 135 if (KGlobal::locale()->use12Clock()) {
136 if (cell > 11) suffix = "pm"; 136 if (cell > 11) suffix = "pm";
137 if (cell == 0) hour.setNum(12); 137 if (cell == 0) hour.setNum(12);
138 if (cell > 12) hour.setNum(cell - 12); 138 if (cell > 12) hour.setNum(cell - 12);
139 } else { 139 } else {
140 suffix = ":00"; 140 suffix = ":00";
141 } 141 }
142 142
143 // create string in format of "XX:XX" or "XXpm/am" 143 // create string in format of "XX:XX" or "XXpm/am"
144 fullTime = hour + suffix; 144 fullTime = hour + suffix;
145 145
146 // center and draw the time label 146 // center and draw the time label
147 int timeWidth = fm.width(fullTime+"i"); 147 int timeWidth = fm.width(fullTime+"i");
148 int offset = this->width() - timeWidth; 148 int offset = this->width() - timeWidth;
149 int borderWidth = 5; 149 int borderWidth = 5;
150 int timeHeight = fm.height(); 150 int timeHeight = fm.height();
151 timeHeight = timeHeight + 2 - ( timeHeight / 4 ); 151 timeHeight = timeHeight + 2 - ( timeHeight / 4 );
152 p->drawText(cx -borderWidth + offset, y+ timeHeight, fullTime); 152 p->drawText(cx -borderWidth + offset, y+ timeHeight, fullTime);
153 153
154 // increment indices 154 // increment indices
155 y += mCellHeight; 155 y += mCellHeight;
156 cell++; 156 cell++;
157 } 157 }
158} 158}
159 159
160/** 160/**
161 Calculates the minimum width. 161 Calculates the minimum width.
162*/ 162*/
163int TimeLabels::minimumWidth() const 163int TimeLabels::minimumWidth() const
164{ 164{
165 QFontMetrics fm = fontMetrics(); 165 QFontMetrics fm = fontMetrics();
166 166
167 //TODO: calculate this value 167 //TODO: calculate this value
168 int borderWidth = 4; 168 int borderWidth = 4;
169 169
170 // the maximum width possible 170 // the maximum width possible
171 int width = fm.width("88:88x") + borderWidth; 171 int width = fm.width("88:88x") + borderWidth;
172 172
173 return width; 173 return width;
174} 174}
175 175
176/** updates widget's internal state */ 176/** updates widget's internal state */
177void TimeLabels::updateConfig() 177void TimeLabels::updateConfig()
178{ 178{
179 // set the font 179 // set the font
180 // config->setGroup("Fonts"); 180 // config->setGroup("Fonts");
181 // QFont font = config->readFontEntry("TimeBar Font"); 181 // QFont font = config->readFontEntry("TimeBar Font");
182 setFont(KOPrefs::instance()->mTimeBarFont); 182 setFont(KOPrefs::instance()->mTimeBarFont);
183 183
184 // update geometry restrictions based on new settings 184 // update geometry restrictions based on new settings
185 setFixedWidth(minimumWidth()); 185 setFixedWidth(minimumWidth());
186 186
187 // update HourSize 187 // update HourSize
188 mCellHeight = KOPrefs::instance()->mHourSize*4; 188 mCellHeight = KOPrefs::instance()->mHourSize*4;
189 resizeContents(50,mRows * mCellHeight); 189 resizeContents(50,mRows * mCellHeight);
190} 190}
191 191
192/** update time label positions */ 192/** update time label positions */
193void TimeLabels::positionChanged() 193void TimeLabels::positionChanged()
194{ 194{
195 int adjustment = mAgenda->contentsY(); 195 int adjustment = mAgenda->contentsY();
196 setContentsPos(0, adjustment); 196 setContentsPos(0, adjustment);
197} 197}
198 198
199/** */ 199/** */
200void TimeLabels::setAgenda(KOAgenda* agenda) 200void TimeLabels::setAgenda(KOAgenda* agenda)
201{ 201{
202 mAgenda = agenda; 202 mAgenda = agenda;
203} 203}
204 204
205void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) 205void TimeLabels::contentsMousePressEvent ( QMouseEvent * e)
206{ 206{
207 mMouseDownY = e->pos().y(); 207 mMouseDownY = e->pos().y();
208 mOrgCap = topLevelWidget()->caption(); 208 mOrgCap = topLevelWidget()->caption();
209} 209}
210 210
211void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) 211void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e )
212{ 212{
213 int diff = mMouseDownY - e->pos().y(); 213 int diff = mMouseDownY - e->pos().y();
214 if ( diff < 10 && diff > -10 ) 214 if ( diff < 10 && diff > -10 )
215 return; 215 return;
216 int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; 216 int tSize = KOPrefs::instance()->mHourSize + (diff/10) ;
217 if ( tSize < 4 ) 217 if ( tSize < 4 )
218 tSize = 4; 218 tSize = 4;
219 if ( tSize > 22 ) 219 if ( tSize > 22 )
220 tSize = 22; 220 tSize = 22;
221 tSize = (tSize-2)/2; 221 tSize = (tSize-2)/2;
222 topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); 222 topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize));
223 223
224} 224}
225void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) 225void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e )
226{ 226{
227 topLevelWidget()->setCaption( mOrgCap ); 227 topLevelWidget()->setCaption( mOrgCap );
228 int diff = mMouseDownY - e->pos().y(); 228 int diff = mMouseDownY - e->pos().y();
229 if ( diff < 10 && diff > -10 ) 229 if ( diff < 10 && diff > -10 )
230 return; 230 return;
231 int tSize = KOPrefs::instance()->mHourSize + (diff/10); 231 int tSize = KOPrefs::instance()->mHourSize + (diff/10);
232 if ( tSize < 4 ) 232 if ( tSize < 4 )
233 tSize = 4; 233 tSize = 4;
234 if ( tSize > 22 ) 234 if ( tSize > 22 )
235 tSize = 22; 235 tSize = 22;
236 tSize = (tSize/2)*2; 236 tSize = (tSize/2)*2;
237 if ( tSize == KOPrefs::instance()->mHourSize ) 237 if ( tSize == KOPrefs::instance()->mHourSize )
238 return; 238 return;
239 KOPrefs::instance()->mHourSize = tSize; 239 KOPrefs::instance()->mHourSize = tSize;
240 emit scaleChanged(); 240 emit scaleChanged();
241} 241}
242 242
243/** This is called in response to repaint() */ 243/** This is called in response to repaint() */
244void TimeLabels::paintEvent(QPaintEvent*) 244void TimeLabels::paintEvent(QPaintEvent*)
245{ 245{
246 246
247 // kdDebug() << "paintevent..." << endl; 247 // kdDebug() << "paintevent..." << endl;
248 // this is another hack! 248 // this is another hack!
249 // QPainter painter(this); 249 // QPainter painter(this);
250 //QString c 250 //QString c
251 repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); 251 repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight());
252} 252}
253 253
254//////////////////////////////////////////////////////////////////////////// 254////////////////////////////////////////////////////////////////////////////
255 255
256EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) 256EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name)
257 : QFrame(parent,name) 257 : QFrame(parent,name)
258{ 258{
259 mColumns = 1; 259 mColumns = 1;
260 mTopBox = 0; 260 mTopBox = 0;
261 mLocation = loc; 261 mLocation = loc;
262 mTopLayout = 0; 262 mTopLayout = 0;
263 mPaintWidget = 0; 263 mPaintWidget = 0;
264 mXOffset = 0; 264 mXOffset = 0;
265 if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); 265 if (mLocation == Top) mPixmap = SmallIcon("1uparrow");
266 else mPixmap = SmallIcon("1downarrow"); 266 else mPixmap = SmallIcon("1downarrow");
267 mEnabled.resize(mColumns); 267 mEnabled.resize(mColumns);
268 if (mLocation == Top) 268 if (mLocation == Top)
269 setMaximumHeight(0); 269 setMaximumHeight(0);
270 else 270 else
271 setMinimumHeight(mPixmap.height()); 271 setMinimumHeight(mPixmap.height());
272} 272}
273 273
274EventIndicator::~EventIndicator() 274EventIndicator::~EventIndicator()
275{ 275{
276} 276}
277 277
278void EventIndicator::drawContents(QPainter *p) 278void EventIndicator::drawContents(QPainter *p)
279{ 279{
280 280
281 // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; 281 // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl;
282 KDGanttSplitterHandle* han = 0; 282 KDGanttSplitterHandle* han = 0;
283 if ( mPaintWidget ) 283 if ( mPaintWidget )
284 han = mPaintWidget->firstHandle(); 284 han = mPaintWidget->firstHandle();
285 if ( ! han ) { 285 if ( ! han ) {
286 int i; 286 int i;
287 for(i=0;i<mColumns;++i) { 287 for(i=0;i<mColumns;++i) {
288 if (mEnabled[i]) { 288 if (mEnabled[i]) {
289 int cellWidth = contentsRect().right()/mColumns; 289 int cellWidth = contentsRect().right()/mColumns;
290 int xOffset = KOGlobals::self()->reverseLayout() ? 290 int xOffset = KOGlobals::self()->reverseLayout() ?
291 (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : 291 (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 :
292 i*cellWidth + cellWidth/2 -mPixmap.width()/2; 292 i*cellWidth + cellWidth/2 -mPixmap.width()/2;
293 p->drawPixmap(QPoint(xOffset,0),mPixmap); 293 p->drawPixmap(QPoint(xOffset,0),mPixmap);
294 } 294 }
295 } 295 }
296 } else { 296 } else {
297 han->repaint(); 297 han->repaint();
298 //mPaintWidget->setBackgroundColor( red ); 298 //mPaintWidget->setBackgroundColor( red );
299 299
300 QPainter pa( han ); 300 QPainter pa( han );
301 int i; 301 int i;
302 bool setColor = false; 302 bool setColor = false;
303 for(i=0;i<mColumns;++i) { 303 for(i=0;i<mColumns;++i) {
304 if (mEnabled[i]) { 304 if (mEnabled[i]) {
305 setColor = true; 305 setColor = true;
306 306
307 int cellWidth = contentsRect().right()/mColumns; 307 int cellWidth = contentsRect().right()/mColumns;
308 int xOffset = KOGlobals::self()->reverseLayout() ? 308 int xOffset = KOGlobals::self()->reverseLayout() ?
309 (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : 309 (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 :
310 i*cellWidth + cellWidth/2 -mPixmap.width()/2; 310 i*cellWidth + cellWidth/2 -mPixmap.width()/2;
311 pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); 311 pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap);
312 //qDebug("222draw pix %d ",xOffset ); 312 //qDebug("222draw pix %d ",xOffset );
313 313
314 } 314 }
315 315
316 } 316 }
317 pa.end(); 317 pa.end();
318 318
319 } 319 }
320} 320}
321 321
322void EventIndicator::setXOffset( int x ) 322void EventIndicator::setXOffset( int x )
323{ 323{
324 mXOffset = x; 324 mXOffset = x;
325} 325}
326void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) 326void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w )
327{ 327{
328 mPaintWidget = w; 328 mPaintWidget = w;
329} 329}
330void EventIndicator::changeColumns(int columns) 330void EventIndicator::changeColumns(int columns)
331{ 331{
332 mColumns = columns; 332 mColumns = columns;
333 mEnabled.resize(mColumns); 333 mEnabled.resize(mColumns);
334 334
335 update(); 335 update();
336} 336}
337 337
338void EventIndicator::enableColumn(int column, bool enable) 338void EventIndicator::enableColumn(int column, bool enable)
339{ 339{
340 mEnabled[column] = enable; 340 mEnabled[column] = enable;
341} 341}
342 342
343 343
344//////////////////////////////////////////////////////////////////////////// 344////////////////////////////////////////////////////////////////////////////
345//////////////////////////////////////////////////////////////////////////// 345////////////////////////////////////////////////////////////////////////////
346//////////////////////////////////////////////////////////////////////////// 346////////////////////////////////////////////////////////////////////////////
347 347
348KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : 348KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
349 KOEventView (cal,parent,name) 349 KOEventView (cal,parent,name)
350{ 350{
351 mBlockUpdating = true; 351 mBlockUpdating = true;
352 mStartHour = 8; 352 mStartHour = 8;
353 mSelectedDates.append(QDate::currentDate()); 353 mSelectedDates.append(QDate::currentDate());
354 354
355 mLayoutDayLabels = 0; 355 mLayoutDayLabels = 0;
356 mDayLabelsFrame = 0; 356 mDayLabelsFrame = 0;
357 mDayLabels = 0; 357 mDayLabels = 0;
358 bool isRTL = KOGlobals::self()->reverseLayout(); 358 bool isRTL = KOGlobals::self()->reverseLayout();
359 359
360 if ( KOPrefs::instance()->mVerticalScreen ) { 360 if ( KOPrefs::instance()->mVerticalScreen ) {
361 mExpandedPixmap = SmallIcon( "1downarrow" ); 361 mExpandedPixmap = SmallIcon( "1downarrow" );
362 mNotExpandedPixmap = SmallIcon( "1uparrow" ); 362 mNotExpandedPixmap = SmallIcon( "1uparrow" );
363 } else { 363 } else {
364 mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" ); 364 mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" );
365 mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" ); 365 mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" );
366 } 366 }
367 367
368 QBoxLayout *topLayout = new QVBoxLayout(this); 368 QBoxLayout *topLayout = new QVBoxLayout(this);
369 369
370 // Create day name labels for agenda columns 370 // Create day name labels for agenda columns
371 mDayLabelsFrame = new QHBox(this); 371 mDayLabelsFrame = new QHBox(this);
372 topLayout->addWidget(mDayLabelsFrame); 372 topLayout->addWidget(mDayLabelsFrame);
373 mDayLabels = new QFrame (mDayLabelsFrame); 373 mDayLabels = new QFrame (mDayLabelsFrame);
374 mLayoutDayLabels = new QHBoxLayout(mDayLabels); 374 mLayoutDayLabels = new QHBoxLayout(mDayLabels);
375 // Create agenda splitter 375 // Create agenda splitter
376#ifndef KORG_NOSPLITTER 376#ifndef KORG_NOSPLITTER
377 mSplitterAgenda = new QSplitter(Vertical,this); 377 mSplitterAgenda = new QSplitter(Vertical,this);
378 topLayout->addWidget(mSplitterAgenda); 378 topLayout->addWidget(mSplitterAgenda);
379 mSplitterAgenda->setOpaqueResize(); 379 mSplitterAgenda->setOpaqueResize();
380 380
381 mAllDayFrame = new QHBox(mSplitterAgenda); 381 mAllDayFrame = new QHBox(mSplitterAgenda);
382 382
383 QWidget *agendaFrame = new QWidget(mSplitterAgenda); 383 QWidget *agendaFrame = new QWidget(mSplitterAgenda);
384#else 384#else
385#if 0 385#if 0
386 QWidget *mainBox = new QWidget( this ); 386 QWidget *mainBox = new QWidget( this );
387 topLayout->addWidget( mainBox ); 387 topLayout->addWidget( mainBox );
388 QBoxLayout *mainLayout = new QVBoxLayout(mainBox); 388 QBoxLayout *mainLayout = new QVBoxLayout(mainBox);
389 mAllDayFrame = new QHBox(mainBox); 389 mAllDayFrame = new QHBox(mainBox);
390 mainLayout->addWidget(mAllDayFrame); 390 mainLayout->addWidget(mAllDayFrame);
391 mainLayout->setStretchFactor( mAllDayFrame, 0 ); 391 mainLayout->setStretchFactor( mAllDayFrame, 0 );
392 mAllDayFrame->setFocusPolicy(NoFocus); 392 mAllDayFrame->setFocusPolicy(NoFocus);
393 QWidget *agendaFrame = new QWidget(mainBox); 393 QWidget *agendaFrame = new QWidget(mainBox);
394 mainLayout->addWidget(agendaFrame); 394 mainLayout->addWidget(agendaFrame);
395 mainLayout->setStretchFactor( agendaFrame, 10 ); 395 mainLayout->setStretchFactor( agendaFrame, 10 );
396 396
397 agendaFrame->setFocusPolicy(NoFocus); 397 agendaFrame->setFocusPolicy(NoFocus);
398#endif 398#endif
399 mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); 399 mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this);
400 mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 400 mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
401 topLayout->addWidget( mSplitterAgenda ); 401 topLayout->addWidget( mSplitterAgenda );
402 mAllDayFrame = new QHBox(mSplitterAgenda); 402 mAllDayFrame = new QHBox(mSplitterAgenda);
403 mAllDayFrame->setFocusPolicy(NoFocus); 403 mAllDayFrame->setFocusPolicy(NoFocus);
404 QWidget *agendaFrame = new QWidget(mSplitterAgenda); 404 QWidget *agendaFrame = new QWidget(mSplitterAgenda);
405 agendaFrame->setFocusPolicy(NoFocus); 405 agendaFrame->setFocusPolicy(NoFocus);
406 406
407#endif 407#endif
408 408
409 // Create all-day agenda widget 409 // Create all-day agenda widget
410 mDummyAllDayLeft = new QVBox( mAllDayFrame ); 410 mDummyAllDayLeft = new QVBox( mAllDayFrame );
411 411
412 mExpandButton = new QPushButton(mDummyAllDayLeft); 412 mExpandButton = new QPushButton(mDummyAllDayLeft);
413 mExpandButton->setPixmap( mNotExpandedPixmap ); 413 mExpandButton->setPixmap( mNotExpandedPixmap );
414 int widebut = mExpandButton->sizeHint().width(); 414 int widebut = mExpandButton->sizeHint().width();
415 if ( QApplication::desktop()->width() < 480 ) 415 if ( QApplication::desktop()->width() < 480 )
416 widebut = widebut*2; 416 widebut = widebut*2;
417 else 417 else
418 widebut = (widebut*3) / 2; 418 widebut = (widebut*3) / 2;
419 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, 419 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed,
420 // QSizePolicy::Fixed ) ); 420 // QSizePolicy::Fixed ) );
421 mExpandButton->setFixedSize( widebut, widebut); 421 mExpandButton->setFixedSize( widebut, widebut);
422 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); 422 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) );
423 mExpandButton->setFocusPolicy(NoFocus); 423 mExpandButton->setFocusPolicy(NoFocus);
424 mAllDayAgenda = new KOAgenda(1,mAllDayFrame); 424 mAllDayAgenda = new KOAgenda(1,mAllDayFrame);
425 mAllDayAgenda->setFocusPolicy(NoFocus); 425 mAllDayAgenda->setFocusPolicy(NoFocus);
426 QWidget *dummyAllDayRight = new QWidget(mAllDayFrame); 426 QWidget *dummyAllDayRight = new QWidget(mAllDayFrame);
427 427
428 // Create event context menu for all day agenda 428 // Create event context menu for all day agenda
429 mAllDayAgendaPopup = eventPopup(); 429 mAllDayAgendaPopup = eventPopup();
430 connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), 430 connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
431 mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); 431 mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
432 432
433 // Create agenda frame 433 // Create agenda frame
434 QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); 434 QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3);
435 // QHBox *agendaFrame = new QHBox(splitterAgenda); 435 // QHBox *agendaFrame = new QHBox(splitterAgenda);
436 436
437 // create event indicator bars 437 // create event indicator bars
438 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); 438 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame);
439 agendaLayout->addWidget(mEventIndicatorTop,0,1); 439 agendaLayout->addWidget(mEventIndicatorTop,0,1);
440 mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); 440 mEventIndicatorTop->setPaintWidget( mSplitterAgenda );
441 mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, 441 mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom,
442 agendaFrame); 442 agendaFrame);
443 agendaLayout->addWidget(mEventIndicatorBottom,2,1); 443 agendaLayout->addWidget(mEventIndicatorBottom,2,1);
444 QWidget *dummyAgendaRight = new QWidget(agendaFrame); 444 QWidget *dummyAgendaRight = new QWidget(agendaFrame);
445 agendaLayout->addWidget(dummyAgendaRight,0,2); 445 agendaLayout->addWidget(dummyAgendaRight,0,2);
446 446
447 // Create time labels 447 // Create time labels
448 mTimeLabels = new TimeLabels(24,agendaFrame); 448 mTimeLabels = new TimeLabels(24,agendaFrame);
449 agendaLayout->addWidget(mTimeLabels,1,0); 449 agendaLayout->addWidget(mTimeLabels,1,0);
450 connect(mTimeLabels,SIGNAL( scaleChanged()), 450 connect(mTimeLabels,SIGNAL( scaleChanged()),
451 this,SLOT(updateConfig())); 451 this,SLOT(updateConfig()));
452 452
453 // Create agenda 453 // Create agenda
454 mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); 454 mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame);
455 agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); 455 agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2);
456 agendaLayout->setColStretch(1,1); 456 agendaLayout->setColStretch(1,1);
457 mAgenda->setFocusPolicy(NoFocus); 457 mAgenda->setFocusPolicy(NoFocus);
458 // Create event context menu for agenda 458 // Create event context menu for agenda
459 mAgendaPopup = eventPopup(); 459 mAgendaPopup = eventPopup();
460 460
461 mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), 461 mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")),
462 i18n("Toggle Alarm"),mAgenda, 462 i18n("Toggle Alarm"),mAgenda,
463 SLOT(popupAlarm()),true); 463 SLOT(popupAlarm()),true);
464 464
465 465
466 connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), 466 connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
467 mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); 467 mAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
468 468
469 // make connections between dependent widgets 469 // make connections between dependent widgets
470 mTimeLabels->setAgenda(mAgenda); 470 mTimeLabels->setAgenda(mAgenda);
471 471
472 // Update widgets to reflect user preferences 472 // Update widgets to reflect user preferences
473 // updateConfig(); 473 // updateConfig();
474 474
475 // createDayLabels(); 475 // createDayLabels();
476 476
477 // these blank widgets make the All Day Event box line up with the agenda 477 // these blank widgets make the All Day Event box line up with the agenda
478 dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); 478 dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width());
479 dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); 479 dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width());
480 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); 480 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width());
481 481
482 // Scrolling 482 // Scrolling
483 connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), 483 connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)),
484 mTimeLabels, SLOT(positionChanged())); 484 mTimeLabels, SLOT(positionChanged()));
485 connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), 485 connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)),
486 SLOT(setContentsPos(int))); 486 SLOT(setContentsPos(int)));
487 487
488 connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate )));
489 connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate )));
490
488 // Create/Show/Edit/Delete Event 491 // Create/Show/Edit/Delete Event
489 connect(mAgenda,SIGNAL(newEventSignal(int,int)), 492 connect(mAgenda,SIGNAL(newEventSignal(int,int)),
490 SLOT(newEvent(int,int))); 493 SLOT(newEvent(int,int)));
491 connect(mAgenda,SIGNAL(newTodoSignal(int,int)), 494 connect(mAgenda,SIGNAL(newTodoSignal(int,int)),
492 SLOT(newTodo(int,int))); 495 SLOT(newTodo(int,int)));
493 connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), 496 connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)),
494 SLOT(newEvent(int,int,int,int))); 497 SLOT(newEvent(int,int,int,int)));
495 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), 498 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)),
496 SLOT(newEventAllDay(int,int))); 499 SLOT(newEventAllDay(int,int)));
497 connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), 500 connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)),
498 SLOT(newTodoAllDay(int,int))); 501 SLOT(newTodoAllDay(int,int)));
499 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), 502 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)),
500 SLOT(newEventAllDay(int,int))); 503 SLOT(newEventAllDay(int,int)));
501 connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), 504 connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)),
502 SLOT(newTimeSpanSelected(int,int,int,int))); 505 SLOT(newTimeSpanSelected(int,int,int,int)));
503 connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), 506 connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)),
504 SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); 507 SLOT(newTimeSpanSelectedAllDay(int,int,int,int)));
505 connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); 508 connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView()));
506 connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); 509 connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView()));
507 510
508 connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), 511 connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)),
509 SIGNAL(editIncidenceSignal(Incidence *))); 512 SIGNAL(editIncidenceSignal(Incidence *)));
510 connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), 513 connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)),
511 SIGNAL(editIncidenceSignal(Incidence *))); 514 SIGNAL(editIncidenceSignal(Incidence *)));
512 connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), 515 connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)),
513 SIGNAL(showIncidenceSignal(Incidence *))); 516 SIGNAL(showIncidenceSignal(Incidence *)));
514 connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), 517 connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)),
515 SIGNAL(showIncidenceSignal(Incidence *))); 518 SIGNAL(showIncidenceSignal(Incidence *)));
516 connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), 519 connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)),
517 SIGNAL(deleteIncidenceSignal(Incidence *))); 520 SIGNAL(deleteIncidenceSignal(Incidence *)));
518 connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), 521 connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)),
519 SIGNAL(deleteIncidenceSignal(Incidence *))); 522 SIGNAL(deleteIncidenceSignal(Incidence *)));
520 523
521 connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), 524 connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )),
522 SLOT(updateEventDates(KOAgendaItem *, int ))); 525 SLOT(updateEventDates(KOAgendaItem *, int )));
523 connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), 526 connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )),
524 SLOT(updateEventDates(KOAgendaItem *, int))); 527 SLOT(updateEventDates(KOAgendaItem *, int)));
525 528
526 // event indicator update 529 // event indicator update
527 connect(mAgenda,SIGNAL(lowerYChanged(int)), 530 connect(mAgenda,SIGNAL(lowerYChanged(int)),
528 SLOT(updateEventIndicatorTop(int))); 531 SLOT(updateEventIndicatorTop(int)));
529 connect(mAgenda,SIGNAL(upperYChanged(int)), 532 connect(mAgenda,SIGNAL(upperYChanged(int)),
530 SLOT(updateEventIndicatorBottom(int))); 533 SLOT(updateEventIndicatorBottom(int)));
531 // drag signals 534 // drag signals
532 /* 535 /*
533 connect(mAgenda,SIGNAL(startDragSignal(Event *)), 536 connect(mAgenda,SIGNAL(startDragSignal(Event *)),
534 SLOT(startDrag(Event *))); 537 SLOT(startDrag(Event *)));
535 connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), 538 connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)),
536 SLOT(startDrag(Event *))); 539 SLOT(startDrag(Event *)));
537 */ 540 */
538 // synchronize selections 541 // synchronize selections
539 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 542 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
540 mAllDayAgenda, SLOT( deselectItem() ) ); 543 mAllDayAgenda, SLOT( deselectItem() ) );
541 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 544 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
542 mAgenda, SLOT( deselectItem() ) ); 545 mAgenda, SLOT( deselectItem() ) );
543 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 546 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
544 SIGNAL( incidenceSelected( Incidence * ) ) ); 547 SIGNAL( incidenceSelected( Incidence * ) ) );
545 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 548 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
546 SIGNAL( incidenceSelected( Incidence * ) ) ); 549 SIGNAL( incidenceSelected( Incidence * ) ) );
547 connect( mAgenda, SIGNAL( resizedSignal() ), 550 connect( mAgenda, SIGNAL( resizedSignal() ),
548 SLOT( updateConfig( ) ) ); 551 SLOT( updateConfig( ) ) );
549 connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), 552 connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ),
550 SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); 553 SLOT( addToCalSlot(Incidence *, Incidence * ) ) );
551 connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), 554 connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ),
552 SLOT( addToCalSlot(Incidence * , Incidence *) ) ); 555 SLOT( addToCalSlot(Incidence * , Incidence *) ) );
553 // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); 556 // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
554 //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); 557 //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
555 558
556 559
557} 560}
558 561
559void KOAgendaView::toggleAllDay() 562void KOAgendaView::toggleAllDay()
560{ 563{
561 if ( mSplitterAgenda->firstHandle() ) 564 if ( mSplitterAgenda->firstHandle() )
562 mSplitterAgenda->firstHandle()->toggle(); 565 mSplitterAgenda->firstHandle()->toggle();
563} 566}
564void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) 567void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld )
565{ 568{
566 calendar()->addIncidence( inc ); 569 calendar()->addIncidence( inc );
567 570
568 if ( incOld ) { 571 if ( incOld ) {
569 if ( incOld->type() == "Todo" ) 572 if ( incOld->type() == "Todo" )
570 emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); 573 emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED );
571 else 574 else
572 emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); 575 emit incidenceChanged(incOld, KOGlobals::EVENTEDITED);
573 } 576 }
574 577
575} 578}
576 579
577KOAgendaView::~KOAgendaView() 580KOAgendaView::~KOAgendaView()
578{ 581{
579 delete mAgendaPopup; 582 delete mAgendaPopup;
580 delete mAllDayAgendaPopup; 583 delete mAllDayAgendaPopup;
581 delete KOAgendaItem::paintPix(); 584 delete KOAgendaItem::paintPix();
582 delete KOAgendaItem::paintPixSel(); 585 delete KOAgendaItem::paintPixSel();
583} 586}
584void KOAgendaView::resizeEvent( QResizeEvent* e ) 587void KOAgendaView::resizeEvent( QResizeEvent* e )
585{ 588{
586 //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); 589 //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width());
587 bool uc = false; 590 bool uc = false;
588 int ow = e->oldSize().width(); 591 int ow = e->oldSize().width();
589 int oh = e->oldSize().height(); 592 int oh = e->oldSize().height();
590 int w = e->size().width(); 593 int w = e->size().width();
591 int h = e->size().height(); 594 int h = e->size().height();
592 if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { 595 if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) {
593 if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) 596 if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda )
594 uc = true; 597 uc = true;
595 //qDebug("view changed %d %d %d %d ", ow, oh , w , h); 598 //qDebug("view changed %d %d %d %d ", ow, oh , w , h);
596 } 599 }
597 mUpcomingWidth = e->size().width() ; 600 mUpcomingWidth = e->size().width() ;
598 if ( mBlockUpdating || uc ) { 601 if ( mBlockUpdating || uc ) {
599 mBlockUpdating = false; 602 mBlockUpdating = false;
600 //mAgenda->setMinimumSize(800 , 600 ); 603 //mAgenda->setMinimumSize(800 , 600 );
601 //qDebug("mAgenda->resize+++++++++++++++ "); 604 //qDebug("mAgenda->resize+++++++++++++++ ");
602 updateConfig(); 605 updateConfig();
603 //qDebug("KOAgendaView::Updating now possible "); 606 //qDebug("KOAgendaView::Updating now possible ");
604 } else 607 } else
605 createDayLabels(); 608 createDayLabels();
606 //qDebug("resizeEvent end "); 609 //qDebug("resizeEvent end ");
607 610
608} 611}
609void KOAgendaView::createDayLabels() 612void KOAgendaView::createDayLabels()
610{ 613{
611 614
612 if ( mBlockUpdating || globalFlagBlockLabel == 1) { 615 if ( mBlockUpdating || globalFlagBlockLabel == 1) {
613 // qDebug(" KOAgendaView::createDayLabels() blocked "); 616 // qDebug(" KOAgendaView::createDayLabels() blocked ");
614 return; 617 return;
615 618
616 } 619 }
617 int newHight; 620 int newHight;
618 621
619 // ### Before deleting and recreating we could check if mSelectedDates changed... 622 // ### Before deleting and recreating we could check if mSelectedDates changed...
620 // It would remove some flickering and gain speed (since this is called by 623 // It would remove some flickering and gain speed (since this is called by
621 // each updateView() call) 624 // each updateView() call)
622 625
623 int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2; 626 int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2;
624 mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); 627 mDayLabelsFrame->setMaximumWidth( mUpcomingWidth );
625 if ( maxWid < 0 ) 628 if ( maxWid < 0 )
626 maxWid = 20; 629 maxWid = 20;
627 630
628 QFont dlf = KOPrefs::instance()->mTimeLabelsFont; 631 QFont dlf = KOPrefs::instance()->mTimeLabelsFont;
629 QFontMetrics fm ( dlf ); 632 QFontMetrics fm ( dlf );
630 int selCount = mSelectedDates.count(); 633 int selCount = mSelectedDates.count();
631 QString dayTest = "Mon 20"; 634 QString dayTest = "Mon 20";
632 int wid = fm.width( dayTest ); 635 int wid = fm.width( dayTest );
633 maxWid -= ( selCount * 3 ); 636 maxWid -= ( selCount * 3 );
634 if ( maxWid < 0 ) 637 if ( maxWid < 0 )
635 maxWid = 20; 638 maxWid = 20;
636 int needWid = wid * selCount; 639 int needWid = wid * selCount;
637 //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); 640 //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid );
638 //if ( needWid > maxWid ) 641 //if ( needWid > maxWid )
639 // qDebug("DAYLABELS TOOOOOOO BIG "); 642 // qDebug("DAYLABELS TOOOOOOO BIG ");
640 while ( needWid > maxWid ) { 643 while ( needWid > maxWid ) {
641 dayTest = dayTest.left( dayTest.length() - 1 ); 644 dayTest = dayTest.left( dayTest.length() - 1 );
642 wid = fm.width( dayTest ); 645 wid = fm.width( dayTest );
643 needWid = wid * selCount; 646 needWid = wid * selCount;
644 } 647 }
645 int maxLen = dayTest.length(); 648 int maxLen = dayTest.length();
646 int fontPoint = dlf.pointSize(); 649 int fontPoint = dlf.pointSize();
647 if ( maxLen < 2 ) { 650 if ( maxLen < 2 ) {
648 int fontPoint = dlf.pointSize(); 651 int fontPoint = dlf.pointSize();
649 while ( fontPoint > 4 ) { 652 while ( fontPoint > 4 ) {
650 --fontPoint; 653 --fontPoint;
651 dlf.setPointSize( fontPoint ); 654 dlf.setPointSize( fontPoint );
652 QFontMetrics f( dlf ); 655 QFontMetrics f( dlf );
653 wid = f.width( "20" ); 656 wid = f.width( "20" );
654 needWid = wid * selCount; 657 needWid = wid * selCount;
655 if ( needWid < maxWid ) 658 if ( needWid < maxWid )
656 break; 659 break;
657 } 660 }
658 maxLen = 2; 661 maxLen = 2;
659 } 662 }
660 //qDebug("Max len %d ", dayTest.length() ); 663 //qDebug("Max len %d ", dayTest.length() );
661 664
662 QFontMetrics tempF( dlf ); 665 QFontMetrics tempF( dlf );
663 newHight = tempF.height(); 666 newHight = tempF.height();
664 mDayLabels->setFont( dlf ); 667 mDayLabels->setFont( dlf );
665 // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; 668 // mLayoutDayLabels = new QHBoxLayout(mDayLabels);;
666 // mLayoutDayLabels->addSpacing(mTimeLabels->width()); 669 // mLayoutDayLabels->addSpacing(mTimeLabels->width());
667 //mLayoutDayLabels->addSpacing( 2 ); 670 //mLayoutDayLabels->addSpacing( 2 );
668 // QFont lFont = dlf; 671 // QFont lFont = dlf;
669 bool appendLabels = false; 672 bool appendLabels = false;
670 QLabel *dayLabel; 673 QLabel *dayLabel;
671 dayLabel = mDayLabelsList.first(); 674 dayLabel = mDayLabelsList.first();
672 if ( !dayLabel ) { 675 if ( !dayLabel ) {
673 appendLabels = true; 676 appendLabels = true;
674 dayLabel = new QLabel(mDayLabels); 677 dayLabel = new QLabel(mDayLabels);
675 mDayLabelsList.append( dayLabel ); 678 mDayLabelsList.append( dayLabel );
676 mLayoutDayLabels->addWidget(dayLabel); 679 mLayoutDayLabels->addWidget(dayLabel);
677 } 680 }
678 dayLabel->setFixedWidth( mTimeLabels->width()+2 ); 681 dayLabel->setFixedWidth( mTimeLabels->width()+2 );
679 dayLabel->setFont( dlf ); 682 dayLabel->setFont( dlf );
680 dayLabel->setAlignment(QLabel::AlignHCenter); 683 dayLabel->setAlignment(QLabel::AlignHCenter);
681 dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); 684 dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) );
682 dayLabel->show(); 685 dayLabel->show();
683 DateList::ConstIterator dit; 686 DateList::ConstIterator dit;
684 bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); 687 bool oneday = (mSelectedDates.first() == mSelectedDates.last() );
685 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { 688 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) {
686 QDate date = *dit; 689 QDate date = *dit;
687 // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); 690 // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels);
688 if ( ! appendLabels ) { 691 if ( ! appendLabels ) {
689 dayLabel = mDayLabelsList.next(); 692 dayLabel = mDayLabelsList.next();
690 if ( !dayLabel ) 693 if ( !dayLabel )
691 appendLabels = true; 694 appendLabels = true;
692 } 695 }
693 if ( appendLabels ) { 696 if ( appendLabels ) {
694 dayLabel = new QLabel(mDayLabels); 697 dayLabel = new QLabel(mDayLabels);
695 mDayLabelsList.append( dayLabel ); 698 mDayLabelsList.append( dayLabel );
696 mLayoutDayLabels->addWidget(dayLabel); 699 mLayoutDayLabels->addWidget(dayLabel);
697 } 700 }
698 dayLabel->setMinimumWidth( 1 ); 701 dayLabel->setMinimumWidth( 1 );
699 dayLabel->setMaximumWidth( 2048 ); 702 dayLabel->setMaximumWidth( 2048 );
700 dayLabel->setFont( dlf ); 703 dayLabel->setFont( dlf );
701 dayLabel->show(); 704 dayLabel->show();
702 QString str; 705 QString str;
703 int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); 706 int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date);
704 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); 707 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true );
705 switch ( maxLen ) { 708 switch ( maxLen ) {
706 case 2: 709 case 2:
707 str = QString::number( date.day() ); 710 str = QString::number( date.day() );
708 break; 711 break;
709 712
710 case 3: 713 case 3:
711 str = dayName.left( 1 ) +QString::number( date.day()); 714 str = dayName.left( 1 ) +QString::number( date.day());
712 715
713 break; 716 break;
714 case 4: 717 case 4:
715 str = dayName.left( 1 ) + " " +QString::number( date.day()); 718 str = dayName.left( 1 ) + " " +QString::number( date.day());
716 719
717 break; 720 break;
718 case 5: 721 case 5:
719 str = dayName.left( 2 ) + " " +QString::number( date.day()); 722 str = dayName.left( 2 ) + " " +QString::number( date.day());
720 723
721 break; 724 break;
722 case 6: 725 case 6:
723 str = dayName.left( 3 ) + " " +QString::number( date.day()); 726 str = dayName.left( 3 ) + " " +QString::number( date.day());
724 break; 727 break;
725 728
726 default: 729 default:
727 break; 730 break;
728 } 731 }
729 if ( oneday ) { 732 if ( oneday ) {
730 QString addString; 733 QString addString;
731 if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) 734 if ( mSelectedDates.first() == QDateTime::currentDateTime().date() )
732 addString = i18n("Today"); 735 addString = i18n("Today");
733 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) 736 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) )
734 addString = i18n("Tomorrow"); 737 addString = i18n("Tomorrow");
735 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) 738 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) )
736 addString = i18n("Yesterday"); 739 addString = i18n("Yesterday");
737 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) 740 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) )
738 addString = i18n("Day before yesterday"); 741 addString = i18n("Day before yesterday");
739 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) 742 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) )
740 addString = i18n("Day after tomorrow"); 743 addString = i18n("Day after tomorrow");
741 if ( !addString.isEmpty() ) { 744 if ( !addString.isEmpty() ) {
742 str = addString+", " + str; 745 str = addString+", " + str;
743 } 746 }
744 } 747 }
745 dayLabel->setText(str); 748 dayLabel->setText(str);
746 dayLabel->setAlignment(QLabel::AlignHCenter); 749 dayLabel->setAlignment(QLabel::AlignHCenter);
747 if (date == QDate::currentDate()) { 750 if (date == QDate::currentDate()) {
748 QFont bFont = dlf; 751 QFont bFont = dlf;
749 bFont.setBold( true ); 752 bFont.setBold( true );
750 dayLabel->setFont(bFont); 753 dayLabel->setFont(bFont);
751 } 754 }
752 //dayLayout->addWidget(dayLabel); 755 //dayLayout->addWidget(dayLabel);
753 756
754#ifndef KORG_NOPLUGINS 757#ifndef KORG_NOPLUGINS
755 CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); 758 CalendarDecoration::List cds = KOCore::self()->calendarDecorations();
756 CalendarDecoration *it; 759 CalendarDecoration *it;
757 for(it = cds.first(); it; it = cds.next()) { 760 for(it = cds.first(); it; it = cds.next()) {
758 QString text = it->shortText( date ); 761 QString text = it->shortText( date );
759 if ( !text.isEmpty() ) { 762 if ( !text.isEmpty() ) {
760 QLabel *label = new QLabel(text,mDayLabels); 763 QLabel *label = new QLabel(text,mDayLabels);
761 label->setAlignment(AlignCenter); 764 label->setAlignment(AlignCenter);
762 dayLayout->addWidget(label); 765 dayLayout->addWidget(label);
763 } 766 }
764 } 767 }
765 768
766 for(it = cds.first(); it; it = cds.next()) { 769 for(it = cds.first(); it; it = cds.next()) {
767 QWidget *wid = it->smallWidget(mDayLabels,date); 770 QWidget *wid = it->smallWidget(mDayLabels,date);
768 if ( wid ) { 771 if ( wid ) {
769 // wid->setHeight(20); 772 // wid->setHeight(20);
770 dayLayout->addWidget(wid); 773 dayLayout->addWidget(wid);
771 } 774 }
772 } 775 }
773#endif 776#endif
774 } 777 }
775 if ( ! appendLabels ) { 778 if ( ! appendLabels ) {
776 dayLabel = mDayLabelsList.next(); 779 dayLabel = mDayLabelsList.next();
777 if ( !dayLabel ) 780 if ( !dayLabel )
778 appendLabels = true; 781 appendLabels = true;
779 } 782 }
780 if ( appendLabels ) { 783 if ( appendLabels ) {
781 dayLabel = new QLabel(mDayLabels); 784 dayLabel = new QLabel(mDayLabels);
782 mDayLabelsList.append( dayLabel ); 785 mDayLabelsList.append( dayLabel );
783 mLayoutDayLabels->addWidget(dayLabel); 786 mLayoutDayLabels->addWidget(dayLabel);
784 } 787 }
785 //dayLabel->hide();//test only 788 //dayLabel->hide();//test only
786 789
787 int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; 790 int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ;
788 if ( offset < 0 ) offset = 0; 791 if ( offset < 0 ) offset = 0;
789 //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); 792 //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 );
790 dayLabel->setText("");//QString::number ( mSelectedDates.first().month() ) ); 793 dayLabel->setText("");//QString::number ( mSelectedDates.first().month() ) );
791 dayLabel->show(); 794 dayLabel->show();
792 dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); 795 dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset );
793 //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2); 796 //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2);
794 //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); 797 //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2);
795 if ( !appendLabels ) { 798 if ( !appendLabels ) {
796 dayLabel = mDayLabelsList.next(); 799 dayLabel = mDayLabelsList.next();
797 while ( dayLabel ) { 800 while ( dayLabel ) {
798 //qDebug("!dayLabel %d",dayLabel ); 801 //qDebug("!dayLabel %d",dayLabel );
799 dayLabel->hide(); 802 dayLabel->hide();
800 dayLabel = mDayLabelsList.next(); 803 dayLabel = mDayLabelsList.next();
801 } 804 }
802 } 805 }
803 //mDayLabelsFrame->show(); 806 //mDayLabelsFrame->show();
804 //mDayLabels->show(); 807 //mDayLabels->show();
805 //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight); 808 //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight);
806 //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight ); 809 //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight );
807 mDayLabelsFrame->setFixedHeight( newHight ); 810 mDayLabelsFrame->setFixedHeight( newHight );
808} 811}
809 812
810int KOAgendaView::maxDatesHint() 813int KOAgendaView::maxDatesHint()
811{ 814{
812 // Not sure about the max number of events, so return 0 for now. 815 // Not sure about the max number of events, so return 0 for now.
813 return 0; 816 return 0;
814} 817}
815 818
816int KOAgendaView::currentDateCount() 819int KOAgendaView::currentDateCount()
817{ 820{
818 return mSelectedDates.count(); 821 return mSelectedDates.count();
819} 822}
820 823
821QPtrList<Incidence> KOAgendaView::selectedIncidences() 824QPtrList<Incidence> KOAgendaView::selectedIncidences()
822{ 825{
823 QPtrList<Incidence> selected; 826 QPtrList<Incidence> selected;
824 Incidence *incidence; 827 Incidence *incidence;
825 828
826 incidence = mAgenda->selectedIncidence(); 829 incidence = mAgenda->selectedIncidence();
827 if (incidence) selected.append(incidence); 830 if (incidence) selected.append(incidence);
828 831
829 incidence = mAllDayAgenda->selectedIncidence(); 832 incidence = mAllDayAgenda->selectedIncidence();
830 if (incidence) selected.append(incidence); 833 if (incidence) selected.append(incidence);
831 834
832 return selected; 835 return selected;
833} 836}
834 837
835DateList KOAgendaView::selectedDates() 838DateList KOAgendaView::selectedDates()
836{ 839{
837 DateList selected; 840 DateList selected;
838 QDate qd; 841 QDate qd;
839 842
840 qd = mAgenda->selectedIncidenceDate(); 843 qd = mAgenda->selectedIncidenceDate();
841 if (qd.isValid()) selected.append(qd); 844 if (qd.isValid()) selected.append(qd);
842 845
843 qd = mAllDayAgenda->selectedIncidenceDate(); 846 qd = mAllDayAgenda->selectedIncidenceDate();
844 if (qd.isValid()) selected.append(qd); 847 if (qd.isValid()) selected.append(qd);
845 848
846 return selected; 849 return selected;
847} 850}
848 851
849 852
850void KOAgendaView::updateView() 853void KOAgendaView::updateView()
851{ 854{
852 if ( mBlockUpdating ) 855 if ( mBlockUpdating )
853 return; 856 return;
854 // kdDebug() << "KOAgendaView::updateView()" << endl; 857 // kdDebug() << "KOAgendaView::updateView()" << endl;
855 fillAgenda(); 858 fillAgenda();
856 859
857} 860}
858 861
859 862
860/* 863/*
861 Update configuration settings for the agenda view. This method is not 864 Update configuration settings for the agenda view. This method is not
862 complete. 865 complete.
863*/ 866*/
864void KOAgendaView::updateConfig() 867void KOAgendaView::updateConfig()
865{ 868{
866 if ( mBlockUpdating ) 869 if ( mBlockUpdating )
867 return; 870 return;
868 // kdDebug() << "KOAgendaView::updateConfig()" << endl; 871 // kdDebug() << "KOAgendaView::updateConfig()" << endl;
869 872
870 // update config for children 873 // update config for children
871 mTimeLabels->updateConfig(); 874 mTimeLabels->updateConfig();
872 mAgenda->storePosition(); 875 mAgenda->storePosition();
873 mAgenda->updateConfig(); 876 mAgenda->updateConfig();
874 mAllDayAgenda->updateConfig(); 877 mAllDayAgenda->updateConfig();
875 // widget synchronization 878 // widget synchronization
876 //TODO: find a better way, maybe signal/slot 879 //TODO: find a better way, maybe signal/slot
877 mTimeLabels->positionChanged(); 880 mTimeLabels->positionChanged();
878 881
879 // for some reason, this needs to be called explicitly 882 // for some reason, this needs to be called explicitly
880 mTimeLabels->repaint(); 883 mTimeLabels->repaint();
881 884
882 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); 885 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width());
883 886
884 // ToolTips displaying summary of events 887 // ToolTips displaying summary of events
885 KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() 888 KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance()
886 ->mEnableToolTips); 889 ->mEnableToolTips);
887 890
888 //setHolidayMasks(); 891 //setHolidayMasks();
889 892
890 //createDayLabels(); called by via updateView(); 893 //createDayLabels(); called by via updateView();
891 mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); 894 mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth());
892 updateView(); 895 updateView();
893 mAgenda->restorePosition(); 896 mAgenda->restorePosition();
894} 897}
895 898
896 899
897void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) 900void KOAgendaView::updateEventDates(KOAgendaItem *item, int type)
898{ 901{
899 // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; 902 // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl;
900 //qDebug("KOAgendaView::updateEventDates "); 903 //qDebug("KOAgendaView::updateEventDates ");
901 QDateTime startDt,endDt; 904 QDateTime startDt,endDt;
902 QDate startDate; 905 QDate startDate;
903 int lenInSecs; 906 int lenInSecs;
904 // if ( type == KOAgenda::RESIZETOP ) 907 // if ( type == KOAgenda::RESIZETOP )
905 // qDebug("RESIZETOP "); 908 // qDebug("RESIZETOP ");
906 // if ( type == KOAgenda::RESIZEBOTTOM ) 909 // if ( type == KOAgenda::RESIZEBOTTOM )
907 // qDebug("RESIZEBOTTOM "); 910 // qDebug("RESIZEBOTTOM ");
908 // if ( type == KOAgenda::MOVE ) 911 // if ( type == KOAgenda::MOVE )
909 // qDebug("MOVE "); 912 // qDebug("MOVE ");
910 if ( item->incidence()->type() == "Event" ) { 913 if ( item->incidence()->type() == "Event" ) {
911 startDt =item->incidence()->dtStart(); 914 startDt =item->incidence()->dtStart();
912 endDt = item->incidence()->dtEnd(); 915 endDt = item->incidence()->dtEnd();
913 lenInSecs = startDt.secsTo( endDt ); 916 lenInSecs = startDt.secsTo( endDt );
914 } 917 }
915 918
916 // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); 919 // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED );
917 920
918 if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { 921 if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) {
919 startDate = mSelectedDates[item->mLastMoveXPos]; 922 startDate = mSelectedDates[item->mLastMoveXPos];
920 } else { 923 } else {
921 if (item->cellX() < 0) { 924 if (item->cellX() < 0) {
922 startDate = (mSelectedDates.first()).addDays(item->cellX()); 925 startDate = (mSelectedDates.first()).addDays(item->cellX());
923 } else { 926 } else {
924 startDate = mSelectedDates[item->cellX()]; 927 startDate = mSelectedDates[item->cellX()];
925 } 928 }
926 } 929 }
927 startDt.setDate(startDate); 930 startDt.setDate(startDate);
928 931
929 if (item->incidence()->doesFloat()) { 932 if (item->incidence()->doesFloat()) {
930 endDt.setDate(startDate.addDays(item->cellWidth() - 1)); 933 endDt.setDate(startDate.addDays(item->cellWidth() - 1));
931 } else { 934 } else {
932 if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) 935 if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE )
933 startDt.setTime(mAgenda->gyToTime(item->cellYTop())); 936 startDt.setTime(mAgenda->gyToTime(item->cellYTop()));
934 if ( item->incidence()->type() == "Event" ) { 937 if ( item->incidence()->type() == "Event" ) {
935 if ( type == KOAgenda::MOVE ) { 938 if ( type == KOAgenda::MOVE ) {
936 endDt = startDt.addSecs(lenInSecs); 939 endDt = startDt.addSecs(lenInSecs);
937 940
938 } else if ( type == KOAgenda::RESIZEBOTTOM ) { 941 } else if ( type == KOAgenda::RESIZEBOTTOM ) {
939 if (item->lastMultiItem()) { 942 if (item->lastMultiItem()) {
940 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); 943 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1));
941 endDt.setDate(startDate. 944 endDt.setDate(startDate.
942 addDays(item->lastMultiItem()->cellX() - item->cellX())); 945 addDays(item->lastMultiItem()->cellX() - item->cellX()));
943 } else { 946 } else {
944 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); 947 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1));
945 endDt.setDate(startDate); 948 endDt.setDate(startDate);
946 } 949 }
947 } 950 }
948 } else { 951 } else {
949 // todo 952 // todo
950 if (item->lastMultiItem()) { 953 if (item->lastMultiItem()) {
951 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); 954 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1));
952 endDt.setDate(startDate. 955 endDt.setDate(startDate.
953 addDays(item->lastMultiItem()->cellX() - item->cellX())); 956 addDays(item->lastMultiItem()->cellX() - item->cellX()));
954 } else { 957 } else {
955 //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); 958 //qDebug("tem->cellYBottom() %d",item->cellYBottom() );
956 if ( item->cellYBottom() > 0 ) 959 if ( item->cellYBottom() > 0 )
957 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); 960 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1));
958 else 961 else
959 endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); 962 endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time());
960 endDt.setDate(startDate); 963 endDt.setDate(startDate);
961 } 964 }
962 } 965 }
963 } 966 }
964 967
965 968
966 if ( item->incidence()->type() == "Event" ) { 969 if ( item->incidence()->type() == "Event" ) {
967 item->incidence()->setDtStart(startDt); 970 item->incidence()->setDtStart(startDt);
968 (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); 971 (static_cast<Event*>(item->incidence()))->setDtEnd(endDt);
969 } else if ( item->incidence()->type() == "Todo" ) { 972 } else if ( item->incidence()->type() == "Todo" ) {
970 (static_cast<Todo*>(item->incidence()))->setDtDue(endDt); 973 (static_cast<Todo*>(item->incidence()))->setDtDue(endDt);
971 } 974 }
972 //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); 975 //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() );
973 item->incidence()->setRevision(item->incidence()->revision()+1); 976 item->incidence()->setRevision(item->incidence()->revision()+1);
974 item->setItemDate(startDt.date()); 977 item->setItemDate(startDt.date());
975 //item->updateItem(); 978 //item->updateItem();
976 if ( item->incidence()->type() == "Todo" ) { 979 if ( item->incidence()->type() == "Todo" ) {
977 emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); 980 emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED );
978 981
979 } 982 }
980 else 983 else
981 emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); 984 emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED);
982 item->updateItem(); 985 item->updateItem();
983} 986}
984 987
985void KOAgendaView::showDates( const QDate &start, const QDate &end ) 988void KOAgendaView::showDates( const QDate &start, const QDate &end )
986{ 989{
987 // kdDebug() << "KOAgendaView::selectDates" << endl; 990 // kdDebug() << "KOAgendaView::selectDates" << endl;
988 991
989 mSelectedDates.clear(); 992 mSelectedDates.clear();
990 // qDebug("KOAgendaView::showDates "); 993 // qDebug("KOAgendaView::showDates ");
991 QDate d = start; 994 QDate d = start;
992 while (d <= end) { 995 while (d <= end) {
993 mSelectedDates.append(d); 996 mSelectedDates.append(d);
994 d = d.addDays( 1 ); 997 d = d.addDays( 1 );
995 } 998 }
996 999
997 // and update the view 1000 // and update the view
998 fillAgenda(); 1001 fillAgenda();
999} 1002}
1000 1003
1001 1004
1002void KOAgendaView::showEvents(QPtrList<Event>) 1005void KOAgendaView::showEvents(QPtrList<Event>)
1003{ 1006{
1004 kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; 1007 kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl;
1005} 1008}
1006 1009
1007void KOAgendaView::changeEventDisplay(Event *, int) 1010void KOAgendaView::changeEventDisplay(Event *, int)
1008{ 1011{
1009 // qDebug("KOAgendaView::changeEventDisplay "); 1012 // qDebug("KOAgendaView::changeEventDisplay ");
1010 // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; 1013 // kdDebug() << "KOAgendaView::changeEventDisplay" << endl;
1011 // this should be re-written to be MUCH smarter. Right now we 1014 // this should be re-written to be MUCH smarter. Right now we
1012 // are just playing dumb. 1015 // are just playing dumb.
1013 fillAgenda(); 1016 fillAgenda();
1014} 1017}
1015 1018
1016void KOAgendaView::fillAgenda(const QDate &) 1019void KOAgendaView::fillAgenda(const QDate &)
1017{ 1020{
1018 // qDebug("KOAgendaView::fillAgenda "); 1021 // qDebug("KOAgendaView::fillAgenda ");
1019 fillAgenda(); 1022 fillAgenda();
1020} 1023}
1021 1024
1022void KOAgendaView::fillAgenda() 1025void KOAgendaView::fillAgenda()
1023{ 1026{
1024 if ( globalFlagBlockStartup ) 1027 if ( globalFlagBlockStartup )
1025 return; 1028 return;
1026 if ( globalFlagBlockAgenda == 1 ) 1029 if ( globalFlagBlockAgenda == 1 )
1027 return; 1030 return;
1028 //if ( globalFlagBlockAgenda == 2 ) 1031 //if ( globalFlagBlockAgenda == 2 )
1029 //globalFlagBlockAgenda = 0; 1032 //globalFlagBlockAgenda = 0;
1030 // globalFlagBlockPainting = false; 1033 // globalFlagBlockPainting = false;
1031 if ( globalFlagBlockAgenda == 0 ) 1034 if ( globalFlagBlockAgenda == 0 )
1032 globalFlagBlockAgenda = 1; 1035 globalFlagBlockAgenda = 1;
1033 // clearView(); 1036 // clearView();
1034 //qDebug("fillAgenda()++++ "); 1037 //qDebug("fillAgenda()++++ ");
1035 globalFlagBlockAgendaItemPaint = 1; 1038 globalFlagBlockAgendaItemPaint = 1;
1036 mAllDayAgenda->changeColumns(mSelectedDates.count()); 1039 mAllDayAgenda->changeColumns(mSelectedDates.count());
1037 mAgenda->changeColumns(mSelectedDates.count()); 1040 mAgenda->changeColumns(mSelectedDates.count());
1038 qApp->processEvents(); 1041 qApp->processEvents();
1039 mEventIndicatorTop->changeColumns(mSelectedDates.count()); 1042 mEventIndicatorTop->changeColumns(mSelectedDates.count());
1040 mEventIndicatorBottom->changeColumns(mSelectedDates.count()); 1043 mEventIndicatorBottom->changeColumns(mSelectedDates.count());
1041 setHolidayMasks(); 1044 setHolidayMasks();
1042 1045
1043 //mAgenda->hideUnused(); 1046 //mAgenda->hideUnused();
1044 //mAllDayAgenda->hideUnused(); 1047 //mAllDayAgenda->hideUnused();
1045 1048
1046 // mAgenda->blockNextRepaint( false ); 1049 // mAgenda->blockNextRepaint( false );
1047 // mAgenda->viewport()->repaint(); 1050 // mAgenda->viewport()->repaint();
1048 // mAgenda->blockNextRepaint( true ); 1051 // mAgenda->blockNextRepaint( true );
1049 mMinY.resize(mSelectedDates.count()); 1052 mMinY.resize(mSelectedDates.count());
1050 mMaxY.resize(mSelectedDates.count()); 1053 mMaxY.resize(mSelectedDates.count());
1051 1054
1052 QPtrList<Event> dayEvents; 1055 QPtrList<Event> dayEvents;
1053 1056
1054 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. 1057 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
1055 // Therefore, get all of them. 1058 // Therefore, get all of them.
1056 QPtrList<Todo> todos = calendar()->todos(); 1059 QPtrList<Todo> todos = calendar()->todos();
1057 1060
1058 mAgenda->setDateList(mSelectedDates); 1061 mAgenda->setDateList(mSelectedDates);
1059 1062
1060 QDate today = QDate::currentDate(); 1063 QDate today = QDate::currentDate();
1061 1064
1062 DateList::ConstIterator dit; 1065 DateList::ConstIterator dit;
1063 int curCol = 0; 1066 int curCol = 0;
1064 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { 1067 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) {
1065 QDate currentDate = *dit; 1068 QDate currentDate = *dit;
1066 // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() 1069 // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString()
1067 // << endl; 1070 // << endl;
1068 1071
1069 dayEvents = calendar()->events(currentDate,true); 1072 dayEvents = calendar()->events(currentDate,true);
1070 1073
1071 // Default values, which can never be reached 1074 // Default values, which can never be reached
1072 mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; 1075 mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1;
1073 mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; 1076 mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1;
1074 1077
1075 unsigned int numEvent; 1078 unsigned int numEvent;
1076 for(numEvent=0;numEvent<dayEvents.count();++numEvent) { 1079 for(numEvent=0;numEvent<dayEvents.count();++numEvent) {
1077 Event *event = dayEvents.at(numEvent); 1080 Event *event = dayEvents.at(numEvent);
1078 if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) 1081 if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") )
1079 if ( event->uid().left(15) == QString("last-syncEvent-") ) 1082 if ( event->uid().left(15) == QString("last-syncEvent-") )
1080 continue; 1083 continue;
1081 // kdDebug() << " Event: " << event->summary() << endl; 1084 // kdDebug() << " Event: " << event->summary() << endl;
1082 1085
1083 int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; 1086 int beginX = currentDate.daysTo(event->dtStart().date()) + curCol;
1084 int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; 1087 int endX = currentDate.daysTo(event->dtEnd().date()) + curCol;
1085 1088
1086 // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; 1089 // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl;
1087 1090
1088 if (event->doesFloat()) { 1091 if (event->doesFloat()) {
1089 if (event->recurrence()->doesRecur()) { 1092 if (event->recurrence()->doesRecur()) {
1090 mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); 1093 mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol);
1091 } else { 1094 } else {
1092 if (beginX <= 0 && curCol == 0) { 1095 if (beginX <= 0 && curCol == 0) {
1093 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); 1096 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1094 } else if (beginX == curCol) { 1097 } else if (beginX == curCol) {
1095 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); 1098 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1096 } 1099 }
1097 } 1100 }
1098 } else if (event->isMultiDay()) { 1101 } else if (event->isMultiDay()) {
1099 if ( event->doesRecur () ) { 1102 if ( event->doesRecur () ) {
1100 QDate dateit = currentDate; 1103 QDate dateit = currentDate;
1101 int count = 0; 1104 int count = 0;
1102 int max = event->dtStart().daysTo( event->dtEnd() ) +2; 1105 int max = event->dtStart().daysTo( event->dtEnd() ) +2;
1103 while (! event->recursOn( dateit ) && count <= max ) { 1106 while (! event->recursOn( dateit ) && count <= max ) {
1104 ++count; 1107 ++count;
1105 dateit = dateit.addDays( -1 ); 1108 dateit = dateit.addDays( -1 );
1106 } 1109 }
1107 bool ok; 1110 bool ok;
1108 QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); 1111 QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok );
1109 if ( ok ) 1112 if ( ok )
1110 { 1113 {
1111 int secs = event->dtStart().secsTo( event->dtEnd() ); 1114 int secs = event->dtStart().secsTo( event->dtEnd() );
1112 QDateTime nextOcend =nextOcstart.addSecs( secs ); ; 1115 QDateTime nextOcend =nextOcstart.addSecs( secs ); ;
1113 beginX = currentDate.daysTo(nextOcstart.date()) + curCol; 1116 beginX = currentDate.daysTo(nextOcstart.date()) + curCol;
1114 endX = currentDate.daysTo(nextOcend.date()) + curCol; 1117 endX = currentDate.daysTo(nextOcend.date()) + curCol;
1115 1118
1116 } 1119 }
1117 } 1120 }
1118 int startY = mAgenda->timeToY(event->dtStart().time()); 1121 int startY = mAgenda->timeToY(event->dtStart().time());
1119 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; 1122 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1;
1120 //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); 1123 //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol );
1121 if ((beginX <= 0 && curCol == 0) || beginX == curCol) { 1124 if ((beginX <= 0 && curCol == 0) || beginX == curCol) {
1122 //qDebug("insert!!! "); 1125 //qDebug("insert!!! ");
1123 mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); 1126 mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY);
1124 } 1127 }
1125 if (beginX == curCol) { 1128 if (beginX == curCol) {
1126 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); 1129 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59));
1127 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1130 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1128 } else if (endX == curCol) { 1131 } else if (endX == curCol) {
1129 mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); 1132 mMinY[curCol] = mAgenda->timeToY(QTime(0,0));
1130 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1133 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1131 } else { 1134 } else {
1132 mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); 1135 mMinY[curCol] = mAgenda->timeToY(QTime(0,0));
1133 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); 1136 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59));
1134 } 1137 }
1135 } else { 1138 } else {
1136 int startY = mAgenda->timeToY(event->dtStart().time()); 1139 int startY = mAgenda->timeToY(event->dtStart().time());
1137 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; 1140 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1;
1138 if (endY < startY) endY = startY; 1141 if (endY < startY) endY = startY;
1139 mAgenda->insertItem(event,currentDate,curCol,startY,endY); 1142 mAgenda->insertItem(event,currentDate,curCol,startY,endY);
1140 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1143 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1141 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1144 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1142 } 1145 }
1143 } 1146 }
1144 // ---------- [display Todos -------------- 1147 // ---------- [display Todos --------------
1145 unsigned int numTodo; 1148 unsigned int numTodo;
1146 for (numTodo = 0; numTodo < todos.count(); ++numTodo) { 1149 for (numTodo = 0; numTodo < todos.count(); ++numTodo) {
1147 Todo *todo = todos.at(numTodo); 1150 Todo *todo = todos.at(numTodo);
1148 1151
1149 if ( ! todo->hasDueDate() ) continue; // todo shall not be displayed if it has no date 1152 if ( ! todo->hasDueDate() ) continue; // todo shall not be displayed if it has no date
1150 1153
1151 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. 1154 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
1152 // Already completed items can be displayed on their original due date 1155 // Already completed items can be displayed on their original due date
1153 //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda 1156 //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda
1154 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; 1157 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda;
1155 1158
1156 if ( ((todo->dtDue().date() == currentDate) && !overdue) || 1159 if ( ((todo->dtDue().date() == currentDate) && !overdue) ||
1157 ((currentDate == today) && overdue) ) { 1160 ((currentDate == today) && overdue) ) {
1158 if ( todo->doesFloat() || overdue ) { // Todo has no due-time set or is already overdue 1161 if ( todo->doesFloat() || overdue ) { // Todo has no due-time set or is already overdue
1159 if ( KOPrefs::instance()->mShowTodoInAgenda ) 1162 if ( KOPrefs::instance()->mShowTodoInAgenda )
1160 mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); 1163 mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol);
1161 } 1164 }
1162 else { 1165 else {
1163 1166
1164 int endY = mAgenda->timeToY(todo->dtDue().time()) - 1; 1167 int endY = mAgenda->timeToY(todo->dtDue().time()) - 1;
1165 int hi = (18/KOPrefs::instance()->mHourSize); 1168 int hi = (18/KOPrefs::instance()->mHourSize);
1166 //qDebug("hei %d ",KOPrefs::instance()->mHourSize); 1169 //qDebug("hei %d ",KOPrefs::instance()->mHourSize);
1167 int startY = endY -hi; 1170 int startY = endY -hi;
1168 1171
1169 mAgenda->insertItem(todo,currentDate,curCol,startY,endY); 1172 mAgenda->insertItem(todo,currentDate,curCol,startY,endY);
1170 1173
1171 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1174 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1172 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1175 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1173 } 1176 }
1174 } 1177 }
1175 } 1178 }
1176 // ---------- display Todos] -------------- 1179 // ---------- display Todos] --------------
1177 1180
1178 ++curCol; 1181 ++curCol;
1179 } 1182 }
1180 mAgenda->hideUnused(); 1183 mAgenda->hideUnused();
1181 mAllDayAgenda->hideUnused(); 1184 mAllDayAgenda->hideUnused();
1182 mAgenda->checkScrollBoundaries(); 1185 mAgenda->checkScrollBoundaries();
1183 1186
1184 deleteSelectedDateTime(); 1187 deleteSelectedDateTime();
1185 1188
1186 createDayLabels(); 1189 createDayLabels();
1187 emit incidenceSelected( 0 ); 1190 emit incidenceSelected( 0 );
1188 1191
1189 if ( globalFlagBlockAgenda == 2 ) { 1192 if ( globalFlagBlockAgenda == 2 ) {
1190 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 1193 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
1191 setStartHour( KOPrefs::instance()->mDayBegins ); 1194 setStartHour( KOPrefs::instance()->mDayBegins );
1192 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 1195 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
1193 setStartHour( QTime::currentTime ().hour() ); 1196 setStartHour( QTime::currentTime ().hour() );
1194 // qApp->processEvents(); 1197 // qApp->processEvents();
1195 } 1198 }
1196 qApp->processEvents(); 1199 qApp->processEvents();
1197 //qDebug("qApp->processEvents(); END "); 1200 //qDebug("qApp->processEvents(); END ");
1198 globalFlagBlockAgenda = 0; 1201 globalFlagBlockAgenda = 0;
1199 1202
1200 // mAgenda->hideUnused(); 1203 // mAgenda->hideUnused();
1201 //mAllDayAgenda->hideUnused(); 1204 //mAllDayAgenda->hideUnused();
1202 mAllDayAgenda->drawContentsToPainter(); 1205 mAllDayAgenda->drawContentsToPainter();
1203 mAgenda->drawContentsToPainter(); 1206 mAgenda->drawContentsToPainter();
1204 repaintAgenda(); 1207 repaintAgenda();
1205 // mAgenda->finishUpdate(); 1208 // mAgenda->finishUpdate();
1206 //mAllDayAgenda->finishUpdate(); 1209 //mAllDayAgenda->finishUpdate();
1207 1210
1208 // repaintAgenda(); 1211 // repaintAgenda();
1209 //qApp->processEvents(); 1212 //qApp->processEvents();
1210 // globalFlagBlockAgenda = 0; 1213 // globalFlagBlockAgenda = 0;
1211} 1214}
1212void KOAgendaView::repaintAgenda() 1215void KOAgendaView::repaintAgenda()
1213{ 1216{
1214 // mAllDayAgenda->drawContentsToPainter(); 1217 // mAllDayAgenda->drawContentsToPainter();
1215// mAllDayAgenda->viewport()->repaint( false ); 1218// mAllDayAgenda->viewport()->repaint( false );
1216// mAgenda->drawContentsToPainter(); 1219// mAgenda->drawContentsToPainter();
1217// mAgenda->viewport()->repaint( false ); 1220// mAgenda->viewport()->repaint( false );
1218// qApp->processEvents(); 1221// qApp->processEvents();
1219 1222
1220 //qDebug("KOAgendaView::repaintAgenda() "); 1223 //qDebug("KOAgendaView::repaintAgenda() ");
1221 //qApp->processEvents(); 1224 //qApp->processEvents();
1222 mAgenda->viewport()->repaint( false ); 1225 mAgenda->viewport()->repaint( false );
1223 mAllDayAgenda->viewport()->repaint( false ); 1226 mAllDayAgenda->viewport()->repaint( false );
1224 mAgenda->finishUpdate(); 1227 mAgenda->finishUpdate();
1225 mAllDayAgenda->finishUpdate(); 1228 mAllDayAgenda->finishUpdate();
1226} 1229}
1227 1230
1228 1231
1229void KOAgendaView::clearView() 1232void KOAgendaView::clearView()
1230{ 1233{
1231 // kdDebug() << "ClearView" << endl; 1234 // kdDebug() << "ClearView" << endl;
1232 mAllDayAgenda->clear(); 1235 mAllDayAgenda->clear();
1233 mAgenda->clear(); 1236 mAgenda->clear();
1234} 1237}
1235 1238
1236void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1239void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1237 const QDate &td) 1240 const QDate &td)
1238{ 1241{
1239#ifndef KORG_NOPRINTER 1242#ifndef KORG_NOPRINTER
1240 if (fd == td) 1243 if (fd == td)
1241 calPrinter->preview(CalPrinter::Day, fd, td); 1244 calPrinter->preview(CalPrinter::Day, fd, td);
1242 else 1245 else
1243 calPrinter->preview(CalPrinter::Week, fd, td); 1246 calPrinter->preview(CalPrinter::Week, fd, td);
1244#endif 1247#endif
1245} 1248}
1246 1249
1247// void KOAgendaView::updateMovedTodo() 1250// void KOAgendaView::updateMovedTodo()
1248// { 1251// {
1249// // updateConfig(); 1252// // updateConfig();
1250// // emit updateTodoViews(); 1253// // emit updateTodoViews();
1251// } 1254// }
1252 1255
1253void KOAgendaView::newEvent(int gx, int gy) 1256void KOAgendaView::newEvent(int gx, int gy)
1254{ 1257{
1255 if (!mSelectedDates.count()) return; 1258 if (!mSelectedDates.count()) return;
1256 1259
1257 QDate day = mSelectedDates[gx]; 1260 QDate day = mSelectedDates[gx];
1258 1261
1259 QTime time = mAgenda->gyToTime(gy); 1262 QTime time = mAgenda->gyToTime(gy);
1260 QDateTime dt(day,time); 1263 QDateTime dt(day,time);
1261 // if ( dt < QDateTime::currentDateTime () ) 1264 // if ( dt < QDateTime::currentDateTime () )
1262 // dt = QDateTime::currentDateTime ().addSecs( 3600 ); 1265 // dt = QDateTime::currentDateTime ().addSecs( 3600 );
1263 emit newEventSignal(dt); 1266 emit newEventSignal(dt);
1264} 1267}
1265 1268
1266void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) 1269void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd)
1267{ 1270{
1268 if (!mSelectedDates.count()) return; 1271 if (!mSelectedDates.count()) return;
1269 1272
1270 QDate dayStart = mSelectedDates[gxStart]; 1273 QDate dayStart = mSelectedDates[gxStart];
1271 QDate dayEnd = mSelectedDates[gxEnd]; 1274 QDate dayEnd = mSelectedDates[gxEnd];
1272 1275
1273 QTime timeStart = mAgenda->gyToTime(gyStart); 1276 QTime timeStart = mAgenda->gyToTime(gyStart);
1274 QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); 1277 QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 );
1275 1278
1276 QDateTime dtStart(dayStart,timeStart); 1279 QDateTime dtStart(dayStart,timeStart);
1277 QDateTime dtEnd(dayEnd,timeEnd); 1280 QDateTime dtEnd(dayEnd,timeEnd);
1278 1281
1279 emit newEventSignal(dtStart,dtEnd); 1282 emit newEventSignal(dtStart,dtEnd);
1280} 1283}
1281 1284
1282void KOAgendaView::newEventAllDay(int gx, int ) 1285void KOAgendaView::newEventAllDay(int gx, int )
1283{ 1286{
1284 if (!mSelectedDates.count()) return; 1287 if (!mSelectedDates.count()) return;
1285 1288
1286 QDate day = mSelectedDates[gx]; 1289 QDate day = mSelectedDates[gx];
1287 1290
1288 emit newEventSignal(day); 1291 emit newEventSignal(day);
1289} 1292}
1290void KOAgendaView::newTodoAllDay(int gx, int ) 1293void KOAgendaView::newTodoAllDay(int gx, int )
1291{ 1294{
1292 if (!mSelectedDates.count()) return; 1295 if (!mSelectedDates.count()) return;
1293 1296
1294 QDateTime day (mSelectedDates[gx] ); 1297 QDateTime day (mSelectedDates[gx] );
1295 emit newTodoSignal(day, true); 1298 emit newTodoSignal(day, true);
1296} 1299}
1297void KOAgendaView::newTodo(int gx, int gy ) 1300void KOAgendaView::newTodo(int gx, int gy )
1298{ 1301{
1299 if (!mSelectedDates.count()) return; 1302 if (!mSelectedDates.count()) return;
1300 QDate dayStart = mSelectedDates[gx]; 1303 QDate dayStart = mSelectedDates[gx];
1301 QTime timeStart = mAgenda->gyToTime(gy); 1304 QTime timeStart = mAgenda->gyToTime(gy);
1302 QDateTime dt (dayStart,timeStart); 1305 QDateTime dt (dayStart,timeStart);
1303 emit newTodoSignal( dt, false ); 1306 emit newTodoSignal( dt, false );
1304} 1307}
1305 1308
1306void KOAgendaView::updateEventIndicatorTop(int newY) 1309void KOAgendaView::updateEventIndicatorTop(int newY)
1307{ 1310{
1308 uint i; 1311 uint i;
1309 for(i=0;i<mMinY.size();++i) { 1312 for(i=0;i<mMinY.size();++i) {
1310 if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true); 1313 if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true);
1311 else mEventIndicatorTop->enableColumn(i,false); 1314 else mEventIndicatorTop->enableColumn(i,false);
1312 } 1315 }
1313 1316
1314 mEventIndicatorTop->update(); 1317 mEventIndicatorTop->update();
1315} 1318}
1316 1319
1317void KOAgendaView::updateEventIndicatorBottom(int newY) 1320void KOAgendaView::updateEventIndicatorBottom(int newY)
1318{ 1321{
1319 uint i; 1322 uint i;
1320 for(i=0;i<mMaxY.size();++i) { 1323 for(i=0;i<mMaxY.size();++i) {
1321 if (newY <= mMaxY.at(i)) mEventIndicatorBottom->enableColumn(i,true); 1324 if (newY <= mMaxY.at(i)) mEventIndicatorBottom->enableColumn(i,true);
1322 else mEventIndicatorBottom->enableColumn(i,false); 1325 else mEventIndicatorBottom->enableColumn(i,false);
1323 } 1326 }
1324 1327
1325 mEventIndicatorBottom->update(); 1328 mEventIndicatorBottom->update();
1326} 1329}
1327 1330
1328void KOAgendaView::startDrag(Event *event) 1331void KOAgendaView::startDrag(Event *event)
1329{ 1332{
1330#ifndef KORG_NODND 1333#ifndef KORG_NODND
1331 DndFactory factory( calendar() ); 1334 DndFactory factory( calendar() );
1332 ICalDrag *vd = factory.createDrag(event,this); 1335 ICalDrag *vd = factory.createDrag(event,this);
1333 if (vd->drag()) { 1336 if (vd->drag()) {
1334 kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl; 1337 kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl;
1335 } 1338 }
1336#endif 1339#endif
1337} 1340}
1338 1341
1339void KOAgendaView::readSettings() 1342void KOAgendaView::readSettings()
1340{ 1343{
1341 readSettings(KOGlobals::config()); 1344 readSettings(KOGlobals::config());
1342} 1345}
1343 1346
1344void KOAgendaView::readSettings(KConfig *config) 1347void KOAgendaView::readSettings(KConfig *config)
1345{ 1348{
1346 // kdDebug() << "KOAgendaView::readSettings()" << endl; 1349 // kdDebug() << "KOAgendaView::readSettings()" << endl;
1347 1350
1348 config->setGroup("Views"); 1351 config->setGroup("Views");
1349 1352
1350 //#ifndef KORG_NOSPLITTER 1353 //#ifndef KORG_NOSPLITTER
1351 QValueList<int> sizes = config->readIntListEntry("Separator AgendaView"); 1354 QValueList<int> sizes = config->readIntListEntry("Separator AgendaView");
1352 if (sizes.count() == 2) { 1355 if (sizes.count() == 2) {
1353 if ( sizes[0] < 20 ) { 1356 if ( sizes[0] < 20 ) {
1354 sizes[1] = sizes[1] +20 - sizes[0]; 1357 sizes[1] = sizes[1] +20 - sizes[0];
1355 sizes[0] = 20; 1358 sizes[0] = 20;
1356 } 1359 }
1357 mSplitterAgenda->setSizes(sizes); 1360 mSplitterAgenda->setSizes(sizes);
1358 // qDebug("read %d %d ",sizes[0],sizes[1] ); 1361 // qDebug("read %d %d ",sizes[0],sizes[1] );
1359 } 1362 }
1360 //#endif 1363 //#endif
1361 1364
1362 // updateConfig(); 1365 // updateConfig();
1363} 1366}
1364 1367
1365void KOAgendaView::writeSettings(KConfig *config) 1368void KOAgendaView::writeSettings(KConfig *config)
1366{ 1369{
1367 // kdDebug() << "KOAgendaView::writeSettings()" << endl; 1370 // kdDebug() << "KOAgendaView::writeSettings()" << endl;
1368 1371
1369 config->setGroup("Views"); 1372 config->setGroup("Views");
1370 1373
1371 //#ifndef KORG_NOSPLITTER 1374 //#ifndef KORG_NOSPLITTER
1372 QValueList<int> list = mSplitterAgenda->sizes(); 1375 QValueList<int> list = mSplitterAgenda->sizes();
1373 config->writeEntry("Separator AgendaView",list); 1376 config->writeEntry("Separator AgendaView",list);
1374 //qDebug("write %d %d ", list[0],list[1] ); 1377 //qDebug("write %d %d ", list[0],list[1] );
1375 //#endif 1378 //#endif
1376} 1379}
1377 1380
1378void KOAgendaView::setHolidayMasks() 1381void KOAgendaView::setHolidayMasks()
1379{ 1382{
1380 mHolidayMask.resize(mSelectedDates.count()); 1383 mHolidayMask.resize(mSelectedDates.count());
1381 1384
1382 uint i; 1385 uint i;
1383 for(i=0;i<mSelectedDates.count();++i) { 1386 for(i=0;i<mSelectedDates.count();++i) {
1384 QDate date = mSelectedDates[i]; 1387 QDate date = mSelectedDates[i];
1385 bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6); 1388 bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6);
1386 bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7); 1389 bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7);
1387 bool showHoliday = false; 1390 bool showHoliday = false;
1388 if ( KOPrefs::instance()->mExcludeHolidays ) { 1391 if ( KOPrefs::instance()->mExcludeHolidays ) {
1389 QPtrList<Event> events = calendar()->events( date, true ); 1392 QPtrList<Event> events = calendar()->events( date, true );
1390 Event *event; 1393 Event *event;
1391 for( event = events.first(); event; event = events.next() ) { 1394 for( event = events.first(); event; event = events.next() ) {
1392 if ( event->categories().contains("Holiday") || 1395 if ( event->categories().contains("Holiday") ||
1393 event->categories().contains(i18n("Holiday"))) { 1396 event->categories().contains(i18n("Holiday"))) {
1394 showHoliday = true; 1397 showHoliday = true;
1395 break; 1398 break;
1396 } 1399 }
1397 } 1400 }
1398 1401
1399 } 1402 }
1400 1403
1401#ifndef KORG_NOPLUGINS 1404#ifndef KORG_NOPLUGINS
1402 bool showHoliday = KOPrefs::instance()->mExcludeHolidays && 1405 bool showHoliday = KOPrefs::instance()->mExcludeHolidays &&
1403 !KOCore::self()->holiday(date).isEmpty(); 1406 !KOCore::self()->holiday(date).isEmpty();
1404#endif 1407#endif
1405 bool showDay = showSaturday || showSunday || showHoliday; 1408 bool showDay = showSaturday || showSunday || showHoliday;
1406 1409
1407 if (showDay) { 1410 if (showDay) {
1408 mHolidayMask.at(i) = true; 1411 mHolidayMask.at(i) = true;
1409 } else { 1412 } else {
1410 mHolidayMask.at(i) = false; 1413 mHolidayMask.at(i) = false;
1411 } 1414 }
1412 } 1415 }
1413 1416
1414 mAgenda->setHolidayMask(&mHolidayMask); 1417 mAgenda->setHolidayMask(&mHolidayMask);
1415 mAllDayAgenda->setHolidayMask(&mHolidayMask); 1418 mAllDayAgenda->setHolidayMask(&mHolidayMask);
1416} 1419}
1417 1420
1418void KOAgendaView::setContentsPos(int y) 1421void KOAgendaView::setContentsPos(int y)
1419{ 1422{
1420 mAgenda->setContentsPos(0,y); 1423 mAgenda->setContentsPos(0,y);
1421} 1424}
1422 1425
1423void KOAgendaView::setExpandedButton( bool expanded ) 1426void KOAgendaView::setExpandedButton( bool expanded )
1424{ 1427{
1425 if ( expanded ) { 1428 if ( expanded ) {
1426 mExpandButton->setPixmap( mExpandedPixmap ); 1429 mExpandButton->setPixmap( mExpandedPixmap );
1427 } else { 1430 } else {
1428 mExpandButton->setPixmap( mNotExpandedPixmap ); 1431 mExpandButton->setPixmap( mNotExpandedPixmap );
1429 } 1432 }
1430} 1433}
1431 1434
1432void KOAgendaView::clearSelection() 1435void KOAgendaView::clearSelection()
1433{ 1436{
1434 mAgenda->deselectItem(); 1437 mAgenda->deselectItem();
1435 mAllDayAgenda->deselectItem(); 1438 mAllDayAgenda->deselectItem();
1436} 1439}
1437 1440
1438void KOAgendaView::newTimeSpanSelectedAllDay(int gxStart, int gyStart, 1441void KOAgendaView::newTimeSpanSelectedAllDay(int gxStart, int gyStart,
1439 int gxEnd, int gyEnd) 1442 int gxEnd, int gyEnd)
1440{ 1443{
1441 mTimeSpanInAllDay = true; 1444 mTimeSpanInAllDay = true;
1442 newTimeSpanSelected(gxStart,gyStart,gxEnd,gyEnd); 1445 newTimeSpanSelected(gxStart,gyStart,gxEnd,gyEnd);
1443} 1446}
1444 1447
1445 1448
1446 1449
1447 1450
1448void KOAgendaView::newTimeSpanSelected(int gxStart, int gyStart, 1451void KOAgendaView::newTimeSpanSelected(int gxStart, int gyStart,
1449 int gxEnd, int gyEnd) 1452 int gxEnd, int gyEnd)
1450{ 1453{
1451 if (!mSelectedDates.count()) return; 1454 if (!mSelectedDates.count()) return;
1452 1455
1453 QDate dayStart = mSelectedDates[gxStart]; 1456 QDate dayStart = mSelectedDates[gxStart];
1454 QDate dayEnd = mSelectedDates[gxEnd]; 1457 QDate dayEnd = mSelectedDates[gxEnd];
1455 1458
1456 QTime timeStart = mAgenda->gyToTime(gyStart); 1459 QTime timeStart = mAgenda->gyToTime(gyStart);
1457 QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); 1460 QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 );
1458 1461
1459 QDateTime dtStart(dayStart,timeStart); 1462 QDateTime dtStart(dayStart,timeStart);
1460 QDateTime dtEnd(dayEnd,timeEnd); 1463 QDateTime dtEnd(dayEnd,timeEnd);
1461 1464
1462 mTimeSpanBegin = dtStart; 1465 mTimeSpanBegin = dtStart;
1463 mTimeSpanEnd = dtEnd; 1466 mTimeSpanEnd = dtEnd;
1464 1467
1465} 1468}
1466 1469
1467void KOAgendaView::deleteSelectedDateTime() 1470void KOAgendaView::deleteSelectedDateTime()
1468{ 1471{
1469 mTimeSpanBegin.setDate(QDate()); 1472 mTimeSpanBegin.setDate(QDate());
1470 mTimeSpanEnd.setDate(QDate()); 1473 mTimeSpanEnd.setDate(QDate());
1471 mTimeSpanInAllDay = false; 1474 mTimeSpanInAllDay = false;
1472} 1475}
1473 1476
1474void KOAgendaView::keyPressEvent ( QKeyEvent * e ) 1477void KOAgendaView::keyPressEvent ( QKeyEvent * e )
1475{ 1478{
1476 e->ignore(); 1479 e->ignore();
1477} 1480}
1478 1481
1479void KOAgendaView::scrollOneHourUp() 1482void KOAgendaView::scrollOneHourUp()
1480{ 1483{
1481 1484
1482 mAgenda->scrollBy ( 0, -mAgenda->contentsHeight () / 24 ); 1485 mAgenda->scrollBy ( 0, -mAgenda->contentsHeight () / 24 );
1483} 1486}
1484void KOAgendaView::scrollOneHourDown() 1487void KOAgendaView::scrollOneHourDown()
1485{ 1488{
1486 mAgenda->scrollBy ( 0, mAgenda->contentsHeight () / 24 ); 1489 mAgenda->scrollBy ( 0, mAgenda->contentsHeight () / 24 );
1487} 1490}
1488 1491
1489void KOAgendaView::setStartHour( int h ) 1492void KOAgendaView::setStartHour( int h )
1490{ 1493{
1491 mAgenda->setStartHour( h ); 1494 mAgenda->setStartHour( h );
1492 1495
1493} 1496}
1494 1497
1495void KOAgendaView::updateTodo( Todo * t, int ) 1498void KOAgendaView::updateTodo( Todo * t, int )
1496{ 1499{
1497 1500
1498 bool remove = false; 1501 bool remove = false;
1499 bool removeAD = false; 1502 bool removeAD = false;
1500 if ( ! t->hasDueDate() ) { 1503 if ( ! t->hasDueDate() ) {
1501 remove = true; 1504 remove = true;
1502 removeAD = true; 1505 removeAD = true;
1503 } 1506 }
1504 else { 1507 else {
1505 bool overdue = (!t->isCompleted()) && (t->dtDue() < QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ; 1508 bool overdue = (!t->isCompleted()) && (t->dtDue() < QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ;
1506 if ( overdue && 1509 if ( overdue &&
1507 QDate::currentDate() >= mSelectedDates.first() && 1510 QDate::currentDate() >= mSelectedDates.first() &&
1508 QDate::currentDate() <= mSelectedDates.last()) { 1511 QDate::currentDate() <= mSelectedDates.last()) {
1509 removeAD = false; 1512 removeAD = false;
1510 remove = true; 1513 remove = true;
1511 } 1514 }
1512 else { 1515 else {
1513 if ( t->dtDue().date() < mSelectedDates.first() || 1516 if ( t->dtDue().date() < mSelectedDates.first() ||
1514 t->dtDue().date() > mSelectedDates.last() ) { 1517 t->dtDue().date() > mSelectedDates.last() ) {
1515 remove = true; 1518 remove = true;
1516 removeAD = true; 1519 removeAD = true;
1517 } else { 1520 } else {
1518 remove = t->doesFloat(); 1521 remove = t->doesFloat();
1519 removeAD = !remove; 1522 removeAD = !remove;
1520 } 1523 }
1521 } 1524 }
1522 } 1525 }
1523 int days = mSelectedDates.first().daysTo( t->dtDue().date() ); 1526 int days = mSelectedDates.first().daysTo( t->dtDue().date() );
1524 // qDebug("daysto %d ", days ); 1527 // qDebug("daysto %d ", days );
1525 mAgenda->updateTodo( t , days, remove); 1528 mAgenda->updateTodo( t , days, remove);
1526 if ( KOPrefs::instance()->mShowTodoInAgenda ) 1529 if ( KOPrefs::instance()->mShowTodoInAgenda )
1527 mAllDayAgenda->updateTodo( t , days, removeAD); 1530 mAllDayAgenda->updateTodo( t , days, removeAD);
1528 //qDebug("KOAgendaView::updateTodo( Todo *, int ) "); 1531 //qDebug("KOAgendaView::updateTodo( Todo *, int ) ");
1529 1532
1530} 1533}
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index 01d74a1..7774fbe 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -1,261 +1,262 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KOAGENDAVIEW_H 23#ifndef KOAGENDAVIEW_H
24#define KOAGENDAVIEW_H 24#define KOAGENDAVIEW_H
25 25
26#include <qscrollview.h> 26#include <qscrollview.h>
27#include <qdatetime.h> 27#include <qdatetime.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#ifndef DESKTOP_VERSION 29#ifndef DESKTOP_VERSION
30#include <qksplitter.h> 30#include <qksplitter.h>
31#else 31#else
32#include <qsplitter.h> 32#include <qsplitter.h>
33#endif 33#endif
34#include <qmemarray.h> 34#include <qmemarray.h>
35 35
36#include "koeventview.h" 36#include "koeventview.h"
37 37
38 38
39class QHBox; 39class QHBox;
40class QFrame; 40class QFrame;
41class QLabel; 41class QLabel;
42class QPushButton; 42class QPushButton;
43class CalendarView; 43class CalendarView;
44class KOAgenda; 44class KOAgenda;
45class KOAgendaItem; 45class KOAgendaItem;
46class KConfig; 46class KConfig;
47class KDGanttMinimizeSplitter; 47class KDGanttMinimizeSplitter;
48class TimeLabels : public QScrollView { 48class TimeLabels : public QScrollView {
49 Q_OBJECT 49 Q_OBJECT
50 public: 50 public:
51 TimeLabels(int rows,QWidget *parent=0,const char *name=0,WFlags f=0); 51 TimeLabels(int rows,QWidget *parent=0,const char *name=0,WFlags f=0);
52 52
53 void setCellHeight(int height); 53 void setCellHeight(int height);
54 54
55 /** Calculates the minimum width */ 55 /** Calculates the minimum width */
56 virtual int minimumWidth() const; 56 virtual int minimumWidth() const;
57 57
58 /** updates widget's internal state */ 58 /** updates widget's internal state */
59 void updateConfig(); 59 void updateConfig();
60 60
61 /** */ 61 /** */
62 void setAgenda(KOAgenda* agenda); 62 void setAgenda(KOAgenda* agenda);
63 63
64 /** */ 64 /** */
65 virtual void paintEvent(QPaintEvent* e); 65 virtual void paintEvent(QPaintEvent* e);
66 void contentsMousePressEvent ( QMouseEvent * ) ; 66 void contentsMousePressEvent ( QMouseEvent * ) ;
67 void contentsMouseReleaseEvent ( QMouseEvent * ); 67 void contentsMouseReleaseEvent ( QMouseEvent * );
68 void contentsMouseMoveEvent ( QMouseEvent * ); 68 void contentsMouseMoveEvent ( QMouseEvent * );
69 69
70 public slots: 70 public slots:
71 /** update time label positions */ 71 /** update time label positions */
72 void positionChanged(); 72 void positionChanged();
73 signals: 73 signals:
74 void scaleChanged(); 74 void scaleChanged();
75 protected: 75 protected:
76 void drawContents(QPainter *p,int cx, int cy, int cw, int ch); 76 void drawContents(QPainter *p,int cx, int cy, int cw, int ch);
77 77
78 private: 78 private:
79 int mMouseDownY; 79 int mMouseDownY;
80 QString mOrgCap; 80 QString mOrgCap;
81 int mRows; 81 int mRows;
82 int mCellHeight; 82 int mCellHeight;
83 83
84 /** */ 84 /** */
85 KOAgenda* mAgenda; 85 KOAgenda* mAgenda;
86}; 86};
87 87
88class EventIndicator : public QFrame { 88class EventIndicator : public QFrame {
89 Q_OBJECT 89 Q_OBJECT
90 public: 90 public:
91 enum Location { Top, Bottom }; 91 enum Location { Top, Bottom };
92 EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0); 92 EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0);
93 virtual ~EventIndicator(); 93 virtual ~EventIndicator();
94 94
95 void changeColumns(int columns); 95 void changeColumns(int columns);
96 void setPaintWidget( KDGanttMinimizeSplitter* ); 96 void setPaintWidget( KDGanttMinimizeSplitter* );
97 void setXOffset( int ); 97 void setXOffset( int );
98 void enableColumn(int column, bool enable); 98 void enableColumn(int column, bool enable);
99 99
100 protected: 100 protected:
101 void drawContents(QPainter *); 101 void drawContents(QPainter *);
102 102
103 private: 103 private:
104 int mXOffset; 104 int mXOffset;
105 KDGanttMinimizeSplitter* mPaintWidget; 105 KDGanttMinimizeSplitter* mPaintWidget;
106 int mColumns; 106 int mColumns;
107 QHBox *mTopBox; 107 QHBox *mTopBox;
108 QBoxLayout *mTopLayout; 108 QBoxLayout *mTopLayout;
109 Location mLocation; 109 Location mLocation;
110 QPixmap mPixmap; 110 QPixmap mPixmap;
111 QMemArray<bool> mEnabled; 111 QMemArray<bool> mEnabled;
112}; 112};
113 113
114/** 114/**
115 KOAgendaView is the agenda-like view used to display events in an one or 115 KOAgendaView is the agenda-like view used to display events in an one or
116 multi-day view. 116 multi-day view.
117*/ 117*/
118class KOAgendaView : public KOEventView { 118class KOAgendaView : public KOEventView {
119 Q_OBJECT 119 Q_OBJECT
120 public: 120 public:
121 KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 ); 121 KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 );
122 virtual ~KOAgendaView(); 122 virtual ~KOAgendaView();
123 void setStartHour( int ); 123 void setStartHour( int );
124 void toggleAllDay(); 124 void toggleAllDay();
125 125
126 126
127 /** Returns maximum number of days supported by the koagendaview */ 127 /** Returns maximum number of days supported by the koagendaview */
128 virtual int maxDatesHint(); 128 virtual int maxDatesHint();
129 129
130 /** Returns number of currently shown dates. */ 130 /** Returns number of currently shown dates. */
131 virtual int currentDateCount(); 131 virtual int currentDateCount();
132 132
133 /** returns the currently selected events */ 133 /** returns the currently selected events */
134 virtual QPtrList<Incidence> selectedIncidences(); 134 virtual QPtrList<Incidence> selectedIncidences();
135 135
136 /** returns the currently selected events */ 136 /** returns the currently selected events */
137 virtual DateList selectedDates(); 137 virtual DateList selectedDates();
138 138
139 /** Remove all events from view */ 139 /** Remove all events from view */
140 void clearView(); 140 void clearView();
141 KOAgenda *agenda() { return mAgenda;} 141 KOAgenda *agenda() { return mAgenda;}
142 virtual void printPreview(CalPrinter *calPrinter, 142 virtual void printPreview(CalPrinter *calPrinter,
143 const QDate &, const QDate &); 143 const QDate &, const QDate &);
144 144
145 /** start-datetime of selection */ 145 /** start-datetime of selection */
146 QDateTime selectionStart() {return mTimeSpanBegin;} 146 QDateTime selectionStart() {return mTimeSpanBegin;}
147 /** end-datetime of selection */ 147 /** end-datetime of selection */
148 QDateTime selectionEnd() {return mTimeSpanEnd;} 148 QDateTime selectionEnd() {return mTimeSpanEnd;}
149 /** returns true if selection is for whole day */ 149 /** returns true if selection is for whole day */
150 bool selectedIsAllDay() {return mTimeSpanInAllDay;} 150 bool selectedIsAllDay() {return mTimeSpanInAllDay;}
151 /** make selected start/end invalid */ 151 /** make selected start/end invalid */
152 void deleteSelectedDateTime(); 152 void deleteSelectedDateTime();
153 void repaintAgenda(); 153 void repaintAgenda();
154 public slots: 154 public slots:
155 virtual void updateView(); 155 virtual void updateView();
156 virtual void updateConfig(); 156 virtual void updateConfig();
157 virtual void showDates(const QDate &start, const QDate &end); 157 virtual void showDates(const QDate &start, const QDate &end);
158 virtual void showEvents(QPtrList<Event> eventList); 158 virtual void showEvents(QPtrList<Event> eventList);
159 159
160 void updateTodo( Todo *, int ); 160 void updateTodo( Todo *, int );
161 void changeEventDisplay(Event *, int); 161 void changeEventDisplay(Event *, int);
162 162
163 void clearSelection(); 163 void clearSelection();
164 164
165 void newTodo(int gx,int gy); 165 void newTodo(int gx,int gy);
166 void newEvent(int gx,int gy); 166 void newEvent(int gx,int gy);
167 void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); 167 void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd);
168 void newEventAllDay(int gx, int gy); 168 void newEventAllDay(int gx, int gy);
169 void newTodoAllDay(int gx, int gy); 169 void newTodoAllDay(int gx, int gy);
170 170
171 void startDrag(Event *); 171 void startDrag(Event *);
172 172
173 void readSettings(); 173 void readSettings();
174 void readSettings(KConfig *); 174 void readSettings(KConfig *);
175 void writeSettings(KConfig *); 175 void writeSettings(KConfig *);
176 176
177 void setContentsPos(int y); 177 void setContentsPos(int y);
178 178
179 void setExpandedButton( bool expanded ); 179 void setExpandedButton( bool expanded );
180 void scrollOneHourUp(); 180 void scrollOneHourUp();
181 void scrollOneHourDown(); 181 void scrollOneHourDown();
182 void addToCalSlot(Incidence *, Incidence *); 182 void addToCalSlot(Incidence *, Incidence *);
183 183
184 signals: 184 signals:
185 void showDateView( int, QDate );
185 void newTodoSignal( QDateTime ,bool ); 186 void newTodoSignal( QDateTime ,bool );
186 void toggleExpand(); 187 void toggleExpand();
187 void todoMoved( Todo *, int ); 188 void todoMoved( Todo *, int );
188 void incidenceChanged(Incidence * , int ); 189 void incidenceChanged(Incidence * , int );
189 // void cloneIncidenceSignal(Incidence *); 190 // void cloneIncidenceSignal(Incidence *);
190 191
191 protected: 192 protected:
192 bool mBlockUpdating; 193 bool mBlockUpdating;
193 int mUpcomingWidth; 194 int mUpcomingWidth;
194 /** Fill agenda beginning with date startDate */ 195 /** Fill agenda beginning with date startDate */
195 void fillAgenda(const QDate &startDate); 196 void fillAgenda(const QDate &startDate);
196 void resizeEvent( QResizeEvent* e ); 197 void resizeEvent( QResizeEvent* e );
197 /** Fill agenda using the current set value for the start date */ 198 /** Fill agenda using the current set value for the start date */
198 void fillAgenda(); 199 void fillAgenda();
199 200
200 /** Create labels for the selected dates. */ 201 /** Create labels for the selected dates. */
201 void createDayLabels(); 202 void createDayLabels();
202 203
203 /** 204 /**
204 Set the masks on the agenda widgets indicating, which days are holidays. 205 Set the masks on the agenda widgets indicating, which days are holidays.
205 */ 206 */
206 void setHolidayMasks(); 207 void setHolidayMasks();
207 208
208 protected slots: 209 protected slots:
209 /** Update event belonging to agenda item */ 210 /** Update event belonging to agenda item */
210 void updateEventDates(KOAgendaItem *item, int mode = -1); 211 void updateEventDates(KOAgendaItem *item, int mode = -1);
211 //void updateMovedTodo(); 212 //void updateMovedTodo();
212 213
213 void updateEventIndicatorTop(int newY); 214 void updateEventIndicatorTop(int newY);
214 void updateEventIndicatorBottom(int newY); 215 void updateEventIndicatorBottom(int newY);
215 216
216 /** Updates data for selected timespan */ 217 /** Updates data for selected timespan */
217 void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); 218 void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd);
218 /** Updates data for selected timespan for all day event*/ 219 /** Updates data for selected timespan for all day event*/
219 void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); 220 void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd);
220 221
221 private: 222 private:
222 // view widgets 223 // view widgets
223 QFrame *mDayLabels; 224 QFrame *mDayLabels;
224 QHBox *mDayLabelsFrame; 225 QHBox *mDayLabelsFrame;
225 QBoxLayout *mLayoutDayLabels; 226 QBoxLayout *mLayoutDayLabels;
226 QFrame *mAllDayFrame; 227 QFrame *mAllDayFrame;
227 KOAgenda *mAllDayAgenda; 228 KOAgenda *mAllDayAgenda;
228 KOAgenda *mAgenda; 229 KOAgenda *mAgenda;
229 TimeLabels *mTimeLabels; 230 TimeLabels *mTimeLabels;
230 QWidget *mDummyAllDayLeft; 231 QWidget *mDummyAllDayLeft;
231 232
232 KDGanttMinimizeSplitter* mSplitterAgenda; 233 KDGanttMinimizeSplitter* mSplitterAgenda;
233 QPushButton *mExpandButton; 234 QPushButton *mExpandButton;
234 235
235 DateList mSelectedDates; // List of dates to be displayed 236 DateList mSelectedDates; // List of dates to be displayed
236 int mViewType; 237 int mViewType;
237 238
238 bool mWeekStartsMonday; 239 bool mWeekStartsMonday;
239 int mStartHour; 240 int mStartHour;
240 241
241 KOEventPopupMenu *mAgendaPopup; 242 KOEventPopupMenu *mAgendaPopup;
242 KOEventPopupMenu *mAllDayAgendaPopup; 243 KOEventPopupMenu *mAllDayAgendaPopup;
243 244
244 EventIndicator *mEventIndicatorTop; 245 EventIndicator *mEventIndicatorTop;
245 EventIndicator *mEventIndicatorBottom; 246 EventIndicator *mEventIndicatorBottom;
246 247
247 QMemArray<int> mMinY; 248 QMemArray<int> mMinY;
248 QMemArray<int> mMaxY; 249 QMemArray<int> mMaxY;
249 250
250 QMemArray<bool> mHolidayMask; 251 QMemArray<bool> mHolidayMask;
251 252
252 QPixmap mExpandedPixmap; 253 QPixmap mExpandedPixmap;
253 QPixmap mNotExpandedPixmap; 254 QPixmap mNotExpandedPixmap;
254 QPtrList<QLabel> mDayLabelsList; 255 QPtrList<QLabel> mDayLabelsList;
255 QDateTime mTimeSpanBegin; 256 QDateTime mTimeSpanBegin;
256 QDateTime mTimeSpanEnd; 257 QDateTime mTimeSpanEnd;
257 bool mTimeSpanInAllDay; 258 bool mTimeSpanInAllDay;
258 void keyPressEvent ( QKeyEvent * e ); 259 void keyPressEvent ( QKeyEvent * e );
259}; 260};
260 261
261#endif // KOAGENDAVIEW_H 262#endif // KOAGENDAVIEW_H
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index a88276e..6da4799 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -1,599 +1,647 @@
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 As a special exception, permission is given to link this program 21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable, 22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution. 23 without including the source code for Qt in the source distribution.
24*/ 24*/
25 25
26#include <qwidgetstack.h> 26#include <qwidgetstack.h>
27 27
28#include <kconfig.h> 28#include <kconfig.h>
29#include <kglobal.h> 29#include <kglobal.h>
30#ifndef DESKTOP_VERSION 30#ifndef DESKTOP_VERSION
31#include <qpe/qpeapplication.h> 31#include <qpe/qpeapplication.h>
32#else 32#else
33#include <qapplication.h> 33#include <qapplication.h>
34#endif 34#endif
35#include <qdatetime.h> 35#include <qdatetime.h>
36#include "calendarview.h" 36#include "calendarview.h"
37#include "datenavigator.h" 37#include "datenavigator.h"
38#include "kotodoview.h" 38#include "kotodoview.h"
39#include "koagendaview.h" 39#include "koagendaview.h"
40#include "kodialogmanager.h" 40#include "kodialogmanager.h"
41#include "komonthview.h" 41#include "komonthview.h"
42#include "kolistview.h" 42#include "kolistview.h"
43#include "kowhatsnextview.h" 43#include "kowhatsnextview.h"
44#include "kojournalview.h" 44#include "kojournalview.h"
45#include "kotimespanview.h" 45#include "kotimespanview.h"
46#include "koprefs.h" 46#include "koprefs.h"
47#include "navigatorbar.h" 47#include "navigatorbar.h"
48#include "kdatenavigator.h" 48#include "kdatenavigator.h"
49 49
50#include "koviewmanager.h" 50#include "koviewmanager.h"
51//extern bool externFlagMonthviewBlockPainting; 51//extern bool externFlagMonthviewBlockPainting;
52 52
53//bool globalFlagBlockPainting = false; 53//bool globalFlagBlockPainting = false;
54int globalFlagBlockAgenda = 0; 54int globalFlagBlockAgenda = 0;
55int globalFlagBlockLabel = 0; 55int globalFlagBlockLabel = 0;
56int globalFlagBlockAgendaItemPaint = 1; 56int globalFlagBlockAgendaItemPaint = 1;
57int globalFlagBlockAgendaItemUpdate = 1; 57int globalFlagBlockAgendaItemUpdate = 1;
58 58
59 59
60KOViewManager::KOViewManager( CalendarView *mainView ) : 60KOViewManager::KOViewManager( CalendarView *mainView ) :
61 QObject(), mMainView( mainView ) 61 QObject(), mMainView( mainView )
62{ 62{
63 mCurrentView = 0; 63 mCurrentView = 0;
64 64
65 mWhatsNextView = 0; 65 mWhatsNextView = 0;
66 mTodoView = 0; 66 mTodoView = 0;
67 mAgendaView = 0; 67 mAgendaView = 0;
68 mMonthView = 0; 68 mMonthView = 0;
69 mListView = 0; 69 mListView = 0;
70 mJournalView = 0; 70 mJournalView = 0;
71 mTimeSpanView = 0; 71 mTimeSpanView = 0;
72 mCurrentAgendaView = 0 ; 72 mCurrentAgendaView = 0 ;
73 mFlagShowNextxDays = false; 73 mFlagShowNextxDays = false;
74} 74}
75 75
76KOViewManager::~KOViewManager() 76KOViewManager::~KOViewManager()
77{ 77{
78} 78}
79 79
80 80
81KOrg::BaseView *KOViewManager::currentView() 81KOrg::BaseView *KOViewManager::currentView()
82{ 82{
83 return mCurrentView; 83 return mCurrentView;
84} 84}
85 85
86void KOViewManager::readSettings(KConfig *config) 86void KOViewManager::readSettings(KConfig *config)
87{ 87{
88 config->setGroup("General"); 88 config->setGroup("General");
89 QString view = config->readEntry("Current View"); 89 QString view = config->readEntry("Current View");
90 if (view == "WhatsNext") showWhatsNextView(); 90 if (view == "WhatsNext") showWhatsNextView();
91 else if (view == "Month") showMonthView(); 91 else if (view == "Month") showMonthView();
92 else if (view == "List") showListView(); 92 else if (view == "List") showListView();
93 else if (view == "Journal") showJournalView(); 93 else if (view == "Journal") showJournalView();
94 else if (view == "TimeSpan") showTimeSpanView(); 94 else if (view == "TimeSpan") showTimeSpanView();
95 else if (view == "Todo") showTodoView(); 95 else if (view == "Todo") showTodoView();
96 else { 96 else {
97 showAgendaView(); 97 showAgendaView();
98 } 98 }
99} 99}
100 100
101
102void KOViewManager::showDateView( int view, QDate date)
103{
104
105 qDebug("date %d %s", view, date.toString().latin1());
106#if 0
107 mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 );
108 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next Week"),4 );
109 mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Two Weeks"),5 );
110 mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Month"),6 );
111 mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 );
112#endif
113 if ( view == 3 ) {
114 mMainView->showDay( date );
115 } else if (view == 4 ) {
116 mMainView->dateNavigator()->selectDates( date, 7 );
117 } else if (view == 5 ) {
118 mMainView->dateNavigator()->selectDates( date, 14);
119 } else if (view == 6 ) {
120 showMonthView();
121 mMainView->dateNavigator()->selectMonthByDate( date );
122 mMainView->dateNavigator()->selectDate( date );
123 } else if (view == 7 ) {
124 mMainView->dateNavigator()->selectDate( date );
125 showJournalView();
126 } else if (view == 8 ) {
127 globalFlagBlockAgenda = 1;
128 if ( mCurrentAgendaView != 3 )
129 mCurrentAgendaView = -1;
130 showAgendaView(KOPrefs::instance()->mFullViewMonth);
131 globalFlagBlockAgenda = 2;
132 mMainView->dateNavigator()->selectDates( date ,
133 KOPrefs::instance()->mNextXDays );
134 mFlagShowNextxDays = true;
135 mCurrentAgendaView = 3 ;
136 }
137
138#if 0
139 dateNavigator()->blockSignals( true );
140 dateNavigator()->selectDate( d );
141 dateNavigator()->blockSignals( false );
142 mViewManager->showDayView();
143#endif
144
145}
146
147
148
101void KOViewManager::writeSettings(KConfig *config) 149void KOViewManager::writeSettings(KConfig *config)
102{ 150{
103 config->setGroup("General"); 151 config->setGroup("General");
104 152
105 QString view; 153 QString view;
106 if (mCurrentView == mWhatsNextView) view = "WhatsNext"; 154 if (mCurrentView == mWhatsNextView) view = "WhatsNext";
107 else if (mCurrentView == mMonthView) view = "Month"; 155 else if (mCurrentView == mMonthView) view = "Month";
108 else if (mCurrentView == mListView) view = "List"; 156 else if (mCurrentView == mListView) view = "List";
109 else if (mCurrentView == mJournalView) view = "Journal"; 157 else if (mCurrentView == mJournalView) view = "Journal";
110 else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; 158 else if (mCurrentView == mTimeSpanView) view = "TimeSpan";
111 else if (mCurrentView == mTodoView) view = "Todo"; 159 else if (mCurrentView == mTodoView) view = "Todo";
112 else view = "Agenda"; 160 else view = "Agenda";
113 161
114 config->writeEntry("Current View",view); 162 config->writeEntry("Current View",view);
115 163
116 if (mAgendaView) { 164 if (mAgendaView) {
117 mAgendaView->writeSettings(config); 165 mAgendaView->writeSettings(config);
118 } 166 }
119 if (mTimeSpanView) { 167 if (mTimeSpanView) {
120 mTimeSpanView->writeSettings(config); 168 mTimeSpanView->writeSettings(config);
121 } 169 }
122 if (mListView) { 170 if (mListView) {
123 mListView->writeSettings(config); 171 mListView->writeSettings(config);
124 } 172 }
125 if (mTodoView) { 173 if (mTodoView) {
126 mTodoView->saveLayout(config,"Todo View"); 174 mTodoView->saveLayout(config,"Todo View");
127 } 175 }
128} 176}
129 177
130void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) 178void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
131{ 179{
132 180
133 //mFlagShowNextxDays = false; 181 //mFlagShowNextxDays = false;
134 //if(view == mCurrentView) return; 182 //if(view == mCurrentView) return;
135 if ( view == 0 ) { 183 if ( view == 0 ) {
136 view = mCurrentView; 184 view = mCurrentView;
137 if ( view == 0 ) 185 if ( view == 0 )
138 return; 186 return;
139 } 187 }
140 bool full = fullScreen; 188 bool full = fullScreen;
141 if(view == mCurrentView && view != mWhatsNextView ) { 189 if(view == mCurrentView && view != mWhatsNextView ) {
142 if ( mCurrentAgendaView < 0 ) 190 if ( mCurrentAgendaView < 0 )
143 return; 191 return;
144 full = mMainView->leftFrame()->isVisible(); 192 full = mMainView->leftFrame()->isVisible();
145 } else { 193 } else {
146 mCurrentView = view; 194 mCurrentView = view;
147 195
148 // bool full = fullScreen; 196 // bool full = fullScreen;
149 bool isFull = !mMainView->leftFrame()->isVisible(); 197 bool isFull = !mMainView->leftFrame()->isVisible();
150 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) 198 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen )
151 full = true; 199 full = true;
152 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) 200 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen )
153 full = false; 201 full = false;
154 } 202 }
155 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); 203 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime();
156 //raiseCurrentView( full ); 204 //raiseCurrentView( full );
157 mMainView->processIncidenceSelection( 0 ); 205 mMainView->processIncidenceSelection( 0 );
158 mMainView->updateView(); 206 mMainView->updateView();
159 raiseCurrentView( full ); 207 raiseCurrentView( full );
160 mMainView->adaptNavigationUnits(); 208 mMainView->adaptNavigationUnits();
161} 209}
162 210
163void KOViewManager::raiseCurrentView( bool fullScreen ) 211void KOViewManager::raiseCurrentView( bool fullScreen )
164{ 212{
165 //qDebug("raiseCurrentView "); 213 //qDebug("raiseCurrentView ");
166 mCurrentAgendaView = 0; 214 mCurrentAgendaView = 0;
167 int wid = mMainView->width() ; 215 int wid = mMainView->width() ;
168 int hei = mMainView->height(); 216 int hei = mMainView->height();
169 if ( mCurrentView == mMonthView ) { 217 if ( mCurrentView == mMonthView ) {
170 mMainView->navigatorBar()->show(); 218 mMainView->navigatorBar()->show();
171 hei -= mMainView->navigatorBar()->sizeHint().height(); 219 hei -= mMainView->navigatorBar()->sizeHint().height();
172 //mMainView->navigatorBar()->hide(); 220 //mMainView->navigatorBar()->hide();
173 } else { 221 } else {
174 mMainView->navigatorBar()->hide(); 222 mMainView->navigatorBar()->hide();
175 } 223 }
176 if ( fullScreen ) { 224 if ( fullScreen ) {
177 mMainView->leftFrame()->hide(); 225 mMainView->leftFrame()->hide();
178 } else { 226 } else {
179 mMainView->leftFrame()->show(); 227 mMainView->leftFrame()->show();
180 if ( KOPrefs::instance()->mVerticalScreen ) 228 if ( KOPrefs::instance()->mVerticalScreen )
181 hei -= mMainView->leftFrame()->height(); 229 hei -= mMainView->leftFrame()->height();
182 else 230 else
183 wid -= mMainView->leftFrame()->width(); 231 wid -= mMainView->leftFrame()->width();
184 } 232 }
185 emit signalFullScreen( !fullScreen ); 233 emit signalFullScreen( !fullScreen );
186 if ( globalFlagBlockAgenda == 5 ) { 234 if ( globalFlagBlockAgenda == 5 ) {
187 globalFlagBlockAgenda = 4; 235 globalFlagBlockAgenda = 4;
188 globalFlagBlockAgendaItemPaint = 1; 236 globalFlagBlockAgendaItemPaint = 1;
189 } 237 }
190 mMainView->viewStack()->raiseWidget(mCurrentView); 238 mMainView->viewStack()->raiseWidget(mCurrentView);
191 if ( globalFlagBlockAgenda == 4 ) { 239 if ( globalFlagBlockAgenda == 4 ) {
192 if ( mCurrentView == mAgendaView ) { 240 if ( mCurrentView == mAgendaView ) {
193 //globalFlagBlockAgenda =1 ; 241 //globalFlagBlockAgenda =1 ;
194 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 242 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
195 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); 243 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins );
196 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 244 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
197 mAgendaView->setStartHour( QTime::currentTime ().hour() ); 245 mAgendaView->setStartHour( QTime::currentTime ().hour() );
198 qApp->processEvents(); 246 qApp->processEvents();
199 //qDebug("qApp->processEvents() "); 247 //qDebug("qApp->processEvents() ");
200 globalFlagBlockAgenda = 0; 248 globalFlagBlockAgenda = 0;
201 mAgendaView->repaintAgenda(); 249 mAgendaView->repaintAgenda();
202 250
203 } 251 }
204 globalFlagBlockAgenda = 0; 252 globalFlagBlockAgenda = 0;
205 } 253 }
206 emit signalAgendaView( mCurrentView == mAgendaView ); 254 emit signalAgendaView( mCurrentView == mAgendaView );
207 //qDebug("raiseCurrentView ende "); 255 //qDebug("raiseCurrentView ende ");
208 256
209} 257}
210 258
211void KOViewManager::updateView() 259void KOViewManager::updateView()
212{ 260{
213 // qDebug("KOViewManager::updateView() "); 261 // qDebug("KOViewManager::updateView() ");
214 // if we are updating mTodoView, we get endless recursion 262 // if we are updating mTodoView, we get endless recursion
215 if ( mTodoView == mCurrentView ) 263 if ( mTodoView == mCurrentView )
216 return; 264 return;
217 if ( mCurrentView ) mCurrentView->updateView(); 265 if ( mCurrentView ) mCurrentView->updateView();
218 266
219} 267}
220 268
221void KOViewManager::updateView(const QDate &start, const QDate &end) 269void KOViewManager::updateView(const QDate &start, const QDate &end)
222{ 270{
223 // kdDebug() << "KOViewManager::updateView()" << endl; 271 // kdDebug() << "KOViewManager::updateView()" << endl;
224 272
225 if (mCurrentView) mCurrentView->showDates(start, end); 273 if (mCurrentView) mCurrentView->showDates(start, end);
226 274
227 if (mTodoView) mTodoView->updateView(); 275 if (mTodoView) mTodoView->updateView();
228} 276}
229 277
230 278
231void KOViewManager::updateWNview() 279void KOViewManager::updateWNview()
232{ 280{
233 if ( mCurrentView == mWhatsNextView && mWhatsNextView ) 281 if ( mCurrentView == mWhatsNextView && mWhatsNextView )
234 mWhatsNextView->updateView(); 282 mWhatsNextView->updateView();
235 283
236} 284}
237void KOViewManager::showWhatsNextView() 285void KOViewManager::showWhatsNextView()
238{ 286{
239 if (!mWhatsNextView) { 287 if (!mWhatsNextView) {
240 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), 288 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
241 "KOViewManager::WhatsNextView"); 289 "KOViewManager::WhatsNextView");
242 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); 290 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
243 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); 291 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
244 addView(mWhatsNextView); 292 addView(mWhatsNextView);
245 connect(this, SIGNAL( printWNV() ), 293 connect(this, SIGNAL( printWNV() ),
246 mWhatsNextView, SLOT( printMe() ) ); 294 mWhatsNextView, SLOT( printMe() ) );
247 } 295 }
248 globalFlagBlockAgenda = 1; 296 globalFlagBlockAgenda = 1;
249 showView(mWhatsNextView, true ); 297 showView(mWhatsNextView, true );
250 //mWhatsNextView->updateView(); 298 //mWhatsNextView->updateView();
251 299
252} 300}
253 301
254void KOViewManager::showListView() 302void KOViewManager::showListView()
255{ 303{
256 if (!mListView) { 304 if (!mListView) {
257 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); 305 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
258 addView(mListView); 306 addView(mListView);
259 307
260 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), 308 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
261 mMainView, SLOT(showIncidence(Incidence *))); 309 mMainView, SLOT(showIncidence(Incidence *)));
262 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), 310 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)),
263 mMainView, SLOT(editIncidence(Incidence *))); 311 mMainView, SLOT(editIncidence(Incidence *)));
264 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), 312 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)),
265 mMainView, SLOT(deleteIncidence(Incidence *))); 313 mMainView, SLOT(deleteIncidence(Incidence *)));
266 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), 314 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ),
267 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 315 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
268 connect( mListView, SIGNAL( signalNewEvent() ), 316 connect( mListView, SIGNAL( signalNewEvent() ),
269 mMainView, SLOT( newEvent() ) ); 317 mMainView, SLOT( newEvent() ) );
270 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); 318 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig()));
271 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 319 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
272 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 320 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
273 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 321 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
274 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 322 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
275 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 323 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
276 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 324 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
277 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 325 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
278 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 326 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
279 } 327 }
280 // bool temp = mFlagShowNextxDays; 328 // bool temp = mFlagShowNextxDays;
281 //globalFlagBlockPainting = true; 329 //globalFlagBlockPainting = true;
282 globalFlagBlockAgenda = 1; 330 globalFlagBlockAgenda = 1;
283 if ( KOPrefs::instance()->mListViewMonthTimespan ) { 331 if ( KOPrefs::instance()->mListViewMonthTimespan ) {
284 mMainView->setBlockShowDates( true ); 332 mMainView->setBlockShowDates( true );
285 mMainView->dateNavigator()->selectMonth(); 333 mMainView->dateNavigator()->selectMonth();
286 mMainView->setBlockShowDates( false ); 334 mMainView->setBlockShowDates( false );
287 } 335 }
288 showView(mListView, KOPrefs::instance()->mFullViewTodo); 336 showView(mListView, KOPrefs::instance()->mFullViewTodo);
289 //mFlagShowNextxDays = temp; 337 //mFlagShowNextxDays = temp;
290} 338}
291 339
292void KOViewManager::showAgendaView( bool fullScreen ) 340void KOViewManager::showAgendaView( bool fullScreen )
293{ 341{
294 342
295 mMainView->dialogManager()->hideSearchDialog(); 343 mMainView->dialogManager()->hideSearchDialog();
296 // qDebug("KOViewManager::showAgendaView "); 344 // qDebug("KOViewManager::showAgendaView ");
297 bool full; 345 bool full;
298 full = fullScreen; 346 full = fullScreen;
299 if (!mAgendaView) { 347 if (!mAgendaView) {
300 full = false; 348 full = false;
301 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); 349 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView");
302 addView(mAgendaView); 350 addView(mAgendaView);
303#ifndef DESKTOP_VERSION 351#ifndef DESKTOP_VERSION
304 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); 352 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold );
305#endif 353#endif
306 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), 354 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )),
307 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); 355 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) ));
308 356
309 // SIGNALS/SLOTS FOR DAY/WEEK VIEW 357 // SIGNALS/SLOTS FOR DAY/WEEK VIEW
310 358
311 359 connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate )));
312 360
313 connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), 361 connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)),
314 mMainView, SLOT(newTodoDateTime(QDateTime,bool))); 362 mMainView, SLOT(newTodoDateTime(QDateTime,bool)));
315 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), 363 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)),
316 mMainView, SLOT(newEvent(QDateTime))); 364 mMainView, SLOT(newEvent(QDateTime)));
317 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), 365 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)),
318 mMainView, SLOT(newEvent(QDateTime,QDateTime))); 366 mMainView, SLOT(newEvent(QDateTime,QDateTime)));
319 connect(mAgendaView,SIGNAL(newEventSignal(QDate)), 367 connect(mAgendaView,SIGNAL(newEventSignal(QDate)),
320 mMainView, SLOT(newEvent(QDate))); 368 mMainView, SLOT(newEvent(QDate)));
321 369
322 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), 370 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)),
323 mMainView, SLOT(editIncidence(Incidence *))); 371 mMainView, SLOT(editIncidence(Incidence *)));
324 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), 372 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)),
325 mMainView, SLOT(showIncidence(Incidence *))); 373 mMainView, SLOT(showIncidence(Incidence *)));
326 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), 374 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)),
327 mMainView, SLOT(deleteIncidence(Incidence *))); 375 mMainView, SLOT(deleteIncidence(Incidence *)));
328 376
329 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), 377 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ),
330 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 378 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
331 379
332 connect(mAgendaView, SIGNAL( toggleExpand() ), 380 connect(mAgendaView, SIGNAL( toggleExpand() ),
333 mMainView, SLOT( toggleExpand() ) ); 381 mMainView, SLOT( toggleExpand() ) );
334 382
335 connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), 383 connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ),
336 mAgendaView, SLOT( setExpandedButton( bool ) ) ); 384 mAgendaView, SLOT( setExpandedButton( bool ) ) );
337 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), 385 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ),
338 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; 386 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ;
339 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), 387 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ),
340 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; 388 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ;
341 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); 389 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig()));
342 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, 390 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView,
343 SLOT( updateTodo( Todo *, int ) ) ); 391 SLOT( updateTodo( Todo *, int ) ) );
344 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), 392 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )),
345 mMainView, SIGNAL( todoModified( Todo *, int ))); 393 mMainView, SIGNAL( todoModified( Todo *, int )));
346 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 394 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
347 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 395 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
348 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 396 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
349 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 397 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
350 mAgendaView->readSettings(); 398 mAgendaView->readSettings();
351 mAgendaView->updateConfig(); 399 mAgendaView->updateConfig();
352 } 400 }
353 401
354 showView( mAgendaView, full); 402 showView( mAgendaView, full);
355 403
356} 404}
357 405
358void KOViewManager::showDayView() 406void KOViewManager::showDayView()
359{ 407{
360 mFlagShowNextxDays = false; 408 mFlagShowNextxDays = false;
361 globalFlagBlockLabel = 1; 409 globalFlagBlockLabel = 1;
362 globalFlagBlockAgenda = 1; 410 globalFlagBlockAgenda = 1;
363 if ( mCurrentAgendaView != 1 ) 411 if ( mCurrentAgendaView != 1 )
364 mCurrentAgendaView = -1; 412 mCurrentAgendaView = -1;
365 showAgendaView(); 413 showAgendaView();
366 qApp->processEvents(); 414 qApp->processEvents();
367 globalFlagBlockAgenda = 2; 415 globalFlagBlockAgenda = 2;
368 globalFlagBlockLabel = 0; 416 globalFlagBlockLabel = 0;
369 mMainView->dateNavigator()->selectDates( 1 ); 417 mMainView->dateNavigator()->selectDates( 1 );
370 mCurrentAgendaView = 1 ; 418 mCurrentAgendaView = 1 ;
371 419
372} 420}
373 421
374void KOViewManager::showWorkWeekView() 422void KOViewManager::showWorkWeekView()
375{ 423{
376 mFlagShowNextxDays = false; 424 mFlagShowNextxDays = false;
377 globalFlagBlockAgenda = 1; 425 globalFlagBlockAgenda = 1;
378 globalFlagBlockLabel = 1; 426 globalFlagBlockLabel = 1;
379 if ( mCurrentAgendaView != 5 ) 427 if ( mCurrentAgendaView != 5 )
380 mCurrentAgendaView = -1; 428 mCurrentAgendaView = -1;
381 showAgendaView(); 429 showAgendaView();
382 qApp->processEvents(); 430 qApp->processEvents();
383 globalFlagBlockAgenda = 2; 431 globalFlagBlockAgenda = 2;
384 globalFlagBlockLabel = 0; 432 globalFlagBlockLabel = 0;
385 mMainView->dateNavigator()->selectWorkWeek(); 433 mMainView->dateNavigator()->selectWorkWeek();
386 mCurrentAgendaView = 5 ; 434 mCurrentAgendaView = 5 ;
387 435
388} 436}
389 437
390void KOViewManager::showWeekView() 438void KOViewManager::showWeekView()
391{ 439{
392 /* 440 /*
393 globalFlagBlockAgenda = 2; 441 globalFlagBlockAgenda = 2;
394 qDebug("4globalFlagBlockAgenda = 2; "); 442 qDebug("4globalFlagBlockAgenda = 2; ");
395 //globalFlagBlockPainting = true; 443 //globalFlagBlockPainting = true;
396 mMainView->dateNavigator()->selectWeek(); 444 mMainView->dateNavigator()->selectWeek();
397 showAgendaView(); 445 showAgendaView();
398 */ 446 */
399 447
400 448
401 mFlagShowNextxDays = false; 449 mFlagShowNextxDays = false;
402 globalFlagBlockAgenda = 1; 450 globalFlagBlockAgenda = 1;
403 globalFlagBlockLabel = 1; 451 globalFlagBlockLabel = 1;
404 if ( mCurrentAgendaView != 7 ) 452 if ( mCurrentAgendaView != 7 )
405 mCurrentAgendaView = -1; 453 mCurrentAgendaView = -1;
406 showAgendaView(); 454 showAgendaView();
407 qApp->processEvents(); 455 qApp->processEvents();
408 globalFlagBlockAgenda = 2; 456 globalFlagBlockAgenda = 2;
409 globalFlagBlockLabel = 0; 457 globalFlagBlockLabel = 0;
410 mMainView->dateNavigator()->selectWeek(); 458 mMainView->dateNavigator()->selectWeek();
411 mCurrentAgendaView = 7 ; 459 mCurrentAgendaView = 7 ;
412} 460}
413 461
414void KOViewManager::showNextXView() 462void KOViewManager::showNextXView()
415{ 463{
416 464
417 globalFlagBlockAgenda = 1; 465 globalFlagBlockAgenda = 1;
418 if ( mCurrentAgendaView != 3 ) 466 if ( mCurrentAgendaView != 3 )
419 mCurrentAgendaView = -1; 467 mCurrentAgendaView = -1;
420 showAgendaView(KOPrefs::instance()->mFullViewMonth); 468 showAgendaView(KOPrefs::instance()->mFullViewMonth);
421 globalFlagBlockAgenda = 2; 469 globalFlagBlockAgenda = 2;
422 mMainView->dateNavigator()->selectDates( QDate::currentDate(), 470 mMainView->dateNavigator()->selectDates( QDate::currentDate(),
423 KOPrefs::instance()->mNextXDays ); 471 KOPrefs::instance()->mNextXDays );
424 mFlagShowNextxDays = true; 472 mFlagShowNextxDays = true;
425 mCurrentAgendaView = 3 ; 473 mCurrentAgendaView = 3 ;
426} 474}
427bool KOViewManager::showsNextDays() 475bool KOViewManager::showsNextDays()
428{ 476{
429 return mFlagShowNextxDays; 477 return mFlagShowNextxDays;
430} 478}
431void KOViewManager::showMonthView() 479void KOViewManager::showMonthView()
432{ 480{
433 if (!mMonthView) { 481 if (!mMonthView) {
434 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); 482 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView");
435 483
436 addView(mMonthView); 484 addView(mMonthView);
437 // mMonthView->show(); 485 // mMonthView->show();
438 // SIGNALS/SLOTS FOR MONTH VIEW 486 // SIGNALS/SLOTS FOR MONTH VIEW
439 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), 487 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)),
440 mMainView, SLOT(newEvent(QDateTime))); 488 mMainView, SLOT(newEvent(QDateTime)));
441 489
442 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), 490 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)),
443 mMainView, SLOT(showIncidence(Incidence *))); 491 mMainView, SLOT(showIncidence(Incidence *)));
444 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), 492 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)),
445 mMainView, SLOT(editIncidence(Incidence *))); 493 mMainView, SLOT(editIncidence(Incidence *)));
446 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), 494 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)),
447 mMainView, SLOT(deleteIncidence(Incidence *))); 495 mMainView, SLOT(deleteIncidence(Incidence *)));
448 496
449 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), 497 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ),
450 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 498 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
451 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 499 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
452 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 500 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
453 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 501 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
454 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 502 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
455 503
456 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 504 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
457 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 505 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
458 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 506 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
459 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 507 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
460 connect( mMonthView, SIGNAL( selectWeekNum( int ) ), 508 connect( mMonthView, SIGNAL( selectWeekNum( int ) ),
461 mMainView, SLOT ( selectWeekNum( int ) ) ); 509 mMainView, SLOT ( selectWeekNum( int ) ) );
462 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), 510 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ),
463 mMainView, SLOT ( showDay( QDate ) ) ); 511 mMainView, SLOT ( showDay( QDate ) ) );
464 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); 512 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig()));
465 connect( mMonthView, SIGNAL(nextMonth() ), 513 connect( mMonthView, SIGNAL(nextMonth() ),
466 mMainView->navigatorBar(), SIGNAL(goNextMonth() ) ); 514 mMainView->navigatorBar(), SIGNAL(goNextMonth() ) );
467 connect( mMonthView, SIGNAL(prevMonth() ), 515 connect( mMonthView, SIGNAL(prevMonth() ),
468 mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) ); 516 mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) );
469 mMonthView->updateConfig(); 517 mMonthView->updateConfig();
470 } 518 }
471 519
472 globalFlagBlockAgenda = 1; 520 globalFlagBlockAgenda = 1;
473 //mFlagShowNextxDays = false; 521 //mFlagShowNextxDays = false;
474 // if(mMonthView == mCurrentView) return; 522 // if(mMonthView == mCurrentView) return;
475 mMainView->dateNavigator()->selectMonth(); 523 mMainView->dateNavigator()->selectMonth();
476 // DateList tmpList = mMainView->dateNavigator()->selectedDates( ); 524 // DateList tmpList = mMainView->dateNavigator()->selectedDates( );
477 //mMonthView->showDates(tmpList.first(), tmpList.last()); 525 //mMonthView->showDates(tmpList.first(), tmpList.last());
478 526
479 showView(mMonthView, true ); 527 showView(mMonthView, true );
480 528
481} 529}
482 530
483void KOViewManager::showTodoView() 531void KOViewManager::showTodoView()
484{ 532{
485 //mFlagShowNextxDays = false; 533 //mFlagShowNextxDays = false;
486 if ( !mTodoView ) { 534 if ( !mTodoView ) {
487 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), 535 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(),
488 "KOViewManager::TodoView" ); 536 "KOViewManager::TodoView" );
489 537
490 addView( mTodoView ); 538 addView( mTodoView );
491 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); 539 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold );
492 540
493 // SIGNALS/SLOTS FOR TODO VIEW 541 // SIGNALS/SLOTS FOR TODO VIEW
494 connect( mTodoView, SIGNAL( newTodoSignal() ), 542 connect( mTodoView, SIGNAL( newTodoSignal() ),
495 mMainView, SLOT( newTodo() ) ); 543 mMainView, SLOT( newTodo() ) );
496 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), 544 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ),
497 mMainView, SLOT( newSubTodo( Todo *) ) ); 545 mMainView, SLOT( newSubTodo( Todo *) ) );
498 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), 546 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ),
499 mMainView, SLOT( showTodo( Todo * ) ) ); 547 mMainView, SLOT( showTodo( Todo * ) ) );
500 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), 548 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ),
501 mMainView, SLOT( editTodo( Todo * ) ) ); 549 mMainView, SLOT( editTodo( Todo * ) ) );
502 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), 550 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ),
503 mMainView, SLOT( deleteTodo( Todo * ) ) ); 551 mMainView, SLOT( deleteTodo( Todo * ) ) );
504 connect( mTodoView, SIGNAL( purgeCompletedSignal() ), 552 connect( mTodoView, SIGNAL( purgeCompletedSignal() ),
505 mMainView, SLOT( purgeCompleted() ) ); 553 mMainView, SLOT( purgeCompleted() ) );
506 554
507 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), 555 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ),
508 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 556 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
509 557
510 connect( mMainView, SIGNAL( configChanged() ), mTodoView, 558 connect( mMainView, SIGNAL( configChanged() ), mTodoView,
511 SLOT( updateConfig() ) ); 559 SLOT( updateConfig() ) );
512 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, 560 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView,
513 SLOT( updateTodo( Todo *, int ) ) ); 561 SLOT( updateTodo( Todo *, int ) ) );
514 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), 562 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ),
515 mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); 563 mMainView, SIGNAL ( todoModified( Todo *, int ) ) );
516 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), 564 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ),
517 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 565 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
518 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), 566 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ),
519 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 567 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
520 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), 568 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ),
521 mMainView, SLOT ( todo_unsub( Todo * ) ) ); 569 mMainView, SLOT ( todo_unsub( Todo * ) ) );
522 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 570 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
523 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); 571 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) );
524 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), 572 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ),
525 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 573 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
526 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), 574 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ),
527 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 575 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
528 KConfig *config = KOGlobals::config(); 576 KConfig *config = KOGlobals::config();
529 mTodoView->restoreLayout(config,"Todo View"); 577 mTodoView->restoreLayout(config,"Todo View");
530 mTodoView->setNavigator( mMainView->dateNavigator() ); 578 mTodoView->setNavigator( mMainView->dateNavigator() );
531 } 579 }
532 580
533 globalFlagBlockAgenda = 1; 581 globalFlagBlockAgenda = 1;
534 showView( mTodoView, true ); 582 showView( mTodoView, true );
535 583
536} 584}
537 585
538void KOViewManager::showJournalView() 586void KOViewManager::showJournalView()
539{ 587{
540 //mFlagShowNextxDays = false; 588 //mFlagShowNextxDays = false;
541 if (!mJournalView) { 589 if (!mJournalView) {
542 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), 590 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(),
543 "KOViewManager::JournalView"); 591 "KOViewManager::JournalView");
544 connect( mMainView, SIGNAL( configChanged() ), mJournalView, 592 connect( mMainView, SIGNAL( configChanged() ), mJournalView,
545 SLOT( updateConfig() ) ); 593 SLOT( updateConfig() ) );
546 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); 594 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) );
547 addView(mJournalView); 595 addView(mJournalView);
548 } 596 }
549 597
550 showView(mJournalView); 598 showView(mJournalView);
551} 599}
552 600
553void KOViewManager::showTimeSpanView() 601void KOViewManager::showTimeSpanView()
554{ 602{
555 //mFlagShowNextxDays = false; 603 //mFlagShowNextxDays = false;
556 if (!mTimeSpanView) { 604 if (!mTimeSpanView) {
557 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), 605 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(),
558 "KOViewManager::TimeSpanView"); 606 "KOViewManager::TimeSpanView");
559 addView(mTimeSpanView); 607 addView(mTimeSpanView);
560 608
561 mTimeSpanView->readSettings(); 609 mTimeSpanView->readSettings();
562 } 610 }
563 611
564 showView(mTimeSpanView); 612 showView(mTimeSpanView);
565} 613}
566 614
567Incidence *KOViewManager::currentSelection() 615Incidence *KOViewManager::currentSelection()
568{ 616{
569 if (!mCurrentView) return 0; 617 if (!mCurrentView) return 0;
570 if ( mCurrentView == mListView ) { 618 if ( mCurrentView == mListView ) {
571 if ( mListView->currentItem() ) 619 if ( mListView->currentItem() )
572 return mListView->currentItem(); 620 return mListView->currentItem();
573 } 621 }
574 return mCurrentView->selectedIncidences().first(); 622 return mCurrentView->selectedIncidences().first();
575} 623}
576 624
577QDate KOViewManager::currentSelectionDate() 625QDate KOViewManager::currentSelectionDate()
578{ 626{
579 QDate qd; 627 QDate qd;
580 if (mCurrentView) { 628 if (mCurrentView) {
581 DateList qvl = mCurrentView->selectedDates(); 629 DateList qvl = mCurrentView->selectedDates();
582 if (!qvl.isEmpty()) qd = qvl.first(); 630 if (!qvl.isEmpty()) qd = qvl.first();
583 } 631 }
584 return qd; 632 return qd;
585} 633}
586 634
587void KOViewManager::addView(KOrg::BaseView *view) 635void KOViewManager::addView(KOrg::BaseView *view)
588{ 636{
589#if QT_VERSION >= 0x030000 637#if QT_VERSION >= 0x030000
590 mMainView->viewStack()->addWidget( view ); 638 mMainView->viewStack()->addWidget( view );
591#else 639#else
592 mMainView->viewStack()->addWidget( view, 1 ); 640 mMainView->viewStack()->addWidget( view, 1 );
593#endif 641#endif
594} 642}
595 643
596void KOViewManager::setDocumentId( const QString &id ) 644void KOViewManager::setDocumentId( const QString &id )
597{ 645{
598 if (mTodoView) mTodoView->setDocumentId( id ); 646 if (mTodoView) mTodoView->setDocumentId( id );
599} 647}
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h
index c8c7a7a..137eb2d 100644
--- a/korganizer/koviewmanager.h
+++ b/korganizer/koviewmanager.h
@@ -1,117 +1,118 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 3 Copyright (c) 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 KOVIEWMANAGER_H 24#ifndef KOVIEWMANAGER_H
25#define KOVIEWMANAGER_H 25#define KOVIEWMANAGER_H
26 26
27#include <qobject.h> 27#include <qobject.h>
28 28
29#include <korganizer/baseview.h> 29#include <korganizer/baseview.h>
30 30
31class CalendarView; 31class CalendarView;
32 32
33class KOListView; 33class KOListView;
34class KOAgendaView; 34class KOAgendaView;
35class KOMonthView; 35class KOMonthView;
36class KOTimeSpanView; 36class KOTimeSpanView;
37class KOTodoView; 37class KOTodoView;
38class KOWhatsNextView; 38class KOWhatsNextView;
39class KOJournalView; 39class KOJournalView;
40 40
41using namespace KCal; 41using namespace KCal;
42 42
43/** 43/**
44 This class manages the views of the calendar. It owns the objects and handles 44 This class manages the views of the calendar. It owns the objects and handles
45 creation and selection. 45 creation and selection.
46*/ 46*/
47class KOViewManager : public QObject 47class KOViewManager : public QObject
48{ 48{
49 Q_OBJECT 49 Q_OBJECT
50 public: 50 public:
51 KOViewManager( CalendarView * ); 51 KOViewManager( CalendarView * );
52 virtual ~KOViewManager(); 52 virtual ~KOViewManager();
53 53
54 /** changes the view to be the currently selected view */ 54 /** changes the view to be the currently selected view */
55 void showView(KOrg::BaseView *, bool fullScreen = false ); 55 void showView(KOrg::BaseView *, bool fullScreen = false );
56 void updateWNview(); 56 void updateWNview();
57 void readSettings(KConfig *config); 57 void readSettings(KConfig *config);
58 void writeSettings(KConfig *config); 58 void writeSettings(KConfig *config);
59 bool showsNextDays(); 59 bool showsNextDays();
60 /** Read which view was shown last from config file */ 60 /** Read which view was shown last from config file */
61 void readCurrentView(KConfig *); 61 void readCurrentView(KConfig *);
62 /** Write which view is currently shown to config file */ 62 /** Write which view is currently shown to config file */
63 void writeCurrentView(KConfig *); 63 void writeCurrentView(KConfig *);
64 64
65 KOrg::BaseView *currentView(); 65 KOrg::BaseView *currentView();
66 66
67 void setDocumentId( const QString & ); 67 void setDocumentId( const QString & );
68 68
69 void updateView( const QDate &start, const QDate &end ); 69 void updateView( const QDate &start, const QDate &end );
70 70
71 void raiseCurrentView( bool fullScreen = false ); 71 void raiseCurrentView( bool fullScreen = false );
72 72
73 void addView(KOrg::BaseView *); 73 void addView(KOrg::BaseView *);
74 74
75 Incidence *currentSelection(); 75 Incidence *currentSelection();
76 QDate currentSelectionDate(); 76 QDate currentSelectionDate();
77 77
78 KOAgendaView *agendaView() const { return mAgendaView; } 78 KOAgendaView *agendaView() const { return mAgendaView; }
79 79
80 signals: 80 signals:
81 void printWNV(); 81 void printWNV();
82 void signalFullScreen( bool ); 82 void signalFullScreen( bool );
83 void signalAgendaView( bool ); 83 void signalAgendaView( bool );
84 public slots: 84 public slots:
85 void showDateView( int, QDate );
85 void updateView(); 86 void updateView();
86 void showWhatsNextView(); 87 void showWhatsNextView();
87 void showListView(); 88 void showListView();
88 void showAgendaView( bool fullScreen = false ); 89 void showAgendaView( bool fullScreen = false );
89 void showDayView(); 90 void showDayView();
90 void showWorkWeekView(); 91 void showWorkWeekView();
91 void showWeekView(); 92 void showWeekView();
92 void showNextXView(); 93 void showNextXView();
93 void showMonthView(); 94 void showMonthView();
94 void showTodoView(); 95 void showTodoView();
95 void showJournalView(); 96 void showJournalView();
96 void showTimeSpanView(); 97 void showTimeSpanView();
97 98
98 private: 99 private:
99 CalendarView *mMainView; 100 CalendarView *mMainView;
100 101
101 int mCurrentAgendaView; 102 int mCurrentAgendaView;
102 KOAgendaView *mAgendaView; 103 KOAgendaView *mAgendaView;
103 KOListView *mListView; 104 KOListView *mListView;
104 KOMonthView *mMonthView; 105 KOMonthView *mMonthView;
105 KOTodoView *mTodoView; 106 KOTodoView *mTodoView;
106 KOWhatsNextView *mWhatsNextView; 107 KOWhatsNextView *mWhatsNextView;
107 KOJournalView *mJournalView; 108 KOJournalView *mJournalView;
108 KOTimeSpanView *mTimeSpanView; 109 KOTimeSpanView *mTimeSpanView;
109 110
110 KOrg::BaseView *mCurrentView; // currently active event view 111 KOrg::BaseView *mCurrentView; // currently active event view
111 112
112 int mAgendaViewMode; 113 int mAgendaViewMode;
113 bool mFlagShowNextxDays; 114 bool mFlagShowNextxDays;
114 115
115}; 116};
116 117
117#endif 118#endif