summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt8
-rw-r--r--korganizer/kolistview.cpp6
-rw-r--r--libkcal/recurrence.cpp12
-rw-r--r--pwmanager/pwmanager/pwm.cpp8
-rw-r--r--pwmanager/pwmanager/pwminit.cpp8
-rw-r--r--pwmanager/pwmanager/pwmview.cpp2
6 files changed, 29 insertions, 15 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index ab6d220..58be545 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1,1292 +1,1300 @@
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,\nfor example '%1'.","Bitte gültiges Enddatum angeben,\nz.B.'%1'." }, 295{ "Please specify a valid end date,\nfor example '%1'.","Bitte gültiges Enddatum angeben,\nz.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,\nfor example '%1'.","Bitte gültiges Startdatum angeben,\nz.B. '%1'." }, 297{ "Please specify a valid start date,\nfor example '%1'.","Bitte gültiges Startdatum angeben,\nz.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,\nfor example '%1'.","Bitte gültige Startzeit angeben,\nz.B. '%1'." }, 299{ "Please specify a valid start time,\nfor example '%1'.","Bitte gültige Startzeit angeben,\nz.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{ "PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n","PDA-Edition\nfür: Zaurus 5x00/7x0/860/3000/6000\n" }, 1047{ "PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n","PDA-Edition\nfür: Zaurus 5x00/7x0/860/3000/6000\n" },
1048{ "KOrganizer/Platform-independent\n","KOrganizer/Platform-independent\n" }, 1048{ "KOrganizer/Platform-independent\n","KOrganizer/Platform-independent\n" },
1049{ "About KOrganizer/Pi","Über KOrganizer/Pi" }, 1049{ "About KOrganizer/Pi","Über KOrganizer/Pi" },
1050{ "From: ","Von: " }, 1050{ "From: ","Von: " },
1051{ "Remove sync info","Entferne Sync Info" }, 1051{ "Remove sync info","Entferne Sync Info" },
1052{ "For all profiles","Für alle Profile" }, 1052{ "For all profiles","Für alle Profile" },
1053{ "Hide not Running","Verstecke nicht Laufende" }, 1053{ "Hide not Running","Verstecke nicht Laufende" },
1054{ "ME","ME" }, 1054{ "ME","ME" },
1055{ "Toolbar","Toolbar" }, 1055{ "Toolbar","Toolbar" },
1056{ "Undo Delete...","Löschen rückgängig machen..." }, 1056{ "Undo Delete...","Löschen rückgängig machen..." },
1057{ "Undo Delete","Löschen rückgängig machen" }, 1057{ "Undo Delete","Löschen rückgängig machen" },
1058{ "KDE Sync HowTo...","KDE Sync HowTo..." }, 1058{ "KDE Sync HowTo...","KDE Sync HowTo..." },
1059{ "Multi Sync HowTo...","Multi Sync HowTo..." }, 1059{ "Multi Sync HowTo...","Multi Sync HowTo..." },
1060{ "Januar","Januar" }, 1060{ "Januar","Januar" },
1061{ "KO/Pi Keys + Colors","KO/Pi Tasten + Farben" }, 1061{ "KO/Pi Keys + Colors","KO/Pi Tasten + Farben" },
1062{ "No Filter","Kein Filter" }, 1062{ "No Filter","Kein Filter" },
1063{ "Multiple Sync options","Multi Sync Optionen" }, 1063{ "Multiple Sync options","Multi Sync Optionen" },
1064{ "Sync algo options","Sync Ablauf Optionen" }, 1064{ "Sync algo options","Sync Ablauf Optionen" },
1065{ "Apply filter when adding data to local:","Filter für das Hinzufügen von Daten zu Lokal:" }, 1065{ "Apply filter when adding data to local:","Filter für das Hinzufügen von Daten zu Lokal:" },
1066{ "Incoming calendar filter:","Eingehender Kalender Filter:" }, 1066{ "Incoming calendar filter:","Eingehender Kalender Filter:" },
1067{ "Incoming addressbook filter:","Eingehender Adressbuch Filter:" }, 1067{ "Incoming addressbook filter:","Eingehender Adressbuch Filter:" },
1068{ "Write back options","Optionen zum Zurückschreiben" }, 1068{ "Write back options","Optionen zum Zurückschreiben" },
1069{ "Write back (on remote) existing entries only","Schreibe nur existierende (auf Entfernt) Einträge zurück" }, 1069{ "Write back (on remote) existing entries only","Schreibe nur existierende (auf Entfernt) Einträge zurück" },
1070{ "Apply filter when adding data to remote:","Filter für das Hinzufügen von Daten zu Entfernt:" }, 1070{ "Apply filter when adding data to remote:","Filter für das Hinzufügen von Daten zu Entfernt:" },
1071{ "Outgoing calendar filter:","Ausgehender Kalender Filter:" }, 1071{ "Outgoing calendar filter:","Ausgehender Kalender Filter:" },
1072{ "Outgoing addressbook filter:","Ausgehender Adressbuch Filter:" }, 1072{ "Outgoing addressbook filter:","Ausgehender Adressbuch Filter:" },
1073{ "Write back (calendar) entries for time period only","Schreibe nur Kalender Einträge für Zeitspanne zurück" }, 1073{ "Write back (calendar) entries for time period only","Schreibe nur Kalender Einträge für Zeitspanne zurück" },
1074{ "Time period","Zeitspanne" }, 1074{ "Time period","Zeitspanne" },
1075{ "From ","Von " }, 1075{ "From ","Von " },
1076{ " weeks in the past to "," Wochen in der Vergangenheit bis zu " }, 1076{ " weeks in the past to "," Wochen in der Vergangenheit bis zu " },
1077{ " weeks in the future "," Wochen in der Zukunft " }, 1077{ " weeks in the future "," Wochen in der Zukunft " },
1078{ "Profile kind specific settings","Profil Art abhängige Einstellungen" }, 1078{ "Profile kind specific settings","Profil Art abhängige Einstellungen" },
1079{ "Local temp file:","Lokale temp Datei:" }, 1079{ "Local temp file:","Lokale temp Datei:" },
1080{ "Multiple profiles with same name!\nPlease use unique profile names!","Mehrere Profile mit demselben Namen!\nBitte verschiedene Namen benutzen!" }, 1080{ "Multiple profiles with same name!\nPlease use unique profile names!","Mehrere Profile mit demselben Namen!\nBitte verschiedene Namen benutzen!" },
1081{ "Aborted! Nothing synced!","Abgebrochen! Nichts wurde gesynct!" }, 1081{ "Aborted! Nothing synced!","Abgebrochen! Nichts wurde gesynct!" },
1082{ "Language","Sprache" }, 1082{ "Language","Sprache" },
1083{ "Time Format","Zeit Format" }, 1083{ "Time Format","Zeit Format" },
1084{ "Time Zone","Zeit Zone" }, 1084{ "Time Zone","Zeit Zone" },
1085{ "%1 groups subscribed","%1 Guppen abboniert" }, 1085{ "%1 groups subscribed","%1 Guppen abboniert" },
1086{ "Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail","Aktuelles Speicherverzeichnis ist:\n%1\nIhre Mail wird gespeichert in:\n(speicherverz.)/apps/kopiemail/localmail" }, 1086{ "Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail","Aktuelles Speicherverzeichnis ist:\n%1\nIhre Mail wird gespeichert in:\n(speicherverz.)/apps/kopiemail/localmail" },
1087{ "<b>New data storage dir:</b>","<b>Neues Datenspeicherverzeichnis:</b>" }, 1087{ "<b>New data storage dir:</b>","<b>Neues Datenspeicherverzeichnis:</b>" },
1088{ "New dirs are created automatically","Neue Verzeichnisse werden aut. erstellt" }, 1088{ "New dirs are created automatically","Neue Verzeichnisse werden aut. erstellt" },
1089{ "Save settings","Speichere Einstellungen" }, 1089{ "Save settings","Speichere Einstellungen" },
1090{ "Save standard","Speichere Standard" }, 1090{ "Save standard","Speichere Standard" },
1091{ "<b>New settings are used\nafter a restart</b>","<b>Neue Einstellungen werden nach\neinem Neustart genutzt</b>" }, 1091{ "<b>New settings are used\nafter a restart</b>","<b>Neue Einstellungen werden nach\neinem Neustart genutzt</b>" },
1092{ "Settings are stored in\n%1","Einstellungen werden gespeichert in:\n%1" }, 1092{ "Settings are stored in\n%1","Einstellungen werden gespeichert in:\n%1" },
1093{ "Data storage path","Daten Speicherpfad" }, 1093{ "Data storage path","Daten Speicherpfad" },
1094{ "Language","Sprache" }, 1094{ "Language","Sprache" },
1095{ "Show time in agenda items","Zeige Zeit in Agenda Items" }, 1095{ "Show time in agenda items","Zeige Zeit in Agenda Items" },
1096{ "Color for Sundays + category "Holiday"","Farbe für Sonntags + Kategorie "Feiertag"" }, 1096{ "Color for Sundays + category "Holiday"","Farbe für Sonntags + Kategorie "Feiertag"" },
1097{ "Show events, that are done in \nWhat's Next view","Zeige abgelaufene Termine in\nWhat's Next Ansicht" }, 1097{ "Show events, that are done in \nWhat's Next view","Zeige abgelaufene Termine in\nWhat's Next Ansicht" },
1098{ "Hide not running Todos in To-do view","Verstecke nicht laufende Todos" }, 1098{ "Hide not running Todos in To-do view","Verstecke nicht laufende Todos" },
1099{ "+01:00 Europe/Oslo(CET)","+01:00 Europe/Oslo(CET)" }, 1099{ "+01:00 Europe/Oslo(CET)","+01:00 Europe/Oslo(CET)" },
1100{ "KO/Pi","KO/Pi" }, 1100{ "KO/Pi","KO/Pi" },
1101{ "There is nothing to undo!","Es gibt nichts zum\nRückgängigmachen!" }, 1101{ "There is nothing to undo!","Es gibt nichts zum\nRückgängigmachen!" },
1102{ "Recreating edit dialog. Please wait...","Recreating edit dialog. Please wait..." }, 1102{ "Recreating edit dialog. Please wait...","Recreating edit dialog. Please wait..." },
1103{ "Sound.Al.: ","Sound.Al.: " }, 1103{ "Sound.Al.: ","Sound.Al.: " },
1104{ "From: %1 To: %2 %3","Von: %1 Bis: %2 %3" }, 1104{ "From: %1 To: %2 %3","Von: %1 Bis: %2 %3" },
1105{ "Restore","Wiederherstellen" }, 1105{ "Restore","Wiederherstellen" },
1106{ "\nAre you sure you want\nto restore this?","\nMöchten Sie das wirklicht\nwiederherstellen?" }, 1106{ "\nAre you sure you want\nto restore this?","\nMöchten Sie das wirklicht\nwiederherstellen?" },
1107{ "% completed","% komplett" }, 1107{ "% completed","% komplett" },
1108{ "%d item(s) found.","%d Item(s) gefunden." }, 1108{ "%d item(s) found.","%d Item(s) gefunden." },
1109{ "Set complete","Setze auf erledigt" }, 1109{ "Set complete","Setze auf erledigt" },
1110{ "(cancelled)","(gecancelt)" }, 1110{ "(cancelled)","(gecancelt)" },
1111{ "Click on the week number to\nshow week in agenda view","Klicke auf die Wochennummer\num die Woche in der Agenda anzuzeigen" }, 1111{ "Click on the week number to\nshow week in agenda view","Klicke auf die Wochennummer\num die Woche in der Agenda anzuzeigen" },
1112{ " Local time "," Locale Zeit " }, 1112{ " Local time "," Locale Zeit " },
1113{ "Form2","Form2" }, 1113{ "Form2","Form2" },
1114{ "Filter enabled","Filter angeschaltet" }, 1114{ "Filter enabled","Filter angeschaltet" },
1115{ "Edit Filters","Ändere Filter" }, 1115{ "Edit Filters","Ändere Filter" },
1116{ "Print What's Next View...","Drucke What's Next Ansicht..." }, 1116{ "Print What's Next View...","Drucke What's Next Ansicht..." },
1117{ "Agenda","Agenda" }, 1117{ "Agenda","Agenda" },
1118{ " ("," (" }, 1118{ " ("," (" },
1119{ "<p><b>Due on:</b> %1</p>","<p><b>Fällig am:</b> %1</p>" }, 1119{ "<p><b>Due on:</b> %1</p>","<p><b>Fällig am:</b> %1</p>" },
1120{ "Print","Print" }, 1120{ "Print","Print" },
1121{ "&Setup Printer...","Drucker &Setup..." }, 1121{ "&Setup Printer...","Drucker &Setup..." },
1122{ "View Type","Zeige Typ" }, 1122{ "View Type","Zeige Typ" },
1123{ "Page &orientation:","Seiten Ausrichtung:" }, 1123{ "Page &orientation:","Seiten Ausrichtung:" },
1124{ "Use Default of Selected Style","Default des selektierten Stils" }, 1124{ "Use Default of Selected Style","Default des selektierten Stils" },
1125{ "Use Default Setting of Printer","Default Einstellung des Druckers" }, 1125{ "Use Default Setting of Printer","Default Einstellung des Druckers" },
1126{ "Portrait","Portrait" }, 1126{ "Portrait","Portrait" },
1127{ "Landscape","Landschaft" }, 1127{ "Landscape","Landschaft" },
1128{ "Print day","Drucke Tag" }, 1128{ "Print day","Drucke Tag" },
1129{ "CalPrintDay_Base","CalPrintDay_Base" }, 1129{ "CalPrintDay_Base","CalPrintDay_Base" },
1130{ "Date && Time Range","Datum && Zeitspanne" }, 1130{ "Date && Time Range","Datum && Zeitspanne" },
1131{ "&End date:","&Enddatum:" }, 1131{ "&End date:","&Enddatum:" },
1132{ "&Start date:","&Startdatum:" }, 1132{ "&Start date:","&Startdatum:" },
1133{ "Start &time:","Startzeit:" }, 1133{ "Start &time:","Startzeit:" },
1134{ "End ti&me:","Endzeit:" }, 1134{ "End ti&me:","Endzeit:" },
1135{ "E&xtend time range to include all events","Erweitere Zeitspanne um alle Termine einzuschliessen" }, 1135{ "E&xtend time range to include all events","Erweitere Zeitspanne um alle Termine einzuschliessen" },
1136{ "Include to&dos that are due on the printed day(s)","Inclusive To&dos, die an den selektierten Tagen fällig sind" }, 1136{ "Include to&dos that are due on the printed day(s)","Inclusive To&dos, die an den selektierten Tagen fällig sind" },
1137{ "Alt+D","Alt+D" }, 1137{ "Alt+D","Alt+D" },
1138{ "&Use colors","Nutze Farben" }, 1138{ "&Use colors","Nutze Farben" },
1139{ "Alt+U","Alt+U" }, 1139{ "Alt+U","Alt+U" },
1140{ "Print week","Drucke Woche" }, 1140{ "Print week","Drucke Woche" },
1141{ "CalPrintWeek_Base","CalPrintWeek_Base" }, 1141{ "CalPrintWeek_Base","CalPrintWeek_Base" },
1142{ "Use &colors","Nutze Farben" }, 1142{ "Use &colors","Nutze Farben" },
1143{ "Type of View","Typ der Ansicht" }, 1143{ "Type of View","Typ der Ansicht" },
1144{ "Print as &Filofax page","Drucke als &Filofax Seite" }, 1144{ "Print as &Filofax page","Drucke als &Filofax Seite" },
1145{ "Alt+F","Alt+F" }, 1145{ "Alt+F","Alt+F" },
1146{ "Print as &timetable view:","Drucke als Zeittabelle:" }, 1146{ "Print as &timetable view:","Drucke als Zeittabelle:" },
1147{ "Alt+T","Alt+T" }, 1147{ "Alt+T","Alt+T" },
1148{ "Print as split week view","Drucke als gesplittete Wochenansicht" }, 1148{ "Print as split week view","Drucke als gesplittete Wochenansicht" },
1149{ "Print month","Drucke Monat" }, 1149{ "Print month","Drucke Monat" },
1150{ "CalPrintMonth_Base","CalPrintMonth_Base" }, 1150{ "CalPrintMonth_Base","CalPrintMonth_Base" },
1151{ "&Start month:","&Startmonat:" }, 1151{ "&Start month:","&Startmonat:" },
1152{ "&End month:","&Endmonat:" }, 1152{ "&End month:","&Endmonat:" },
1153{ "Print week &numbers","Drucke Wochen Nummer(n)" }, 1153{ "Print week &numbers","Drucke Wochen Nummer(n)" },
1154{ "Print todos","Drucke Todos" }, 1154{ "Print todos","Drucke Todos" },
1155{ "CalPrintTodoConfig_Base","CalPrintTodoConfig_Base" }, 1155{ "CalPrintTodoConfig_Base","CalPrintTodoConfig_Base" },
1156{ "Include &description of the item","Inclusive Itembeschreibung" }, 1156{ "Include &description of the item","Inclusive Itembeschreibung" },
1157{ "Include d&ue date of the item","Inclusive Fälligkeitsdatum des Items" }, 1157{ "Include d&ue date of the item","Inclusive Fälligkeitsdatum des Items" },
1158{ "Include &priority of the item","Inclusive Priorität des Items" }, 1158{ "Include &priority of the item","Inclusive Priorität des Items" },
1159{ "Items to Print","Zu druckende Items" }, 1159{ "Items to Print","Zu druckende Items" },
1160{ "&From:","Von:" }, 1160{ "&From:","Von:" },
1161{ "&To:","Bis:" }, 1161{ "&To:","Bis:" },
1162{ "Print &all todo items","Drucke alle Todo Items" }, 1162{ "Print &all todo items","Drucke alle Todo Items" },
1163{ "Print only &uncompleted items","Drucke nur nicht erledigte Todos" }, 1163{ "Print only &uncompleted items","Drucke nur nicht erledigte Todos" },
1164{ "Only items due in the &range:","Nur Items in dem Zeitraum:" }, 1164{ "Only items due in the &range:","Nur Items in dem Zeitraum:" },
1165{ "Todo List","Todo Liste" }, 1165{ "Todo List","Todo Liste" },
1166{ "&Title:","&Titel:" }, 1166{ "&Title:","&Titel:" },
1167{ "Co&nnect subtodos with its parent","Verbinde Unter-Todos mit ihren Ober-Todos" }, 1167{ "Co&nnect subtodos with its parent","Verbinde Unter-Todos mit ihren Ober-Todos" },
1168{ "Todo list","Todo Liste" }, 1168{ "Todo list","Todo Liste" },
1169{ "&Print...","Drucke..." }, 1169{ "&Print...","Drucke..." },
1170{ "<qt>Printing on printer <b>%1</b></qt>","<qt>Drucke auf Drucker <b>%1</b></qt>" }, 1170{ "<qt>Printing on printer <b>%1</b></qt>","<qt>Drucke auf Drucker <b>%1</b></qt>" },
1171{ "[Unconfigured]","[Unkonfiguriert]" }, 1171{ "[Unconfigured]","[Unkonfiguriert]" },
1172{ "OK","OK" }, 1172{ "OK","OK" },
1173{ "FilterEditor","FilterEditor" }, 1173{ "FilterEditor","FilterEditor" },
1174{ "Include","Inclusive" }, 1174{ "Include","Inclusive" },
1175{ "Exclude","Exclusive" }, 1175{ "Exclude","Exclusive" },
1176{ "Edit Selection...","Editiere Auswahl" }, 1176{ "Edit Selection...","Editiere Auswahl" },
1177{ "recurring events","wiederholende Termine" }, 1177{ "recurring events","wiederholende Termine" },
1178{ "recurr. events","wiederh.Termine" }, 1178{ "recurr. events","wiederh.Termine" },
1179{ "completed to-dos","erledigte Todos" }, 1179{ "completed to-dos","erledigte Todos" },
1180{ "events","Termine" }, 1180{ "events","Termine" },
1181{ "todos","Todos" }, 1181{ "todos","Todos" },
1182{ "journals","Journale" }, 1182{ "journals","Journale" },
1183{ "public","öffentl." }, 1183{ "public","öffentl." },
1184{ "private","privat" }, 1184{ "private","privat" },
1185{ "confidential","vertraul." }, 1185{ "confidential","vertraul." },
1186{ "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Unter-Todos.\nAlle erledigten Unter-Todos\nwerden auch gelöscht!" }, 1186{ "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Unter-Todos.\nAlle erledigten Unter-Todos\nwerden auch gelöscht!" },
1187{ "Yesterday","Gestern" }, 1187{ "Yesterday","Gestern" },
1188{ "Day after tomorrow","Übermorgen" }, 1188{ "Day after tomorrow","Übermorgen" },
1189{ "Tomorrow","Morgen" }, 1189{ "Tomorrow","Morgen" },
1190{ "Day before yesterday","Vorgestern" }, 1190{ "Day before yesterday","Vorgestern" },
1191{ "Size %1","Größe %1" }, 1191{ "Size %1","Größe %1" },
1192{ "New Agendasize: %1","Neue Agendagröße: %1" }, 1192{ "New Agendasize: %1","Neue Agendagröße: %1" },
1193{ " (%1 y.)"," (%1 J.)" }, 1193{ " (%1 y.)"," (%1 J.)" },
1194{ "Allday:","Ganztägig:" }, 1194{ "Allday:","Ganztägig:" },
1195{ "compl.todos","erled.Todos" }, 1195{ "compl.todos","erled.Todos" },
1196{ "Day view","Tagesansicht" }, 1196{ "Day view","Tagesansicht" },
1197{ "Next days","Nächste Tage" }, 1197{ "Next days","Nächste Tage" },
1198{ "Next week","Nächste Woche" }, 1198{ "Next week","Nächste Woche" },
1199{ "Next two weeks","Nächste zwei Wochen" }, 1199{ "Next two weeks","Nächste zwei Wochen" },
1200{ "Next month","Nächster Monat" }, 1200{ "Next month","Nächster Monat" },
1201{ "Journal view","Journal" }, 1201{ "Journal view","Journal" },
1202{ "Display all opened","Zeige alle geöffnet" }, 1202{ "Display all opened","Zeige alle geöffnet" },
1203{ "Display all closed","Zeige alle geschlossen" }, 1203{ "Display all closed","Zeige alle geschlossen" },
1204{ "Display all flat","Zeige alle flach" }, 1204{ "Display all flat","Zeige alle flach" },
1205{ "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" }, 1205{ "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" },
1206{ "Default todo done color:","Standard Todo erledigt Farbe" }, 1206{ "Default todo done color:","Standard Todo erledigt Farbe" },
1207{ "Select week %1-%2","Wähle Woche %1-%2" }, 1207{ "Select week %1-%2","Wähle Woche %1-%2" },
1208{ "Select Week","Wähle Woche" }, 1208{ "Select Week","Wähle Woche" },
1209{ "Set alarm for selected...","Setze Alarm für Selekt..." }, 1209{ "Set alarm for selected...","Setze Alarm für Selekt..." },
1210{ "Set Alarm!","Setze Alarm!" }, 1210{ "Set Alarm!","Setze Alarm!" },
1211{ "Canged alarm for %1 items","Alarm für %1 Items geändert" }, 1211{ "Canged alarm for %1 items","Alarm für %1 Items geändert" },
1212{ " and "," und " }, 1212{ " and "," und " },
1213{ "<IMG src="%1"> only )","nur <IMG src="%1"> )" }, 1213{ "<IMG src="%1"> only )","nur <IMG src="%1"> )" },
1214{ "Mail to selected","Mail an Ausgewählte" }, 1214{ "Mail to selected","Mail an Ausgewählte" },
1215{ "Mail to all","Mail an Alle" }, 1215{ "Mail to all","Mail an Alle" },
1216{ "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" }, 1216{ "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" },
1217{ "Set reminder ON with offset to:","Alarm AN mit Offset auf:" }, 1217{ "Set reminder ON with offset to:","Alarm AN mit Offset auf:" },
1218{ " on"," am" }, 1218{ " on"," am" },
1219{ " completed on "," erledigt am " }, 1219{ " completed on "," erledigt am " },
1220{ "Save as Event template","Speichere als Vorlage" }, 1220{ "Save as Event template","Speichere als Vorlage" },
1221{ "Load Event template","Lade Termin Vorlage" }, 1221{ "Load Event template","Lade Termin Vorlage" },
1222{ "Save as Journal template","Speichere als Journal Vorlage" }, 1222{ "Save as Journal template","Speichere als Journal Vorlage" },
1223{ "Insert Journal template","Füge Journal Vorlage ein" }, 1223{ "Insert Journal template","Füge Journal Vorlage ein" },
1224{ "Sub todos:<br>","Unter Todos:<br>" }, 1224{ "Sub todos:<br>","Unter Todos:<br>" },
1225{ "Parent todo:<br>","Über Todo:<br>" }, 1225{ "Parent todo:<br>","Über Todo:<br>" },
1226{ "Set current as color category","Setze Gewählte als Farbkategorie" }, 1226{ "Set current as color category","Setze Gewählte als Farbkategorie" },
1227{ " completed"," erledigt" }, 1227{ " completed"," erledigt" },
1228{ "(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.net --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!","(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi basiert auf KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) und das KDE Team.\nKOrganizer/Pi ist lizensiert unter der GPL.\nKO/Pi kann kompiliert werden für\nLinux, Zaurus-PDA und Windows\nwww.pi-sync.net --- www.korganizer.org\nBesonderen Dank an Michael und Ben\nfür intensives Testen!" }, 1228{ "(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.net --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!","(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi basiert auf KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) und das KDE Team.\nKOrganizer/Pi ist lizensiert unter der GPL.\nKO/Pi kann kompiliert werden für\nLinux, Zaurus-PDA und Windows\nwww.pi-sync.net --- www.korganizer.org\nBesonderen Dank an Michael und Ben\nfür intensives Testen!" },
1229{ "Syncing aborted. Nothing synced.","Syncing abgebrochen.Nichts wurde gesynct." }, 1229{ "Syncing aborted. Nothing synced.","Syncing abgebrochen.Nichts wurde gesynct." },
1230{ "Connected! Sending request for remote file ...","Verbunden! Sende Daten Anfrage..." }, 1230{ "Connected! Sending request for remote file ...","Verbunden! Sende Daten Anfrage..." },
1231{ "Trying to connect to remote...","Versuche mit Gegenstelle zu verbinden..." }, 1231{ "Trying to connect to remote...","Versuche mit Gegenstelle zu verbinden..." },
1232{ "Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?","Verbindungsversuch wegen\nZeitüberschreitung gescheitert!\nWurde vergessen Pi-Sync auf\nder Gegenstelle anzuschalten?" }, 1232{ "Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?","Verbindungsversuch wegen\nZeitüberschreitung gescheitert!\nWurde vergessen Pi-Sync auf\nder Gegenstelle anzuschalten?" },
1233{ "ERROR: Receiving remote file failed.","FEHLER: Empfang der entfernten Daten fehlgeschlagen." }, 1233{ "ERROR: Receiving remote file failed.","FEHLER: Empfang der entfernten Daten fehlgeschlagen." },
1234{ "Error","Fehler" }, 1234{ "Error","Fehler" },
1235{ ""You entered an invalid date!\n Date changed to current date.","Ungültiges Datum eingegeben.\nSetze heutiges Datum." }, 1235{ ""You entered an invalid date!\n Date changed to current date.","Ungültiges Datum eingegeben.\nSetze heutiges Datum." },
1236{ "You entered an invalid date!\n Will use current date instead.","Ungültiges Datum eingegeben.\nSetze stattdessen heutiges Datum." }, 1236{ "You entered an invalid date!\n Will use current date instead.","Ungültiges Datum eingegeben.\nSetze stattdessen heutiges Datum." },
1237{ "Warning","Warnung" }, 1237{ "Warning","Warnung" },
1238{ "Select week number","Wähle Wochen Nummer" }, 1238{ "Select week number","Wähle Wochen Nummer" },
1239{ "Februar","Februar" }, 1239{ "Februar","Februar" },
1240{ "Click on the week number to\nshow week zoomed","Klicke auf die Wochennummer\num die Woche groß zu zeigen" }, 1240{ "Click on the week number to\nshow week zoomed","Klicke auf die Wochennummer\num die Woche groß zu zeigen" },
1241{ "W","W" }, 1241{ "W","W" },
1242{ "Click on this to\nselect week number","Klicke hierauf um\ndie Woche auszuwählen" }, 1242{ "Click on this to\nselect week number","Klicke hierauf um\ndie Woche auszuwählen" },
1243{ "T: %1","T: %1" }, 1243{ "T: %1","T: %1" },
1244{ "Start: ","Start: " }, 1244{ "Start: ","Start: " },
1245{ "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " }, 1245{ "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " },
1246{ "Password for remote access:","Passwort für fernen Zugriff:" }, 1246{ "Password for remote access:","Passwort für fernen Zugriff:" },
1247{ "Remote IP address:","Ferne IP Adresse:" }, 1247{ "Remote IP address:","Ferne IP Adresse:" },
1248{ "Remote port number:","Ferne Port Nummer:" }, 1248{ "Remote port number:","Ferne Port Nummer:" },
1249{ "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." }, 1249{ "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." },
1250{ "Remote from: ","Fern von: " }, 1250{ "Remote from: ","Fern von: " },
1251{ "Local from: ","Lokal von: " }, 1251{ "Local from: ","Lokal von: " },
1252{ "Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n","Synchronisationsübersicht:\n\n %d lokal hinzugefügt\n %d fern hinzugefügt\n %d lokal geändert\n %d fern geändert\n %d lokal gelöscht\n %d fern gelöscht\n %d eingehende ausgefiltert\n %d ausgehende ausgefiltert\n" }, 1252{ "Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n","Synchronisationsübersicht:\n\n %d lokal hinzugefügt\n %d fern hinzugefügt\n %d lokal geändert\n %d fern geändert\n %d lokal gelöscht\n %d fern gelöscht\n %d eingehende ausgefiltert\n %d ausgehende ausgefiltert\n" },
1253{ "Local calendar changed!\n","Lokaler Kalender geändert!\n" }, 1253{ "Local calendar changed!\n","Lokaler Kalender geändert!\n" },
1254{ "Write back","Schreibe zurück" }, 1254{ "Write back","Schreibe zurück" },
1255{ "KO/Pi Synchronization","KO/Pi Synchronisation" }, 1255{ "KO/Pi Synchronization","KO/Pi Synchronisation" },
1256{ "Pi-Sync succesful!","Pi-Sync erfolgreich!" }, 1256{ "Pi-Sync succesful!","Pi-Sync erfolgreich!" },
1257{ "Received sync request","Sync Anfrage erhalten" }, 1257{ "Received sync request","Sync Anfrage erhalten" },
1258{ "Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog.","Ferne Synchronisation ...\n\nBenutze diese Anwendung nicht!\n\nWenn das Syncen fehlschlägt kann\ndieser Dialog geschlossen werden." }, 1258{ "Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog.","Ferne Synchronisation ...\n\nBenutze diese Anwendung nicht!\n\nWenn das Syncen fehlschlägt kann\ndieser Dialog geschlossen werden." },
1259{ "Saving Data to temp file ...","Speichere Daten in temp Datei..." }, 1259{ "Saving Data to temp file ...","Speichere Daten in temp Datei..." },
1260{ "Data saved to temp file!","Daten in temp Datei gespeichert!" }, 1260{ "Data saved to temp file!","Daten in temp Datei gespeichert!" },
1261{ "Sending file...","Sende Datei..." }, 1261{ "Sending file...","Sende Datei..." },
1262{ "Waiting for synced file...","Warte auf gesyncte Daten..." }, 1262{ "Waiting for synced file...","Warte auf gesyncte Daten..." },
1263{ "Receiving synced file...","Gesyncte Daten erhalten..." }, 1263{ "Receiving synced file...","Gesyncte Daten erhalten..." },
1264{ "Received %1 bytes","%1 Bytes erhalten" }, 1264{ "Received %1 bytes","%1 Bytes erhalten" },
1265{ "Writing file to disk...","Speichere Datei..." }, 1265{ "Writing file to disk...","Speichere Datei..." },
1266{ "Pi-Sync successful!","Pi-Sync erfolgreich!" }, 1266{ "Pi-Sync successful!","Pi-Sync erfolgreich!" },
1267{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" }, 1267{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" },
1268{ "Synchronize!","Synchronisiere!" }, 1268{ "Synchronize!","Synchronisiere!" },
1269{ "High clock skew!","Großer Uhrzeitunterschied!" }, 1269{ "High clock skew!","Großer Uhrzeitunterschied!" },
1270{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" }, 1270{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" },
1271{ "The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!","Die Uhren der syncenden Geräte\nhaben einen Unterschied von\nmehr als 5 Minuten. Bitte die\nUhrzeiten anpassen. Sie können\nfalsche Sync-Resultate erhalten!\nBitte das Syncen bestätigen!" }, 1271{ "The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!","Die Uhren der syncenden Geräte\nhaben einen Unterschied von\nmehr als 5 Minuten. Bitte die\nUhrzeiten anpassen. Sie können\nfalsche Sync-Resultate erhalten!\nBitte das Syncen bestätigen!" },
1272{ "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." }, 1272{ "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." },
1273{ "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" }, 1273{ "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" },
1274{ "List week view","Listenwochenansicht" }, 1274{ "List week view","Listenwochenansicht" },
1275{ "List week","Listenwochenansicht" }, 1275{ "List week","Listenwochenansicht" },
1276{ "Next Week","Nächste Woche" }, 1276{ "Next Week","Nächste Woche" },
1277{ "Previous Week","Vorherige Woche" }, 1277{ "Previous Week","Vorherige Woche" },
1278{ "No items were found matching\nyour search expression.\nUse the wildcard characters\n'*' and '?' where needed.","Keine Einträge gefunden die\ndem Suchausdruck entsprechen.\nBenutze Platzhalter Zeichen\n'*' und '?' wo benötigt." }, 1278{ "No items were found matching\nyour search expression.\nUse the wildcard characters\n'*' and '?' where needed.","Keine Einträge gefunden die\ndem Suchausdruck entsprechen.\nBenutze Platzhalter Zeichen\n'*' und '?' wo benötigt." },
1279{ "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" }, 1279{ "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" },
1280{ "Details","Details" }, 1280{ "Details","Details" },
1281{ "Created time","Erstellt Zeit" }, 1281{ "Created time","Erstellt Zeit" },
1282{ "Last modified time","Geändert Zeit" }, 1282{ "Last modified time","Geändert Zeit" },
1283{ "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" }, 1283{ "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" },
1284{ "View Options","Anzeige Optionen" }, 1284{ "View Options","Anzeige Optionen" },
1285{ "<b>Created: ","<b>Erstellt am: " }, 1285{ "<b>Created: ","<b>Erstellt am: " },
1286{ "<b>Last modified: ","<b>Zuletzt geändert am: " }, 1286{ "<b>Last modified: ","<b>Zuletzt geändert am: " },
1287{ "Journal: ","Journal: " },
1288{ "yearly","jährlich" },
1289{ "(%1) ","%1-" },
1290{ "","" },
1291{ "","" },
1292{ "","" },
1293{ "","" },
1294{ "","" },
1287{ "","" }, 1295{ "","" },
1288{ "","" }, 1296{ "","" },
1289{ "","" }, 1297{ "","" },
1290{ "","" }, 1298{ "","" },
1291{ "","" }, 1299{ "","" },
1292 1300
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 1f5afc0..4a6e17d 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -1,1186 +1,1186 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 1999 Preston Brown 3 Copyright (c) 1999 Preston Brown
4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qlistview.h> 25#include <qlistview.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qpopupmenu.h> 28#include <qpopupmenu.h>
29#include <qprogressbar.h> 29#include <qprogressbar.h>
30#include <qfileinfo.h> 30#include <qfileinfo.h>
31#include <qmessagebox.h> 31#include <qmessagebox.h>
32#include <qdialog.h> 32#include <qdialog.h>
33#include <qtextstream.h> 33#include <qtextstream.h>
34#include <qdir.h> 34#include <qdir.h>
35#include <qwhatsthis.h> 35#include <qwhatsthis.h>
36#include <qregexp.h> 36#include <qregexp.h>
37 37
38#include <klocale.h> 38#include <klocale.h>
39#include <kdebug.h> 39#include <kdebug.h>
40#include <kiconloader.h> 40#include <kiconloader.h>
41#include <kglobal.h> 41#include <kglobal.h>
42 42
43#include <libkdepim/kpimglobalprefs.h> 43#include <libkdepim/kpimglobalprefs.h>
44#include <libkcal/calendar.h> 44#include <libkcal/calendar.h>
45#include <libkcal/calendarlocal.h> 45#include <libkcal/calendarlocal.h>
46#include <libkcal/icalformat.h> 46#include <libkcal/icalformat.h>
47#include <libkcal/vcalformat.h> 47#include <libkcal/vcalformat.h>
48#include <libkcal/recurrence.h> 48#include <libkcal/recurrence.h>
49#include <libkcal/filestorage.h> 49#include <libkcal/filestorage.h>
50#include <libkdepim/categoryselectdialog.h> 50#include <libkdepim/categoryselectdialog.h>
51#include <libkcal/kincidenceformatter.h> 51#include <libkcal/kincidenceformatter.h>
52#ifndef DESKTOP_VERSION 52#ifndef DESKTOP_VERSION
53#include <qpe/qpeapplication.h> 53#include <qpe/qpeapplication.h>
54#else 54#else
55#include <qapplication.h> 55#include <qapplication.h>
56#endif 56#endif
57 57
58#ifndef KORG_NOPRINTER 58#ifndef KORG_NOPRINTER
59#include "calprinter.h" 59#include "calprinter.h"
60#endif 60#endif
61#include "koglobals.h" 61#include "koglobals.h"
62#include "koprefs.h" 62#include "koprefs.h"
63#include "kfiledialog.h" 63#include "kfiledialog.h"
64 64
65#include "kolistview.h" 65#include "kolistview.h"
66 66
67 67
68 68
69 69
70class KOListViewWhatsThis :public QWhatsThis 70class KOListViewWhatsThis :public QWhatsThis
71{ 71{
72public: 72public:
73 KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; 73 KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { };
74 74
75protected: 75protected:
76 virtual QString text( const QPoint& p) 76 virtual QString text( const QPoint& p)
77 { 77 {
78 return _view->getWhatsThisText(p) ; 78 return _view->getWhatsThisText(p) ;
79 } 79 }
80private: 80private:
81 QWidget* _wid; 81 QWidget* _wid;
82 KOListView * _view; 82 KOListView * _view;
83}; 83};
84 84
85 85
86ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) 86ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date )
87{ 87{
88 mItem = item; 88 mItem = item;
89 mDate = date; 89 mDate = date;
90} 90}
91 91
92ListItemVisitor::~ListItemVisitor() 92ListItemVisitor::~ListItemVisitor()
93{ 93{
94} 94}
95 95
96bool ListItemVisitor::visit(Event *e) 96bool ListItemVisitor::visit(Event *e)
97{ 97{
98 98
99 bool ok = false; 99 bool ok = false;
100 QString start, end; 100 QString start, end;
101 QDate ds, de; 101 QDate ds, de;
102 if ( e->doesRecur() ) { 102 if ( e->doesRecur() ) {
103 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); 103 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date();
104 if ( ok ) { 104 if ( ok ) {
105 int days = e->dtStart().date().daysTo(e->dtEnd().date() ); 105 int days = e->dtStart().date().daysTo(e->dtEnd().date() );
106 start = KGlobal::locale()->formatDate(ds,true); 106 start = KGlobal::locale()->formatDate(ds,true);
107 de = ds.addDays( days); 107 de = ds.addDays( days);
108 end = KGlobal::locale()->formatDate(de,true); 108 end = KGlobal::locale()->formatDate(de,true);
109 } 109 }
110 110
111 } 111 }
112 if ( ! ok ) { 112 if ( ! ok ) {
113 start =e->dtStartDateStr(); 113 start =e->dtStartDateStr();
114 end = e->dtEndDateStr(); 114 end = e->dtEndDateStr();
115 ds = e->dtStart().date(); 115 ds = e->dtStart().date();
116 de = e->dtEnd().date(); 116 de = e->dtEnd().date();
117 } 117 }
118 mItem->setText(0,e->summary()); 118 mItem->setText(0,e->summary());
119 mItem->setText(1,start); 119 mItem->setText(1,start);
120 mItem->setText(2,e->dtStartTimeStr()); 120 mItem->setText(2,e->dtStartTimeStr());
121 mItem->setText(3,end); 121 mItem->setText(3,end);
122 mItem->setText(4,e->dtEndTimeStr()); 122 mItem->setText(4,e->dtEndTimeStr());
123 mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No")); 123 mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No"));
124 mItem->setText(6, e->recurrence()->recurrenceText()); 124 mItem->setText(6, e->recurrence()->recurrenceText());
125 mItem->setText(7,"---"); 125 mItem->setText(7,"---");
126 mItem->setText(8,"---"); 126 mItem->setText(8,"---");
127 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); 127 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No"));
128 mItem->setText(10,e->categoriesStr()); 128 mItem->setText(10,e->categoriesStr());
129 129
130 QString key; 130 QString key;
131 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); 131 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time();
132 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); 132 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute());
133 mItem->setSortKey(1,key); 133 mItem->setSortKey(1,key);
134 134
135 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); 135 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time();
136 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); 136 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute());
137 mItem->setSortKey(3,key); 137 mItem->setSortKey(3,key);
138 138
139 return true; 139 return true;
140} 140}
141 141
142bool ListItemVisitor::visit(Todo *t) 142bool ListItemVisitor::visit(Todo *t)
143{ 143{
144 mItem->setText(0,i18n("To-Do: %1").arg(t->summary())); 144 mItem->setText(0,i18n("Todo: %1").arg(t->summary()));
145 if (t->hasStartDate()) { 145 if (t->hasStartDate()) {
146 mItem->setText(1,t->dtStartDateStr()); 146 mItem->setText(1,t->dtStartDateStr());
147 if (t->doesFloat()) { 147 if (t->doesFloat()) {
148 mItem->setText(2,"---"); 148 mItem->setText(2,"---");
149 } else { 149 } else {
150 mItem->setText(2,t->dtStartTimeStr()); 150 mItem->setText(2,t->dtStartTimeStr());
151 } 151 }
152 } else { 152 } else {
153 mItem->setText(1,"---"); 153 mItem->setText(1,"---");
154 mItem->setText(2,"---"); 154 mItem->setText(2,"---");
155 } 155 }
156 mItem->setText(3,"---"); 156 mItem->setText(3,"---");
157 mItem->setText(4,"---"); 157 mItem->setText(4,"---");
158 mItem->setText(5,t->isAlarmEnabled() ? i18n("Yes") : i18n("No")); 158 mItem->setText(5,t->isAlarmEnabled() ? i18n("Yes") : i18n("No"));
159 mItem->setText(6, t->recurrence()->recurrenceText()); 159 mItem->setText(6, t->recurrence()->recurrenceText());
160 if (t->hasDueDate()) { 160 if (t->hasDueDate()) {
161 mItem->setText(7,t->dtDueDateStr()); 161 mItem->setText(7,t->dtDueDateStr());
162 if (t->doesFloat()) { 162 if (t->doesFloat()) {
163 mItem->setText(8,"---"); 163 mItem->setText(8,"---");
164 } else { 164 } else {
165 mItem->setText(8,t->dtDueTimeStr()); 165 mItem->setText(8,t->dtDueTimeStr());
166 } 166 }
167 } else { 167 } else {
168 mItem->setText(7,"---"); 168 mItem->setText(7,"---");
169 mItem->setText(8,"---"); 169 mItem->setText(8,"---");
170 } 170 }
171 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); 171 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No"));
172 mItem->setText(10,t->categoriesStr()); 172 mItem->setText(10,t->categoriesStr());
173 173
174 QString key; 174 QString key;
175 QDate d; 175 QDate d;
176 if (t->hasDueDate()) { 176 if (t->hasDueDate()) {
177 d = t->dtDue().date(); 177 d = t->dtDue().date();
178 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); 178 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time();
179 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 179 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
180 mItem->setSortKey(7,key); 180 mItem->setSortKey(7,key);
181 } 181 }
182 if ( t->hasStartDate() ) { 182 if ( t->hasStartDate() ) {
183 d = t->dtStart().date(); 183 d = t->dtStart().date();
184 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); 184 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time();
185 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 185 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
186 mItem->setSortKey(1,key); 186 mItem->setSortKey(1,key);
187 } 187 }
188 return true; 188 return true;
189} 189}
190 190
191bool ListItemVisitor::visit(Journal * j) 191bool ListItemVisitor::visit(Journal * j)
192{ 192{
193 QString des = j->description().left(50); 193 QString des = j->description().left(30);
194 des = des.simplifyWhiteSpace (); 194 des = des.simplifyWhiteSpace ();
195 des.replace (QRegExp ("\\n"),"" ); 195 des.replace (QRegExp ("\\n"),"" );
196 des.replace (QRegExp ("\\r"),"" ); 196 des.replace (QRegExp ("\\r"),"" );
197 mItem->setText(0,i18n("Journal")+": "+des.left(25)); 197 mItem->setText(0,i18n("Journal: ")+des.left(25));
198 mItem->setText(1,j->dtStartDateStr()); 198 mItem->setText(1,j->dtStartDateStr());
199 mItem->setText(2,"---"); 199 mItem->setText(2,"---");
200 mItem->setText(3,"---"); 200 mItem->setText(3,"---");
201 mItem->setText(4,"---"); 201 mItem->setText(4,"---");
202 mItem->setText(5,"---"); 202 mItem->setText(5,"---");
203 mItem->setText(6,"---"); 203 mItem->setText(6,"---");
204 mItem->setText(7,j->dtStartDateStr()); 204 mItem->setText(7,j->dtStartDateStr());
205 mItem->setText(8,"---"); 205 mItem->setText(8,"---");
206 mItem->setText(9,"---"); 206 mItem->setText(9,"---");
207 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); 207 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) );
208 208
209 QString key; 209 QString key;
210 QDate d = j->dtStart().date(); 210 QDate d = j->dtStart().date();
211 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 211 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
212 mItem->setSortKey(1,key); 212 mItem->setSortKey(1,key);
213 mItem->setSortKey(7,key); 213 mItem->setSortKey(7,key);
214 214
215 return true; 215 return true;
216} 216}
217 217
218KOListView::KOListView(Calendar *calendar, QWidget *parent, 218KOListView::KOListView(Calendar *calendar, QWidget *parent,
219 const char *name) 219 const char *name)
220 : KOEventView(calendar, parent, name) 220 : KOEventView(calendar, parent, name)
221{ 221{
222 mActiveItem = 0; 222 mActiveItem = 0;
223 mListView = new KOListViewListView(this); 223 mListView = new KOListViewListView(this);
224 mListView->addColumn(i18n("Summary")); 224 mListView->addColumn(i18n("Summary"));
225 mListView->addColumn(i18n("Start Date")); 225 mListView->addColumn(i18n("Start Date"));
226 mListView->addColumn(i18n("Start Time")); 226 mListView->addColumn(i18n("Start Time"));
227 mListView->addColumn(i18n("End Date")); 227 mListView->addColumn(i18n("End Date"));
228 mListView->addColumn(i18n("End Time")); 228 mListView->addColumn(i18n("End Time"));
229 mListView->addColumn(i18n("Alarm")); // alarm set? 229 mListView->addColumn(i18n("Alarm")); // alarm set?
230 mListView->addColumn(i18n("Recurs")); // recurs? 230 mListView->addColumn(i18n("Recurs")); // recurs?
231 mListView->addColumn(i18n("Due Date")); 231 mListView->addColumn(i18n("Due Date"));
232 mListView->addColumn(i18n("Due Time")); 232 mListView->addColumn(i18n("Due Time"));
233 mListView->addColumn(i18n("Cancelled")); 233 mListView->addColumn(i18n("Cancelled"));
234 mListView->addColumn(i18n("Categories")); 234 mListView->addColumn(i18n("Categories"));
235 235
236 mListView->setColumnAlignment(0,AlignLeft); 236 mListView->setColumnAlignment(0,AlignLeft);
237 mListView->setColumnAlignment(1,AlignLeft); 237 mListView->setColumnAlignment(1,AlignLeft);
238 mListView->setColumnAlignment(2,AlignHCenter); 238 mListView->setColumnAlignment(2,AlignHCenter);
239 mListView->setColumnAlignment(3,AlignLeft); 239 mListView->setColumnAlignment(3,AlignLeft);
240 mListView->setColumnAlignment(4,AlignHCenter); 240 mListView->setColumnAlignment(4,AlignHCenter);
241 mListView->setColumnAlignment(5,AlignLeft); 241 mListView->setColumnAlignment(5,AlignLeft);
242 mListView->setColumnAlignment(6,AlignLeft); 242 mListView->setColumnAlignment(6,AlignLeft);
243 mListView->setColumnAlignment(7,AlignLeft); 243 mListView->setColumnAlignment(7,AlignLeft);
244 mListView->setColumnAlignment(8,AlignLeft); 244 mListView->setColumnAlignment(8,AlignLeft);
245 mListView->setColumnAlignment(9,AlignLeft); 245 mListView->setColumnAlignment(9,AlignLeft);
246 mListView->setColumnAlignment(10,AlignLeft); 246 mListView->setColumnAlignment(10,AlignLeft);
247 mListView->setColumnWidthMode(10, QListView::Manual); 247 mListView->setColumnWidthMode(10, QListView::Manual);
248 new KOListViewWhatsThis(mListView->viewport(),this); 248 new KOListViewWhatsThis(mListView->viewport(),this);
249 249
250 int iii = 0; 250 int iii = 0;
251 for ( iii = 0; iii< 10 ; ++iii ) 251 for ( iii = 0; iii< 10 ; ++iii )
252 mListView->setColumnWidthMode( iii, QListView::Manual ); 252 mListView->setColumnWidthMode( iii, QListView::Manual );
253 253
254 QBoxLayout *layoutTop = new QVBoxLayout(this); 254 QBoxLayout *layoutTop = new QVBoxLayout(this);
255 layoutTop->addWidget(mListView); 255 layoutTop->addWidget(mListView);
256 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 256 mListView->setFont ( KOPrefs::instance()->mListViewFont );
257 mPopupMenu = eventPopup(); 257 mPopupMenu = eventPopup();
258 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 258 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
259 i18n("Select all"),this, 259 i18n("Select all"),this,
260 SLOT(allSelection()),true); 260 SLOT(allSelection()),true);
261 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 261 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
262 i18n("Deselect all"),this, 262 i18n("Deselect all"),this,
263 SLOT(clearSelection()),true); 263 SLOT(clearSelection()),true);
264 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 264 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
265 i18n("Delete all selected"),this, 265 i18n("Delete all selected"),this,
266 SLOT(deleteAll()),true); 266 SLOT(deleteAll()),true);
267 mPopupMenu->insertSeparator(); 267 mPopupMenu->insertSeparator();
268 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 268 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
269 i18n("Save selected to file..."),this, 269 i18n("Save selected to file..."),this,
270 SLOT(saveToFile()),true); 270 SLOT(saveToFile()),true);
271 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 271 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
272 i18n("Save Journal/Description..."),this, 272 i18n("Save Journal/Description..."),this,
273 SLOT(saveDescriptionToFile()),true); 273 SLOT(saveDescriptionToFile()),true);
274 // mPopupMenu->insertSeparator(); 274 // mPopupMenu->insertSeparator();
275 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 275 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
276 i18n("Add Categ. to selected..."),this, 276 i18n("Add Categ. to selected..."),this,
277 SLOT(addCat()),true); 277 SLOT(addCat()),true);
278 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 278 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
279 i18n("Set Categ. for selected..."),this, 279 i18n("Set Categ. for selected..."),this,
280 SLOT(setCat()),true); 280 SLOT(setCat()),true);
281 //mPopupMenu->insertSeparator(); 281 //mPopupMenu->insertSeparator();
282 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 282 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
283 i18n("Set alarm for selected..."),this, 283 i18n("Set alarm for selected..."),this,
284 SLOT(setAlarm()),true); 284 SLOT(setAlarm()),true);
285 285
286 286
287#ifndef DESKTOP_VERSION 287#ifndef DESKTOP_VERSION
288 mPopupMenu->insertSeparator(); 288 mPopupMenu->insertSeparator();
289 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 289 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
290 i18n("Beam selected via IR"),this, 290 i18n("Beam selected via IR"),this,
291 SLOT(beamSelected()),true); 291 SLOT(beamSelected()),true);
292#endif 292#endif
293 /* 293 /*
294 mPopupMenu = new QPopupMenu; 294 mPopupMenu = new QPopupMenu;
295 mPopupMenu->insertItem(i18n("Edit Event"), this, 295 mPopupMenu->insertItem(i18n("Edit Event"), this,
296 SLOT (editEvent())); 296 SLOT (editEvent()));
297 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, 297 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
298 SLOT (deleteEvent())); 298 SLOT (deleteEvent()));
299 mPopupMenu->insertSeparator(); 299 mPopupMenu->insertSeparator();
300 mPopupMenu->insertItem(i18n("Show Dates"), this, 300 mPopupMenu->insertItem(i18n("Show Dates"), this,
301 SLOT(showDates())); 301 SLOT(showDates()));
302 mPopupMenu->insertItem(i18n("Hide Dates"), this, 302 mPopupMenu->insertItem(i18n("Hide Dates"), this,
303 SLOT(hideDates())); 303 SLOT(hideDates()));
304 */ 304 */
305 QObject::connect(mListView,SIGNAL( newEvent()), 305 QObject::connect(mListView,SIGNAL( newEvent()),
306 this,SIGNAL(signalNewEvent())); 306 this,SIGNAL(signalNewEvent()));
307 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), 307 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
308 this,SLOT(defaultItemAction(QListViewItem *))); 308 this,SLOT(defaultItemAction(QListViewItem *)));
309 QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *, 309 QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *,
310 const QPoint &, int )), 310 const QPoint &, int )),
311 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 311 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
312 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 312 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
313 SLOT(processSelectionChange(QListViewItem *))); 313 SLOT(processSelectionChange(QListViewItem *)));
314 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 314 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
315 SIGNAL(showIncidenceSignal(Incidence *)) ); 315 SIGNAL(showIncidenceSignal(Incidence *)) );
316 316
317 readSettings(KOGlobals::config(),"KOListView Layout"); 317 readSettings(KOGlobals::config(),"KOListView Layout");
318} 318}
319 319
320KOListView::~KOListView() 320KOListView::~KOListView()
321{ 321{
322 delete mPopupMenu; 322 delete mPopupMenu;
323} 323}
324QString KOListView::getWhatsThisText(QPoint p) 324QString KOListView::getWhatsThisText(QPoint p)
325{ 325{
326 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); 326 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
327 if ( item ) 327 if ( item )
328 return KIncidenceFormatter::instance()->getFormattedText( item->data(), 328 return KIncidenceFormatter::instance()->getFormattedText( item->data(),
329 KOPrefs::instance()->mWTshowDetails, 329 KOPrefs::instance()->mWTshowDetails,
330 KOPrefs::instance()->mWTshowCreated, 330 KOPrefs::instance()->mWTshowCreated,
331 KOPrefs::instance()->mWTshowChanged); 331 KOPrefs::instance()->mWTshowChanged);
332 return i18n("That is the list view" ); 332 return i18n("That is the list view" );
333 333
334} 334}
335 335
336void KOListView::updateList() 336void KOListView::updateList()
337{ 337{
338 // qDebug(" KOListView::updateList() "); 338 // qDebug(" KOListView::updateList() ");
339 339
340} 340}
341 341
342void KOListView::addCat( ) 342void KOListView::addCat( )
343{ 343{
344 setCategories( false ); 344 setCategories( false );
345} 345}
346void KOListView::setCat() 346void KOListView::setCat()
347{ 347{
348 setCategories( true ); 348 setCategories( true );
349} 349}
350void KOListView::setAlarm() 350void KOListView::setAlarm()
351{ 351{
352 KOAlarmPrefs kap( this); 352 KOAlarmPrefs kap( this);
353 if ( !kap.exec() ) 353 if ( !kap.exec() )
354 return; 354 return;
355 355
356 356
357 QStringList itemList; 357 QStringList itemList;
358 QPtrList<KOListViewItem> sel ; 358 QPtrList<KOListViewItem> sel ;
359 QListViewItem *qitem = mListView->firstChild (); 359 QListViewItem *qitem = mListView->firstChild ();
360 while ( qitem ) { 360 while ( qitem ) {
361 if ( qitem->isSelected() ) { 361 if ( qitem->isSelected() ) {
362 Incidence* inc = ((KOListViewItem *) qitem)->data(); 362 Incidence* inc = ((KOListViewItem *) qitem)->data();
363 if ( inc->type() != "Journal" ) { 363 if ( inc->type() != "Journal" ) {
364 if ( inc->type() == "Todo" ) { 364 if ( inc->type() == "Todo" ) {
365 if ( ((Todo*)inc)->hasDueDate() ) 365 if ( ((Todo*)inc)->hasDueDate() )
366 sel.append(((KOListViewItem *)qitem)); 366 sel.append(((KOListViewItem *)qitem));
367 } else 367 } else
368 sel.append(((KOListViewItem *)qitem)); 368 sel.append(((KOListViewItem *)qitem));
369 } 369 }
370 } 370 }
371 qitem = qitem->nextSibling(); 371 qitem = qitem->nextSibling();
372 } 372 }
373 int count = 0; 373 int count = 0;
374 KOListViewItem * item, *temp; 374 KOListViewItem * item, *temp;
375 item = sel.first(); 375 item = sel.first();
376 Incidence* inc; 376 Incidence* inc;
377 while ( item ) { 377 while ( item ) {
378 inc = item->data(); 378 inc = item->data();
379 ++count; 379 ++count;
380 if (kap.mAlarmButton->isChecked()) { 380 if (kap.mAlarmButton->isChecked()) {
381 if (inc->alarms().count() == 0) 381 if (inc->alarms().count() == 0)
382 inc->newAlarm(); 382 inc->newAlarm();
383 QPtrList<Alarm> alarms = inc->alarms(); 383 QPtrList<Alarm> alarms = inc->alarms();
384 Alarm *alarm; 384 Alarm *alarm;
385 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { 385 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
386 alarm->setEnabled(true); 386 alarm->setEnabled(true);
387 int j = kap.mAlarmTimeEdit->value()* -60; 387 int j = kap.mAlarmTimeEdit->value()* -60;
388 if (kap.mAlarmIncrCombo->currentItem() == 1) 388 if (kap.mAlarmIncrCombo->currentItem() == 1)
389 j = j * 60; 389 j = j * 60;
390 else if (kap.mAlarmIncrCombo->currentItem() == 2) 390 else if (kap.mAlarmIncrCombo->currentItem() == 2)
391 j = j * (60 * 24); 391 j = j * (60 * 24);
392 alarm->setStartOffset( j ); 392 alarm->setStartOffset( j );
393 393
394 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { 394 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) {
395 alarm->setProcedureAlarm(kap.mAlarmProgram); 395 alarm->setProcedureAlarm(kap.mAlarmProgram);
396 } 396 }
397 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) 397 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn())
398 alarm->setAudioAlarm(kap.mAlarmSound); 398 alarm->setAudioAlarm(kap.mAlarmSound);
399 else 399 else
400 alarm->setType(Alarm::Invalid); 400 alarm->setType(Alarm::Invalid);
401 //alarm->setAudioAlarm("default"); 401 //alarm->setAudioAlarm("default");
402 // TODO: Deal with multiple alarms 402 // TODO: Deal with multiple alarms
403 break; // For now, stop after the first alarm 403 break; // For now, stop after the first alarm
404 } 404 }
405 } else { 405 } else {
406 Alarm* alarm = inc->alarms().first(); 406 Alarm* alarm = inc->alarms().first();
407 if ( alarm ) { 407 if ( alarm ) {
408 alarm->setEnabled(false); 408 alarm->setEnabled(false);
409 alarm->setType(Alarm::Invalid); 409 alarm->setType(Alarm::Invalid);
410 } 410 }
411 } 411 }
412 temp = item; 412 temp = item;
413 item = sel.next(); 413 item = sel.next();
414 mUidDict.remove( inc->uid() ); 414 mUidDict.remove( inc->uid() );
415 delete temp;; 415 delete temp;;
416 addIncidence( inc ); 416 addIncidence( inc );
417 } 417 }
418 topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) ); 418 topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) );
419 qDebug("KO: Set alarm for %d items", count); 419 qDebug("KO: Set alarm for %d items", count);
420 calendar()->reInitAlarmSettings(); 420 calendar()->reInitAlarmSettings();
421} 421}
422void KOListView::setCategories( bool removeOld ) 422void KOListView::setCategories( bool removeOld )
423{ 423{
424 424
425 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 425 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
426 if (! csd->exec()) { 426 if (! csd->exec()) {
427 delete csd; 427 delete csd;
428 return; 428 return;
429 } 429 }
430 QStringList catList = csd->selectedCategories(); 430 QStringList catList = csd->selectedCategories();
431 delete csd; 431 delete csd;
432 // if ( catList.count() == 0 ) 432 // if ( catList.count() == 0 )
433 // return; 433 // return;
434 catList.sort(); 434 catList.sort();
435 QString categoriesStr = catList.join(","); 435 QString categoriesStr = catList.join(",");
436 int i; 436 int i;
437 QStringList itemList; 437 QStringList itemList;
438 QPtrList<KOListViewItem> sel ; 438 QPtrList<KOListViewItem> sel ;
439 QListViewItem *qitem = mListView->firstChild (); 439 QListViewItem *qitem = mListView->firstChild ();
440 while ( qitem ) { 440 while ( qitem ) {
441 if ( qitem->isSelected() ) { 441 if ( qitem->isSelected() ) {
442 sel.append(((KOListViewItem *)qitem)); 442 sel.append(((KOListViewItem *)qitem));
443 } 443 }
444 qitem = qitem->nextSibling(); 444 qitem = qitem->nextSibling();
445 } 445 }
446 KOListViewItem * item, *temp; 446 KOListViewItem * item, *temp;
447 item = sel.first(); 447 item = sel.first();
448 Incidence* inc; 448 Incidence* inc;
449 while ( item ) { 449 while ( item ) {
450 inc = item->data(); 450 inc = item->data();
451 if ( removeOld ) { 451 if ( removeOld ) {
452 inc->setCategories( categoriesStr ); 452 inc->setCategories( categoriesStr );
453 } else { 453 } else {
454 itemList = QStringList::split (",", inc->categoriesStr() ); 454 itemList = QStringList::split (",", inc->categoriesStr() );
455 for( i = 0; i< catList.count(); ++i ) { 455 for( i = 0; i< catList.count(); ++i ) {
456 if ( !itemList.contains (catList[i])) 456 if ( !itemList.contains (catList[i]))
457 itemList.append( catList[i] ); 457 itemList.append( catList[i] );
458 } 458 }
459 itemList.sort(); 459 itemList.sort();
460 inc->setCategories( itemList.join(",") ); 460 inc->setCategories( itemList.join(",") );
461 } 461 }
462 temp = item; 462 temp = item;
463 item = sel.next(); 463 item = sel.next();
464 mUidDict.remove( inc->uid() ); 464 mUidDict.remove( inc->uid() );
465 delete temp;; 465 delete temp;;
466 addIncidence( inc ); 466 addIncidence( inc );
467 } 467 }
468} 468}
469 469
470void KOListView::beamSelected() 470void KOListView::beamSelected()
471{ 471{
472 int icount = 0; 472 int icount = 0;
473 QPtrList<Incidence> delSel ; 473 QPtrList<Incidence> delSel ;
474 QListViewItem *item = mListView->firstChild (); 474 QListViewItem *item = mListView->firstChild ();
475 while ( item ) { 475 while ( item ) {
476 if ( item->isSelected() ) { 476 if ( item->isSelected() ) {
477 delSel.append(((KOListViewItem *)item)->data()); 477 delSel.append(((KOListViewItem *)item)->data());
478 ++icount; 478 ++icount;
479 } 479 }
480 480
481 item = item->nextSibling(); 481 item = item->nextSibling();
482 } 482 }
483 if ( icount ) { 483 if ( icount ) {
484 emit beamIncidenceList( delSel ); 484 emit beamIncidenceList( delSel );
485 return; 485 return;
486 QString fn ; 486 QString fn ;
487 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; 487 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs";
488 QString mes; 488 QString mes;
489 bool createbup = true; 489 bool createbup = true;
490 if ( createbup ) { 490 if ( createbup ) {
491 QString description = "\n"; 491 QString description = "\n";
492 CalendarLocal* cal = new CalendarLocal(); 492 CalendarLocal* cal = new CalendarLocal();
493 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 493 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
494 Incidence *incidence = delSel.first(); 494 Incidence *incidence = delSel.first();
495 while ( incidence ) { 495 while ( incidence ) {
496 Incidence *in = incidence->clone(); 496 Incidence *in = incidence->clone();
497 description += in->summary() + "\n"; 497 description += in->summary() + "\n";
498 cal->addIncidence( in ); 498 cal->addIncidence( in );
499 incidence = delSel.next(); 499 incidence = delSel.next();
500 } 500 }
501 FileStorage storage( cal, fn, new VCalFormat ); 501 FileStorage storage( cal, fn, new VCalFormat );
502 storage.save(); 502 storage.save();
503 delete cal; 503 delete cal;
504 mes = i18n("KO/Pi: Ready for beaming"); 504 mes = i18n("KO/Pi: Ready for beaming");
505 topLevelWidget()->setCaption(mes); 505 topLevelWidget()->setCaption(mes);
506 506
507#ifndef DESKTOP_VERSION 507#ifndef DESKTOP_VERSION
508 Ir *ir = new Ir( this ); 508 Ir *ir = new Ir( this );
509 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 509 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
510 ir->send( fn, description, "text/x-vCalendar" ); 510 ir->send( fn, description, "text/x-vCalendar" );
511#endif 511#endif
512 } 512 }
513 } 513 }
514} 514}
515void KOListView::beamDone( Ir *ir ) 515void KOListView::beamDone( Ir *ir )
516{ 516{
517#ifndef DESKTOP_VERSION 517#ifndef DESKTOP_VERSION
518 delete ir; 518 delete ir;
519#endif 519#endif
520 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); 520 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done"));
521} 521}
522 522
523void KOListView::saveDescriptionToFile() 523void KOListView::saveDescriptionToFile()
524{ 524{
525 525
526 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), 526 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"),
527 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), 527 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."),
528 i18n("Continue"), i18n("Cancel"), 0, 528 i18n("Continue"), i18n("Cancel"), 0,
529 0, 1 ); 529 0, 1 );
530 if ( result != 0 ) { 530 if ( result != 0 ) {
531 return; 531 return;
532 } 532 }
533 int icount = 0; 533 int icount = 0;
534 QPtrList<Incidence> delSel ; 534 QPtrList<Incidence> delSel ;
535 QListViewItem *item = mListView->firstChild (); 535 QListViewItem *item = mListView->firstChild ();
536 while ( item ) { 536 while ( item ) {
537 if ( item->isSelected() ) { 537 if ( item->isSelected() ) {
538 delSel.append(((KOListViewItem *)item)->data()); 538 delSel.append(((KOListViewItem *)item)->data());
539 ++icount; 539 ++icount;
540 } 540 }
541 541
542 item = item->nextSibling(); 542 item = item->nextSibling();
543 } 543 }
544 if ( icount ) { 544 if ( icount ) {
545 QString fn = KOPrefs::instance()->mLastSaveFile; 545 QString fn = KOPrefs::instance()->mLastSaveFile;
546 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 546 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
547 547
548 if ( fn == "" ) 548 if ( fn == "" )
549 return; 549 return;
550 QFileInfo info; 550 QFileInfo info;
551 info.setFile( fn ); 551 info.setFile( fn );
552 QString mes; 552 QString mes;
553 bool createbup = true; 553 bool createbup = true;
554 if ( info. exists() ) { 554 if ( info. exists() ) {
555 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 555 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
556 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 556 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
557 i18n("Overwrite!"), i18n("Cancel"), 0, 557 i18n("Overwrite!"), i18n("Cancel"), 0,
558 0, 1 ); 558 0, 1 );
559 if ( result != 0 ) { 559 if ( result != 0 ) {
560 createbup = false; 560 createbup = false;
561 } 561 }
562 } 562 }
563 if ( createbup ) { 563 if ( createbup ) {
564 QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + 564 QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") +
565 KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); 565 KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false);
566 Incidence *incidence = delSel.first(); 566 Incidence *incidence = delSel.first();
567 icount = 0; 567 icount = 0;
568 while ( incidence ) { 568 while ( incidence ) {
569 if ( incidence->type() == "Journal" ) { 569 if ( incidence->type() == "Journal" ) {
570 text += "\n************************************\n"; 570 text += "\n************************************\n";
571 text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); 571 text += i18n("Journal from: ") +incidence->dtStartDateStr( false );
572 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 572 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
573 text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); 573 text +="\n" + i18n("Description: ") + "\n"+ incidence->description();
574 ++icount; 574 ++icount;
575 575
576 } else { 576 } else {
577 if ( !incidence->description().isEmpty() ) { 577 if ( !incidence->description().isEmpty() ) {
578 text += "\n************************************\n"; 578 text += "\n************************************\n";
579 if ( incidence->type() == "Todo" ) 579 if ( incidence->type() == "Todo" )
580 text += i18n("To-Do: "); 580 text += i18n("To-Do: ");
581 text += incidence->summary(); 581 text += incidence->summary();
582 if ( incidence->hasStartDate() ) 582 if ( incidence->hasStartDate() )
583 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); 583 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false );
584 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 584 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
585 if ( !incidence->location().isEmpty() ) 585 if ( !incidence->location().isEmpty() )
586 text += "\n" +i18n("Location: ") + incidence->location(); 586 text += "\n" +i18n("Location: ") + incidence->location();
587 text += "\n" + i18n("Description: ") + "\n" + incidence->description(); 587 text += "\n" + i18n("Description: ") + "\n" + incidence->description();
588 ++icount; 588 ++icount;
589 589
590 } 590 }
591 } 591 }
592 incidence = delSel.next(); 592 incidence = delSel.next();
593 } 593 }
594 QFile file( fn ); 594 QFile file( fn );
595 if (!file.open( IO_WriteOnly ) ) { 595 if (!file.open( IO_WriteOnly ) ) {
596 topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); 596 topLevelWidget()->setCaption(i18n("File open error - nothing saved!") );
597 return; 597 return;
598 } 598 }
599 QTextStream ts( &file ); 599 QTextStream ts( &file );
600 ts << text; 600 ts << text;
601 file.close(); 601 file.close();
602 //qDebug("%s ", text.latin1()); 602 //qDebug("%s ", text.latin1());
603 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); 603 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount );
604 KOPrefs::instance()->mLastSaveFile = fn; 604 KOPrefs::instance()->mLastSaveFile = fn;
605 topLevelWidget()->setCaption(mes); 605 topLevelWidget()->setCaption(mes);
606 } 606 }
607 } 607 }
608} 608}
609void KOListView::saveToFile() 609void KOListView::saveToFile()
610{ 610{
611 611
612 int icount = 0; 612 int icount = 0;
613 QPtrList<Incidence> delSel ; 613 QPtrList<Incidence> delSel ;
614 QListViewItem *item = mListView->firstChild (); 614 QListViewItem *item = mListView->firstChild ();
615 while ( item ) { 615 while ( item ) {
616 if ( item->isSelected() ) { 616 if ( item->isSelected() ) {
617 delSel.append(((KOListViewItem *)item)->data()); 617 delSel.append(((KOListViewItem *)item)->data());
618 ++icount; 618 ++icount;
619 } 619 }
620 620
621 item = item->nextSibling(); 621 item = item->nextSibling();
622 } 622 }
623 if ( icount ) { 623 if ( icount ) {
624 QString fn = KOPrefs::instance()->mLastSaveFile; 624 QString fn = KOPrefs::instance()->mLastSaveFile;
625 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 625 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
626 626
627 if ( fn == "" ) 627 if ( fn == "" )
628 return; 628 return;
629 QFileInfo info; 629 QFileInfo info;
630 info.setFile( fn ); 630 info.setFile( fn );
631 QString mes; 631 QString mes;
632 bool createbup = true; 632 bool createbup = true;
633 if ( info. exists() ) { 633 if ( info. exists() ) {
634 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 634 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
635 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 635 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
636 i18n("Overwrite!"), i18n("Cancel"), 0, 636 i18n("Overwrite!"), i18n("Cancel"), 0,
637 0, 1 ); 637 0, 1 );
638 if ( result != 0 ) { 638 if ( result != 0 ) {
639 createbup = false; 639 createbup = false;
640 } 640 }
641 } 641 }
642 if ( createbup ) { 642 if ( createbup ) {
643 CalendarLocal cal; 643 CalendarLocal cal;
644 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 644 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
645 Incidence *incidence = delSel.first(); 645 Incidence *incidence = delSel.first();
646 while ( incidence ) { 646 while ( incidence ) {
647 cal.addIncidence( incidence->clone() ); 647 cal.addIncidence( incidence->clone() );
648 incidence = delSel.next(); 648 incidence = delSel.next();
649 } 649 }
650 ICalFormat format; 650 ICalFormat format;
651 format.save( &cal, fn ); 651 format.save( &cal, fn );
652 mes = i18n("KO/Pi:Saved %1").arg(fn ); 652 mes = i18n("KO/Pi:Saved %1").arg(fn );
653 KOPrefs::instance()->mLastSaveFile = fn; 653 KOPrefs::instance()->mLastSaveFile = fn;
654 topLevelWidget()->setCaption(mes); 654 topLevelWidget()->setCaption(mes);
655 } 655 }
656 } 656 }
657} 657}
658void KOListView::deleteAll() 658void KOListView::deleteAll()
659{ 659{
660 int icount = 0; 660 int icount = 0;
661 QPtrList<Incidence> delSel ; 661 QPtrList<Incidence> delSel ;
662 QListViewItem *item = mListView->firstChild (); 662 QListViewItem *item = mListView->firstChild ();
663 while ( item ) { 663 while ( item ) {
664 if ( item->isSelected() ) { 664 if ( item->isSelected() ) {
665 delSel.append(((KOListViewItem *)item)->data()); 665 delSel.append(((KOListViewItem *)item)->data());
666 ++icount; 666 ++icount;
667 } 667 }
668 668
669 item = item->nextSibling(); 669 item = item->nextSibling();
670 } 670 }
671 if ( icount ) { 671 if ( icount ) {
672 Incidence *incidence = delSel.first(); 672 Incidence *incidence = delSel.first();
673 Incidence *toDelete; 673 Incidence *toDelete;
674 KOPrefs *p = KOPrefs::instance(); 674 KOPrefs *p = KOPrefs::instance();
675 bool confirm = p->mConfirm; 675 bool confirm = p->mConfirm;
676 QString mess; 676 QString mess;
677 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); 677 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount );
678 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { 678 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) {
679 p->mConfirm = false; 679 p->mConfirm = false;
680 int delCounter = 0; 680 int delCounter = 0;
681 QDialog dia ( this, "p-dialog", true ); 681 QDialog dia ( this, "p-dialog", true );
682 QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); 682 QLabel lab (i18n("Close dialog to abort deletion!"), &dia );
683 QVBoxLayout lay( &dia ); 683 QVBoxLayout lay( &dia );
684 lay.setMargin(7); 684 lay.setMargin(7);
685 lay.setSpacing(7); 685 lay.setSpacing(7);
686 lay.addWidget( &lab); 686 lay.addWidget( &lab);
687 QProgressBar bar( icount, &dia ); 687 QProgressBar bar( icount, &dia );
688 lay.addWidget( &bar); 688 lay.addWidget( &bar);
689 int w = 220; 689 int w = 220;
690 int h = 50; 690 int h = 50;
691 int dw = QApplication::desktop()->width(); 691 int dw = QApplication::desktop()->width();
692 int dh = QApplication::desktop()->height(); 692 int dh = QApplication::desktop()->height();
693 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 693 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
694 //dia.resize( 240,50 ); 694 //dia.resize( 240,50 );
695 dia.show(); 695 dia.show();
696 696
697 while ( incidence ) { 697 while ( incidence ) {
698 bar.setProgress( delCounter ); 698 bar.setProgress( delCounter );
699 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); 699 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter );
700 dia.setCaption( mess ); 700 dia.setCaption( mess );
701 qApp->processEvents(); 701 qApp->processEvents();
702 toDelete = (incidence); 702 toDelete = (incidence);
703 incidence = delSel.next(); 703 incidence = delSel.next();
704 emit deleteIncidenceSignal(toDelete ); 704 emit deleteIncidenceSignal(toDelete );
705 if ( dia.result() != 0 ) 705 if ( dia.result() != 0 )
706 break; 706 break;
707 707
708 } 708 }
709 mess = mess.sprintf( i18n("%d items remaining in list."), count() ); 709 mess = mess.sprintf( i18n("%d items remaining in list."), count() );
710 topLevelWidget ()->setCaption( mess ); 710 topLevelWidget ()->setCaption( mess );
711 p->mConfirm = confirm; 711 p->mConfirm = confirm;
712 } 712 }
713 } 713 }
714 714
715 715
716} 716}
717int KOListView::maxDatesHint() 717int KOListView::maxDatesHint()
718{ 718{
719 return 0; 719 return 0;
720} 720}
721 721
722int KOListView::currentDateCount() 722int KOListView::currentDateCount()
723{ 723{
724 return 0; 724 return 0;
725} 725}
726 726
727QPtrList<Incidence> KOListView::selectedIncidences() 727QPtrList<Incidence> KOListView::selectedIncidences()
728{ 728{
729 QPtrList<Incidence> eventList; 729 QPtrList<Incidence> eventList;
730 QListViewItem *item = mListView->firstChild (); 730 QListViewItem *item = mListView->firstChild ();
731 while ( item ) { 731 while ( item ) {
732 if ( item->isSelected() ) { 732 if ( item->isSelected() ) {
733 eventList.append(((KOListViewItem *)item)->data()); 733 eventList.append(((KOListViewItem *)item)->data());
734 } 734 }
735 735
736 item = item->nextSibling(); 736 item = item->nextSibling();
737 } 737 }
738 738
739 // // QListViewItem *item = mListView->selectedItem(); 739 // // QListViewItem *item = mListView->selectedItem();
740 //if (item) eventList.append(((KOListViewItem *)item)->data()); 740 //if (item) eventList.append(((KOListViewItem *)item)->data());
741 741
742 return eventList; 742 return eventList;
743} 743}
744 744
745DateList KOListView::selectedDates() 745DateList KOListView::selectedDates()
746{ 746{
747 DateList eventList; 747 DateList eventList;
748 return eventList; 748 return eventList;
749} 749}
750 750
751void KOListView::showDates(bool show) 751void KOListView::showDates(bool show)
752{ 752{
753 // Shouldn't we set it to a value greater 0? When showDates is called with 753 // Shouldn't we set it to a value greater 0? When showDates is called with
754 // show == true at first, then the columnwidths are set to zero. 754 // show == true at first, then the columnwidths are set to zero.
755 static int oldColWidth1 = 0; 755 static int oldColWidth1 = 0;
756 static int oldColWidth3 = 0; 756 static int oldColWidth3 = 0;
757 757
758 if (!show) { 758 if (!show) {
759 oldColWidth1 = mListView->columnWidth(1); 759 oldColWidth1 = mListView->columnWidth(1);
760 oldColWidth3 = mListView->columnWidth(3); 760 oldColWidth3 = mListView->columnWidth(3);
761 mListView->setColumnWidth(1, 0); 761 mListView->setColumnWidth(1, 0);
762 mListView->setColumnWidth(3, 0); 762 mListView->setColumnWidth(3, 0);
763 } else { 763 } else {
764 mListView->setColumnWidth(1, oldColWidth1); 764 mListView->setColumnWidth(1, oldColWidth1);
765 mListView->setColumnWidth(3, oldColWidth3); 765 mListView->setColumnWidth(3, oldColWidth3);
766 } 766 }
767 mListView->repaint(); 767 mListView->repaint();
768} 768}
769 769
770void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, 770void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd,
771 const QDate &td) 771 const QDate &td)
772{ 772{
773#ifndef KORG_NOPRINTER 773#ifndef KORG_NOPRINTER
774 calPrinter->preview(CalPrinter::Day, fd, td); 774 calPrinter->preview(CalPrinter::Day, fd, td);
775#endif 775#endif
776} 776}
777 777
778void KOListView::showDates() 778void KOListView::showDates()
779{ 779{
780 showDates(true); 780 showDates(true);
781} 781}
782 782
783void KOListView::hideDates() 783void KOListView::hideDates()
784{ 784{
785 showDates(false); 785 showDates(false);
786} 786}
787 787
788void KOListView::updateView() 788void KOListView::updateView()
789{ 789{
790 mListView->setFocus(); 790 mListView->setFocus();
791 if ( mListView->firstChild () ) 791 if ( mListView->firstChild () )
792 mListView->setCurrentItem( mListView->firstChild () ); 792 mListView->setCurrentItem( mListView->firstChild () );
793} 793}
794void KOListView::updateConfig() 794void KOListView::updateConfig()
795{ 795{
796 796
797 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 797 mListView->setFont ( KOPrefs::instance()->mListViewFont );
798 updateView(); 798 updateView();
799 799
800} 800}
801void KOListView::setStartDate(const QDate &start) 801void KOListView::setStartDate(const QDate &start)
802{ 802{
803 mStartDate = start; 803 mStartDate = start;
804} 804}
805 805
806void KOListView::showDates(const QDate &start, const QDate &end) 806void KOListView::showDates(const QDate &start, const QDate &end)
807{ 807{
808 clear(); 808 clear();
809 mStartDate = start; 809 mStartDate = start;
810 QDate date = start; 810 QDate date = start;
811 QPtrList<Journal> j_list; 811 QPtrList<Journal> j_list;
812 while( date <= end ) { 812 while( date <= end ) {
813 addEvents(calendar()->events(date)); 813 addEvents(calendar()->events(date));
814 addTodos(calendar()->todos(date)); 814 addTodos(calendar()->todos(date));
815 Journal* jo = calendar()->journal(date); 815 Journal* jo = calendar()->journal(date);
816 if ( jo ) 816 if ( jo )
817 j_list.append( jo ); 817 j_list.append( jo );
818 date = date.addDays( 1 ); 818 date = date.addDays( 1 );
819 } 819 }
820 addJournals(j_list); 820 addJournals(j_list);
821 emit incidenceSelected( 0 ); 821 emit incidenceSelected( 0 );
822 updateView(); 822 updateView();
823 823
824} 824}
825 825
826void KOListView::addEvents(QPtrList<Event> eventList) 826void KOListView::addEvents(QPtrList<Event> eventList)
827{ 827{
828 Event *ev; 828 Event *ev;
829 for(ev = eventList.first(); ev; ev = eventList.next()) { 829 for(ev = eventList.first(); ev; ev = eventList.next()) {
830 addIncidence(ev); 830 addIncidence(ev);
831 } 831 }
832 if ( !mListView->currentItem() ){ 832 if ( !mListView->currentItem() ){
833 updateView(); 833 updateView();
834 } 834 }
835} 835}
836 836
837void KOListView::addTodos(QPtrList<Todo> eventList) 837void KOListView::addTodos(QPtrList<Todo> eventList)
838{ 838{
839 Todo *ev; 839 Todo *ev;
840 for(ev = eventList.first(); ev; ev = eventList.next()) { 840 for(ev = eventList.first(); ev; ev = eventList.next()) {
841 addIncidence(ev); 841 addIncidence(ev);
842 } 842 }
843 if ( !mListView->currentItem() ){ 843 if ( !mListView->currentItem() ){
844 updateView(); 844 updateView();
845 } 845 }
846} 846}
847void KOListView::addJournals(QPtrList<Journal> eventList) 847void KOListView::addJournals(QPtrList<Journal> eventList)
848{ 848{
849 Journal *ev; 849 Journal *ev;
850 for(ev = eventList.first(); ev; ev = eventList.next()) { 850 for(ev = eventList.first(); ev; ev = eventList.next()) {
851 addIncidence(ev); 851 addIncidence(ev);
852 } 852 }
853 if ( !mListView->currentItem() ){ 853 if ( !mListView->currentItem() ){
854 updateView(); 854 updateView();
855 } 855 }
856} 856}
857 857
858void KOListView::addIncidence(Incidence *incidence) 858void KOListView::addIncidence(Incidence *incidence)
859{ 859{
860 if ( mUidDict.find( incidence->uid() ) ) return; 860 if ( mUidDict.find( incidence->uid() ) ) return;
861 861
862 // mListView->setFont ( KOPrefs::instance()->mListViewFont ); 862 // mListView->setFont ( KOPrefs::instance()->mListViewFont );
863 mUidDict.insert( incidence->uid(), incidence ); 863 mUidDict.insert( incidence->uid(), incidence );
864 864
865 KOListViewItem *item = new KOListViewItem( incidence, mListView ); 865 KOListViewItem *item = new KOListViewItem( incidence, mListView );
866 ListItemVisitor v(item, mStartDate ); 866 ListItemVisitor v(item, mStartDate );
867 if (incidence->accept(v)) return; 867 if (incidence->accept(v)) return;
868 else delete item; 868 else delete item;
869 //qDebug("delete item "); 869 //qDebug("delete item ");
870} 870}
871 871
872void KOListView::showEvents(QPtrList<Event> eventList) 872void KOListView::showEvents(QPtrList<Event> eventList)
873{ 873{
874 clear(); 874 clear();
875 875
876 addEvents(eventList); 876 addEvents(eventList);
877 877
878 // After new creation of list view no events are selected. 878 // After new creation of list view no events are selected.
879 emit incidenceSelected( 0 ); 879 emit incidenceSelected( 0 );
880} 880}
881int KOListView::count() 881int KOListView::count()
882{ 882{
883 return mListView->childCount(); 883 return mListView->childCount();
884} 884}
885 885
886void KOListView::changeEventDisplay(Event *event, int action) 886void KOListView::changeEventDisplay(Event *event, int action)
887{ 887{
888 KOListViewItem *item; 888 KOListViewItem *item;
889 889
890 switch(action) { 890 switch(action) {
891 case KOGlobals::EVENTADDED: 891 case KOGlobals::EVENTADDED:
892 addIncidence( event ); 892 addIncidence( event );
893 break; 893 break;
894 case KOGlobals::EVENTEDITED: 894 case KOGlobals::EVENTEDITED:
895 item = getItemForEvent(event); 895 item = getItemForEvent(event);
896 if (item) { 896 if (item) {
897 mUidDict.remove( event->uid() ); 897 mUidDict.remove( event->uid() );
898 delete item; 898 delete item;
899 addIncidence( event ); 899 addIncidence( event );
900 } 900 }
901 break; 901 break;
902 case KOGlobals::EVENTDELETED: 902 case KOGlobals::EVENTDELETED:
903 item = getItemForEvent(event); 903 item = getItemForEvent(event);
904 if (item) { 904 if (item) {
905 mUidDict.remove( event->uid() ); 905 mUidDict.remove( event->uid() );
906 delete item; 906 delete item;
907 } 907 }
908 break; 908 break;
909 default: 909 default:
910 ; 910 ;
911 } 911 }
912} 912}
913 913
914KOListViewItem *KOListView::getItemForEvent(Event *event) 914KOListViewItem *KOListView::getItemForEvent(Event *event)
915{ 915{
916 KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); 916 KOListViewItem *item = (KOListViewItem *)mListView->firstChild();
917 while (item) { 917 while (item) {
918 if (item->data() == event) return item; 918 if (item->data() == event) return item;
919 item = (KOListViewItem *)item->nextSibling(); 919 item = (KOListViewItem *)item->nextSibling();
920 } 920 }
921 return 0; 921 return 0;
922} 922}
923 923
924void KOListView::defaultItemAction(QListViewItem *i) 924void KOListView::defaultItemAction(QListViewItem *i)
925{ 925{
926 KOListViewItem *item = static_cast<KOListViewItem *>( i ); 926 KOListViewItem *item = static_cast<KOListViewItem *>( i );
927 if ( item ) defaultAction( item->data() ); 927 if ( item ) defaultAction( item->data() );
928 928
929} 929}
930 930
931void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) 931void KOListView::popupMenu(QListViewItem *item,const QPoint &,int)
932{ 932{
933 mActiveItem = (KOListViewItem *)item; 933 mActiveItem = (KOListViewItem *)item;
934 if (mActiveItem) { 934 if (mActiveItem) {
935 Incidence *incidence = mActiveItem->data(); 935 Incidence *incidence = mActiveItem->data();
936 mPopupMenu->showIncidencePopup(incidence); 936 mPopupMenu->showIncidencePopup(incidence);
937 937
938 /* 938 /*
939 if ( incidence && incidence->type() == "Event" ) { 939 if ( incidence && incidence->type() == "Event" ) {
940 Event *event = static_cast<Event *>( incidence ); 940 Event *event = static_cast<Event *>( incidence );
941 mPopupMenu->showEventPopup(event); 941 mPopupMenu->showEventPopup(event);
942 } 942 }
943 */ 943 */
944 } 944 }
945} 945}
946 946
947void KOListView::readSettings(KConfig *config, QString setting) 947void KOListView::readSettings(KConfig *config, QString setting)
948{ 948{
949 // qDebug("KOListView::readSettings "); 949 // qDebug("KOListView::readSettings ");
950 mListView->restoreLayout(config,setting); 950 mListView->restoreLayout(config,setting);
951} 951}
952 952
953void KOListView::writeSettings(KConfig *config, QString setting) 953void KOListView::writeSettings(KConfig *config, QString setting)
954{ 954{
955 // qDebug("KOListView::writeSettings "); 955 // qDebug("KOListView::writeSettings ");
956 mListView->saveLayout(config, setting); 956 mListView->saveLayout(config, setting);
957} 957}
958 958
959void KOListView::processSelectionChange(QListViewItem *) 959void KOListView::processSelectionChange(QListViewItem *)
960{ 960{
961 961
962 KOListViewItem *item = 962 KOListViewItem *item =
963 static_cast<KOListViewItem *>( mListView->currentItem() ); 963 static_cast<KOListViewItem *>( mListView->currentItem() );
964 964
965 if ( !item ) { 965 if ( !item ) {
966 emit incidenceSelected( 0 ); 966 emit incidenceSelected( 0 );
967 } else { 967 } else {
968 emit incidenceSelected( item->data() ); 968 emit incidenceSelected( item->data() );
969 } 969 }
970} 970}
971 971
972void KOListView::clearSelection() 972void KOListView::clearSelection()
973{ 973{
974 mListView->selectAll( false ); 974 mListView->selectAll( false );
975} 975}
976void KOListView::allSelection() 976void KOListView::allSelection()
977{ 977{
978 mListView->selectAll( true ); 978 mListView->selectAll( true );
979} 979}
980 980
981void KOListView::clear() 981void KOListView::clear()
982{ 982{
983 mListView->clear(); 983 mListView->clear();
984 mUidDict.clear(); 984 mUidDict.clear();
985} 985}
986 986
987Incidence* KOListView::currentItem() 987Incidence* KOListView::currentItem()
988{ 988{
989 if ( mListView->currentItem() ) 989 if ( mListView->currentItem() )
990 return ((KOListViewItem*) mListView->currentItem())->data(); 990 return ((KOListViewItem*) mListView->currentItem())->data();
991 return 0; 991 return 0;
992} 992}
993void KOListView::keyPressEvent ( QKeyEvent *e) 993void KOListView::keyPressEvent ( QKeyEvent *e)
994{ 994{
995 995
996 if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { 996 if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) {
997 deleteAll(); 997 deleteAll();
998 return; 998 return;
999 } 999 }
1000 1000
1001 e->ignore(); 1001 e->ignore();
1002} 1002}
1003void KOListViewListView::keyPressEvent ( QKeyEvent *e) 1003void KOListViewListView::keyPressEvent ( QKeyEvent *e)
1004{ 1004{
1005 1005
1006 switch ( e->key() ) { 1006 switch ( e->key() ) {
1007 case Qt::Key_Down: 1007 case Qt::Key_Down:
1008 if ( e->state() == ShiftButton ) { 1008 if ( e->state() == ShiftButton ) {
1009 QListViewItem* cn = currentItem(); 1009 QListViewItem* cn = currentItem();
1010 if ( !cn ) 1010 if ( !cn )
1011 cn = firstChild(); 1011 cn = firstChild();
1012 if ( !cn ) 1012 if ( !cn )
1013 return; 1013 return;
1014 while ( cn->nextSibling() ) 1014 while ( cn->nextSibling() )
1015 cn = cn->nextSibling(); 1015 cn = cn->nextSibling();
1016 setCurrentItem ( cn ); 1016 setCurrentItem ( cn );
1017 ensureItemVisible ( cn ); 1017 ensureItemVisible ( cn );
1018 1018
1019 e->accept(); 1019 e->accept();
1020 return; 1020 return;
1021 } 1021 }
1022 if ( e->state() == ControlButton ) { 1022 if ( e->state() == ControlButton ) {
1023 int count = childCount (); 1023 int count = childCount ();
1024 int jump = count / 5; 1024 int jump = count / 5;
1025 QListViewItem* cn; 1025 QListViewItem* cn;
1026 cn = currentItem(); 1026 cn = currentItem();
1027 if ( ! cn ) 1027 if ( ! cn )
1028 return; 1028 return;
1029 if ( jump == 0 ) 1029 if ( jump == 0 )
1030 jump = 1; 1030 jump = 1;
1031 while ( jump && cn->nextSibling() ) { 1031 while ( jump && cn->nextSibling() ) {
1032 cn = cn->nextSibling(); 1032 cn = cn->nextSibling();
1033 --jump; 1033 --jump;
1034 } 1034 }
1035 setCurrentItem ( cn ); 1035 setCurrentItem ( cn );
1036 ensureItemVisible ( cn ); 1036 ensureItemVisible ( cn );
1037 1037
1038 } else 1038 } else
1039 QListView::keyPressEvent ( e ) ; 1039 QListView::keyPressEvent ( e ) ;
1040 e->accept(); 1040 e->accept();
1041 break; 1041 break;
1042 1042
1043 case Qt::Key_Up: 1043 case Qt::Key_Up:
1044 if ( e->state() == ShiftButton ) { 1044 if ( e->state() == ShiftButton ) {
1045 QListViewItem* cn = firstChild(); 1045 QListViewItem* cn = firstChild();
1046 if ( cn ) { 1046 if ( cn ) {
1047 setCurrentItem ( cn ); 1047 setCurrentItem ( cn );
1048 ensureItemVisible ( cn ); 1048 ensureItemVisible ( cn );
1049 } 1049 }
1050 e->accept(); 1050 e->accept();
1051 return; 1051 return;
1052 } 1052 }
1053 if ( e->state() == ControlButton ) { 1053 if ( e->state() == ControlButton ) {
1054 int count = childCount (); 1054 int count = childCount ();
1055 int jump = count / 5; 1055 int jump = count / 5;
1056 QListViewItem* cn; 1056 QListViewItem* cn;
1057 cn = currentItem(); 1057 cn = currentItem();
1058 if ( ! cn ) 1058 if ( ! cn )
1059 return; 1059 return;
1060 if ( jump == 0 ) 1060 if ( jump == 0 )
1061 jump = 1; 1061 jump = 1;
1062 while ( jump && cn->itemAbove ()) { 1062 while ( jump && cn->itemAbove ()) {
1063 cn = cn->itemAbove (); 1063 cn = cn->itemAbove ();
1064 --jump; 1064 --jump;
1065 } 1065 }
1066 setCurrentItem ( cn ); 1066 setCurrentItem ( cn );
1067 ensureItemVisible ( cn ); 1067 ensureItemVisible ( cn );
1068 } else 1068 } else
1069 QListView::keyPressEvent ( e ) ; 1069 QListView::keyPressEvent ( e ) ;
1070 e->accept(); 1070 e->accept();
1071 break; 1071 break;
1072 case Qt::Key_I: { 1072 case Qt::Key_I: {
1073 QListViewItem* cn; 1073 QListViewItem* cn;
1074 cn = currentItem(); 1074 cn = currentItem();
1075 if ( cn ) { 1075 if ( cn ) {
1076 KOListViewItem* ci = (KOListViewItem*)( cn ); 1076 KOListViewItem* ci = (KOListViewItem*)( cn );
1077 if ( ci ){ 1077 if ( ci ){
1078 emit showIncidence( ci->data()); 1078 emit showIncidence( ci->data());
1079 cn = cn->nextSibling(); 1079 cn = cn->nextSibling();
1080 if ( cn ) { 1080 if ( cn ) {
1081 setCurrentItem ( cn ); 1081 setCurrentItem ( cn );
1082 ensureItemVisible ( cn ); 1082 ensureItemVisible ( cn );
1083 } 1083 }
1084 } 1084 }
1085 } 1085 }
1086 e->accept(); 1086 e->accept();
1087 } 1087 }
1088 break; 1088 break;
1089 case Qt::Key_Return: 1089 case Qt::Key_Return:
1090 case Qt::Key_Enter: 1090 case Qt::Key_Enter:
1091 { 1091 {
1092 QListViewItem* cn; 1092 QListViewItem* cn;
1093 cn = currentItem(); 1093 cn = currentItem();
1094 if ( cn ) { 1094 if ( cn ) {
1095 KOListViewItem* ci = (KOListViewItem*)( cn ); 1095 KOListViewItem* ci = (KOListViewItem*)( cn );
1096 if ( ci ){ 1096 if ( ci ){
1097 if ( e->state() == ShiftButton ) 1097 if ( e->state() == ShiftButton )
1098 ci->setSelected( false ); 1098 ci->setSelected( false );
1099 else 1099 else
1100 ci->setSelected( true ); 1100 ci->setSelected( true );
1101 cn = cn->nextSibling(); 1101 cn = cn->nextSibling();
1102 if ( cn ) { 1102 if ( cn ) {
1103 setCurrentItem ( cn ); 1103 setCurrentItem ( cn );
1104 ensureItemVisible ( cn ); 1104 ensureItemVisible ( cn );
1105 } 1105 }
1106 } 1106 }
1107 } 1107 }
1108 e->accept(); 1108 e->accept();
1109 } 1109 }
1110 break; 1110 break;
1111 default: 1111 default:
1112 e->ignore(); 1112 e->ignore();
1113 } 1113 }
1114} 1114}
1115KOListViewListView::KOListViewListView(KOListView * lv ) 1115KOListViewListView::KOListViewListView(KOListView * lv )
1116 : KListView( lv ) 1116 : KListView( lv )
1117{ 1117{
1118#ifndef DESKTOP_VERSION 1118#ifndef DESKTOP_VERSION
1119 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); 1119 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
1120#endif 1120#endif
1121 mYMousePos = -1000; 1121 mYMousePos = -1000;
1122 setSelectionMode( QListView::Multi ); 1122 setSelectionMode( QListView::Multi );
1123 setMultiSelection( true); 1123 setMultiSelection( true);
1124 mAllowPopupMenu = true; 1124 mAllowPopupMenu = true;
1125 mMouseDown = false; 1125 mMouseDown = false;
1126 1126
1127} 1127}
1128void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 1128void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
1129{ 1129{
1130 if (!e) return; 1130 if (!e) return;
1131 QPoint vp = contentsToViewport(e->pos()); 1131 QPoint vp = contentsToViewport(e->pos());
1132 QListViewItem *item = itemAt(vp); 1132 QListViewItem *item = itemAt(vp);
1133 if (!item) { 1133 if (!item) {
1134 emit newEvent(); 1134 emit newEvent();
1135 return; 1135 return;
1136 } 1136 }
1137 KListView::contentsMouseDoubleClickEvent(e); 1137 KListView::contentsMouseDoubleClickEvent(e);
1138} 1138}
1139 1139
1140 1140
1141void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) 1141void KOListViewListView::contentsMousePressEvent(QMouseEvent *e)
1142{ 1142{
1143 //qDebug("contentsMousePressEvent++++ "); 1143 //qDebug("contentsMousePressEvent++++ ");
1144 if (! mMouseDown ) { 1144 if (! mMouseDown ) {
1145 mAllowPopupMenu = true; 1145 mAllowPopupMenu = true;
1146 mYMousePos = mapToGlobal( (e->pos())).y(); 1146 mYMousePos = mapToGlobal( (e->pos())).y();
1147 } 1147 }
1148 if ( e->button() == RightButton && mMouseDown ) 1148 if ( e->button() == RightButton && mMouseDown )
1149 return; 1149 return;
1150 if ( e->button() == LeftButton ) 1150 if ( e->button() == LeftButton )
1151 mMouseDown = true; 1151 mMouseDown = true;
1152 KListView::contentsMousePressEvent( e ); 1152 KListView::contentsMousePressEvent( e );
1153} 1153}
1154void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) 1154void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e)
1155{ 1155{
1156 //qDebug("contentsMouseReleaseEv---- "); 1156 //qDebug("contentsMouseReleaseEv---- ");
1157 if ( ! mMouseDown ) { 1157 if ( ! mMouseDown ) {
1158 if ( e->button() == RightButton && ! mAllowPopupMenu ) 1158 if ( e->button() == RightButton && ! mAllowPopupMenu )
1159 return; 1159 return;
1160 QListViewItem* ci = currentItem(); 1160 QListViewItem* ci = currentItem();
1161 if ( ci ) 1161 if ( ci )
1162 ci->setSelected( true ); 1162 ci->setSelected( true );
1163 KListView::contentsMouseReleaseEvent(e); 1163 KListView::contentsMouseReleaseEvent(e);
1164 return; 1164 return;
1165 } 1165 }
1166 if ( e->button() == LeftButton ) 1166 if ( e->button() == LeftButton )
1167 mMouseDown = false; 1167 mMouseDown = false;
1168 if ( e->button() == RightButton && ! mAllowPopupMenu ) 1168 if ( e->button() == RightButton && ! mAllowPopupMenu )
1169 return; 1169 return;
1170 if ( e->button() == RightButton ) { 1170 if ( e->button() == RightButton ) {
1171 QListViewItem* ci = currentItem(); 1171 QListViewItem* ci = currentItem();
1172 if ( ci ) 1172 if ( ci )
1173 ci->setSelected( true ); 1173 ci->setSelected( true );
1174 } 1174 }
1175 KListView::contentsMouseReleaseEvent(e); 1175 KListView::contentsMouseReleaseEvent(e);
1176} 1176}
1177void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) 1177void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e)
1178{ 1178{
1179 // qDebug("contentsMouseMoveEv....... "); 1179 // qDebug("contentsMouseMoveEv....... ");
1180 // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); 1180 // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() );
1181 int diff = mYMousePos - mapToGlobal( (e->pos())).y(); 1181 int diff = mYMousePos - mapToGlobal( (e->pos())).y();
1182 if ( diff < 0 ) diff = -diff; 1182 if ( diff < 0 ) diff = -diff;
1183 if ( diff > 20 ) 1183 if ( diff > 20 )
1184 mAllowPopupMenu = false; 1184 mAllowPopupMenu = false;
1185 KListView::contentsMouseMoveEvent(e); 1185 KListView::contentsMouseMoveEvent(e);
1186} 1186}
diff --git a/libkcal/recurrence.cpp b/libkcal/recurrence.cpp
index 5181eaf..8a175c9 100644
--- a/libkcal/recurrence.cpp
+++ b/libkcal/recurrence.cpp
@@ -1,3284 +1,3290 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 1998 Preston Brown 3 Copyright (c) 1998 Preston Brown
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (c) 2002 David Jarvie <software@astrojar.org.uk> 5 Copyright (c) 2002 David Jarvie <software@astrojar.org.uk>
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
11 11
12 This library is distributed in the hope that it will be useful, 12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details. 15 Library General Public License for more details.
16 16
17 You should have received a copy of the GNU Library General Public License 17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to 18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
21*/ 21*/
22 22
23#include <limits.h> 23#include <limits.h>
24 24
25#include <kdebug.h> 25#include <kdebug.h>
26#include <kglobal.h> 26#include <kglobal.h>
27#include <klocale.h> 27#include <klocale.h>
28 28
29#include "incidence.h" 29#include "incidence.h"
30 30
31#include "recurrence.h" 31#include "recurrence.h"
32 32
33using namespace KCal; 33using namespace KCal;
34 34
35Recurrence::Feb29Type Recurrence::mFeb29YearlyDefaultType = Recurrence::rMar1; 35Recurrence::Feb29Type Recurrence::mFeb29YearlyDefaultType = Recurrence::rMar1;
36 36
37 37
38Recurrence::Recurrence(Incidence *parent, int compatVersion) 38Recurrence::Recurrence(Incidence *parent, int compatVersion)
39: recurs(rNone), // by default, it's not a recurring event 39: recurs(rNone), // by default, it's not a recurring event
40 rWeekStart(1), // default is Monday 40 rWeekStart(1), // default is Monday
41 rDays(7), 41 rDays(7),
42 mFloats(parent ? parent->doesFloat() : false), 42 mFloats(parent ? parent->doesFloat() : false),
43 mRecurReadOnly(false), 43 mRecurReadOnly(false),
44 mRecurExDatesCount(0), 44 mRecurExDatesCount(0),
45 mFeb29YearlyType(mFeb29YearlyDefaultType), 45 mFeb29YearlyType(mFeb29YearlyDefaultType),
46 mCompatVersion(compatVersion ? compatVersion : INT_MAX), 46 mCompatVersion(compatVersion ? compatVersion : INT_MAX),
47 mCompatRecurs(rNone), 47 mCompatRecurs(rNone),
48 mCompatDuration(0), 48 mCompatDuration(0),
49 mParent(parent) 49 mParent(parent)
50{ 50{
51 rMonthDays.setAutoDelete( true ); 51 rMonthDays.setAutoDelete( true );
52 rMonthPositions.setAutoDelete( true ); 52 rMonthPositions.setAutoDelete( true );
53 rYearNums.setAutoDelete( true ); 53 rYearNums.setAutoDelete( true );
54} 54}
55 55
56Recurrence::Recurrence(const Recurrence &r, Incidence *parent) 56Recurrence::Recurrence(const Recurrence &r, Incidence *parent)
57: recurs(r.recurs), 57: recurs(r.recurs),
58 rWeekStart(r.rWeekStart), 58 rWeekStart(r.rWeekStart),
59 rDays(r.rDays.copy()), 59 rDays(r.rDays.copy()),
60 rFreq(r.rFreq), 60 rFreq(r.rFreq),
61 rDuration(r.rDuration), 61 rDuration(r.rDuration),
62 rEndDateTime(r.rEndDateTime), 62 rEndDateTime(r.rEndDateTime),
63 mRecurStart(r.mRecurStart), 63 mRecurStart(r.mRecurStart),
64 mFloats(r.mFloats), 64 mFloats(r.mFloats),
65 mRecurReadOnly(r.mRecurReadOnly), 65 mRecurReadOnly(r.mRecurReadOnly),
66 mRecurExDatesCount(r.mRecurExDatesCount), 66 mRecurExDatesCount(r.mRecurExDatesCount),
67 mFeb29YearlyType(r.mFeb29YearlyType), 67 mFeb29YearlyType(r.mFeb29YearlyType),
68 mCompatVersion(r.mCompatVersion), 68 mCompatVersion(r.mCompatVersion),
69 mCompatRecurs(r.mCompatRecurs), 69 mCompatRecurs(r.mCompatRecurs),
70 mCompatDuration(r.mCompatDuration), 70 mCompatDuration(r.mCompatDuration),
71 mParent(parent) 71 mParent(parent)
72{ 72{
73 for (QPtrListIterator<rMonthPos> mp(r.rMonthPositions); mp.current(); ++mp) { 73 for (QPtrListIterator<rMonthPos> mp(r.rMonthPositions); mp.current(); ++mp) {
74 rMonthPos *tmp = new rMonthPos; 74 rMonthPos *tmp = new rMonthPos;
75 tmp->rPos = mp.current()->rPos; 75 tmp->rPos = mp.current()->rPos;
76 tmp->negative = mp.current()->negative; 76 tmp->negative = mp.current()->negative;
77 tmp->rDays = mp.current()->rDays.copy(); 77 tmp->rDays = mp.current()->rDays.copy();
78 rMonthPositions.append(tmp); 78 rMonthPositions.append(tmp);
79 } 79 }
80 for (QPtrListIterator<int> md(r.rMonthDays); md.current(); ++md) { 80 for (QPtrListIterator<int> md(r.rMonthDays); md.current(); ++md) {
81 int *tmp = new int; 81 int *tmp = new int;
82 *tmp = *md.current(); 82 *tmp = *md.current();
83 rMonthDays.append(tmp); 83 rMonthDays.append(tmp);
84 } 84 }
85 for (QPtrListIterator<int> yn(r.rYearNums); yn.current(); ++yn) { 85 for (QPtrListIterator<int> yn(r.rYearNums); yn.current(); ++yn) {
86 int *tmp = new int; 86 int *tmp = new int;
87 *tmp = *yn.current(); 87 *tmp = *yn.current();
88 rYearNums.append(tmp); 88 rYearNums.append(tmp);
89 } 89 }
90 rMonthDays.setAutoDelete( true ); 90 rMonthDays.setAutoDelete( true );
91 rMonthPositions.setAutoDelete( true ); 91 rMonthPositions.setAutoDelete( true );
92 rYearNums.setAutoDelete( true ); 92 rYearNums.setAutoDelete( true );
93} 93}
94 94
95Recurrence::~Recurrence() 95Recurrence::~Recurrence()
96{ 96{
97} 97}
98 98
99 99
100bool Recurrence::operator==( const Recurrence& r2 ) const 100bool Recurrence::operator==( const Recurrence& r2 ) const
101{ 101{
102 102
103 // the following line is obvious 103 // the following line is obvious
104 if ( recurs == rNone && r2.recurs == rNone ) 104 if ( recurs == rNone && r2.recurs == rNone )
105 return true; 105 return true;
106 // we need the above line, because two non recurring events may 106 // we need the above line, because two non recurring events may
107 // differ in the other settings, because one (or both) 107 // differ in the other settings, because one (or both)
108 // may be not initialized properly 108 // may be not initialized properly
109 109
110 if ( recurs != r2.recurs 110 if ( recurs != r2.recurs
111 || rFreq != r2.rFreq 111 || rFreq != r2.rFreq
112 || rDuration != r2.rDuration 112 || rDuration != r2.rDuration
113 || !rDuration && rEndDateTime != r2.rEndDateTime 113 || !rDuration && rEndDateTime != r2.rEndDateTime
114 || mRecurStart != r2.mRecurStart 114 || mRecurStart != r2.mRecurStart
115 || mFloats != r2.mFloats 115 || mFloats != r2.mFloats
116 || mRecurReadOnly != r2.mRecurReadOnly 116 || mRecurReadOnly != r2.mRecurReadOnly
117 || mRecurExDatesCount != r2.mRecurExDatesCount ) 117 || mRecurExDatesCount != r2.mRecurExDatesCount )
118 return false; 118 return false;
119 // no need to compare mCompat* and mParent 119 // no need to compare mCompat* and mParent
120 // OK to compare the pointers 120 // OK to compare the pointers
121 switch ( recurs ) 121 switch ( recurs )
122 { 122 {
123 case rWeekly: 123 case rWeekly:
124 return rDays == r2.rDays 124 return rDays == r2.rDays
125 && rWeekStart == r2.rWeekStart; 125 && rWeekStart == r2.rWeekStart;
126 case rMonthlyPos: { 126 case rMonthlyPos: {
127 QPtrList<rMonthPos> MonthPositions = rMonthPositions; 127 QPtrList<rMonthPos> MonthPositions = rMonthPositions;
128 QPtrList<rMonthPos> MonthPositions2 = r2.rMonthPositions; 128 QPtrList<rMonthPos> MonthPositions2 = r2.rMonthPositions;
129 if ( !MonthPositions.count() ) 129 if ( !MonthPositions.count() )
130 return false; 130 return false;
131 if ( !MonthPositions2.count() ) 131 if ( !MonthPositions2.count() )
132 return false; 132 return false;
133 return MonthPositions.first()->rPos == MonthPositions2.first()->rPos; 133 return MonthPositions.first()->rPos == MonthPositions2.first()->rPos;
134 } 134 }
135 case rMonthlyDay: { 135 case rMonthlyDay: {
136 QPtrList<int> MonthDays = rMonthDays ; 136 QPtrList<int> MonthDays = rMonthDays ;
137 QPtrList<int> MonthDays2 = r2.rMonthDays ; 137 QPtrList<int> MonthDays2 = r2.rMonthDays ;
138 if ( !MonthDays.count() ) 138 if ( !MonthDays.count() )
139 return false; 139 return false;
140 if ( !MonthDays2.count() ) 140 if ( !MonthDays2.count() )
141 return false; 141 return false;
142 return *MonthDays.first() == *MonthDays2.first() ; 142 return *MonthDays.first() == *MonthDays2.first() ;
143 } 143 }
144 case rYearlyPos: { 144 case rYearlyPos: {
145 145
146 QPtrList<int> YearNums = rYearNums; 146 QPtrList<int> YearNums = rYearNums;
147 QPtrList<int> YearNums2 = r2.rYearNums; 147 QPtrList<int> YearNums2 = r2.rYearNums;
148 if ( *YearNums.first() != *YearNums2.first() ) 148 if ( *YearNums.first() != *YearNums2.first() )
149 return false; 149 return false;
150 QPtrList<rMonthPos> MonthPositions = rMonthPositions; 150 QPtrList<rMonthPos> MonthPositions = rMonthPositions;
151 QPtrList<rMonthPos> MonthPositions2 = r2.rMonthPositions; 151 QPtrList<rMonthPos> MonthPositions2 = r2.rMonthPositions;
152 if ( !MonthPositions.count() ) 152 if ( !MonthPositions.count() )
153 return false; 153 return false;
154 if ( !MonthPositions2.count() ) 154 if ( !MonthPositions2.count() )
155 return false; 155 return false;
156 return MonthPositions.first()->rPos == MonthPositions2.first()->rPos; 156 return MonthPositions.first()->rPos == MonthPositions2.first()->rPos;
157 157
158 } 158 }
159 case rYearlyMonth: { 159 case rYearlyMonth: {
160 QPtrList<int> YearNums = rYearNums; 160 QPtrList<int> YearNums = rYearNums;
161 QPtrList<int> YearNums2 = r2.rYearNums; 161 QPtrList<int> YearNums2 = r2.rYearNums;
162 return ( *YearNums.first() == *YearNums2.first() && mFeb29YearlyType == r2.mFeb29YearlyType); 162 return ( *YearNums.first() == *YearNums2.first() && mFeb29YearlyType == r2.mFeb29YearlyType);
163 } 163 }
164 case rYearlyDay: { 164 case rYearlyDay: {
165 QPtrList<int> YearNums = rYearNums; 165 QPtrList<int> YearNums = rYearNums;
166 QPtrList<int> YearNums2 = r2.rYearNums; 166 QPtrList<int> YearNums2 = r2.rYearNums;
167 return ( *YearNums.first() == *YearNums2.first() ); 167 return ( *YearNums.first() == *YearNums2.first() );
168 } 168 }
169 case rNone: 169 case rNone:
170 case rMinutely: 170 case rMinutely:
171 case rHourly: 171 case rHourly:
172 case rDaily: 172 case rDaily:
173 default: 173 default:
174 return true; 174 return true;
175 } 175 }
176} 176}
177/* 177/*
178bool Recurrence::compareLists( const QPtrList<int> &l1 ,const QPtrList<int> &l2) 178bool Recurrence::compareLists( const QPtrList<int> &l1 ,const QPtrList<int> &l2)
179{ 179{
180 if ( l1.count() != l2.count() ) 180 if ( l1.count() != l2.count() )
181 return false; 181 return false;
182 int count = l1.count(); 182 int count = l1.count();
183 int i; 183 int i;
184 for ( i = 0; i < count ; ++i ) { 184 for ( i = 0; i < count ; ++i ) {
185 // if ( l1.at(i) != l2.at(i) ) 185 // if ( l1.at(i) != l2.at(i) )
186 return false; 186 return false;
187 qDebug("compüare "); 187 qDebug("compüare ");
188 } 188 }
189 return true; 189 return true;
190} 190}
191*/ 191*/
192QString Recurrence::recurrenceText() const 192QString Recurrence::recurrenceText() const
193{ 193{
194 QString recurText = i18n("No"); 194 QString recurText;
195 if ( recurs == Recurrence::rMinutely ) 195 if ( recurs == Recurrence::rMinutely )
196 recurText = i18n("minutely"); 196 recurText = i18n("minutely");
197 else if ( recurs == Recurrence::rHourly ) 197 else if ( recurs == Recurrence::rHourly )
198 recurText = i18n("hourly"); 198 recurText = i18n("hourly");
199 else if ( recurs == Recurrence::rDaily ) 199 else if ( recurs == Recurrence::rDaily )
200 recurText = i18n("daily"); 200 recurText = i18n("daily");
201 else if ( recurs == Recurrence::rWeekly ) 201 else if ( recurs == Recurrence::rWeekly )
202 recurText = i18n("weekly"); 202 recurText = i18n("weekly");
203 else if ( recurs == Recurrence::rMonthlyPos ) 203 else if ( recurs == Recurrence::rMonthlyPos )
204 recurText = i18n("monthly"); 204 recurText = i18n("monthly");
205 else if ( recurs == Recurrence::rMonthlyDay ) 205 else if ( recurs == Recurrence::rMonthlyDay )
206 recurText = i18n("day-monthly"); 206 recurText = i18n("monthly");
207 else if ( recurs == Recurrence::rYearlyMonth ) 207 else if ( recurs == Recurrence::rYearlyMonth )
208 recurText = i18n("month-yearly"); 208 recurText = i18n("yearly");
209 else if ( recurs == Recurrence::rYearlyDay ) 209 else if ( recurs == Recurrence::rYearlyDay )
210 recurText = i18n("day-yearly"); 210 recurText = i18n("day-yearly");
211 else if ( recurs == Recurrence::rYearlyPos ) 211 else if ( recurs == Recurrence::rYearlyPos )
212 recurText = i18n("position-yearly"); 212 recurText = i18n("position-yearly");
213 if ( !recurText.isEmpty() ) {
214 if ( rFreq > 1 ){
215 recurText = i18n("(%1) ").arg(rFreq ) + recurText;
216 }
217 } else
218 recurText = i18n("No");
213 return recurText; 219 return recurText;
214} 220}
215 221
216void Recurrence::setCompatVersion(int version) 222void Recurrence::setCompatVersion(int version)
217{ 223{
218 mCompatVersion = version ? version : INT_MAX; 224 mCompatVersion = version ? version : INT_MAX;
219} 225}
220 226
221ushort Recurrence::doesRecur() const 227ushort Recurrence::doesRecur() const
222{ 228{
223 return recurs; 229 return recurs;
224} 230}
225 231
226bool Recurrence::recursOnPure(const QDate &qd) const 232bool Recurrence::recursOnPure(const QDate &qd) const
227{ 233{
228 switch(recurs) { 234 switch(recurs) {
229 case rMinutely: 235 case rMinutely:
230 return recursSecondly(qd, rFreq*60); 236 return recursSecondly(qd, rFreq*60);
231 case rHourly: 237 case rHourly:
232 return recursSecondly(qd, rFreq*3600); 238 return recursSecondly(qd, rFreq*3600);
233 case rDaily: 239 case rDaily:
234 return recursDaily(qd); 240 return recursDaily(qd);
235 case rWeekly: 241 case rWeekly:
236 return recursWeekly(qd); 242 return recursWeekly(qd);
237 case rMonthlyPos: 243 case rMonthlyPos:
238 case rMonthlyDay: 244 case rMonthlyDay:
239 return recursMonthly(qd); 245 return recursMonthly(qd);
240 case rYearlyMonth: 246 case rYearlyMonth:
241 return recursYearlyByMonth(qd); 247 return recursYearlyByMonth(qd);
242 case rYearlyDay: 248 case rYearlyDay:
243 return recursYearlyByDay(qd); 249 return recursYearlyByDay(qd);
244 case rYearlyPos: 250 case rYearlyPos:
245 return recursYearlyByPos(qd); 251 return recursYearlyByPos(qd);
246 default: 252 default:
247 return false; 253 return false;
248 case rNone: 254 case rNone:
249 return false; 255 return false;
250 } // case 256 } // case
251 return false; 257 return false;
252} 258}
253 259
254bool Recurrence::recursAtPure(const QDateTime &dt) const 260bool Recurrence::recursAtPure(const QDateTime &dt) const
255{ 261{
256 switch(recurs) { 262 switch(recurs) {
257 case rMinutely: 263 case rMinutely:
258 return recursMinutelyAt(dt, rFreq); 264 return recursMinutelyAt(dt, rFreq);
259 case rHourly: 265 case rHourly:
260 return recursMinutelyAt(dt, rFreq*60); 266 return recursMinutelyAt(dt, rFreq*60);
261 default: 267 default:
262 if (dt.time() != mRecurStart.time()) 268 if (dt.time() != mRecurStart.time())
263 return false; 269 return false;
264 switch(recurs) { 270 switch(recurs) {
265 case rDaily: 271 case rDaily:
266 return recursDaily(dt.date()); 272 return recursDaily(dt.date());
267 case rWeekly: 273 case rWeekly:
268 return recursWeekly(dt.date()); 274 return recursWeekly(dt.date());
269 case rMonthlyPos: 275 case rMonthlyPos:
270 case rMonthlyDay: 276 case rMonthlyDay:
271 return recursMonthly(dt.date()); 277 return recursMonthly(dt.date());
272 case rYearlyMonth: 278 case rYearlyMonth:
273 return recursYearlyByMonth(dt.date()); 279 return recursYearlyByMonth(dt.date());
274 case rYearlyDay: 280 case rYearlyDay:
275 return recursYearlyByDay(dt.date()); 281 return recursYearlyByDay(dt.date());
276 case rYearlyPos: 282 case rYearlyPos:
277 return recursYearlyByPos(dt.date()); 283 return recursYearlyByPos(dt.date());
278 default: 284 default:
279 return false; 285 return false;
280 case rNone: 286 case rNone:
281 return false; 287 return false;
282 } 288 }
283 } // case 289 } // case
284 return false; 290 return false;
285} 291}
286 292
287QDate Recurrence::endDate() const 293QDate Recurrence::endDate() const
288{ 294{
289 int count = 0; 295 int count = 0;
290 QDate end; 296 QDate end;
291 if (recurs != rNone) { 297 if (recurs != rNone) {
292 if (rDuration < 0) 298 if (rDuration < 0)
293 return QDate(); // infinite recurrence 299 return QDate(); // infinite recurrence
294 if (rDuration == 0) 300 if (rDuration == 0)
295 return rEndDateTime.date(); 301 return rEndDateTime.date();
296 302
297 // The end date is determined by the recurrence count 303 // The end date is determined by the recurrence count
298 QDate dStart = mRecurStart.date(); 304 QDate dStart = mRecurStart.date();
299 switch (recurs) 305 switch (recurs)
300 { 306 {
301 case rMinutely: 307 case rMinutely:
302 return mRecurStart.addSecs((rDuration-1+mRecurExDatesCount)*rFreq*60).date(); 308 return mRecurStart.addSecs((rDuration-1+mRecurExDatesCount)*rFreq*60).date();
303 case rHourly: 309 case rHourly:
304 return mRecurStart.addSecs((rDuration-1+mRecurExDatesCount)*rFreq*3600).date(); 310 return mRecurStart.addSecs((rDuration-1+mRecurExDatesCount)*rFreq*3600).date();
305 case rDaily: 311 case rDaily:
306 return dStart.addDays((rDuration-1+mRecurExDatesCount)*rFreq); 312 return dStart.addDays((rDuration-1+mRecurExDatesCount)*rFreq);
307 313
308 case rWeekly: 314 case rWeekly:
309 count = weeklyCalc(END_DATE_AND_COUNT, end); 315 count = weeklyCalc(END_DATE_AND_COUNT, end);
310 break; 316 break;
311 case rMonthlyPos: 317 case rMonthlyPos:
312 case rMonthlyDay: 318 case rMonthlyDay:
313 count = monthlyCalc(END_DATE_AND_COUNT, end); 319 count = monthlyCalc(END_DATE_AND_COUNT, end);
314 break; 320 break;
315 case rYearlyMonth: 321 case rYearlyMonth:
316 count = yearlyMonthCalc(END_DATE_AND_COUNT, end); 322 count = yearlyMonthCalc(END_DATE_AND_COUNT, end);
317 break; 323 break;
318 case rYearlyDay: 324 case rYearlyDay:
319 count = yearlyDayCalc(END_DATE_AND_COUNT, end); 325 count = yearlyDayCalc(END_DATE_AND_COUNT, end);
320 break; 326 break;
321 case rYearlyPos: 327 case rYearlyPos:
322 count = yearlyPosCalc(END_DATE_AND_COUNT, end); 328 count = yearlyPosCalc(END_DATE_AND_COUNT, end);
323 break; 329 break;
324 default: 330 default:
325 // catch-all. Should never get here. 331 // catch-all. Should never get here.
326 kdDebug(5800) << "Control should never reach here in endDate()!" << endl; 332 kdDebug(5800) << "Control should never reach here in endDate()!" << endl;
327 break; 333 break;
328 } 334 }
329 } 335 }
330 if (!count) 336 if (!count)
331 return QDate(); // error - there is no recurrence 337 return QDate(); // error - there is no recurrence
332 return end; 338 return end;
333} 339}
334 340
335QDateTime Recurrence::endDateTime() const 341QDateTime Recurrence::endDateTime() const
336{ 342{
337 int count = 0; 343 int count = 0;
338 QDate end; 344 QDate end;
339 if (recurs != rNone) { 345 if (recurs != rNone) {
340 if (rDuration < 0) 346 if (rDuration < 0)
341 return QDateTime(); // infinite recurrence 347 return QDateTime(); // infinite recurrence
342 if (rDuration == 0) 348 if (rDuration == 0)
343 return rEndDateTime; 349 return rEndDateTime;
344 350
345 // The end date is determined by the recurrence count 351 // The end date is determined by the recurrence count
346 QDate dStart = mRecurStart.date(); 352 QDate dStart = mRecurStart.date();
347 switch (recurs) 353 switch (recurs)
348 { 354 {
349 case rMinutely: 355 case rMinutely:
350 return mRecurStart.addSecs((rDuration-1+mRecurExDatesCount)*rFreq*60); 356 return mRecurStart.addSecs((rDuration-1+mRecurExDatesCount)*rFreq*60);
351 case rHourly: 357 case rHourly:
352 return mRecurStart.addSecs((rDuration-1+mRecurExDatesCount)*rFreq*3600); 358 return mRecurStart.addSecs((rDuration-1+mRecurExDatesCount)*rFreq*3600);
353 case rDaily: 359 case rDaily:
354 return dStart.addDays((rDuration-1+mRecurExDatesCount)*rFreq); 360 return dStart.addDays((rDuration-1+mRecurExDatesCount)*rFreq);
355 361
356 case rWeekly: 362 case rWeekly:
357 count = weeklyCalc(END_DATE_AND_COUNT, end); 363 count = weeklyCalc(END_DATE_AND_COUNT, end);
358 break; 364 break;
359 case rMonthlyPos: 365 case rMonthlyPos:
360 case rMonthlyDay: 366 case rMonthlyDay:
361 count = monthlyCalc(END_DATE_AND_COUNT, end); 367 count = monthlyCalc(END_DATE_AND_COUNT, end);
362 break; 368 break;
363 case rYearlyMonth: 369 case rYearlyMonth:
364 count = yearlyMonthCalc(END_DATE_AND_COUNT, end); 370 count = yearlyMonthCalc(END_DATE_AND_COUNT, end);
365 break; 371 break;
366 case rYearlyDay: 372 case rYearlyDay:
367 count = yearlyDayCalc(END_DATE_AND_COUNT, end); 373 count = yearlyDayCalc(END_DATE_AND_COUNT, end);
368 break; 374 break;
369 case rYearlyPos: 375 case rYearlyPos:
370 count = yearlyPosCalc(END_DATE_AND_COUNT, end); 376 count = yearlyPosCalc(END_DATE_AND_COUNT, end);
371 break; 377 break;
372 default: 378 default:
373 // catch-all. Should never get here. 379 // catch-all. Should never get here.
374 kdDebug(5800) << "Control should never reach here in endDate()!" << endl; 380 kdDebug(5800) << "Control should never reach here in endDate()!" << endl;
375 break; 381 break;
376 } 382 }
377 } 383 }
378 if (!count) 384 if (!count)
379 return QDateTime(); // error - there is no recurrence 385 return QDateTime(); // error - there is no recurrence
380 return QDateTime(end, mRecurStart.time()); 386 return QDateTime(end, mRecurStart.time());
381} 387}
382 388
383int Recurrence::durationTo(const QDate &date) const 389int Recurrence::durationTo(const QDate &date) const
384{ 390{
385 QDate d = date; 391 QDate d = date;
386 return recurCalc(COUNT_TO_DATE, d); 392 return recurCalc(COUNT_TO_DATE, d);
387} 393}
388 394
389int Recurrence::durationTo(const QDateTime &datetime) const 395int Recurrence::durationTo(const QDateTime &datetime) const
390{ 396{
391 QDateTime dt = datetime; 397 QDateTime dt = datetime;
392 return recurCalc(COUNT_TO_DATE, dt); 398 return recurCalc(COUNT_TO_DATE, dt);
393} 399}
394 400
395void Recurrence::unsetRecurs() 401void Recurrence::unsetRecurs()
396{ 402{
397 if (mRecurReadOnly) return; 403 if (mRecurReadOnly) return;
398 recurs = rNone; 404 recurs = rNone;
399 rMonthPositions.clear(); 405 rMonthPositions.clear();
400 rMonthDays.clear(); 406 rMonthDays.clear();
401 rYearNums.clear(); 407 rYearNums.clear();
402} 408}
403 409
404void Recurrence::setRecurStart(const QDateTime &start) 410void Recurrence::setRecurStart(const QDateTime &start)
405{ 411{
406 mRecurStart = start; 412 mRecurStart = start;
407 mFloats = false; 413 mFloats = false;
408 switch (recurs) 414 switch (recurs)
409 { 415 {
410 case rMinutely: 416 case rMinutely:
411 case rHourly: 417 case rHourly:
412 break; 418 break;
413 case rDaily: 419 case rDaily:
414 case rWeekly: 420 case rWeekly:
415 case rMonthlyPos: 421 case rMonthlyPos:
416 case rMonthlyDay: 422 case rMonthlyDay:
417 case rYearlyMonth: 423 case rYearlyMonth:
418 case rYearlyDay: 424 case rYearlyDay:
419 case rYearlyPos: 425 case rYearlyPos:
420 default: 426 default:
421 rEndDateTime.setTime(start.time()); 427 rEndDateTime.setTime(start.time());
422 break; 428 break;
423 } 429 }
424} 430}
425 431
426void Recurrence::setRecurStart(const QDate &start) 432void Recurrence::setRecurStart(const QDate &start)
427{ 433{
428 mRecurStart.setDate(start); 434 mRecurStart.setDate(start);
429 mRecurStart.setTime(QTime(0,0,0)); 435 mRecurStart.setTime(QTime(0,0,0));
430 switch (recurs) 436 switch (recurs)
431 { 437 {
432 case rMinutely: 438 case rMinutely:
433 case rHourly: 439 case rHourly:
434 break; 440 break;
435 case rDaily: 441 case rDaily:
436 case rWeekly: 442 case rWeekly:
437 case rMonthlyPos: 443 case rMonthlyPos:
438 case rMonthlyDay: 444 case rMonthlyDay:
439 case rYearlyMonth: 445 case rYearlyMonth:
440 case rYearlyDay: 446 case rYearlyDay:
441 case rYearlyPos: 447 case rYearlyPos:
442 default: 448 default:
443 mFloats = true; 449 mFloats = true;
444 break; 450 break;
445 } 451 }
446} 452}
447 453
448void Recurrence::setFloats(bool f) 454void Recurrence::setFloats(bool f)
449{ 455{
450 switch (recurs) 456 switch (recurs)
451 { 457 {
452 case rDaily: 458 case rDaily:
453 case rWeekly: 459 case rWeekly:
454 case rMonthlyPos: 460 case rMonthlyPos:
455 case rMonthlyDay: 461 case rMonthlyDay:
456 case rYearlyMonth: 462 case rYearlyMonth:
457 case rYearlyDay: 463 case rYearlyDay:
458 case rYearlyPos: 464 case rYearlyPos:
459 break; 465 break;
460 case rMinutely: 466 case rMinutely:
461 case rHourly: 467 case rHourly:
462 default: 468 default:
463 return; // can't set sub-daily to floating 469 return; // can't set sub-daily to floating
464 } 470 }
465 mFloats = f; 471 mFloats = f;
466 if (f) { 472 if (f) {
467 mRecurStart.setTime(QTime(0,0,0)); 473 mRecurStart.setTime(QTime(0,0,0));
468 rEndDateTime.setTime(QTime(0,0,0)); 474 rEndDateTime.setTime(QTime(0,0,0));
469 } 475 }
470} 476}
471 477
472int Recurrence::frequency() const 478int Recurrence::frequency() const
473{ 479{
474 return rFreq; 480 return rFreq;
475} 481}
476 482
477int Recurrence::duration() const 483int Recurrence::duration() const
478{ 484{
479 return rDuration; 485 return rDuration;
480} 486}
481 487
482void Recurrence::setDuration(int _rDuration) 488void Recurrence::setDuration(int _rDuration)
483{ 489{
484 if (mRecurReadOnly) return; 490 if (mRecurReadOnly) return;
485 if (_rDuration > 0) { 491 if (_rDuration > 0) {
486 rDuration = _rDuration; 492 rDuration = _rDuration;
487 // Compatibility mode is only needed when reading the calendar in ICalFormatImpl, 493 // Compatibility mode is only needed when reading the calendar in ICalFormatImpl,
488 // so explicitly setting the duration means no backwards compatibility is needed. 494 // so explicitly setting the duration means no backwards compatibility is needed.
489 mCompatDuration = 0; 495 mCompatDuration = 0;
490 } 496 }
491} 497}
492 498
493QString Recurrence::endDateStr(bool shortfmt) const 499QString Recurrence::endDateStr(bool shortfmt) const
494{ 500{
495 return KGlobal::locale()->formatDate(rEndDateTime.date(),shortfmt); 501 return KGlobal::locale()->formatDate(rEndDateTime.date(),shortfmt);
496} 502}
497 503
498const QBitArray &Recurrence::days() const 504const QBitArray &Recurrence::days() const
499{ 505{
500 return rDays; 506 return rDays;
501} 507}
502 508
503const QPtrList<Recurrence::rMonthPos> &Recurrence::monthPositions() const 509const QPtrList<Recurrence::rMonthPos> &Recurrence::monthPositions() const
504{ 510{
505 return rMonthPositions; 511 return rMonthPositions;
506} 512}
507 513
508const QPtrList<Recurrence::rMonthPos> &Recurrence::yearMonthPositions() const 514const QPtrList<Recurrence::rMonthPos> &Recurrence::yearMonthPositions() const
509{ 515{
510 return rMonthPositions; 516 return rMonthPositions;
511} 517}
512 518
513const QPtrList<int> &Recurrence::monthDays() const 519const QPtrList<int> &Recurrence::monthDays() const
514{ 520{
515 return rMonthDays; 521 return rMonthDays;
516} 522}
517 523
518void Recurrence::setMinutely(int _rFreq, int _rDuration) 524void Recurrence::setMinutely(int _rFreq, int _rDuration)
519{ 525{
520 if (mRecurReadOnly || _rDuration == 0 || _rDuration < -1) 526 if (mRecurReadOnly || _rDuration == 0 || _rDuration < -1)
521 return; 527 return;
522 setDailySub(rMinutely, _rFreq, _rDuration); 528 setDailySub(rMinutely, _rFreq, _rDuration);
523} 529}
524 530
525void Recurrence::setMinutely(int _rFreq, const QDateTime &_rEndDateTime) 531void Recurrence::setMinutely(int _rFreq, const QDateTime &_rEndDateTime)
526{ 532{
527 if (mRecurReadOnly) return; 533 if (mRecurReadOnly) return;
528 rEndDateTime = _rEndDateTime; 534 rEndDateTime = _rEndDateTime;
529 setDailySub(rMinutely, _rFreq, 0); 535 setDailySub(rMinutely, _rFreq, 0);
530} 536}
531 537
532void Recurrence::setHourly(int _rFreq, int _rDuration) 538void Recurrence::setHourly(int _rFreq, int _rDuration)
533{ 539{
534 if (mRecurReadOnly || _rDuration == 0 || _rDuration < -1) 540 if (mRecurReadOnly || _rDuration == 0 || _rDuration < -1)
535 return; 541 return;
536 setDailySub(rHourly, _rFreq, _rDuration); 542 setDailySub(rHourly, _rFreq, _rDuration);
537} 543}
538 544
539void Recurrence::setHourly(int _rFreq, const QDateTime &_rEndDateTime) 545void Recurrence::setHourly(int _rFreq, const QDateTime &_rEndDateTime)
540{ 546{
541 if (mRecurReadOnly) return; 547 if (mRecurReadOnly) return;
542 rEndDateTime = _rEndDateTime; 548 rEndDateTime = _rEndDateTime;
543 setDailySub(rHourly, _rFreq, 0); 549 setDailySub(rHourly, _rFreq, 0);
544} 550}
545 551
546void Recurrence::setDaily(int _rFreq, int _rDuration) 552void Recurrence::setDaily(int _rFreq, int _rDuration)
547{ 553{
548 if (mRecurReadOnly || _rDuration == 0 || _rDuration < -1) 554 if (mRecurReadOnly || _rDuration == 0 || _rDuration < -1)
549 return; 555 return;
550 setDailySub(rDaily, _rFreq, _rDuration); 556 setDailySub(rDaily, _rFreq, _rDuration);
551} 557}
552 558
553void Recurrence::setDaily(int _rFreq, const QDate &_rEndDate) 559void Recurrence::setDaily(int _rFreq, const QDate &_rEndDate)
554{ 560{
555 if (mRecurReadOnly) return; 561 if (mRecurReadOnly) return;
556 rEndDateTime.setDate(_rEndDate); 562 rEndDateTime.setDate(_rEndDate);
557 rEndDateTime.setTime(mRecurStart.time()); 563 rEndDateTime.setTime(mRecurStart.time());
558 setDailySub(rDaily, _rFreq, 0); 564 setDailySub(rDaily, _rFreq, 0);
559} 565}
560 566
561void Recurrence::setWeekly(int _rFreq, const QBitArray &_rDays, 567void Recurrence::setWeekly(int _rFreq, const QBitArray &_rDays,
562 int _rDuration, int _rWeekStart) 568 int _rDuration, int _rWeekStart)
563{ 569{
564 if (mRecurReadOnly || _rDuration == 0 || _rDuration < -1) 570 if (mRecurReadOnly || _rDuration == 0 || _rDuration < -1)
565 return; 571 return;
566 recurs = rWeekly; 572 recurs = rWeekly;
567 573
568 rFreq = _rFreq; 574 rFreq = _rFreq;
569 rDays = _rDays; 575 rDays = _rDays;
570 rWeekStart = _rWeekStart; 576 rWeekStart = _rWeekStart;
571 rDuration = _rDuration; 577 rDuration = _rDuration;
572 if (mCompatVersion < 310 && _rDuration > 0) { 578 if (mCompatVersion < 310 && _rDuration > 0) {
573 // Backwards compatibility for KDE < 3.1. 579 // Backwards compatibility for KDE < 3.1.
574 // rDuration was set to the number of time periods to recur, 580 // rDuration was set to the number of time periods to recur,
575 // with week start always on a Monday. 581 // with week start always on a Monday.
576 // Convert this to the number of occurrences. 582 // Convert this to the number of occurrences.
577 mCompatDuration = _rDuration; 583 mCompatDuration = _rDuration;
578 int weeks = ((mCompatDuration-1+mRecurExDatesCount)*7) + (7 - mRecurStart.date().dayOfWeek()); 584 int weeks = ((mCompatDuration-1+mRecurExDatesCount)*7) + (7 - mRecurStart.date().dayOfWeek());
579 QDate end(mRecurStart.date().addDays(weeks * rFreq)); 585 QDate end(mRecurStart.date().addDays(weeks * rFreq));
580 rDuration = INT_MAX; // ensure that weeklyCalc() does its job correctly 586 rDuration = INT_MAX; // ensure that weeklyCalc() does its job correctly
581 rDuration = weeklyCalc(COUNT_TO_DATE, end); 587 rDuration = weeklyCalc(COUNT_TO_DATE, end);
582 } else { 588 } else {
583 mCompatDuration = 0; 589 mCompatDuration = 0;
584 } 590 }
585 rMonthPositions.clear(); 591 rMonthPositions.clear();
586 rMonthDays.clear(); 592 rMonthDays.clear();
587 if (mParent) mParent->updated(); 593 if (mParent) mParent->updated();
588} 594}
589 595
590void Recurrence::setWeekly(int _rFreq, const QBitArray &_rDays, 596void Recurrence::setWeekly(int _rFreq, const QBitArray &_rDays,
591 const QDate &_rEndDate, int _rWeekStart) 597 const QDate &_rEndDate, int _rWeekStart)
592{ 598{
593 if (mRecurReadOnly) return; 599 if (mRecurReadOnly) return;
594 recurs = rWeekly; 600 recurs = rWeekly;
595 601
596 rFreq = _rFreq; 602 rFreq = _rFreq;
597 rDays = _rDays; 603 rDays = _rDays;
598 rWeekStart = _rWeekStart; 604 rWeekStart = _rWeekStart;
599 rEndDateTime.setDate(_rEndDate); 605 rEndDateTime.setDate(_rEndDate);
600 rEndDateTime.setTime(mRecurStart.time()); 606 rEndDateTime.setTime(mRecurStart.time());
601 rDuration = 0; // set to 0 because there is an end date 607 rDuration = 0; // set to 0 because there is an end date
602 mCompatDuration = 0; 608 mCompatDuration = 0;
603 rMonthPositions.clear(); 609 rMonthPositions.clear();
604 rMonthDays.clear(); 610 rMonthDays.clear();
605 rYearNums.clear(); 611 rYearNums.clear();
606 if (mParent) mParent->updated(); 612 if (mParent) mParent->updated();
607} 613}
608 614
609void Recurrence::setMonthly(short type, int _rFreq, int _rDuration) 615void Recurrence::setMonthly(short type, int _rFreq, int _rDuration)
610{ 616{
611 if (mRecurReadOnly || _rDuration == 0 || _rDuration < -1) 617 if (mRecurReadOnly || _rDuration == 0 || _rDuration < -1)
612 return; 618 return;
613 recurs = type; 619 recurs = type;
614 620
615 rFreq = _rFreq; 621 rFreq = _rFreq;
616 rDuration = _rDuration; 622 rDuration = _rDuration;
617 if (mCompatVersion < 310) 623 if (mCompatVersion < 310)
618 mCompatDuration = (_rDuration > 0) ? _rDuration : 0; 624 mCompatDuration = (_rDuration > 0) ? _rDuration : 0;
619 rYearNums.clear(); 625 rYearNums.clear();
620 if (mParent) mParent->updated(); 626 if (mParent) mParent->updated();
621} 627}
622 628
623void Recurrence::setMonthly(short type, int _rFreq, 629void Recurrence::setMonthly(short type, int _rFreq,
624 const QDate &_rEndDate) 630 const QDate &_rEndDate)
625{ 631{
626 if (mRecurReadOnly) return; 632 if (mRecurReadOnly) return;
627 recurs = type; 633 recurs = type;
628 634
629 rFreq = _rFreq; 635 rFreq = _rFreq;
630 rEndDateTime.setDate(_rEndDate); 636 rEndDateTime.setDate(_rEndDate);
631 rEndDateTime.setTime(mRecurStart.time()); 637 rEndDateTime.setTime(mRecurStart.time());
632 rDuration = 0; // set to 0 because there is an end date 638 rDuration = 0; // set to 0 because there is an end date
633 mCompatDuration = 0; 639 mCompatDuration = 0;
634 rYearNums.clear(); 640 rYearNums.clear();
635 if (mParent) mParent->updated(); 641 if (mParent) mParent->updated();
636} 642}
637 643
638void Recurrence::addMonthlyPos(short _rPos, const QBitArray &_rDays) 644void Recurrence::addMonthlyPos(short _rPos, const QBitArray &_rDays)
639{ 645{
640 if (recurs == rMonthlyPos) 646 if (recurs == rMonthlyPos)
641 addMonthlyPos_(_rPos, _rDays); 647 addMonthlyPos_(_rPos, _rDays);
642} 648}
643 649
644void Recurrence::addMonthlyPos_(short _rPos, const QBitArray &_rDays) 650void Recurrence::addMonthlyPos_(short _rPos, const QBitArray &_rDays)
645{ 651{
646 if (mRecurReadOnly 652 if (mRecurReadOnly
647 || _rPos == 0 || _rPos > 5 || _rPos < -5) // invalid week number 653 || _rPos == 0 || _rPos > 5 || _rPos < -5) // invalid week number
648 return; 654 return;
649 655
650 for (rMonthPos* it = rMonthPositions.first(); it; it = rMonthPositions.next()) { 656 for (rMonthPos* it = rMonthPositions.first(); it; it = rMonthPositions.next()) {
651 int itPos = it->negative ? -it->rPos : it->rPos; 657 int itPos = it->negative ? -it->rPos : it->rPos;
652 if (_rPos == itPos) { 658 if (_rPos == itPos) {
653 // This week is already in the list. 659 // This week is already in the list.
654 // Combine the specified days with those in the list. 660 // Combine the specified days with those in the list.
655 it->rDays |= _rDays; 661 it->rDays |= _rDays;
656 if (mParent) mParent->updated(); 662 if (mParent) mParent->updated();
657 return; 663 return;
658 } 664 }
659 } 665 }
660 // Add the new position to the list 666 // Add the new position to the list
661 rMonthPos *tmpPos = new rMonthPos; 667 rMonthPos *tmpPos = new rMonthPos;
662 if (_rPos > 0) { 668 if (_rPos > 0) {
663 tmpPos->rPos = _rPos; 669 tmpPos->rPos = _rPos;
664 tmpPos->negative = false; 670 tmpPos->negative = false;
665 } else { 671 } else {
666 tmpPos->rPos = -_rPos; // take abs() 672 tmpPos->rPos = -_rPos; // take abs()
667 tmpPos->negative = true; 673 tmpPos->negative = true;
668 } 674 }
669 tmpPos->rDays = _rDays; 675 tmpPos->rDays = _rDays;
670 tmpPos->rDays.detach(); 676 tmpPos->rDays.detach();
671 rMonthPositions.append(tmpPos); 677 rMonthPositions.append(tmpPos);
672 678
673 if (mCompatVersion < 310 && mCompatDuration > 0) { 679 if (mCompatVersion < 310 && mCompatDuration > 0) {
674 // Backwards compatibility for KDE < 3.1. 680 // Backwards compatibility for KDE < 3.1.
675 // rDuration was set to the number of time periods to recur. 681 // rDuration was set to the number of time periods to recur.
676 // Convert this to the number of occurrences. 682 // Convert this to the number of occurrences.
677 int monthsAhead = (mCompatDuration-1+mRecurExDatesCount) * rFreq; 683 int monthsAhead = (mCompatDuration-1+mRecurExDatesCount) * rFreq;
678 int month = mRecurStart.date().month() - 1 + monthsAhead; 684 int month = mRecurStart.date().month() - 1 + monthsAhead;
679 QDate end(mRecurStart.date().year() + month/12, month%12 + 1, 31); 685 QDate end(mRecurStart.date().year() + month/12, month%12 + 1, 31);
680 rDuration = INT_MAX; // ensure that recurCalc() does its job correctly 686 rDuration = INT_MAX; // ensure that recurCalc() does its job correctly
681 rDuration = recurCalc(COUNT_TO_DATE, end); 687 rDuration = recurCalc(COUNT_TO_DATE, end);
682 } 688 }
683 689
684 if (mParent) mParent->updated(); 690 if (mParent) mParent->updated();
685} 691}
686 692
687void Recurrence::addMonthlyDay(short _rDay) 693void Recurrence::addMonthlyDay(short _rDay)
688{ 694{
689 if (mRecurReadOnly || (recurs != rMonthlyDay && recurs != rYearlyMonth) 695 if (mRecurReadOnly || (recurs != rMonthlyDay && recurs != rYearlyMonth)
690 || _rDay == 0 || _rDay > 31 || _rDay < -31) // invalid day number 696 || _rDay == 0 || _rDay > 31 || _rDay < -31) // invalid day number
691 return; 697 return;
692 for (int* it = rMonthDays.first(); it; it = rMonthDays.next()) { 698 for (int* it = rMonthDays.first(); it; it = rMonthDays.next()) {
693 if (_rDay == *it) 699 if (_rDay == *it)
694 return; // this day is already in the list - avoid duplication 700 return; // this day is already in the list - avoid duplication
695 } 701 }
696 int *tmpDay = new int; 702 int *tmpDay = new int;
697 *tmpDay = _rDay; 703 *tmpDay = _rDay;
698 rMonthDays.append(tmpDay); 704 rMonthDays.append(tmpDay);
699 705
700 if (mCompatVersion < 310 && mCompatDuration > 0) { 706 if (mCompatVersion < 310 && mCompatDuration > 0) {
701 // Backwards compatibility for KDE < 3.1. 707 // Backwards compatibility for KDE < 3.1.
702 // rDuration was set to the number of time periods to recur. 708 // rDuration was set to the number of time periods to recur.
703 // Convert this to the number of occurrences. 709 // Convert this to the number of occurrences.
704 int monthsAhead = (mCompatDuration-1+mRecurExDatesCount) * rFreq; 710 int monthsAhead = (mCompatDuration-1+mRecurExDatesCount) * rFreq;
705 int month = mRecurStart.date().month() - 1 + monthsAhead; 711 int month = mRecurStart.date().month() - 1 + monthsAhead;
706 QDate end(mRecurStart.date().year() + month/12, month%12 + 1, 31); 712 QDate end(mRecurStart.date().year() + month/12, month%12 + 1, 31);
707 rDuration = INT_MAX; // ensure that recurCalc() does its job correctly 713 rDuration = INT_MAX; // ensure that recurCalc() does its job correctly
708 rDuration = recurCalc(COUNT_TO_DATE, end); 714 rDuration = recurCalc(COUNT_TO_DATE, end);
709 } 715 }
710 716
711 if (mParent) mParent->updated(); 717 if (mParent) mParent->updated();
712} 718}
713 719
714void Recurrence::setYearly(int type, int _rFreq, int _rDuration) 720void Recurrence::setYearly(int type, int _rFreq, int _rDuration)
715{ 721{
716 if (mRecurReadOnly || _rDuration == 0 || _rDuration < -1) 722 if (mRecurReadOnly || _rDuration == 0 || _rDuration < -1)
717 return; 723 return;
718 if (mCompatVersion < 310) 724 if (mCompatVersion < 310)
719 mCompatDuration = (_rDuration > 0) ? _rDuration : 0; 725 mCompatDuration = (_rDuration > 0) ? _rDuration : 0;
720 setYearly_(type, mFeb29YearlyDefaultType, _rFreq, _rDuration); 726 setYearly_(type, mFeb29YearlyDefaultType, _rFreq, _rDuration);
721} 727}
722 728
723void Recurrence::setYearly(int type, int _rFreq, const QDate &_rEndDate) 729void Recurrence::setYearly(int type, int _rFreq, const QDate &_rEndDate)
724{ 730{
725 if (mRecurReadOnly) return; 731 if (mRecurReadOnly) return;
726 rEndDateTime.setDate(_rEndDate); 732 rEndDateTime.setDate(_rEndDate);
727 rEndDateTime.setTime(mRecurStart.time()); 733 rEndDateTime.setTime(mRecurStart.time());
728 mCompatDuration = 0; 734 mCompatDuration = 0;
729 setYearly_(type, mFeb29YearlyDefaultType, _rFreq, 0); 735 setYearly_(type, mFeb29YearlyDefaultType, _rFreq, 0);
730} 736}
731 737
732void Recurrence::setYearlyByDate(Feb29Type type, int _rFreq, int _rDuration) 738void Recurrence::setYearlyByDate(Feb29Type type, int _rFreq, int _rDuration)
733{ 739{
734 if (mRecurReadOnly || _rDuration == 0 || _rDuration < -1) 740 if (mRecurReadOnly || _rDuration == 0 || _rDuration < -1)
735 return; 741 return;
736 if (mCompatVersion < 310) 742 if (mCompatVersion < 310)
737 mCompatDuration = (_rDuration > 0) ? _rDuration : 0; 743 mCompatDuration = (_rDuration > 0) ? _rDuration : 0;
738 setYearly_(rYearlyMonth, type, _rFreq, _rDuration); 744 setYearly_(rYearlyMonth, type, _rFreq, _rDuration);
739} 745}
740 746
741void Recurrence::setYearlyByDate(Feb29Type type, int _rFreq, const QDate &_rEndDate) 747void Recurrence::setYearlyByDate(Feb29Type type, int _rFreq, const QDate &_rEndDate)
742{ 748{
743 if (mRecurReadOnly) return; 749 if (mRecurReadOnly) return;
744 rEndDateTime.setDate(_rEndDate); 750 rEndDateTime.setDate(_rEndDate);
745 rEndDateTime.setTime(mRecurStart.time()); 751 rEndDateTime.setTime(mRecurStart.time());
746 mCompatDuration = 0; 752 mCompatDuration = 0;
747 setYearly_(rYearlyMonth, type, _rFreq, 0); 753 setYearly_(rYearlyMonth, type, _rFreq, 0);
748} 754}
749 755
750void Recurrence::addYearlyMonthPos(short _rPos, const QBitArray &_rDays) 756void Recurrence::addYearlyMonthPos(short _rPos, const QBitArray &_rDays)
751{ 757{
752 if (recurs == rYearlyPos) 758 if (recurs == rYearlyPos)
753 addMonthlyPos_(_rPos, _rDays); 759 addMonthlyPos_(_rPos, _rDays);
754} 760}
755 761
756const QPtrList<int> &Recurrence::yearNums() const 762const QPtrList<int> &Recurrence::yearNums() const
757{ 763{
758 return rYearNums; 764 return rYearNums;
759} 765}
760void Recurrence::addYearlyMonth(short _rPos ) 766void Recurrence::addYearlyMonth(short _rPos )
761{ 767{
762 if (mRecurReadOnly || recurs != rYearlyMonth) // invalid day/month number 768 if (mRecurReadOnly || recurs != rYearlyMonth) // invalid day/month number
763 return; 769 return;
764 rMonthPos *tmpPos = new rMonthPos; 770 rMonthPos *tmpPos = new rMonthPos;
765 if ( _rPos > 0) { 771 if ( _rPos > 0) {
766 tmpPos->rPos = _rPos; 772 tmpPos->rPos = _rPos;
767 tmpPos->negative = false; 773 tmpPos->negative = false;
768 } else { 774 } else {
769 tmpPos->rPos = -_rPos; // take abs() 775 tmpPos->rPos = -_rPos; // take abs()
770 tmpPos->negative = true; 776 tmpPos->negative = true;
771 } 777 }
772 rMonthPositions.append(tmpPos); 778 rMonthPositions.append(tmpPos);
773} 779}
774void Recurrence::addYearlyNum(short _rNum) 780void Recurrence::addYearlyNum(short _rNum)
775{ 781{
776 if (mRecurReadOnly 782 if (mRecurReadOnly
777 || (recurs != rYearlyMonth && recurs != rYearlyDay && recurs != rYearlyPos) 783 || (recurs != rYearlyMonth && recurs != rYearlyDay && recurs != rYearlyPos)
778 || _rNum <= 0) // invalid day/month number 784 || _rNum <= 0) // invalid day/month number
779 return; 785 return;
780 786
781 if (mCompatVersion < 310 && mCompatRecurs == rYearlyDay) { 787 if (mCompatVersion < 310 && mCompatRecurs == rYearlyDay) {
782 // Backwards compatibility for KDE < 3.1. 788 // Backwards compatibility for KDE < 3.1.
783 // Dates were stored as day numbers, with a fiddle to take account of leap years. 789 // Dates were stored as day numbers, with a fiddle to take account of leap years.
784 // Convert the day number to a month. 790 // Convert the day number to a month.
785 if (_rNum <= 0 || _rNum > 366 || (_rNum == 366 && mRecurStart.date().daysInYear() < 366)) 791 if (_rNum <= 0 || _rNum > 366 || (_rNum == 366 && mRecurStart.date().daysInYear() < 366))
786 return; // invalid day number 792 return; // invalid day number
787 _rNum = QDate(mRecurStart.date().year(), 1, 1).addDays(_rNum - 1).month(); 793 _rNum = QDate(mRecurStart.date().year(), 1, 1).addDays(_rNum - 1).month();
788 } else 794 } else
789 if ((recurs == rYearlyMonth || recurs == rYearlyPos) && _rNum > 12 795 if ((recurs == rYearlyMonth || recurs == rYearlyPos) && _rNum > 12
790 || recurs == rYearlyDay && _rNum > 366) 796 || recurs == rYearlyDay && _rNum > 366)
791 return; // invalid day number 797 return; // invalid day number
792 798
793 uint i = 0; 799 uint i = 0;
794 for (int* it = rYearNums.first(); it && _rNum >= *it; it = rYearNums.next()) { 800 for (int* it = rYearNums.first(); it && _rNum >= *it; it = rYearNums.next()) {
795 if (_rNum == *it) 801 if (_rNum == *it)
796 return; // this day/month is already in the list - avoid duplication 802 return; // this day/month is already in the list - avoid duplication
797 ++i; 803 ++i;
798 } 804 }
799 805
800 int *tmpNum = new int; 806 int *tmpNum = new int;
801 *tmpNum = _rNum; 807 *tmpNum = _rNum;
802 rYearNums.insert(i, tmpNum); // insert the day/month in a sorted position 808 rYearNums.insert(i, tmpNum); // insert the day/month in a sorted position
803 809
804 if (mCompatVersion < 310 && mCompatDuration > 0) { 810 if (mCompatVersion < 310 && mCompatDuration > 0) {
805 // Backwards compatibility for KDE < 3.1. 811 // Backwards compatibility for KDE < 3.1.
806 // rDuration was set to the number of time periods to recur. 812 // rDuration was set to the number of time periods to recur.
807 // Convert this to the number of occurrences. 813 // Convert this to the number of occurrences.
808 QDate end(mRecurStart.date().year() + (mCompatDuration-1+mRecurExDatesCount)*rFreq, 12, 31); 814 QDate end(mRecurStart.date().year() + (mCompatDuration-1+mRecurExDatesCount)*rFreq, 12, 31);
809 rDuration = INT_MAX; // ensure that recurCalc() does its job correctly 815 rDuration = INT_MAX; // ensure that recurCalc() does its job correctly
810 rDuration = recurCalc(COUNT_TO_DATE, end); 816 rDuration = recurCalc(COUNT_TO_DATE, end);
811 } 817 }
812 818
813 if (mParent) mParent->updated(); 819 if (mParent) mParent->updated();
814} 820}
815 821
816 822
817QDateTime Recurrence::getNextDateTime(const QDateTime &preDateTime, bool *last) const 823QDateTime Recurrence::getNextDateTime(const QDateTime &preDateTime, bool *last) const
818{ 824{
819 if (last) 825 if (last)
820 *last = false; 826 *last = false;
821 int freq; 827 int freq;
822 switch (recurs) 828 switch (recurs)
823 { 829 {
824 case rMinutely: 830 case rMinutely:
825 freq = rFreq * 60; 831 freq = rFreq * 60;
826 break; 832 break;
827 case rHourly: 833 case rHourly:
828 freq = rFreq * 3600; 834 freq = rFreq * 3600;
829 break; 835 break;
830 case rDaily: 836 case rDaily:
831 case rWeekly: 837 case rWeekly:
832 case rMonthlyPos: 838 case rMonthlyPos:
833 case rMonthlyDay: 839 case rMonthlyDay:
834 case rYearlyMonth: 840 case rYearlyMonth:
835 case rYearlyDay: 841 case rYearlyDay:
836 case rYearlyPos: { 842 case rYearlyPos: {
837 QDate preDate = preDateTime.date(); 843 QDate preDate = preDateTime.date();
838 if (!mFloats && mRecurStart.time() > preDateTime.time()) 844 if (!mFloats && mRecurStart.time() > preDateTime.time())
839 preDate = preDate.addDays(-1); 845 preDate = preDate.addDays(-1);
840 return QDateTime(getNextDateNoTime(preDate, last), mRecurStart.time()); 846 return QDateTime(getNextDateNoTime(preDate, last), mRecurStart.time());
841 } 847 }
842 default: 848 default:
843 return QDateTime(); 849 return QDateTime();
844 } 850 }
845 851
846 // It's a sub-daily recurrence 852 // It's a sub-daily recurrence
847 if (preDateTime < mRecurStart) 853 if (preDateTime < mRecurStart)
848 return mRecurStart; 854 return mRecurStart;
849 int count = mRecurStart.secsTo(preDateTime) / freq + 2; 855 int count = mRecurStart.secsTo(preDateTime) / freq + 2;
850 if (rDuration > 0) { 856 if (rDuration > 0) {
851 if (count > rDuration) 857 if (count > rDuration)
852 return QDateTime(); 858 return QDateTime();
853 if (last && count == rDuration) 859 if (last && count == rDuration)
854 *last = true; 860 *last = true;
855 } 861 }
856 QDateTime endtime = mRecurStart.addSecs((count - 1)*freq); 862 QDateTime endtime = mRecurStart.addSecs((count - 1)*freq);
857 if (rDuration == 0) { 863 if (rDuration == 0) {
858 if (endtime > rEndDateTime) 864 if (endtime > rEndDateTime)
859 return QDateTime(); 865 return QDateTime();
860 if (last && endtime == rEndDateTime) 866 if (last && endtime == rEndDateTime)
861 *last = true; 867 *last = true;
862 } 868 }
863 return endtime; 869 return endtime;
864} 870}
865 871
866QDate Recurrence::getNextDate(const QDate &preDate, bool *last) const 872QDate Recurrence::getNextDate(const QDate &preDate, bool *last) const
867{ 873{
868 if (last) 874 if (last)
869 *last = false; 875 *last = false;
870 switch (recurs) 876 switch (recurs)
871 { 877 {
872 case rMinutely: 878 case rMinutely:
873 case rHourly: 879 case rHourly:
874 return getNextDateTime(QDateTime(preDate, QTime(23,59,59)), last).date(); 880 return getNextDateTime(QDateTime(preDate, QTime(23,59,59)), last).date();
875 case rDaily: 881 case rDaily:
876 case rWeekly: 882 case rWeekly:
877 case rMonthlyPos: 883 case rMonthlyPos:
878 case rMonthlyDay: 884 case rMonthlyDay:
879 case rYearlyMonth: 885 case rYearlyMonth:
880 case rYearlyDay: 886 case rYearlyDay:
881 case rYearlyPos: 887 case rYearlyPos:
882 qDebug("Recurrence::getNextDate: MAY BE BROKEN "); 888 qDebug("Recurrence::getNextDate: MAY BE BROKEN ");
883 return getNextDateNoTime(preDate, last); 889 return getNextDateNoTime(preDate, last);
884 default: 890 default:
885 return QDate(); 891 return QDate();
886 } 892 }
887} 893}
888 894
889 895
890QDateTime Recurrence::getPreviousDateTime(const QDateTime &afterDateTime, bool *last) const 896QDateTime Recurrence::getPreviousDateTime(const QDateTime &afterDateTime, bool *last) const
891{ 897{
892 if (last) 898 if (last)
893 *last = false; 899 *last = false;
894 int freq; 900 int freq;
895 switch (recurs) 901 switch (recurs)
896 { 902 {
897 case rMinutely: 903 case rMinutely:
898 freq = rFreq * 60; 904 freq = rFreq * 60;
899 break; 905 break;
900 case rHourly: 906 case rHourly:
901 freq = rFreq * 3600; 907 freq = rFreq * 3600;
902 break; 908 break;
903 case rDaily: 909 case rDaily:
904 case rWeekly: 910 case rWeekly:
905 case rMonthlyPos: 911 case rMonthlyPos:
906 case rMonthlyDay: 912 case rMonthlyDay:
907 case rYearlyMonth: 913 case rYearlyMonth:
908 case rYearlyDay: 914 case rYearlyDay:
909 case rYearlyPos: { 915 case rYearlyPos: {
910 QDate afterDate = afterDateTime.date(); 916 QDate afterDate = afterDateTime.date();
911 if (!mFloats && mRecurStart.time() < afterDateTime.time()) 917 if (!mFloats && mRecurStart.time() < afterDateTime.time())
912 afterDate = afterDate.addDays(1); 918 afterDate = afterDate.addDays(1);
913 return QDateTime(getPreviousDateNoTime(afterDate, last), mRecurStart.time()); 919 return QDateTime(getPreviousDateNoTime(afterDate, last), mRecurStart.time());
914 } 920 }
915 default: 921 default:
916 return QDateTime(); 922 return QDateTime();
917 } 923 }
918 924
919 // It's a sub-daily recurrence 925 // It's a sub-daily recurrence
920 if (afterDateTime <= mRecurStart) 926 if (afterDateTime <= mRecurStart)
921 return QDateTime(); 927 return QDateTime();
922 int count = (mRecurStart.secsTo(afterDateTime) - 1) / freq + 1; 928 int count = (mRecurStart.secsTo(afterDateTime) - 1) / freq + 1;
923 if (rDuration > 0) { 929 if (rDuration > 0) {
924 if (count > rDuration) 930 if (count > rDuration)
925 count = rDuration; 931 count = rDuration;
926 if (last && count == rDuration) 932 if (last && count == rDuration)
927 *last = true; 933 *last = true;
928 } 934 }
929 QDateTime endtime = mRecurStart.addSecs((count - 1)*freq); 935 QDateTime endtime = mRecurStart.addSecs((count - 1)*freq);
930 if (rDuration == 0) { 936 if (rDuration == 0) {
931 if (endtime > rEndDateTime) 937 if (endtime > rEndDateTime)
932 endtime = rEndDateTime; 938 endtime = rEndDateTime;
933 if (last && endtime == rEndDateTime) 939 if (last && endtime == rEndDateTime)
934 *last = true; 940 *last = true;
935 } 941 }
936 return endtime; 942 return endtime;
937} 943}
938 944
939QDate Recurrence::getPreviousDate(const QDate &afterDate, bool *last) const 945QDate Recurrence::getPreviousDate(const QDate &afterDate, bool *last) const
940{ 946{
941 if (last) 947 if (last)
942 *last = false; 948 *last = false;
943 switch (recurs) 949 switch (recurs)
944 { 950 {
945 case rMinutely: 951 case rMinutely:
946 case rHourly: 952 case rHourly:
947 return getPreviousDateTime(QDateTime(afterDate, QTime(0,0,0)), last).date(); 953 return getPreviousDateTime(QDateTime(afterDate, QTime(0,0,0)), last).date();
948 case rDaily: 954 case rDaily:
949 case rWeekly: 955 case rWeekly:
950 case rMonthlyPos: 956 case rMonthlyPos:
951 case rMonthlyDay: 957 case rMonthlyDay:
952 case rYearlyMonth: 958 case rYearlyMonth:
953 case rYearlyDay: 959 case rYearlyDay:
954 case rYearlyPos: 960 case rYearlyPos:
955 return getPreviousDateNoTime(afterDate, last); 961 return getPreviousDateNoTime(afterDate, last);
956 default: 962 default:
957 return QDate(); 963 return QDate();
958 } 964 }
959} 965}
960 966
961 967
962/***************************** PROTECTED FUNCTIONS ***************************/ 968/***************************** PROTECTED FUNCTIONS ***************************/
963 969
964bool Recurrence::recursSecondly(const QDate &qd, int secondFreq) const 970bool Recurrence::recursSecondly(const QDate &qd, int secondFreq) const
965{ 971{
966 if ((qd >= mRecurStart.date()) && 972 if ((qd >= mRecurStart.date()) &&
967 ((rDuration > 0) && (qd <= endDate()) || 973 ((rDuration > 0) && (qd <= endDate()) ||
968 ((rDuration == 0) && (qd <= rEndDateTime.date())) || 974 ((rDuration == 0) && (qd <= rEndDateTime.date())) ||
969 (rDuration == -1))) { 975 (rDuration == -1))) {
970 // The date queried falls within the range of the event. 976 // The date queried falls within the range of the event.
971 if (secondFreq < 24*3600) 977 if (secondFreq < 24*3600)
972 return true; // the event recurs at least once each day 978 return true; // the event recurs at least once each day
973 int after = mRecurStart.secsTo(QDateTime(qd)); 979 int after = mRecurStart.secsTo(QDateTime(qd));
974 if (after / secondFreq != (after + 24*3600) / secondFreq) 980 if (after / secondFreq != (after + 24*3600) / secondFreq)
975 return true; 981 return true;
976 } 982 }
977 return false; 983 return false;
978} 984}
979 985
980bool Recurrence::recursMinutelyAt(const QDateTime &dt, int minuteFreq) const 986bool Recurrence::recursMinutelyAt(const QDateTime &dt, int minuteFreq) const
981{ 987{
982 if ((dt >= mRecurStart) && 988 if ((dt >= mRecurStart) &&
983 ((rDuration > 0) && (dt <= endDateTime()) || 989 ((rDuration > 0) && (dt <= endDateTime()) ||
984 ((rDuration == 0) && (dt <= rEndDateTime)) || 990 ((rDuration == 0) && (dt <= rEndDateTime)) ||
985 (rDuration == -1))) { 991 (rDuration == -1))) {
986 // The time queried falls within the range of the event. 992 // The time queried falls within the range of the event.
987 if (((mRecurStart.secsTo(dt) / 60) % minuteFreq) == 0) 993 if (((mRecurStart.secsTo(dt) / 60) % minuteFreq) == 0)
988 return true; 994 return true;
989 } 995 }
990 return false; 996 return false;
991} 997}
992 998
993bool Recurrence::recursDaily(const QDate &qd) const 999bool Recurrence::recursDaily(const QDate &qd) const
994{ 1000{
995 QDate dStart = mRecurStart.date(); 1001 QDate dStart = mRecurStart.date();
996 if ((dStart.daysTo(qd) % rFreq) == 0) { 1002 if ((dStart.daysTo(qd) % rFreq) == 0) {
997 // The date is a day which recurs 1003 // The date is a day which recurs
998 if (qd >= dStart 1004 if (qd >= dStart
999 && ((rDuration > 0 && qd <= endDate()) || 1005 && ((rDuration > 0 && qd <= endDate()) ||
1000 (rDuration == 0 && qd <= rEndDateTime.date()) || 1006 (rDuration == 0 && qd <= rEndDateTime.date()) ||
1001 rDuration == -1)) { 1007 rDuration == -1)) {
1002 // The date queried falls within the range of the event. 1008 // The date queried falls within the range of the event.
1003 return true; 1009 return true;
1004 } 1010 }
1005 } 1011 }
1006 return false; 1012 return false;
1007} 1013}
1008 1014
1009bool Recurrence::recursWeekly(const QDate &qd) const 1015bool Recurrence::recursWeekly(const QDate &qd) const
1010{ 1016{
1011 QDate dStart = mRecurStart.date(); 1017 QDate dStart = mRecurStart.date();
1012 if ((dStart.daysTo(qd)/7) % rFreq == 0) { 1018 if ((dStart.daysTo(qd)/7) % rFreq == 0) {
1013 // The date is in a week which recurs 1019 // The date is in a week which recurs
1014 if (qd >= dStart 1020 if (qd >= dStart
1015 && ((rDuration > 0 && qd <= endDate()) || 1021 && ((rDuration > 0 && qd <= endDate()) ||
1016 (rDuration == 0 && qd <= rEndDateTime.date()) || 1022 (rDuration == 0 && qd <= rEndDateTime.date()) ||
1017 rDuration == -1)) { 1023 rDuration == -1)) {
1018 // The date queried falls within the range of the event. 1024 // The date queried falls within the range of the event.
1019 // check if the bits set match today. 1025 // check if the bits set match today.
1020 int i = qd.dayOfWeek()-1; 1026 int i = qd.dayOfWeek()-1;
1021 if (rDays.testBit((uint) i)) 1027 if (rDays.testBit((uint) i))
1022 return true; 1028 return true;
1023 } 1029 }
1024 } 1030 }
1025 return false; 1031 return false;
1026} 1032}
1027 1033
1028bool Recurrence::recursMonthly(const QDate &qd) const 1034bool Recurrence::recursMonthly(const QDate &qd) const
1029{ 1035{
1030 QDate dStart = mRecurStart.date(); 1036 QDate dStart = mRecurStart.date();
1031 int year = qd.year(); 1037 int year = qd.year();
1032 int month = qd.month(); 1038 int month = qd.month();
1033 int day = qd.day(); 1039 int day = qd.day();
1034 // calculate how many months ahead this date is from the original 1040 // calculate how many months ahead this date is from the original
1035 // event's date 1041 // event's date
1036 int monthsAhead = (year - dStart.year()) * 12 + (month - dStart.month()); 1042 int monthsAhead = (year - dStart.year()) * 12 + (month - dStart.month());
1037 if ((monthsAhead % rFreq) == 0) { 1043 if ((monthsAhead % rFreq) == 0) {
1038 // The date is in a month which recurs 1044 // The date is in a month which recurs
1039 if (qd >= dStart 1045 if (qd >= dStart
1040 && ((rDuration > 0 && qd <= endDate()) || 1046 && ((rDuration > 0 && qd <= endDate()) ||
1041 (rDuration == 0 && qd <= rEndDateTime.date()) || 1047 (rDuration == 0 && qd <= rEndDateTime.date()) ||
1042 rDuration == -1)) { 1048 rDuration == -1)) {
1043 // The date queried falls within the range of the event. 1049 // The date queried falls within the range of the event.
1044 QValueList<int> days; 1050 QValueList<int> days;
1045 int daysInMonth = qd.daysInMonth(); 1051 int daysInMonth = qd.daysInMonth();
1046 if (recurs == rMonthlyDay) 1052 if (recurs == rMonthlyDay)
1047 getMonthlyDayDays(days, daysInMonth); 1053 getMonthlyDayDays(days, daysInMonth);
1048 else if (recurs == rMonthlyPos) 1054 else if (recurs == rMonthlyPos)
1049 getMonthlyPosDays(days, daysInMonth, QDate(year, month, 1).dayOfWeek()); 1055 getMonthlyPosDays(days, daysInMonth, QDate(year, month, 1).dayOfWeek());
1050 for (QValueList<int>::Iterator it = days.begin(); it != days.end(); ++it) { 1056 for (QValueList<int>::Iterator it = days.begin(); it != days.end(); ++it) {
1051 if (*it == day) 1057 if (*it == day)
1052 return true; 1058 return true;
1053 } 1059 }
1054 // no dates matched 1060 // no dates matched
1055 } 1061 }
1056 } 1062 }
1057 return false; 1063 return false;
1058} 1064}
1059 1065
1060bool Recurrence::recursYearlyByMonth(const QDate &qd) const 1066bool Recurrence::recursYearlyByMonth(const QDate &qd) const
1061{ 1067{
1062 QDate dStart = mRecurStart.date(); 1068 QDate dStart = mRecurStart.date();
1063 int startDay = dStart.day(); 1069 int startDay = dStart.day();
1064 int qday = qd.day(); 1070 int qday = qd.day();
1065 int qmonth = qd.month(); 1071 int qmonth = qd.month();
1066 int qyear = qd.year(); 1072 int qyear = qd.year();
1067 bool match = (qday == startDay); 1073 bool match = (qday == startDay);
1068 if (!match && startDay == 29 && dStart.month() == 2) { 1074 if (!match && startDay == 29 && dStart.month() == 2) {
1069 // It's a recurrence on February 29th 1075 // It's a recurrence on February 29th
1070 switch (mFeb29YearlyType) { 1076 switch (mFeb29YearlyType) {
1071 case rFeb28: 1077 case rFeb28:
1072 if (qday == 28 && qmonth == 2 && !QDate::leapYear(qyear)) 1078 if (qday == 28 && qmonth == 2 && !QDate::leapYear(qyear))
1073 match = true; 1079 match = true;
1074 break; 1080 break;
1075 case rMar1: 1081 case rMar1:
1076 if (qday == 1 && qmonth == 3 && !QDate::leapYear(qyear)) { 1082 if (qday == 1 && qmonth == 3 && !QDate::leapYear(qyear)) {
1077 qmonth = 2; 1083 qmonth = 2;
1078 match = true; 1084 match = true;
1079 } 1085 }
1080 break; 1086 break;
1081 case rFeb29: 1087 case rFeb29:
1082 break; 1088 break;
1083 } 1089 }
1084 } 1090 }
1085 1091
1086 if (match) { 1092 if (match) {
1087 // The day of the month matches. Calculate how many years ahead 1093 // The day of the month matches. Calculate how many years ahead
1088 // this date is from the original event's date. 1094 // this date is from the original event's date.
1089 int yearsAhead = (qyear - dStart.year()); 1095 int yearsAhead = (qyear - dStart.year());
1090 if (yearsAhead % rFreq == 0) { 1096 if (yearsAhead % rFreq == 0) {
1091 // The date is in a year which recurs 1097 // The date is in a year which recurs
1092 if (qd >= dStart 1098 if (qd >= dStart
1093 && ((rDuration > 0 && qd <= endDate()) || 1099 && ((rDuration > 0 && qd <= endDate()) ||
1094 (rDuration == 0 && qd <= rEndDateTime.date()) || 1100 (rDuration == 0 && qd <= rEndDateTime.date()) ||
1095 rDuration == -1)) { 1101 rDuration == -1)) {
1096 // The date queried falls within the range of the event. 1102 // The date queried falls within the range of the event.
1097 int i = qmonth; 1103 int i = qmonth;
1098 for (QPtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) { 1104 for (QPtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) {
1099 if (i == *qlin.current()) 1105 if (i == *qlin.current())
1100 return true; 1106 return true;
1101 } 1107 }
1102 } 1108 }
1103 } 1109 }
1104 } 1110 }
1105 return false; 1111 return false;
1106} 1112}
1107 1113
1108bool Recurrence::recursYearlyByPos(const QDate &qd) const 1114bool Recurrence::recursYearlyByPos(const QDate &qd) const
1109{ 1115{
1110 QDate dStart = mRecurStart.date(); 1116 QDate dStart = mRecurStart.date();
1111 int year = qd.year(); 1117 int year = qd.year();
1112 int month = qd.month(); 1118 int month = qd.month();
1113 int day = qd.day(); 1119 int day = qd.day();
1114 // calculate how many years ahead this date is from the original 1120 // calculate how many years ahead this date is from the original
1115 // event's date 1121 // event's date
1116 int yearsAhead = (year - dStart.year()); 1122 int yearsAhead = (year - dStart.year());
1117 if (yearsAhead % rFreq == 0) { 1123 if (yearsAhead % rFreq == 0) {
1118 // The date is in a year which recurs 1124 // The date is in a year which recurs
1119 if (qd >= dStart 1125 if (qd >= dStart
1120 && ((rDuration > 0 && qd <= endDate()) || 1126 && ((rDuration > 0 && qd <= endDate()) ||
1121 (rDuration == 0 && qd <= rEndDateTime.date()) || 1127 (rDuration == 0 && qd <= rEndDateTime.date()) ||
1122 rDuration == -1)) { 1128 rDuration == -1)) {
1123 // The date queried falls within the range of the event. 1129 // The date queried falls within the range of the event.
1124 for (QPtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) { 1130 for (QPtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) {
1125 if (month == *qlin.current()) { 1131 if (month == *qlin.current()) {
1126 // The month recurs 1132 // The month recurs
1127 QValueList<int> days; 1133 QValueList<int> days;
1128 getMonthlyPosDays(days, qd.daysInMonth(), QDate(year, month, 1).dayOfWeek()); 1134 getMonthlyPosDays(days, qd.daysInMonth(), QDate(year, month, 1).dayOfWeek());
1129 for (QValueList<int>::Iterator it = days.begin(); it != days.end(); ++it) { 1135 for (QValueList<int>::Iterator it = days.begin(); it != days.end(); ++it) {
1130 if (*it == day) 1136 if (*it == day)
1131 return true; 1137 return true;
1132 } 1138 }
1133 } 1139 }
1134 } 1140 }
1135 } 1141 }
1136 } 1142 }
1137 return false; 1143 return false;
1138} 1144}
1139 1145
1140bool Recurrence::recursYearlyByDay(const QDate &qd) const 1146bool Recurrence::recursYearlyByDay(const QDate &qd) const
1141{ 1147{
1142 QDate dStart = mRecurStart.date(); 1148 QDate dStart = mRecurStart.date();
1143 // calculate how many years ahead this date is from the original 1149 // calculate how many years ahead this date is from the original
1144 // event's date 1150 // event's date
1145 int yearsAhead = (qd.year() - dStart.year()); 1151 int yearsAhead = (qd.year() - dStart.year());
1146 if (yearsAhead % rFreq == 0) { 1152 if (yearsAhead % rFreq == 0) {
1147 // The date is in a year which recurs 1153 // The date is in a year which recurs
1148 if (qd >= dStart 1154 if (qd >= dStart
1149 && ((rDuration > 0 && qd <= endDate()) || 1155 && ((rDuration > 0 && qd <= endDate()) ||
1150 (rDuration == 0 && qd <= rEndDateTime.date()) || 1156 (rDuration == 0 && qd <= rEndDateTime.date()) ||
1151 rDuration == -1)) { 1157 rDuration == -1)) {
1152 // The date queried falls within the range of the event. 1158 // The date queried falls within the range of the event.
1153 int i = qd.dayOfYear(); 1159 int i = qd.dayOfYear();
1154 for (QPtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) { 1160 for (QPtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) {
1155 if (i == *qlin.current()) 1161 if (i == *qlin.current())
1156 return true; 1162 return true;
1157 } 1163 }
1158 } 1164 }
1159 } 1165 }
1160 return false; 1166 return false;
1161} 1167}
1162 1168
1163/* Get the date of the next recurrence, after the specified date. 1169/* Get the date of the next recurrence, after the specified date.
1164 * If 'last' is non-null, '*last' is set to true if the next recurrence is the 1170 * If 'last' is non-null, '*last' is set to true if the next recurrence is the
1165 * last recurrence, else false. 1171 * last recurrence, else false.
1166 * Reply = date of next recurrence, or invalid date if none. 1172 * Reply = date of next recurrence, or invalid date if none.
1167 */ 1173 */
1168QDate Recurrence::getNextDateNoTime(const QDate &preDate, bool *last) const 1174QDate Recurrence::getNextDateNoTime(const QDate &preDate, bool *last) const
1169{ 1175{
1170 1176
1171 if (last) 1177 if (last)
1172 *last = false; 1178 *last = false;
1173 QDate dStart = mRecurStart.date(); 1179 QDate dStart = mRecurStart.date();
1174 if (preDate < dStart) 1180 if (preDate < dStart)
1175 return dStart; 1181 return dStart;
1176 QDate earliestDate = preDate.addDays(1); 1182 QDate earliestDate = preDate.addDays(1);
1177 QDate nextDate; 1183 QDate nextDate;
1178 1184
1179 switch (recurs) { 1185 switch (recurs) {
1180 case rDaily: 1186 case rDaily:
1181 nextDate = dStart.addDays((dStart.daysTo(preDate)/rFreq + 1) * rFreq); 1187 nextDate = dStart.addDays((dStart.daysTo(preDate)/rFreq + 1) * rFreq);
1182 break; 1188 break;
1183 1189
1184 case rWeekly: { 1190 case rWeekly: {
1185 QDate start = dStart.addDays(1 - dStart.dayOfWeek()); // start of week for dStart 1191 QDate start = dStart.addDays(1 - dStart.dayOfWeek()); // start of week for dStart
1186 int earliestDayOfWeek = earliestDate.dayOfWeek(); 1192 int earliestDayOfWeek = earliestDate.dayOfWeek();
1187 int weeksAhead = start.daysTo(earliestDate) / 7; 1193 int weeksAhead = start.daysTo(earliestDate) / 7;
1188 int notThisWeek = weeksAhead % rFreq; // zero if this week is a recurring week 1194 int notThisWeek = weeksAhead % rFreq; // zero if this week is a recurring week
1189 weeksAhead -= notThisWeek; // latest week which recurred 1195 weeksAhead -= notThisWeek; // latest week which recurred
1190 int weekday = 0; 1196 int weekday = 0;
1191 // First check for any remaining day this week, if this week is a recurring week 1197 // First check for any remaining day this week, if this week is a recurring week
1192 if (!notThisWeek) 1198 if (!notThisWeek)
1193 weekday = getFirstDayInWeek(earliestDayOfWeek); 1199 weekday = getFirstDayInWeek(earliestDayOfWeek);
1194 // Check for a day in the next scheduled week 1200 // Check for a day in the next scheduled week
1195 if (!weekday && earliestDayOfWeek > 1) 1201 if (!weekday && earliestDayOfWeek > 1)
1196 weekday = getFirstDayInWeek(rWeekStart) + rFreq*7; 1202 weekday = getFirstDayInWeek(rWeekStart) + rFreq*7;
1197 if (weekday) 1203 if (weekday)
1198 nextDate = start.addDays(weeksAhead*7 + weekday - 1); 1204 nextDate = start.addDays(weeksAhead*7 + weekday - 1);
1199 break; 1205 break;
1200 } 1206 }
1201 case rMonthlyDay: 1207 case rMonthlyDay:
1202 case rMonthlyPos: { 1208 case rMonthlyPos: {
1203 int startYear = dStart.year(); 1209 int startYear = dStart.year();
1204 int startMonth = dStart.month(); // 1..12 1210 int startMonth = dStart.month(); // 1..12
1205 int earliestYear = earliestDate.year(); 1211 int earliestYear = earliestDate.year();
1206 int monthsAhead = (earliestYear - startYear)*12 + earliestDate.month() - startMonth; 1212 int monthsAhead = (earliestYear - startYear)*12 + earliestDate.month() - startMonth;
1207 int notThisMonth = monthsAhead % rFreq; // zero if this month is a recurring month 1213 int notThisMonth = monthsAhead % rFreq; // zero if this month is a recurring month
1208 monthsAhead -= notThisMonth; // latest month which recurred 1214 monthsAhead -= notThisMonth; // latest month which recurred
1209 // Check for the first later day in the current month 1215 // Check for the first later day in the current month
1210 if (!notThisMonth) 1216 if (!notThisMonth)
1211 nextDate = getFirstDateInMonth(earliestDate); 1217 nextDate = getFirstDateInMonth(earliestDate);
1212 if (!nextDate.isValid() && earliestDate.day() > 1) { 1218 if (!nextDate.isValid() && earliestDate.day() > 1) {
1213 // Check for a day in the next scheduled month 1219 // Check for a day in the next scheduled month
1214 int months = startMonth - 1 + monthsAhead + rFreq; 1220 int months = startMonth - 1 + monthsAhead + rFreq;
1215 nextDate = getFirstDateInMonth(QDate(startYear + months/12, months%12 + 1, 1)); 1221 nextDate = getFirstDateInMonth(QDate(startYear + months/12, months%12 + 1, 1));
1216 } 1222 }
1217 break; 1223 break;
1218 } 1224 }
1219 case rYearlyMonth: 1225 case rYearlyMonth:
1220 case rYearlyPos: 1226 case rYearlyPos:
1221 case rYearlyDay: { 1227 case rYearlyDay: {
1222 int startYear = dStart.year(); 1228 int startYear = dStart.year();
1223 int yearsAhead = earliestDate.year() - startYear; 1229 int yearsAhead = earliestDate.year() - startYear;
1224 int notThisYear = yearsAhead % rFreq; // zero if this year is a recurring year 1230 int notThisYear = yearsAhead % rFreq; // zero if this year is a recurring year
1225 yearsAhead -= notThisYear; // latest year which recurred 1231 yearsAhead -= notThisYear; // latest year which recurred
1226 // Check for the first later date in the current year 1232 // Check for the first later date in the current year
1227 if (!notThisYear) 1233 if (!notThisYear)
1228 nextDate = getFirstDateInYear(earliestDate); 1234 nextDate = getFirstDateInYear(earliestDate);
1229 // Check for a date in the next scheduled year 1235 // Check for a date in the next scheduled year
1230 if (!nextDate.isValid() && earliestDate.dayOfYear() > 1) 1236 if (!nextDate.isValid() && earliestDate.dayOfYear() > 1)
1231 nextDate = getFirstDateInYear(QDate(startYear + yearsAhead + rFreq, 1, 1)); 1237 nextDate = getFirstDateInYear(QDate(startYear + yearsAhead + rFreq, 1, 1));
1232 break; 1238 break;
1233 } 1239 }
1234 case rNone: 1240 case rNone:
1235 default: 1241 default:
1236 return QDate(); 1242 return QDate();
1237 } 1243 }
1238 1244
1239 if (rDuration >= 0 && nextDate.isValid()) { 1245 if (rDuration >= 0 && nextDate.isValid()) {
1240 // Check that the date found is within the range of the recurrence 1246 // Check that the date found is within the range of the recurrence
1241 QDate end = endDate(); 1247 QDate end = endDate();
1242 if (nextDate > end) 1248 if (nextDate > end)
1243 return QDate(); 1249 return QDate();
1244 if (last && nextDate == end) 1250 if (last && nextDate == end)
1245 *last = true; 1251 *last = true;
1246 } 1252 }
1247 return nextDate; 1253 return nextDate;
1248} 1254}
1249 1255
1250/* Get the date of the last previous recurrence, before the specified date. 1256/* Get the date of the last previous recurrence, before the specified date.
1251 * Reply = date of previous recurrence, or invalid date if none. 1257 * Reply = date of previous recurrence, or invalid date if none.
1252 */ 1258 */
1253QDate Recurrence::getPreviousDateNoTime(const QDate &afterDate, bool *last) const 1259QDate Recurrence::getPreviousDateNoTime(const QDate &afterDate, bool *last) const
1254{ 1260{
1255 if (last) 1261 if (last)
1256 *last = false; 1262 *last = false;
1257 QDate dStart = mRecurStart.date(); 1263 QDate dStart = mRecurStart.date();
1258 QDate latestDate = afterDate.addDays(-1); 1264 QDate latestDate = afterDate.addDays(-1);
1259 if (latestDate < dStart) 1265 if (latestDate < dStart)
1260 return QDate(); 1266 return QDate();
1261 QDate prevDate; 1267 QDate prevDate;
1262 1268
1263 switch (recurs) { 1269 switch (recurs) {
1264 case rDaily: 1270 case rDaily:
1265 prevDate = dStart.addDays((dStart.daysTo(latestDate) / rFreq) * rFreq); 1271 prevDate = dStart.addDays((dStart.daysTo(latestDate) / rFreq) * rFreq);
1266 break; 1272 break;
1267 1273
1268 case rWeekly: { 1274 case rWeekly: {
1269 QDate start = dStart.addDays(1 - dStart.dayOfWeek()); // start of week for dStart 1275 QDate start = dStart.addDays(1 - dStart.dayOfWeek()); // start of week for dStart
1270 int latestDayOfWeek = latestDate.dayOfWeek(); 1276 int latestDayOfWeek = latestDate.dayOfWeek();
1271 int weeksAhead = start.daysTo(latestDate) / 7; 1277 int weeksAhead = start.daysTo(latestDate) / 7;
1272 int notThisWeek = weeksAhead % rFreq; // zero if this week is a recurring week 1278 int notThisWeek = weeksAhead % rFreq; // zero if this week is a recurring week
1273 weeksAhead -= notThisWeek; // latest week which recurred 1279 weeksAhead -= notThisWeek; // latest week which recurred
1274 int weekday = 0; 1280 int weekday = 0;
1275 // First check for any previous day this week, if this week is a recurring week 1281 // First check for any previous day this week, if this week is a recurring week
1276 if (!notThisWeek) 1282 if (!notThisWeek)
1277 weekday = getLastDayInWeek(latestDayOfWeek); 1283 weekday = getLastDayInWeek(latestDayOfWeek);
1278 // Check for a day in the previous scheduled week 1284 // Check for a day in the previous scheduled week
1279 if (!weekday) { 1285 if (!weekday) {
1280 int weekEnd = (rWeekStart + 5)%7 + 1; 1286 int weekEnd = (rWeekStart + 5)%7 + 1;
1281 if (latestDayOfWeek < weekEnd) { 1287 if (latestDayOfWeek < weekEnd) {
1282 if (!notThisWeek) 1288 if (!notThisWeek)
1283 weeksAhead -= rFreq; 1289 weeksAhead -= rFreq;
1284 weekday = getLastDayInWeek(weekEnd); 1290 weekday = getLastDayInWeek(weekEnd);
1285 } 1291 }
1286 } 1292 }
1287 if (weekday) 1293 if (weekday)
1288 prevDate = start.addDays(weeksAhead*7 + weekday - 1); 1294 prevDate = start.addDays(weeksAhead*7 + weekday - 1);
1289 break; 1295 break;
1290 } 1296 }
1291 case rMonthlyDay: 1297 case rMonthlyDay:
1292 case rMonthlyPos: { 1298 case rMonthlyPos: {
1293 int startYear = dStart.year(); 1299 int startYear = dStart.year();
1294 int startMonth = dStart.month(); // 1..12 1300 int startMonth = dStart.month(); // 1..12
1295 int latestYear = latestDate.year(); 1301 int latestYear = latestDate.year();
1296 int monthsAhead = (latestYear - startYear)*12 + latestDate.month() - startMonth; 1302 int monthsAhead = (latestYear - startYear)*12 + latestDate.month() - startMonth;
1297 int notThisMonth = monthsAhead % rFreq; // zero if this month is a recurring month 1303 int notThisMonth = monthsAhead % rFreq; // zero if this month is a recurring month
1298 monthsAhead -= notThisMonth; // latest month which recurred 1304 monthsAhead -= notThisMonth; // latest month which recurred
1299 // Check for the last earlier day in the current month 1305 // Check for the last earlier day in the current month
1300 if (!notThisMonth) 1306 if (!notThisMonth)
1301 prevDate = getLastDateInMonth(latestDate); 1307 prevDate = getLastDateInMonth(latestDate);
1302 if (!prevDate.isValid() && latestDate.day() < latestDate.daysInMonth()) { 1308 if (!prevDate.isValid() && latestDate.day() < latestDate.daysInMonth()) {
1303 // Check for a day in the previous scheduled month 1309 // Check for a day in the previous scheduled month
1304 if (!notThisMonth) 1310 if (!notThisMonth)
1305 monthsAhead -= rFreq; 1311 monthsAhead -= rFreq;
1306 int months = startMonth + monthsAhead; // get the month after the one that recurs 1312 int months = startMonth + monthsAhead; // get the month after the one that recurs
1307 prevDate = getLastDateInMonth(QDate(startYear + months/12, months%12 + 1, 1).addDays(-1)); 1313 prevDate = getLastDateInMonth(QDate(startYear + months/12, months%12 + 1, 1).addDays(-1));
1308 } 1314 }
1309 break; 1315 break;
1310 } 1316 }
1311 case rYearlyMonth: 1317 case rYearlyMonth:
1312 case rYearlyPos: 1318 case rYearlyPos:
1313 case rYearlyDay: { 1319 case rYearlyDay: {
1314 int startYear = dStart.year(); 1320 int startYear = dStart.year();
1315 int yearsAhead = latestDate.year() - startYear; 1321 int yearsAhead = latestDate.year() - startYear;
1316 int notThisYear = yearsAhead % rFreq; // zero if this year is a recurring year 1322 int notThisYear = yearsAhead % rFreq; // zero if this year is a recurring year
1317 yearsAhead -= notThisYear; // latest year which recurred 1323 yearsAhead -= notThisYear; // latest year which recurred
1318 // Check for the first later date in the current year 1324 // Check for the first later date in the current year
1319 if (!notThisYear) 1325 if (!notThisYear)
1320 prevDate = getLastDateInYear(latestDate); 1326 prevDate = getLastDateInYear(latestDate);
1321 if (!prevDate.isValid() && latestDate.dayOfYear() < latestDate.daysInYear()) { 1327 if (!prevDate.isValid() && latestDate.dayOfYear() < latestDate.daysInYear()) {
1322 // Check for a date in the next scheduled year 1328 // Check for a date in the next scheduled year
1323 if (!notThisYear) 1329 if (!notThisYear)
1324 yearsAhead -= rFreq; 1330 yearsAhead -= rFreq;
1325 prevDate = getLastDateInYear(QDate(startYear + yearsAhead, 12, 31)); 1331 prevDate = getLastDateInYear(QDate(startYear + yearsAhead, 12, 31));
1326 } 1332 }
1327 break; 1333 break;
1328 } 1334 }
1329 case rNone: 1335 case rNone:
1330 default: 1336 default:
1331 return QDate(); 1337 return QDate();
1332 } 1338 }
1333 1339
1334 if (prevDate.isValid()) { 1340 if (prevDate.isValid()) {
1335 // Check that the date found is within the range of the recurrence 1341 // Check that the date found is within the range of the recurrence
1336 if (prevDate < dStart) 1342 if (prevDate < dStart)
1337 return QDate(); 1343 return QDate();
1338 if (rDuration >= 0) { 1344 if (rDuration >= 0) {
1339 QDate end = endDate(); 1345 QDate end = endDate();
1340 if (prevDate >= end) { 1346 if (prevDate >= end) {
1341 if (last) 1347 if (last)
1342 *last = true; 1348 *last = true;
1343 return end; 1349 return end;
1344 } 1350 }
1345 } 1351 }
1346 } 1352 }
1347 return prevDate; 1353 return prevDate;
1348} 1354}
1349 1355
1350void Recurrence::setDailySub(short type, int freq, int duration) 1356void Recurrence::setDailySub(short type, int freq, int duration)
1351{ 1357{
1352 recurs = type; 1358 recurs = type;
1353 rFreq = freq; 1359 rFreq = freq;
1354 rDuration = duration; 1360 rDuration = duration;
1355 rMonthPositions.clear(); 1361 rMonthPositions.clear();
1356 rMonthDays.clear(); 1362 rMonthDays.clear();
1357 rYearNums.clear(); 1363 rYearNums.clear();
1358 if (type != rDaily) 1364 if (type != rDaily)
1359 mFloats = false; // sub-daily types can't be floating 1365 mFloats = false; // sub-daily types can't be floating
1360 1366
1361 if (mParent) mParent->updated(); 1367 if (mParent) mParent->updated();
1362} 1368}
1363 1369
1364void Recurrence::setYearly_(short type, Feb29Type feb29type, int freq, int duration) 1370void Recurrence::setYearly_(short type, Feb29Type feb29type, int freq, int duration)
1365{ 1371{
1366 recurs = type; 1372 recurs = type;
1367 if (mCompatVersion < 310 && type == rYearlyDay) { 1373 if (mCompatVersion < 310 && type == rYearlyDay) {
1368 mCompatRecurs = rYearlyDay; 1374 mCompatRecurs = rYearlyDay;
1369 recurs = rYearlyMonth; // convert old yearly-by-day to yearly-by-month 1375 recurs = rYearlyMonth; // convert old yearly-by-day to yearly-by-month
1370 feb29type = rMar1; // retain the same day number in the year 1376 feb29type = rMar1; // retain the same day number in the year
1371 } 1377 }
1372 1378
1373 mFeb29YearlyType = feb29type; 1379 mFeb29YearlyType = feb29type;
1374 rFreq = freq; 1380 rFreq = freq;
1375 rDuration = duration; 1381 rDuration = duration;
1376 if (type != rYearlyPos) 1382 if (type != rYearlyPos)
1377 rMonthPositions.clear(); 1383 rMonthPositions.clear();
1378 rMonthDays.clear(); 1384 rMonthDays.clear();
1379 if (mParent) mParent->updated(); 1385 if (mParent) mParent->updated();
1380} 1386}
1381 1387
1382int Recurrence::recurCalc(PeriodFunc func, QDateTime &endtime) const 1388int Recurrence::recurCalc(PeriodFunc func, QDateTime &endtime) const
1383{ 1389{
1384 QDate enddate = endtime.date(); 1390 QDate enddate = endtime.date();
1385 switch (func) { 1391 switch (func) {
1386 case END_DATE_AND_COUNT: 1392 case END_DATE_AND_COUNT:
1387 if (rDuration < 0) { 1393 if (rDuration < 0) {
1388 endtime = QDateTime(); 1394 endtime = QDateTime();
1389 return 0; // infinite recurrence 1395 return 0; // infinite recurrence
1390 } 1396 }
1391 if (rDuration == 0) { 1397 if (rDuration == 0) {
1392 endtime = rEndDateTime; 1398 endtime = rEndDateTime;
1393 func = COUNT_TO_DATE; 1399 func = COUNT_TO_DATE;
1394 } 1400 }
1395 break; 1401 break;
1396 case COUNT_TO_DATE: 1402 case COUNT_TO_DATE:
1397 // Count recurrences up to and including the specified date/time. 1403 // Count recurrences up to and including the specified date/time.
1398 if (endtime < mRecurStart) 1404 if (endtime < mRecurStart)
1399 return 0; 1405 return 0;
1400 if (rDuration == 0 && endtime > rEndDateTime) 1406 if (rDuration == 0 && endtime > rEndDateTime)
1401 enddate = rEndDateTime.date(); 1407 enddate = rEndDateTime.date();
1402 else if (!mFloats && mRecurStart.time() > endtime.time()) 1408 else if (!mFloats && mRecurStart.time() > endtime.time())
1403 enddate = enddate.addDays(-1); 1409 enddate = enddate.addDays(-1);
1404 break; 1410 break;
1405 case NEXT_AFTER_DATE: 1411 case NEXT_AFTER_DATE:
1406 // Find next recurrence AFTER endtime 1412 // Find next recurrence AFTER endtime
1407 if (endtime < mRecurStart) { 1413 if (endtime < mRecurStart) {
1408 endtime = mRecurStart; 1414 endtime = mRecurStart;
1409 return 1; 1415 return 1;
1410 } 1416 }
1411 if (rDuration == 0 && endtime >= rEndDateTime) { 1417 if (rDuration == 0 && endtime >= rEndDateTime) {
1412 endtime = QDateTime(); 1418 endtime = QDateTime();
1413 return 0; 1419 return 0;
1414 } 1420 }
1415 if (!mFloats && mRecurStart.time() > endtime.time()) 1421 if (!mFloats && mRecurStart.time() > endtime.time())
1416 enddate = enddate.addDays(-1); 1422 enddate = enddate.addDays(-1);
1417 break; 1423 break;
1418 default: 1424 default:
1419 endtime = QDateTime(); 1425 endtime = QDateTime();
1420 return 0; 1426 return 0;
1421 } 1427 }
1422 1428
1423 int count = 0; // default = error 1429 int count = 0; // default = error
1424 bool timed = false; 1430 bool timed = false;
1425 switch (recurs) { 1431 switch (recurs) {
1426 case rMinutely: 1432 case rMinutely:
1427 timed = true; 1433 timed = true;
1428 count = secondlyCalc(func, endtime, rFreq*60); 1434 count = secondlyCalc(func, endtime, rFreq*60);
1429 break; 1435 break;
1430 case rHourly: 1436 case rHourly:
1431 timed = true; 1437 timed = true;
1432 count = secondlyCalc(func, endtime, rFreq*3600); 1438 count = secondlyCalc(func, endtime, rFreq*3600);
1433 break; 1439 break;
1434 case rDaily: 1440 case rDaily:
1435 count = dailyCalc(func, enddate); 1441 count = dailyCalc(func, enddate);
1436 break; 1442 break;
1437 case rWeekly: 1443 case rWeekly:
1438 count = weeklyCalc(func, enddate); 1444 count = weeklyCalc(func, enddate);
1439 break; 1445 break;
1440 case rMonthlyPos: 1446 case rMonthlyPos:
1441 case rMonthlyDay: 1447 case rMonthlyDay:
1442 count = monthlyCalc(func, enddate); 1448 count = monthlyCalc(func, enddate);
1443 break; 1449 break;
1444 case rYearlyMonth: 1450 case rYearlyMonth:
1445 count = yearlyMonthCalc(func, enddate); 1451 count = yearlyMonthCalc(func, enddate);
1446 break; 1452 break;
1447 case rYearlyPos: 1453 case rYearlyPos:
1448 count = yearlyPosCalc(func, enddate); 1454 count = yearlyPosCalc(func, enddate);
1449 break; 1455 break;
1450 case rYearlyDay: 1456 case rYearlyDay:
1451 count = yearlyDayCalc(func, enddate); 1457 count = yearlyDayCalc(func, enddate);
1452 break; 1458 break;
1453 default: 1459 default:
1454 break; 1460 break;
1455 } 1461 }
1456 1462
1457 switch (func) { 1463 switch (func) {
1458 case END_DATE_AND_COUNT: 1464 case END_DATE_AND_COUNT:
1459 case NEXT_AFTER_DATE: 1465 case NEXT_AFTER_DATE:
1460 if (count == 0) 1466 if (count == 0)
1461 endtime = QDateTime(); 1467 endtime = QDateTime();
1462 else if (!timed) { 1468 else if (!timed) {
1463 endtime.setDate(enddate); 1469 endtime.setDate(enddate);
1464 endtime.setTime(mRecurStart.time()); 1470 endtime.setTime(mRecurStart.time());
1465 } 1471 }
1466 break; 1472 break;
1467 case COUNT_TO_DATE: 1473 case COUNT_TO_DATE:
1468 break; 1474 break;
1469 } 1475 }
1470 return count; 1476 return count;
1471} 1477}
1472 1478
1473int Recurrence::recurCalc(PeriodFunc func, QDate &enddate) const 1479int Recurrence::recurCalc(PeriodFunc func, QDate &enddate) const
1474{ 1480{
1475 QDateTime endtime(enddate, QTime(23,59,59)); 1481 QDateTime endtime(enddate, QTime(23,59,59));
1476 switch (func) { 1482 switch (func) {
1477 case END_DATE_AND_COUNT: 1483 case END_DATE_AND_COUNT:
1478 if (rDuration < 0) { 1484 if (rDuration < 0) {
1479 enddate = QDate(); 1485 enddate = QDate();
1480 return 0; // infinite recurrence 1486 return 0; // infinite recurrence
1481 } 1487 }
1482 if (rDuration == 0) { 1488 if (rDuration == 0) {
1483 enddate = rEndDateTime.date(); 1489 enddate = rEndDateTime.date();
1484 func = COUNT_TO_DATE; 1490 func = COUNT_TO_DATE;
1485 } 1491 }
1486 break; 1492 break;
1487 case COUNT_TO_DATE: 1493 case COUNT_TO_DATE:
1488 // Count recurrences up to and including the specified date. 1494 // Count recurrences up to and including the specified date.
1489 if (enddate < mRecurStart.date()) 1495 if (enddate < mRecurStart.date())
1490 return 0; 1496 return 0;
1491 if (rDuration == 0 && enddate > rEndDateTime.date()) { 1497 if (rDuration == 0 && enddate > rEndDateTime.date()) {
1492 enddate = rEndDateTime.date(); 1498 enddate = rEndDateTime.date();
1493 endtime.setDate(enddate); 1499 endtime.setDate(enddate);
1494 } 1500 }
1495 break; 1501 break;
1496 case NEXT_AFTER_DATE: 1502 case NEXT_AFTER_DATE:
1497 if (enddate < mRecurStart.date()) { 1503 if (enddate < mRecurStart.date()) {
1498 enddate = mRecurStart.date(); 1504 enddate = mRecurStart.date();
1499 return 1; 1505 return 1;
1500 } 1506 }
1501 if (rDuration == 0 && enddate >= rEndDateTime.date()) { 1507 if (rDuration == 0 && enddate >= rEndDateTime.date()) {
1502 enddate = QDate(); 1508 enddate = QDate();
1503 return 0; 1509 return 0;
1504 } 1510 }
1505 break; 1511 break;
1506 default: 1512 default:
1507 enddate = QDate(); 1513 enddate = QDate();
1508 return 0; 1514 return 0;
1509 } 1515 }
1510 1516
1511 int count = 0; // default = error 1517 int count = 0; // default = error
1512 bool timed = false; 1518 bool timed = false;
1513 switch (recurs) { 1519 switch (recurs) {
1514 case rMinutely: 1520 case rMinutely:
1515 timed = true; 1521 timed = true;
1516 count = secondlyCalc(func, endtime, rFreq*60); 1522 count = secondlyCalc(func, endtime, rFreq*60);
1517 break; 1523 break;
1518 case rHourly: 1524 case rHourly:
1519 timed = true; 1525 timed = true;
1520 count = secondlyCalc(func, endtime, rFreq*3600); 1526 count = secondlyCalc(func, endtime, rFreq*3600);
1521 break; 1527 break;
1522 case rDaily: 1528 case rDaily:
1523 count = dailyCalc(func, enddate); 1529 count = dailyCalc(func, enddate);
1524 break; 1530 break;
1525 case rWeekly: 1531 case rWeekly:
1526 count = weeklyCalc(func, enddate); 1532 count = weeklyCalc(func, enddate);
1527 break; 1533 break;
1528 case rMonthlyPos: 1534 case rMonthlyPos:
1529 case rMonthlyDay: 1535 case rMonthlyDay:
1530 count = monthlyCalc(func, enddate); 1536 count = monthlyCalc(func, enddate);
1531 break; 1537 break;
1532 case rYearlyMonth: 1538 case rYearlyMonth:
1533 count = yearlyMonthCalc(func, enddate); 1539 count = yearlyMonthCalc(func, enddate);
1534 break; 1540 break;
1535 case rYearlyPos: 1541 case rYearlyPos:
1536 count = yearlyPosCalc(func, enddate); 1542 count = yearlyPosCalc(func, enddate);
1537 break; 1543 break;
1538 case rYearlyDay: 1544 case rYearlyDay:
1539 count = yearlyDayCalc(func, enddate); 1545 count = yearlyDayCalc(func, enddate);
1540 break; 1546 break;
1541 default: 1547 default:
1542 break; 1548 break;
1543 } 1549 }
1544 1550
1545 switch (func) { 1551 switch (func) {
1546 case END_DATE_AND_COUNT: 1552 case END_DATE_AND_COUNT:
1547 case NEXT_AFTER_DATE: 1553 case NEXT_AFTER_DATE:
1548 if (count == 0) 1554 if (count == 0)
1549 endtime = QDate(); 1555 endtime = QDate();
1550 else if (timed) 1556 else if (timed)
1551 enddate = endtime.date(); 1557 enddate = endtime.date();
1552 break; 1558 break;
1553 case COUNT_TO_DATE: 1559 case COUNT_TO_DATE:
1554 break; 1560 break;
1555 } 1561 }
1556 return count; 1562 return count;
1557} 1563}
1558 1564
1559/* Find count and, depending on 'func', the end date/time of a secondly recurrence. 1565/* Find count and, depending on 'func', the end date/time of a secondly recurrence.
1560 * Reply = total number of occurrences up to 'endtime', or 0 if error. 1566 * Reply = total number of occurrences up to 'endtime', or 0 if error.
1561 * If 'func' = END_DATE_AND_COUNT or NEXT_AFTER_DATE, 'endtime' is updated to the 1567 * If 'func' = END_DATE_AND_COUNT or NEXT_AFTER_DATE, 'endtime' is updated to the
1562 * recurrence end date/time. 1568 * recurrence end date/time.
1563 */ 1569 */
1564int Recurrence::secondlyCalc(PeriodFunc func, QDateTime &endtime, int freq) const 1570int Recurrence::secondlyCalc(PeriodFunc func, QDateTime &endtime, int freq) const
1565{ 1571{
1566 switch (func) { 1572 switch (func) {
1567 case END_DATE_AND_COUNT: 1573 case END_DATE_AND_COUNT:
1568 endtime = mRecurStart.addSecs((rDuration + mRecurExDatesCount - 1) * freq); 1574 endtime = mRecurStart.addSecs((rDuration + mRecurExDatesCount - 1) * freq);
1569 return rDuration + mRecurExDatesCount; 1575 return rDuration + mRecurExDatesCount;
1570 case COUNT_TO_DATE: { 1576 case COUNT_TO_DATE: {
1571 int n = mRecurStart.secsTo(endtime)/freq + 1; 1577 int n = mRecurStart.secsTo(endtime)/freq + 1;
1572 if (rDuration > 0 && n > rDuration + mRecurExDatesCount) 1578 if (rDuration > 0 && n > rDuration + mRecurExDatesCount)
1573 return rDuration + mRecurExDatesCount; 1579 return rDuration + mRecurExDatesCount;
1574 return n; 1580 return n;
1575 } 1581 }
1576 case NEXT_AFTER_DATE: { 1582 case NEXT_AFTER_DATE: {
1577 int count = mRecurStart.secsTo(endtime) / freq + 2; 1583 int count = mRecurStart.secsTo(endtime) / freq + 2;
1578 if (rDuration > 0 && count > rDuration) 1584 if (rDuration > 0 && count > rDuration)
1579 return 0; 1585 return 0;
1580 endtime = mRecurStart.addSecs((count - 1)*freq); 1586 endtime = mRecurStart.addSecs((count - 1)*freq);
1581 return count; 1587 return count;
1582 } 1588 }
1583 } 1589 }
1584 return 0; 1590 return 0;
1585} 1591}
1586 1592
1587/* Find count and, depending on 'func', the end date of a daily recurrence. 1593/* Find count and, depending on 'func', the end date of a daily recurrence.
1588 * Reply = total number of occurrences up to 'enddate', or 0 if error. 1594 * Reply = total number of occurrences up to 'enddate', or 0 if error.
1589 * If 'func' = END_DATE_AND_COUNT or NEXT_AFTER_DATE, 'enddate' is updated to the 1595 * If 'func' = END_DATE_AND_COUNT or NEXT_AFTER_DATE, 'enddate' is updated to the
1590 * recurrence end date. 1596 * recurrence end date.
1591 */ 1597 */
1592int Recurrence::dailyCalc(PeriodFunc func, QDate &enddate) const 1598int Recurrence::dailyCalc(PeriodFunc func, QDate &enddate) const
1593{ 1599{
1594 QDate dStart = mRecurStart.date(); 1600 QDate dStart = mRecurStart.date();
1595 switch (func) { 1601 switch (func) {
1596 case END_DATE_AND_COUNT: 1602 case END_DATE_AND_COUNT:
1597 enddate = dStart.addDays((rDuration + mRecurExDatesCount - 1) * rFreq); 1603 enddate = dStart.addDays((rDuration + mRecurExDatesCount - 1) * rFreq);
1598 return rDuration + mRecurExDatesCount; 1604 return rDuration + mRecurExDatesCount;
1599 case COUNT_TO_DATE: { 1605 case COUNT_TO_DATE: {
1600 int n = dStart.daysTo(enddate)/rFreq + 1; 1606 int n = dStart.daysTo(enddate)/rFreq + 1;
1601 if (rDuration > 0 && n > rDuration + mRecurExDatesCount) 1607 if (rDuration > 0 && n > rDuration + mRecurExDatesCount)
1602 return rDuration + mRecurExDatesCount; 1608 return rDuration + mRecurExDatesCount;
1603 return n; 1609 return n;
1604 } 1610 }
1605 case NEXT_AFTER_DATE: { 1611 case NEXT_AFTER_DATE: {
1606 int count = dStart.daysTo(enddate) / rFreq + 2; 1612 int count = dStart.daysTo(enddate) / rFreq + 2;
1607 if (rDuration > 0 && count > rDuration) 1613 if (rDuration > 0 && count > rDuration)
1608 return 0; 1614 return 0;
1609 enddate = dStart.addDays((count - 1)*rFreq); 1615 enddate = dStart.addDays((count - 1)*rFreq);
1610 return count; 1616 return count;
1611 } 1617 }
1612 } 1618 }
1613 return 0; 1619 return 0;
1614} 1620}
1615 1621
1616/* Find count and, depending on 'func', the end date of a weekly recurrence. 1622/* Find count and, depending on 'func', the end date of a weekly recurrence.
1617 * Reply = total number of occurrences up to 'enddate', or 0 if error. 1623 * Reply = total number of occurrences up to 'enddate', or 0 if error.
1618 * If 'func' = END_DATE_AND_COUNT or NEXT_AFTER_DATE, 'enddate' is updated to the 1624 * If 'func' = END_DATE_AND_COUNT or NEXT_AFTER_DATE, 'enddate' is updated to the
1619 * recurrence end date. 1625 * recurrence end date.
1620 */ 1626 */
1621int Recurrence::weeklyCalc(PeriodFunc func, QDate &enddate) const 1627int Recurrence::weeklyCalc(PeriodFunc func, QDate &enddate) const
1622{ 1628{
1623 int daysPerWeek = 0; 1629 int daysPerWeek = 0;
1624 for (int i = 0; i < 7; ++i) { 1630 for (int i = 0; i < 7; ++i) {
1625 if (rDays.testBit((uint)i)) 1631 if (rDays.testBit((uint)i))
1626 ++daysPerWeek; 1632 ++daysPerWeek;
1627 } 1633 }
1628 if (!daysPerWeek) 1634 if (!daysPerWeek)
1629 return 0; // there are no days to recur on 1635 return 0; // there are no days to recur on
1630 1636
1631 switch (func) { 1637 switch (func) {
1632 case END_DATE_AND_COUNT: 1638 case END_DATE_AND_COUNT:
1633 return weeklyCalcEndDate(enddate, daysPerWeek); 1639 return weeklyCalcEndDate(enddate, daysPerWeek);
1634 case COUNT_TO_DATE: 1640 case COUNT_TO_DATE:
1635 return weeklyCalcToDate(enddate, daysPerWeek); 1641 return weeklyCalcToDate(enddate, daysPerWeek);
1636 case NEXT_AFTER_DATE: 1642 case NEXT_AFTER_DATE:
1637 return weeklyCalcNextAfter(enddate, daysPerWeek); 1643 return weeklyCalcNextAfter(enddate, daysPerWeek);
1638 } 1644 }
1639 return 0; 1645 return 0;
1640} 1646}
1641 1647
1642int Recurrence::weeklyCalcEndDate(QDate &enddate, int daysPerWeek) const 1648int Recurrence::weeklyCalcEndDate(QDate &enddate, int daysPerWeek) const
1643{ 1649{
1644 int startDayOfWeek = mRecurStart.date().dayOfWeek(); // 1..7 1650 int startDayOfWeek = mRecurStart.date().dayOfWeek(); // 1..7
1645 int countGone = 0; 1651 int countGone = 0;
1646 int daysGone = 0; 1652 int daysGone = 0;
1647 uint countTogo = rDuration + mRecurExDatesCount; 1653 uint countTogo = rDuration + mRecurExDatesCount;
1648 if (startDayOfWeek != rWeekStart) { 1654 if (startDayOfWeek != rWeekStart) {
1649 // Check what remains of the start week 1655 // Check what remains of the start week
1650 for (int i = startDayOfWeek - 1; i != rWeekStart - 1; i = (i + 1) % 7) { 1656 for (int i = startDayOfWeek - 1; i != rWeekStart - 1; i = (i + 1) % 7) {
1651 ++daysGone; 1657 ++daysGone;
1652 if (rDays.testBit((uint)i)) { 1658 if (rDays.testBit((uint)i)) {
1653 ++countGone; 1659 ++countGone;
1654 if (--countTogo == 0) 1660 if (--countTogo == 0)
1655 break; 1661 break;
1656 } 1662 }
1657 } 1663 }
1658 daysGone += 7 * (rFreq - 1); 1664 daysGone += 7 * (rFreq - 1);
1659 } 1665 }
1660 if (countTogo) { 1666 if (countTogo) {
1661 // Skip the remaining whole weeks 1667 // Skip the remaining whole weeks
1662 // Leave at least 1 recurrence remaining, in order to get its date 1668 // Leave at least 1 recurrence remaining, in order to get its date
1663 int wholeWeeks = (countTogo - 1) / daysPerWeek; 1669 int wholeWeeks = (countTogo - 1) / daysPerWeek;
1664 daysGone += wholeWeeks * 7 * rFreq; 1670 daysGone += wholeWeeks * 7 * rFreq;
1665 countGone += wholeWeeks * daysPerWeek; 1671 countGone += wholeWeeks * daysPerWeek;
1666 countTogo -= wholeWeeks * daysPerWeek; 1672 countTogo -= wholeWeeks * daysPerWeek;
1667 // Check the last week in the recurrence 1673 // Check the last week in the recurrence
1668 for (int i = rWeekStart - 1; ; i = (i + 1) % 7) { 1674 for (int i = rWeekStart - 1; ; i = (i + 1) % 7) {
1669 ++daysGone; 1675 ++daysGone;
1670 if (rDays.testBit((uint)i)) { 1676 if (rDays.testBit((uint)i)) {
1671 ++countGone; 1677 ++countGone;
1672 if (--countTogo == 0) 1678 if (--countTogo == 0)
1673 break; 1679 break;
1674 } 1680 }
1675 } 1681 }
1676 } 1682 }
1677 enddate = mRecurStart.date().addDays(daysGone); 1683 enddate = mRecurStart.date().addDays(daysGone);
1678 return countGone; 1684 return countGone;
1679} 1685}
1680 1686
1681int Recurrence::weeklyCalcToDate(const QDate &enddate, int daysPerWeek) const 1687int Recurrence::weeklyCalcToDate(const QDate &enddate, int daysPerWeek) const
1682{ 1688{
1683 QDate dStart = mRecurStart.date(); 1689 QDate dStart = mRecurStart.date();
1684 int startDayOfWeek = dStart.dayOfWeek(); // 1..7 1690 int startDayOfWeek = dStart.dayOfWeek(); // 1..7
1685 int countGone = 0; 1691 int countGone = 0;
1686 int daysGone = 0; 1692 int daysGone = 0;
1687 int totalDays = dStart.daysTo(enddate) + 1; 1693 int totalDays = dStart.daysTo(enddate) + 1;
1688 int countMax = (rDuration > 0) ? rDuration + mRecurExDatesCount : INT_MAX; 1694 int countMax = (rDuration > 0) ? rDuration + mRecurExDatesCount : INT_MAX;
1689 1695
1690 if (startDayOfWeek != rWeekStart) { 1696 if (startDayOfWeek != rWeekStart) {
1691 // Check what remains of the start week 1697 // Check what remains of the start week
1692 for (int i = startDayOfWeek - 1; i != rWeekStart - 1; i = (i + 1) % 7) { 1698 for (int i = startDayOfWeek - 1; i != rWeekStart - 1; i = (i + 1) % 7) {
1693 if (rDays.testBit((uint)i)) { 1699 if (rDays.testBit((uint)i)) {
1694 if (++countGone >= countMax) 1700 if (++countGone >= countMax)
1695 return countMax; 1701 return countMax;
1696 } 1702 }
1697 if (++daysGone == totalDays) 1703 if (++daysGone == totalDays)
1698 return countGone; 1704 return countGone;
1699 } 1705 }
1700 daysGone += 7 * (rFreq - 1); 1706 daysGone += 7 * (rFreq - 1);
1701 if (daysGone >= totalDays) 1707 if (daysGone >= totalDays)
1702 return countGone; 1708 return countGone;
1703 } 1709 }
1704 // Skip the remaining whole weeks 1710 // Skip the remaining whole weeks
1705 int wholeWeeks = (totalDays - daysGone) / 7; 1711 int wholeWeeks = (totalDays - daysGone) / 7;
1706 countGone += (wholeWeeks / rFreq) * daysPerWeek; 1712 countGone += (wholeWeeks / rFreq) * daysPerWeek;
1707 if (countGone >= countMax) 1713 if (countGone >= countMax)
1708 return countMax; 1714 return countMax;
1709 daysGone += wholeWeeks * 7; 1715 daysGone += wholeWeeks * 7;
1710 if (daysGone >= totalDays // have we reached the end date? 1716 if (daysGone >= totalDays // have we reached the end date?
1711 || wholeWeeks % rFreq) // is end week a recurrence week? 1717 || wholeWeeks % rFreq) // is end week a recurrence week?
1712 return countGone; 1718 return countGone;
1713 1719
1714 // Check the last week in the recurrence 1720 // Check the last week in the recurrence
1715 for (int i = rWeekStart - 1; ; i = (i + 1) % 7) { 1721 for (int i = rWeekStart - 1; ; i = (i + 1) % 7) {
1716 if (rDays.testBit((uint)i)) { 1722 if (rDays.testBit((uint)i)) {
1717 if (++countGone >= countMax) 1723 if (++countGone >= countMax)
1718 return countMax; 1724 return countMax;
1719 } 1725 }
1720 if (++daysGone == totalDays) 1726 if (++daysGone == totalDays)
1721 return countGone; 1727 return countGone;
1722 } 1728 }
1723 return countGone; 1729 return countGone;
1724} 1730}
1725 1731
1726int Recurrence::weeklyCalcNextAfter(QDate &enddate, int daysPerWeek) const 1732int Recurrence::weeklyCalcNextAfter(QDate &enddate, int daysPerWeek) const
1727{ 1733{
1728 QDate dStart = mRecurStart.date(); 1734 QDate dStart = mRecurStart.date();
1729 int startDayOfWeek = dStart.dayOfWeek(); // 1..7 1735 int startDayOfWeek = dStart.dayOfWeek(); // 1..7
1730 int totalDays = dStart.daysTo(enddate) + 1; 1736 int totalDays = dStart.daysTo(enddate) + 1;
1731 uint countTogo = (rDuration > 0) ? rDuration + mRecurExDatesCount : UINT_MAX; 1737 uint countTogo = (rDuration > 0) ? rDuration + mRecurExDatesCount : UINT_MAX;
1732 int countGone = 0; 1738 int countGone = 0;
1733 int daysGone = 0; 1739 int daysGone = 0;
1734 int recurWeeks; 1740 int recurWeeks;
1735 1741
1736 if (startDayOfWeek != rWeekStart) { 1742 if (startDayOfWeek != rWeekStart) {
1737 // Check what remains of the start week 1743 // Check what remains of the start week
1738 for (int i = startDayOfWeek - 1; i != rWeekStart - 1; i = (i + 1) % 7) { 1744 for (int i = startDayOfWeek - 1; i != rWeekStart - 1; i = (i + 1) % 7) {
1739 ++daysGone; 1745 ++daysGone;
1740 if (rDays.testBit((uint)i)) { 1746 if (rDays.testBit((uint)i)) {
1741 ++countGone; 1747 ++countGone;
1742 if (daysGone > totalDays) 1748 if (daysGone > totalDays)
1743 goto ex; 1749 goto ex;
1744 if (--countTogo == 0) 1750 if (--countTogo == 0)
1745 return 0; 1751 return 0;
1746 } 1752 }
1747 } 1753 }
1748 daysGone += 7 * (rFreq - 1); 1754 daysGone += 7 * (rFreq - 1);
1749 } 1755 }
1750 1756
1751 // Skip the remaining whole weeks 1757 // Skip the remaining whole weeks
1752 recurWeeks = (totalDays - daysGone) / (7 * rFreq); 1758 recurWeeks = (totalDays - daysGone) / (7 * rFreq);
1753 if (recurWeeks) { 1759 if (recurWeeks) {
1754 int n = recurWeeks * daysPerWeek; 1760 int n = recurWeeks * daysPerWeek;
1755 if (static_cast<uint>(n) > countTogo) 1761 if (static_cast<uint>(n) > countTogo)
1756 return 0; // reached end of recurrence 1762 return 0; // reached end of recurrence
1757 countGone += n; 1763 countGone += n;
1758 countTogo -= n; 1764 countTogo -= n;
1759 daysGone += recurWeeks * 7 * rFreq; 1765 daysGone += recurWeeks * 7 * rFreq;
1760 } 1766 }
1761 1767
1762 // Check the last week or two in the recurrence 1768 // Check the last week or two in the recurrence
1763 for ( ; ; ) { 1769 for ( ; ; ) {
1764 for (int i = rWeekStart - 1; ; i = (i + 1) % 7) { 1770 for (int i = rWeekStart - 1; ; i = (i + 1) % 7) {
1765 ++daysGone; 1771 ++daysGone;
1766 if (rDays.testBit((uint)i)) { 1772 if (rDays.testBit((uint)i)) {
1767 ++countGone; 1773 ++countGone;
1768 if (daysGone > totalDays) 1774 if (daysGone > totalDays)
1769 goto ex; 1775 goto ex;
1770 if (--countTogo == 0) 1776 if (--countTogo == 0)
1771 return 0; 1777 return 0;
1772 } 1778 }
1773 } 1779 }
1774 daysGone += 7 * (rFreq - 1); 1780 daysGone += 7 * (rFreq - 1);
1775 } 1781 }
1776ex: 1782ex:
1777 enddate = dStart.addDays(daysGone); 1783 enddate = dStart.addDays(daysGone);
1778 return countGone; 1784 return countGone;
1779} 1785}
1780 1786
1781/* Find count and, depending on 'func', the end date of a monthly recurrence. 1787/* Find count and, depending on 'func', the end date of a monthly recurrence.
1782 * Reply = total number of occurrences up to 'enddate', or 0 if error. 1788 * Reply = total number of occurrences up to 'enddate', or 0 if error.
1783 * If 'func' = END_DATE_AND_COUNT or NEXT_AFTER_DATE, 'enddate' is updated to the 1789 * If 'func' = END_DATE_AND_COUNT or NEXT_AFTER_DATE, 'enddate' is updated to the
1784 * recurrence end date. 1790 * recurrence end date.
1785 */ 1791 */
1786struct Recurrence::MonthlyData { 1792struct Recurrence::MonthlyData {
1787 const Recurrence *recurrence; 1793 const Recurrence *recurrence;
1788 int year; // current year 1794 int year; // current year
1789 int month; // current month 0..11 1795 int month; // current month 0..11
1790 int day; // current day of month 1..31 1796 int day; // current day of month 1..31
1791 bool varies; // true if recurring days vary between different months 1797 bool varies; // true if recurring days vary between different months
1792 private: 1798 private:
1793 QValueList<int> days28, days29, days30, days31; // recurring days in months of each length 1799 QValueList<int> days28, days29, days30, days31; // recurring days in months of each length
1794 QValueList<int> *recurDays[4]; 1800 QValueList<int> *recurDays[4];
1795 public: 1801 public:
1796 MonthlyData(const Recurrence* r, const QDate &date) 1802 MonthlyData(const Recurrence* r, const QDate &date)
1797 : recurrence(r), year(date.year()), month(date.month()-1), day(date.day()) 1803 : recurrence(r), year(date.year()), month(date.month()-1), day(date.day())
1798 { recurDays[0] = &days28; 1804 { recurDays[0] = &days28;
1799 recurDays[1] = &days29; 1805 recurDays[1] = &days29;
1800 recurDays[2] = &days30; 1806 recurDays[2] = &days30;
1801 recurDays[3] = &days31; 1807 recurDays[3] = &days31;
1802 varies = (recurrence->recurs == rMonthlyPos) 1808 varies = (recurrence->recurs == rMonthlyPos)
1803 ? true : recurrence->getMonthlyDayDays(days31, 31); 1809 ? true : recurrence->getMonthlyDayDays(days31, 31);
1804 } 1810 }
1805 const QValueList<int>* dayList() const { 1811 const QValueList<int>* dayList() const {
1806 if (!varies) 1812 if (!varies)
1807 return &days31; 1813 return &days31;
1808 QDate startOfMonth(year, month + 1, 1); 1814 QDate startOfMonth(year, month + 1, 1);
1809 int daysInMonth = startOfMonth.daysInMonth(); 1815 int daysInMonth = startOfMonth.daysInMonth();
1810 QValueList<int>* days = recurDays[daysInMonth - 28]; 1816 QValueList<int>* days = recurDays[daysInMonth - 28];
1811 if (recurrence->recurs == rMonthlyPos) 1817 if (recurrence->recurs == rMonthlyPos)
1812 recurrence->getMonthlyPosDays(*days, daysInMonth, startOfMonth.dayOfWeek()); 1818 recurrence->getMonthlyPosDays(*days, daysInMonth, startOfMonth.dayOfWeek());
1813 else if (days->isEmpty()) 1819 else if (days->isEmpty())
1814 recurrence->getMonthlyDayDays(*days, daysInMonth); 1820 recurrence->getMonthlyDayDays(*days, daysInMonth);
1815 return days; 1821 return days;
1816 } 1822 }
1817 int yearMonth() const { return year*12 + month; } 1823 int yearMonth() const { return year*12 + month; }
1818 void addMonths(int diff) { month += diff; year += month / 12; month %= 12; } 1824 void addMonths(int diff) { month += diff; year += month / 12; month %= 12; }
1819 QDate date() const { return QDate(year, month + 1, day); } 1825 QDate date() const { return QDate(year, month + 1, day); }
1820}; 1826};
1821 1827
1822int Recurrence::monthlyCalc(PeriodFunc func, QDate &enddate) const 1828int Recurrence::monthlyCalc(PeriodFunc func, QDate &enddate) const
1823{ 1829{
1824 if (recurs == rMonthlyPos && rMonthPositions.isEmpty() 1830 if (recurs == rMonthlyPos && rMonthPositions.isEmpty()
1825 || recurs == rMonthlyDay && rMonthDays.isEmpty()) 1831 || recurs == rMonthlyDay && rMonthDays.isEmpty())
1826 return 0; 1832 return 0;
1827 1833
1828 MonthlyData data(this, mRecurStart.date()); 1834 MonthlyData data(this, mRecurStart.date());
1829 switch (func) { 1835 switch (func) {
1830 case END_DATE_AND_COUNT: 1836 case END_DATE_AND_COUNT:
1831 return monthlyCalcEndDate(enddate, data); 1837 return monthlyCalcEndDate(enddate, data);
1832 case COUNT_TO_DATE: 1838 case COUNT_TO_DATE:
1833 return monthlyCalcToDate(enddate, data); 1839 return monthlyCalcToDate(enddate, data);
1834 case NEXT_AFTER_DATE: 1840 case NEXT_AFTER_DATE:
1835 return monthlyCalcNextAfter(enddate, data); 1841 return monthlyCalcNextAfter(enddate, data);
1836 } 1842 }
1837 return 0; 1843 return 0;
1838} 1844}
1839 1845
1840int Recurrence::monthlyCalcEndDate(QDate &enddate, MonthlyData &data) const 1846int Recurrence::monthlyCalcEndDate(QDate &enddate, MonthlyData &data) const
1841{ 1847{
1842 uint countTogo = rDuration + mRecurExDatesCount; 1848 uint countTogo = rDuration + mRecurExDatesCount;
1843 int countGone = 0; 1849 int countGone = 0;
1844 QValueList<int>::ConstIterator it; 1850 QValueList<int>::ConstIterator it;
1845 const QValueList<int>* days = data.dayList(); 1851 const QValueList<int>* days = data.dayList();
1846 1852
1847 if (data.day > 1) { 1853 if (data.day > 1) {
1848 // Check what remains of the start month 1854 // Check what remains of the start month
1849 for (it = days->begin(); it != days->end(); ++it) { 1855 for (it = days->begin(); it != days->end(); ++it) {
1850 if (*it >= data.day) { 1856 if (*it >= data.day) {
1851 ++countGone; 1857 ++countGone;
1852 if (--countTogo == 0) { 1858 if (--countTogo == 0) {
1853 data.day = *it; 1859 data.day = *it;
1854 break; 1860 break;
1855 } 1861 }
1856 } 1862 }
1857 } 1863 }
1858 if (countTogo) { 1864 if (countTogo) {
1859 data.day = 1; 1865 data.day = 1;
1860 data.addMonths(rFreq); 1866 data.addMonths(rFreq);
1861 } 1867 }
1862 } 1868 }
1863 if (countTogo) { 1869 if (countTogo) {
1864 if (data.varies) { 1870 if (data.varies) {
1865 // The number of recurrence days varies from month to month, 1871 // The number of recurrence days varies from month to month,
1866 // so we need to check month by month. 1872 // so we need to check month by month.
1867 for ( ; ; ) { 1873 for ( ; ; ) {
1868 days = data.dayList(); 1874 days = data.dayList();
1869 uint n = days->count(); // number of recurrence days in this month 1875 uint n = days->count(); // number of recurrence days in this month
1870 if (n >= countTogo) 1876 if (n >= countTogo)
1871 break; 1877 break;
1872 countTogo -= n; 1878 countTogo -= n;
1873 countGone += n; 1879 countGone += n;
1874 data.addMonths(rFreq); 1880 data.addMonths(rFreq);
1875 } 1881 }
1876 } else { 1882 } else {
1877 // The number of recurrences is the same every month, 1883 // The number of recurrences is the same every month,
1878 // so skip the month-by-month check. 1884 // so skip the month-by-month check.
1879 // Skip the remaining whole months, but leave at least 1885 // Skip the remaining whole months, but leave at least
1880 // 1 recurrence remaining, in order to get its date. 1886 // 1 recurrence remaining, in order to get its date.
1881 int daysPerMonth = days->count(); 1887 int daysPerMonth = days->count();
1882 int wholeMonths = (countTogo - 1) / daysPerMonth; 1888 int wholeMonths = (countTogo - 1) / daysPerMonth;
1883 data.addMonths(wholeMonths * rFreq); 1889 data.addMonths(wholeMonths * rFreq);
1884 countGone += wholeMonths * daysPerMonth; 1890 countGone += wholeMonths * daysPerMonth;
1885 countTogo -= wholeMonths * daysPerMonth; 1891 countTogo -= wholeMonths * daysPerMonth;
1886 } 1892 }
1887 if (countTogo) { 1893 if (countTogo) {
1888 // Check the last month in the recurrence 1894 // Check the last month in the recurrence
1889 for (it = days->begin(); it != days->end(); ++it) { 1895 for (it = days->begin(); it != days->end(); ++it) {
1890 ++countGone; 1896 ++countGone;
1891 if (--countTogo == 0) { 1897 if (--countTogo == 0) {
1892 data.day = *it; 1898 data.day = *it;
1893 break; 1899 break;
1894 } 1900 }
1895 } 1901 }
1896 } 1902 }
1897 } 1903 }
1898 enddate = data.date(); 1904 enddate = data.date();
1899 return countGone; 1905 return countGone;
1900} 1906}
1901 1907
1902int Recurrence::monthlyCalcToDate(const QDate &enddate, MonthlyData &data) const 1908int Recurrence::monthlyCalcToDate(const QDate &enddate, MonthlyData &data) const
1903{ 1909{
1904 int countGone = 0; 1910 int countGone = 0;
1905 int countMax = (rDuration > 0) ? rDuration + mRecurExDatesCount : INT_MAX; 1911 int countMax = (rDuration > 0) ? rDuration + mRecurExDatesCount : INT_MAX;
1906 int endYear = enddate.year(); 1912 int endYear = enddate.year();
1907 int endMonth = enddate.month() - 1; // zero-based 1913 int endMonth = enddate.month() - 1; // zero-based
1908 int endDay = enddate.day(); 1914 int endDay = enddate.day();
1909 int endYearMonth = endYear*12 + endMonth; 1915 int endYearMonth = endYear*12 + endMonth;
1910 QValueList<int>::ConstIterator it; 1916 QValueList<int>::ConstIterator it;
1911 const QValueList<int>* days = data.dayList(); 1917 const QValueList<int>* days = data.dayList();
1912 1918
1913 if (data.day > 1) { 1919 if (data.day > 1) {
1914 // Check what remains of the start month 1920 // Check what remains of the start month
1915 for (it = days->begin(); it != days->end(); ++it) { 1921 for (it = days->begin(); it != days->end(); ++it) {
1916 if (*it >= data.day) { 1922 if (*it >= data.day) {
1917 if (data.yearMonth() == endYearMonth && *it > endDay) 1923 if (data.yearMonth() == endYearMonth && *it > endDay)
1918 return countGone; 1924 return countGone;
1919 if (++countGone >= countMax) 1925 if (++countGone >= countMax)
1920 return countMax; 1926 return countMax;
1921 } 1927 }
1922 } 1928 }
1923 data.day = 1; 1929 data.day = 1;
1924 data.addMonths(rFreq); 1930 data.addMonths(rFreq);
1925 } 1931 }
1926 1932
1927 if (data.varies) { 1933 if (data.varies) {
1928 // The number of recurrence days varies from month to month, 1934 // The number of recurrence days varies from month to month,
1929 // so we need to check month by month. 1935 // so we need to check month by month.
1930 while (data.yearMonth() < endYearMonth) { 1936 while (data.yearMonth() < endYearMonth) {
1931 countGone += data.dayList()->count(); 1937 countGone += data.dayList()->count();
1932 if (countGone >= countMax) 1938 if (countGone >= countMax)
1933 return countMax; 1939 return countMax;
1934 data.addMonths(rFreq); 1940 data.addMonths(rFreq);
1935 } 1941 }
1936 days = data.dayList(); 1942 days = data.dayList();
1937 } else { 1943 } else {
1938 // The number of recurrences is the same every month, 1944 // The number of recurrences is the same every month,
1939 // so skip the month-by-month check. 1945 // so skip the month-by-month check.
1940 // Skip the remaining whole months. 1946 // Skip the remaining whole months.
1941 int daysPerMonth = days->count(); 1947 int daysPerMonth = days->count();
1942 int wholeMonths = endYearMonth - data.yearMonth(); 1948 int wholeMonths = endYearMonth - data.yearMonth();
1943 countGone += (wholeMonths / rFreq) * daysPerMonth; 1949 countGone += (wholeMonths / rFreq) * daysPerMonth;
1944 if (countGone >= countMax) 1950 if (countGone >= countMax)
1945 return countMax; 1951 return countMax;
1946 if (wholeMonths % rFreq) 1952 if (wholeMonths % rFreq)
1947 return countGone; // end year isn't a recurrence year 1953 return countGone; // end year isn't a recurrence year
1948 data.year = endYear; 1954 data.year = endYear;
1949 data.month = endMonth; 1955 data.month = endMonth;
1950 } 1956 }
1951 1957
1952 // Check the last month in the recurrence 1958 // Check the last month in the recurrence
1953 for (it = days->begin(); it != days->end(); ++it) { 1959 for (it = days->begin(); it != days->end(); ++it) {
1954 if (*it > endDay) 1960 if (*it > endDay)
1955 return countGone; 1961 return countGone;
1956 if (++countGone >= countMax) 1962 if (++countGone >= countMax)
1957 return countMax; 1963 return countMax;
1958 } 1964 }
1959 return countGone; 1965 return countGone;
1960} 1966}
1961 1967
1962int Recurrence::monthlyCalcNextAfter(QDate &enddate, MonthlyData &data) const 1968int Recurrence::monthlyCalcNextAfter(QDate &enddate, MonthlyData &data) const
1963{ 1969{
1964 uint countTogo = (rDuration > 0) ? rDuration + mRecurExDatesCount : UINT_MAX; 1970 uint countTogo = (rDuration > 0) ? rDuration + mRecurExDatesCount : UINT_MAX;
1965 int countGone = 0; 1971 int countGone = 0;
1966 int endYear = enddate.year(); 1972 int endYear = enddate.year();
1967 int endDay = enddate.day(); 1973 int endDay = enddate.day();
1968 int endYearMonth = endYear*12 + enddate.month() - 1; 1974 int endYearMonth = endYear*12 + enddate.month() - 1;
1969 QValueList<int>::ConstIterator it; 1975 QValueList<int>::ConstIterator it;
1970 const QValueList<int>* days = data.dayList(); 1976 const QValueList<int>* days = data.dayList();
1971 1977
1972 if (data.day > 1) { 1978 if (data.day > 1) {
1973 // Check what remains of the start month 1979 // Check what remains of the start month
1974 for (it = days->begin(); it != days->end(); ++it) { 1980 for (it = days->begin(); it != days->end(); ++it) {
1975 if (*it >= data.day) { 1981 if (*it >= data.day) {
1976 ++countGone; 1982 ++countGone;
1977 if (data.yearMonth() == endYearMonth && *it > endDay) { 1983 if (data.yearMonth() == endYearMonth && *it > endDay) {
1978 data.day = *it; 1984 data.day = *it;
1979 goto ex; 1985 goto ex;
1980 } 1986 }
1981 if (--countTogo == 0) 1987 if (--countTogo == 0)
1982 return 0; 1988 return 0;
1983 } 1989 }
1984 } 1990 }
1985 data.day = 1; 1991 data.day = 1;
1986 data.addMonths(rFreq); 1992 data.addMonths(rFreq);
1987 } 1993 }
1988 1994
1989 if (data.varies) { 1995 if (data.varies) {
1990 // The number of recurrence days varies from month to month, 1996 // The number of recurrence days varies from month to month,
1991 // so we need to check month by month. 1997 // so we need to check month by month.
1992 while (data.yearMonth() <= endYearMonth) { 1998 while (data.yearMonth() <= endYearMonth) {
1993 days = data.dayList(); 1999 days = data.dayList();
1994 uint n = days->count(); // number of recurrence days in this month 2000 uint n = days->count(); // number of recurrence days in this month
1995 if (data.yearMonth() == endYearMonth && days->last() > endDay) 2001 if (data.yearMonth() == endYearMonth && days->last() > endDay)
1996 break; 2002 break;
1997 if (n >= countTogo) 2003 if (n >= countTogo)
1998 return 0; 2004 return 0;
1999 countGone += n; 2005 countGone += n;
2000 countTogo -= n; 2006 countTogo -= n;
2001 data.addMonths(rFreq); 2007 data.addMonths(rFreq);
2002 } 2008 }
2003 days = data.dayList(); 2009 days = data.dayList();
2004 } else { 2010 } else {
2005 // The number of recurrences is the same every month, 2011 // The number of recurrences is the same every month,
2006 // so skip the month-by-month check. 2012 // so skip the month-by-month check.
2007 // Skip the remaining whole months to at least end year/month. 2013 // Skip the remaining whole months to at least end year/month.
2008 int daysPerMonth = days->count(); 2014 int daysPerMonth = days->count();
2009 int elapsed = endYearMonth - data.yearMonth(); 2015 int elapsed = endYearMonth - data.yearMonth();
2010 int recurMonths = (elapsed + rFreq - 1) / rFreq; 2016 int recurMonths = (elapsed + rFreq - 1) / rFreq;
2011 if (elapsed % rFreq == 0 && days->last() <= endDay) 2017 if (elapsed % rFreq == 0 && days->last() <= endDay)
2012 ++recurMonths; // required month is after endYearMonth 2018 ++recurMonths; // required month is after endYearMonth
2013 if (recurMonths) { 2019 if (recurMonths) {
2014 int n = recurMonths * daysPerMonth; 2020 int n = recurMonths * daysPerMonth;
2015 if (static_cast<uint>(n) > countTogo) 2021 if (static_cast<uint>(n) > countTogo)
2016 return 0; // reached end of recurrence 2022 return 0; // reached end of recurrence
2017 countTogo -= n; 2023 countTogo -= n;
2018 countGone += n; 2024 countGone += n;
2019 data.addMonths(recurMonths * rFreq); 2025 data.addMonths(recurMonths * rFreq);
2020 } 2026 }
2021 } 2027 }
2022 2028
2023 // Check the last month in the recurrence 2029 // Check the last month in the recurrence
2024 for (it = days->begin(); it != days->end(); ++it) { 2030 for (it = days->begin(); it != days->end(); ++it) {
2025 ++countGone; 2031 ++countGone;
2026 if (data.yearMonth() > endYearMonth || *it > endDay) { 2032 if (data.yearMonth() > endYearMonth || *it > endDay) {
2027 data.day = *it; 2033 data.day = *it;
2028 break; 2034 break;
2029 } 2035 }
2030 if (--countTogo == 0) 2036 if (--countTogo == 0)
2031 return 0; 2037 return 0;
2032 } 2038 }
2033ex: 2039ex:
2034 enddate = data.date(); 2040 enddate = data.date();
2035 return countGone; 2041 return countGone;
2036} 2042}
2037 2043
2038 2044
2039/* Find count and, depending on 'func', the end date of an annual recurrence by date. 2045/* Find count and, depending on 'func', the end date of an annual recurrence by date.
2040 * Reply = total number of occurrences up to 'enddate', or 0 if error. 2046 * Reply = total number of occurrences up to 'enddate', or 0 if error.
2041 * If 'func' = END_DATE_AND_COUNT or NEXT_AFTER_DATE, 'enddate' is updated to the 2047 * If 'func' = END_DATE_AND_COUNT or NEXT_AFTER_DATE, 'enddate' is updated to the
2042 * recurrence end date. 2048 * recurrence end date.
2043 */ 2049 */
2044struct Recurrence::YearlyMonthData { 2050struct Recurrence::YearlyMonthData {
2045 const Recurrence *recurrence; 2051 const Recurrence *recurrence;
2046 int year; // current year 2052 int year; // current year
2047 int month; // current month 1..12 2053 int month; // current month 1..12
2048 int day; // current day of month 1..31 2054 int day; // current day of month 1..31
2049 bool leapyear; // true if February 29th recurs and current year is a leap year 2055 bool leapyear; // true if February 29th recurs and current year is a leap year
2050 bool feb29; // true if February 29th recurs 2056 bool feb29; // true if February 29th recurs
2051 private: 2057 private:
2052 QValueList<int> months; // recurring months in non-leap years 1..12 2058 QValueList<int> months; // recurring months in non-leap years 1..12
2053 QValueList<int> leapMonths; // recurring months in leap years 1..12 2059 QValueList<int> leapMonths; // recurring months in leap years 1..12
2054 public: 2060 public:
2055 YearlyMonthData(const Recurrence* r, const QDate &date) 2061 YearlyMonthData(const Recurrence* r, const QDate &date)
2056 : recurrence(r), year(date.year()), month(date.month()), day(date.day()) 2062 : recurrence(r), year(date.year()), month(date.month()), day(date.day())
2057 { feb29 = recurrence->getYearlyMonthMonths(day, months, leapMonths); 2063 { feb29 = recurrence->getYearlyMonthMonths(day, months, leapMonths);
2058 leapyear = feb29 && QDate::leapYear(year); 2064 leapyear = feb29 && QDate::leapYear(year);
2059 } 2065 }
2060 const QValueList<int>* monthList() const 2066 const QValueList<int>* monthList() const
2061 { return leapyear ? &leapMonths : &months; } 2067 { return leapyear ? &leapMonths : &months; }
2062 const QValueList<int>* leapMonthList() const { return &leapMonths; } 2068 const QValueList<int>* leapMonthList() const { return &leapMonths; }
2063 QDate date() const { return QDate(year, month, day); } 2069 QDate date() const { return QDate(year, month, day); }
2064}; 2070};
2065 2071
2066int Recurrence::yearlyMonthCalc(PeriodFunc func, QDate &enddate) const 2072int Recurrence::yearlyMonthCalc(PeriodFunc func, QDate &enddate) const
2067{ 2073{
2068 if (rYearNums.isEmpty()) 2074 if (rYearNums.isEmpty())
2069 return 0; 2075 return 0;
2070 YearlyMonthData data(this, mRecurStart.date()); 2076 YearlyMonthData data(this, mRecurStart.date());
2071 switch (func) { 2077 switch (func) {
2072 case END_DATE_AND_COUNT: 2078 case END_DATE_AND_COUNT:
2073 return yearlyMonthCalcEndDate(enddate, data); 2079 return yearlyMonthCalcEndDate(enddate, data);
2074 case COUNT_TO_DATE: 2080 case COUNT_TO_DATE:
2075 return yearlyMonthCalcToDate(enddate, data); 2081 return yearlyMonthCalcToDate(enddate, data);
2076 case NEXT_AFTER_DATE: 2082 case NEXT_AFTER_DATE:
2077 return yearlyMonthCalcNextAfter(enddate, data); 2083 return yearlyMonthCalcNextAfter(enddate, data);
2078 } 2084 }
2079 return 0; 2085 return 0;
2080} 2086}
2081 2087
2082// Find total count and end date of an annual recurrence by date. 2088// Find total count and end date of an annual recurrence by date.
2083// Reply = total number of occurrences. 2089// Reply = total number of occurrences.
2084int Recurrence::yearlyMonthCalcEndDate(QDate &enddate, YearlyMonthData &data) const 2090int Recurrence::yearlyMonthCalcEndDate(QDate &enddate, YearlyMonthData &data) const
2085{ 2091{
2086 uint countTogo = rDuration + mRecurExDatesCount; 2092 uint countTogo = rDuration + mRecurExDatesCount;
2087 int countGone = 0; 2093 int countGone = 0;
2088 QValueList<int>::ConstIterator it; 2094 QValueList<int>::ConstIterator it;
2089 const QValueList<int>* mons = data.monthList(); // get recurring months for this year 2095 const QValueList<int>* mons = data.monthList(); // get recurring months for this year
2090 2096
2091 if (data.month > 1) { 2097 if (data.month > 1) {
2092 // Check what remains of the start year 2098 // Check what remains of the start year
2093 for (it = mons->begin(); it != mons->end(); ++it) { 2099 for (it = mons->begin(); it != mons->end(); ++it) {
2094 if (*it >= data.month) { 2100 if (*it >= data.month) {
2095 ++countGone; 2101 ++countGone;
2096 if (--countTogo == 0) { 2102 if (--countTogo == 0) {
2097 data.month = *it; 2103 data.month = *it;
2098 if (data.month == 2 && data.feb29 && !data.leapyear) { 2104 if (data.month == 2 && data.feb29 && !data.leapyear) {
2099 // The recurrence should end on February 29th, but it's a non-leap year 2105 // The recurrence should end on February 29th, but it's a non-leap year
2100 switch (mFeb29YearlyType) { 2106 switch (mFeb29YearlyType) {
2101 case rFeb28: 2107 case rFeb28:
2102 data.day = 28; 2108 data.day = 28;
2103 break; 2109 break;
2104 case rMar1: 2110 case rMar1:
2105 data.month = 3; 2111 data.month = 3;
2106 data.day = 1; 2112 data.day = 1;
2107 break; 2113 break;
2108 case rFeb29: 2114 case rFeb29:
2109 break; 2115 break;
2110 } 2116 }
2111 } 2117 }
2112 break; 2118 break;
2113 } 2119 }
2114 } 2120 }
2115 } 2121 }
2116 if (countTogo) { 2122 if (countTogo) {
2117 data.month = 1; 2123 data.month = 1;
2118 data.year += rFreq; 2124 data.year += rFreq;
2119 } 2125 }
2120 } 2126 }
2121 if (countTogo) { 2127 if (countTogo) {
2122 if (data.feb29 && mFeb29YearlyType == rFeb29) { 2128 if (data.feb29 && mFeb29YearlyType == rFeb29) {
2123 // The number of recurrences is different on leap years, 2129 // The number of recurrences is different on leap years,
2124 // so check year-by-year. 2130 // so check year-by-year.
2125 for ( ; ; ) { 2131 for ( ; ; ) {
2126 mons = data.monthList(); 2132 mons = data.monthList();
2127 uint n = mons->count(); 2133 uint n = mons->count();
2128 if (n >= countTogo) 2134 if (n >= countTogo)
2129 break; 2135 break;
2130 countTogo -= n; 2136 countTogo -= n;
2131 countGone += n; 2137 countGone += n;
2132 data.year += rFreq; 2138 data.year += rFreq;
2133 } 2139 }
2134 } else { 2140 } else {
2135 // The number of recurrences is the same every year, 2141 // The number of recurrences is the same every year,
2136 // so skip the year-by-year check. 2142 // so skip the year-by-year check.
2137 // Skip the remaining whole years, but leave at least 2143 // Skip the remaining whole years, but leave at least
2138 // 1 recurrence remaining, in order to get its date. 2144 // 1 recurrence remaining, in order to get its date.
2139 int monthsPerYear = mons->count(); 2145 int monthsPerYear = mons->count();
2140 int wholeYears = (countTogo - 1) / monthsPerYear; 2146 int wholeYears = (countTogo - 1) / monthsPerYear;
2141 data.year += wholeYears * rFreq; 2147 data.year += wholeYears * rFreq;
2142 countGone += wholeYears * monthsPerYear; 2148 countGone += wholeYears * monthsPerYear;
2143 countTogo -= wholeYears * monthsPerYear; 2149 countTogo -= wholeYears * monthsPerYear;
2144 } 2150 }
2145 if (countTogo) { 2151 if (countTogo) {
2146 // Check the last year in the recurrence 2152 // Check the last year in the recurrence
2147 for (it = mons->begin(); it != mons->end(); ++it) { 2153 for (it = mons->begin(); it != mons->end(); ++it) {
2148 ++countGone; 2154 ++countGone;
2149 if (--countTogo == 0) { 2155 if (--countTogo == 0) {
2150 data.month = *it; 2156 data.month = *it;
2151 if (data.month == 2 && data.feb29 && !QDate::leapYear(data.year)) { 2157 if (data.month == 2 && data.feb29 && !QDate::leapYear(data.year)) {
2152 // The recurrence should end on February 29th, but it's a non-leap year 2158 // The recurrence should end on February 29th, but it's a non-leap year
2153 switch (mFeb29YearlyType) { 2159 switch (mFeb29YearlyType) {
2154 case rFeb28: 2160 case rFeb28:
2155 data.day = 28; 2161 data.day = 28;
2156 break; 2162 break;
2157 case rMar1: 2163 case rMar1:
2158 data.month = 3; 2164 data.month = 3;
2159 data.day = 1; 2165 data.day = 1;
2160 break; 2166 break;
2161 case rFeb29: 2167 case rFeb29:
2162 break; 2168 break;
2163 } 2169 }
2164 } 2170 }
2165 break; 2171 break;
2166 } 2172 }
2167 } 2173 }
2168 } 2174 }
2169 } 2175 }
2170 enddate = data.date(); 2176 enddate = data.date();
2171 return countGone; 2177 return countGone;
2172} 2178}
2173 2179
2174// Find count of an annual recurrence by date. 2180// Find count of an annual recurrence by date.
2175// Reply = total number of occurrences up to 'enddate'. 2181// Reply = total number of occurrences up to 'enddate'.
2176int Recurrence::yearlyMonthCalcToDate(const QDate &enddate, YearlyMonthData &data) const 2182int Recurrence::yearlyMonthCalcToDate(const QDate &enddate, YearlyMonthData &data) const
2177{ 2183{
2178 int countGone = 0; 2184 int countGone = 0;
2179 int countMax = (rDuration > 0) ? rDuration + mRecurExDatesCount : INT_MAX; 2185 int countMax = (rDuration > 0) ? rDuration + mRecurExDatesCount : INT_MAX;
2180 int endYear = enddate.year(); 2186 int endYear = enddate.year();
2181 int endMonth = enddate.month(); 2187 int endMonth = enddate.month();
2182 int endDay = enddate.day(); 2188 int endDay = enddate.day();
2183 if (endDay < data.day) { 2189 if (endDay < data.day) {
2184 /* The end day of the month is earlier than the recurrence day of the month. 2190 /* The end day of the month is earlier than the recurrence day of the month.
2185 * If Feb 29th recurs and: 2191 * If Feb 29th recurs and:
2186 * 1) it recurs on Feb 28th in non-leap years, don't adjust the end month 2192 * 1) it recurs on Feb 28th in non-leap years, don't adjust the end month
2187 * if enddate is Feb 28th on a non-leap year. 2193 * if enddate is Feb 28th on a non-leap year.
2188 * 2) it recurs on Mar 1st in non-leap years, allow the end month to be 2194 * 2) it recurs on Mar 1st in non-leap years, allow the end month to be
2189 * adjusted to February, to simplify calculations. 2195 * adjusted to February, to simplify calculations.
2190 */ 2196 */
2191 if (data.feb29 && !QDate::leapYear(endYear) 2197 if (data.feb29 && !QDate::leapYear(endYear)
2192 && mFeb29YearlyType == rFeb28 && endDay == 28 && endMonth == 2) { 2198 && mFeb29YearlyType == rFeb28 && endDay == 28 && endMonth == 2) {
2193 } 2199 }
2194 else if (--endMonth == 0) { 2200 else if (--endMonth == 0) {
2195 endMonth = 12; 2201 endMonth = 12;
2196 --endYear; 2202 --endYear;
2197 } 2203 }
2198 } 2204 }
2199 QValueList<int>::ConstIterator it; 2205 QValueList<int>::ConstIterator it;
2200 const QValueList<int>* mons = data.monthList(); 2206 const QValueList<int>* mons = data.monthList();
2201 2207
2202 if (data.month > 1) { 2208 if (data.month > 1) {
2203 // Check what remains of the start year 2209 // Check what remains of the start year
2204 for (it = mons->begin(); it != mons->end(); ++it) { 2210 for (it = mons->begin(); it != mons->end(); ++it) {
2205 if (*it >= data.month) { 2211 if (*it >= data.month) {
2206 if (data.year == endYear && *it > endMonth) 2212 if (data.year == endYear && *it > endMonth)
2207 return countGone; 2213 return countGone;
2208 if (++countGone >= countMax) 2214 if (++countGone >= countMax)
2209 return countMax; 2215 return countMax;
2210 } 2216 }
2211 } 2217 }
2212 data.month = 1; 2218 data.month = 1;
2213 data.year += rFreq; 2219 data.year += rFreq;
2214 } 2220 }
2215 if (data.feb29 && mFeb29YearlyType == rFeb29) { 2221 if (data.feb29 && mFeb29YearlyType == rFeb29) {
2216 // The number of recurrences is different on leap years, 2222 // The number of recurrences is different on leap years,
2217 // so check year-by-year. 2223 // so check year-by-year.
2218 while (data.year < endYear) { 2224 while (data.year < endYear) {
2219 countGone += data.monthList()->count(); 2225 countGone += data.monthList()->count();
2220 if (countGone >= countMax) 2226 if (countGone >= countMax)
2221 return countMax; 2227 return countMax;
2222 data.year += rFreq; 2228 data.year += rFreq;
2223 } 2229 }
2224 mons = data.monthList(); 2230 mons = data.monthList();
2225 } else { 2231 } else {
2226 // The number of recurrences is the same every year, 2232 // The number of recurrences is the same every year,
2227 // so skip the year-by-year check. 2233 // so skip the year-by-year check.
2228 // Skip the remaining whole years. 2234 // Skip the remaining whole years.
2229 int monthsPerYear = mons->count(); 2235 int monthsPerYear = mons->count();
2230 int wholeYears = endYear - data.year; 2236 int wholeYears = endYear - data.year;
2231 countGone += (wholeYears / rFreq) * monthsPerYear; 2237 countGone += (wholeYears / rFreq) * monthsPerYear;
2232 if (countGone >= countMax) 2238 if (countGone >= countMax)
2233 return countMax; 2239 return countMax;
2234 if (wholeYears % rFreq) 2240 if (wholeYears % rFreq)
2235 return countGone; // end year isn't a recurrence year 2241 return countGone; // end year isn't a recurrence year
2236 data.year = endYear; 2242 data.year = endYear;
2237 } 2243 }
2238 2244
2239 // Check the last year in the recurrence 2245 // Check the last year in the recurrence
2240 for (it = mons->begin(); it != mons->end(); ++it) { 2246 for (it = mons->begin(); it != mons->end(); ++it) {
2241 if (*it > endMonth) 2247 if (*it > endMonth)
2242 return countGone; 2248 return countGone;
2243 if (++countGone >= countMax) 2249 if (++countGone >= countMax)
2244 return countMax; 2250 return countMax;
2245 } 2251 }
2246 return countGone; 2252 return countGone;
2247} 2253}
2248 2254
2249// Find count and date of first recurrence after 'enddate' of an annual recurrence by date. 2255// Find count and date of first recurrence after 'enddate' of an annual recurrence by date.
2250// Reply = total number of occurrences up to 'enddate'. 2256// Reply = total number of occurrences up to 'enddate'.
2251int Recurrence::yearlyMonthCalcNextAfter(QDate &enddate, YearlyMonthData &data) const 2257int Recurrence::yearlyMonthCalcNextAfter(QDate &enddate, YearlyMonthData &data) const
2252{ 2258{
2253 uint countTogo = (rDuration > 0) ? rDuration + mRecurExDatesCount : UINT_MAX; 2259 uint countTogo = (rDuration > 0) ? rDuration + mRecurExDatesCount : UINT_MAX;
2254 int countGone = 0; 2260 int countGone = 0;
2255 int endYear = enddate.year(); 2261 int endYear = enddate.year();
2256 int endMonth = enddate.month(); 2262 int endMonth = enddate.month();
2257 int endDay = enddate.day(); 2263 int endDay = enddate.day();
2258 bool mar1TooEarly = false; 2264 bool mar1TooEarly = false;
2259 bool feb28ok = false; 2265 bool feb28ok = false;
2260 if (endDay < data.day) { 2266 if (endDay < data.day) {
2261 if (data.feb29 && mFeb29YearlyType == rMar1 && endMonth == 3) 2267 if (data.feb29 && mFeb29YearlyType == rMar1 && endMonth == 3)
2262 mar1TooEarly = true; 2268 mar1TooEarly = true;
2263 if (data.feb29 && mFeb29YearlyType == rFeb28 && endMonth == 2 && endDay == 28) 2269 if (data.feb29 && mFeb29YearlyType == rFeb28 && endMonth == 2 && endDay == 28)
2264 feb28ok = true; 2270 feb28ok = true;
2265 else if (--endMonth == 0) { 2271 else if (--endMonth == 0) {
2266 endMonth = 12; 2272 endMonth = 12;
2267 --endYear; 2273 --endYear;
2268 } 2274 }
2269 } 2275 }
2270 QValueList<int>::ConstIterator it; 2276 QValueList<int>::ConstIterator it;
2271 const QValueList<int>* mons = data.monthList(); 2277 const QValueList<int>* mons = data.monthList();
2272 2278
2273 if (data.month > 1) { 2279 if (data.month > 1) {
2274 // Check what remains of the start year 2280 // Check what remains of the start year
2275 for (it = mons->begin(); it != mons->end(); ++it) { 2281 for (it = mons->begin(); it != mons->end(); ++it) {
2276 if (*it >= data.month) { 2282 if (*it >= data.month) {
2277 ++countGone; 2283 ++countGone;
2278 if (data.year == endYear 2284 if (data.year == endYear
2279 && ( *it > endMonth && (*it > 3 || !mar1TooEarly) 2285 && ( *it > endMonth && (*it > 3 || !mar1TooEarly)
2280 || *it == 2 && feb28ok && data.leapyear)) { 2286 || *it == 2 && feb28ok && data.leapyear)) {
2281 if (*it == 2 && data.feb29 && !data.leapyear) { 2287 if (*it == 2 && data.feb29 && !data.leapyear) {
2282 // The next recurrence should be on February 29th, but it's a non-leap year 2288 // The next recurrence should be on February 29th, but it's a non-leap year
2283 switch (mFeb29YearlyType) { 2289 switch (mFeb29YearlyType) {
2284 case rFeb28: 2290 case rFeb28:
2285 data.month = 2; 2291 data.month = 2;
2286 data.day = 28; 2292 data.day = 28;
2287 break; 2293 break;
2288 case rMar1: 2294 case rMar1:
2289 data.month = 3; 2295 data.month = 3;
2290 data.day = 1; 2296 data.day = 1;
2291 break; 2297 break;
2292 case rFeb29: // impossible in this context! 2298 case rFeb29: // impossible in this context!
2293 break; 2299 break;
2294 } 2300 }
2295 } 2301 }
2296 else 2302 else
2297 data.month = *it; 2303 data.month = *it;
2298 goto ex; 2304 goto ex;
2299 } 2305 }
2300 if (--countTogo == 0) 2306 if (--countTogo == 0)
2301 return 0; 2307 return 0;
2302 } 2308 }
2303 } 2309 }
2304 data.month = 1; 2310 data.month = 1;
2305 data.year += rFreq; 2311 data.year += rFreq;
2306 } 2312 }
2307 2313
2308 if (data.feb29 && mFeb29YearlyType == rFeb29) { 2314 if (data.feb29 && mFeb29YearlyType == rFeb29) {
2309 // The number of recurrences is different on leap years, 2315 // The number of recurrences is different on leap years,
2310 // so check year-by-year. 2316 // so check year-by-year.
2311 while (data.year <= endYear) { 2317 while (data.year <= endYear) {
2312 mons = data.monthList(); 2318 mons = data.monthList();
2313 if (data.year == endYear && mons->last() > endMonth) 2319 if (data.year == endYear && mons->last() > endMonth)
2314 break; 2320 break;
2315 uint n = mons->count(); 2321 uint n = mons->count();
2316 if (n >= countTogo) 2322 if (n >= countTogo)
2317 break; 2323 break;
2318 countTogo -= n; 2324 countTogo -= n;
2319 countGone += n; 2325 countGone += n;
2320 data.year += rFreq; 2326 data.year += rFreq;
2321 } 2327 }
2322 mons = data.monthList(); 2328 mons = data.monthList();
2323 } else { 2329 } else {
2324 // The number of recurrences is the same every year, 2330 // The number of recurrences is the same every year,
2325 // so skip the year-by-year check. 2331 // so skip the year-by-year check.
2326 // Skip the remaining whole years to at least endYear. 2332 // Skip the remaining whole years to at least endYear.
2327 int monthsPerYear = mons->count(); 2333 int monthsPerYear = mons->count();
2328 int recurYears = (endYear - data.year + rFreq - 1) / rFreq; 2334 int recurYears = (endYear - data.year + rFreq - 1) / rFreq;
2329 if ((endYear - data.year)%rFreq == 0 2335 if ((endYear - data.year)%rFreq == 0
2330 && mons->last() <= endMonth) 2336 && mons->last() <= endMonth)
2331 ++recurYears; // required year is after endYear 2337 ++recurYears; // required year is after endYear
2332 if (recurYears) { 2338 if (recurYears) {
2333 int n = recurYears * monthsPerYear; 2339 int n = recurYears * monthsPerYear;
2334 if (static_cast<uint>(n) > countTogo) 2340 if (static_cast<uint>(n) > countTogo)
2335 return 0; // reached end of recurrence 2341 return 0; // reached end of recurrence
2336 countTogo -= n; 2342 countTogo -= n;
2337 countGone += n; 2343 countGone += n;
2338 data.year += recurYears * rFreq; 2344 data.year += recurYears * rFreq;
2339 } 2345 }
2340 } 2346 }
2341 2347
2342 // Check the last year in the recurrence 2348 // Check the last year in the recurrence
2343 for (it = mons->begin(); it != mons->end(); ++it) { 2349 for (it = mons->begin(); it != mons->end(); ++it) {
2344 ++countGone; 2350 ++countGone;
2345 if (data.year > endYear 2351 if (data.year > endYear
2346 || ( *it > endMonth && (*it > 3 || !mar1TooEarly) 2352 || ( *it > endMonth && (*it > 3 || !mar1TooEarly)
2347 || *it == 2 && feb28ok && QDate::leapYear(data.year))) { 2353 || *it == 2 && feb28ok && QDate::leapYear(data.year))) {
2348 if (*it == 2 && data.feb29 && !QDate::leapYear(data.year)) { 2354 if (*it == 2 && data.feb29 && !QDate::leapYear(data.year)) {
2349 // The next recurrence should be on February 29th, but it's a non-leap year 2355 // The next recurrence should be on February 29th, but it's a non-leap year
2350 switch (mFeb29YearlyType) { 2356 switch (mFeb29YearlyType) {
2351 case rFeb28: 2357 case rFeb28:
2352 data.month = 2; 2358 data.month = 2;
2353 data.day = 28; 2359 data.day = 28;
2354 break; 2360 break;
2355 case rMar1: 2361 case rMar1:
2356 data.month = 3; 2362 data.month = 3;
2357 data.day = 1; 2363 data.day = 1;
2358 break; 2364 break;
2359 case rFeb29: // impossible in this context! 2365 case rFeb29: // impossible in this context!
2360 break; 2366 break;
2361 } 2367 }
2362 } 2368 }
2363 else 2369 else
2364 data.month = *it; 2370 data.month = *it;
2365 break; 2371 break;
2366 } 2372 }
2367 if (--countTogo == 0) 2373 if (--countTogo == 0)
2368 return 0; 2374 return 0;
2369 } 2375 }
2370ex: 2376ex:
2371 enddate = data.date(); 2377 enddate = data.date();
2372 return countGone; 2378 return countGone;
2373} 2379}
2374 2380
2375 2381
2376/* Find count and, depending on 'func', the end date of an annual recurrence by date. 2382/* Find count and, depending on 'func', the end date of an annual recurrence by date.
2377 * Reply = total number of occurrences up to 'enddate', or 0 if error. 2383 * Reply = total number of occurrences up to 'enddate', or 0 if error.
2378 * If 'func' = END_DATE_AND_COUNT or NEXT_AFTER_DATE, 'enddate' is updated to the 2384 * If 'func' = END_DATE_AND_COUNT or NEXT_AFTER_DATE, 'enddate' is updated to the
2379 * recurrence end date. 2385 * recurrence end date.
2380 */ 2386 */
2381struct Recurrence::YearlyPosData { 2387struct Recurrence::YearlyPosData {
2382 const Recurrence *recurrence; 2388 const Recurrence *recurrence;
2383 int year; // current year 2389 int year; // current year
2384 int month; // current month 1..12 2390 int month; // current month 1..12
2385 int day; // current day of month 1..31 2391 int day; // current day of month 1..31
2386 int daysPerMonth; // number of days which recur each month, or -1 if variable 2392 int daysPerMonth; // number of days which recur each month, or -1 if variable
2387 int count; // number of days which recur each year, or -1 if variable 2393 int count; // number of days which recur each year, or -1 if variable
2388 bool varies; // true if number of days varies from year to year 2394 bool varies; // true if number of days varies from year to year
2389 private: 2395 private:
2390 mutable QValueList<int> days; 2396 mutable QValueList<int> days;
2391 public: 2397 public:
2392 YearlyPosData(const Recurrence* r, const QDate &date) 2398 YearlyPosData(const Recurrence* r, const QDate &date)
2393 : recurrence(r), year(date.year()), month(date.month()), day(date.day()), count(-1) 2399 : recurrence(r), year(date.year()), month(date.month()), day(date.day()), count(-1)
2394 { if ((daysPerMonth = r->countMonthlyPosDays()) > 0) 2400 { if ((daysPerMonth = r->countMonthlyPosDays()) > 0)
2395 count = daysPerMonth * r->rYearNums.count(); 2401 count = daysPerMonth * r->rYearNums.count();
2396 varies = (daysPerMonth < 0); 2402 varies = (daysPerMonth < 0);
2397 } 2403 }
2398 const QValueList<int>* dayList() const { 2404 const QValueList<int>* dayList() const {
2399 QDate startOfMonth(year, month, 1); 2405 QDate startOfMonth(year, month, 1);
2400 recurrence->getMonthlyPosDays(days, startOfMonth.daysInMonth(), startOfMonth.dayOfWeek()); 2406 recurrence->getMonthlyPosDays(days, startOfMonth.daysInMonth(), startOfMonth.dayOfWeek());
2401 return &days; 2407 return &days;
2402 } 2408 }
2403 int yearMonth() const { return year*12 + month - 1; } 2409 int yearMonth() const { return year*12 + month - 1; }
2404 void addMonths(int diff) { month += diff - 1; year += month / 12; month = month % 12 + 1; } 2410 void addMonths(int diff) { month += diff - 1; year += month / 12; month = month % 12 + 1; }
2405 QDate date() const { return QDate(year, month, day); } 2411 QDate date() const { return QDate(year, month, day); }
2406}; 2412};
2407 2413
2408int Recurrence::yearlyPosCalc(PeriodFunc func, QDate &enddate) const 2414int Recurrence::yearlyPosCalc(PeriodFunc func, QDate &enddate) const
2409{ 2415{
2410 if (rYearNums.isEmpty() || rMonthPositions.isEmpty()) 2416 if (rYearNums.isEmpty() || rMonthPositions.isEmpty())
2411 return 0; 2417 return 0;
2412 YearlyPosData data(this, mRecurStart.date()); 2418 YearlyPosData data(this, mRecurStart.date());
2413 switch (func) { 2419 switch (func) {
2414 case END_DATE_AND_COUNT: 2420 case END_DATE_AND_COUNT:
2415 return yearlyPosCalcEndDate(enddate, data); 2421 return yearlyPosCalcEndDate(enddate, data);
2416 case COUNT_TO_DATE: 2422 case COUNT_TO_DATE:
2417 return yearlyPosCalcToDate(enddate, data); 2423 return yearlyPosCalcToDate(enddate, data);
2418 case NEXT_AFTER_DATE: 2424 case NEXT_AFTER_DATE:
2419 return yearlyPosCalcNextAfter(enddate, data); 2425 return yearlyPosCalcNextAfter(enddate, data);
2420 } 2426 }
2421 return 0; 2427 return 0;
2422} 2428}
2423 2429
2424int Recurrence::yearlyPosCalcEndDate(QDate &enddate, YearlyPosData &data) const 2430int Recurrence::yearlyPosCalcEndDate(QDate &enddate, YearlyPosData &data) const
2425{ 2431{
2426 uint countTogo = rDuration + mRecurExDatesCount; 2432 uint countTogo = rDuration + mRecurExDatesCount;
2427 int countGone = 0; 2433 int countGone = 0;
2428 QValueList<int>::ConstIterator id; 2434 QValueList<int>::ConstIterator id;
2429 const QValueList<int>* days; 2435 const QValueList<int>* days;
2430 2436
2431 if (data.month > 1 || data.day > 1) { 2437 if (data.month > 1 || data.day > 1) {
2432 // Check what remains of the start year 2438 // Check what remains of the start year
2433 for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) { 2439 for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
2434 if (*im.current() >= data.month) { 2440 if (*im.current() >= data.month) {
2435 // Check what remains of the start month 2441 // Check what remains of the start month
2436 if (data.day > 1 || data.varies 2442 if (data.day > 1 || data.varies
2437 || static_cast<uint>(data.daysPerMonth) >= countTogo) { 2443 || static_cast<uint>(data.daysPerMonth) >= countTogo) {
2438 data.month = *im.current(); 2444 data.month = *im.current();
2439 days = data.dayList(); 2445 days = data.dayList();
2440 for (id = days->begin(); id != days->end(); ++id) { 2446 for (id = days->begin(); id != days->end(); ++id) {
2441 if (*id >= data.day) { 2447 if (*id >= data.day) {
2442 ++countGone; 2448 ++countGone;
2443 if (--countTogo == 0) { 2449 if (--countTogo == 0) {
2444 data.month = *im.current(); 2450 data.month = *im.current();
2445 data.day = *id; 2451 data.day = *id;
2446 goto ex; 2452 goto ex;
2447 } 2453 }
2448 } 2454 }
2449 } 2455 }
2450 data.day = 1; 2456 data.day = 1;
2451 } else { 2457 } else {
2452 // The number of days per month is constant, so skip 2458 // The number of days per month is constant, so skip
2453 // the whole month. 2459 // the whole month.
2454 countTogo -= data.daysPerMonth; 2460 countTogo -= data.daysPerMonth;
2455 countGone += data.daysPerMonth; 2461 countGone += data.daysPerMonth;
2456 } 2462 }
2457 } 2463 }
2458 } 2464 }
2459 data.month = 1; 2465 data.month = 1;
2460 data.year += rFreq; 2466 data.year += rFreq;
2461 } 2467 }
2462 2468
2463 if (data.varies) { 2469 if (data.varies) {
2464 // The number of recurrences varies from year to year. 2470 // The number of recurrences varies from year to year.
2465 for ( ; ; ) { 2471 for ( ; ; ) {
2466 for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) { 2472 for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
2467 data.month = *im.current(); 2473 data.month = *im.current();
2468 days = data.dayList(); 2474 days = data.dayList();
2469 int n = days->count(); 2475 int n = days->count();
2470 if (static_cast<uint>(n) >= countTogo) { 2476 if (static_cast<uint>(n) >= countTogo) {
2471 // Check the last month in the recurrence 2477 // Check the last month in the recurrence
2472 for (id = days->begin(); id != days->end(); ++id) { 2478 for (id = days->begin(); id != days->end(); ++id) {
2473 ++countGone; 2479 ++countGone;
2474 if (--countTogo == 0) { 2480 if (--countTogo == 0) {
2475 data.day = *id; 2481 data.day = *id;
2476 goto ex; 2482 goto ex;
2477 } 2483 }
2478 } 2484 }
2479 } 2485 }
2480 countTogo -= n; 2486 countTogo -= n;
2481 countGone += n; 2487 countGone += n;
2482 } 2488 }
2483 data.year += rFreq; 2489 data.year += rFreq;
2484 } 2490 }
2485 } else { 2491 } else {
2486 // The number of recurrences is the same every year, 2492 // The number of recurrences is the same every year,
2487 // so skip the year-by-year check. 2493 // so skip the year-by-year check.
2488 // Skip the remaining whole years, but leave at least 2494 // Skip the remaining whole years, but leave at least
2489 // 1 recurrence remaining, in order to get its date. 2495 // 1 recurrence remaining, in order to get its date.
2490 int wholeYears = (countTogo - 1) / data.count; 2496 int wholeYears = (countTogo - 1) / data.count;
2491 data.year += wholeYears * rFreq; 2497 data.year += wholeYears * rFreq;
2492 countGone += wholeYears * data.count; 2498 countGone += wholeYears * data.count;
2493 countTogo -= wholeYears * data.count; 2499 countTogo -= wholeYears * data.count;
2494 2500
2495 // Check the last year in the recurrence. 2501 // Check the last year in the recurrence.
2496 for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) { 2502 for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
2497 if (static_cast<uint>(data.daysPerMonth) >= countTogo) { 2503 if (static_cast<uint>(data.daysPerMonth) >= countTogo) {
2498 // Check the last month in the recurrence 2504 // Check the last month in the recurrence
2499 data.month = *im.current(); 2505 data.month = *im.current();
2500 days = data.dayList(); 2506 days = data.dayList();
2501 for (id = days->begin(); id != days->end(); ++id) { 2507 for (id = days->begin(); id != days->end(); ++id) {
2502 ++countGone; 2508 ++countGone;
2503 if (--countTogo == 0) { 2509 if (--countTogo == 0) {
2504 data.day = *id; 2510 data.day = *id;
2505 goto ex; 2511 goto ex;
2506 } 2512 }
2507 } 2513 }
2508 } 2514 }
2509 countTogo -= data.daysPerMonth; 2515 countTogo -= data.daysPerMonth;
2510 countGone += data.daysPerMonth; 2516 countGone += data.daysPerMonth;
2511 } 2517 }
2512 data.year += rFreq; 2518 data.year += rFreq;
2513 } 2519 }
2514ex: 2520ex:
2515 enddate = data.date(); 2521 enddate = data.date();
2516 return countGone; 2522 return countGone;
2517} 2523}
2518 2524
2519int Recurrence::yearlyPosCalcToDate(const QDate &enddate, YearlyPosData &data) const 2525int Recurrence::yearlyPosCalcToDate(const QDate &enddate, YearlyPosData &data) const
2520{ 2526{
2521 int countGone = 0; 2527 int countGone = 0;
2522 int countMax = (rDuration > 0) ? rDuration + mRecurExDatesCount : INT_MAX; 2528 int countMax = (rDuration > 0) ? rDuration + mRecurExDatesCount : INT_MAX;
2523 int endYear = enddate.year(); 2529 int endYear = enddate.year();
2524 int endMonth = enddate.month(); 2530 int endMonth = enddate.month();
2525 int endDay = enddate.day(); 2531 int endDay = enddate.day();
2526 if (endDay < data.day && --endMonth == 0) { 2532 if (endDay < data.day && --endMonth == 0) {
2527 endMonth = 12; 2533 endMonth = 12;
2528 --endYear; 2534 --endYear;
2529 } 2535 }
2530 int endYearMonth = endYear*12 + endMonth; 2536 int endYearMonth = endYear*12 + endMonth;
2531 QValueList<int>::ConstIterator id; 2537 QValueList<int>::ConstIterator id;
2532 const QValueList<int>* days; 2538 const QValueList<int>* days;
2533 2539
2534 if (data.month > 1 || data.day > 1) { 2540 if (data.month > 1 || data.day > 1) {
2535 // Check what remains of the start year 2541 // Check what remains of the start year
2536 for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) { 2542 for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
2537 if (*im.current() >= data.month) { 2543 if (*im.current() >= data.month) {
2538 data.month = *im.current(); 2544 data.month = *im.current();
2539 if (data.yearMonth() > endYearMonth) 2545 if (data.yearMonth() > endYearMonth)
2540 return countGone; 2546 return countGone;
2541 // Check what remains of the start month 2547 // Check what remains of the start month
2542 bool lastMonth = (data.yearMonth() == endYearMonth); 2548 bool lastMonth = (data.yearMonth() == endYearMonth);
2543 if (lastMonth || data.day > 1 || data.varies) { 2549 if (lastMonth || data.day > 1 || data.varies) {
2544 days = data.dayList(); 2550 days = data.dayList();
2545 if (lastMonth || data.day > 1) { 2551 if (lastMonth || data.day > 1) {
2546 for (id = days->begin(); id != days->end(); ++id) { 2552 for (id = days->begin(); id != days->end(); ++id) {
2547 if (*id >= data.day) { 2553 if (*id >= data.day) {
2548 if (lastMonth && *id > endDay) 2554 if (lastMonth && *id > endDay)
2549 return countGone; 2555 return countGone;
2550 if (++countGone >= countMax) 2556 if (++countGone >= countMax)
2551 return countMax; 2557 return countMax;
2552 } 2558 }
2553 } 2559 }
2554 } else { 2560 } else {
2555 countGone += days->count(); 2561 countGone += days->count();
2556 if (countGone >= countMax) 2562 if (countGone >= countMax)
2557 return countMax; 2563 return countMax;
2558 } 2564 }
2559 data.day = 1; 2565 data.day = 1;
2560 } else { 2566 } else {
2561 // The number of days per month is constant, so skip 2567 // The number of days per month is constant, so skip
2562 // the whole month. 2568 // the whole month.
2563 countGone += data.daysPerMonth; 2569 countGone += data.daysPerMonth;
2564 if (countGone >= countMax) 2570 if (countGone >= countMax)
2565 return countMax; 2571 return countMax;
2566 } 2572 }
2567 } 2573 }
2568 } 2574 }
2569 data.month = 1; 2575 data.month = 1;
2570 data.year += rFreq; 2576 data.year += rFreq;
2571 } 2577 }
2572 2578
2573 if (data.varies) { 2579 if (data.varies) {
2574 // The number of recurrences varies from year to year. 2580 // The number of recurrences varies from year to year.
2575 for ( ; ; ) { 2581 for ( ; ; ) {
2576 for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) { 2582 for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
2577 data.month = *im.current(); 2583 data.month = *im.current();
2578 days = data.dayList(); 2584 days = data.dayList();
2579 if (data.yearMonth() >= endYearMonth) { 2585 if (data.yearMonth() >= endYearMonth) {
2580 if (data.yearMonth() > endYearMonth) 2586 if (data.yearMonth() > endYearMonth)
2581 return countGone; 2587 return countGone;
2582 // Check the last month in the recurrence 2588 // Check the last month in the recurrence
2583 for (id = days->begin(); id != days->end(); ++id) { 2589 for (id = days->begin(); id != days->end(); ++id) {
2584 if (*id > endDay) 2590 if (*id > endDay)
2585 return countGone; 2591 return countGone;
2586 if (++countGone >= countMax) 2592 if (++countGone >= countMax)
2587 return countMax; 2593 return countMax;
2588 } 2594 }
2589 } else { 2595 } else {
2590 countGone += days->count(); 2596 countGone += days->count();
2591 if (countGone >= countMax) 2597 if (countGone >= countMax)
2592 return countMax; 2598 return countMax;
2593 } 2599 }
2594 } 2600 }
2595 data.year += rFreq; 2601 data.year += rFreq;
2596 } 2602 }
2597 } else { 2603 } else {
2598 // The number of recurrences is the same every year, 2604 // The number of recurrences is the same every year,
2599 // so skip the year-by-year check. 2605 // so skip the year-by-year check.
2600 // Skip the remaining whole years, but leave at least 2606 // Skip the remaining whole years, but leave at least
2601 // 1 recurrence remaining, in order to get its date. 2607 // 1 recurrence remaining, in order to get its date.
2602 int wholeYears = endYear - data.year; 2608 int wholeYears = endYear - data.year;
2603 countGone += (wholeYears / rFreq) * data.count; 2609 countGone += (wholeYears / rFreq) * data.count;
2604 if (countGone >= countMax) 2610 if (countGone >= countMax)
2605 return countMax; 2611 return countMax;
2606 if (wholeYears % rFreq) 2612 if (wholeYears % rFreq)
2607 return countGone; // end year isn't a recurrence year 2613 return countGone; // end year isn't a recurrence year
2608 data.year = endYear; 2614 data.year = endYear;
2609 2615
2610 // Check the last year in the recurrence. 2616 // Check the last year in the recurrence.
2611 for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) { 2617 for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
2612 data.month = *im.current(); 2618 data.month = *im.current();
2613 if (data.month >= endMonth) { 2619 if (data.month >= endMonth) {
2614 if (data.month > endMonth) 2620 if (data.month > endMonth)
2615 return countGone; 2621 return countGone;
2616 // Check the last month in the recurrence 2622 // Check the last month in the recurrence
2617 days = data.dayList(); 2623 days = data.dayList();
2618 for (id = days->begin(); id != days->end(); ++id) { 2624 for (id = days->begin(); id != days->end(); ++id) {
2619 if (*id > endDay) 2625 if (*id > endDay)
2620 return countGone; 2626 return countGone;
2621 if (++countGone >= countMax) 2627 if (++countGone >= countMax)
2622 return countMax; 2628 return countMax;
2623 } 2629 }
2624 } else { 2630 } else {
2625 countGone += data.daysPerMonth; 2631 countGone += data.daysPerMonth;
2626 if (countGone >= countMax) 2632 if (countGone >= countMax)
2627 return countMax; 2633 return countMax;
2628 } 2634 }
2629 } 2635 }
2630 } 2636 }
2631 return countGone; 2637 return countGone;
2632} 2638}
2633 2639
2634int Recurrence::yearlyPosCalcNextAfter(QDate &enddate, YearlyPosData &data) const 2640int Recurrence::yearlyPosCalcNextAfter(QDate &enddate, YearlyPosData &data) const
2635{ 2641{
2636 uint countTogo = (rDuration > 0) ? rDuration + mRecurExDatesCount : UINT_MAX; 2642 uint countTogo = (rDuration > 0) ? rDuration + mRecurExDatesCount : UINT_MAX;
2637 int countGone = 0; 2643 int countGone = 0;
2638 int endYear = enddate.year(); 2644 int endYear = enddate.year();
2639 int endMonth = enddate.month(); 2645 int endMonth = enddate.month();
2640 int endDay = enddate.day(); 2646 int endDay = enddate.day();
2641 if (endDay < data.day && --endMonth == 0) { 2647 if (endDay < data.day && --endMonth == 0) {
2642 endMonth = 12; 2648 endMonth = 12;
2643 --endYear; 2649 --endYear;
2644 } 2650 }
2645 int endYearMonth = endYear*12 + endMonth; 2651 int endYearMonth = endYear*12 + endMonth;
2646 QValueList<int>::ConstIterator id; 2652 QValueList<int>::ConstIterator id;
2647 const QValueList<int>* days; 2653 const QValueList<int>* days;
2648 2654
2649 if (data.varies) { 2655 if (data.varies) {
2650 // The number of recurrences varies from year to year. 2656 // The number of recurrences varies from year to year.
2651 for ( ; ; ) { 2657 for ( ; ; ) {
2652 // Check the next year 2658 // Check the next year
2653 for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) { 2659 for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
2654 if (*im.current() >= data.month) { 2660 if (*im.current() >= data.month) {
2655 // Check the next month 2661 // Check the next month
2656 data.month = *im.current(); 2662 data.month = *im.current();
2657 int ended = data.yearMonth() - endYearMonth; 2663 int ended = data.yearMonth() - endYearMonth;
2658 days = data.dayList(); 2664 days = data.dayList();
2659 if (ended >= 0 || data.day > 1) { 2665 if (ended >= 0 || data.day > 1) {
2660 // This is the start or end month, so check each day 2666 // This is the start or end month, so check each day
2661 for (id = days->begin(); id != days->end(); ++id) { 2667 for (id = days->begin(); id != days->end(); ++id) {
2662 if (*id >= data.day) { 2668 if (*id >= data.day) {
2663 ++countGone; 2669 ++countGone;
2664 if (ended > 0 || (ended == 0 && *id > endDay)) { 2670 if (ended > 0 || (ended == 0 && *id > endDay)) {
2665 data.day = *id; 2671 data.day = *id;
2666 goto ex; 2672 goto ex;
2667 } 2673 }
2668 if (--countTogo == 0) 2674 if (--countTogo == 0)
2669 return 0; 2675 return 0;
2670 } 2676 }
2671 } 2677 }
2672 } else { 2678 } else {
2673 // Skip the whole month 2679 // Skip the whole month
2674 uint n = days->count(); 2680 uint n = days->count();
2675 if (n >= countTogo) 2681 if (n >= countTogo)
2676 return 0; 2682 return 0;
2677 countGone += n; 2683 countGone += n;
2678 } 2684 }
2679 data.day = 1; // we've checked the start month now 2685 data.day = 1; // we've checked the start month now
2680 } 2686 }
2681 } 2687 }
2682 data.month = 1; // we've checked the start year now 2688 data.month = 1; // we've checked the start year now
2683 data.year += rFreq; 2689 data.year += rFreq;
2684 } 2690 }
2685 } else { 2691 } else {
2686 // The number of recurrences is the same every year. 2692 // The number of recurrences is the same every year.
2687 if (data.month > 1 || data.day > 1) { 2693 if (data.month > 1 || data.day > 1) {
2688 // Check what remains of the start year 2694 // Check what remains of the start year
2689 for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) { 2695 for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
2690 if (*im.current() >= data.month) { 2696 if (*im.current() >= data.month) {
2691 // Check what remains of the start month 2697 // Check what remains of the start month
2692 data.month = *im.current(); 2698 data.month = *im.current();
2693 int ended = data.yearMonth() - endYearMonth; 2699 int ended = data.yearMonth() - endYearMonth;
2694 if (ended >= 0 || data.day > 1) { 2700 if (ended >= 0 || data.day > 1) {
2695 // This is the start or end month, so check each day 2701 // This is the start or end month, so check each day
2696 days = data.dayList(); 2702 days = data.dayList();
2697 for (id = days->begin(); id != days->end(); ++id) { 2703 for (id = days->begin(); id != days->end(); ++id) {
2698 if (*id >= data.day) { 2704 if (*id >= data.day) {
2699 ++countGone; 2705 ++countGone;
2700 if (ended > 0 || (ended == 0 && *id > endDay)) { 2706 if (ended > 0 || (ended == 0 && *id > endDay)) {
2701 data.day = *id; 2707 data.day = *id;
2702 goto ex; 2708 goto ex;
2703 } 2709 }
2704 if (--countTogo == 0) 2710 if (--countTogo == 0)
2705 return 0; 2711 return 0;
2706 } 2712 }
2707 } 2713 }
2708 data.day = 1; // we've checked the start month now 2714 data.day = 1; // we've checked the start month now
2709 } else { 2715 } else {
2710 // Skip the whole month. 2716 // Skip the whole month.
2711 if (static_cast<uint>(data.daysPerMonth) >= countTogo) 2717 if (static_cast<uint>(data.daysPerMonth) >= countTogo)
2712 return 0; 2718 return 0;
2713 countGone += data.daysPerMonth; 2719 countGone += data.daysPerMonth;
2714 } 2720 }
2715 } 2721 }
2716 } 2722 }
2717 data.year += rFreq; 2723 data.year += rFreq;
2718 } 2724 }
2719 // Skip the remaining whole years to at least endYear. 2725 // Skip the remaining whole years to at least endYear.
2720 int recurYears = (endYear - data.year + rFreq - 1) / rFreq; 2726 int recurYears = (endYear - data.year + rFreq - 1) / rFreq;
2721 if ((endYear - data.year)%rFreq == 0 2727 if ((endYear - data.year)%rFreq == 0
2722 && *rYearNums.getLast() <= endMonth) 2728 && *rYearNums.getLast() <= endMonth)
2723 ++recurYears; // required year is after endYear 2729 ++recurYears; // required year is after endYear
2724 if (recurYears) { 2730 if (recurYears) {
2725 int n = recurYears * data.count; 2731 int n = recurYears * data.count;
2726 if (static_cast<uint>(n) > countTogo) 2732 if (static_cast<uint>(n) > countTogo)
2727 return 0; // reached end of recurrence 2733 return 0; // reached end of recurrence
2728 countTogo -= n; 2734 countTogo -= n;
2729 countGone += n; 2735 countGone += n;
2730 data.year += recurYears * rFreq; 2736 data.year += recurYears * rFreq;
2731 } 2737 }
2732 2738
2733 // Check the last year in the recurrence 2739 // Check the last year in the recurrence
2734 for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) { 2740 for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
2735 data.month = *im.current(); 2741 data.month = *im.current();
2736 int ended = data.yearMonth() - endYearMonth; 2742 int ended = data.yearMonth() - endYearMonth;
2737 if (ended >= 0) { 2743 if (ended >= 0) {
2738 // This is the end month, so check each day 2744 // This is the end month, so check each day
2739 days = data.dayList(); 2745 days = data.dayList();
2740 for (id = days->begin(); id != days->end(); ++id) { 2746 for (id = days->begin(); id != days->end(); ++id) {
2741 ++countGone; 2747 ++countGone;
2742 if (ended > 0 || (ended == 0 && *id > endDay)) { 2748 if (ended > 0 || (ended == 0 && *id > endDay)) {
2743 data.day = *id; 2749 data.day = *id;
2744 goto ex; 2750 goto ex;
2745 } 2751 }
2746 if (--countTogo == 0) 2752 if (--countTogo == 0)
2747 return 0; 2753 return 0;
2748 } 2754 }
2749 } else { 2755 } else {
2750 // Skip the whole month. 2756 // Skip the whole month.
2751 if (static_cast<uint>(data.daysPerMonth) >= countTogo) 2757 if (static_cast<uint>(data.daysPerMonth) >= countTogo)
2752 return 0; 2758 return 0;
2753 countGone += data.daysPerMonth; 2759 countGone += data.daysPerMonth;
2754 } 2760 }
2755 } 2761 }
2756 } 2762 }
2757ex: 2763ex:
2758 enddate = data.date(); 2764 enddate = data.date();
2759 return countGone; 2765 return countGone;
2760} 2766}
2761 2767
2762 2768
2763/* Find count and, depending on 'func', the end date of an annual recurrence by day. 2769/* Find count and, depending on 'func', the end date of an annual recurrence by day.
2764 * Reply = total number of occurrences up to 'enddate', or 0 if error. 2770 * Reply = total number of occurrences up to 'enddate', or 0 if error.
2765 * If 'func' = END_DATE_AND_COUNT or NEXT_AFTER_DATE, 'enddate' is updated to the 2771 * If 'func' = END_DATE_AND_COUNT or NEXT_AFTER_DATE, 'enddate' is updated to the
2766 * recurrence end date. 2772 * recurrence end date.
2767 */ 2773 */
2768struct Recurrence::YearlyDayData { 2774struct Recurrence::YearlyDayData {
2769 int year; // current year 2775 int year; // current year
2770 int day; // current day of year 1..366 2776 int day; // current day of year 1..366
2771 bool varies; // true if day 366 recurs 2777 bool varies; // true if day 366 recurs
2772 private: 2778 private:
2773 int daycount; 2779 int daycount;
2774 public: 2780 public:
2775 YearlyDayData(const Recurrence* r, const QDate &date) 2781 YearlyDayData(const Recurrence* r, const QDate &date)
2776 : year(date.year()), day(date.dayOfYear()), varies(*r->rYearNums.getLast() == 366), 2782 : year(date.year()), day(date.dayOfYear()), varies(*r->rYearNums.getLast() == 366),
2777 daycount(r->rYearNums.count()) { } 2783 daycount(r->rYearNums.count()) { }
2778 bool leapYear() const { return QDate::leapYear(year); } 2784 bool leapYear() const { return QDate::leapYear(year); }
2779 int dayCount() const { return daycount - (varies && !QDate::leapYear(year) ? 1 : 0); } 2785 int dayCount() const { return daycount - (varies && !QDate::leapYear(year) ? 1 : 0); }
2780 bool isMaxDayCount() const { return !varies || QDate::leapYear(year); } 2786 bool isMaxDayCount() const { return !varies || QDate::leapYear(year); }
2781 QDate date() const { return QDate(year, 1, 1).addDays(day - 1); } 2787 QDate date() const { return QDate(year, 1, 1).addDays(day - 1); }
2782}; 2788};
2783 2789
2784int Recurrence::yearlyDayCalc(PeriodFunc func, QDate &enddate) const 2790int Recurrence::yearlyDayCalc(PeriodFunc func, QDate &enddate) const
2785{ 2791{
2786 if (rYearNums.isEmpty()) 2792 if (rYearNums.isEmpty())
2787 return 0; 2793 return 0;
2788 YearlyDayData data(this, mRecurStart.date()); 2794 YearlyDayData data(this, mRecurStart.date());
2789 switch (func) { 2795 switch (func) {
2790 case END_DATE_AND_COUNT: 2796 case END_DATE_AND_COUNT:
2791 return yearlyDayCalcEndDate(enddate, data); 2797 return yearlyDayCalcEndDate(enddate, data);
2792 case COUNT_TO_DATE: 2798 case COUNT_TO_DATE:
2793 return yearlyDayCalcToDate(enddate, data); 2799 return yearlyDayCalcToDate(enddate, data);
2794 case NEXT_AFTER_DATE: 2800 case NEXT_AFTER_DATE:
2795 return yearlyDayCalcNextAfter(enddate, data); 2801 return yearlyDayCalcNextAfter(enddate, data);
2796 } 2802 }
2797 return 0; 2803 return 0;
2798} 2804}
2799 2805
2800int Recurrence::yearlyDayCalcEndDate(QDate &enddate, YearlyDayData &data) const 2806int Recurrence::yearlyDayCalcEndDate(QDate &enddate, YearlyDayData &data) const
2801{ 2807{
2802 uint countTogo = rDuration + mRecurExDatesCount; 2808 uint countTogo = rDuration + mRecurExDatesCount;
2803 int countGone = 0; 2809 int countGone = 0;
2804 2810
2805 if (data.day > 1) { 2811 if (data.day > 1) {
2806 // Check what remains of the start year 2812 // Check what remains of the start year
2807 bool leapOK = data.isMaxDayCount(); 2813 bool leapOK = data.isMaxDayCount();
2808 for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) { 2814 for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) {
2809 int d = *it.current(); 2815 int d = *it.current();
2810 if (d >= data.day && (leapOK || d < 366)) { 2816 if (d >= data.day && (leapOK || d < 366)) {
2811 ++countGone; 2817 ++countGone;
2812 if (--countTogo == 0) { 2818 if (--countTogo == 0) {
2813 data.day = d; 2819 data.day = d;
2814 goto ex; 2820 goto ex;
2815 } 2821 }
2816 } 2822 }
2817 } 2823 }
2818 data.day = 1; 2824 data.day = 1;
2819 data.year += rFreq; 2825 data.year += rFreq;
2820 } 2826 }
2821 2827
2822 if (data.varies) { 2828 if (data.varies) {
2823 // The number of recurrences is different in leap years, 2829 // The number of recurrences is different in leap years,
2824 // so check year-by-year. 2830 // so check year-by-year.
2825 for ( ; ; ) { 2831 for ( ; ; ) {
2826 uint n = data.dayCount(); 2832 uint n = data.dayCount();
2827 if (n >= countTogo) 2833 if (n >= countTogo)
2828 break; 2834 break;
2829 countTogo -= n; 2835 countTogo -= n;
2830 countGone += n; 2836 countGone += n;
2831 data.year += rFreq; 2837 data.year += rFreq;
2832 } 2838 }
2833 } else { 2839 } else {
2834 // The number of recurrences is the same every year, 2840 // The number of recurrences is the same every year,
2835 // so skip the year-by-year check. 2841 // so skip the year-by-year check.
2836 // Skip the remaining whole years, but leave at least 2842 // Skip the remaining whole years, but leave at least
2837 // 1 recurrence remaining, in order to get its date. 2843 // 1 recurrence remaining, in order to get its date.
2838 int daysPerYear = rYearNums.count(); 2844 int daysPerYear = rYearNums.count();
2839 int wholeYears = (countTogo - 1) / daysPerYear; 2845 int wholeYears = (countTogo - 1) / daysPerYear;
2840 data.year += wholeYears * rFreq; 2846 data.year += wholeYears * rFreq;
2841 countGone += wholeYears * daysPerYear; 2847 countGone += wholeYears * daysPerYear;
2842 countTogo -= wholeYears * daysPerYear; 2848 countTogo -= wholeYears * daysPerYear;
2843 } 2849 }
2844 if (countTogo) { 2850 if (countTogo) {
2845 // Check the last year in the recurrence 2851 // Check the last year in the recurrence
2846 for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) { 2852 for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) {
2847 ++countGone; 2853 ++countGone;
2848 if (--countTogo == 0) { 2854 if (--countTogo == 0) {
2849 data.day = *it.current(); 2855 data.day = *it.current();
2850 break; 2856 break;
2851 } 2857 }
2852 } 2858 }
2853 } 2859 }
2854ex: 2860ex:
2855 enddate = data.date(); 2861 enddate = data.date();
2856 return countGone; 2862 return countGone;
2857} 2863}
2858 2864
2859int Recurrence::yearlyDayCalcToDate(const QDate &enddate, YearlyDayData &data) const 2865int Recurrence::yearlyDayCalcToDate(const QDate &enddate, YearlyDayData &data) const
2860{ 2866{
2861 int countGone = 0; 2867 int countGone = 0;
2862 int countMax = (rDuration > 0) ? rDuration + mRecurExDatesCount : INT_MAX; 2868 int countMax = (rDuration > 0) ? rDuration + mRecurExDatesCount : INT_MAX;
2863 int endYear = enddate.year(); 2869 int endYear = enddate.year();
2864 int endDay = enddate.dayOfYear(); 2870 int endDay = enddate.dayOfYear();
2865 2871
2866 if (data.day > 1) { 2872 if (data.day > 1) {
2867 // Check what remains of the start year 2873 // Check what remains of the start year
2868 bool leapOK = data.isMaxDayCount(); 2874 bool leapOK = data.isMaxDayCount();
2869 for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) { 2875 for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) {
2870 int d = *it.current(); 2876 int d = *it.current();
2871 if (d >= data.day && (leapOK || d < 366)) { 2877 if (d >= data.day && (leapOK || d < 366)) {
2872 if (data.year == endYear && d > endDay) 2878 if (data.year == endYear && d > endDay)
2873 return countGone; 2879 return countGone;
2874 if (++countGone >= countMax) 2880 if (++countGone >= countMax)
2875 return countMax; 2881 return countMax;
2876 } 2882 }
2877 } 2883 }
2878 data.day = 1; 2884 data.day = 1;
2879 data.year += rFreq; 2885 data.year += rFreq;
2880 } 2886 }
2881 2887
2882 if (data.varies) { 2888 if (data.varies) {
2883 // The number of recurrences is different in leap years, 2889 // The number of recurrences is different in leap years,
2884 // so check year-by-year. 2890 // so check year-by-year.
2885 while (data.year < endYear) { 2891 while (data.year < endYear) {
2886 uint n = data.dayCount(); 2892 uint n = data.dayCount();
2887 countGone += n; 2893 countGone += n;
2888 if (countGone >= countMax) 2894 if (countGone >= countMax)
2889 return countMax; 2895 return countMax;
2890 data.year += rFreq; 2896 data.year += rFreq;
2891 } 2897 }
2892 if (data.year > endYear) 2898 if (data.year > endYear)
2893 return countGone; 2899 return countGone;
2894 } else { 2900 } else {
2895 // The number of recurrences is the same every year. 2901 // The number of recurrences is the same every year.
2896 // Skip the remaining whole years. 2902 // Skip the remaining whole years.
2897 int wholeYears = endYear - data.year; 2903 int wholeYears = endYear - data.year;
2898 countGone += (wholeYears / rFreq) * rYearNums.count(); 2904 countGone += (wholeYears / rFreq) * rYearNums.count();
2899 if (countGone >= countMax) 2905 if (countGone >= countMax)
2900 return countMax; 2906 return countMax;
2901 if (wholeYears % rFreq) 2907 if (wholeYears % rFreq)
2902 return countGone; // end year isn't a recurrence year 2908 return countGone; // end year isn't a recurrence year
2903 data.year = endYear; 2909 data.year = endYear;
2904 } 2910 }
2905 2911
2906 if (data.year <= endYear) { 2912 if (data.year <= endYear) {
2907 // Check the last year in the recurrence 2913 // Check the last year in the recurrence
2908 for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) { 2914 for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) {
2909 if (*it.current() > endDay) 2915 if (*it.current() > endDay)
2910 return countGone; 2916 return countGone;
2911 if (++countGone >= countMax) 2917 if (++countGone >= countMax)
2912 return countMax; 2918 return countMax;
2913 } 2919 }
2914 } 2920 }
2915 return countGone; 2921 return countGone;
2916} 2922}
2917 2923
2918int Recurrence::yearlyDayCalcNextAfter(QDate &enddate, YearlyDayData &data) const 2924int Recurrence::yearlyDayCalcNextAfter(QDate &enddate, YearlyDayData &data) const
2919{ 2925{
2920 uint countTogo = (rDuration > 0) ? rDuration + mRecurExDatesCount : UINT_MAX; 2926 uint countTogo = (rDuration > 0) ? rDuration + mRecurExDatesCount : UINT_MAX;
2921 int countGone = 0; 2927 int countGone = 0;
2922 int endYear = enddate.year(); 2928 int endYear = enddate.year();
2923 int endDay = enddate.dayOfYear(); 2929 int endDay = enddate.dayOfYear();
2924 2930
2925 if (data.day > 1) { 2931 if (data.day > 1) {
2926 // Check what remains of the start year 2932 // Check what remains of the start year
2927 bool leapOK = data.isMaxDayCount(); 2933 bool leapOK = data.isMaxDayCount();
2928 for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) { 2934 for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) {
2929 int d = *it.current(); 2935 int d = *it.current();
2930 if (d >= data.day && (leapOK || d < 366)) { 2936 if (d >= data.day && (leapOK || d < 366)) {
2931 ++countGone; 2937 ++countGone;
2932 if (data.year == endYear && d > endDay) { 2938 if (data.year == endYear && d > endDay) {
2933 data.day = d; 2939 data.day = d;
2934 goto ex; 2940 goto ex;
2935 } 2941 }
2936 if (--countTogo == 0) 2942 if (--countTogo == 0)
2937 return 0; 2943 return 0;
2938 } 2944 }
2939 } 2945 }
2940 data.day = 1; 2946 data.day = 1;
2941 data.year += rFreq; 2947 data.year += rFreq;
2942 } 2948 }
2943 2949
2944 if (data.varies) { 2950 if (data.varies) {
2945 // The number of recurrences is different in leap years, 2951 // The number of recurrences is different in leap years,
2946 // so check year-by-year. 2952 // so check year-by-year.
2947 while (data.year <= endYear) { 2953 while (data.year <= endYear) {
2948 uint n = data.dayCount(); 2954 uint n = data.dayCount();
2949 if (data.year == endYear && *rYearNums.getLast() > endDay) 2955 if (data.year == endYear && *rYearNums.getLast() > endDay)
2950 break; 2956 break;
2951 if (n >= countTogo) 2957 if (n >= countTogo)
2952 break; 2958 break;
2953 countTogo -= n; 2959 countTogo -= n;
2954 countGone += n; 2960 countGone += n;
2955 data.year += rFreq; 2961 data.year += rFreq;
2956 } 2962 }
2957 } else { 2963 } else {
2958 // The number of recurrences is the same every year, 2964 // The number of recurrences is the same every year,
2959 // so skip the year-by-year check. 2965 // so skip the year-by-year check.
2960 // Skip the remaining whole years to at least endYear. 2966 // Skip the remaining whole years to at least endYear.
2961 int daysPerYear = rYearNums.count(); 2967 int daysPerYear = rYearNums.count();
2962 int recurYears = (endYear - data.year + rFreq - 1) / rFreq; 2968 int recurYears = (endYear - data.year + rFreq - 1) / rFreq;
2963 if ((endYear - data.year)%rFreq == 0 2969 if ((endYear - data.year)%rFreq == 0
2964 && *rYearNums.getLast() <= endDay) 2970 && *rYearNums.getLast() <= endDay)
2965 ++recurYears; // required year is after endYear 2971 ++recurYears; // required year is after endYear
2966 if (recurYears) { 2972 if (recurYears) {
2967 int n = recurYears * daysPerYear; 2973 int n = recurYears * daysPerYear;
2968 if (static_cast<uint>(n) > countTogo) 2974 if (static_cast<uint>(n) > countTogo)
2969 return 0; // reached end of recurrence 2975 return 0; // reached end of recurrence
2970 countTogo -= n; 2976 countTogo -= n;
2971 countGone += n; 2977 countGone += n;
2972 data.year += recurYears * rFreq; 2978 data.year += recurYears * rFreq;
2973 } 2979 }
2974 } 2980 }
2975 2981
2976 // Check the last year in the recurrence 2982 // Check the last year in the recurrence
2977 for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) { 2983 for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) {
2978 ++countGone; 2984 ++countGone;
2979 int d = *it.current(); 2985 int d = *it.current();
2980 if (data.year > endYear || d > endDay) { 2986 if (data.year > endYear || d > endDay) {
2981 data.day = d; 2987 data.day = d;
2982 break; 2988 break;
2983 } 2989 }
2984 if (--countTogo == 0) 2990 if (--countTogo == 0)
2985 return 0; 2991 return 0;
2986 } 2992 }
2987ex: 2993ex:
2988 enddate = data.date(); 2994 enddate = data.date();
2989 return countGone; 2995 return countGone;
2990} 2996}
2991 2997
2992// Get the days in this month which recur, in numerical order. 2998// Get the days in this month which recur, in numerical order.
2993// Parameters: daysInMonth = number of days in this month 2999// Parameters: daysInMonth = number of days in this month
2994// startDayOfWeek = day of week for first day of month. 3000// startDayOfWeek = day of week for first day of month.
2995void Recurrence::getMonthlyPosDays(QValueList<int> &list, int daysInMonth, int startDayOfWeek) const 3001void Recurrence::getMonthlyPosDays(QValueList<int> &list, int daysInMonth, int startDayOfWeek) const
2996{ 3002{
2997 list.clear(); 3003 list.clear();
2998 int endDayOfWeek = (startDayOfWeek + daysInMonth - 2) % 7 + 1; 3004 int endDayOfWeek = (startDayOfWeek + daysInMonth - 2) % 7 + 1;
2999 // Go through the list, compiling a bit list of actual day numbers 3005 // Go through the list, compiling a bit list of actual day numbers
3000 Q_UINT32 days = 0; 3006 Q_UINT32 days = 0;
3001 for (QPtrListIterator<rMonthPos> pos(rMonthPositions); pos.current(); ++pos) { 3007 for (QPtrListIterator<rMonthPos> pos(rMonthPositions); pos.current(); ++pos) {
3002 int weeknum = pos.current()->rPos - 1; // get 0-based week number 3008 int weeknum = pos.current()->rPos - 1; // get 0-based week number
3003 QBitArray &rdays = pos.current()->rDays; 3009 QBitArray &rdays = pos.current()->rDays;
3004 if (pos.current()->negative) { 3010 if (pos.current()->negative) {
3005 // nth days before the end of the month 3011 // nth days before the end of the month
3006 for (uint i = 1; i <= 7; ++i) { 3012 for (uint i = 1; i <= 7; ++i) {
3007 if (rdays.testBit(i - 1)) { 3013 if (rdays.testBit(i - 1)) {
3008 int day = daysInMonth - weeknum*7 - (endDayOfWeek - i + 7) % 7; 3014 int day = daysInMonth - weeknum*7 - (endDayOfWeek - i + 7) % 7;
3009 if (day > 0) 3015 if (day > 0)
3010 days |= 1 << (day - 1); 3016 days |= 1 << (day - 1);
3011 } 3017 }
3012 } 3018 }
3013 } else { 3019 } else {
3014 // nth days after the start of the month 3020 // nth days after the start of the month
3015 for (uint i = 1; i <= 7; ++i) { 3021 for (uint i = 1; i <= 7; ++i) {
3016 if (rdays.testBit(i - 1)) { 3022 if (rdays.testBit(i - 1)) {
3017 int day = 1 + weeknum*7 + (i - startDayOfWeek + 7) % 7; 3023 int day = 1 + weeknum*7 + (i - startDayOfWeek + 7) % 7;
3018 if (day <= daysInMonth) 3024 if (day <= daysInMonth)
3019 days |= 1 << (day - 1); 3025 days |= 1 << (day - 1);
3020 } 3026 }
3021 } 3027 }
3022 } 3028 }
3023 } 3029 }
3024 // Compile the ordered list 3030 // Compile the ordered list
3025 Q_UINT32 mask = 1; 3031 Q_UINT32 mask = 1;
3026 for (int i = 0; i < daysInMonth; mask <<= 1, ++i) { 3032 for (int i = 0; i < daysInMonth; mask <<= 1, ++i) {
3027 if (days & mask) 3033 if (days & mask)
3028 list.append(i + 1); 3034 list.append(i + 1);
3029 } 3035 }
3030} 3036}
3031 3037
3032// Get the number of days in the month which recur. 3038// Get the number of days in the month which recur.
3033// Reply = -1 if the number varies from month to month. 3039// Reply = -1 if the number varies from month to month.
3034int Recurrence::countMonthlyPosDays() const 3040int Recurrence::countMonthlyPosDays() const
3035{ 3041{
3036 int count = 0; 3042 int count = 0;
3037 Q_UINT8 positive[5] = { 0, 0, 0, 0, 0 }; 3043 Q_UINT8 positive[5] = { 0, 0, 0, 0, 0 };
3038 Q_UINT8 negative[4] = { 0, 0, 0, 0 }; 3044 Q_UINT8 negative[4] = { 0, 0, 0, 0 };
3039 for (QPtrListIterator<rMonthPos> pos(rMonthPositions); pos.current(); ++pos) { 3045 for (QPtrListIterator<rMonthPos> pos(rMonthPositions); pos.current(); ++pos) {
3040 int weeknum = pos.current()->rPos; 3046 int weeknum = pos.current()->rPos;
3041 Q_UINT8* wk; 3047 Q_UINT8* wk;
3042 if (pos.current()->negative) { 3048 if (pos.current()->negative) {
3043 // nth days before the end of the month 3049 // nth days before the end of the month
3044 if (weeknum > 4) 3050 if (weeknum > 4)
3045 return -1; // days in 5th week are often missing 3051 return -1; // days in 5th week are often missing
3046 wk = &negative[4 - weeknum]; 3052 wk = &negative[4 - weeknum];
3047 } else { 3053 } else {
3048 // nth days after the start of the month 3054 // nth days after the start of the month
3049 if (weeknum > 4) 3055 if (weeknum > 4)
3050 return -1; // days in 5th week are often missing 3056 return -1; // days in 5th week are often missing
3051 wk = &positive[weeknum - 1]; 3057 wk = &positive[weeknum - 1];
3052 } 3058 }
3053 QBitArray &rdays = pos.current()->rDays; 3059 QBitArray &rdays = pos.current()->rDays;
3054 for (uint i = 0; i < 7; ++i) { 3060 for (uint i = 0; i < 7; ++i) {
3055 if (rdays.testBit(i)) { 3061 if (rdays.testBit(i)) {
3056 ++count; 3062 ++count;
3057 *wk |= (1 << i); 3063 *wk |= (1 << i);
3058 } 3064 }
3059 } 3065 }
3060 } 3066 }
3061 // Check for any possible days which could be duplicated by 3067 // Check for any possible days which could be duplicated by
3062 // a positive and a negative position. 3068 // a positive and a negative position.
3063 for (int i = 0; i < 4; ++i) { 3069 for (int i = 0; i < 4; ++i) {
3064 if (negative[i] & (positive[i] | positive[i+1])) 3070 if (negative[i] & (positive[i] | positive[i+1]))
3065 return -1; 3071 return -1;
3066 } 3072 }
3067 return count; 3073 return count;
3068} 3074}
3069 3075
3070// Get the days in this month which recur, in numerical order. 3076// Get the days in this month which recur, in numerical order.
3071// Reply = true if day numbers varies from month to month. 3077// Reply = true if day numbers varies from month to month.
3072bool Recurrence::getMonthlyDayDays(QValueList<int> &list, int daysInMonth) const 3078bool Recurrence::getMonthlyDayDays(QValueList<int> &list, int daysInMonth) const
3073{ 3079{
3074 list.clear(); 3080 list.clear();
3075 bool variable = false; 3081 bool variable = false;
3076 Q_UINT32 days = 0; 3082 Q_UINT32 days = 0;
3077 for (QPtrListIterator<int> it(rMonthDays); it.current(); ++it) { 3083 for (QPtrListIterator<int> it(rMonthDays); it.current(); ++it) {
3078 int day = *it.current(); 3084 int day = *it.current();
3079 if (day > 0) { 3085 if (day > 0) {
3080 // date in the month 3086 // date in the month
3081 if (day <= daysInMonth) 3087 if (day <= daysInMonth)
3082 days |= 1 << (day - 1); 3088 days |= 1 << (day - 1);
3083 if (day > 28 && day <= 31) 3089 if (day > 28 && day <= 31)
3084 variable = true; // this date does not appear in some months 3090 variable = true; // this date does not appear in some months
3085 } else if (day < 0) { 3091 } else if (day < 0) {
3086 // days before the end of the month 3092 // days before the end of the month
3087 variable = true; // this date varies depending on the month length 3093 variable = true; // this date varies depending on the month length
3088 day = daysInMonth + day; // zero-based day of month 3094 day = daysInMonth + day; // zero-based day of month
3089 if (day >= 0) 3095 if (day >= 0)
3090 days |= 1 << day; 3096 days |= 1 << day;
3091 } 3097 }
3092 } 3098 }
3093 // Compile the ordered list 3099 // Compile the ordered list
3094 Q_UINT32 mask = 1; 3100 Q_UINT32 mask = 1;
3095 for (int i = 0; i < daysInMonth; mask <<= 1, ++i) { 3101 for (int i = 0; i < daysInMonth; mask <<= 1, ++i) {
3096 if (days & mask) 3102 if (days & mask)
3097 list.append(i + 1); 3103 list.append(i + 1);
3098 } 3104 }
3099 return variable; 3105 return variable;
3100} 3106}
3101 3107
3102// Get the months which recur, in numerical order, for both leap years and non-leap years. 3108// Get the months which recur, in numerical order, for both leap years and non-leap years.
3103// N.B. If February 29th recurs on March 1st in non-leap years, February (not March) is 3109// N.B. If February 29th recurs on March 1st in non-leap years, February (not March) is
3104// included in the non-leap year month list. 3110// included in the non-leap year month list.
3105// Reply = true if February 29th also recurs. 3111// Reply = true if February 29th also recurs.
3106bool Recurrence::getYearlyMonthMonths(int day, QValueList<int> &list, QValueList<int> &leaplist) const 3112bool Recurrence::getYearlyMonthMonths(int day, QValueList<int> &list, QValueList<int> &leaplist) const
3107{ 3113{
3108 list.clear(); 3114 list.clear();
3109 leaplist.clear(); 3115 leaplist.clear();
3110 bool feb29 = false; 3116 bool feb29 = false;
3111 for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) { 3117 for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) {
3112 int month = *it.current(); 3118 int month = *it.current();
3113 if (month == 2) { 3119 if (month == 2) {
3114 if (day <= 28) { 3120 if (day <= 28) {
3115 list.append(month); // date appears in February 3121 list.append(month); // date appears in February
3116 leaplist.append(month); 3122 leaplist.append(month);
3117 } 3123 }
3118 else if (day == 29) { 3124 else if (day == 29) {
3119 // February 29th 3125 // February 29th
3120 leaplist.append(month); 3126 leaplist.append(month);
3121 switch (mFeb29YearlyType) { 3127 switch (mFeb29YearlyType) {
3122 case rFeb28: 3128 case rFeb28:
3123 case rMar1: 3129 case rMar1:
3124 list.append(2); 3130 list.append(2);
3125 break; 3131 break;
3126 case rFeb29: 3132 case rFeb29:
3127 break; 3133 break;
3128 } 3134 }
3129 feb29 = true; 3135 feb29 = true;
3130 } 3136 }
3131 } 3137 }
3132 else if (day <= 30 || QDate(2000, month, 1).daysInMonth() == 31) { 3138 else if (day <= 30 || QDate(2000, month, 1).daysInMonth() == 31) {
3133 list.append(month); // date appears in every month 3139 list.append(month); // date appears in every month
3134 leaplist.append(month); 3140 leaplist.append(month);
3135 } 3141 }
3136 } 3142 }
3137 return feb29; 3143 return feb29;
3138} 3144}
3139 3145
3140/* From the recurrence day of the week list, get the earliest day in the 3146/* From the recurrence day of the week list, get the earliest day in the
3141 * specified week which is >= the startDay. 3147 * specified week which is >= the startDay.
3142 * Parameters: startDay = 1..7 (Monday..Sunday) 3148 * Parameters: startDay = 1..7 (Monday..Sunday)
3143 * useWeekStart = true to end search at day before next rWeekStart 3149 * useWeekStart = true to end search at day before next rWeekStart
3144 * = false to search for a full 7 days 3150 * = false to search for a full 7 days
3145 * Reply = day of the week (1..7), or 0 if none found. 3151 * Reply = day of the week (1..7), or 0 if none found.
3146 */ 3152 */
3147int Recurrence::getFirstDayInWeek(int startDay, bool useWeekStart) const 3153int Recurrence::getFirstDayInWeek(int startDay, bool useWeekStart) const
3148{ 3154{
3149 int last = ((useWeekStart ? rWeekStart : startDay) + 5)%7; 3155 int last = ((useWeekStart ? rWeekStart : startDay) + 5)%7;
3150 for (int i = startDay - 1; ; i = (i + 1)%7) { 3156 for (int i = startDay - 1; ; i = (i + 1)%7) {
3151 if (rDays.testBit(i)) 3157 if (rDays.testBit(i))
3152 return i + 1; 3158 return i + 1;
3153 if (i == last) 3159 if (i == last)
3154 return 0; 3160 return 0;
3155 } 3161 }
3156} 3162}
3157 3163
3158/* From the recurrence day of the week list, get the latest day in the 3164/* From the recurrence day of the week list, get the latest day in the
3159 * specified week which is <= the endDay. 3165 * specified week which is <= the endDay.
3160 * Parameters: endDay = 1..7 (Monday..Sunday) 3166 * Parameters: endDay = 1..7 (Monday..Sunday)
3161 * useWeekStart = true to end search at rWeekStart 3167 * useWeekStart = true to end search at rWeekStart
3162 * = false to search for a full 7 days 3168 * = false to search for a full 7 days
3163 * Reply = day of the week (1..7), or 0 if none found. 3169 * Reply = day of the week (1..7), or 0 if none found.
3164 */ 3170 */
3165int Recurrence::getLastDayInWeek(int endDay, bool useWeekStart) const 3171int Recurrence::getLastDayInWeek(int endDay, bool useWeekStart) const
3166{ 3172{
3167 int last = useWeekStart ? rWeekStart - 1 : endDay%7; 3173 int last = useWeekStart ? rWeekStart - 1 : endDay%7;
3168 for (int i = endDay - 1; ; i = (i + 6)%7) { 3174 for (int i = endDay - 1; ; i = (i + 6)%7) {
3169 if (rDays.testBit(i)) 3175 if (rDays.testBit(i))
3170 return i + 1; 3176 return i + 1;
3171 if (i == last) 3177 if (i == last)
3172 return 0; 3178 return 0;
3173 } 3179 }
3174} 3180}
3175 3181
3176/* From the recurrence monthly day number list or monthly day of week/week of 3182/* From the recurrence monthly day number list or monthly day of week/week of
3177 * month list, get the earliest day in the specified month which is >= the 3183 * month list, get the earliest day in the specified month which is >= the
3178 * earliestDate. 3184 * earliestDate.
3179 */ 3185 */
3180QDate Recurrence::getFirstDateInMonth(const QDate &earliestDate) const 3186QDate Recurrence::getFirstDateInMonth(const QDate &earliestDate) const
3181{ 3187{
3182 int earliestDay = earliestDate.day(); 3188 int earliestDay = earliestDate.day();
3183 int daysInMonth = earliestDate.daysInMonth(); 3189 int daysInMonth = earliestDate.daysInMonth();
3184 switch (recurs) { 3190 switch (recurs) {
3185 case rMonthlyDay: { 3191 case rMonthlyDay: {
3186 int minday = daysInMonth + 1; 3192 int minday = daysInMonth + 1;
3187 for (QPtrListIterator<int> it(rMonthDays); it.current(); ++it) { 3193 for (QPtrListIterator<int> it(rMonthDays); it.current(); ++it) {
3188 int day = *it.current(); 3194 int day = *it.current();
3189 if (day < 0) 3195 if (day < 0)
3190 day = daysInMonth + day + 1; 3196 day = daysInMonth + day + 1;
3191 if (day >= earliestDay && day < minday) 3197 if (day >= earliestDay && day < minday)
3192 minday = day; 3198 minday = day;
3193 } 3199 }
3194 if (minday <= daysInMonth) 3200 if (minday <= daysInMonth)
3195 return earliestDate.addDays(minday - earliestDay); 3201 return earliestDate.addDays(minday - earliestDay);
3196 break; 3202 break;
3197 } 3203 }
3198 case rMonthlyPos: 3204 case rMonthlyPos:
3199 case rYearlyPos: { 3205 case rYearlyPos: {
3200 QDate monthBegin(earliestDate.addDays(1 - earliestDay)); 3206 QDate monthBegin(earliestDate.addDays(1 - earliestDay));
3201 QValueList<int> dayList; 3207 QValueList<int> dayList;
3202 getMonthlyPosDays(dayList, daysInMonth, monthBegin.dayOfWeek()); 3208 getMonthlyPosDays(dayList, daysInMonth, monthBegin.dayOfWeek());
3203 for (QValueList<int>::ConstIterator id = dayList.begin(); id != dayList.end(); ++id) { 3209 for (QValueList<int>::ConstIterator id = dayList.begin(); id != dayList.end(); ++id) {
3204 if (*id >= earliestDay) 3210 if (*id >= earliestDay)
3205 return monthBegin.addDays(*id - 1); 3211 return monthBegin.addDays(*id - 1);
3206 } 3212 }
3207 break; 3213 break;
3208 } 3214 }
3209 } 3215 }
3210 return QDate(); 3216 return QDate();
3211} 3217}
3212 3218
3213/* From the recurrence monthly day number list or monthly day of week/week of 3219/* From the recurrence monthly day number list or monthly day of week/week of
3214 * month list, get the latest day in the specified month which is <= the 3220 * month list, get the latest day in the specified month which is <= the
3215 * latestDate. 3221 * latestDate.
3216 */ 3222 */
3217QDate Recurrence::getLastDateInMonth(const QDate &latestDate) const 3223QDate Recurrence::getLastDateInMonth(const QDate &latestDate) const
3218{ 3224{
3219 int latestDay = latestDate.day(); 3225 int latestDay = latestDate.day();
3220 int daysInMonth = latestDate.daysInMonth(); 3226 int daysInMonth = latestDate.daysInMonth();
3221 switch (recurs) { 3227 switch (recurs) {
3222 case rMonthlyDay: { 3228 case rMonthlyDay: {
3223 int maxday = -1; 3229 int maxday = -1;
3224 for (QPtrListIterator<int> it(rMonthDays); it.current(); ++it) { 3230 for (QPtrListIterator<int> it(rMonthDays); it.current(); ++it) {
3225 int day = *it.current(); 3231 int day = *it.current();
3226 if (day < 0) 3232 if (day < 0)
3227 day = daysInMonth + day + 1; 3233 day = daysInMonth + day + 1;
3228 if (day <= latestDay && day > maxday) 3234 if (day <= latestDay && day > maxday)
3229 maxday = day; 3235 maxday = day;
3230 } 3236 }
3231 if (maxday > 0) 3237 if (maxday > 0)
3232 return QDate(latestDate.year(), latestDate.month(), maxday); 3238 return QDate(latestDate.year(), latestDate.month(), maxday);
3233 break; 3239 break;
3234 } 3240 }
3235 case rMonthlyPos: 3241 case rMonthlyPos:
3236 case rYearlyPos: { 3242 case rYearlyPos: {
3237 QDate monthBegin(latestDate.addDays(1 - latestDay)); 3243 QDate monthBegin(latestDate.addDays(1 - latestDay));
3238 QValueList<int> dayList; 3244 QValueList<int> dayList;
3239 getMonthlyPosDays(dayList, daysInMonth, monthBegin.dayOfWeek()); 3245 getMonthlyPosDays(dayList, daysInMonth, monthBegin.dayOfWeek());
3240 for (QValueList<int>::ConstIterator id = dayList.fromLast(); id != dayList.end(); --id) { 3246 for (QValueList<int>::ConstIterator id = dayList.fromLast(); id != dayList.end(); --id) {
3241 if (*id <= latestDay) 3247 if (*id <= latestDay)
3242 return monthBegin.addDays(*id - 1); 3248 return monthBegin.addDays(*id - 1);
3243 } 3249 }
3244 break; 3250 break;
3245 } 3251 }
3246 } 3252 }
3247 return QDate(); 3253 return QDate();
3248} 3254}
3249 3255
3250/* From the recurrence yearly month list or yearly day list, get the earliest 3256/* From the recurrence yearly month list or yearly day list, get the earliest
3251 * month or day in the specified year which is >= the earliestDate. 3257 * month or day in the specified year which is >= the earliestDate.
3252 * Note that rYearNums is sorted in numerical order. 3258 * Note that rYearNums is sorted in numerical order.
3253 */ 3259 */
3254QDate Recurrence::getFirstDateInYear(const QDate &earliestDate) const 3260QDate Recurrence::getFirstDateInYear(const QDate &earliestDate) const
3255{ 3261{
3256 QPtrListIterator<int> it(rYearNums); 3262 QPtrListIterator<int> it(rYearNums);
3257 switch (recurs) { 3263 switch (recurs) {
3258 case rYearlyMonth: { 3264 case rYearlyMonth: {
3259 int day = recurStart().date().day(); 3265 int day = recurStart().date().day();
3260 int earliestYear = earliestDate.year(); 3266 int earliestYear = earliestDate.year();
3261 int earliestMonth = earliestDate.month(); 3267 int earliestMonth = earliestDate.month();
3262 int earliestDay = earliestDate.day(); 3268 int earliestDay = earliestDate.day();
3263 if (earliestDay > day) { 3269 if (earliestDay > day) {
3264 // The earliest date is later in the month than the recurrence date, 3270 // The earliest date is later in the month than the recurrence date,
3265 // so skip to the next month before starting to check 3271 // so skip to the next month before starting to check
3266 if (++earliestMonth > 12) 3272 if (++earliestMonth > 12)
3267 return QDate(); 3273 return QDate();
3268 } 3274 }
3269 for ( ; it.current(); ++it) { 3275 for ( ; it.current(); ++it) {
3270 int month = *it.current(); 3276 int month = *it.current();
3271 if (month >= earliestMonth) { 3277 if (month >= earliestMonth) {
3272 if (day <= 28 || QDate::isValid(earliestYear, month, day)) 3278 if (day <= 28 || QDate::isValid(earliestYear, month, day))
3273 return QDate(earliestYear, month, day); 3279 return QDate(earliestYear, month, day);
3274 if (day == 29 && month == 2) { 3280 if (day == 29 && month == 2) {
3275 // It's a recurrence on February 29th, in a non-leap year 3281 // It's a recurrence on February 29th, in a non-leap year
3276 switch (mFeb29YearlyType) { 3282 switch (mFeb29YearlyType) {
3277 case rMar1: 3283 case rMar1:
3278 return QDate(earliestYear, 3, 1); 3284 return QDate(earliestYear, 3, 1);
3279 case rFeb28: 3285 case rFeb28:
3280 if (earliestDay <= 28) 3286 if (earliestDay <= 28)
3281 return QDate(earliestYear, 2, 28); 3287 return QDate(earliestYear, 2, 28);
3282 break; 3288 break;
3283 case rFeb29: 3289 case rFeb29:
3284 break; 3290 break;
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp
index 083e6d1..48257ef 100644
--- a/pwmanager/pwmanager/pwm.cpp
+++ b/pwmanager/pwmanager/pwm.cpp
@@ -1,1549 +1,1549 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * copyright (C) 2003, 2004 by Michael Buesch * 3 * copyright (C) 2003, 2004 by Michael Buesch *
4 * email: mbuesch@freenet.de * 4 * email: mbuesch@freenet.de *
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 version 2 * 7 * it under the terms of the GNU General Public License version 2 *
8 * as published by the Free Software Foundation. * 8 * as published by the Free Software Foundation. *
9 * * 9 * *
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12/*************************************************************************** 12/***************************************************************************
13 * copyright (C) 2004 by Ulf Schenk 13 * copyright (C) 2004 by Ulf Schenk
14 * This file is originaly based on version 1.0.1 of pwmanager 14 * This file is originaly based on version 1.0.1 of pwmanager
15 * and was modified to run on embedded devices that run microkde 15 * and was modified to run on embedded devices that run microkde
16 * 16 *
17 * $Id$ 17 * $Id$
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#include <klocale.h> 20#include <klocale.h>
21#include <klistview.h> 21#include <klistview.h>
22#include <ktoolbar.h> 22#include <ktoolbar.h>
23#include <kfiledialog.h> 23#include <kfiledialog.h>
24#include <kiconloader.h> 24#include <kiconloader.h>
25#include <kmessagebox.h> 25#include <kmessagebox.h>
26 26
27#include <qstatusbar.h> 27#include <qstatusbar.h>
28 28
29#ifndef PWM_EMBEDDED 29#ifndef PWM_EMBEDDED
30#include <kmenubar.h> 30#include <kmenubar.h>
31#include <kstatusbar.h> 31#include <kstatusbar.h>
32#include <dcopclient.h> 32#include <dcopclient.h>
33#include "configwndimpl.h" 33#include "configwndimpl.h"
34#include "configuration.h" 34#include "configuration.h"
35#else 35#else
36#include <qmenubar.h> 36#include <qmenubar.h>
37#include <qmessagebox.h> 37#include <qmessagebox.h>
38#include <pwmprefs.h> 38#include <pwmprefs.h>
39#include <kpimglobalprefs.h> 39#include <kpimglobalprefs.h>
40#include <kcmconfigs/kcmpwmconfig.h> 40#include <kcmconfigs/kcmpwmconfig.h>
41#include <kcmconfigs/kcmkdepimconfig.h> 41#include <kcmconfigs/kcmkdepimconfig.h>
42#include <kcmultidialog.h> 42#include <kcmultidialog.h>
43#include "editcategory.h" 43#include "editcategory.h"
44#endif 44#endif
45 45
46 46
47#ifndef DESKTOP_VERSION 47#ifndef DESKTOP_VERSION
48#include <qpe/global.h> 48#include <qpe/global.h>
49#endif 49#endif
50 50
51#include <qpixmap.h> 51#include <qpixmap.h>
52#include <qcheckbox.h> 52#include <qcheckbox.h>
53#include <qspinbox.h> 53#include <qspinbox.h>
54#include <qlineedit.h> 54#include <qlineedit.h>
55#include <qfileinfo.h> 55#include <qfileinfo.h>
56#include <qclipboard.h> 56#include <qclipboard.h>
57 57
58 58
59#include <stdio.h> 59#include <stdio.h>
60 60
61#include "pwm.h" 61#include "pwm.h"
62#include "pwminit.h" 62#include "pwminit.h"
63#include "pwmprint.h" 63#include "pwmprint.h"
64#include "addentrywndimpl.h" 64#include "addentrywndimpl.h"
65#include "globalstuff.h" 65#include "globalstuff.h"
66#include "findwndimpl.h" 66#include "findwndimpl.h"
67#include "csv.h" 67#include "csv.h"
68 68
69#ifdef CONFIG_KWALLETIF 69#ifdef CONFIG_KWALLETIF
70# include "kwalletif.h" 70# include "kwalletif.h"
71# include "kwalletemu.h" 71# include "kwalletemu.h"
72#endif 72#endif
73#ifdef CONFIG_KEYCARD 73#ifdef CONFIG_KEYCARD
74# include "pwmkeycard.h" 74# include "pwmkeycard.h"
75#endif 75#endif
76 76
77 77
78 #define DEFAULT_SIZE (QSize(700, 400)) 78 #define DEFAULT_SIZE (QSize(700, 400))
79 79
80// Button IDs for "file" popup menu 80// Button IDs for "file" popup menu
81enum { 81enum {
82 BUTTON_POPUP_FILE_NEW = 0, 82 BUTTON_POPUP_FILE_NEW = 0,
83 BUTTON_POPUP_FILE_OPEN, 83 BUTTON_POPUP_FILE_OPEN,
84 BUTTON_POPUP_FILE_CLOSE, 84 BUTTON_POPUP_FILE_CLOSE,
85 BUTTON_POPUP_FILE_SAVE, 85 BUTTON_POPUP_FILE_SAVE,
86 BUTTON_POPUP_FILE_SAVEAS, 86 BUTTON_POPUP_FILE_SAVEAS,
87 BUTTON_POPUP_FILE_EXPORT, 87 BUTTON_POPUP_FILE_EXPORT,
88 BUTTON_POPUP_FILE_IMPORT, 88 BUTTON_POPUP_FILE_IMPORT,
89 BUTTON_POPUP_FILE_PRINT, 89 BUTTON_POPUP_FILE_PRINT,
90 BUTTON_POPUP_FILE_QUIT 90 BUTTON_POPUP_FILE_QUIT
91}; 91};
92// Button IDs for "manage" popup menu 92// Button IDs for "manage" popup menu
93enum { 93enum {
94 BUTTON_POPUP_MANAGE_ADD = 0, 94 BUTTON_POPUP_MANAGE_ADD = 0,
95 BUTTON_POPUP_MANAGE_EDIT, 95 BUTTON_POPUP_MANAGE_EDIT,
96 BUTTON_POPUP_MANAGE_DEL, 96 BUTTON_POPUP_MANAGE_DEL,
97 BUTTON_POPUP_MANAGE_CHANGEMP 97 BUTTON_POPUP_MANAGE_CHANGEMP
98}; 98};
99// Button IDs for chipcard popup menu 99// Button IDs for chipcard popup menu
100enum { 100enum {
101#ifdef CONFIG_KEYCARD 101#ifdef CONFIG_KEYCARD
102 BUTTON_POPUP_CHIPCARD_GENNEW = 0, 102 BUTTON_POPUP_CHIPCARD_GENNEW = 0,
103 BUTTON_POPUP_CHIPCARD_DEL, 103 BUTTON_POPUP_CHIPCARD_DEL,
104 BUTTON_POPUP_CHIPCARD_READID, 104 BUTTON_POPUP_CHIPCARD_READID,
105 BUTTON_POPUP_CHIPCARD_SAVEBACKUP, 105 BUTTON_POPUP_CHIPCARD_SAVEBACKUP,
106 BUTTON_POPUP_CHIPCARD_REPLAYBACKUP 106 BUTTON_POPUP_CHIPCARD_REPLAYBACKUP
107#else // CONFIG_KEYCARD 107#else // CONFIG_KEYCARD
108 BUTTON_POPUP_CHIPCARD_NO = 0 108 BUTTON_POPUP_CHIPCARD_NO = 0
109#endif // CONFIG_KEYCARD 109#endif // CONFIG_KEYCARD
110}; 110};
111// Button IDs for "view" popup menu 111// Button IDs for "view" popup menu
112enum { 112enum {
113 BUTTON_POPUP_VIEW_FIND = 0, 113 BUTTON_POPUP_VIEW_FIND = 0,
114 BUTTON_POPUP_VIEW_LOCK, 114 BUTTON_POPUP_VIEW_LOCK,
115 BUTTON_POPUP_VIEW_DEEPLOCK, 115 BUTTON_POPUP_VIEW_DEEPLOCK,
116 BUTTON_POPUP_VIEW_UNLOCK 116 BUTTON_POPUP_VIEW_UNLOCK
117}; 117};
118// Button IDs for "options" popup menu 118// Button IDs for "options" popup menu
119enum { 119enum {
120 BUTTON_POPUP_OPTIONS_CONFIG = 0 120 BUTTON_POPUP_OPTIONS_CONFIG = 0
121#ifdef PWM_EMBEDDED 121#ifdef PWM_EMBEDDED
122 ,BUTTON_POPUP_OPTIONS_CATEGORY 122 ,BUTTON_POPUP_OPTIONS_CATEGORY
123#endif 123#endif
124}; 124};
125// Button IDs for "export" popup menu (in "file" popup menu) 125// Button IDs for "export" popup menu (in "file" popup menu)
126enum { 126enum {
127 BUTTON_POPUP_EXPORT_TEXT = 0, 127 BUTTON_POPUP_EXPORT_TEXT = 0,
128 BUTTON_POPUP_EXPORT_GPASMAN, 128 BUTTON_POPUP_EXPORT_GPASMAN,
129 BUTTON_POPUP_EXPORT_CSV 129 BUTTON_POPUP_EXPORT_CSV
130#ifdef CONFIG_KWALLETIF 130#ifdef CONFIG_KWALLETIF
131 ,BUTTON_POPUP_EXPORT_KWALLET 131 ,BUTTON_POPUP_EXPORT_KWALLET
132#endif 132#endif
133}; 133};
134// Button IDs for "import" popup menu (in "file" popup menu) 134// Button IDs for "import" popup menu (in "file" popup menu)
135enum { 135enum {
136 BUTTON_POPUP_IMPORT_TEXT = 0, 136 BUTTON_POPUP_IMPORT_TEXT = 0,
137 BUTTON_POPUP_IMPORT_GPASMAN, 137 BUTTON_POPUP_IMPORT_GPASMAN,
138 BUTTON_POPUP_IMPORT_CSV 138 BUTTON_POPUP_IMPORT_CSV
139#ifdef CONFIG_KWALLETIF 139#ifdef CONFIG_KWALLETIF
140 ,BUTTON_POPUP_IMPORT_KWALLET 140 ,BUTTON_POPUP_IMPORT_KWALLET
141#endif 141#endif
142}; 142};
143 143
144#ifdef PWM_EMBEDDED 144#ifdef PWM_EMBEDDED
145// Button IDs for "help" popup menu 145// Button IDs for "help" popup menu
146enum { 146enum {
147 BUTTON_POPUP_HELP_LICENSE = 0, 147 BUTTON_POPUP_HELP_LICENSE = 0,
148 BUTTON_POPUP_HELP_FAQ, 148 BUTTON_POPUP_HELP_FAQ,
149 BUTTON_POPUP_HELP_ABOUT, 149 BUTTON_POPUP_HELP_ABOUT,
150 BUTTON_POPUP_HELP_SYNC, 150 BUTTON_POPUP_HELP_SYNC,
151 BUTTON_POPUP_HELP_WHATSNEW 151 BUTTON_POPUP_HELP_WHATSNEW
152}; 152};
153#endif 153#endif
154 154
155// Button IDs for toolbar 155// Button IDs for toolbar
156enum { 156enum {
157 BUTTON_TOOL_NEW = 0, 157 BUTTON_TOOL_NEW = 0,
158 BUTTON_TOOL_OPEN, 158 BUTTON_TOOL_OPEN,
159 BUTTON_TOOL_SAVE, 159 BUTTON_TOOL_SAVE,
160 BUTTON_TOOL_SAVEAS, 160 BUTTON_TOOL_SAVEAS,
161 BUTTON_TOOL_PRINT, 161 BUTTON_TOOL_PRINT,
162 BUTTON_TOOL_ADD, 162 BUTTON_TOOL_ADD,
163 BUTTON_TOOL_EDIT, 163 BUTTON_TOOL_EDIT,
164 BUTTON_TOOL_DEL, 164 BUTTON_TOOL_DEL,
165 BUTTON_TOOL_FIND, 165 BUTTON_TOOL_FIND,
166 BUTTON_TOOL_LOCK, 166 BUTTON_TOOL_LOCK,
167 BUTTON_TOOL_DEEPLOCK, 167 BUTTON_TOOL_DEEPLOCK,
168 BUTTON_TOOL_UNLOCK 168 BUTTON_TOOL_UNLOCK
169}; 169};
170 170
171 171
172PwM::PwM(PwMInit *_init, PwMDoc *doc, 172PwM::PwM(PwMInit *_init, PwMDoc *doc,
173 bool virginity, 173 bool virginity,
174 QWidget *parent, const char *name) 174 QWidget *parent, const char *name)
175 : KMainWindow(parent, "HALLO") 175 : KMainWindow(parent, "HALLO")
176 , forceQuit (false) 176 , forceQuit (false)
177 , forceMinimizeToTray (false) 177 , forceMinimizeToTray (false)
178{ 178{
179 syncManager = 0; 179 syncManager = 0;
180 virgin = !virginity; 180 virgin = !virginity;
181 init = _init; 181 init = _init;
182 connect(doc, SIGNAL(docClosed(PwMDoc *)), 182 connect(doc, SIGNAL(docClosed(PwMDoc *)),
183 this, SLOT(docClosed(PwMDoc *))); 183 this, SLOT(docClosed(PwMDoc *)));
184 initMenubar(); 184 initMenubar();
185 initToolbar(); 185 initToolbar();
186 initMetrics(); 186 initMetrics();
187 setVirgin(virginity); 187 setVirgin(virginity);
188 setFocusPolicy(QWidget::WheelFocus); 188 setFocusPolicy(QWidget::WheelFocus);
189#ifndef PWM_EMBEDDED 189#ifndef PWM_EMBEDDED
190 statusBar()->show(); 190 statusBar()->show();
191#endif 191#endif
192 view = makeNewListView(doc); 192 view = makeNewListView(doc);
193 setCentralWidget(view); 193 setCentralWidget(view);
194 updateCaption(); 194 updateCaption();
195 showStatMsg(i18n("Ready.")); 195 showStatMsg(i18n("Ready."));
196} 196}
197 197
198PwM::~PwM() 198PwM::~PwM()
199{ 199{
200 qDebug("PwM::~PwM() %x", this); 200 //qDebug("PwM::~PwM() %x", this);
201 disconnect(curDoc(), SIGNAL(docClosed(PwMDoc *)), 201 disconnect(curDoc(), SIGNAL(docClosed(PwMDoc *)),
202 this, SLOT(docClosed(PwMDoc *))); 202 this, SLOT(docClosed(PwMDoc *)));
203 conf()->confWndMainWndSize(size()); 203 conf()->confWndMainWndSize(size());
204 //LR closing of windows changed 204 //LR closing of windows changed
205 //needed for fastload option on PDA 205 //needed for fastload option on PDA
206 //emit closed(this); 206 //emit closed(this);
207 //qDebug("PwM::~PwM() emited closed(this)"); 207 //qDebug("PwM::~PwM() emited closed(this)");
208 delete view; 208 delete view;
209 delete syncManager; 209 delete syncManager;
210} 210}
211 211
212void PwM::initMenubar() 212void PwM::initMenubar()
213{ 213{
214 KIconLoader* picons; 214 KIconLoader* picons;
215#ifndef PWM_EMBEDDED 215#ifndef PWM_EMBEDDED
216 KIconLoader icons; 216 KIconLoader icons;
217 picons = &icons; 217 picons = &icons;
218#else 218#else
219 picons = KGlobal::iconLoader(); 219 picons = KGlobal::iconLoader();
220 220
221 221
222 syncPopup = new KPopupMenu(this); 222 syncPopup = new KPopupMenu(this);
223 223
224 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::PWMPI, PWMPrefs::instance(), syncPopup); 224 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::PWMPI, PWMPrefs::instance(), syncPopup);
225 syncManager->setBlockSave(false); 225 syncManager->setBlockSave(false);
226 226
227 connect ( syncPopup, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 227 connect ( syncPopup, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
228 syncManager->fillSyncMenu(); 228 syncManager->fillSyncMenu();
229 229
230#endif 230#endif
231 filePopup = new KPopupMenu(this); 231 filePopup = new KPopupMenu(this);
232 importPopup = new KPopupMenu(filePopup); 232 importPopup = new KPopupMenu(filePopup);
233 exportPopup = new KPopupMenu(filePopup); 233 exportPopup = new KPopupMenu(filePopup);
234 managePopup = new KPopupMenu(this); 234 managePopup = new KPopupMenu(this);
235#ifdef CONFIG_KEYCARD 235#ifdef CONFIG_KEYCARD
236 chipcardPopup = new KPopupMenu(this); 236 chipcardPopup = new KPopupMenu(this);
237#endif // CONFIG_KEYCARD 237#endif // CONFIG_KEYCARD
238 viewPopup = new KPopupMenu(this); 238 viewPopup = new KPopupMenu(this);
239 optionsPopup = new KPopupMenu(this); 239 optionsPopup = new KPopupMenu(this);
240 240
241// "file" popup menu 241// "file" popup menu
242 filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), 242 filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)),
243 i18n("&New"), this, 243 i18n("&New"), this,
244 SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW); 244 SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW);
245 filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)), 245 filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)),
246 i18n("&Open"), this, 246 i18n("&Open"), this,
247 SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN); 247 SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN);
248 filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)), 248 filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)),
249 i18n("&Close"), this, 249 i18n("&Close"), this,
250 SLOT(close_slot()), 0, BUTTON_POPUP_FILE_CLOSE); 250 SLOT(close_slot()), 0, BUTTON_POPUP_FILE_CLOSE);
251 filePopup->insertSeparator(); 251 filePopup->insertSeparator();
252 filePopup->insertItem(QIconSet(picons->loadIcon("filesave", KIcon::Small)), 252 filePopup->insertItem(QIconSet(picons->loadIcon("filesave", KIcon::Small)),
253 i18n("&Save"), this, 253 i18n("&Save"), this,
254 SLOT(save_slot()), 0, BUTTON_POPUP_FILE_SAVE); 254 SLOT(save_slot()), 0, BUTTON_POPUP_FILE_SAVE);
255 filePopup->insertItem(QIconSet(picons->loadIcon("filesaveas", KIcon::Small)), 255 filePopup->insertItem(QIconSet(picons->loadIcon("filesaveas", KIcon::Small)),
256 i18n("Save &as..."), 256 i18n("Save &as..."),
257 this, SLOT(saveAs_slot()), 0, 257 this, SLOT(saveAs_slot()), 0,
258 BUTTON_POPUP_FILE_SAVEAS); 258 BUTTON_POPUP_FILE_SAVEAS);
259 filePopup->insertSeparator(); 259 filePopup->insertSeparator();
260 // "file/export" popup menu 260 // "file/export" popup menu
261 exportPopup->insertItem(i18n("&Text-file..."), this, 261 exportPopup->insertItem(i18n("&Text-file..."), this,
262 SLOT(exportToText()), 0, BUTTON_POPUP_EXPORT_TEXT); 262 SLOT(exportToText()), 0, BUTTON_POPUP_EXPORT_TEXT);
263 exportPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, 263 exportPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this,
264 SLOT(exportToGpasman()), 0, BUTTON_POPUP_EXPORT_GPASMAN); 264 SLOT(exportToGpasman()), 0, BUTTON_POPUP_EXPORT_GPASMAN);
265 exportPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this, 265 exportPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this,
266 SLOT(exportToCsv()), 0, BUTTON_POPUP_EXPORT_CSV); 266 SLOT(exportToCsv()), 0, BUTTON_POPUP_EXPORT_CSV);
267#ifdef CONFIG_KWALLETIF 267#ifdef CONFIG_KWALLETIF
268 exportPopup->insertItem(i18n("&KWallet..."), this, 268 exportPopup->insertItem(i18n("&KWallet..."), this,
269 SLOT(exportToKWallet()), 0, BUTTON_POPUP_EXPORT_KWALLET); 269 SLOT(exportToKWallet()), 0, BUTTON_POPUP_EXPORT_KWALLET);
270#endif 270#endif
271 filePopup->insertItem(QIconSet(picons->loadIcon("fileexport", KIcon::Small)), 271 filePopup->insertItem(QIconSet(picons->loadIcon("fileexport", KIcon::Small)),
272 i18n("E&xport"), exportPopup, 272 i18n("E&xport"), exportPopup,
273 BUTTON_POPUP_FILE_EXPORT); 273 BUTTON_POPUP_FILE_EXPORT);
274 // "file/import" popup menu 274 // "file/import" popup menu
275 importPopup->insertItem(i18n("&Text-file..."), this, 275 importPopup->insertItem(i18n("&Text-file..."), this,
276 SLOT(importFromText()), 0, BUTTON_POPUP_IMPORT_TEXT); 276 SLOT(importFromText()), 0, BUTTON_POPUP_IMPORT_TEXT);
277 importPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, 277 importPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this,
278 SLOT(importFromGpasman()), 0, BUTTON_POPUP_IMPORT_GPASMAN); 278 SLOT(importFromGpasman()), 0, BUTTON_POPUP_IMPORT_GPASMAN);
279 importPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this, 279 importPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this,
280 SLOT(importCsv()), 0, BUTTON_POPUP_IMPORT_CSV); 280 SLOT(importCsv()), 0, BUTTON_POPUP_IMPORT_CSV);
281#ifdef CONFIG_KWALLETIF 281#ifdef CONFIG_KWALLETIF
282 importPopup->insertItem(i18n("&KWallet..."), this, 282 importPopup->insertItem(i18n("&KWallet..."), this,
283 SLOT(importKWallet()), 0, BUTTON_POPUP_IMPORT_KWALLET); 283 SLOT(importKWallet()), 0, BUTTON_POPUP_IMPORT_KWALLET);
284#endif 284#endif
285 filePopup->insertItem(QIconSet(picons->loadIcon("fileimport", KIcon::Small)), 285 filePopup->insertItem(QIconSet(picons->loadIcon("fileimport", KIcon::Small)),
286 i18n("I&mport"), importPopup, 286 i18n("I&mport"), importPopup,
287 BUTTON_POPUP_FILE_IMPORT); 287 BUTTON_POPUP_FILE_IMPORT);
288 filePopup->insertSeparator(); 288 filePopup->insertSeparator();
289 filePopup->insertItem(QIconSet(picons->loadIcon("fileprint", KIcon::Small)), 289 filePopup->insertItem(QIconSet(picons->loadIcon("fileprint", KIcon::Small)),
290 i18n("&Print..."), this, 290 i18n("&Print..."), this,
291 SLOT(print_slot()), 0, BUTTON_POPUP_FILE_PRINT); 291 SLOT(print_slot()), 0, BUTTON_POPUP_FILE_PRINT);
292 filePopup->insertSeparator(); 292 filePopup->insertSeparator();
293 filePopup->insertItem(QIconSet(picons->loadIcon("exit", KIcon::Small)), 293 filePopup->insertItem(QIconSet(picons->loadIcon("exit", KIcon::Small)),
294 i18n("&Quit"), this, 294 i18n("&Quit"), this,
295 SLOT(quitButton_slot()), 0, BUTTON_POPUP_FILE_QUIT); 295 SLOT(quitButton_slot()), 0, BUTTON_POPUP_FILE_QUIT);
296 menuBar()->insertItem(i18n("&File"), filePopup); 296 menuBar()->insertItem(i18n("&File"), filePopup);
297// "manage" popup menu 297// "manage" popup menu
298 managePopup->insertItem(QIconSet(picons->loadIcon("pencil", KIcon::Small)), 298 managePopup->insertItem(QIconSet(picons->loadIcon("pencil", KIcon::Small)),
299 i18n("&Add password"), this, 299 i18n("&Add password"), this,
300 SLOT(addPwd_slot()), 0, 300 SLOT(addPwd_slot()), 0,
301 BUTTON_POPUP_MANAGE_ADD); 301 BUTTON_POPUP_MANAGE_ADD);
302 managePopup->insertItem(QIconSet(picons->loadIcon("edit", KIcon::Small)), 302 managePopup->insertItem(QIconSet(picons->loadIcon("edit", KIcon::Small)),
303 i18n("&Edit"), this, SLOT(editPwd_slot()), 0, 303 i18n("&Edit"), this, SLOT(editPwd_slot()), 0,
304 BUTTON_POPUP_MANAGE_EDIT); 304 BUTTON_POPUP_MANAGE_EDIT);
305 managePopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), 305 managePopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)),
306 i18n("&Delete"), this, SLOT(deletePwd_slot()), 306 i18n("&Delete"), this, SLOT(deletePwd_slot()),
307 0, BUTTON_POPUP_MANAGE_DEL); 307 0, BUTTON_POPUP_MANAGE_DEL);
308 managePopup->insertSeparator(); 308 managePopup->insertSeparator();
309 managePopup->insertItem(QIconSet(picons->loadIcon("rotate", KIcon::Small)), 309 managePopup->insertItem(QIconSet(picons->loadIcon("rotate", KIcon::Small)),
310 i18n("Change &Master Password"), this, 310 i18n("Change &Master Password"), this,
311 SLOT(changeMasterPwd_slot()), 0, 311 SLOT(changeMasterPwd_slot()), 0,
312 BUTTON_POPUP_MANAGE_CHANGEMP); 312 BUTTON_POPUP_MANAGE_CHANGEMP);
313 menuBar()->insertItem(i18n("&Manage"), managePopup); 313 menuBar()->insertItem(i18n("&Manage"), managePopup);
314// "chipcard" popup menu 314// "chipcard" popup menu
315#ifdef CONFIG_KEYCARD 315#ifdef CONFIG_KEYCARD
316 chipcardPopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), 316 chipcardPopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)),
317 i18n("&Generate new key-card"), this, 317 i18n("&Generate new key-card"), this,
318 SLOT(genNewCard_slot()), 0, 318 SLOT(genNewCard_slot()), 0,
319 BUTTON_POPUP_CHIPCARD_GENNEW); 319 BUTTON_POPUP_CHIPCARD_GENNEW);
320 chipcardPopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), 320 chipcardPopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)),
321 i18n("&Erase key-card"), this, 321 i18n("&Erase key-card"), this,
322 SLOT(eraseCard_slot()), 0, 322 SLOT(eraseCard_slot()), 0,
323 BUTTON_POPUP_CHIPCARD_DEL); 323 BUTTON_POPUP_CHIPCARD_DEL);
324 chipcardPopup->insertItem(QIconSet(picons->loadIcon("", KIcon::Small)), 324 chipcardPopup->insertItem(QIconSet(picons->loadIcon("", KIcon::Small)),
325 i18n("Read card-&ID"), this, 325 i18n("Read card-&ID"), this,
326 SLOT(readCardId_slot()), 0, 326 SLOT(readCardId_slot()), 0,
327 BUTTON_POPUP_CHIPCARD_READID); 327 BUTTON_POPUP_CHIPCARD_READID);
328 chipcardPopup->insertSeparator(); 328 chipcardPopup->insertSeparator();
329 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2rightarrow", KIcon::Small)), 329 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2rightarrow", KIcon::Small)),
330 i18n("&Make card backup-image"), this, 330 i18n("&Make card backup-image"), this,
331 SLOT(makeCardBackup_slot()), 0, 331 SLOT(makeCardBackup_slot()), 0,
332 BUTTON_POPUP_CHIPCARD_SAVEBACKUP); 332 BUTTON_POPUP_CHIPCARD_SAVEBACKUP);
333 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2leftarrow", KIcon::Small)), 333 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2leftarrow", KIcon::Small)),
334 i18n("&Replay card backup-image"), this, 334 i18n("&Replay card backup-image"), this,
335 SLOT(replayCardBackup_slot()), 0, 335 SLOT(replayCardBackup_slot()), 0,
336 BUTTON_POPUP_CHIPCARD_REPLAYBACKUP); 336 BUTTON_POPUP_CHIPCARD_REPLAYBACKUP);
337 menuBar()->insertItem(i18n("&Chipcard manager"), chipcardPopup); 337 menuBar()->insertItem(i18n("&Chipcard manager"), chipcardPopup);
338#endif // CONFIG_KEYCARD 338#endif // CONFIG_KEYCARD
339// "view" popup menu 339// "view" popup menu
340 viewPopup->insertItem(QIconSet(picons->loadIcon("find", KIcon::Small)), 340 viewPopup->insertItem(QIconSet(picons->loadIcon("find", KIcon::Small)),
341 i18n("&Find"), this, 341 i18n("&Find"), this,
342 SLOT(find_slot()), 0, BUTTON_POPUP_VIEW_FIND); 342 SLOT(find_slot()), 0, BUTTON_POPUP_VIEW_FIND);
343 viewPopup->insertSeparator(); 343 viewPopup->insertSeparator();
344 viewPopup->insertItem(QIconSet(picons->loadIcon("halfencrypted", KIcon::Small)), 344 viewPopup->insertItem(QIconSet(picons->loadIcon("halfencrypted", KIcon::Small)),
345 i18n("&Lock all entries"), this, 345 i18n("&Lock all entries"), this,
346 SLOT(lockWnd_slot()), 0, 346 SLOT(lockWnd_slot()), 0,
347 BUTTON_POPUP_VIEW_LOCK); 347 BUTTON_POPUP_VIEW_LOCK);
348 viewPopup->insertItem(QIconSet(picons->loadIcon("encrypted", KIcon::Small)), 348 viewPopup->insertItem(QIconSet(picons->loadIcon("encrypted", KIcon::Small)),
349 i18n("&Deep-lock all entries"), this, 349 i18n("&Deep-lock all entries"), this,
350 SLOT(deepLockWnd_slot()), 0, 350 SLOT(deepLockWnd_slot()), 0,
351 BUTTON_POPUP_VIEW_DEEPLOCK); 351 BUTTON_POPUP_VIEW_DEEPLOCK);
352 viewPopup->insertItem(QIconSet(picons->loadIcon("decrypted", KIcon::Small)), 352 viewPopup->insertItem(QIconSet(picons->loadIcon("decrypted", KIcon::Small)),
353 i18n("&Unlock all entries"), this, 353 i18n("&Unlock all entries"), this,
354 SLOT(unlockWnd_slot()), 0, 354 SLOT(unlockWnd_slot()), 0,
355 BUTTON_POPUP_VIEW_UNLOCK); 355 BUTTON_POPUP_VIEW_UNLOCK);
356 menuBar()->insertItem(i18n("&View"), viewPopup); 356 menuBar()->insertItem(i18n("&View"), viewPopup);
357// "options" popup menu 357// "options" popup menu
358 optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)), 358 optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)),
359 i18n("&Configure..."), this, 359 i18n("&Configure..."), this,
360 SLOT(config_slot()),0, 360 SLOT(config_slot()),0,
361 BUTTON_POPUP_OPTIONS_CONFIG); 361 BUTTON_POPUP_OPTIONS_CONFIG);
362 menuBar()->insertItem(i18n("&Options"), optionsPopup); 362 menuBar()->insertItem(i18n("&Options"), optionsPopup);
363// "help" popup menu 363// "help" popup menu
364#ifndef PWM_EMBEDDED 364#ifndef PWM_EMBEDDED
365 helpPopup = helpMenu(QString::null, false); 365 helpPopup = helpMenu(QString::null, false);
366#else 366#else
367 optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)), 367 optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)),
368 i18n("C&ategories..."), this, 368 i18n("C&ategories..."), this,
369 SLOT(category_slot()),0, 369 SLOT(category_slot()),0,
370 BUTTON_POPUP_OPTIONS_CATEGORY); 370 BUTTON_POPUP_OPTIONS_CATEGORY);
371 371
372 372
373 menuBar()->insertItem(i18n("&Sync"), syncPopup); 373 menuBar()->insertItem(i18n("&Sync"), syncPopup);
374 374
375 375
376 376
377 377
378 378
379 helpPopup = new KPopupMenu(this); 379 helpPopup = new KPopupMenu(this);
380 380
381 381
382 helpPopup->insertItem(i18n("&License"), this, 382 helpPopup->insertItem(i18n("&License"), this,
383 SLOT(showLicense_slot()), 0, 383 SLOT(showLicense_slot()), 0,
384 BUTTON_POPUP_HELP_LICENSE); 384 BUTTON_POPUP_HELP_LICENSE);
385 385
386 helpPopup->insertItem(i18n("&Faq"), this, 386 helpPopup->insertItem(i18n("&Faq"), this,
387 SLOT(faq_slot()), 0, 387 SLOT(faq_slot()), 0,
388 BUTTON_POPUP_HELP_FAQ); 388 BUTTON_POPUP_HELP_FAQ);
389 389
390 helpPopup->insertItem(i18n("&About PwManager"), this, 390 helpPopup->insertItem(i18n("&About PwManager"), this,
391 SLOT(createAboutData_slot()), 0, 391 SLOT(createAboutData_slot()), 0,
392 BUTTON_POPUP_HELP_ABOUT); 392 BUTTON_POPUP_HELP_ABOUT);
393 393
394 helpPopup->insertItem(i18n("&Sync HowTo"), this, 394 helpPopup->insertItem(i18n("&Sync HowTo"), this,
395 SLOT(syncHowTo_slot()), 0, 395 SLOT(syncHowTo_slot()), 0,
396 BUTTON_POPUP_HELP_SYNC); 396 BUTTON_POPUP_HELP_SYNC);
397 397
398 helpPopup->insertItem(i18n("&What's New"), this, 398 helpPopup->insertItem(i18n("&What's New"), this,
399 SLOT(whatsnew_slot()), 0, 399 SLOT(whatsnew_slot()), 0,
400 BUTTON_POPUP_HELP_WHATSNEW); 400 BUTTON_POPUP_HELP_WHATSNEW);
401 401
402#endif 402#endif
403 menuBar()->insertItem(i18n("&Help"), helpPopup); 403 menuBar()->insertItem(i18n("&Help"), helpPopup);
404 404
405} 405}
406 406
407void PwM::initToolbar() 407void PwM::initToolbar()
408{ 408{
409 KIconLoader* picons; 409 KIconLoader* picons;
410#ifndef PWM_EMBEDDED 410#ifndef PWM_EMBEDDED
411 KIconLoader icons; 411 KIconLoader icons;
412 picons = &icons; 412 picons = &icons;
413#else 413#else
414 picons = KGlobal::iconLoader(); 414 picons = KGlobal::iconLoader();
415#endif 415#endif
416 416
417#ifdef PWM_EMBEDDED 417#ifdef PWM_EMBEDDED
418 if ( QApplication::desktop()->width() > 320 ) 418 if ( QApplication::desktop()->width() > 320 )
419#endif 419#endif
420 { 420 {
421 toolBar()->insertButton(picons->loadIcon("filenew", KIcon::Toolbar), 421 toolBar()->insertButton(picons->loadIcon("filenew", KIcon::Toolbar),
422 BUTTON_TOOL_NEW, SIGNAL(clicked(int)), this, 422 BUTTON_TOOL_NEW, SIGNAL(clicked(int)), this,
423 SLOT(new_slot()), true, i18n("New")); 423 SLOT(new_slot()), true, i18n("New"));
424 toolBar()->insertButton(picons->loadIcon("fileopen", KIcon::Toolbar), 424 toolBar()->insertButton(picons->loadIcon("fileopen", KIcon::Toolbar),
425 BUTTON_TOOL_OPEN, SIGNAL(clicked(int)), this, 425 BUTTON_TOOL_OPEN, SIGNAL(clicked(int)), this,
426 SLOT(open_slot()), true, i18n("Open")); 426 SLOT(open_slot()), true, i18n("Open"));
427 toolBar()->insertSeparator(); 427 toolBar()->insertSeparator();
428 } 428 }
429 toolBar()->insertButton(picons->loadIcon("filesave", KIcon::Toolbar), 429 toolBar()->insertButton(picons->loadIcon("filesave", KIcon::Toolbar),
430 BUTTON_TOOL_SAVE, SIGNAL(clicked(int)), this, 430 BUTTON_TOOL_SAVE, SIGNAL(clicked(int)), this,
431 SLOT(save_slot()), true, i18n("Save")); 431 SLOT(save_slot()), true, i18n("Save"));
432 toolBar()->insertButton(picons->loadIcon("filesaveas", KIcon::Toolbar), 432 toolBar()->insertButton(picons->loadIcon("filesaveas", KIcon::Toolbar),
433 BUTTON_TOOL_SAVEAS, SIGNAL(clicked(int)), this, 433 BUTTON_TOOL_SAVEAS, SIGNAL(clicked(int)), this,
434 SLOT(saveAs_slot()), true, i18n("Save as")); 434 SLOT(saveAs_slot()), true, i18n("Save as"));
435 toolBar()->insertButton(picons->loadIcon("fileprint", KIcon::Toolbar), 435 toolBar()->insertButton(picons->loadIcon("fileprint", KIcon::Toolbar),
436 BUTTON_TOOL_PRINT, SIGNAL(clicked(int)), this, 436 BUTTON_TOOL_PRINT, SIGNAL(clicked(int)), this,
437 SLOT(print_slot()), true, i18n("Print...")); 437 SLOT(print_slot()), true, i18n("Print..."));
438 toolBar()->insertSeparator(); 438 toolBar()->insertSeparator();
439 toolBar()->insertButton(picons->loadIcon("pencil", KIcon::Toolbar), 439 toolBar()->insertButton(picons->loadIcon("pencil", KIcon::Toolbar),
440 BUTTON_TOOL_ADD, SIGNAL(clicked(int)), this, 440 BUTTON_TOOL_ADD, SIGNAL(clicked(int)), this,
441 SLOT(addPwd_slot()), true, 441 SLOT(addPwd_slot()), true,
442 i18n("Add password")); 442 i18n("Add password"));
443 toolBar()->insertButton(picons->loadIcon("edit", KIcon::Toolbar), 443 toolBar()->insertButton(picons->loadIcon("edit", KIcon::Toolbar),
444 BUTTON_TOOL_EDIT, SIGNAL(clicked(int)), this, 444 BUTTON_TOOL_EDIT, SIGNAL(clicked(int)), this,
445 SLOT(editPwd_slot()), true, 445 SLOT(editPwd_slot()), true,
446 i18n("Edit password")); 446 i18n("Edit password"));
447 toolBar()->insertButton(picons->loadIcon("editdelete", KIcon::Toolbar), 447 toolBar()->insertButton(picons->loadIcon("editdelete", KIcon::Toolbar),
448 BUTTON_TOOL_DEL, SIGNAL(clicked(int)), this, 448 BUTTON_TOOL_DEL, SIGNAL(clicked(int)), this,
449 SLOT(deletePwd_slot()), true, 449 SLOT(deletePwd_slot()), true,
450 i18n("Delete password")); 450 i18n("Delete password"));
451 toolBar()->insertSeparator(); 451 toolBar()->insertSeparator();
452 toolBar()->insertButton(picons->loadIcon("find", KIcon::Toolbar), 452 toolBar()->insertButton(picons->loadIcon("find", KIcon::Toolbar),
453 BUTTON_TOOL_FIND, SIGNAL(clicked(int)), this, 453 BUTTON_TOOL_FIND, SIGNAL(clicked(int)), this,
454 SLOT(find_slot()), true, i18n("Find entry")); 454 SLOT(find_slot()), true, i18n("Find entry"));
455 toolBar()->insertSeparator(); 455 toolBar()->insertSeparator();
456 toolBar()->insertButton(picons->loadIcon("halfencrypted", KIcon::Toolbar), 456 toolBar()->insertButton(picons->loadIcon("halfencrypted", KIcon::Toolbar),
457 BUTTON_TOOL_LOCK, SIGNAL(clicked(int)), this, 457 BUTTON_TOOL_LOCK, SIGNAL(clicked(int)), this,
458 SLOT(lockWnd_slot()), true, 458 SLOT(lockWnd_slot()), true,
459 i18n("Lock all entries")); 459 i18n("Lock all entries"));
460 toolBar()->insertButton(picons->loadIcon("encrypted", KIcon::Toolbar), 460 toolBar()->insertButton(picons->loadIcon("encrypted", KIcon::Toolbar),
461 BUTTON_TOOL_DEEPLOCK, SIGNAL(clicked(int)), this, 461 BUTTON_TOOL_DEEPLOCK, SIGNAL(clicked(int)), this,
462 SLOT(deepLockWnd_slot()), true, 462 SLOT(deepLockWnd_slot()), true,
463 i18n("Deep-Lock all entries")); 463 i18n("Deep-Lock all entries"));
464 toolBar()->insertButton(picons->loadIcon("decrypted", KIcon::Toolbar), 464 toolBar()->insertButton(picons->loadIcon("decrypted", KIcon::Toolbar),
465 BUTTON_TOOL_UNLOCK, SIGNAL(clicked(int)), this, 465 BUTTON_TOOL_UNLOCK, SIGNAL(clicked(int)), this,
466 SLOT(unlockWnd_slot()), true, 466 SLOT(unlockWnd_slot()), true,
467 i18n("Unlock all entries")); 467 i18n("Unlock all entries"));
468} 468}
469 469
470void PwM::initMetrics() 470void PwM::initMetrics()
471{ 471{
472 QSize s = conf()->confWndMainWndSize(); 472 QSize s = conf()->confWndMainWndSize();
473 if (s.isValid()) 473 if (s.isValid())
474 resize(s); 474 resize(s);
475 else 475 else
476 resize(DEFAULT_SIZE); 476 resize(DEFAULT_SIZE);
477} 477}
478 478
479void PwM::updateCaption() 479void PwM::updateCaption()
480{ 480{
481 setPlainCaption(curDoc()->getTitle() + " - " PROG_NAME " " PACKAGE_VER); 481 setPlainCaption(curDoc()->getTitle() + " - " PROG_NAME " " PACKAGE_VER);
482} 482}
483 483
484void PwM::hideEvent(QHideEvent *) 484void PwM::hideEvent(QHideEvent *)
485{ 485{
486 if (isMinimized()) { 486 if (isMinimized()) {
487 if (init->tray()) { 487 if (init->tray()) {
488 forceMinimizeToTray = true; 488 forceMinimizeToTray = true;
489 close(); 489 close();
490 } 490 }
491 int mmlock = conf()->confGlobMinimizeLock(); 491 int mmlock = conf()->confGlobMinimizeLock();
492 switch (mmlock) { 492 switch (mmlock) {
493 case 0: // don't lock anything 493 case 0: // don't lock anything
494 break; 494 break;
495 case 1: {// normal lock 495 case 1: {// normal lock
496 curDoc()->lockAll(true); 496 curDoc()->lockAll(true);
497 break; 497 break;
498 } case 2: {// deep-lock 498 } case 2: {// deep-lock
499 curDoc()->deepLock(); 499 curDoc()->deepLock();
500 break; 500 break;
501 } default: 501 } default:
502 WARN(); 502 WARN();
503 } 503 }
504 } 504 }
505} 505}
506 506
507void PwM::setVirgin(bool v) 507void PwM::setVirgin(bool v)
508{ 508{
509 if (virgin == v) 509 if (virgin == v)
510 return; 510 return;
511 virgin = v; 511 virgin = v;
512 filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVE, !v); 512 filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVE, !v);
513 filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVEAS, !v); 513 filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVEAS, !v);
514 filePopup->setItemEnabled(BUTTON_POPUP_FILE_EXPORT, !v); 514 filePopup->setItemEnabled(BUTTON_POPUP_FILE_EXPORT, !v);
515 filePopup->setItemEnabled(BUTTON_POPUP_FILE_PRINT, !v); 515 filePopup->setItemEnabled(BUTTON_POPUP_FILE_PRINT, !v);
516 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_EDIT, !v); 516 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_EDIT, !v);
517 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_DEL, !v); 517 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_DEL, !v);
518 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, !v); 518 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, !v);
519 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_LOCK, !v); 519 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_LOCK, !v);
520 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_DEEPLOCK, !v); 520 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_DEEPLOCK, !v);
521 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_UNLOCK, !v); 521 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_UNLOCK, !v);
522 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_FIND, !v); 522 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_FIND, !v);
523 toolBar()->setItemEnabled(BUTTON_TOOL_SAVE, !v); 523 toolBar()->setItemEnabled(BUTTON_TOOL_SAVE, !v);
524 toolBar()->setItemEnabled(BUTTON_TOOL_SAVEAS, !v); 524 toolBar()->setItemEnabled(BUTTON_TOOL_SAVEAS, !v);
525 toolBar()->setItemEnabled(BUTTON_TOOL_PRINT, !v); 525 toolBar()->setItemEnabled(BUTTON_TOOL_PRINT, !v);
526 toolBar()->setItemEnabled(BUTTON_TOOL_EDIT, !v); 526 toolBar()->setItemEnabled(BUTTON_TOOL_EDIT, !v);
527 toolBar()->setItemEnabled(BUTTON_TOOL_DEL, !v); 527 toolBar()->setItemEnabled(BUTTON_TOOL_DEL, !v);
528 toolBar()->setItemEnabled(BUTTON_TOOL_LOCK, !v); 528 toolBar()->setItemEnabled(BUTTON_TOOL_LOCK, !v);
529 toolBar()->setItemEnabled(BUTTON_TOOL_DEEPLOCK, !v); 529 toolBar()->setItemEnabled(BUTTON_TOOL_DEEPLOCK, !v);
530 toolBar()->setItemEnabled(BUTTON_TOOL_UNLOCK, !v); 530 toolBar()->setItemEnabled(BUTTON_TOOL_UNLOCK, !v);
531 toolBar()->setItemEnabled(BUTTON_TOOL_FIND, !v); 531 toolBar()->setItemEnabled(BUTTON_TOOL_FIND, !v);
532} 532}
533 533
534void PwM::new_slot() 534void PwM::new_slot()
535{ 535{
536 init->createMainWnd(); 536 init->createMainWnd();
537} 537}
538 538
539//US ENH 539//US ENH
540void PwM::open_slot() 540void PwM::open_slot()
541{ 541{
542 open_slot(""); 542 open_slot("");
543} 543}
544 544
545void PwM::open_slot(QString fn) 545void PwM::open_slot(QString fn)
546{ 546{
547 openDoc(fn); 547 openDoc(fn);
548} 548}
549 549
550PwMDoc * PwM::openDoc(QString filename, bool openDeepLocked) 550PwMDoc * PwM::openDoc(QString filename, bool openDeepLocked)
551{ 551{
552 if (!isVirgin()) { 552 if (!isVirgin()) {
553 // open the document in a new window. 553 // open the document in a new window.
554 PwM *newInstance = init->createMainWnd(); 554 PwM *newInstance = init->createMainWnd();
555 PwMDoc *newDoc = newInstance->openDoc(filename, openDeepLocked); 555 PwMDoc *newDoc = newInstance->openDoc(filename, openDeepLocked);
556 if (!newDoc) { 556 if (!newDoc) {
557 newInstance->setForceQuit(true); 557 newInstance->setForceQuit(true);
558 delete_and_null(newInstance); 558 delete_and_null(newInstance);
559 } 559 }
560 return newDoc; 560 return newDoc;
561 } 561 }
562 562
563 if (!curDoc()->openDocUi(curDoc(), filename, openDeepLocked)) 563 if (!curDoc()->openDocUi(curDoc(), filename, openDeepLocked))
564 return 0; 564 return 0;
565 showStatMsg(i18n("Successfully opened file.")); 565 showStatMsg(i18n("Successfully opened file."));
566 updateCaption(); 566 updateCaption();
567 setVirgin(false); 567 setVirgin(false);
568 return curDoc(); 568 return curDoc();
569} 569}
570 570
571PwMView * PwM::makeNewListView(PwMDoc *doc) 571PwMView * PwM::makeNewListView(PwMDoc *doc)
572{ 572{
573 PwMView *ret = new PwMView(this, this, doc); 573 PwMView *ret = new PwMView(this, this, doc);
574 ret->setFont(conf()->confGlobEntryFont()); 574 ret->setFont(conf()->confGlobEntryFont());
575 ret->show(); 575 ret->show();
576 return ret; 576 return ret;
577} 577}
578 578
579void PwM::close_slot() 579void PwM::close_slot()
580{ 580{
581 close(); 581 close();
582} 582}
583 583
584void PwM::quitButton_slot() 584void PwM::quitButton_slot()
585{ 585{
586 init->shutdownApp(0); 586 init->shutdownApp(0);
587} 587}
588 588
589void PwM::save_slot() 589void PwM::save_slot()
590{ 590{
591 save(); 591 save();
592} 592}
593 593
594bool PwM::save() 594bool PwM::save()
595{ 595{
596 if (!curDoc()->saveDocUi(curDoc())) 596 if (!curDoc()->saveDocUi(curDoc()))
597 return false; 597 return false;
598 showStatMsg(i18n("Successfully saved data.")); 598 showStatMsg(i18n("Successfully saved data."));
599 updateCaption(); 599 updateCaption();
600 return true; 600 return true;
601} 601}
602 602
603void PwM::saveAs_slot() 603void PwM::saveAs_slot()
604{ 604{
605 saveAs(); 605 saveAs();
606} 606}
607 607
608bool PwM::saveAs() 608bool PwM::saveAs()
609{ 609{
610 if (!curDoc()->saveAsDocUi(curDoc())) 610 if (!curDoc()->saveAsDocUi(curDoc()))
611 return false; 611 return false;
612 showStatMsg(i18n("Successfully saved data.")); 612 showStatMsg(i18n("Successfully saved data."));
613 updateCaption(); 613 updateCaption();
614 return true; 614 return true;
615} 615}
616 616
617//US ENH : changed code to run with older MOC 617//US ENH : changed code to run with older MOC
618void PwM::addPwd_slot() 618void PwM::addPwd_slot()
619{ 619{
620 addPwd_slot1(0, 0); 620 addPwd_slot1(0, 0);
621} 621}
622 622
623void PwM::addPwd_slot1(QString *pw, PwMDoc *_doc) 623void PwM::addPwd_slot1(QString *pw, PwMDoc *_doc)
624{ 624{
625 PwMDoc *doc; 625 PwMDoc *doc;
626 if (_doc) { 626 if (_doc) {
627 doc = _doc; 627 doc = _doc;
628 } else { 628 } else {
629 doc = curDoc(); 629 doc = curDoc();
630 } 630 }
631 PWM_ASSERT(doc); 631 PWM_ASSERT(doc);
632 doc->timer()->getLock(DocTimer::id_autoLockTimer); 632 doc->timer()->getLock(DocTimer::id_autoLockTimer);
633#ifndef PWM_EMBEDDED 633#ifndef PWM_EMBEDDED
634 AddEntryWndImpl w; 634 AddEntryWndImpl w;
635#else 635#else
636 AddEntryWndImpl w(doc, this, "addentrywndimpl"); 636 AddEntryWndImpl w(doc, this, "addentrywndimpl");
637#endif 637#endif
638 638
639 vector<string> catList; 639 vector<string> catList;
640 doc->getCategoryList(&catList); 640 doc->getCategoryList(&catList);
641 unsigned i, size = catList.size(); 641 unsigned i, size = catList.size();
642 for (i = 0; i < size; ++i) { 642 for (i = 0; i < size; ++i) {
643 w.addCategory(catList[i].c_str()); 643 w.addCategory(catList[i].c_str());
644 } 644 }
645 w.setCurrCategory(view->getCurrentCategory()); 645 w.setCurrCategory(view->getCurrentCategory());
646 if (pw) 646 if (pw)
647 w.pwLineEdit->setText(*pw); 647 w.pwLineEdit->setText(*pw);
648 648
649 tryAgain: 649 tryAgain:
650 if (w.exec() == 1) 650 if (w.exec() == 1)
651 { 651 {
652 PwMDataItem d; 652 PwMDataItem d;
653 653
654 //US BUG: to initialize all values of curEntr with meaningfulldata, 654 //US BUG: to initialize all values of curEntr with meaningfulldata,
655 // we call clear on it. Reason: Metadata will be uninitialized otherwise. 655 // we call clear on it. Reason: Metadata will be uninitialized otherwise.
656 // another option would be to create a constructor for PwMDataItem 656 // another option would be to create a constructor for PwMDataItem
657 d.clear(true); 657 d.clear(true);
658 658
659 d.desc = w.getDescription().latin1(); 659 d.desc = w.getDescription().latin1();
660 d.name = w.getUsername().latin1(); 660 d.name = w.getUsername().latin1();
661 d.pw = w.getPassword().latin1(); 661 d.pw = w.getPassword().latin1();
662 d.comment = w.getComment().latin1(); 662 d.comment = w.getComment().latin1();
663 d.url = w.getUrl().latin1(); 663 d.url = w.getUrl().latin1();
664 d.launcher = w.getLauncher().latin1(); 664 d.launcher = w.getLauncher().latin1();
665 PwMerror ret = doc->addEntry(w.getCategory(), &d); 665 PwMerror ret = doc->addEntry(w.getCategory(), &d);
666 if (ret == e_entryExists) { 666 if (ret == e_entryExists) {
667 KMessageBox::error(this, 667 KMessageBox::error(this,
668 i18n 668 i18n
669 ("An entry with this \"Description\",\n" 669 ("An entry with this \"Description\",\n"
670 "does already exist.\n" 670 "does already exist.\n"
671 "Please select another description."), 671 "Please select another description."),
672 i18n("entry already exists.")); 672 i18n("entry already exists."));
673 goto tryAgain; 673 goto tryAgain;
674 } else if (ret == e_maxAllowedEntr) { 674 } else if (ret == e_maxAllowedEntr) {
675 KMessageBox::error(this, i18n("The maximum possible number of\nentries" 675 KMessageBox::error(this, i18n("The maximum possible number of\nentries"
676 "has been reached.\nYou can't add more entries."), 676 "has been reached.\nYou can't add more entries."),
677 i18n("maximum number of entries")); 677 i18n("maximum number of entries"));
678 doc->timer()->putLock(DocTimer::id_autoLockTimer); 678 doc->timer()->putLock(DocTimer::id_autoLockTimer);
679 return; 679 return;
680 } 680 }
681 } 681 }
682 setVirgin(false); 682 setVirgin(false);
683 doc->timer()->putLock(DocTimer::id_autoLockTimer); 683 doc->timer()->putLock(DocTimer::id_autoLockTimer);
684} 684}
685 685
686//US ENH : changed code to run with older MOC 686//US ENH : changed code to run with older MOC
687void PwM::editPwd_slot() 687void PwM::editPwd_slot()
688{ 688{
689 editPwd_slot3(0,0,0); 689 editPwd_slot3(0,0,0);
690} 690}
691 691
692void PwM::editPwd_slot1(const QString *category) 692void PwM::editPwd_slot1(const QString *category)
693{ 693{
694 editPwd_slot3(category, 0, 0); 694 editPwd_slot3(category, 0, 0);
695} 695}
696 696
697void PwM::editPwd_slot3(const QString *category, const int *index, 697void PwM::editPwd_slot3(const QString *category, const int *index,
698 PwMDoc *_doc) 698 PwMDoc *_doc)
699{ 699{
700 PwMDoc *doc; 700 PwMDoc *doc;
701 if (_doc) { 701 if (_doc) {
702 doc = _doc; 702 doc = _doc;
703 } else { 703 } else {
704 doc = curDoc(); 704 doc = curDoc();
705 } 705 }
706 PWM_ASSERT(doc); 706 PWM_ASSERT(doc);
707 if (doc->isDocEmpty()) 707 if (doc->isDocEmpty())
708 return; 708 return;
709 if (doc->isDeepLocked()) 709 if (doc->isDeepLocked())
710 return; 710 return;
711 doc->timer()->getLock(DocTimer::id_autoLockTimer); 711 doc->timer()->getLock(DocTimer::id_autoLockTimer);
712 unsigned int curEntryIndex; 712 unsigned int curEntryIndex;
713 if (index) { 713 if (index) {
714 curEntryIndex = *index; 714 curEntryIndex = *index;
715 } else { 715 } else {
716 if (!(view->getCurEntryIndex(&curEntryIndex))) { 716 if (!(view->getCurEntryIndex(&curEntryIndex))) {
717 printDebug("couldn't get index. Maybe we have a binary entry here."); 717 printDebug("couldn't get index. Maybe we have a binary entry here.");
718 doc->timer()->putLock(DocTimer::id_autoLockTimer); 718 doc->timer()->putLock(DocTimer::id_autoLockTimer);
719 return; 719 return;
720 } 720 }
721 } 721 }
722 QString curCategory; 722 QString curCategory;
723 if (category) { 723 if (category) {
724 curCategory = *category; 724 curCategory = *category;
725 } else { 725 } else {
726 curCategory = view->getCurrentCategory(); 726 curCategory = view->getCurrentCategory();
727 } 727 }
728 PwMDataItem currItem; 728 PwMDataItem currItem;
729 if (!doc->getEntry(curCategory, curEntryIndex, &currItem, true)) { 729 if (!doc->getEntry(curCategory, curEntryIndex, &currItem, true)) {
730 doc->timer()->putLock(DocTimer::id_autoLockTimer); 730 doc->timer()->putLock(DocTimer::id_autoLockTimer);
731 return; 731 return;
732 } 732 }
733 BUG_ON(currItem.binary); 733 BUG_ON(currItem.binary);
734 734
735 AddEntryWndImpl w(doc); 735 AddEntryWndImpl w(doc);
736 vector<string> catList; 736 vector<string> catList;
737 doc->getCategoryList(&catList); 737 doc->getCategoryList(&catList);
738 unsigned i, size = catList.size(); 738 unsigned i, size = catList.size();
739 for (i = 0; i < size; ++i) { 739 for (i = 0; i < size; ++i) {
740 w.addCategory(catList[i].c_str()); 740 w.addCategory(catList[i].c_str());
741 } 741 }
742 w.setCurrCategory(curCategory); 742 w.setCurrCategory(curCategory);
743 w.setDescription(currItem.desc.c_str()); 743 w.setDescription(currItem.desc.c_str());
744 w.setUsername(currItem.name.c_str()); 744 w.setUsername(currItem.name.c_str());
745 w.setPassword(currItem.pw.c_str()); 745 w.setPassword(currItem.pw.c_str());
746 w.setUrl(currItem.url.c_str()); 746 w.setUrl(currItem.url.c_str());
747 w.setLauncher(currItem.launcher.c_str()); 747 w.setLauncher(currItem.launcher.c_str());
748 w.setComment(currItem.comment.c_str()); 748 w.setComment(currItem.comment.c_str());
749 if (w.exec() == 1) { 749 if (w.exec() == 1) {
750 currItem.desc = w.getDescription().latin1(); 750 currItem.desc = w.getDescription().latin1();
751 currItem.name = w.getUsername().latin1(); 751 currItem.name = w.getUsername().latin1();
752 currItem.pw = w.getPassword().latin1(); 752 currItem.pw = w.getPassword().latin1();
753 currItem.comment = w.getComment().latin1(); 753 currItem.comment = w.getComment().latin1();
754 currItem.url = w.getUrl().latin1(); 754 currItem.url = w.getUrl().latin1();
755 currItem.launcher = w.getLauncher().latin1(); 755 currItem.launcher = w.getLauncher().latin1();
756 if (!doc->editEntry(curCategory, w.getCategory(), 756 if (!doc->editEntry(curCategory, w.getCategory(),
757 curEntryIndex, &currItem)) { 757 curEntryIndex, &currItem)) {
758 KMessageBox::error(this, 758 KMessageBox::error(this,
759 i18n("Couldn't edit the entry.\n" 759 i18n("Couldn't edit the entry.\n"
760 "Maybe you changed the category and\n" 760 "Maybe you changed the category and\n"
761 "this entry is already present\nin the new " 761 "this entry is already present\nin the new "
762 "category?"), 762 "category?"),
763 i18n("couldn't edit entry.")); 763 i18n("couldn't edit entry."));
764 doc->timer()->putLock(DocTimer::id_autoLockTimer); 764 doc->timer()->putLock(DocTimer::id_autoLockTimer);
765 return; 765 return;
766 } 766 }
767 } 767 }
768 doc->timer()->putLock(DocTimer::id_autoLockTimer); 768 doc->timer()->putLock(DocTimer::id_autoLockTimer);
769} 769}
770 770
771void PwM::deletePwd_slot() 771void PwM::deletePwd_slot()
772{ 772{
773 PWM_ASSERT(curDoc()); 773 PWM_ASSERT(curDoc());
774 if (curDoc()->isDocEmpty()) 774 if (curDoc()->isDocEmpty())
775 return; 775 return;
776 if (curDoc()->isDeepLocked()) 776 if (curDoc()->isDeepLocked())
777 return; 777 return;
778 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 778 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
779 unsigned int curEntryIndex = 0; 779 unsigned int curEntryIndex = 0;
780 if (!(view->getCurEntryIndex(&curEntryIndex))) { 780 if (!(view->getCurEntryIndex(&curEntryIndex))) {
781 printDebug("couldn't get index"); 781 printDebug("couldn't get index");
782 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 782 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
783 return; 783 return;
784 } 784 }
785 785
786 PwMDataItem currItem; 786 PwMDataItem currItem;
787 QString curCategory = view->getCurrentCategory(); 787 QString curCategory = view->getCurrentCategory();
788 if (!curDoc()->getEntry(curCategory, curEntryIndex, &currItem)) { 788 if (!curDoc()->getEntry(curCategory, curEntryIndex, &currItem)) {
789 printDebug("couldn't get entry"); 789 printDebug("couldn't get entry");
790 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 790 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
791 return; 791 return;
792 } 792 }
793 if (KMessageBox:: 793 if (KMessageBox::
794 questionYesNo(this, 794 questionYesNo(this,
795 i18n 795 i18n
796 ("Do you really want to delete\nthe selected entry") + 796 ("Do you really want to delete\nthe selected entry") +
797 " \n\"" + QString(currItem.desc.c_str()) 797 " \n\"" + QString(currItem.desc.c_str())
798 + "\" ?", i18n("delete?")) 798 + "\" ?", i18n("delete?"))
799 == KMessageBox::Yes) { 799 == KMessageBox::Yes) {
800 800
801 curDoc()->delEntry(curCategory, curEntryIndex); 801 curDoc()->delEntry(curCategory, curEntryIndex);
802 } 802 }
803 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 803 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
804} 804}
805 805
806void PwM::changeMasterPwd_slot() 806void PwM::changeMasterPwd_slot()
807{ 807{
808 PWM_ASSERT(curDoc()); 808 PWM_ASSERT(curDoc());
809 curDoc()->changeCurrentPw(); 809 curDoc()->changeCurrentPw();
810} 810}
811 811
812void PwM::lockWnd_slot() 812void PwM::lockWnd_slot()
813{ 813{
814 PWM_ASSERT(curDoc()); 814 PWM_ASSERT(curDoc());
815 curDoc()->lockAll(true); 815 curDoc()->lockAll(true);
816} 816}
817 817
818void PwM::deepLockWnd_slot() 818void PwM::deepLockWnd_slot()
819{ 819{
820 PWM_ASSERT(curDoc()); 820 PWM_ASSERT(curDoc());
821 curDoc()->deepLock(); 821 curDoc()->deepLock();
822} 822}
823 823
824void PwM::unlockWnd_slot() 824void PwM::unlockWnd_slot()
825{ 825{
826 PWM_ASSERT(curDoc()); 826 PWM_ASSERT(curDoc());
827 curDoc()->lockAll(false); 827 curDoc()->lockAll(false);
828} 828}
829 829
830void PwM::config_slot() 830void PwM::config_slot()
831{ 831{
832 int oldStyle = conf()->confWndMainViewStyle(); 832 int oldStyle = conf()->confWndMainViewStyle();
833#ifdef PWM_EMBEDDED 833#ifdef PWM_EMBEDDED
834 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"pwmconfigdialog", true ); 834 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"pwmconfigdialog", true );
835 835
836 KCMPwmConfig* pwmcfg = new KCMPwmConfig( ConfigureDialog->getNewVBoxPage(i18n( "PwManager")) , "KCMPwmConfig" ); 836 KCMPwmConfig* pwmcfg = new KCMPwmConfig( ConfigureDialog->getNewVBoxPage(i18n( "PwManager")) , "KCMPwmConfig" );
837 ConfigureDialog->addModule(pwmcfg ); 837 ConfigureDialog->addModule(pwmcfg );
838 838
839 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); 839 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" );
840 ConfigureDialog->addModule(kdelibcfg ); 840 ConfigureDialog->addModule(kdelibcfg );
841 841
842#ifndef DESKTOP_VERSION 842#ifndef DESKTOP_VERSION
843 ConfigureDialog->showMaximized(); 843 ConfigureDialog->showMaximized();
844#endif 844#endif
845 if ( ConfigureDialog->exec() ) 845 if ( ConfigureDialog->exec() )
846 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); 846 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") );
847 delete ConfigureDialog; 847 delete ConfigureDialog;
848 848
849#else //PWM_EMBEDDED 849#else //PWM_EMBEDDED
850 // display the configuration window (modal mode) 850 // display the configuration window (modal mode)
851 if (!conf()->showConfWnd(this)) 851 if (!conf()->showConfWnd(this))
852 return; 852 return;
853#endif 853#endif
854 854
855 int newStyle = conf()->confWndMainViewStyle(); 855 int newStyle = conf()->confWndMainViewStyle();
856 // reinitialize tray 856 // reinitialize tray
857 init->initTray(); 857 init->initTray();
858 // reinitialize KWallet emulation 858 // reinitialize KWallet emulation
859 init->initKWalletEmu(); 859 init->initKWalletEmu();
860 860
861 PwMDocList *_dl = PwMDoc::getOpenDocList(); 861 PwMDocList *_dl = PwMDoc::getOpenDocList();
862 const vector<PwMDocList::listItem> *dl = _dl->getList(); 862 const vector<PwMDocList::listItem> *dl = _dl->getList();
863 vector<PwMDocList::listItem>::const_iterator i = dl->begin(), 863 vector<PwMDocList::listItem>::const_iterator i = dl->begin(),
864 end = dl->end(); 864 end = dl->end();
865 PwMDoc *doc; 865 PwMDoc *doc;
866 while (i != end) { 866 while (i != end) {
867 doc = (*i).doc; 867 doc = (*i).doc;
868 // unlock-without-mpw timeout 868 // unlock-without-mpw timeout
869 doc->timer()->start(DocTimer::id_mpwTimer); 869 doc->timer()->start(DocTimer::id_mpwTimer);
870 // auto-lock timeout 870 // auto-lock timeout
871 doc->timer()->start(DocTimer::id_autoLockTimer); 871 doc->timer()->start(DocTimer::id_autoLockTimer);
872 ++i; 872 ++i;
873 } 873 }
874 874
875 const QValueList<PwM *> *ml = init->mainWndList(); 875 const QValueList<PwM *> *ml = init->mainWndList();
876#ifndef PWM_EMBEDDED 876#ifndef PWM_EMBEDDED
877 QValueList<PwM *>::const_iterator i2 = ml->begin(), 877 QValueList<PwM *>::const_iterator i2 = ml->begin(),
878 end2 = ml->end(); 878 end2 = ml->end();
879#else 879#else
880 QValueList<PwM *>::ConstIterator i2 = ml->begin(), 880 QValueList<PwM *>::ConstIterator i2 = ml->begin(),
881 end2 = ml->end(); 881 end2 = ml->end();
882#endif 882#endif
883 PwM *pwm; 883 PwM *pwm;
884 while (i2 != end2) { 884 while (i2 != end2) {
885 pwm = *i2; 885 pwm = *i2;
886 // reinitialize the window style. 886 // reinitialize the window style.
887 if (oldStyle != newStyle) 887 if (oldStyle != newStyle)
888 pwm->curView()->initStyle(newStyle); 888 pwm->curView()->initStyle(newStyle);
889 // set the new font 889 // set the new font
890 pwm->curView()->setFont(conf()->confGlobEntryFont()); 890 pwm->curView()->setFont(conf()->confGlobEntryFont());
891 ++i2; 891 ++i2;
892 } 892 }
893} 893}
894 894
895void PwM::activateMpButton(bool activate) 895void PwM::activateMpButton(bool activate)
896{ 896{
897 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, activate); 897 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, activate);
898} 898}
899 899
900void PwM::closeEvent(QCloseEvent *e) 900void PwM::closeEvent(QCloseEvent *e)
901{ 901{
902 qDebug("PwM::closeEvent "); 902 //qDebug("PwM::closeEvent ");
903 emit closed( this ); 903 emit closed( this );
904 return; 904 return;
905 e->accept(); 905 e->accept();
906} 906}
907 907
908void PwM::docClosed(PwMDoc *doc) 908void PwM::docClosed(PwMDoc *doc)
909{ 909{
910 qDebug("PwM::docClosed "); 910 //qDebug("PwM::docClosed ");
911 PARAM_UNUSED(doc); 911 PARAM_UNUSED(doc);
912 PWM_ASSERT(doc == curDoc()); 912 PWM_ASSERT(doc == curDoc());
913 close(); 913 close();
914} 914}
915 915
916void PwM::find_slot() 916void PwM::find_slot()
917{ 917{
918 PWM_ASSERT(curDoc()); 918 PWM_ASSERT(curDoc());
919 if (curDoc()->isDocEmpty()) 919 if (curDoc()->isDocEmpty())
920 return; 920 return;
921 if (curDoc()->isDeepLocked()) 921 if (curDoc()->isDeepLocked())
922 return; 922 return;
923 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 923 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
924 FindWndImpl findWnd(view); 924 FindWndImpl findWnd(view);
925 findWnd.exec(); 925 findWnd.exec();
926 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 926 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
927} 927}
928 928
929void PwM::exportToText() 929void PwM::exportToText()
930{ 930{
931 PWM_ASSERT(curDoc()); 931 PWM_ASSERT(curDoc());
932 if (curDoc()->isDocEmpty()) { 932 if (curDoc()->isDocEmpty()) {
933 KMessageBox::information(this, 933 KMessageBox::information(this,
934 i18n 934 i18n
935 ("Sorry, there's nothing to export.\n" 935 ("Sorry, there's nothing to export.\n"
936 "Please first add some passwords."), 936 "Please first add some passwords."),
937 i18n("nothing to do")); 937 i18n("nothing to do"));
938 return; 938 return;
939 } 939 }
940 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 940 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
941 QString fn(KFileDialog::getSaveFileName(QString::null, 941 QString fn(KFileDialog::getSaveFileName(QString::null,
942 i18n("*|plain-text file"), 942 i18n("*|plain-text file"),
943 this)); 943 this));
944 if (fn == "") { 944 if (fn == "") {
945 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 945 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
946 return; 946 return;
947 } 947 }
948 948
949 PwMerror ret = curDoc()->exportToText(&fn); 949 PwMerror ret = curDoc()->exportToText(&fn);
950 if (ret != e_success) { 950 if (ret != e_success) {
951 KMessageBox::error(this, 951 KMessageBox::error(this,
952 i18n("Error: Couldn't write to file.\n" 952 i18n("Error: Couldn't write to file.\n"
953 "Please check if you have permission to write\n" 953 "Please check if you have permission to write\n"
954 "to the file in that directory."), 954 "to the file in that directory."),
955 i18n("error while writing")); 955 i18n("error while writing"));
956 } else 956 } else
957 showStatMsg(i18n("Successfully exported data.")); 957 showStatMsg(i18n("Successfully exported data."));
958 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 958 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
959} 959}
960 960
961bool PwM::importFromText() 961bool PwM::importFromText()
962{ 962{
963 if (!isVirgin()) { 963 if (!isVirgin()) {
964 if (KMessageBox::questionYesNo(this, 964 if (KMessageBox::questionYesNo(this,
965 i18n("Do you want to import the data\n" 965 i18n("Do you want to import the data\n"
966 "into the current document? (If you\n" 966 "into the current document? (If you\n"
967 "select \"no\", a new document will be\n" 967 "select \"no\", a new document will be\n"
968 "opened.)"), 968 "opened.)"),
969 i18n("import into this document?")) 969 i18n("import into this document?"))
970 == KMessageBox::No) { 970 == KMessageBox::No) {
971 // import the data to a new window. 971 // import the data to a new window.
972 PwM *newInstance = init->createMainWnd(); 972 PwM *newInstance = init->createMainWnd();
973 bool ok = newInstance->importFromText(); 973 bool ok = newInstance->importFromText();
974 if (!ok) { 974 if (!ok) {
975 newInstance->setForceQuit(true); 975 newInstance->setForceQuit(true);
976 delete_and_null(newInstance); 976 delete_and_null(newInstance);
977 } 977 }
978 return ok; 978 return ok;
979 } 979 }
980 } 980 }
981 981
982 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 982 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
983 PwMerror ret; 983 PwMerror ret;
984 QString path(KFileDialog::getOpenFileName(QString::null, 984 QString path(KFileDialog::getOpenFileName(QString::null,
985 i18n("*|PWM-exported text file"), 985 i18n("*|PWM-exported text file"),
986 this)); 986 this));
987 if (path == "") 987 if (path == "")
988 goto cancelImport; 988 goto cancelImport;
989 989
990 ret = curDoc()->importFromText(&path, 0); 990 ret = curDoc()->importFromText(&path, 0);
991 if (ret == e_fileFormat) { 991 if (ret == e_fileFormat) {
992 KMessageBox::error(this, 992 KMessageBox::error(this,
993 i18n("Could not read file-format.\n" 993 i18n("Could not read file-format.\n"
994 "This seems to be _not_ a valid file\n" 994 "This seems to be _not_ a valid file\n"
995 "exported by PwM."), 995 "exported by PwM."),
996 i18n("invalid file-format")); 996 i18n("invalid file-format"));
997 goto cancelImport; 997 goto cancelImport;
998 } else if (ret == e_invalidArg) { 998 } else if (ret == e_invalidArg) {
999 BUG(); 999 BUG();
1000 goto cancelImport; 1000 goto cancelImport;
1001 } else if (ret != e_success) { 1001 } else if (ret != e_success) {
1002 KMessageBox::error(this, 1002 KMessageBox::error(this,
1003 i18n("Could not import file!\n" 1003 i18n("Could not import file!\n"
1004 "Do you have permission to read this file?\n" 1004 "Do you have permission to read this file?\n"
1005 "Do you have enough free memory?"), 1005 "Do you have enough free memory?"),
1006 i18n("import failed")); 1006 i18n("import failed"));
1007 goto cancelImport; 1007 goto cancelImport;
1008 } 1008 }
1009 setVirgin(false); 1009 setVirgin(false);
1010 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1010 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1011 return true; 1011 return true;
1012 1012
1013cancelImport: 1013cancelImport:
1014 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1014 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1015 return false; 1015 return false;
1016} 1016}
1017 1017
1018void PwM::exportToGpasman() 1018void PwM::exportToGpasman()
1019{ 1019{
1020 PWM_ASSERT(curDoc()); 1020 PWM_ASSERT(curDoc());
1021 if (curDoc()->isDocEmpty()) { 1021 if (curDoc()->isDocEmpty()) {
1022 KMessageBox::information(this, 1022 KMessageBox::information(this,
1023 i18n 1023 i18n
1024 ("Sorry, there's nothing to export.\n" 1024 ("Sorry, there's nothing to export.\n"
1025 "Please first add some passwords."), 1025 "Please first add some passwords."),
1026 i18n("nothing to do")); 1026 i18n("nothing to do"));
1027 return; 1027 return;
1028 } 1028 }
1029 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 1029 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
1030 QString fn(KFileDialog::getSaveFileName(QString::null, 1030 QString fn(KFileDialog::getSaveFileName(QString::null,
1031 i18n("*|Gpasman or Kpasman file"), 1031 i18n("*|Gpasman or Kpasman file"),
1032 this)); 1032 this));
1033 if (fn == "") { 1033 if (fn == "") {
1034 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1034 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1035 return; 1035 return;
1036 } 1036 }
1037 1037
1038 PwMerror ret = curDoc()->exportToGpasman(&fn); 1038 PwMerror ret = curDoc()->exportToGpasman(&fn);
1039 if (ret != e_success) { 1039 if (ret != e_success) {
1040 if (ret == e_noPw) { 1040 if (ret == e_noPw) {
1041 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1041 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1042 return; 1042 return;
1043 } 1043 }
1044 KMessageBox::error(this, 1044 KMessageBox::error(this,
1045 i18n("Error: Couldn't write to file.\n" 1045 i18n("Error: Couldn't write to file.\n"
1046 "Please check if you have permission to write " 1046 "Please check if you have permission to write "
1047 "to the file in that directory."), 1047 "to the file in that directory."),
1048 i18n("error while writing")); 1048 i18n("error while writing"));
1049 } else 1049 } else
1050 showStatMsg(i18n("Successfully exported data.")); 1050 showStatMsg(i18n("Successfully exported data."));
1051 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1051 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1052} 1052}
1053 1053
1054 1054
1055 1055
1056void PwM::exportToCsv() 1056void PwM::exportToCsv()
1057{ 1057{
1058 PWM_ASSERT(curDoc()); 1058 PWM_ASSERT(curDoc());
1059 if (curDoc()->isDocEmpty()) { 1059 if (curDoc()->isDocEmpty()) {
1060 KMessageBox::information(this, 1060 KMessageBox::information(this,
1061 i18n 1061 i18n
1062 ("Sorry, there is nothing to export;\n" 1062 ("Sorry, there is nothing to export;\n"
1063 "please add some passwords first."), 1063 "please add some passwords first."),
1064 i18n("Nothing to Do")); 1064 i18n("Nothing to Do"));
1065 return; 1065 return;
1066 } 1066 }
1067 1067
1068 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 1068 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
1069 QString fn(KFileDialog::getSaveFileName("*.csv", i18n("*|CSV Text File"), this)); 1069 QString fn(KFileDialog::getSaveFileName("*.csv", i18n("*|CSV Text File"), this));
1070 if (fn.isEmpty()) { 1070 if (fn.isEmpty()) {
1071 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1071 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1072 return; 1072 return;
1073 } 1073 }
1074 1074
1075 Csv csv(this); 1075 Csv csv(this);
1076 if (!csv.exportData(fn, curDoc())) { 1076 if (!csv.exportData(fn, curDoc())) {
1077 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1077 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1078 showStatMsg(i18n("CSV file export failed.")); 1078 showStatMsg(i18n("CSV file export failed."));
1079 return; 1079 return;
1080 } 1080 }
1081 showStatMsg(i18n("Successfully exported data.")); 1081 showStatMsg(i18n("Successfully exported data."));
1082 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1082 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1083} 1083}
1084 1084
1085bool PwM::importCsv() 1085bool PwM::importCsv()
1086{ 1086{
1087 Csv csv(this); 1087 Csv csv(this);
1088 if (!isVirgin()) { 1088 if (!isVirgin()) {
1089 if (KMessageBox::questionYesNo(this, 1089 if (KMessageBox::questionYesNo(this,
1090 i18n("Do you want to import the data\n" 1090 i18n("Do you want to import the data\n"
1091 "into the current document? (If you\n" 1091 "into the current document? (If you\n"
1092 "select \"no\", a new document will be\n" 1092 "select \"no\", a new document will be\n"
1093 "opened.)"), 1093 "opened.)"),
1094 i18n("Import into This Document?")) 1094 i18n("Import into This Document?"))
1095 == KMessageBox::No) { 1095 == KMessageBox::No) {
1096 // import the data to a new window. 1096 // import the data to a new window.
1097 PwM *newInstance = init->createMainWnd(); 1097 PwM *newInstance = init->createMainWnd();
1098 bool ok = newInstance->importCsv(); 1098 bool ok = newInstance->importCsv();
1099 if (!ok) { 1099 if (!ok) {
1100 newInstance->setForceQuit(true); 1100 newInstance->setForceQuit(true);
1101 delete_and_null(newInstance); 1101 delete_and_null(newInstance);
1102 } 1102 }
1103 return ok; 1103 return ok;
1104 } 1104 }
1105 } 1105 }
1106 1106
1107 QString filename = KFileDialog::getOpenFileName("*.csv", i18n("*|CSV Text File"), this); 1107 QString filename = KFileDialog::getOpenFileName("*.csv", i18n("*|CSV Text File"), this);
1108 if (filename.isEmpty()) 1108 if (filename.isEmpty())
1109 return false; 1109 return false;
1110 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 1110 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
1111 if (!csv.importData(filename, curDoc())) { 1111 if (!csv.importData(filename, curDoc())) {
1112 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1112 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1113 showStatMsg(i18n("CSV file import failed.")); 1113 showStatMsg(i18n("CSV file import failed."));
1114 return false; 1114 return false;
1115 } 1115 }
1116 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1116 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1117 KMessageBox::information(this, 1117 KMessageBox::information(this,
1118 i18n("Successfully imported the CSV data\n" 1118 i18n("Successfully imported the CSV data\n"
1119 "into the current document."), i18n("Successfully Imported")); 1119 "into the current document."), i18n("Successfully Imported"));
1120 showStatMsg(i18n("Successfully imported")); 1120 showStatMsg(i18n("Successfully imported"));
1121 setVirgin(false); 1121 setVirgin(false);
1122 return true; 1122 return true;
1123} 1123}
1124 1124
1125 1125
1126void PwM::exportToKWallet() 1126void PwM::exportToKWallet()
1127{ 1127{
1128#ifdef CONFIG_KWALLETIF 1128#ifdef CONFIG_KWALLETIF
1129 if (!checkAndAskForKWalletEmu()) 1129 if (!checkAndAskForKWalletEmu())
1130 return; 1130 return;
1131 PWM_ASSERT(curDoc()); 1131 PWM_ASSERT(curDoc());
1132 if (curDoc()->isDocEmpty()) { 1132 if (curDoc()->isDocEmpty()) {
1133 KMessageBox::information(this, 1133 KMessageBox::information(this,
1134 i18n 1134 i18n
1135 ("Sorry, there's nothing to export.\n" 1135 ("Sorry, there's nothing to export.\n"
1136 "Please first add some passwords."), 1136 "Please first add some passwords."),
1137 i18n("nothing to do")); 1137 i18n("nothing to do"));
1138 init->initKWalletEmu(); 1138 init->initKWalletEmu();
1139 return; 1139 return;
1140 } 1140 }
1141 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 1141 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
1142 KWalletIf walletIf(this); 1142 KWalletIf walletIf(this);
1143 if (walletIf.kwalletExport(curDoc())) { 1143 if (walletIf.kwalletExport(curDoc())) {
1144 KMessageBox::information(this, 1144 KMessageBox::information(this,
1145 i18n("Successfully exported the data of the current " 1145 i18n("Successfully exported the data of the current "
1146 "document to KWallet."), 1146 "document to KWallet."),
1147 i18n("Successfully exported data.")); 1147 i18n("Successfully exported data."));
1148 showStatMsg(i18n("Successfully exported data.")); 1148 showStatMsg(i18n("Successfully exported data."));
1149 } 1149 }
1150 init->initKWalletEmu(); 1150 init->initKWalletEmu();
1151 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1151 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1152#endif // CONFIG_KWALLETIF 1152#endif // CONFIG_KWALLETIF
1153} 1153}
1154 1154
1155bool PwM::importFromGpasman() 1155bool PwM::importFromGpasman()
1156{ 1156{
1157 if (!isVirgin()) { 1157 if (!isVirgin()) {
1158 if (KMessageBox::questionYesNo(this, 1158 if (KMessageBox::questionYesNo(this,
1159 i18n("Do you want to import the data\n" 1159 i18n("Do you want to import the data\n"
1160 "into the current document? (If you\n" 1160 "into the current document? (If you\n"
1161 "select \"no\", a new document will be\n" 1161 "select \"no\", a new document will be\n"
1162 "opened.)"), 1162 "opened.)"),
1163 i18n("import into this document?")) 1163 i18n("import into this document?"))
1164 == KMessageBox::No) { 1164 == KMessageBox::No) {
1165 // import the data to a new window. 1165 // import the data to a new window.
1166 PwM *newInstance = init->createMainWnd(); 1166 PwM *newInstance = init->createMainWnd();
1167 bool ok = newInstance->importFromGpasman(); 1167 bool ok = newInstance->importFromGpasman();
1168 if (!ok) { 1168 if (!ok) {
1169 newInstance->setForceQuit(true); 1169 newInstance->setForceQuit(true);
1170 delete_and_null(newInstance); 1170 delete_and_null(newInstance);
1171 } 1171 }
1172 return ok; 1172 return ok;
1173 } 1173 }
1174 } 1174 }
1175 1175
1176 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 1176 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
1177 PwMerror ret; 1177 PwMerror ret;
1178 QString path(KFileDialog::getOpenFileName(QString::null, 1178 QString path(KFileDialog::getOpenFileName(QString::null,
1179 i18n("*|Gpasman or Kpasman file"), this)); 1179 i18n("*|Gpasman or Kpasman file"), this));
1180 if (path == "") 1180 if (path == "")
1181 goto cancelImport; 1181 goto cancelImport;
1182 ret = curDoc()->importFromGpasman(&path); 1182 ret = curDoc()->importFromGpasman(&path);
1183 if (ret == e_wrongPw) { 1183 if (ret == e_wrongPw) {
1184 if (KMessageBox::questionYesNo(this, 1184 if (KMessageBox::questionYesNo(this,
1185 i18n 1185 i18n
1186 ("This is probably the wrong master-password\n" 1186 ("This is probably the wrong master-password\n"
1187 "you have typed in.\n" 1187 "you have typed in.\n"
1188 "There is no real way to determine the\n" 1188 "There is no real way to determine the\n"
1189 "correctness of the password in the Gpasman\n" 1189 "correctness of the password in the Gpasman\n"
1190 "file-format. But I think this\n" 1190 "file-format. But I think this\n"
1191 "password ist wrong.\n" 1191 "password ist wrong.\n"
1192 "Do you want to continue nevertheless?"), 1192 "Do you want to continue nevertheless?"),
1193 i18n("password error")) 1193 i18n("password error"))
1194 == KMessageBox::No) { 1194 == KMessageBox::No) {
1195 goto cancelImport; 1195 goto cancelImport;
1196 } 1196 }
1197 } else if (ret != e_success) { 1197 } else if (ret != e_success) {
1198 KMessageBox::error(this, 1198 KMessageBox::error(this,
1199 i18n("Could not import file!\n" 1199 i18n("Could not import file!\n"
1200 "Do you have permission to read this file?"), 1200 "Do you have permission to read this file?"),
1201 i18n("import failed")); 1201 i18n("import failed"));
1202 goto cancelImport; 1202 goto cancelImport;
1203 } 1203 }
1204 setVirgin(false); 1204 setVirgin(false);
1205 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1205 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1206 return true; 1206 return true;
1207 1207
1208cancelImport: 1208cancelImport:
1209 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1209 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1210 return false; 1210 return false;
1211} 1211}
1212 1212
1213#ifdef CONFIG_KWALLETIF 1213#ifdef CONFIG_KWALLETIF
1214bool PwM::checkAndAskForKWalletEmu() 1214bool PwM::checkAndAskForKWalletEmu()
1215{ 1215{
1216 if (init->kwalletEmu()) { 1216 if (init->kwalletEmu()) {
1217 /* KWallet emulation is enabled. We can't import/export 1217 /* KWallet emulation is enabled. We can't import/export
1218 * data from/to it, while emulation is active. 1218 * data from/to it, while emulation is active.
1219 */ 1219 */
1220 if (KMessageBox::questionYesNo(this, 1220 if (KMessageBox::questionYesNo(this,
1221 i18n("KWallet emulation is enabled.\n" 1221 i18n("KWallet emulation is enabled.\n"
1222 "You can't import or export data from/to " 1222 "You can't import or export data from/to "
1223 "the original KWallet, while the emulation " 1223 "the original KWallet, while the emulation "
1224 "is active.\n" 1224 "is active.\n"
1225 "Do you want to tempoarly disable the KWallet emulation?"), 1225 "Do you want to tempoarly disable the KWallet emulation?"),
1226 i18n("Tempoarly disable KWallet emulation?")) 1226 i18n("Tempoarly disable KWallet emulation?"))
1227 == KMessageBox::Yes) { 1227 == KMessageBox::Yes) {
1228 init->initKWalletEmu(true); 1228 init->initKWalletEmu(true);
1229 PWM_ASSERT(!init->kwalletEmu()); 1229 PWM_ASSERT(!init->kwalletEmu());
1230 return true; 1230 return true;
1231 } 1231 }
1232 return false; 1232 return false;
1233 } 1233 }
1234 return true; 1234 return true;
1235} 1235}
1236#endif // CONFIG_KWALLETIF 1236#endif // CONFIG_KWALLETIF
1237 1237
1238bool PwM::importKWallet() 1238bool PwM::importKWallet()
1239{ 1239{
1240#ifdef CONFIG_KWALLETIF 1240#ifdef CONFIG_KWALLETIF
1241 if (!checkAndAskForKWalletEmu()) 1241 if (!checkAndAskForKWalletEmu())
1242 return false; 1242 return false;
1243 KWalletIf walletIf(this); 1243 KWalletIf walletIf(this);
1244 if (!isVirgin()) { 1244 if (!isVirgin()) {
1245 if (KMessageBox::questionYesNo(this, 1245 if (KMessageBox::questionYesNo(this,
1246 i18n("Do you want to import the data " 1246 i18n("Do you want to import the data "
1247 "into the current document? (If you " 1247 "into the current document? (If you "
1248 "select \"no\", a new document will be " 1248 "select \"no\", a new document will be "
1249 "opened.)"), 1249 "opened.)"),
1250 i18n("import into this document?")) 1250 i18n("import into this document?"))
1251 == KMessageBox::No) { 1251 == KMessageBox::No) {
1252 // import the data to a new window. 1252 // import the data to a new window.
1253 PwM *newInstance = init->createMainWnd(); 1253 PwM *newInstance = init->createMainWnd();
1254 bool ok = newInstance->importKWallet(); 1254 bool ok = newInstance->importKWallet();
1255 if (!ok) { 1255 if (!ok) {
1256 newInstance->setForceQuit(true); 1256 newInstance->setForceQuit(true);
1257 delete_and_null(newInstance); 1257 delete_and_null(newInstance);
1258 goto exit_fail; 1258 goto exit_fail;
1259 } else { 1259 } else {
1260 goto exit_ok; 1260 goto exit_ok;
1261 } 1261 }
1262 } 1262 }
1263 } 1263 }
1264 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 1264 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
1265 if (!walletIf.kwalletImport(curDoc())) { 1265 if (!walletIf.kwalletImport(curDoc())) {
1266 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1266 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1267 showStatMsg(i18n("KWallet import failed")); 1267 showStatMsg(i18n("KWallet import failed"));
1268 goto exit_fail; 1268 goto exit_fail;
1269 } 1269 }
1270 KMessageBox::information(this, 1270 KMessageBox::information(this,
1271 i18n("Successfully imported the KWallet data " 1271 i18n("Successfully imported the KWallet data "
1272 "into the current document."), 1272 "into the current document."),
1273 i18n("successfully imported")); 1273 i18n("successfully imported"));
1274 showStatMsg(i18n("successfully imported")); 1274 showStatMsg(i18n("successfully imported"));
1275 setVirgin(false); 1275 setVirgin(false);
1276 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1276 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1277 1277
1278exit_ok: 1278exit_ok:
1279 init->initKWalletEmu(); 1279 init->initKWalletEmu();
1280 return true; 1280 return true;
1281 1281
1282exit_fail: 1282exit_fail:
1283 init->initKWalletEmu(); 1283 init->initKWalletEmu();
1284#endif // CONFIG_KWALLETIF 1284#endif // CONFIG_KWALLETIF
1285 return false; 1285 return false;
1286} 1286}
1287 1287
1288void PwM::print_slot() 1288void PwM::print_slot()
1289{ 1289{
1290 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 1290 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
1291#ifndef PWM_EMBEDDED 1291#ifndef PWM_EMBEDDED
1292 PwMPrint p(curDoc(), this); 1292 PwMPrint p(curDoc(), this);
1293 p.printNow(); 1293 p.printNow();
1294#else 1294#else
1295 qDebug("PwM::print_slot , PRINTING IS NOT IMPLEMENTED"); 1295 qDebug("PwM::print_slot , PRINTING IS NOT IMPLEMENTED");
1296#endif 1296#endif
1297 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1297 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1298} 1298}
1299 1299
1300void PwM::genNewCard_slot() 1300void PwM::genNewCard_slot()
1301{ 1301{
1302#ifdef CONFIG_KEYCARD 1302#ifdef CONFIG_KEYCARD
1303 init->keycard()->genNewCard(); 1303 init->keycard()->genNewCard();
1304#endif 1304#endif
1305} 1305}
1306 1306
1307void PwM::eraseCard_slot() 1307void PwM::eraseCard_slot()
1308{ 1308{
1309#ifdef CONFIG_KEYCARD 1309#ifdef CONFIG_KEYCARD
1310 init->keycard()->eraseCard(); 1310 init->keycard()->eraseCard();
1311#endif 1311#endif
1312} 1312}
1313 1313
1314void PwM::readCardId_slot() 1314void PwM::readCardId_slot()
1315{ 1315{
1316#ifdef CONFIG_KEYCARD 1316#ifdef CONFIG_KEYCARD
1317 init->keycard()->displayKey(); 1317 init->keycard()->displayKey();
1318#endif 1318#endif
1319} 1319}
1320 1320
1321void PwM::makeCardBackup_slot() 1321void PwM::makeCardBackup_slot()
1322{ 1322{
1323#ifdef CONFIG_KEYCARD 1323#ifdef CONFIG_KEYCARD
1324 init->keycard()->makeBackupImage(); 1324 init->keycard()->makeBackupImage();
1325#endif 1325#endif
1326} 1326}
1327 1327
1328void PwM::replayCardBackup_slot() 1328void PwM::replayCardBackup_slot()
1329{ 1329{
1330#ifdef CONFIG_KEYCARD 1330#ifdef CONFIG_KEYCARD
1331 init->keycard()->replayBackupImage(); 1331 init->keycard()->replayBackupImage();
1332#endif 1332#endif
1333} 1333}
1334 1334
1335void PwM::execLauncher_slot() 1335void PwM::execLauncher_slot()
1336{ 1336{
1337 PWM_ASSERT(curDoc()); 1337 PWM_ASSERT(curDoc());
1338 if (curDoc()->isDeepLocked()) 1338 if (curDoc()->isDeepLocked())
1339 return; 1339 return;
1340 unsigned int curEntryIndex; 1340 unsigned int curEntryIndex;
1341 if (!view->getCurEntryIndex(&curEntryIndex)) 1341 if (!view->getCurEntryIndex(&curEntryIndex))
1342 return; 1342 return;
1343 bool ret = curDoc()->execLauncher(view->getCurrentCategory(), 1343 bool ret = curDoc()->execLauncher(view->getCurrentCategory(),
1344 curEntryIndex); 1344 curEntryIndex);
1345 if (ret) 1345 if (ret)
1346 showStatMsg(i18n("Executed the \"Launcher\".")); 1346 showStatMsg(i18n("Executed the \"Launcher\"."));
1347 else 1347 else
1348 showStatMsg(i18n("ERROR: Couldn't execute the \"Launcher\"!")); 1348 showStatMsg(i18n("ERROR: Couldn't execute the \"Launcher\"!"));
1349} 1349}
1350 1350
1351void PwM::goToURL_slot() 1351void PwM::goToURL_slot()
1352{ 1352{
1353 PWM_ASSERT(curDoc()); 1353 PWM_ASSERT(curDoc());
1354 if (curDoc()->isDeepLocked()) 1354 if (curDoc()->isDeepLocked())
1355 return; 1355 return;
1356 unsigned int curEntryIndex; 1356 unsigned int curEntryIndex;
1357 if (!view->getCurEntryIndex(&curEntryIndex)) 1357 if (!view->getCurEntryIndex(&curEntryIndex))
1358 return; 1358 return;
1359 bool ret = curDoc()->goToURL(view->getCurrentCategory(), 1359 bool ret = curDoc()->goToURL(view->getCurrentCategory(),
1360 curEntryIndex); 1360 curEntryIndex);
1361 if (ret) 1361 if (ret)
1362 showStatMsg(i18n("started browser with current URL.")); 1362 showStatMsg(i18n("started browser with current URL."));
1363 else 1363 else
1364 showStatMsg(i18n("ERROR: Couldn't start browser! Maybe invalid URL?")); 1364 showStatMsg(i18n("ERROR: Couldn't start browser! Maybe invalid URL?"));
1365} 1365}
1366 1366
1367void PwM::copyToClipboard(const QString &s) 1367void PwM::copyToClipboard(const QString &s)
1368{ 1368{
1369 QClipboard *cb = QApplication::clipboard(); 1369 QClipboard *cb = QApplication::clipboard();
1370#ifndef PWM_EMBEDDED 1370#ifndef PWM_EMBEDDED
1371 if (cb->supportsSelection()) 1371 if (cb->supportsSelection())
1372 cb->setText(s, QClipboard::Selection); 1372 cb->setText(s, QClipboard::Selection);
1373 cb->setText(s, QClipboard::Clipboard); 1373 cb->setText(s, QClipboard::Clipboard);
1374#else 1374#else
1375 cb->setText(s); 1375 cb->setText(s);
1376 1376
1377#endif 1377#endif
1378 1378
1379} 1379}
1380 1380
1381 1381
1382void PwM::showStatMsg(const QString &msg) 1382void PwM::showStatMsg(const QString &msg)
1383{ 1383{
1384#ifdef DESKTOP_VERSION 1384#ifdef DESKTOP_VERSION
1385 statusBar()->message(msg, STATUSBAR_MSG_TIMEOUT * 1000); 1385 statusBar()->message(msg, STATUSBAR_MSG_TIMEOUT * 1000);
1386#else 1386#else
1387 qDebug("Statusbar : %s",msg.latin1()); 1387 //qDebug("Statusbar : %s",msg.latin1());
1388 Global::statusMessage(msg); 1388 Global::statusMessage(msg);
1389#endif 1389#endif
1390} 1390}
1391 1391
1392void PwM::focusInEvent(QFocusEvent *e) 1392void PwM::focusInEvent(QFocusEvent *e)
1393{ 1393{
1394 if (e->gotFocus()) { 1394 if (e->gotFocus()) {
1395 emit gotFocus(this); 1395 emit gotFocus(this);
1396 } else if (e->lostFocus()) { 1396 } else if (e->lostFocus()) {
1397 emit lostFocus(this); 1397 emit lostFocus(this);
1398 } 1398 }
1399} 1399}
1400 1400
1401 1401
1402#ifdef PWM_EMBEDDED 1402#ifdef PWM_EMBEDDED
1403 1403
1404void PwM::category_slot() 1404void PwM::category_slot()
1405{ 1405{
1406 PwMDoc *doc = curDoc(); 1406 PwMDoc *doc = curDoc();
1407 PWM_ASSERT(doc); 1407 PWM_ASSERT(doc);
1408 doc->timer()->getLock(DocTimer::id_autoLockTimer); 1408 doc->timer()->getLock(DocTimer::id_autoLockTimer);
1409 1409
1410 editCategoryWnd w(doc, this, "editcategory"); 1410 editCategoryWnd w(doc, this, "editcategory");
1411/* 1411/*
1412 vector<string> catList; 1412 vector<string> catList;
1413 doc->getCategoryList(&catList); 1413 doc->getCategoryList(&catList);
1414 unsigned i, size = catList.size(); 1414 unsigned i, size = catList.size();
1415 for (i = 0; i < size; ++i) { 1415 for (i = 0; i < size; ++i) {
1416 w.addCategory(catList[i].c_str()); 1416 w.addCategory(catList[i].c_str());
1417 } 1417 }
1418 w.setCurrCategory(view->getCurrentCategory()); 1418 w.setCurrCategory(view->getCurrentCategory());
1419 if (pw) 1419 if (pw)
1420 w.pwLineEdit->setText(*pw); 1420 w.pwLineEdit->setText(*pw);
1421*/ 1421*/
1422 w.setCurrCategory(view->getCurrentCategory()); 1422 w.setCurrCategory(view->getCurrentCategory());
1423 1423
1424 tryAgain: 1424 tryAgain:
1425 if (w.exec() == 1) 1425 if (w.exec() == 1)
1426 { 1426 {
1427 PwMDataItem d; 1427 PwMDataItem d;
1428 1428
1429 //US BUG: to initialize all values of curEntr with meaningfulldata, 1429 //US BUG: to initialize all values of curEntr with meaningfulldata,
1430 // we call clear on it. Reason: Metadata will be uninitialized otherwise. 1430 // we call clear on it. Reason: Metadata will be uninitialized otherwise.
1431 // another option would be to create a constructor for PwMDataItem 1431 // another option would be to create a constructor for PwMDataItem
1432 d.clear(true); 1432 d.clear(true);
1433 /* 1433 /*
1434 d.desc = w.getDescription().latin1(); 1434 d.desc = w.getDescription().latin1();
1435 d.name = w.getUsername().latin1(); 1435 d.name = w.getUsername().latin1();
1436 d.pw = w.getPassword().latin1(); 1436 d.pw = w.getPassword().latin1();
1437 d.comment = w.getComment().latin1(); 1437 d.comment = w.getComment().latin1();
1438 d.url = w.getUrl().latin1(); 1438 d.url = w.getUrl().latin1();
1439 d.launcher = w.getLauncher().latin1(); 1439 d.launcher = w.getLauncher().latin1();
1440 PwMerror ret = doc->addEntry(w.getCategory(), &d); 1440 PwMerror ret = doc->addEntry(w.getCategory(), &d);
1441 if (ret == e_entryExists) { 1441 if (ret == e_entryExists) {
1442 KMessageBox::error(this, 1442 KMessageBox::error(this,
1443 i18n 1443 i18n
1444 ("An entry with this \"Description\",\n" 1444 ("An entry with this \"Description\",\n"
1445 "does already exist.\n" 1445 "does already exist.\n"
1446 "Please select another description."), 1446 "Please select another description."),
1447 i18n("entry already exists.")); 1447 i18n("entry already exists."));
1448 goto tryAgain; 1448 goto tryAgain;
1449 } else if (ret == e_maxAllowedEntr) { 1449 } else if (ret == e_maxAllowedEntr) {
1450 KMessageBox::error(this, i18n("The maximum possible number of\nentries" 1450 KMessageBox::error(this, i18n("The maximum possible number of\nentries"
1451 "has been reached.\nYou can't add more entries."), 1451 "has been reached.\nYou can't add more entries."),
1452 i18n("maximum number of entries")); 1452 i18n("maximum number of entries"));
1453 doc->timer()->putLock(DocTimer::id_autoLockTimer); 1453 doc->timer()->putLock(DocTimer::id_autoLockTimer);
1454 return; 1454 return;
1455 } 1455 }
1456 */ 1456 */
1457 } 1457 }
1458 setVirgin(false); 1458 setVirgin(false);
1459 doc->timer()->putLock(DocTimer::id_autoLockTimer); 1459 doc->timer()->putLock(DocTimer::id_autoLockTimer);
1460} 1460}
1461 1461
1462 1462
1463void PwM::whatsnew_slot() 1463void PwM::whatsnew_slot()
1464{ 1464{
1465 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1465 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1466} 1466}
1467 1467
1468void PwM::showLicense_slot() 1468void PwM::showLicense_slot()
1469{ 1469{
1470 KApplication::showLicence(); 1470 KApplication::showLicence();
1471} 1471}
1472 1472
1473void PwM::faq_slot() 1473void PwM::faq_slot()
1474{ 1474{
1475 KApplication::showFile( "PWM/Pi FAQ", "kdepim/pwmanager/pwmanagerFAQ.txt" ); 1475 KApplication::showFile( "PWM/Pi FAQ", "kdepim/pwmanager/pwmanagerFAQ.txt" );
1476} 1476}
1477 1477
1478void PwM::syncHowTo_slot() 1478void PwM::syncHowTo_slot()
1479{ 1479{
1480 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1480 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1481} 1481}
1482 1482
1483 1483
1484void PwM::createAboutData_slot() 1484void PwM::createAboutData_slot()
1485{ 1485{
1486 QString version; 1486 QString version;
1487#include <../version> 1487#include <../version>
1488; 1488;
1489 QMessageBox::about( this, "About PwManager/Pi", 1489 QMessageBox::about( this, "About PwManager/Pi",
1490 "PwManager/Platform-independent\n" 1490 "PwManager/Platform-independent\n"
1491 "(PWM/Pi) " +version + " - " + 1491 "(PWM/Pi) " +version + " - " +
1492#ifdef DESKTOP_VERSION 1492#ifdef DESKTOP_VERSION
1493 "Desktop Edition\n" 1493 "Desktop Edition\n"
1494#else 1494#else
1495 "PDA-Edition\n" 1495 "PDA-Edition\n"
1496 "for: Zaurus 5500 / 7x0 / 8x0\n" 1496 "for: Zaurus 5500 / 7x0 / 8x0\n"
1497#endif 1497#endif
1498 1498
1499 "(c) 2004 Ulf Schenk\n" 1499 "(c) 2004 Ulf Schenk\n"
1500 "(c) 2004 Lutz Rogowski\n" 1500 "(c) 2004 Lutz Rogowski\n"
1501 "(c) 1997-2004, The KDE PIM Team\n" 1501 "(c) 1997-2004, The KDE PIM Team\n"
1502 1502
1503 "(c) Michael Buesch - main programming\nand current maintainer\nmbuesch@freenet.de\n" 1503 "(c) Michael Buesch - main programming\nand current maintainer\nmbuesch@freenet.de\n"
1504 "Matt Scifo - mscifo@o1.com\n" 1504 "Matt Scifo - mscifo@o1.com\n"
1505 "Elias Probst - elias.probst@gmx.de\n" 1505 "Elias Probst - elias.probst@gmx.de\n"
1506 "George Staikos - staikos@kde.org\n" 1506 "George Staikos - staikos@kde.org\n"
1507 "Matthew Palmer - mjp16@uow.edu.au\n" 1507 "Matthew Palmer - mjp16@uow.edu.au\n"
1508 "Olivier Sessink - gpasman@nl.linux.org\n" 1508 "Olivier Sessink - gpasman@nl.linux.org\n"
1509 "The libgcrypt developers -\nBlowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n" 1509 "The libgcrypt developers -\nBlowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n"
1510 "Troy Engel - tengel@sonic.net\n" 1510 "Troy Engel - tengel@sonic.net\n"
1511 "Wickey - wickey@gmx.at\n" 1511 "Wickey - wickey@gmx.at\n"
1512 "Ian MacGregor - original documentation author.\n" 1512 "Ian MacGregor - original documentation author.\n"
1513 ); 1513 );
1514} 1514}
1515 1515
1516 1516
1517//this are the overwritten callbackmethods from the syncinterface 1517//this are the overwritten callbackmethods from the syncinterface
1518bool PwM::sync(KSyncManager* manager, QString filename, int mode) 1518bool PwM::sync(KSyncManager* manager, QString filename, int mode)
1519{ 1519{
1520 PWM_ASSERT(curDoc()); 1520 PWM_ASSERT(curDoc());
1521 1521
1522 bool ret = curDoc()->sync(manager, filename, mode); 1522 bool ret = curDoc()->sync(manager, filename, mode);
1523 1523
1524 qDebug("PwM::sync save now: ret=%i", ret); 1524 qDebug("PwM::sync save now: ret=%i", ret);
1525 1525
1526 if (ret == true) { 1526 if (ret == true) {
1527 //US BUG: what can we call here to update the view of the current doc? 1527 //US BUG: what can we call here to update the view of the current doc?
1528 //mViewManager->refreshView(); 1528 //mViewManager->refreshView();
1529 1529
1530 //US curDoc()->sync sets the dirtyFlag in case the sync was successfull. 1530 //US curDoc()->sync sets the dirtyFlag in case the sync was successfull.
1531 save(); 1531 save();
1532 } 1532 }
1533 1533
1534 return ret; 1534 return ret;
1535} 1535}
1536 1536
1537void PwM::removeSyncInfo( QString syncProfile) 1537void PwM::removeSyncInfo( QString syncProfile)
1538{ 1538{
1539 qDebug("PWM:removeSyncInfo for profile %s ", syncProfile.latin1()); 1539 qDebug("PWM:removeSyncInfo for profile %s ", syncProfile.latin1());
1540 curDoc()->removeSyncInfo( syncProfile ); 1540 curDoc()->removeSyncInfo( syncProfile );
1541 //US curDoc()->removeSyncInfo sets the dirtyFlag. 1541 //US curDoc()->removeSyncInfo sets the dirtyFlag.
1542} 1542}
1543 1543
1544#endif 1544#endif
1545 1545
1546 1546
1547#ifndef PWM_EMBEDDED 1547#ifndef PWM_EMBEDDED
1548#include "pwm.moc" 1548#include "pwm.moc"
1549#endif 1549#endif
diff --git a/pwmanager/pwmanager/pwminit.cpp b/pwmanager/pwmanager/pwminit.cpp
index 0cf248c..d59d4d8 100644
--- a/pwmanager/pwmanager/pwminit.cpp
+++ b/pwmanager/pwmanager/pwminit.cpp
@@ -1,661 +1,661 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * copyright (C) 2004 by Michael Buesch * 3 * copyright (C) 2004 by Michael Buesch *
4 * email: mbuesch@freenet.de * 4 * email: mbuesch@freenet.de *
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 version 2 * 7 * it under the terms of the GNU General Public License version 2 *
8 * as published by the Free Software Foundation. * 8 * as published by the Free Software Foundation. *
9 * * 9 * *
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12/*************************************************************************** 12/***************************************************************************
13 * copyright (C) 2004 by Ulf Schenk 13 * copyright (C) 2004 by Ulf Schenk
14 * This file is originaly based on version 1.0.1 of pwmanager 14 * This file is originaly based on version 1.0.1 of pwmanager
15 * and was modified to run on embedded devices that run microkde 15 * and was modified to run on embedded devices that run microkde
16 * 16 *
17 * $Id$ 17 * $Id$
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#include "pwminit.h" 20#include "pwminit.h"
21#include "randomizer.h" 21#include "randomizer.h"
22#include <qdir.h> 22#include <qdir.h>
23 23
24#ifndef PWM_EMBEDDED 24#ifndef PWM_EMBEDDED
25#include "selftest.h" 25#include "selftest.h"
26#include "configuration.h" 26#include "configuration.h"
27#else 27#else
28#include "pwmprefs.h" 28#include "pwmprefs.h"
29#endif 29#endif
30 30
31#include "pwm.h" 31#include "pwm.h"
32#include "pwmexception.h" 32#include "pwmexception.h"
33#include "pwmtray.h" 33#include "pwmtray.h"
34#include "pwmdoc.h" 34#include "pwmdoc.h"
35 35
36#ifdef CONFIG_KWALLETIF 36#ifdef CONFIG_KWALLETIF
37# include "kwalletemu.h" 37# include "kwalletemu.h"
38#endif // CONFIG_KWALLETIF 38#endif // CONFIG_KWALLETIF
39#ifdef CONFIG_KEYCARD 39#ifdef CONFIG_KEYCARD
40# include "pwmkeycard.h" 40# include "pwmkeycard.h"
41#endif // CONFIG_KEYCARD 41#endif // CONFIG_KEYCARD
42 42
43#include <qmessagebox.h> 43#include <qmessagebox.h>
44 44
45#include <kmessagebox.h> 45#include <kmessagebox.h>
46#ifndef PWM_EMBEDDED 46#ifndef PWM_EMBEDDED
47#include <kcmdlineargs.h> 47#include <kcmdlineargs.h>
48#include <kwin.h> 48#include <kwin.h>
49#include <dcopclient.h> 49#include <dcopclient.h>
50#endif 50#endif
51 51
52#include <kapplication.h> 52#include <kapplication.h>
53#include <kiconloader.h> 53#include <kiconloader.h>
54 54
55#include <signal.h> 55#include <signal.h>
56 56
57static PwMInit *sig_init_pointer; 57static PwMInit *sig_init_pointer;
58#ifdef _WIN32_ 58#ifdef _WIN32_
59static void sig_handler(int signum) 59static void sig_handler(int signum)
60#else 60#else
61static NOREGPARM void sig_handler(int signum) 61static NOREGPARM void sig_handler(int signum)
62#endif 62#endif
63{ 63{
64 switch (signum) { 64 switch (signum) {
65 case SIGINT: 65 case SIGINT:
66 case SIGTERM: 66 case SIGTERM:
67 sig_init_pointer->shutdownApp(20 + signum); 67 sig_init_pointer->shutdownApp(20 + signum);
68 break; 68 break;
69 default: 69 default:
70 printDebug(string("unhandled signal ") 70 printDebug(string("unhandled signal ")
71 + tostr(signum)); 71 + tostr(signum));
72 } 72 }
73} 73}
74 74
75 75
76 76
77PwMInit::PwMInit(PwMApplication *_app) 77PwMInit::PwMInit(PwMApplication *_app)
78 : runStatus (unknown) 78 : runStatus (unknown)
79 , _curWidget (0) 79 , _curWidget (0)
80 , _dcopClient (0) 80 , _dcopClient (0)
81 , _kwalletEmu (0) 81 , _kwalletEmu (0)
82 , _keycard (0) 82 , _keycard (0)
83 , _tray (0) 83 , _tray (0)
84{ 84{
85 sig_init_pointer = this; 85 sig_init_pointer = this;
86 app = _app; 86 app = _app;
87} 87}
88 88
89PwMInit::~PwMInit() 89PwMInit::~PwMInit()
90{ 90{
91 qDebug("PwMInit::~PwMInit() "); 91 //qDebug("PwMInit::~PwMInit() ");
92#ifndef PWM_EMBEDDED 92#ifndef PWM_EMBEDDED
93 SelfTest::cancel(); 93 SelfTest::cancel();
94 // close all open mainwnds 94 // close all open mainwnds
95 QValueList<PwM *>::iterator i = _mainWndList.begin(), 95 QValueList<PwM *>::iterator i = _mainWndList.begin(),
96 end = _mainWndList.end(); 96 end = _mainWndList.end();
97 97
98#else 98#else
99 // close all open mainwnds 99 // close all open mainwnds
100 QValueList<PwM *>::Iterator i = _mainWndList.begin(), 100 QValueList<PwM *>::Iterator i = _mainWndList.begin(),
101 end = _mainWndList.end(); 101 end = _mainWndList.end();
102#endif 102#endif
103 while (i != end) { 103 while (i != end) {
104 disconnect(*i, SIGNAL(closed(PwM *)), 104 disconnect(*i, SIGNAL(closed(PwM *)),
105 this, SLOT(mainWndClosed(PwM *))); 105 this, SLOT(mainWndClosed(PwM *)));
106 delete *i; 106 delete *i;
107 ++i; 107 ++i;
108 } 108 }
109 _mainWndList.clear(); 109 _mainWndList.clear();
110 // close all remaining open documents 110 // close all remaining open documents
111 PwMDocList *_dl = PwMDoc::getOpenDocList(); 111 PwMDocList *_dl = PwMDoc::getOpenDocList();
112 vector<PwMDocList::listItem> dl = *(_dl->getList()); 112 vector<PwMDocList::listItem> dl = *(_dl->getList());
113 vector<PwMDocList::listItem>::iterator i2 = dl.begin(), 113 vector<PwMDocList::listItem>::iterator i2 = dl.begin(),
114 end2 = dl.end(); 114 end2 = dl.end();
115 while (i2 != end2) { 115 while (i2 != end2) {
116 delete (*i2).doc; 116 delete (*i2).doc;
117 ++i2; 117 ++i2;
118 } 118 }
119 119
120#ifdef CONFIG_KWALLETIF 120#ifdef CONFIG_KWALLETIF
121 delete_ifnot_null(_kwalletEmu); 121 delete_ifnot_null(_kwalletEmu);
122#endif // CONFIG_KWALLETIF 122#endif // CONFIG_KWALLETIF
123#ifdef CONFIG_KEYCARD 123#ifdef CONFIG_KEYCARD
124 delete_ifnot_null(_keycard); 124 delete_ifnot_null(_keycard);
125#endif // CONFIG_KEYCARD 125#endif // CONFIG_KEYCARD
126 delete_ifnot_null(_tray); 126 delete_ifnot_null(_tray);
127 127
128 Randomizer::cleanup(); 128 Randomizer::cleanup();
129#ifndef PWM_EMBEDDED 129#ifndef PWM_EMBEDDED
130 Configuration::cleanup(); 130 Configuration::cleanup();
131#endif 131#endif
132} 132}
133 133
134void PwMInit::initializeApp() 134void PwMInit::initializeApp()
135{ 135{
136 //qDebug("PwMInit::initializeApp() "); 136 //qDebug("PwMInit::initializeApp() ");
137 PWM_ASSERT(runStatus == unknown); 137 PWM_ASSERT(runStatus == unknown);
138 runStatus = init; 138 runStatus = init;
139 initPosixSignalHandler(); 139 initPosixSignalHandler();
140 Randomizer::init(); 140 Randomizer::init();
141#ifndef PWM_EMBEDDED 141#ifndef PWM_EMBEDDED
142 Configuration::init(); 142 Configuration::init();
143#endif 143#endif
144 initDCOP(); 144 initDCOP();
145 initKWalletEmu(); 145 initKWalletEmu();
146 initKeycard(); 146 initKeycard();
147 initTray(); 147 initTray();
148 handleCmdLineArgs(); 148 handleCmdLineArgs();
149 bool openDeeplocked = false; 149 bool openDeeplocked = false;
150 if (conf()->confGlobAutostartDeepLocked() || 150 if (conf()->confGlobAutostartDeepLocked() ||
151 savedCmd.open_deeplocked) 151 savedCmd.open_deeplocked)
152 openDeeplocked = true; 152 openDeeplocked = true;
153 if ( false ){ 153 if ( false ){
154 // LR is not working 154 // LR is not working
155 //if (conf()->confWndAutoMinimizeOnStart() || 155 //if (conf()->confWndAutoMinimizeOnStart() ||
156 // savedCmd.minToTray) { 156 // savedCmd.minToTray) {
157 PwMDoc *newDoc = createDoc(); 157 PwMDoc *newDoc = createDoc();
158 qDebug(" createDoc()"); 158 //qDebug(" createDoc()");
159 if (!newDoc->openDocUi(newDoc, 159 if (!newDoc->openDocUi(newDoc,
160 conf()->confGlobAutoStart(), 160 conf()->confGlobAutoStart(),
161 openDeeplocked)) { 161 openDeeplocked)) {
162 delete newDoc; 162 delete newDoc;
163 } 163 }
164 164
165 //US ENH for embedded devices: in the case of failure, open a document the default way 165 //US ENH for embedded devices: in the case of failure, open a document the default way
166 createMainWnd(conf()->confGlobAutoStart(), 166 createMainWnd(conf()->confGlobAutoStart(),
167 openDeeplocked, 167 openDeeplocked,
168 true, 168 true,
169 0, 169 0,
170 savedCmd.minimized); 170 savedCmd.minimized);
171 171
172 172
173 173
174 174
175 //} 175 //}
176 } else { 176 } else {
177 createMainWnd(conf()->confGlobAutoStart(), 177 createMainWnd(conf()->confGlobAutoStart(),
178 openDeeplocked, 178 openDeeplocked,
179 true, 179 true,
180 0, 180 0,
181 savedCmd.minimized); 181 savedCmd.minimized);
182 } 182 }
183 runStatus = running; 183 runStatus = running;
184} 184}
185 185
186void PwMInit::shutdownApp(int exitStatus) 186void PwMInit::shutdownApp(int exitStatus)
187{ 187{
188 188
189 189
190 PwM * iii;; 190 PwM * iii;;
191 while ( _mainWndList.count() ) { 191 while ( _mainWndList.count() ) {
192 iii = _mainWndList.first(); 192 iii = _mainWndList.first();
193 disconnect(iii, SIGNAL(closed(PwM *)), 193 disconnect(iii, SIGNAL(closed(PwM *)),
194 this, SLOT(mainWndClosed(PwM *))); 194 this, SLOT(mainWndClosed(PwM *)));
195 mainWndClosed((iii)); 195 mainWndClosed((iii));
196 } 196 }
197 197
198 printDebug(string("PwMInit::shutdownApp(") 198 printDebug(string("PwMInit::shutdownApp(")
199 + tostr(exitStatus) + ") called."); 199 + tostr(exitStatus) + ") called.");
200 PWM_ASSERT((runStatus == running) || (runStatus == init)); 200 PWM_ASSERT((runStatus == running) || (runStatus == init));
201 runStatus = shutdown; 201 runStatus = shutdown;
202 QApplication::exit(exitStatus); 202 QApplication::exit(exitStatus);
203 /* The destructor of PwMInit is called when control 203 /* The destructor of PwMInit is called when control
204 * leaves main() 204 * leaves main()
205 */ 205 */
206} 206}
207 207
208void PwMInit::initPosixSignalHandler() 208void PwMInit::initPosixSignalHandler()
209{ 209{
210 signal(SIGINT, sig_handler); 210 signal(SIGINT, sig_handler);
211 signal(SIGTERM, sig_handler); 211 signal(SIGTERM, sig_handler);
212} 212}
213 213
214void PwMInit::initDCOP() 214void PwMInit::initDCOP()
215{ 215{
216#ifndef PWM_EMBEDDED 216#ifndef PWM_EMBEDDED
217 _dcopClient = app->dcopClient(); 217 _dcopClient = app->dcopClient();
218 _dcopClient->setNotifications(true); 218 _dcopClient->setNotifications(true);
219#endif 219#endif
220 220
221} 221}
222 222
223void PwMInit::initKWalletEmu(bool forceDisable, bool forceReload) 223void PwMInit::initKWalletEmu(bool forceDisable, bool forceReload)
224{ 224{
225#ifdef CONFIG_KWALLETIF 225#ifdef CONFIG_KWALLETIF
226 if (!conf()->confGlobKwalletEmu() || 226 if (!conf()->confGlobKwalletEmu() ||
227 forceDisable) { 227 forceDisable) {
228 delete_ifnot_null(_kwalletEmu); 228 delete_ifnot_null(_kwalletEmu);
229 return; 229 return;
230 } 230 }
231 try { 231 try {
232 if (_kwalletEmu && forceReload) 232 if (_kwalletEmu && forceReload)
233 delete_and_null(_kwalletEmu); 233 delete_and_null(_kwalletEmu);
234 if (!_kwalletEmu) 234 if (!_kwalletEmu)
235 _kwalletEmu = new KWalletEmu(this); 235 _kwalletEmu = new KWalletEmu(this);
236 } catch (PwMException e) { 236 } catch (PwMException e) {
237 string errMsg("initializing KWallet emulation failed. ID: "); 237 string errMsg("initializing KWallet emulation failed. ID: ");
238 errMsg += tostr(static_cast<int>(e.getId())); 238 errMsg += tostr(static_cast<int>(e.getId()));
239 errMsg += " err-message: "; 239 errMsg += " err-message: ";
240 errMsg += e.getMessage(); 240 errMsg += e.getMessage();
241 printWarn(errMsg); 241 printWarn(errMsg);
242 return; 242 return;
243 } 243 }
244#else // CONFIG_KWALLETIF 244#else // CONFIG_KWALLETIF
245 PARAM_UNUSED(forceDisable); 245 PARAM_UNUSED(forceDisable);
246 PARAM_UNUSED(forceReload); 246 PARAM_UNUSED(forceReload);
247#endif // CONFIG_KWALLETIF 247#endif // CONFIG_KWALLETIF
248} 248}
249 249
250void PwMInit::initKeycard() 250void PwMInit::initKeycard()
251{ 251{
252#ifdef CONFIG_KEYCARD 252#ifdef CONFIG_KEYCARD
253 PWM_ASSERT(!_keycard); 253 PWM_ASSERT(!_keycard);
254 _keycard = new PwMKeyCard(this); 254 _keycard = new PwMKeyCard(this);
255#endif // CONFIG_KEYCARD 255#endif // CONFIG_KEYCARD
256} 256}
257 257
258void PwMInit::initTray() 258void PwMInit::initTray()
259{ 259{
260#ifdef PWM_EMBEDDED 260#ifdef PWM_EMBEDDED
261 //US ENH : embedded version does not support a tray 261 //US ENH : embedded version does not support a tray
262 return; 262 return;
263#endif 263#endif
264 264
265 if (!conf()->confGlobTray()) { 265 if (!conf()->confGlobTray()) {
266 if (!_tray) 266 if (!_tray)
267 return; 267 return;
268 _tray->hide(); 268 _tray->hide();
269 delete_and_null(_tray); 269 delete_and_null(_tray);
270 return; 270 return;
271 } 271 }
272 if (_tray) 272 if (_tray)
273 return; 273 return;
274 _tray = new PwMTray(this); 274 _tray = new PwMTray(this);
275 connect(_tray, SIGNAL(quitSelected()), 275 connect(_tray, SIGNAL(quitSelected()),
276 this, SLOT(removeTrayAndQuit())); 276 this, SLOT(removeTrayAndQuit()));
277 connect(_tray, SIGNAL(closed(PwMTray *)), 277 connect(_tray, SIGNAL(closed(PwMTray *)),
278 this, SLOT(trayIconClosed(PwMTray *))); 278 this, SLOT(trayIconClosed(PwMTray *)));
279 KIconLoader icons; 279 KIconLoader icons;
280#ifndef PWM_EMBEDDED 280#ifndef PWM_EMBEDDED
281 _tray->setPixmap(icons.loadIcon(PACKAGE_NAME, KIcon::Small)); 281 _tray->setPixmap(icons.loadIcon(PACKAGE_NAME, KIcon::Small));
282#endif 282#endif
283 _tray->show(); 283 _tray->show();
284 // connect the signals of all open documents. 284 // connect the signals of all open documents.
285 const vector<PwMDocList::listItem> *dl = PwMDoc::getOpenDocList()->getList(); 285 const vector<PwMDocList::listItem> *dl = PwMDoc::getOpenDocList()->getList();
286 vector<PwMDocList::listItem>::const_iterator i = dl->begin(), 286 vector<PwMDocList::listItem>::const_iterator i = dl->begin(),
287 end = dl->end(); 287 end = dl->end();
288 while (i != end) { 288 while (i != end) {
289 _tray->connectDocToTray((*i).doc); 289 _tray->connectDocToTray((*i).doc);
290 ++i; 290 ++i;
291 } 291 }
292} 292}
293 293
294void PwMInit::removeTrayAndQuit() 294void PwMInit::removeTrayAndQuit()
295{ 295{
296 PWM_ASSERT(_tray); 296 PWM_ASSERT(_tray);
297 // _tray is deleted in ~PwMInit 297 // _tray is deleted in ~PwMInit
298 shutdownApp(0); 298 shutdownApp(0);
299} 299}
300 300
301PwM * PwMInit::createMainWnd(const QString &loadFile, 301PwM * PwMInit::createMainWnd(const QString &loadFile,
302 bool loadFileDeepLocked, 302 bool loadFileDeepLocked,
303 bool virginity, 303 bool virginity,
304 PwMDoc *doc, 304 PwMDoc *doc,
305 bool minimized) 305 bool minimized)
306{ 306{
307 PwM *newWnd; 307 PwM *newWnd;
308 if (!doc) 308 if (!doc)
309 doc = createDoc(); 309 doc = createDoc();
310 newWnd = new PwM(this, doc, virginity); 310 newWnd = new PwM(this, doc, virginity);
311#ifndef PWM_EMBEDDED 311#ifndef PWM_EMBEDDED
312 _mainWndList.push_back(newWnd); 312 _mainWndList.push_back(newWnd);
313#else 313#else
314 _mainWndList.append(newWnd); 314 _mainWndList.append(newWnd);
315#endif 315#endif
316 connect(newWnd, SIGNAL(closed(PwM *)), 316 connect(newWnd, SIGNAL(closed(PwM *)),
317 this, SLOT(mainWndClosed(PwM *))); 317 this, SLOT(mainWndClosed(PwM *)));
318 connect(newWnd, SIGNAL(gotFocus(PwM *)), 318 connect(newWnd, SIGNAL(gotFocus(PwM *)),
319 this, SLOT(setCurWidget(PwM *))); 319 this, SLOT(setCurWidget(PwM *)));
320 connect(newWnd, SIGNAL(lostFocus(PwM *)), 320 connect(newWnd, SIGNAL(lostFocus(PwM *)),
321 this, SLOT(resetCurWidget())); 321 this, SLOT(resetCurWidget()));
322 322
323 //US ENH 323 //US ENH
324#ifndef PWM_EMBEDDED 324#ifndef PWM_EMBEDDED
325 if (minimized) 325 if (minimized)
326 newWnd->showMinimized(); 326 newWnd->showMinimized();
327 else 327 else
328 newWnd->show(); 328 newWnd->show();
329 329
330#else //PWM_EMBEDDED 330#else //PWM_EMBEDDED
331 331
332#ifndef DESKTOP_VERSION 332#ifndef DESKTOP_VERSION
333 app->showMainWidget( newWnd ); 333 app->showMainWidget( newWnd );
334#else //DESKTOP_VERSION 334#else //DESKTOP_VERSION
335 newWnd->resize (640, 480 ); 335 newWnd->resize (640, 480 );
336 newWnd->show(); 336 newWnd->show();
337#endif //DESKTOP_VERSION 337#endif //DESKTOP_VERSION
338 338
339#endif //PWM_EMBEDDED 339#endif //PWM_EMBEDDED
340 340
341 if (loadFile != QString::null && 341 if (loadFile != QString::null &&
342 loadFile != "") { 342 loadFile != "") {
343 newWnd->openDoc(loadFile, loadFileDeepLocked); 343 newWnd->openDoc(loadFile, loadFileDeepLocked);
344 } 344 }
345 return newWnd; 345 return newWnd;
346} 346}
347 347
348PwMDoc * PwMInit::createDoc() 348PwMDoc * PwMInit::createDoc()
349{ 349{
350 PwMDoc *doc = new PwMDoc(this); 350 PwMDoc *doc = new PwMDoc(this);
351#ifdef CONFIG_KEYCARD 351#ifdef CONFIG_KEYCARD
352 doc->setPwMKeyCard(keycard()); 352 doc->setPwMKeyCard(keycard());
353#endif 353#endif
354#ifdef CONFIG_KWALLETIF 354#ifdef CONFIG_KWALLETIF
355 if (kwalletEmu()) 355 if (kwalletEmu())
356 kwalletEmu()->connectDocSignals(doc); 356 kwalletEmu()->connectDocSignals(doc);
357#endif 357#endif
358 358
359 if (_tray) 359 if (_tray)
360 _tray->connectDocToTray(doc); 360 _tray->connectDocToTray(doc);
361 361
362 return doc; 362 return doc;
363 363
364} 364}
365 365
366void PwMInit::mainWndClosed(PwM *wnd) 366void PwMInit::mainWndClosed(PwM *wnd)
367{ 367{
368 bool doMinimizeToTray = false; 368 bool doMinimizeToTray = false;
369 bool doDeleteDoc = false; 369 bool doDeleteDoc = false;
370#ifndef PWM_EMBEDDED 370#ifndef PWM_EMBEDDED
371 dcopClient()->suspend(); 371 dcopClient()->suspend();
372 dcopClient()->setAcceptCalls(false); 372 dcopClient()->setAcceptCalls(false);
373#endif 373#endif
374again: 374again:
375 375
376 if (wnd->isForceMinimizeToTray()) { 376 if (wnd->isForceMinimizeToTray()) {
377 if (unlikely(!_tray)) { 377 if (unlikely(!_tray)) {
378 /* This should not happen! If we set forceMinimizeToTray , 378 /* This should not happen! If we set forceMinimizeToTray ,
379 * we must be sure that _tray exists. 379 * we must be sure that _tray exists.
380 */ 380 */
381 BUG(); 381 BUG();
382 wnd->setForceMinimizeToTray(false); 382 wnd->setForceMinimizeToTray(false);
383 goto again; 383 goto again;
384 } 384 }
385 doMinimizeToTray = true; 385 doMinimizeToTray = true;
386 } else { 386 } else {
387 // Ask to minimize to tray. If not, delete doc. 387 // Ask to minimize to tray. If not, delete doc.
388 if (_tray && 388 if (_tray &&
389 runStatus != shutdown && 389 runStatus != shutdown &&
390 !wnd->isForceQuit() && 390 !wnd->isForceQuit() &&
391 !wnd->curDoc()->isDeleted()) { 391 !wnd->curDoc()->isDeleted()) {
392 if (conf()->confWndClose()) 392 if (conf()->confWndClose())
393 doDeleteDoc = true; 393 doDeleteDoc = true;
394 else 394 else
395 doMinimizeToTray = true; 395 doMinimizeToTray = true;
396 } else { 396 } else {
397 doDeleteDoc = true; 397 doDeleteDoc = true;
398 } 398 }
399 } 399 }
400 400
401 if (doMinimizeToTray) { 401 if (doMinimizeToTray) {
402 qDebug("doMinimizeToTray "); 402 //qDebug("doMinimizeToTray ");
403 PWM_ASSERT(_tray); 403 PWM_ASSERT(_tray);
404 int mmlock = conf()->confGlobMinimizeLock(); 404 int mmlock = conf()->confGlobMinimizeLock();
405 switch (mmlock) { 405 switch (mmlock) {
406 case 0: // don't lock anything 406 case 0: // don't lock anything
407 break; 407 break;
408 case 1: // normal lock 408 case 1: // normal lock
409 wnd->curDoc()->lockAll(true); 409 wnd->curDoc()->lockAll(true);
410 break; 410 break;
411 case 2: // deep-lock 411 case 2: // deep-lock
412 wnd->curDoc()->deepLock(); 412 wnd->curDoc()->deepLock();
413 break; 413 break;
414 default: 414 default:
415 WARN(); 415 WARN();
416 } 416 }
417 } else if (doDeleteDoc) { 417 } else if (doDeleteDoc) {
418 qDebug("doDeleteDoc "); 418 //qDebug("doDeleteDoc ");
419 if (!wnd->curDoc()->tryDelete()) { 419 if (!wnd->curDoc()->tryDelete()) {
420 /* We failed deleting the doc, 420 /* We failed deleting the doc,
421 * so open a new window with it, again. 421 * so open a new window with it, again.
422 */ 422 */
423 createMainWnd(QString::null, false, 423 createMainWnd(QString::null, false,
424 false, wnd->curDoc()); 424 false, wnd->curDoc());
425 } 425 }
426 } 426 }
427#ifndef PWM_EMBEDDED 427#ifndef PWM_EMBEDDED
428 // find the closed window in the "mainWndList" and delete it. 428 // find the closed window in the "mainWndList" and delete it.
429 QValueList<PwM *>::iterator i = _mainWndList.begin(), 429 QValueList<PwM *>::iterator i = _mainWndList.begin(),
430 end = _mainWndList.end(); 430 end = _mainWndList.end();
431#else 431#else
432 // find the closed window in the "mainWndList" and delete it. 432 // find the closed window in the "mainWndList" and delete it.
433 QValueList<PwM *>::Iterator i = _mainWndList.begin(), 433 QValueList<PwM *>::Iterator i = _mainWndList.begin(),
434 end = _mainWndList.end(); 434 end = _mainWndList.end();
435#endif 435#endif
436 while (i != end) { 436 while (i != end) {
437 //qDebug("iii %x end %x wnd %x", (*i), (*end), wnd); 437 //qDebug("iii %x end %x wnd %x", (*i), (*end), wnd);
438 if (*i == wnd) { 438 if (*i == wnd) {
439#ifndef PWM_EMBEDDED 439#ifndef PWM_EMBEDDED
440 _mainWndList.erase(i); 440 _mainWndList.erase(i);
441#else 441#else
442 _mainWndList.remove(i); 442 _mainWndList.remove(i);
443#endif 443#endif
444 444
445 if ( app->mainWidget() == wnd ) { 445 if ( app->mainWidget() == wnd ) {
446 if ( _mainWndList.count() ) { 446 if ( _mainWndList.count() ) {
447#ifndef DESKTOP_VERSION 447#ifndef DESKTOP_VERSION
448 app->showMainWidget(_mainWndList.first() ); 448 app->showMainWidget(_mainWndList.first() );
449#endif //DESKTOP_VERSION 449#endif //DESKTOP_VERSION
450 450
451 } 451 }
452 } 452 }
453 delete wnd; 453 delete wnd;
454 goto out_success; 454 goto out_success;
455 } 455 }
456 ++i; 456 ++i;
457 } 457 }
458 BUG(); 458 BUG();
459out_success: 459out_success:
460#ifndef PWM_EMBEDDED 460#ifndef PWM_EMBEDDED
461 if (!_mainWndList.size()) 461 if (!_mainWndList.size())
462#else 462#else
463 if (!_mainWndList.count()) 463 if (!_mainWndList.count())
464#endif 464#endif
465 465
466 { 466 {
467 /* If there's no main window and no tray icon 467 /* If there's no main window and no tray icon
468 * left, we have no user interface, so we can 468 * left, we have no user interface, so we can
469 * shut down the application. 469 * shut down the application.
470 */ 470 */
471 if (!_tray) { 471 if (!_tray) {
472#ifndef PWM_EMBEDDED 472#ifndef PWM_EMBEDDED
473 dcopClient()->setAcceptCalls(true); 473 dcopClient()->setAcceptCalls(true);
474 dcopClient()->resume(); 474 dcopClient()->resume();
475#endif 475#endif
476 shutdownApp(0); 476 shutdownApp(0);
477 return; 477 return;
478 } 478 }
479 /* There is no widget left, so set 479 /* There is no widget left, so set
480 * _curWidget to 0 480 * _curWidget to 0
481 */ 481 */
482 resetCurWidget(); 482 resetCurWidget();
483 } 483 }
484#ifndef PWM_EMBEDDED 484#ifndef PWM_EMBEDDED
485 dcopClient()->setAcceptCalls(true); 485 dcopClient()->setAcceptCalls(true);
486 dcopClient()->resume(); 486 dcopClient()->resume();
487#endif 487#endif
488} 488}
489 489
490void PwMInit::trayIconClosed(PwMTray *tray) 490void PwMInit::trayIconClosed(PwMTray *tray)
491{ 491{
492 if (runStatus != running) 492 if (runStatus != running)
493 return; 493 return;
494 PARAM_UNUSED(tray); 494 PARAM_UNUSED(tray);
495 PWM_ASSERT(tray == _tray); 495 PWM_ASSERT(tray == _tray);
496 /* If there's no main wnd left we have to 496 /* If there's no main wnd left we have to
497 * shutdown the app (same as in mainWndClosed()) 497 * shutdown the app (same as in mainWndClosed())
498 */ 498 */
499#ifndef PWM_EMBEDDED 499#ifndef PWM_EMBEDDED
500 if (!_mainWndList.size()) 500 if (!_mainWndList.size())
501 shutdownApp(0); 501 shutdownApp(0);
502#else 502#else
503 if (!_mainWndList.count()) 503 if (!_mainWndList.count())
504 shutdownApp(0); 504 shutdownApp(0);
505#endif 505#endif
506} 506}
507 507
508void PwMInit::handleCmdLineArgs(bool initial) 508void PwMInit::handleCmdLineArgs(bool initial)
509{ 509{
510#ifndef PWM_EMBEDDED 510#ifndef PWM_EMBEDDED
511 KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); 511 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
512 PWM_ASSERT(args); 512 PWM_ASSERT(args);
513 int i, numArgs = args->count(); 513 int i, numArgs = args->count();
514 const char *curArg; 514 const char *curArg;
515 515
516 // read all cmdline options 516 // read all cmdline options
517 savedCmd.open_deeplocked = args->isSet("open-deeplocked"); 517 savedCmd.open_deeplocked = args->isSet("open-deeplocked");
518 savedCmd.minimized = args->isSet("minimized"); 518 savedCmd.minimized = args->isSet("minimized");
519 savedCmd.minToTray = args->isSet("mintray"); 519 savedCmd.minToTray = args->isSet("mintray");
520 savedCmd.skipSelfTest = args->isSet("skip-self-test"); 520 savedCmd.skipSelfTest = args->isSet("skip-self-test");
521 if (savedCmd.minimized && 521 if (savedCmd.minimized &&
522 savedCmd.minToTray) { 522 savedCmd.minToTray) {
523 printInfo(i18n("Commandline option \"--minimized\" and " 523 printInfo(i18n("Commandline option \"--minimized\" and "
524 "\"--mintray\" selected. These are incompatible. " 524 "\"--mintray\" selected. These are incompatible. "
525 "\"--mintray\" will be selected.").latin1()); 525 "\"--mintray\" will be selected.").latin1());
526 } 526 }
527 /* Iterate through all non-option arguments. 527 /* Iterate through all non-option arguments.
528 * Every non-option arg is a filename to open. 528 * Every non-option arg is a filename to open.
529 */ 529 */
530 for (i = 0; i < numArgs; ++i) { 530 for (i = 0; i < numArgs; ++i) {
531 curArg = args->arg(i); 531 curArg = args->arg(i);
532 PWM_ASSERT(curArg); 532 PWM_ASSERT(curArg);
533 if (savedCmd.minToTray) { 533 if (savedCmd.minToTray) {
534 PwMDoc *newDoc = createDoc(); 534 PwMDoc *newDoc = createDoc();
535 if (!newDoc->openDocUi(newDoc, 535 if (!newDoc->openDocUi(newDoc,
536 curArg, 536 curArg,
537 savedCmd.open_deeplocked)) { 537 savedCmd.open_deeplocked)) {
538 delete newDoc; 538 delete newDoc;
539 } 539 }
540 } else { 540 } else {
541 PwM *newInstance = createMainWnd(QString::null, 541 PwM *newInstance = createMainWnd(QString::null,
542 false, 542 false,
543 true, 543 true,
544 0, 544 0,
545 savedCmd.minimized); 545 savedCmd.minimized);
546 PwMDoc *newDoc = newInstance->openDoc(curArg, 546 PwMDoc *newDoc = newInstance->openDoc(curArg,
547 savedCmd.open_deeplocked); 547 savedCmd.open_deeplocked);
548 if (!newDoc) { 548 if (!newDoc) {
549 newInstance->setForceQuit(true); 549 newInstance->setForceQuit(true);
550 delete_and_null(newInstance); 550 delete_and_null(newInstance);
551 } 551 }
552 } 552 }
553 } 553 }
554 554
555 if (savedCmd.minToTray) { 555 if (savedCmd.minToTray) {
556 minimizeAllMainWnd(true); 556 minimizeAllMainWnd(true);
557 } else if (savedCmd.minimized) { 557 } else if (savedCmd.minimized) {
558 minimizeAllMainWnd(false); 558 minimizeAllMainWnd(false);
559 } 559 }
560 if (!savedCmd.skipSelfTest && initial) { 560 if (!savedCmd.skipSelfTest && initial) {
561 SelfTest::schedule(); 561 SelfTest::schedule();
562 } 562 }
563 args->clear(); 563 args->clear();
564#endif 564#endif
565} 565}
566 566
567void PwMInit::minimizeAllMainWnd(bool toTray) 567void PwMInit::minimizeAllMainWnd(bool toTray)
568{ 568{
569#ifndef PWM_EMBEDDED 569#ifndef PWM_EMBEDDED
570 if (!_mainWndList.size()) 570 if (!_mainWndList.size())
571 return; 571 return;
572#else 572#else
573 if (!_mainWndList.count()) 573 if (!_mainWndList.count())
574 return; 574 return;
575#endif 575#endif
576 const QValueList<PwM *> *ml = mainWndList(); 576 const QValueList<PwM *> *ml = mainWndList();
577#ifndef PWM_EMBEDDED 577#ifndef PWM_EMBEDDED
578 QValueList<PwM *>::const_iterator it = ml->begin(), 578 QValueList<PwM *>::const_iterator it = ml->begin(),
579 end = ml->end(); 579 end = ml->end();
580#else 580#else
581 QValueList<PwM *>::ConstIterator it = ml->begin(), 581 QValueList<PwM *>::ConstIterator it = ml->begin(),
582 end = ml->end(); 582 end = ml->end();
583#endif 583#endif
584 PwM *wnd; 584 PwM *wnd;
585 if (toTray && _tray) { 585 if (toTray && _tray) {
586 /* minimize to tray. 586 /* minimize to tray.
587 * close all mainWnd. 587 * close all mainWnd.
588 */ 588 */
589 while (it != end) { 589 while (it != end) {
590 wnd = *it; 590 wnd = *it;
591 wnd->setForceMinimizeToTray(true); 591 wnd->setForceMinimizeToTray(true);
592 wnd->close_slot(); 592 wnd->close_slot();
593 ++it; 593 ++it;
594 } 594 }
595 } else { 595 } else {
596 // normal minimize 596 // normal minimize
597 while (it != end) { 597 while (it != end) {
598 wnd = *it; 598 wnd = *it;
599 wnd->hide(); 599 wnd->hide();
600 wnd->showMinimized(); 600 wnd->showMinimized();
601 ++it; 601 ++it;
602 } 602 }
603 } 603 }
604} 604}
605 605
606#ifdef PWM_EMBEDDED 606#ifdef PWM_EMBEDDED
607 607
608#ifndef DESKTOP_VERSION 608#ifndef DESKTOP_VERSION
609 609
610PwMApplication::PwMApplication(int & argc, char ** argv) 610PwMApplication::PwMApplication(int & argc, char ** argv)
611 : QPEApplication( argc, argv ) 611 : QPEApplication( argc, argv )
612 , init (0) 612 , init (0)
613{ 613{
614 this->setKeepRunning (); 614 this->setKeepRunning ();
615} 615}
616 616
617PwMApplication::~PwMApplication() 617PwMApplication::~PwMApplication()
618{ 618{
619 delete_ifnot_null(init); 619 delete_ifnot_null(init);
620} 620}
621#else //DESKTOP_VERSION 621#else //DESKTOP_VERSION
622 622
623PwMApplication::PwMApplication(int & argc, char ** argv) 623PwMApplication::PwMApplication(int & argc, char ** argv)
624 : QApplication( argc, argv ) 624 : QApplication( argc, argv )
625 , init (0) 625 , init (0)
626{ 626{
627 setStyle( new QPlatinumStyle ()); 627 setStyle( new QPlatinumStyle ());
628 QString hdir = QDir::homeDirPath(); 628 QString hdir = QDir::homeDirPath();
629 // there is a bug when creating dirs for WIN 98 629 // there is a bug when creating dirs for WIN 98
630 // it is difficult to fix, because we have no WIN 98 runnung 630 // it is difficult to fix, because we have no WIN 98 runnung
631 // such that we try it to create the dirs at startup here 631 // such that we try it to create the dirs at startup here
632 if ( hdir == "C:\\" ) 632 if ( hdir == "C:\\" )
633 { 633 {
634 // win 98 or ME 634 // win 98 or ME
635 QDir app_dir; 635 QDir app_dir;
636 if ( !app_dir.exists("C:\\kdepim") ) 636 if ( !app_dir.exists("C:\\kdepim") )
637 app_dir.mkdir ("C:\\kdepim"); 637 app_dir.mkdir ("C:\\kdepim");
638 if ( !app_dir.exists("C:\\kdepim\\apps") ) 638 if ( !app_dir.exists("C:\\kdepim\\apps") )
639 app_dir.mkdir ("C:\\kdepim\\apps"); 639 app_dir.mkdir ("C:\\kdepim\\apps");
640 if ( !app_dir.exists("C:\\kdepim\\config") ) 640 if ( !app_dir.exists("C:\\kdepim\\config") )
641 app_dir.mkdir ("C:\\kdepim\\config"); 641 app_dir.mkdir ("C:\\kdepim\\config");
642 if ( !app_dir.exists("C:\\kdepim\\apps\\pwmanager") ) 642 if ( !app_dir.exists("C:\\kdepim\\apps\\pwmanager") )
643 app_dir.mkdir ("C:\\kdepim\\apps\\pwmanager"); 643 app_dir.mkdir ("C:\\kdepim\\apps\\pwmanager");
644 } 644 }
645} 645}
646 646
647PwMApplication::~PwMApplication() 647PwMApplication::~PwMApplication()
648{ 648{
649 delete_ifnot_null(init); 649 delete_ifnot_null(init);
650} 650}
651 651
652#endif //DESKTOP_VERSION 652#endif //DESKTOP_VERSION
653 653
654#endif //PWM_EMBEDDED 654#endif //PWM_EMBEDDED
655 655
656 656
657 657
658 658
659#ifndef PWM_EMBEDDED 659#ifndef PWM_EMBEDDED
660#include "pwminit.moc" 660#include "pwminit.moc"
661#endif 661#endif
diff --git a/pwmanager/pwmanager/pwmview.cpp b/pwmanager/pwmanager/pwmview.cpp
index cd816e5..8c4d9cc 100644
--- a/pwmanager/pwmanager/pwmview.cpp
+++ b/pwmanager/pwmanager/pwmview.cpp
@@ -1,620 +1,620 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * copyright (C) 2003, 2004 by Michael Buesch * 3 * copyright (C) 2003, 2004 by Michael Buesch *
4 * email: mbuesch@freenet.de * 4 * email: mbuesch@freenet.de *
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 version 2 * 7 * it under the terms of the GNU General Public License version 2 *
8 * as published by the Free Software Foundation. * 8 * as published by the Free Software Foundation. *
9 * * 9 * *
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12/*************************************************************************** 12/***************************************************************************
13 * copyright (C) 2004 by Ulf Schenk 13 * copyright (C) 2004 by Ulf Schenk
14 * This file is originaly based on version 1.0.1 of pwmanager 14 * This file is originaly based on version 1.0.1 of pwmanager
15 * and was modified to run on embedded devices that run microkde 15 * and was modified to run on embedded devices that run microkde
16 * 16 *
17 * $Id$ 17 * $Id$
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#include "pwmview.h" 20#include "pwmview.h"
21#include "pwmexception.h" 21#include "pwmexception.h"
22#include "globalstuff.h" 22#include "globalstuff.h"
23#include "pwm.h" 23#include "pwm.h"
24#include "rencatwnd.h" 24#include "rencatwnd.h"
25#ifndef PWM_EMBEDDED 25#ifndef PWM_EMBEDDED
26#include "configuration.h" 26#include "configuration.h"
27#else 27#else
28#include "pwmprefs.h" 28#include "pwmprefs.h"
29#endif 29#endif
30#include "commentbox.h" 30#include "commentbox.h"
31 31
32#include <kmessagebox.h> 32#include <kmessagebox.h>
33#include <klocale.h> 33#include <klocale.h>
34 34
35#include <qlineedit.h> 35#include <qlineedit.h>
36#include <qpoint.h> 36#include <qpoint.h>
37#include <qapplication.h> 37#include <qapplication.h>
38#include <qlayout.h> 38#include <qlayout.h>
39 39
40//US ENH: wouldn't it be a good idea if we could use this consts everywhere else. 40//US ENH: wouldn't it be a good idea if we could use this consts everywhere else.
41//US ENH: for examle in listviewpwm.cpp 41//US ENH: for examle in listviewpwm.cpp
42//US ENH: Because of that I transfer them into the headerfile. 42//US ENH: Because of that I transfer them into the headerfile.
43/* 43/*
44 #define COLUMN_DESC 0 44 #define COLUMN_DESC 0
45 #define COLUMN_NAME 1 45 #define COLUMN_NAME 1
46 #define COLUMN_PW 2 46 #define COLUMN_PW 2
47 #define COLUMN_URL 3 47 #define COLUMN_URL 3
48 #define COLUMN_LAUNCHER 4 48 #define COLUMN_LAUNCHER 4
49*/ 49*/
50 50
51PwMView::PwMView(PwM *_mainClass, 51PwMView::PwMView(PwM *_mainClass,
52 QWidget *parent, PwMDoc *_doc, 52 QWidget *parent, PwMDoc *_doc,
53 const char *name) 53 const char *name)
54 : PwMViewStyle(parent, name) 54 : PwMViewStyle(parent, name)
55{ 55{
56 PWM_ASSERT(_mainClass); 56 PWM_ASSERT(_mainClass);
57 PWM_ASSERT(parent); 57 PWM_ASSERT(parent);
58 PWM_ASSERT(_doc); 58 PWM_ASSERT(_doc);
59 setView(this); 59 setView(this);
60 doc = _doc; 60 doc = _doc;
61 doc->setListViewPointer(this); 61 doc->setListViewPointer(this);
62 mainClass = _mainClass; 62 mainClass = _mainClass;
63 resize(_mainClass->size()); 63 resize(_mainClass->size());
64 initStyle(conf()->confWndMainViewStyle()); 64 initStyle(conf()->confWndMainViewStyle());
65 initCtxMenu(); 65 initCtxMenu();
66 doc->setCurrentView(this); 66 doc->setCurrentView(this);
67 connect(doc, SIGNAL(dataChanged(PwMDoc *)), this, SLOT(updateView())); 67 connect(doc, SIGNAL(dataChanged(PwMDoc *)), this, SLOT(updateView()));
68} 68}
69 69
70PwMView::~PwMView() 70PwMView::~PwMView()
71{ 71{
72} 72}
73 73
74void PwMView::initCtxMenu() 74void PwMView::initCtxMenu()
75{ 75{
76 ctxMenu = new QPopupMenu(this); 76 ctxMenu = new QPopupMenu(this);
77 ctxMenu->insertItem(i18n("&Add password"), mainClass, SLOT(addPwd_slot())); 77 ctxMenu->insertItem(i18n("&Add password"), mainClass, SLOT(addPwd_slot()));
78 ctxMenu->insertSeparator(); 78 ctxMenu->insertSeparator();
79 ctxMenu->insertItem(i18n("&Edit"), mainClass, SLOT(editPwd_slot())); 79 ctxMenu->insertItem(i18n("&Edit"), mainClass, SLOT(editPwd_slot()));
80 ctxMenu->insertItem(i18n("&Delete"), mainClass, SLOT(deletePwd_slot())); 80 ctxMenu->insertItem(i18n("&Delete"), mainClass, SLOT(deletePwd_slot()));
81 ctxMenu->insertSeparator(); 81 ctxMenu->insertSeparator();
82 ctxMenu->insertItem(i18n("copy password to clipboard"), 82 ctxMenu->insertItem(i18n("copy password to clipboard"),
83 this, SLOT(copyPwToClip())); 83 this, SLOT(copyPwToClip()));
84 ctxMenu->insertItem(i18n("copy username to clipboard"), 84 ctxMenu->insertItem(i18n("copy username to clipboard"),
85 this, SLOT(copyNameToClip())); 85 this, SLOT(copyNameToClip()));
86 ctxMenu->insertItem(i18n("copy description to clipboard"), 86 ctxMenu->insertItem(i18n("copy description to clipboard"),
87 this, SLOT(copyDescToClip())); 87 this, SLOT(copyDescToClip()));
88 ctxMenu->insertItem(i18n("copy url to clipboard"), 88 ctxMenu->insertItem(i18n("copy url to clipboard"),
89 this, SLOT(copyUrlToClip())); 89 this, SLOT(copyUrlToClip()));
90 ctxMenu->insertItem(i18n("copy launcher to clipboard"), 90 ctxMenu->insertItem(i18n("copy launcher to clipboard"),
91 this, SLOT(copyLauncherToClip())); 91 this, SLOT(copyLauncherToClip()));
92 ctxMenu->insertItem(i18n("copy comment to clipboard"), 92 ctxMenu->insertItem(i18n("copy comment to clipboard"),
93 this, SLOT(copyCommentToClip())); 93 this, SLOT(copyCommentToClip()));
94 ctxMenu->insertSeparator(); 94 ctxMenu->insertSeparator();
95 ctxMenu->insertItem(i18n("Execute \"Launcher\""), mainClass, 95 ctxMenu->insertItem(i18n("Execute \"Launcher\""), mainClass,
96 SLOT(execLauncher_slot())); 96 SLOT(execLauncher_slot()));
97 ctxMenu->insertItem(i18n("Go to \"URL\""), mainClass, 97 ctxMenu->insertItem(i18n("Go to \"URL\""), mainClass,
98 SLOT(goToURL_slot())); 98 SLOT(goToURL_slot()));
99} 99}
100 100
101void PwMView::resizeEvent(QResizeEvent *) 101void PwMView::resizeEvent(QResizeEvent *)
102{ 102{
103 resizeView(size()); 103 resizeView(size());
104} 104}
105 105
106void PwMView::refreshCommentTextEdit(QListViewItem *curItem) 106void PwMView::refreshCommentTextEdit(QListViewItem *curItem)
107{ 107{
108 PWM_ASSERT(commentBox); 108 PWM_ASSERT(commentBox);
109 if (!curItem) 109 if (!curItem)
110 return; 110 return;
111 string comment; 111 string comment;
112 PwMerror ret; 112 PwMerror ret;
113 ret = document()->getCommentByLvp(getCurrentCategory(), 113 ret = document()->getCommentByLvp(getCurrentCategory(),
114 lv->childCount() - lv->itemIndex(curItem) - 1, 114 lv->childCount() - lv->itemIndex(curItem) - 1,
115 &comment); 115 &comment);
116 if (ret == e_binEntry) { 116 if (ret == e_binEntry) {
117 commentBox->setContent(i18n("This is a binary entry.\n" 117 commentBox->setContent(i18n("This is a binary entry.\n"
118 "It is not a normal password-entry, as it contains " 118 "It is not a normal password-entry, as it contains "
119 "binary data, which PwManager can't display here.")); 119 "binary data, which PwManager can't display here."));
120 } else if (ret == e_normalEntry) { 120 } else if (ret == e_normalEntry) {
121 commentBox->setContent(comment.c_str()); 121 commentBox->setContent(comment.c_str());
122 } else { 122 } else {
123 BUG(); 123 BUG();
124 return; 124 return;
125 } 125 }
126 lv->ensureItemVisible(curItem); 126 lv->ensureItemVisible(curItem);
127} 127}
128 128
129void PwMView::keyReleaseEvent(QKeyEvent * /*e*/) 129void PwMView::keyReleaseEvent(QKeyEvent * /*e*/)
130{ 130{
131 refreshCommentTextEdit(lv->currentItem()); 131 refreshCommentTextEdit(lv->currentItem());
132} 132}
133 133
134bool PwMView::getCurEntryIndex(unsigned int *index) 134bool PwMView::getCurEntryIndex(unsigned int *index)
135{ 135{
136 QListViewItem *current = lv->currentItem(); 136 QListViewItem *current = lv->currentItem();
137 if (!current) 137 if (!current)
138 return false; 138 return false;
139 return getDocEntryIndex(index, current); 139 return getDocEntryIndex(index, current);
140} 140}
141 141
142bool PwMView::getDocEntryIndex(unsigned int *index, 142bool PwMView::getDocEntryIndex(unsigned int *index,
143 const QListViewItem *item) 143 const QListViewItem *item)
144{ 144{
145 vector<unsigned int> foundPositions; 145 vector<unsigned int> foundPositions;
146 PwMDataItem curItem; 146 PwMDataItem curItem;
147 curItem.desc = item->text(COLUMN_DESC).latin1(); 147 curItem.desc = item->text(COLUMN_DESC).latin1();
148 curItem.name = item->text(COLUMN_NAME).latin1(); 148 curItem.name = item->text(COLUMN_NAME).latin1();
149 document()->getCommentByLvp(getCurrentCategory(), 149 document()->getCommentByLvp(getCurrentCategory(),
150 lv->childCount() - lv->itemIndex(item) - 1, 150 lv->childCount() - lv->itemIndex(item) - 1,
151 &curItem.comment); 151 &curItem.comment);
152 curItem.url = item->text(COLUMN_URL).latin1(); 152 curItem.url = item->text(COLUMN_URL).latin1();
153 curItem.launcher = item->text(COLUMN_LAUNCHER).latin1(); 153 curItem.launcher = item->text(COLUMN_LAUNCHER).latin1();
154 document()->findEntry(getCurrentCategory(), curItem, SEARCH_IN_DESC | 154 document()->findEntry(getCurrentCategory(), curItem, SEARCH_IN_DESC |
155 SEARCH_IN_NAME | SEARCH_IN_COMMENT | SEARCH_IN_URL | 155 SEARCH_IN_NAME | SEARCH_IN_COMMENT | SEARCH_IN_URL |
156 SEARCH_IN_LAUNCHER, 156 SEARCH_IN_LAUNCHER,
157 &foundPositions, true); 157 &foundPositions, true);
158 if (foundPositions.size()) { 158 if (foundPositions.size()) {
159 *index = foundPositions[0]; 159 *index = foundPositions[0];
160 return true; 160 return true;
161 } 161 }
162 162
163 return false; 163 return false;
164} 164}
165 165
166void PwMView::handleToggle(QListViewItem *item) 166void PwMView::handleToggle(QListViewItem *item)
167{ 167{
168 PWM_ASSERT(doc); 168 PWM_ASSERT(doc);
169 if (!item) 169 if (!item)
170 return; 170 return;
171 QCheckListItem *clItem = (QCheckListItem *)item; 171 QCheckListItem *clItem = (QCheckListItem *)item;
172 QString curCat(getCurrentCategory()); 172 QString curCat(getCurrentCategory());
173 173
174 // find document position of this entry. 174 // find document position of this entry.
175 unsigned int curEntryDocIndex; 175 unsigned int curEntryDocIndex;
176 if (!getDocEntryIndex(&curEntryDocIndex, item)) 176 if (!getDocEntryIndex(&curEntryDocIndex, item))
177 return; 177 return;
178 178
179 // hack to refresh the comment, if only one item is present 179 // hack to refresh the comment, if only one item is present
180 if (lv->childCount() == 1) 180 if (lv->childCount() == 1)
181 refreshCommentTextEdit(lv->currentItem()); 181 refreshCommentTextEdit(lv->currentItem());
182 182
183 if (doc->isLocked(curCat, curEntryDocIndex) != clItem->isOn()) 183 if (doc->isLocked(curCat, curEntryDocIndex) != clItem->isOn())
184 return; // this is just a click somewhere on the entry 184 return; // this is just a click somewhere on the entry
185 if (doc->isDeepLocked()) { 185 if (doc->isDeepLocked()) {
186 PwMerror ret; 186 PwMerror ret;
187 ret = doc->deepLock(false); 187 ret = doc->deepLock(false);
188 if (ret != e_success) 188 if (ret != e_success)
189 clItem->setOn(false); 189 clItem->setOn(false);
190 return; 190 return;
191 } 191 }
192 doc->lockAt(curCat, curEntryDocIndex, !clItem->isOn()); 192 doc->lockAt(curCat, curEntryDocIndex, !clItem->isOn());
193} 193}
194 194
195void PwMView::handleRightClick(QListViewItem *item, const QPoint &point, int) 195void PwMView::handleRightClick(QListViewItem *item, const QPoint &point, int)
196{ 196{
197 if (!item) 197 if (!item)
198 return; 198 return;
199 ctxMenu->move(point); 199 ctxMenu->move(point);
200 /* don't use ctxMenu->exec() here, as it generates race conditions 200 /* don't use ctxMenu->exec() here, as it generates race conditions
201 * with the card interface code. Believe it or not. :) 201 * with the card interface code. Believe it or not. :)
202 */ 202 */
203 ctxMenu->show(); 203 ctxMenu->show();
204} 204}
205 205
206void PwMView::updateCategories() 206void PwMView::updateCategories()
207{ 207{
208 qDebug("PwMView::updateCategories() "); 208 //qDebug("PwMView::updateCategories() ");
209 QString oldSel(getCurrentCategory()); 209 QString oldSel(getCurrentCategory());
210 delAllCategories(); 210 delAllCategories();
211 QStringList catList; 211 QStringList catList;
212 document()->getCategoryList(&catList); 212 document()->getCategoryList(&catList);
213 catList.sort(); 213 catList.sort();
214#ifndef PWM_EMBEDDED 214#ifndef PWM_EMBEDDED
215 QStringList::iterator i = catList.begin(), 215 QStringList::iterator i = catList.begin(),
216 end = catList.end(); 216 end = catList.end();
217#else 217#else
218 QStringList::Iterator i = catList.begin(), 218 QStringList::Iterator i = catList.begin(),
219 end = catList.end(); 219 end = catList.end();
220#endif 220#endif
221 while (i != end) { 221 while (i != end) {
222 addCategory(*i); 222 addCategory(*i);
223 ++i; 223 ++i;
224 } 224 }
225 selectCategory(oldSel); 225 selectCategory(oldSel);
226} 226}
227 227
228void PwMView::shiftToView() 228void PwMView::shiftToView()
229{ 229{
230 int cX = lv->contentsX(); 230 int cX = lv->contentsX();
231 int cY = lv->contentsY(); 231 int cY = lv->contentsY();
232 commentBox->clear(); 232 commentBox->clear();
233 233
234 unsigned int catDocIndex; 234 unsigned int catDocIndex;
235 if (unlikely( 235 if (unlikely(
236 !(document()->findCategory(getCurrentCategory(), 236 !(document()->findCategory(getCurrentCategory(),
237 &catDocIndex)))) { 237 &catDocIndex)))) {
238 BUG(); 238 BUG();
239 } 239 }
240 240
241 // ensure all listViewPos are set 241 // ensure all listViewPos are set
242 doc->ensureLvp(); 242 doc->ensureLvp();
243 243
244 // clear all tmp-data vectors 244 // clear all tmp-data vectors
245 unsigned int i, entries = doc->numEntries(catDocIndex); 245 unsigned int i, entries = doc->numEntries(catDocIndex);
246 if (entries) { 246 if (entries) {
247 mainClass->setVirgin(false); 247 mainClass->setVirgin(false);
248 } 248 }
249 vector<PwMDataItem> tmpSorted; 249 vector<PwMDataItem> tmpSorted;
250 PwMDataItem currItem; 250 PwMDataItem currItem;
251 currItem.clear(); 251 currItem.clear();
252 tmpSorted.insert(tmpSorted.begin(), entries, currItem); 252 tmpSorted.insert(tmpSorted.begin(), entries, currItem);
253 253
254 // Sort items and store them in tempoary tmpSorted. 254 // Sort items and store them in tempoary tmpSorted.
255 for (i = 0; i < entries; ++i) { 255 for (i = 0; i < entries; ++i) {
256 doc->getEntry(catDocIndex, i, &currItem); 256 doc->getEntry(catDocIndex, i, &currItem);
257 //qDebug("PwMView::shiftToView: %s, %i", currItem.desc.c_str(), currItem.listViewPos); 257 //qDebug("PwMView::shiftToView: %s, %i", currItem.desc.c_str(), currItem.listViewPos);
258 tmpSorted[currItem.listViewPos] = currItem; 258 tmpSorted[currItem.listViewPos] = currItem;
259 } 259 }
260 260
261 // shift tempoary data to ListView. 261 // shift tempoary data to ListView.
262 tmpDisableSort(); 262 tmpDisableSort();
263 lv->clear(); 263 lv->clear();
264 264
265 //US ENH: adjust the headers of the table according the category texts 265 //US ENH: adjust the headers of the table according the category texts
266 { 266 {
267 PwMCategoryItem* catItem = doc->getCategoryEntry(catDocIndex); 267 PwMCategoryItem* catItem = doc->getCategoryEntry(catDocIndex);
268 // qDebug("PwMView::ShiftToView CAT: %i, %s", catDocIndex, catItem->name.c_str()); 268 // qDebug("PwMView::ShiftToView CAT: %i, %s", catDocIndex, catItem->name.c_str());
269 lv->setColumnText(COLUMN_DESC, catItem->desc_text.c_str()); 269 lv->setColumnText(COLUMN_DESC, catItem->desc_text.c_str());
270 lv->setColumnText(COLUMN_NAME, catItem->name_text.c_str()); 270 lv->setColumnText(COLUMN_NAME, catItem->name_text.c_str());
271 lv->setColumnText(COLUMN_PW, catItem->pw_text.c_str()); 271 lv->setColumnText(COLUMN_PW, catItem->pw_text.c_str());
272 } 272 }
273 273
274 QCheckListItem *newItem; 274 QCheckListItem *newItem;
275 vector<PwMDataItem>::iterator it = tmpSorted.begin(), 275 vector<PwMDataItem>::iterator it = tmpSorted.begin(),
276 end = tmpSorted.end(); 276 end = tmpSorted.end();
277 while (it != end) { 277 while (it != end) {
278 newItem = new ListViewItemPwM(lv); 278 newItem = new ListViewItemPwM(lv);
279 newItem->setText(COLUMN_DESC, (*it).desc.c_str()); 279 newItem->setText(COLUMN_DESC, (*it).desc.c_str());
280 if ((*it).binary) { 280 if ((*it).binary) {
281 newItem->setText(COLUMN_NAME, ""); 281 newItem->setText(COLUMN_NAME, "");
282 newItem->setText(COLUMN_PW, i18n("<BINARY ENTRY>")); 282 newItem->setText(COLUMN_PW, i18n("<BINARY ENTRY>"));
283 newItem->setText(COLUMN_URL, ""); 283 newItem->setText(COLUMN_URL, "");
284 newItem->setText(COLUMN_LAUNCHER, (*it).launcher.c_str()); 284 newItem->setText(COLUMN_LAUNCHER, (*it).launcher.c_str());
285 } else { 285 } else {
286 newItem->setText(COLUMN_NAME, (*it).name.c_str()); 286 newItem->setText(COLUMN_NAME, (*it).name.c_str());
287 if ((*it).lockStat) { 287 if ((*it).lockStat) {
288 newItem->setText(COLUMN_PW, QString((*it).pw.c_str()) 288 newItem->setText(COLUMN_PW, QString((*it).pw.c_str())
289 + " " 289 + " "
290 + i18n("To unlock click the icon on the left.")); 290 + i18n("To unlock click the icon on the left."));
291 } else { 291 } else {
292 newItem->setText(COLUMN_PW, (*it).pw.c_str()); 292 newItem->setText(COLUMN_PW, (*it).pw.c_str());
293 } 293 }
294 newItem->setText(COLUMN_URL, (*it).url.c_str()); 294 newItem->setText(COLUMN_URL, (*it).url.c_str());
295 newItem->setText(COLUMN_LAUNCHER, (*it).launcher.c_str()); 295 newItem->setText(COLUMN_LAUNCHER, (*it).launcher.c_str());
296 } 296 }
297 newItem->setOn(!((*it).lockStat)); 297 newItem->setOn(!((*it).lockStat));
298 lv->insertItem(newItem); 298 lv->insertItem(newItem);
299 ++it; 299 ++it;
300 } 300 }
301 tmpReEnableSort(); 301 tmpReEnableSort();
302 302
303 if (cY || cX) 303 if (cY || cX)
304 lv->setContentsPos(cX, cY); 304 lv->setContentsPos(cX, cY);
305} 305}
306 306
307void PwMView::reorgLp() 307void PwMView::reorgLp()
308{ 308{
309 if (!lv->childCount()) 309 if (!lv->childCount())
310 return; 310 return;
311 PWM_ASSERT(doc); 311 PWM_ASSERT(doc);
312 PWM_ASSERT(!doc->isDocEmpty()); 312 PWM_ASSERT(!doc->isDocEmpty());
313 QListViewItem *currItem; 313 QListViewItem *currItem;
314 vector<unsigned int> foundPos; 314 vector<unsigned int> foundPos;
315 /* This searchIn _should_ be: 315 /* This searchIn _should_ be:
316 *const unsigned int searchIn = SEARCH_IN_DESC; 316 *const unsigned int searchIn = SEARCH_IN_DESC;
317 * But we want backward compatibility (see comment in PwMDoc::addEntry()). 317 * But we want backward compatibility (see comment in PwMDoc::addEntry()).
318 * So we need to search again, if we don't find the entry. (see below) 318 * So we need to search again, if we don't find the entry. (see below)
319 */ 319 */
320 const unsigned int searchIn = SEARCH_IN_DESC | SEARCH_IN_NAME | 320 const unsigned int searchIn = SEARCH_IN_DESC | SEARCH_IN_NAME |
321 SEARCH_IN_URL | SEARCH_IN_LAUNCHER; 321 SEARCH_IN_URL | SEARCH_IN_LAUNCHER;
322 QString curCat(getCurrentCategory()); 322 QString curCat(getCurrentCategory());
323 PwMDataItem findThis; 323 PwMDataItem findThis;
324 unsigned int i, cnt = lv->childCount(); 324 unsigned int i, cnt = lv->childCount();
325 for (i = 0; i < cnt; ++i) { 325 for (i = 0; i < cnt; ++i) {
326 currItem = lv->itemAtIndex(i); 326 currItem = lv->itemAtIndex(i);
327 findThis.desc = currItem->text(COLUMN_DESC).latin1(); 327 findThis.desc = currItem->text(COLUMN_DESC).latin1();
328 findThis.name = currItem->text(COLUMN_NAME).latin1(); 328 findThis.name = currItem->text(COLUMN_NAME).latin1();
329 findThis.url = currItem->text(COLUMN_URL).latin1(); 329 findThis.url = currItem->text(COLUMN_URL).latin1();
330 findThis.launcher = currItem->text(COLUMN_LAUNCHER).latin1(); 330 findThis.launcher = currItem->text(COLUMN_LAUNCHER).latin1();
331 doc->findEntry(curCat, findThis, searchIn, 331 doc->findEntry(curCat, findThis, searchIn,
332 &foundPos, true); 332 &foundPos, true);
333 if (!foundPos.size()) { 333 if (!foundPos.size()) {
334 /* Did not find the entry. We seem to have a binary 334 /* Did not find the entry. We seem to have a binary
335 * entry here (pray for it!). So search again with 335 * entry here (pray for it!). So search again with
336 * the "correct" searchIn flags. 336 * the "correct" searchIn flags.
337 */ 337 */
338 const unsigned int searchIn2 = SEARCH_IN_DESC; 338 const unsigned int searchIn2 = SEARCH_IN_DESC;
339 doc->findEntry(curCat, findThis, searchIn2, 339 doc->findEntry(curCat, findThis, searchIn2,
340 &foundPos, true); 340 &foundPos, true);
341 if (unlikely(!foundPos.size())) { 341 if (unlikely(!foundPos.size())) {
342 BUG(); 342 BUG();
343 continue; 343 continue;
344 } 344 }
345 /* We assert that it's a binary entry, now. 345 /* We assert that it's a binary entry, now.
346 * No chance to efficiently verify it here. 346 * No chance to efficiently verify it here.
347 */ 347 */
348 } 348 }
349 doc->setListViewPos(curCat, foundPos[0], cnt - i - 1); 349 doc->setListViewPos(curCat, foundPos[0], cnt - i - 1);
350 } 350 }
351} 351}
352 352
353void PwMView::selAt(int index) 353void PwMView::selAt(int index)
354{ 354{
355 QListViewItem *item = lv->itemAtIndex(index); 355 QListViewItem *item = lv->itemAtIndex(index);
356 if (!item) 356 if (!item)
357 return; 357 return;
358 lv->setCurrentItem(item); 358 lv->setCurrentItem(item);
359 lv->ensureItemVisible(item); 359 lv->ensureItemVisible(item);
360} 360}
361 361
362void PwMView::renCatButton_slot() 362void PwMView::renCatButton_slot()
363{ 363{
364 if (doc->isDeepLocked()) 364 if (doc->isDeepLocked())
365 return; 365 return;
366 RenCatWnd wnd(this); 366 RenCatWnd wnd(this);
367 if (wnd.exec() == 1) { 367 if (wnd.exec() == 1) {
368 QString newName(wnd.getNewName()); 368 QString newName(wnd.getNewName());
369 if (newName == "") 369 if (newName == "")
370 return; 370 return;
371 document()->renameCategory(getCurrentCategory(), 371 document()->renameCategory(getCurrentCategory(),
372 newName); 372 newName);
373 } 373 }
374} 374}
375 375
376void PwMView::delCatButton_slot() 376void PwMView::delCatButton_slot()
377{ 377{
378 if (doc->isDeepLocked()) 378 if (doc->isDeepLocked())
379 return; 379 return;
380 if (numCategories() <= 1) { 380 if (numCategories() <= 1) {
381 mainClass->showStatMsg(i18n("Can't remove the last category.")); 381 mainClass->showStatMsg(i18n("Can't remove the last category."));
382 return; 382 return;
383 } 383 }
384 if (KMessageBox::questionYesNo(this, 384 if (KMessageBox::questionYesNo(this,
385 i18n("Do you really want to\n" 385 i18n("Do you really want to\n"
386 "delete the selected\n" 386 "delete the selected\n"
387 "category? All password-\n" 387 "category? All password-\n"
388 "entries will be lost in\n" 388 "entries will be lost in\n"
389 "this category!\n"), 389 "this category!\n"),
390 i18n("Delete category?")) 390 i18n("Delete category?"))
391 == KMessageBox::No) { 391 == KMessageBox::No) {
392 return; 392 return;
393 } 393 }
394 document()->delCategory(getCurrentCategory()); 394 document()->delCategory(getCurrentCategory());
395} 395}
396 396
397void PwMView::copyPwToClip() 397void PwMView::copyPwToClip()
398{ 398{
399 if (doc->isDeepLocked()) 399 if (doc->isDeepLocked())
400 return; 400 return;
401 unsigned int curIndex = 0; 401 unsigned int curIndex = 0;
402 if (!getCurEntryIndex(&curIndex)) 402 if (!getCurEntryIndex(&curIndex))
403 return; 403 return;
404 PwMDataItem d; 404 PwMDataItem d;
405 document()->getDataChangedLock(); 405 document()->getDataChangedLock();
406 document()->getEntry(getCurrentCategory(), curIndex, &d, true); 406 document()->getEntry(getCurrentCategory(), curIndex, &d, true);
407 document()->putDataChangedLock(); 407 document()->putDataChangedLock();
408 PwM::copyToClipboard(d.pw.c_str()); 408 PwM::copyToClipboard(d.pw.c_str());
409} 409}
410 410
411void PwMView::copyNameToClip() 411void PwMView::copyNameToClip()
412{ 412{
413 if (doc->isDeepLocked()) 413 if (doc->isDeepLocked())
414 return; 414 return;
415 unsigned int curIndex = 0; 415 unsigned int curIndex = 0;
416 if (!getCurEntryIndex(&curIndex)) 416 if (!getCurEntryIndex(&curIndex))
417 return; 417 return;
418 PwMDataItem d; 418 PwMDataItem d;
419 document()->getEntry(getCurrentCategory(), curIndex, &d); 419 document()->getEntry(getCurrentCategory(), curIndex, &d);
420 PwM::copyToClipboard(d.name.c_str()); 420 PwM::copyToClipboard(d.name.c_str());
421} 421}
422 422
423void PwMView::copyDescToClip() 423void PwMView::copyDescToClip()
424{ 424{
425 if (doc->isDeepLocked()) 425 if (doc->isDeepLocked())
426 return; 426 return;
427 unsigned int curIndex = 0; 427 unsigned int curIndex = 0;
428 if (!getCurEntryIndex(&curIndex)) 428 if (!getCurEntryIndex(&curIndex))
429 return; 429 return;
430 PwMDataItem d; 430 PwMDataItem d;
431 document()->getEntry(getCurrentCategory(), curIndex, &d); 431 document()->getEntry(getCurrentCategory(), curIndex, &d);
432 PwM::copyToClipboard(d.desc.c_str()); 432 PwM::copyToClipboard(d.desc.c_str());
433} 433}
434 434
435void PwMView::copyUrlToClip() 435void PwMView::copyUrlToClip()
436{ 436{
437 if (doc->isDeepLocked()) 437 if (doc->isDeepLocked())
438 return; 438 return;
439 unsigned int curIndex = 0; 439 unsigned int curIndex = 0;
440 if (!getCurEntryIndex(&curIndex)) 440 if (!getCurEntryIndex(&curIndex))
441 return; 441 return;
442 PwMDataItem d; 442 PwMDataItem d;
443 document()->getEntry(getCurrentCategory(), curIndex, &d); 443 document()->getEntry(getCurrentCategory(), curIndex, &d);
444 PwM::copyToClipboard(d.url.c_str()); 444 PwM::copyToClipboard(d.url.c_str());
445} 445}
446 446
447void PwMView::copyLauncherToClip() 447void PwMView::copyLauncherToClip()
448{ 448{
449 if (doc->isDeepLocked()) 449 if (doc->isDeepLocked())
450 return; 450 return;
451 unsigned int curIndex = 0; 451 unsigned int curIndex = 0;
452 if (!getCurEntryIndex(&curIndex)) 452 if (!getCurEntryIndex(&curIndex))
453 return; 453 return;
454 PwMDataItem d; 454 PwMDataItem d;
455 document()->getEntry(getCurrentCategory(), curIndex, &d); 455 document()->getEntry(getCurrentCategory(), curIndex, &d);
456 PwM::copyToClipboard(d.launcher.c_str()); 456 PwM::copyToClipboard(d.launcher.c_str());
457} 457}
458 458
459void PwMView::copyCommentToClip() 459void PwMView::copyCommentToClip()
460{ 460{
461 if (doc->isDeepLocked()) 461 if (doc->isDeepLocked())
462 return; 462 return;
463 unsigned int curIndex = 0; 463 unsigned int curIndex = 0;
464 if (!getCurEntryIndex(&curIndex)) 464 if (!getCurEntryIndex(&curIndex))
465 return; 465 return;
466 PwMDataItem d; 466 PwMDataItem d;
467 document()->getEntry(getCurrentCategory(), curIndex, &d); 467 document()->getEntry(getCurrentCategory(), curIndex, &d);
468 PwM::copyToClipboard(d.comment.c_str()); 468 PwM::copyToClipboard(d.comment.c_str());
469} 469}
470 470
471/************************************************************************ 471/************************************************************************
472 * 472 *
473 * 473 *
474 * 474 *
475 ************************************************************************/ 475 ************************************************************************/
476 476
477 477
478PwMDataItemView::PwMDataItemView( QWidget *parent, const char *name ) 478PwMDataItemView::PwMDataItemView( QWidget *parent, const char *name )
479 : QTextBrowser( parent, name ) 479 : QTextBrowser( parent, name )
480 480
481 481
482{ 482{
483//US setWrapPolicy( QTextEdit::AtWordBoundary ); 483//US setWrapPolicy( QTextEdit::AtWordBoundary );
484 setLinkUnderline( false ); 484 setLinkUnderline( false );
485 // setVScrollBarMode( QScrollView::AlwaysOff ); 485 // setVScrollBarMode( QScrollView::AlwaysOff );
486 //setHScrollBarMode( QScrollView::AlwaysOff ); 486 //setHScrollBarMode( QScrollView::AlwaysOff );
487 487
488//US QStyleSheet *sheet = styleSheet(); 488//US QStyleSheet *sheet = styleSheet();
489//US QStyleSheetItem *link = sheet->item( "a" ); 489//US QStyleSheetItem *link = sheet->item( "a" );
490//US link->setColor( KGlobalSettings::linkColor() ); 490//US link->setColor( KGlobalSettings::linkColor() );
491 491
492} 492}
493 493
494void PwMDataItemView::setPwMDataItem( const PwMDataItem& a ) 494void PwMDataItemView::setPwMDataItem( const PwMDataItem& a )
495 495
496{ 496{
497 mItem = a; 497 mItem = a;
498 // clear view 498 // clear view
499 setText( QString::null ); 499 setText( QString::null );
500 500
501 501
502 QString dynamicPart; 502 QString dynamicPart;
503 QString format = "<tr><td align=\"right\"><b>%1</b></td>" 503 QString format = "<tr><td align=\"right\"><b>%1</b></td>"
504 "<td align=\"left\">%2</td></tr>"; 504 "<td align=\"left\">%2</td></tr>";
505 505
506 dynamicPart += format 506 dynamicPart += format
507 .arg( i18n("LastUpdate") ) 507 .arg( i18n("LastUpdate") )
508 .arg( mItem.meta.update.toString().latin1() ); 508 .arg( mItem.meta.update.toString().latin1() );
509 509
510 dynamicPart += format 510 dynamicPart += format
511 .arg( i18n("Description") ) 511 .arg( i18n("Description") )
512 .arg( mItem.desc.c_str() ); 512 .arg( mItem.desc.c_str() );
513 513
514 dynamicPart += format 514 dynamicPart += format
515 .arg( i18n("Name") ) 515 .arg( i18n("Name") )
516 .arg( mItem.name.c_str() ); 516 .arg( mItem.name.c_str() );
517 517
518 dynamicPart += format 518 dynamicPart += format
519 .arg( i18n("Password") ) 519 .arg( i18n("Password") )
520 .arg( mItem.pw.c_str() ); 520 .arg( mItem.pw.c_str() );
521 521
522 QString comment(mItem.pw.c_str()); 522 QString comment(mItem.pw.c_str());
523 dynamicPart += format 523 dynamicPart += format
524 .arg( i18n("Comment") ) 524 .arg( i18n("Comment") )
525 .arg( comment.replace( QRegExp("\n"), "<br>" ) ); 525 .arg( comment.replace( QRegExp("\n"), "<br>" ) );
526 526
527 dynamicPart += format 527 dynamicPart += format
528 .arg( i18n("URL") ) 528 .arg( i18n("URL") )
529 .arg( mItem.url.c_str() ); 529 .arg( mItem.url.c_str() );
530 530
531 dynamicPart += format 531 dynamicPart += format
532 .arg( i18n("Launcher") ) 532 .arg( i18n("Launcher") )
533 .arg( mItem.launcher.c_str() ); 533 .arg( mItem.launcher.c_str() );
534 534
535 QString mText = "<table><td colspan=\"2\">&nbsp;</td>"; 535 QString mText = "<table><td colspan=\"2\">&nbsp;</td>";
536 536
537 mText += dynamicPart; 537 mText += dynamicPart;
538 mText += "</table>"; 538 mText += "</table>";
539 539
540 // at last display it... 540 // at last display it...
541 setText( mText ); 541 setText( mText );
542 542
543} 543}
544 544
545PwMDataItem PwMDataItemView::pwmdataitem() const 545PwMDataItem PwMDataItemView::pwmdataitem() const
546{ 546{
547 return mItem; 547 return mItem;
548} 548}
549 549
550/************************************************************************ 550/************************************************************************
551 * 551 *
552 * 552 *
553 * 553 *
554 ************************************************************************/ 554 ************************************************************************/
555 555
556 556
557PwMDataItemChooser::PwMDataItemChooser( PwMDataItem loc, PwMDataItem rem, bool takeloc, QWidget *parent, const char *name ) 557PwMDataItemChooser::PwMDataItemChooser( PwMDataItem loc, PwMDataItem rem, bool takeloc, QWidget *parent, const char *name )
558 : KDialogBase(parent, name, true , 558 : KDialogBase(parent, name, true ,
559 i18n("Conflict! Please choose Entry!"),Ok|User1|Close,Close, false) 559 i18n("Conflict! Please choose Entry!"),Ok|User1|Close,Close, false)
560{ 560{
561 findButton( Close )->setText( i18n("Cancel Sync")); 561 findButton( Close )->setText( i18n("Cancel Sync"));
562 findButton( Ok )->setText( i18n("Remote")); 562 findButton( Ok )->setText( i18n("Remote"));
563 findButton( User1 )->setText( i18n("Local")); 563 findButton( User1 )->setText( i18n("Local"));
564 QWidget* topframe = new QWidget( this ); 564 QWidget* topframe = new QWidget( this );
565 setMainWidget( topframe ); 565 setMainWidget( topframe );
566 QBoxLayout* bl; 566 QBoxLayout* bl;
567 if ( QApplication::desktop()->width() < 640 ) { 567 if ( QApplication::desktop()->width() < 640 ) {
568 bl = new QVBoxLayout( topframe ); 568 bl = new QVBoxLayout( topframe );
569 } else { 569 } else {
570 bl = new QHBoxLayout( topframe ); 570 bl = new QHBoxLayout( topframe );
571 } 571 }
572 QVBox* subframe = new QVBox( topframe ); 572 QVBox* subframe = new QVBox( topframe );
573 bl->addWidget(subframe ); 573 bl->addWidget(subframe );
574 QLabel* lab = new QLabel( i18n("Local Entry"), subframe ); 574 QLabel* lab = new QLabel( i18n("Local Entry"), subframe );
575 if ( takeloc ) 575 if ( takeloc )
576 lab->setBackgroundColor(Qt::green.light() ); 576 lab->setBackgroundColor(Qt::green.light() );
577 PwMDataItemView * av = new PwMDataItemView( subframe ); 577 PwMDataItemView * av = new PwMDataItemView( subframe );
578 av->setPwMDataItem( loc ); 578 av->setPwMDataItem( loc );
579 subframe = new QVBox( topframe ); 579 subframe = new QVBox( topframe );
580 bl->addWidget(subframe ); 580 bl->addWidget(subframe );
581 lab = new QLabel( i18n("Remote Entry"), subframe ); 581 lab = new QLabel( i18n("Remote Entry"), subframe );
582 if ( !takeloc ) 582 if ( !takeloc )
583 lab->setBackgroundColor(Qt::green.light() ); 583 lab->setBackgroundColor(Qt::green.light() );
584 av = new PwMDataItemView( subframe ); 584 av = new PwMDataItemView( subframe );
585 av->setPwMDataItem( rem ); 585 av->setPwMDataItem( rem );
586 QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote())); 586 QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote()));
587 QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local())); 587 QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local()));
588#ifndef DESKTOP_VERSION 588#ifndef DESKTOP_VERSION
589 showMaximized(); 589 showMaximized();
590#else 590#else
591 resize ( 640, 400 ); 591 resize ( 640, 400 );
592#endif 592#endif
593} 593}
594 594
595int PwMDataItemChooser::executeD( bool local ) 595int PwMDataItemChooser::executeD( bool local )
596{ 596{
597 mSyncResult = 3; 597 mSyncResult = 3;
598 if ( local ) 598 if ( local )
599 findButton( User1 )->setFocus(); 599 findButton( User1 )->setFocus();
600 else 600 else
601 findButton( Ok )->setFocus(); 601 findButton( Ok )->setFocus();
602 exec(); 602 exec();
603 return mSyncResult; 603 return mSyncResult;
604} 604}
605void PwMDataItemChooser::slot_remote() 605void PwMDataItemChooser::slot_remote()
606{ 606{
607 mSyncResult = 2; 607 mSyncResult = 2;
608 accept(); 608 accept();
609} 609}
610void PwMDataItemChooser::slot_local() 610void PwMDataItemChooser::slot_local()
611{ 611{
612 mSyncResult = 1; 612 mSyncResult = 1;
613 accept(); 613 accept();
614} 614}
615 615
616 616
617 617
618#ifndef PWM_EMBEDDED 618#ifndef PWM_EMBEDDED
619#include "pwmview.moc" 619#include "pwmview.moc"
620#endif 620#endif