author | zautrix <zautrix> | 2005-06-13 13:57:22 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-13 13:57:22 (UTC) |
commit | 56de219c5ce910a470a01a0e5003d1a113837ef4 (patch) (unidiff) | |
tree | 3393cb306cec8dcdc05d6ed0fae3ae7d374f2794 | |
parent | 4f3ff02932b39bf16b9692c3cb69c101a28b4616 (diff) | |
download | kdepimpi-56de219c5ce910a470a01a0e5003d1a113837ef4.zip kdepimpi-56de219c5ce910a470a01a0e5003d1a113837ef4.tar.gz kdepimpi-56de219c5ce910a470a01a0e5003d1a113837ef4.tar.bz2 |
fixxx
-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 2 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 8 | ||||
-rw-r--r-- | korganizer/calendarview.h | 1 | ||||
-rw-r--r-- | korganizer/koagendaitem.cpp | 6 | ||||
-rw-r--r-- | korganizer/kofilterview.cpp | 4 | ||||
-rw-r--r-- | korganizer/kofilterview.h | 1 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 4 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 52 | ||||
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 2 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.cpp | 4 | ||||
-rw-r--r-- | libkcal/alarm.cpp | 2 | ||||
-rw-r--r-- | libkcal/calendar.cpp | 54 | ||||
-rw-r--r-- | libkcal/calendar.h | 1 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 56 | ||||
-rw-r--r-- | libkcal/calendarlocal.h | 1 |
15 files changed, 137 insertions, 61 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index acf17b2..8651a49 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt | |||
@@ -1,1390 +1,1390 @@ | |||
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","Lösche alles" }, | 128 | { "Delete All","Lösche alles" }, |
129 | { "Delete all selected","Lösche alle Selektierten" }, | 129 | { "Delete all selected","Lösche alle Selektierten" }, |
130 | { "Delete Current","Aktuellen löschen" }, | 130 | { "Delete Current","Aktuellen löschen" }, |
131 | { "Delete Event...","Lösche Termin..." }, | 131 | { "Delete Event...","Lösche Termin..." }, |
132 | { "Delete Event","Lösche Termin" }, | 132 | { "Delete Event","Lösche Termin" }, |
133 | { "&Delete","Löschen" }, | 133 | { "&Delete","Löschen" }, |
134 | { "Delete...","Löschen..." }, | 134 | { "Delete...","Löschen..." }, |
135 | { "Delete","Löschen" }, | 135 | { "Delete","Löschen" }, |
136 | { "Delete Todo...","Lösche Todo..." }, | 136 | { "Delete Todo...","Lösche Todo..." }, |
137 | { "Delete To-Do","Lösche Todo" }, | 137 | { "Delete To-Do","Lösche Todo" }, |
138 | { "Deleting item %d ...","Lösche Eintrag %d..." }, | 138 | { "Deleting item %d ...","Lösche Eintrag %d..." }, |
139 | { "Descriptions","Beschreibungen" }, | 139 | { "Descriptions","Beschreibungen" }, |
140 | { "Deselect all","Deselektiere Alle" }, | 140 | { "Deselect all","Deselektiere Alle" }, |
141 | { "Details","Details" }, | 141 | { "Details","Details" }, |
142 | { "Dinner","Abendessen" }, | 142 | { "Dinner","Abendessen" }, |
143 | { "Do you really want\nto close KO/Pi?","Möchten Sie wirklich\nKO/PI verlassen?" }, | 143 | { "Do you really want\nto close KO/Pi?","Möchten Sie wirklich\nKO/PI verlassen?" }, |
144 | { "Due Date","Fällig am" }, | 144 | { "Due Date","Fällig am" }, |
145 | { "Due: ","Fällig: "}, | 145 | { "Due: ","Fällig: "}, |
146 | { "Due Time","Fällig um" }, | 146 | { "Due Time","Fällig um" }, |
147 | { "Due:","Fällig:"}, | 147 | { "Due:","Fällig:"}, |
148 | { "Duration: ","Dauer: " }, | 148 | { "Duration: ","Dauer: " }, |
149 | { "Edit...","Bearbeite..." }, | 149 | { "Edit...","Bearbeite..." }, |
150 | { "Edit","Bearbeite" }, | 150 | { "Edit","Bearbeite" }, |
151 | { "Edit Event...","Bearbeite Termin..." }, | 151 | { "Edit Event...","Bearbeite Termin..." }, |
152 | { "Edit Event","Bearbeite Termin" }, | 152 | { "Edit Event","Bearbeite Termin" }, |
153 | { "Edit exceptions","Bearbeite Ausnahmen" }, | 153 | { "Edit exceptions","Bearbeite Ausnahmen" }, |
154 | { "EditorBox:","Editor Fenster:" }, | 154 | { "EditorBox:","Editor Fenster:" }, |
155 | { "Edit Recurrence Range","Bearbeite Wiederholung" }, | 155 | { "Edit Recurrence Range","Bearbeite Wiederholung" }, |
156 | { "Edit Todo...","Berabeite Todo..." }, | 156 | { "Edit Todo...","Berabeite Todo..." }, |
157 | { "Edit To-Do","Todo bearbeiten" }, | 157 | { "Edit To-Do","Todo bearbeiten" }, |
158 | { "E&mail address:","E&mail Adresse:" }, | 158 | { "E&mail address:","E&mail Adresse:" }, |
159 | { "(EmptyEmail)","(KeineEmail)" }, | 159 | { "(EmptyEmail)","(KeineEmail)" }, |
160 | { "(EmptyName)","(KeinName)" }, | 160 | { "(EmptyName)","(KeinName)" }, |
161 | { "Enable Recurrence","Wiederholung anschalten" }, | 161 | { "Enable Recurrence","Wiederholung anschalten" }, |
162 | { "End after","Endet nach"}, | 162 | { "End after","Endet nach"}, |
163 | { "End by:","Endet am"}, | 163 | { "End by:","Endet am"}, |
164 | { "End Date","End Datum" }, | 164 | { "End Date","End Datum" }, |
165 | { "End:","Ende:" }, | 165 | { "End:","Ende:" }, |
166 | { "End Time","End Zeit" }, | 166 | { "End Time","End Zeit" }, |
167 | { "English","Englisch" }, | 167 | { "English","Englisch" }, |
168 | { "Event","Termin" }, | 168 | { "Event","Termin" }, |
169 | { "Event list","Termin Liste" }, | 169 | { "Event list","Termin Liste" }, |
170 | { "Events","Termine" }, | 170 | { "Events","Termine" }, |
171 | { "Event Viewer:","Termin Übersicht:" }, | 171 | { "Event Viewer:","Termin Übersicht:" }, |
172 | { "every","jede" }, | 172 | { "every","jede" }, |
173 | { "Exceptions...","Ausnahmen..." }, | 173 | { "Exceptions...","Ausnahmen..." }, |
174 | { "Exceptions","Ausnahmen" }, | 174 | { "Exceptions","Ausnahmen" }, |
175 | { "Exclude holidays","Ohne freie Tage" }, | 175 | { "Exclude holidays","Ohne freie Tage" }, |
176 | { "Exclude Saturdays","Ohne Samstage" }, | 176 | { "Exclude Saturdays","Ohne Samstage" }, |
177 | { "Feb","Feb" }, | 177 | { "Feb","Feb" }, |
178 | { "February","Februar" }, | 178 | { "February","Februar" }, |
179 | { "&Find","Suche!" }, | 179 | { "&Find","Suche!" }, |
180 | { "Fonts","Schriftart" }, | 180 | { "Fonts","Schriftart" }, |
181 | { "Force take local entry always","Erzwinge:Nimm immer lokalen Eintrag" }, | 181 | { "Force take local entry always","Erzwinge:Nimm immer lokalen Eintrag" }, |
182 | { "Force take remote entry always","Erzwinge:Nimm immer fernen Eintrag"}, | 182 | { "Force take remote entry always","Erzwinge:Nimm immer fernen Eintrag"}, |
183 | { "Free","Frei" }, | 183 | { "Free","Frei" }, |
184 | { "Friday","Freitag" }, | 184 | { "Friday","Freitag" }, |
185 | { "Fri","Fr" }, | 185 | { "Fri","Fr" }, |
186 | { "From:","Vom:" }, | 186 | { "From:","Vom:" }, |
187 | { "Full &name:","Vor- und &Nachname:" }, | 187 | { "Full &name:","Vor- und &Nachname:" }, |
188 | { "General","Allgemein" }, | 188 | { "General","Allgemein" }, |
189 | { "German","Deutsch" }, | 189 | { "German","Deutsch" }, |
190 | { "Gifts","Geschenke" }, | 190 | { "Gifts","Geschenke" }, |
191 | { "Go to Today","Heute anzeigen" }, | 191 | { "Go to Today","Heute anzeigen" }, |
192 | { "Help","Hilfe" }, | 192 | { "Help","Hilfe" }, |
193 | { "Hide Dates","Daten ausblenden" }, | 193 | { "Hide Dates","Daten ausblenden" }, |
194 | { "Highlight color:","Markierungen:" }, | 194 | { "Highlight color:","Markierungen:" }, |
195 | { "Holiday color:","Freie Tage:" }, | 195 | { "Holiday color:","Freie Tage:" }, |
196 | { "hour(s)","Stunde(n)" }, | 196 | { "hour(s)","Stunde(n)" }, |
197 | { "In %1 days: ","In %1 Tagen: " }, | 197 | { "In %1 days: ","In %1 Tagen: " }, |
198 | { "Incomplete Todo:","Unerledigte Aufgaben:" }, | 198 | { "Incomplete Todo:","Unerledigte Aufgaben:" }, |
199 | { "Information","Information" }, | 199 | { "Information","Information" }, |
200 | { "Invalid search expression,\ncannot perform ","Kann Suche nicht ausführen" }, | 200 | { "Invalid search expression,\ncannot perform ","Kann Suche nicht ausführen" }, |
201 | { "Jan","Jan" }, | 201 | { "Jan","Jan" }, |
202 | { "January","Januar" }, | 202 | { "January","Januar" }, |
203 | { "JournalView:","Journal Ansicht:" }, | 203 | { "JournalView:","Journal Ansicht:" }, |
204 | { "Journals","Journale" }, | 204 | { "Journals","Journale" }, |
205 | { "Jul","Jul" }, | 205 | { "Jul","Jul" }, |
206 | { "July","Juli" }, | 206 | { "July","Juli" }, |
207 | { "Jump to date","Springe zum Datum" }, | 207 | { "Jump to date","Springe zum Datum" }, |
208 | { "June","Juni" }, | 208 | { "June","Juni" }, |
209 | { "Jun","Jun" }, | 209 | { "Jun","Jun" }, |
210 | { "Key Bindings...","Tastenzuordnung..." }, | 210 | { "Key Bindings...","Tastenzuordnung..." }, |
211 | { "Kids","Kinder" }, | 211 | { "Kids","Kinder" }, |
212 | { "Known Problems...","Bekannte Probleme..." }, | 212 | { "Known Problems...","Bekannte Probleme..." }, |
213 | { "KO/Pi Find ","KO/Pi Suchdialog " }, | 213 | { "KO/Pi Find ","KO/Pi Suchdialog " }, |
214 | { "KO/Pi Find: ","KO/Pi Suchen: " }, | 214 | { "KO/Pi Find: ","KO/Pi Suchen: " }, |
215 | { "KO/Pi is starting ... "," KO/Pi startet ... \n... Zeit für eine Kaffeepause ..." }, | 215 | { "KO/Pi is starting ... "," KO/Pi startet ... \n... Zeit für eine Kaffeepause ..." }, |
216 | { "Language:(needs restart)","Sprache (Neustart!)" }, | 216 | { "Language:(needs restart)","Sprache (Neustart!)" }, |
217 | { "Language:","Sprache" }, | 217 | { "Language:","Sprache" }, |
218 | { "Large","Etwas mehr" }, | 218 | { "Large","Etwas mehr" }, |
219 | { "List View:","Listenansicht:" }, | 219 | { "List View:","Listenansicht:" }, |
220 | { "List View","Listenansicht" }, | 220 | { "List View","Listenansicht" }, |
221 | { "Load/Save","Laden/Speichern" }, | 221 | { "Load/Save","Laden/Speichern" }, |
222 | { "Load Template","Lade Vorlage" }, | 222 | { "Load Template","Lade Vorlage" }, |
223 | { "Locale","Localisation" }, | 223 | { "Locale","Localisation" }, |
224 | { "Local temp file:","Lokale temp. Datei:" }, | 224 | { "Local temp file:","Lokale temp. Datei:" }, |
225 | { "Location: ","Ort: " }, | 225 | { "Location: ","Ort: " }, |
226 | { "Location:","Ort:" }, | 226 | { "Location:","Ort:" }, |
227 | { "Mail client","Mail Programm" }, | 227 | { "Mail client","Mail Programm" }, |
228 | { "Mail Client","Mail Programm" }, | 228 | { "Mail Client","Mail Programm" }, |
229 | { "March","März" }, | 229 | { "March","März" }, |
230 | { "Mar","Mär" }, | 230 | { "Mar","Mär" }, |
231 | { "May","Mai" }, | 231 | { "May","Mai" }, |
232 | { "M. Bains line:","M. Bains Linie:" }, | 232 | { "M. Bains line:","M. Bains Linie:" }, |
233 | { "Medium","Medium" }, | 233 | { "Medium","Medium" }, |
234 | { "Method","Methode" }, | 234 | { "Method","Methode" }, |
235 | { "minute(s)","Minute(n)" }, | 235 | { "minute(s)","Minute(n)" }, |
236 | { "Monday","Montag" }, | 236 | { "Monday","Montag" }, |
237 | { "Mon","Mo" }, | 237 | { "Mon","Mo" }, |
238 | { "Monthly","Monatlich" }, | 238 | { "Monthly","Monatlich" }, |
239 | { "Month not long enough","Monat ist nicht lang genug" }, | 239 | { "Month not long enough","Monat ist nicht lang genug" }, |
240 | { "month(s)","Monat(e)" }, | 240 | { "month(s)","Monat(e)" }, |
241 | { "Month view:","Monatsansicht:" }, | 241 | { "Month view:","Monatsansicht:" }, |
242 | { "Month view uses category colors","Monatsansicht zeigt Kategorie Farben" }, | 242 | { "Month view uses category colors","Monatsansicht zeigt Kategorie Farben" }, |
243 | { "Todo view uses category colors","To-Do Ansicht zeigt Kategorie Farben" }, | 243 | { "Todo view uses category colors","To-Do Ansicht zeigt Kategorie Farben" }, |
244 | { "Move &Down","Nach unten verschieben" }, | 244 | { "Move &Down","Nach unten verschieben" }, |
245 | { "Move &Up","Nach oben verschieben" }, | 245 | { "Move &Up","Nach oben verschieben" }, |
246 | { "Name:","Name:" }, | 246 | { "Name:","Name:" }, |
247 | { "Name","Name" }, | 247 | { "Name","Name" }, |
248 | { "\nAre you sure you want\nto delete this event?","\nSind Sie sicher, dass Sie\nden Termin löschen möchten?" }, | 248 | { "\nAre you sure you want\nto delete this event?","\nSind Sie sicher, dass Sie\nden Termin löschen möchten?" }, |
249 | { "%n Days","%n Tage" }, | 249 | { "%n Days","%n Tage" }, |
250 | { "Never","Nie" }, | 250 | { "Never","Nie" }, |
251 | { "New event...","Neuer Termin..." }, | 251 | { "New event...","Neuer Termin..." }, |
252 | { "New event","Neuer Termin" }, | 252 | { "New event","Neuer Termin" }, |
253 | { "New Event...","Neuer Termin..." }, | 253 | { "New Event...","Neuer Termin..." }, |
254 | { "New Events/Todos should","Neue Termine/Todos sollten" }, | 254 | { "New Events/Todos should","Neue Termine/Todos sollten" }, |
255 | { "&New","&Neu" }, | 255 | { "&New","&Neu" }, |
256 | { "New","Neu", }, | 256 | { "New","Neu", }, |
257 | { "New Sub-Todo...","Neues Sub-Todo..." }, | 257 | { "New Sub-Todo...","Neues Sub-Todo..." }, |
258 | { "New Todo...","Neues Todo..." }, | 258 | { "New Todo...","Neues Todo..." }, |
259 | { "Next Alarm: ","Nächster Alarm: ", }, | 259 | { "Next Alarm: ","Nächster Alarm: ", }, |
260 | { "&Next Day","&Nächster Tag", }, | 260 | { "&Next Day","&Nächster Tag", }, |
261 | { "Next days view uses full window","Nächste-X-Tage nutzt Vollbild" }, | 261 | { "Next days view uses full window","Nächste-X-Tage nutzt Vollbild" }, |
262 | { "Next month","Nächster Monat" }, | 262 | { "Next month","Nächster Monat" }, |
263 | { "&Next Week","&Nächste Woche" }, | 263 | { "&Next Week","&Nächste Woche" }, |
264 | { "Next year","Nächstes Jahr" }, | 264 | { "Next year","Nächstes Jahr" }, |
265 | { "Next Year","Nächstes Jahr" }, | 265 | { "Next Year","Nächstes Jahr" }, |
266 | { "%n h","%n Std" }, | 266 | { "%n h","%n Std" }, |
267 | { "No ending date","Kein End-Datum", }, | 267 | { "No ending date","Kein End-Datum", }, |
268 | { "No event, nothing to do.","Kein Termin, nichts zu tun.", }, | 268 | { "No event, nothing to do.","Kein Termin, nichts zu tun.", }, |
269 | { "No event selected.","Kein Termin selektiert" }, | 269 | { "No event selected.","Kein Termin selektiert" }, |
270 | { "No","Nein" }, | 270 | { "No","Nein" }, |
271 | { "No program set","Kein Programm ausgewählt", }, | 271 | { "No program set","Kein Programm ausgewählt", }, |
272 | { "Normal","Normal" }, | 272 | { "Normal","Normal" }, |
273 | { "[No selection]","Keine Selektion", }, | 273 | { "[No selection]","Keine Selektion", }, |
274 | { "No sound set","Kein Sound ausgewählt", }, | 274 | { "No sound set","Kein Sound ausgewählt", }, |
275 | { "no time ","keine Zeit ", }, | 275 | { "no time ","keine Zeit ", }, |
276 | { "no time","keine Zeit", }, | 276 | { "no time","keine Zeit", }, |
277 | { "No Time","Keine Zeit" }, | 277 | { "No Time","Keine Zeit" }, |
278 | { "November","November" }, | 278 | { "November","November" }, |
279 | { "Nov","Nov", }, | 279 | { "Nov","Nov", }, |
280 | { "\nThis event recurs\nover multiple dates.\n","\nDieser Termin wiederholt sich an mehreren Tagen.\n" }, | 280 | { "\nThis event recurs\nover multiple dates.\n","\nDieser Termin wiederholt sich an mehreren Tagen.\n" }, |
281 | { "occurrence(s)","Vorkommen" }, | 281 | { "occurrence(s)","Vorkommen" }, |
282 | { "October","Oktober" }, | 282 | { "October","Oktober" }, |
283 | { "Oct","Okt", }, | 283 | { "Oct","Okt", }, |
284 | { "O-due!","Ü-fällig! " }, | 284 | { "O-due!","Ü-fällig! " }, |
285 | { "&OK","&OK" }, | 285 | { "&OK","&OK" }, |
286 | { "Ok+Show!","Ok+Anzeigen" }, | 286 | { "Ok+Show!","Ok+Anzeigen" }, |
287 | { "Organizer: %1","Organisator %1" }, | 287 | { "Organizer: %1","Organisator %1" }, |
288 | { "Organizer","Organisator" }, | 288 | { "Organizer","Organisator" }, |
289 | { "Owner: ","Besitzer: " }, | 289 | { "Owner: ","Besitzer: " }, |
290 | { "Owner:","Besitzer:" }, | 290 | { "Owner:","Besitzer:" }, |
291 | { "<p><b>Priority:</b> %2</p>","<p><b>Priorität:</b> %2</p>" }, | 291 | { "<p><b>Priority:</b> %2</p>","<p><b>Priorität:</b> %2</p>" }, |
292 | { "Pick a date to display","Wähle einen Tag zum anzeigen aus" }, | 292 | { "Pick a date to display","Wähle einen Tag zum anzeigen aus" }, |
293 | { "Please specify a valid due date.","Bitte gültiges Fälligkeitsdatum angeben."}, | 293 | { "Please specify a valid due date.","Bitte gültiges Fälligkeitsdatum angeben."}, |
294 | { "Please specify a valid end date,\nfor example '%1'.","Bitte gültiges Enddatum angeben,\nz.B.'%1'." }, | 294 | { "Please specify a valid end date,\nfor example '%1'.","Bitte gültiges Enddatum angeben,\nz.B.'%1'." }, |
295 | { "Please specify a valid start date.","Bitte gültiges Startdatum angeben." }, | 295 | { "Please specify a valid start date.","Bitte gültiges Startdatum angeben." }, |
296 | { "Please specify a valid start date,\nfor example '%1'.","Bitte gültiges Startdatum angeben,\nz.B. '%1'." }, | 296 | { "Please specify a valid start date,\nfor example '%1'.","Bitte gültiges Startdatum angeben,\nz.B. '%1'." }, |
297 | { "Please specify a valid start time.","Bitte gültige Startzeit angeben."}, | 297 | { "Please specify a valid start time.","Bitte gültige Startzeit angeben."}, |
298 | { "Please specify a valid start time,\nfor example '%1'.","Bitte gültige Startzeit angeben,\nz.B. '%1'." }, | 298 | { "Please specify a valid start time,\nfor example '%1'.","Bitte gültige Startzeit angeben,\nz.B. '%1'." }, |
299 | { "Preferences - some settings need a restart (nr)","Einstellungen - teilweise Neustart erforderlich (bn)" }, | 299 | { "Preferences - some settings need a restart (nr)","Einstellungen - teilweise Neustart erforderlich (bn)" }, |
300 | { "&Previous Day","Vorheriger Tag" }, | 300 | { "&Previous Day","Vorheriger Tag" }, |
301 | { "Previous month","Vorheriger Monat" }, | 301 | { "Previous month","Vorheriger Monat" }, |
302 | { "Previous Month","Vorheriger Monat" }, | 302 | { "Previous Month","Vorheriger Monat" }, |
303 | { "&Previous Week","Vorherige Woche" }, | 303 | { "&Previous Week","Vorherige Woche" }, |
304 | { "Previous year","Vorheriges Jahr" }, | 304 | { "Previous year","Vorheriges Jahr" }, |
305 | { "Previous Year","Vorheriges Jahr" }, | 305 | { "Previous Year","Vorheriges Jahr" }, |
306 | { "Printing","Drucken" }, | 306 | { "Printing","Drucken" }, |
307 | { "Priority:","Priorität:" }, | 307 | { "Priority:","Priorität:" }, |
308 | { "Private","Privat" }, | 308 | { "Private","Privat" }, |
309 | { "Proceed","Weiter" }, | 309 | { "Proceed","Weiter" }, |
310 | { "Public","Öffentlich" }, | 310 | { "Public","Öffentlich" }, |
311 | { "Purge","Entferne" }, | 311 | { "Purge","Entferne" }, |
312 | { "Purge Completed","Entferne erledigte Todos" }, | 312 | { "Purge Completed","Entferne erledigte Todos" }, |
313 | { "Purge Todos","Todos bereinigen" }, | 313 | { "Purge Todos","Todos bereinigen" }, |
314 | { "read-only","schreibgeschützt" }, | 314 | { "read-only","schreibgeschützt" }, |
315 | { "Recur every","Wiederh. alle" }, | 315 | { "Recur every","Wiederh. alle" }, |
316 | { "Recur in the month of","Wiederh. im Monat" }, | 316 | { "Recur in the month of","Wiederh. im Monat" }, |
317 | { "Recur on the","Wiederh. am" }, | 317 | { "Recur on the","Wiederh. am" }, |
318 | { "Recur on this day","Wiederh. am diesen Tag" }, | 318 | { "Recur on this day","Wiederh. am diesen Tag" }, |
319 | { "Recurrence Range...","Wiederholungs Zeitraum..." }, | 319 | { "Recurrence Range...","Wiederholungs Zeitraum..." }, |
320 | { "Recurrence Range","Wiederholungs Zeitraum" }, | 320 | { "Recurrence Range","Wiederholungs Zeitraum" }, |
321 | { "Recurrence Rule","Wiederholungs Regel" }, | 321 | { "Recurrence Rule","Wiederholungs Regel" }, |
322 | { "Recurrence","Wiederholung" }, | 322 | { "Recurrence","Wiederholung" }, |
323 | { "Recurs","Wiederholung" }, | 323 | { "Recurs","Wiederholung" }, |
324 | {"&Reject","Abweisen"}, | 324 | {"&Reject","Abweisen"}, |
325 | { "Reminder:","Alarm:" }, | 325 | { "Reminder:","Alarm:" }, |
326 | { "Rem.:","Alarm:" }, | 326 | { "Rem.:","Alarm:" }, |
327 | { "Rem.","Alarm:" }, | 327 | { "Rem.","Alarm:" }, |
328 | { "Remote file:","Remote Datei:"}, | 328 | { "Remote file:","Remote Datei:"}, |
329 | { "Remote IP:","Remote (ferne) IP:" }, | 329 | { "Remote IP:","Remote (ferne) IP:" }, |
330 | { "Remote syncing (via ssh/scp) network settings ","Remote Sync (via ssh/scp) Netzwerk Einstellungen " }, | 330 | { "Remote syncing (via ssh/scp) network settings ","Remote Sync (via ssh/scp) Netzwerk Einstellungen " }, |
331 | { "Remote user:","Remote Benutzer"}, | 331 | { "Remote user:","Remote Benutzer"}, |
332 | { "&Remove","Entfe&rnen" }, | 332 | { "&Remove","Entfe&rnen" }, |
333 | { "Remove","Entfernen" }, | 333 | { "Remove","Entfernen" }, |
334 | { "Request response","Bemerkung anfordern" }, | 334 | { "Request response","Bemerkung anfordern" }, |
335 | { "Role:","Rolle:" }, | 335 | { "Role:","Rolle:" }, |
336 | { "Role","Rolle" }, | 336 | { "Role","Rolle" }, |
337 | { "Sat","Sa" }, | 337 | { "Sat","Sa" }, |
338 | { "Saturday","Samstag" }, | 338 | { "Saturday","Samstag" }, |
339 | { "Search for:","Suche nach:" }, | 339 | { "Search for:","Suche nach:" }, |
340 | { "Search In","Suche in" }, | 340 | { "Search In","Suche in" }, |
341 | { "Search...","Suche..." }, | 341 | { "Search...","Suche..." }, |
342 | { "Search","Suche" }, | 342 | { "Search","Suche" }, |
343 | { "Select Addresses","Wähle Adressen" }, | 343 | { "Select Addresses","Wähle Adressen" }, |
344 | { "Select all","Selektiere Alle" }, | 344 | { "Select all","Selektiere Alle" }, |
345 | { "Select a month","Wähle Monat" }, | 345 | { "Select a month","Wähle Monat" }, |
346 | { "Select a week","Wähle Woche" }, | 346 | { "Select a week","Wähle Woche" }, |
347 | { "Select a year","Wähle Jahr" }, | 347 | { "Select a year","Wähle Jahr" }, |
348 | { "Send directly","Sende direkt" }, | 348 | { "Send directly","Sende direkt" }, |
349 | { "&Send Messages","&Sende Nachrichten", }, | 349 | { "&Send Messages","&Sende Nachrichten", }, |
350 | { "Sep","Sep" }, | 350 | { "Sep","Sep" }, |
351 | { "September","September" }, | 351 | { "September","September" }, |
352 | { "Shopping","Einkaufen" }, | 352 | { "Shopping","Einkaufen" }, |
353 | { "Show Dates","Zeige Daten" }, | 353 | { "Show Dates","Zeige Daten" }, |
354 | { "Show events that recur daily in date nav.","Zeige tägl.wiederh.Term.in Datums Nav." }, | 354 | { "Show events that recur daily in date nav.","Zeige tägl.wiederh.Term.in Datums Nav." }, |
355 | { "Show Event...","Zeige Termin..." }, | 355 | { "Show Event...","Zeige Termin..." }, |
356 | { "Show ev. that recur weekly in date nav.","Zeige wöch.wiederh.Term.in Datums Nav." }, | 356 | { "Show ev. that recur weekly in date nav.","Zeige wöch.wiederh.Term.in Datums Nav." }, |
357 | { "Show Marcus Bains line","Zeige Marcus Bains Linie" }, | 357 | { "Show Marcus Bains line","Zeige Marcus Bains Linie" }, |
358 | { "Show summary after syncing","Zeige Zusammenfassung nach Sync." }, | 358 | { "Show summary after syncing","Zeige Zusammenfassung nach Sync." }, |
359 | { "Show time as:","Zeige Zeit als" }, | 359 | { "Show time as:","Zeige Zeit als" }, |
360 | { "Show Todo...","Zeige To-Do" }, | 360 | { "Show Todo...","Zeige To-Do" }, |
361 | { "Show vertical screen (Needs restart)","Vertikaler Bildschirm-Layout (Neustart!)" }, | 361 | { "Show vertical screen (Needs restart)","Vertikaler Bildschirm-Layout (Neustart!)" }, |
362 | { "&Show","Zeige" }, | 362 | { "&Show","Zeige" }, |
363 | { "Show...","Zeige..." }, | 363 | { "Show...","Zeige..." }, |
364 | { "Show","Zeige" }, | 364 | { "Show","Zeige" }, |
365 | { "Small","Klein" }, | 365 | { "Small","Klein" }, |
366 | { "Sorry","Entschuldigung" }, | 366 | { "Sorry","Entschuldigung" }, |
367 | {"Sorry, the copy command failed!\nCommand was:\n","Der Kopierbefehl schlug fehl!\nBefehl war:\n"}, | 367 | {"Sorry, the copy command failed!\nCommand was:\n","Der Kopierbefehl schlug fehl!\nBefehl war:\n"}, |
368 | { "Start:","Start:" }, | 368 | { "Start:","Start:" }, |
369 | { "Start Date","Start Datum" }, | 369 | { "Start Date","Start Datum" }, |
370 | { "Start date: %1","Start Datum: %1" }, | 370 | { "Start date: %1","Start Datum: %1" }, |
371 | { "Start Time","Start Zeit" }, | 371 | { "Start Time","Start Zeit" }, |
372 | { "Status:","Status:" }, | 372 | { "Status:","Status:" }, |
373 | { "Status","Status:" }, | 373 | { "Status","Status:" }, |
374 | { "Summaries","Titel" }, | 374 | { "Summaries","Titel" }, |
375 | { "Summary:","Titel:" }, | 375 | { "Summary:","Titel:" }, |
376 | { "Summary","Titel" }, | 376 | { "Summary","Titel" }, |
377 | { "Sunday","Sonntag" }, | 377 | { "Sunday","Sonntag" }, |
378 | { "Sun","So" }, | 378 | { "Sun","So" }, |
379 | { "Sync preferences:","Sync Einstellungen" }, | 379 | { "Sync preferences:","Sync Einstellungen" }, |
380 | { "Sync Prefs","Sync Einstellungen" }, | 380 | { "Sync Prefs","Sync Einstellungen" }, |
381 | { "Syncronize","Daten abgleich" }, | 381 | { "Syncronize","Daten abgleich" }, |
382 | { "Take local entry on conflict","Nimm lokalen Eintrag beim Konflikt" }, | 382 | { "Take local entry on conflict","Nimm lokalen Eintrag beim Konflikt" }, |
383 | { "Take newest entry on conflict","Nimm neuesten Eintrag beim Konflikt" }, | 383 | { "Take newest entry on conflict","Nimm neuesten Eintrag beim Konflikt" }, |
384 | { "Take remote entry on conflict","Nimm fernen Eintrag beim Konflikt" }, | 384 | { "Take remote entry on conflict","Nimm fernen Eintrag beim Konflikt" }, |
385 | { "Template '%1' does not contain a valid Todo.","Template '%1' enthält kein gültiges To-Do" }, | 385 | { "Template '%1' does not contain a valid Todo.","Template '%1' enthält kein gültiges To-Do" }, |
386 | { "Template does not contain a valid Event.","Template '%1' enthält keinen gültigen Termin" }, | 386 | { "Template does not contain a valid Event.","Template '%1' enthält keinen gültigen Termin" }, |
387 | { "Template...","Vorlage..." }, | 387 | { "Template...","Vorlage..." }, |
388 | { "This day","Dieser Tag" }, | 388 | { "This day","Dieser Tag" }, |
389 | { "This is an experimental feature. ","Dieses Feature ist experimentel" }, | 389 | { "This is an experimental feature. ","Dieses Feature ist experimentel" }, |
390 | { "This item will be\npermanently deleted.","Dieser Eintrag wird\nkomplett gelöscht." }, | 390 | { "This item will be\npermanently deleted.","Dieser Eintrag wird\nkomplett gelöscht." }, |
391 | { "This item will be permanently deleted.", "Dieser Eintrag wird komplett gelöscht." }, | 391 | { "This item will be permanently deleted.", "Dieser Eintrag wird komplett gelöscht." }, |
392 | { "Thu","Do" }, | 392 | { "Thu","Do" }, |
393 | { "Thursday","Donnerstag" }, | 393 | { "Thursday","Donnerstag" }, |
394 | { "Time associated","Mit Zeit" }, | 394 | { "Time associated","Mit Zeit" }, |
395 | { "Time bar:","Uhrzeit Zeile:" }, | 395 | { "Time bar:","Uhrzeit Zeile:" }, |
396 | { "Time && Date","Zeit und Datum" }, | 396 | { "Time && Date","Zeit und Datum" }, |
397 | { "Time Format","Zeit Format" }, | 397 | { "Time Format","Zeit Format" }, |
398 | { "Time Format(nr):","Zeit Format(Neustart!)" }, | 398 | { "Time Format(nr):","Zeit Format(Neustart!)" }, |
399 | { "Date Labels:","Datumsleiste:" }, | 399 | { "Date Labels:","Datumsleiste:" }, |
400 | { "Time: ","Zeit: " }, | 400 | { "Time: ","Zeit: " }, |
401 | { "Timezone:","Zeitzone:" }, | 401 | { "Timezone:","Zeitzone:" }, |
402 | { "To: ","Bis: " }, | 402 | { "To: ","Bis: " }, |
403 | { "To:","Bis:" }, | 403 | { "To:","Bis:" }, |
404 | { "Today: ","Heute: " }, | 404 | { "Today: ","Heute: " }, |
405 | { "Todo due today color:","Heute fällige To-Do's" }, | 405 | { "Todo due today color:","Heute fällige To-Do's" }, |
406 | { "To-do items:","To-Do items:" }, | 406 | { "To-do items:","To-Do items:" }, |
407 | { "Todo overdue color:","Überfällige To-Do's" }, | 407 | { "Todo overdue color:","Überfällige To-Do's" }, |
408 | { "Todo","Todo" }, | 408 | { "Todo","Todo" }, |
409 | { "To-do view shows completed Todos","To-do Ansicht zeigt erledigte To-dos" }, | 409 | { "To-do view shows completed Todos","To-do Ansicht zeigt erledigte To-dos" }, |
410 | { "ToDoView:","Todo Ansicht:" }, | 410 | { "ToDoView:","Todo Ansicht:" }, |
411 | { "Toggle Alarm","Wechsle Alarm" }, | 411 | { "Toggle Alarm","Wechsle Alarm" }, |
412 | { "Toggle Allday","Umschalten Ganztag" }, | 412 | { "Toggle Allday","Umschalten Ganztag" }, |
413 | { "Tomorrow: ","Morgen: " }, | 413 | { "Tomorrow: ","Morgen: " }, |
414 | { "Tue","Di" }, | 414 | { "Tue","Di" }, |
415 | { "Tuesday","Dienstag" }, | 415 | { "Tuesday","Dienstag" }, |
416 | { "Two entries are in conflict, if: ","Zwei Einträge haben einen Konflikt, wenn:" }, | 416 | { "Two entries are in conflict, if: ","Zwei Einträge haben einen Konflikt, wenn:" }, |
417 | { "Unable to find template '%1'.","Kann Vorlage '%1' nicht finden." }, | 417 | { "Unable to find template '%1'.","Kann Vorlage '%1' nicht finden." }, |
418 | { "Unknown","Unbekannt" }, | 418 | { "Unknown","Unbekannt" }, |
419 | { "Up","Hinauf" }, | 419 | { "Up","Hinauf" }, |
420 | { "Use password (if not, ask when syncing)","Passwort: (sonst jedesmal anfragen)" }, | 420 | { "Use password (if not, ask when syncing)","Passwort: (sonst jedesmal anfragen)" }, |
421 | { "User defined","Benutzerdefiniert" }, | 421 | { "User defined","Benutzerdefiniert" }, |
422 | { "User long date:","Format langes Datum:" }, | 422 | { "User long date:","Format langes Datum:" }, |
423 | { "User short date:","Forma kurzes Datum:" }, | 423 | { "User short date:","Forma kurzes Datum:" }, |
424 | { "View","Ansicht" }, | 424 | { "View","Ansicht" }, |
425 | { "View Fonts","Schriftarten Ansichten" }, | 425 | { "View Fonts","Schriftarten Ansichten" }, |
426 | { "Views","Ansichten" }, | 426 | { "Views","Ansichten" }, |
427 | { "Wed","Mi" }, | 427 | { "Wed","Mi" }, |
428 | { "Wednesday","Mittwoch" }, | 428 | { "Wednesday","Mittwoch" }, |
429 | { "Week %1","Woche %1" }, | 429 | { "Week %1","Woche %1" }, |
430 | { "Weekly","Wöchentlich" }, | 430 | { "Weekly","Wöchentlich" }, |
431 | { "Week starts on Sunday","Woche beginnt Sonntags" }, | 431 | { "Week starts on Sunday","Woche beginnt Sonntags" }, |
432 | { "What's Next View:","What's Next Anz." }, | 432 | { "What's Next View:","What's Next Anz." }, |
433 | { "What's next ?","Was kommt als nächstes?(What's Next)" }, | 433 | { "What's next ?","Was kommt als nächstes?(What's Next)" }, |
434 | { "Working Hours","Tägliche Arbeitszeit" }, | 434 | { "Working Hours","Tägliche Arbeitszeit" }, |
435 | { "Working hours color:","Arbeitszeit in der Agenda Ansicht:" }, | 435 | { "Working hours color:","Arbeitszeit in der Agenda Ansicht:" }, |
436 | { "Write back existing entries only","Nur exisitierende Einträge zurückschreiben" }, | 436 | { "Write back existing entries only","Nur exisitierende Einträge zurückschreiben" }, |
437 | { "Write back synced file","Syncronisierte Datei zurückschreiben" }, | 437 | { "Write back synced file","Syncronisierte Datei zurückschreiben" }, |
438 | { "Yearly","Jährlich" }, | 438 | { "Yearly","Jährlich" }, |
439 | { "year(s)","Jahr(e)" }, | 439 | { "year(s)","Jahr(e)" }, |
440 | { "Yes","Ja" }, | 440 | { "Yes","Ja" }, |
441 | { "You have %d item(s) selected.\n","Sie haben %d Einträge ausgewählt.\n" }, | 441 | { "You have %d item(s) selected.\n","Sie haben %d Einträge ausgewählt.\n" }, |
442 | { "You have to restart KOrganizer for this setting to take effect.","Sie müssem Korganizer neu starten, damit diese Einstellung aktiviert wird." }, | 442 | { "You have to restart KOrganizer for this setting to take effect.","Sie müssem Korganizer neu starten, damit diese Einstellung aktiviert wird." }, |
443 | { "week(s) on:","Woche(n) am: " }, | 443 | { "week(s) on:","Woche(n) am: " }, |
444 | { "Full menu bar(nr)","Volle Menuleiste(bn)" }, | 444 | { "Full menu bar(nr)","Volle Menuleiste(bn)" }, |
445 | { "Timezone has daylight saving","Zeitzone hat Sommerzeit" }, | 445 | { "Timezone has daylight saving","Zeitzone hat Sommerzeit" }, |
446 | { "Actual start and end is the\nsunday before this date.","Tatsächlicher Beginn/Ende ist der\nSonntag vor diesem Datum!" }, | 446 | { "Actual start and end is the\nsunday before this date.","Tatsächlicher Beginn/Ende ist der\nSonntag vor diesem Datum!" }, |
447 | { "The year in the date is ignored.","Das Jahr vom Datum wird ignoriert." }, | 447 | { "The year in the date is ignored.","Das Jahr vom Datum wird ignoriert." }, |
448 | { "Daylight start:","Sommerzeit Start:" }, | 448 | { "Daylight start:","Sommerzeit Start:" }, |
449 | { "Daylight end:","Sommerzeit Ende:" }, | 449 | { "Daylight end:","Sommerzeit Ende:" }, |
450 | { "Time Zone","Zeitzone" }, | 450 | { "Time Zone","Zeitzone" }, |
451 | { "Monday 19 April 2004: %A %d %B %Y","Montag 19 April 2004: %A %d %B %Y" }, | 451 | { "Monday 19 April 2004: %A %d %B %Y","Montag 19 April 2004: %A %d %B %Y" }, |
452 | { "%A: Monday --- %a: Mon","%A: Montag --- %a: Mon" }, | 452 | { "%A: Monday --- %a: Mon","%A: Montag --- %a: Mon" }, |
453 | { "minutely","minütlich" }, | 453 | { "minutely","minütlich" }, |
454 | { "hourly","stündlich" }, | 454 | { "hourly","stündlich" }, |
455 | { "daily","täglich" }, | 455 | { "daily","täglich" }, |
456 | { "weekly","wöchentlich" }, | 456 | { "weekly","wöchentlich" }, |
457 | { "monthly","monatlich" }, | 457 | { "monthly","monatlich" }, |
458 | { "day-monthly","tag-monatlich" }, | 458 | { "day-monthly","tag-monatlich" }, |
459 | { "month-yearly","monat-jährlich" }, | 459 | { "month-yearly","monat-jährlich" }, |
460 | { "day-yearly","tag-jährlich" }, | 460 | { "day-yearly","tag-jährlich" }, |
461 | { "position-yearly","pos-jährlich" }, | 461 | { "position-yearly","pos-jährlich" }, |
462 | { "Edit item on doubleclick (if not, show)","Editiere mit Doppelklick(wenn nicht, zeige)" }, | 462 | { "Edit item on doubleclick (if not, show)","Editiere mit Doppelklick(wenn nicht, zeige)" }, |
463 | { "Highlight current day in agenda","Hebe >>heute<< in Agenda hervor" }, | 463 | { "Highlight current day in agenda","Hebe >>heute<< in Agenda hervor" }, |
464 | { "Use light color for highlight current day","Helle Farbe für >>heute<< Hervorhebung" }, | 464 | { "Use light color for highlight current day","Helle Farbe für >>heute<< Hervorhebung" }, |
465 | { "Highlight selection in Time Edit","Hebe Auswahl in Zeit Edit hervor" }, | 465 | { "Highlight selection in Time Edit","Hebe Auswahl in Zeit Edit hervor" }, |
466 | { "Hold fullscreen on view change","Behalte Vollbild bei Ansichswechsel" }, | 466 | { "Hold fullscreen on view change","Behalte Vollbild bei Ansichswechsel" }, |
467 | { "Hold non-fullscreen on view change","Behalte Nicht-Vollbild bei Ansichtsw." }, | 467 | { "Hold non-fullscreen on view change","Behalte Nicht-Vollbild bei Ansichtsw." }, |
468 | { "Event list view uses full window","Listenansicht nutzt Vollbild" }, | 468 | { "Event list view uses full window","Listenansicht nutzt Vollbild" }, |
469 | { "Set agenda to DayBeginsAt on change","Setze Agenda auf TagBeginntUm bei Wechsel" }, | 469 | { "Set agenda to DayBeginsAt on change","Setze Agenda auf TagBeginntUm bei Wechsel" }, |
470 | { "Set agenda to current time on change","Setze Agenda auf gegenw.Zeit bei Wechsel" }, | 470 | { "Set agenda to current time on change","Setze Agenda auf gegenw.Zeit bei Wechsel" }, |
471 | { "Listview uses monthly timespan","Listenansicht zeigt monatliche Zeitspanne" }, | 471 | { "Listview uses monthly timespan","Listenansicht zeigt monatliche Zeitspanne" }, |
472 | { "ViewChange","Ansichtswechsel" }, | 472 | { "ViewChange","Ansichtswechsel" }, |
473 | { "Default alarm *.wav file:","Standard Alarm *.wav Datei:" }, | 473 | { "Default alarm *.wav file:","Standard Alarm *.wav Datei:" }, |
474 | { "This setting is useless for 5500 user!","Diese Einst. ist nutzlos für 5500 Nutzer" }, | 474 | { "This setting is useless for 5500 user!","Diese Einst. ist nutzlos für 5500 Nutzer" }, |
475 | { "File","Datei" }, | 475 | { "File","Datei" }, |
476 | { "Clone...","Dupliziere.." }, | 476 | { "Clone...","Dupliziere.." }, |
477 | { "Move...","Bewege..." }, | 477 | { "Move...","Bewege..." }, |
478 | { "Beam...","Sende via IR..." }, | 478 | { "Beam...","Sende via IR..." }, |
479 | { "&Clone...","Dupliziere.." }, | 479 | { "&Clone...","Dupliziere.." }, |
480 | { "&Move...","Bewege..." }, | 480 | { "&Move...","Bewege..." }, |
481 | { "&Beam...","Sende via IR..." }, | 481 | { "&Beam...","Sende via IR..." }, |
482 | { "Show Completed","Zeige erledigte Todos" }, | 482 | { "Show Completed","Zeige erledigte Todos" }, |
483 | { "Show Quick Todo","Zeige Quick Todo" }, | 483 | { "Show Quick Todo","Zeige Quick Todo" }, |
484 | { "Unparent Todo","Un-sub Todo" }, | 484 | { "Unparent Todo","Un-sub Todo" }, |
485 | { "Save selected to file...","Speichere Selektierte..." }, | 485 | { "Save selected to file...","Speichere Selektierte..." }, |
486 | { "Add Categ. to selected...","Füge zu Selekt. Kateg. hinzu..." }, | 486 | { "Add Categ. to selected...","Füge zu Selekt. Kateg. hinzu..." }, |
487 | { "Set Categ. for selected...","Setze Kateg. für Selekt." }, | 487 | { "Set Categ. for selected...","Setze Kateg. für Selekt." }, |
488 | { "Beam selected via IR","Sende Selekt. via IR..." }, | 488 | { "Beam selected via IR","Sende Selekt. via IR..." }, |
489 | { "Search","Suchen" }, | 489 | { "Search","Suchen" }, |
490 | { "Date Picker","Datum auswählen" }, | 490 | { "Date Picker","Datum auswählen" }, |
491 | { "Day View","Tagesansicht" }, | 491 | { "Day View","Tagesansicht" }, |
492 | { "Work Week","Arbeitswoche" }, | 492 | { "Work Week","Arbeitswoche" }, |
493 | { "Week","Wochenansicht" }, | 493 | { "Week","Wochenansicht" }, |
494 | { "Month","Monatsansicht" }, | 494 | { "Month","Monatsansicht" }, |
495 | { "Todo View","Todo Liste" }, | 495 | { "Todo View","Todo Liste" }, |
496 | { "Journal","Journal" }, | 496 | { "Journal","Journal" }, |
497 | { "Next days","Nächste Tage" }, | 497 | { "Next days","Nächste Tage" }, |
498 | { "Print agenda selection...","Drucke Agendaselektion..." }, | 498 | { "Print agenda selection...","Drucke Agendaselektion..." }, |
499 | { "Toggle DateNavigator","Navigator umschalten" }, | 499 | { "Toggle DateNavigator","Navigator umschalten" }, |
500 | { "Toggle FilterView","Filteransicht umschalten" }, | 500 | { "Toggle FilterView","Filteransicht umschalten" }, |
501 | { "Prev. month","Vorheriger Monat" }, | 501 | { "Prev. month","Vorheriger Monat" }, |
502 | { "Go backward","Gehe zurück" }, | 502 | { "Go backward","Gehe zurück" }, |
503 | { "Go forward","Gehe weiter" }, | 503 | { "Go forward","Gehe weiter" }, |
504 | { "Synchronize","Synchronisieren" }, | 504 | { "Synchronize","Synchronisieren" }, |
505 | { "AgendaSize","Agendagröße" }, | 505 | { "AgendaSize","Agendagröße" }, |
506 | { "Import (*.ics/*.vcs) file","Importiere (*.ics/*.vcs) Datei" }, | 506 | { "Import (*.ics/*.vcs) file","Importiere (*.ics/*.vcs) Datei" }, |
507 | { "Import last file","Importiere letzte Datei" }, | 507 | { "Import last file","Importiere letzte Datei" }, |
508 | { "Import Opie/Qtopia Cal.","Importiere Opie/Qtopia Kal." }, | 508 | { "Import Opie/Qtopia Cal.","Importiere Opie/Qtopia Kal." }, |
509 | { "Load Calendar Backup","Lade Kalender Backup" }, | 509 | { "Load Calendar Backup","Lade Kalender Backup" }, |
510 | { "Save Calendar Backup","Speichere Kalender Backup" }, | 510 | { "Save Calendar Backup","Speichere Kalender Backup" }, |
511 | { "Export VCalendar","Exportiere VCalendar" }, | 511 | { "Export VCalendar","Exportiere VCalendar" }, |
512 | { "Manage new categories...","Verwalte neue Kategorien..." }, | 512 | { "Manage new categories...","Verwalte neue Kategorien..." }, |
513 | { "Beam complete calendar...","Sende kompletten Kalender via IR" }, | 513 | { "Beam complete calendar...","Sende kompletten Kalender via IR" }, |
514 | { "Beam filtered calendar...","Sende gefilterten Kalender via IR" }, | 514 | { "Beam filtered calendar...","Sende gefilterten Kalender via IR" }, |
515 | { "Remote via ssh","Über Netzwerk via ssh" }, | 515 | { "Remote via ssh","Über Netzwerk via ssh" }, |
516 | { "With local file","Mit lokaler Datei" }, | 516 | { "With local file","Mit lokaler Datei" }, |
517 | { "With last file","Mit letzter Datei" }, | 517 | { "With last file","Mit letzter Datei" }, |
518 | { "KO/Pi: Ready for beaming","KO/Pi: Bereit zum Senden" }, | 518 | { "KO/Pi: Ready for beaming","KO/Pi: Bereit zum Senden" }, |
519 | { "KO/Pi:Beaming done","KO/Pi: Senden erfolgt" }, | 519 | { "KO/Pi:Beaming done","KO/Pi: Senden erfolgt" }, |
520 | { "Save filename","Speichern: Dateinamen wählen" }, | 520 | { "Save filename","Speichern: Dateinamen wählen" }, |
521 | { "File already exists!\nOld file from:\n%1\nOverwrite?\n","Dateiname existiert bereits!\nAlte Datei vom:\n%1\nÜberschreiben?\n" }, | 521 | { "File already exists!\nOld file from:\n%1\nOverwrite?\n","Dateiname existiert bereits!\nAlte Datei vom:\n%1\nÜberschreiben?\n" }, |
522 | { "KO/Pi: Warning!","KO/Pi: Warnung!" }, | 522 | { "KO/Pi: Warning!","KO/Pi: Warnung!" }, |
523 | { "Overwrite!","Überschreibe!" }, | 523 | { "Overwrite!","Überschreibe!" }, |
524 | { "KO/Pi:Saved %1","KO/Pi:Gespeichert %1" }, | 524 | { "KO/Pi:Saved %1","KO/Pi:Gespeichert %1" }, |
525 | { "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" }, | 525 | { "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" }, |
526 | { "KO/Pi Confirmation","KO/Pi Bestätigung" }, | 526 | { "KO/Pi Confirmation","KO/Pi Bestätigung" }, |
527 | { "Close dialog to abort deletion!","Schließe Dialog um das Löschen abzubrechen!" }, | 527 | { "Close dialog to abort deletion!","Schließe Dialog um das Löschen abzubrechen!" }, |
528 | { "Deleting item %d ...","Lösche Eintrag %d ..." }, | 528 | { "Deleting item %d ...","Lösche Eintrag %d ..." }, |
529 | { "%d items remaining in list.","%d Einträge sind in der Liste verblieben." }, | 529 | { "%d items remaining in list.","%d Einträge sind in der Liste verblieben." }, |
530 | { "Size","Größe" }, | 530 | { "Size","Größe" }, |
531 | { "Date","Datum" }, | 531 | { "Date","Datum" }, |
532 | { "Mime Type","Datei Typ" }, | 532 | { "Mime Type","Datei Typ" }, |
533 | { "All Files","Alle Dateien" }, | 533 | { "All Files","Alle Dateien" }, |
534 | { "Files","Dateien" }, | 534 | { "Files","Dateien" }, |
535 | { "Documents","DoKumente" }, | 535 | { "Documents","DoKumente" }, |
536 | { "Select Categories","Selektiere Kategorien" }, | 536 | { "Select Categories","Selektiere Kategorien" }, |
537 | { " &Deselect All "," Auswahl aufheben " }, | 537 | { " &Deselect All "," Auswahl aufheben " }, |
538 | { "A&dd","Hinzu" }, | 538 | { "A&dd","Hinzu" }, |
539 | { "&Modify","Ändern" }, | 539 | { "&Modify","Ändern" }, |
540 | { "Edit Categories","Editiere Kategorien" }, | 540 | { "Edit Categories","Editiere Kategorien" }, |
541 | { " &Edit Categories "," &Editiere Kategorien " }, | 541 | { " &Edit Categories "," &Editiere Kategorien " }, |
542 | { "Beam Options","Beam Einstellungen" }, | 542 | { "Beam Options","Beam Einstellungen" }, |
543 | { " With timezone "," Mit Zeitzone " }, | 543 | { " With timezone "," Mit Zeitzone " }, |
544 | { " Local time ", " Lokale Zeit " }, | 544 | { " Local time ", " Lokale Zeit " }, |
545 | { "Manage new Categories","Verwalte neue Kategorien" }, | 545 | { "Manage new Categories","Verwalte neue Kategorien" }, |
546 | { "Add to category list","Füge zur Kategorieliste hinzu" }, | 546 | { "Add to category list","Füge zur Kategorieliste hinzu" }, |
547 | { "Remove from Events/Todos","Entferne von Terminen/Todos" }, | 547 | { "Remove from Events/Todos","Entferne von Terminen/Todos" }, |
548 | { "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 " }, | 548 | { "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 " }, |
549 | { "New categories not in list:","Kategorien, die nicht in der Liste sind:" }, | 549 | { "New categories not in list:","Kategorien, die nicht in der Liste sind:" }, |
550 | { "File format","Datei Format" }, | 550 | { "File format","Datei Format" }, |
551 | { "Time format","Zeit Format" }, | 551 | { "Time format","Zeit Format" }, |
552 | { "KO/Pi:Saving Data to File ...","KO/Pi: Speichere Kalender in Datei ..." }, | 552 | { "KO/Pi:Saving Data to File ...","KO/Pi: Speichere Kalender in Datei ..." }, |
553 | { "KO/Pi:File Saved. Needed %d sec, %d ms","KO/Pi: Abgespeichert in %d sec, %d ms" }, | 553 | { "KO/Pi:File Saved. Needed %d sec, %d ms","KO/Pi: Abgespeichert in %d sec, %d ms" }, |
554 | { "h","Std" }, | 554 | { "h","Std" }, |
555 | { "min","Min" }, | 555 | { "min","Min" }, |
556 | { "hou","Std" }, | 556 | { "hou","Std" }, |
557 | { "day","Tag" }, | 557 | { "day","Tag" }, |
558 | { "French","Französich" }, | 558 | { "French","Französich" }, |
559 | { "Time","Zeit" }, | 559 | { "Time","Zeit" }, |
560 | { "Event Viewer","Termin Ansicht" }, | 560 | { "Event Viewer","Termin Ansicht" }, |
561 | { "Cancel Sync","Sync Abbrechen" }, | 561 | { "Cancel Sync","Sync Abbrechen" }, |
562 | { "Remote","Fern" }, | 562 | { "Remote","Fern" }, |
563 | { "Local","Lokal" }, | 563 | { "Local","Lokal" }, |
564 | { "Conflict! Please choose entry","Konflikt! Bitte Eintrag wählen" }, | 564 | { "Conflict! Please choose entry","Konflikt! Bitte Eintrag wählen" }, |
565 | { "Local: ","Lokal: " }, | 565 | { "Local: ","Lokal: " }, |
566 | { "Remote: ","Fern: " }, | 566 | { "Remote: ","Fern: " }, |
567 | { "Last modified: ","Zuletzt geändert: " }, | 567 | { "Last modified: ","Zuletzt geändert: " }, |
568 | { "Location: ","Ort: " }, | 568 | { "Location: ","Ort: " }, |
569 | { "<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>","<p><b>Von:</b> %1 </p><p><b>Bis:</b> %2</p>" }, | 569 | { "<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>","<p><b>Von:</b> %1 </p><p><b>Bis:</b> %2</p>" }, |
570 | { "<p><b>On:</b> %1</p>","<p><b>Am:</b> %1</p>" }, | 570 | { "<p><b>On:</b> %1</p>","<p><b>Am:</b> %1</p>" }, |
571 | { "<p><b>From:</b> %1</p> ","<p><b>Von:</b> %1</p> " }, | 571 | { "<p><b>From:</b> %1</p> ","<p><b>Von:</b> %1</p> " }, |
572 | { "<p><b>To:</b> %1</p>","<p><b>Bis:</b> %1</p>" }, | 572 | { "<p><b>To:</b> %1</p>","<p><b>Bis:</b> %1</p>" }, |
573 | { "<p><b>On:</b> %1</p> ","<p><b>Am:</b> %1</p> " }, | 573 | { "<p><b>On:</b> %1</p> ","<p><b>Am:</b> %1</p> " }, |
574 | { "<p><b>From:</b> %1 <b>To:</b> %2</p>","<p><b>Von:</b> %1 <b>Bis:</b> %2</p>" }, | 574 | { "<p><b>From:</b> %1 <b>To:</b> %2</p>","<p><b>Von:</b> %1 <b>Bis:</b> %2</p>" }, |
575 | { "This is a %1 recurring event.","Das ist ein %1 wiederholender Termin." }, | 575 | { "This is a %1 recurring event.","Das ist ein %1 wiederholender Termin." }, |
576 | { "<b>Next recurrence is on:</b>","<b>Nächste Wiederholung ist am:</b>" }, | 576 | { "<b>Next recurrence is on:</b>","<b>Nächste Wiederholung ist am:</b>" }, |
577 | { "<b>Last recurrence was on:</b>","<b>Letzte Wiederholung war am:</b>" }, | 577 | { "<b>Last recurrence was on:</b>","<b>Letzte Wiederholung war am:</b>" }, |
578 | { "( %1 min before )","( %1 min vorher )" }, | 578 | { "( %1 min before )","( %1 min vorher )" }, |
579 | { "<b>Alarm on: ","<b>Alarm am: " }, | 579 | { "<b>Alarm on: ","<b>Alarm am: " }, |
580 | { "<b>Details: </b>","<b>Details: </b>" }, | 580 | { "<b>Details: </b>","<b>Details: </b>" }, |
581 | { "<p><b>Priority:</b> %2</p>","<p><b>Priorität:</b> %2</p>" }, | 581 | { "<p><b>Priority:</b> %2</p>","<p><b>Priorität:</b> %2</p>" }, |
582 | { "<p><i>%1 % completed</i></p>","<p><i>%1 % erledigt</i></p>" }, | 582 | { "<p><i>%1 % completed</i></p>","<p><i>%1 % erledigt</i></p>" }, |
583 | { "Organizer","Organisator" }, | 583 | { "Organizer","Organisator" }, |
584 | { "Save","Speichern" }, | 584 | { "Save","Speichern" }, |
585 | { "Exit (+save)","Beenden (+ speichern)" }, | 585 | { "Exit (+save)","Beenden (+ speichern)" }, |
586 | { "Home","Zuhause" }, | 586 | { "Home","Zuhause" }, |
587 | { "Office","Büro" }, | 587 | { "Office","Büro" }, |
588 | { "Libary","Bücherei" }, | 588 | { "Libary","Bücherei" }, |
589 | { "Doctor","Arzt" }, | 589 | { "Doctor","Arzt" }, |
590 | { "Beach","Strand" }, | 590 | { "Beach","Strand" }, |
591 | { "Conference room","Konferenzraum" }, | 591 | { "Conference room","Konferenzraum" }, |
592 | { "Drive Home","Heimfahrt" }, | 592 | { "Drive Home","Heimfahrt" }, |
593 | { "Watch TV","Tv gucken" }, | 593 | { "Watch TV","Tv gucken" }, |
594 | { "Phone call","Telefonanruf" }, | 594 | { "Phone call","Telefonanruf" }, |
595 | { "Pay bill","Rechnung bezahlen" }, | 595 | { "Pay bill","Rechnung bezahlen" }, |
596 | { "Read book","Buch lesen" }, | 596 | { "Read book","Buch lesen" }, |
597 | { "Watering plants","Pflanzen giessen" }, | 597 | { "Watering plants","Pflanzen giessen" }, |
598 | {"Appointment","Verabredung" }, | 598 | {"Appointment","Verabredung" }, |
599 | {"Birthday","Geburtstag" }, | 599 | {"Birthday","Geburtstag" }, |
600 | {"Business","Geschäft" }, | 600 | {"Business","Geschäft" }, |
601 | {"Business Travel","Geschäftsreise" }, | 601 | {"Business Travel","Geschäftsreise" }, |
602 | {"Cinema","Kino" }, | 602 | {"Cinema","Kino" }, |
603 | {"Customer","Kunde" }, | 603 | {"Customer","Kunde" }, |
604 | {"Break","Pause" }, | 604 | {"Break","Pause" }, |
605 | {"Breakfast","Frühstück" }, | 605 | {"Breakfast","Frühstück" }, |
606 | {"Competition","Wettkampf" }, | 606 | {"Competition","Wettkampf" }, |
607 | {"Dinner","Abendessen" }, | 607 | {"Dinner","Abendessen" }, |
608 | {"Education","Erziehung" }, | 608 | {"Education","Erziehung" }, |
609 | {"Family","Familie" }, | 609 | {"Family","Familie" }, |
610 | {"Favorites","Favoriten" }, | 610 | {"Favorites","Favoriten" }, |
611 | {"Festival","Festival" }, | 611 | {"Festival","Festival" }, |
612 | {"Fishing","Angeln" }, | 612 | {"Fishing","Angeln" }, |
613 | {"Flight","Flug" }, | 613 | {"Flight","Flug" }, |
614 | {"Gifts","Geschenk" }, | 614 | {"Gifts","Geschenk" }, |
615 | {"Holiday","Feiertag" }, | 615 | {"Holiday","Feiertag" }, |
616 | {"Holiday Cards","Ansichtskarten" }, | 616 | {"Holiday Cards","Ansichtskarten" }, |
617 | {"Hot Contacts","Heisse Kontakte" }, | 617 | {"Hot Contacts","Heisse Kontakte" }, |
618 | {"Hiking","Wandern" }, | 618 | {"Hiking","Wandern" }, |
619 | {"Hunting","Jagen" }, | 619 | {"Hunting","Jagen" }, |
620 | {"Key Customer","Wichtiger Kunde" }, | 620 | {"Key Customer","Wichtiger Kunde" }, |
621 | {"Kids","Kinder" }, | 621 | {"Kids","Kinder" }, |
622 | {"Lunch","Mittagessen" }, | 622 | {"Lunch","Mittagessen" }, |
623 | {"Meeting","Treffen" }, | 623 | {"Meeting","Treffen" }, |
624 | {"Miscellaneous","Verschiedenes" }, | 624 | {"Miscellaneous","Verschiedenes" }, |
625 | {"Partner","Partner" }, | 625 | {"Partner","Partner" }, |
626 | {"Party","Partie" }, | 626 | {"Party","Partie" }, |
627 | {"Personal","Privat" }, | 627 | {"Personal","Privat" }, |
628 | {"Personal Travel","Privatreise"}, | 628 | {"Personal Travel","Privatreise"}, |
629 | {"PHB","PHB" }, | 629 | {"PHB","PHB" }, |
630 | {"Phone Calls","Telefonanruf" }, | 630 | {"Phone Calls","Telefonanruf" }, |
631 | {"Projects","Projekt" }, | 631 | {"Projects","Projekt" }, |
632 | {"Recurring","Wiederholend" }, | 632 | {"Recurring","Wiederholend" }, |
633 | {"School","Schule" }, | 633 | {"School","Schule" }, |
634 | {"Shopping","Einkaufen" }, | 634 | {"Shopping","Einkaufen" }, |
635 | {"Speach","Rede" }, | 635 | {"Speach","Rede" }, |
636 | {"Special Occasion","Spez.Gelegenheit" }, | 636 | {"Special Occasion","Spez.Gelegenheit" }, |
637 | {"Sports","Sport" }, | 637 | {"Sports","Sport" }, |
638 | {"Talk","Vortrag" }, | 638 | {"Talk","Vortrag" }, |
639 | {"Travel","Reise" }, | 639 | {"Travel","Reise" }, |
640 | {"TV","TV" }, | 640 | {"TV","TV" }, |
641 | {"Germany","Deutschland" }, | 641 | {"Germany","Deutschland" }, |
642 | {"Sweden","Schweden" }, | 642 | {"Sweden","Schweden" }, |
643 | {"Forest","Wald" }, | 643 | {"Forest","Wald" }, |
644 | { "Desert","Wüste" }, | 644 | { "Desert","Wüste" }, |
645 | { "Kitchen","Küche" }, | 645 | { "Kitchen","Küche" }, |
646 | { "Lake","See" }, | 646 | { "Lake","See" }, |
647 | {"University","Universität"}, | 647 | {"University","Universität"}, |
648 | {"Vacation","Urlaub" }, | 648 | {"Vacation","Urlaub" }, |
649 | {"VIP","VIP" }, | 649 | {"VIP","VIP" }, |
650 | { "Import Sharp Calendar","Importiere Sharp Kalender" }, | 650 | { "Import Sharp Calendar","Importiere Sharp Kalender" }, |
651 | { "This todo has been cancelled!","Dieses Todo wurde gecancelt!" }, | 651 | { "This todo has been cancelled!","Dieses Todo wurde gecancelt!" }, |
652 | { "This event has been cancelled!","Dieser Termin wurde gecancelt!" }, | 652 | { "This event has been cancelled!","Dieser Termin wurde gecancelt!" }, |
653 | { "Cancelled","Gecancelt" }, | 653 | { "Cancelled","Gecancelt" }, |
654 | { "Multiple sync","Mehrfach Sync" }, | 654 | { "Multiple sync","Mehrfach Sync" }, |
655 | { "Local file","Lokale Datei" }, | 655 | { "Local file","Lokale Datei" }, |
656 | { "Last file","Letzte Datei" }, | 656 | { "Last file","Letzte Datei" }, |
657 | { "Keys + Colors...","Tasten + Farben..." }, | 657 | { "Keys + Colors...","Tasten + Farben..." }, |
658 | { "Mini icons in toolbar(nr)","Mini Icons in ToolBar(bn)" }, | 658 | { "Mini icons in toolbar(nr)","Mini Icons in ToolBar(bn)" }, |
659 | { "Quick load/save (w/o Unicode)","Schnelles Laden/Speichern (o Unicode)" }, | 659 | { "Quick load/save (w/o Unicode)","Schnelles Laden/Speichern (o Unicode)" }, |
660 | { "Choose...","Wähle..." }, | 660 | { "Choose...","Wähle..." }, |
661 | { "Use colors for application:","Setze Farben für Programm:" }, | 661 | { "Use colors for application:","Setze Farben für Programm:" }, |
662 | { "Buttons, menus, etc.:","Knöpfe, Menu, etc.:" }, | 662 | { "Buttons, menus, etc.:","Knöpfe, Menu, etc.:" }, |
663 | { "Frames, labels, etc.:","Rahmen, Label, etc.:" }, | 663 | { "Frames, labels, etc.:","Rahmen, Label, etc.:" }, |
664 | { "Show parent To-Do's","Zeige Ober-Todos" }, | 664 | { "Show parent To-Do's","Zeige Ober-Todos" }, |
665 | { "Show location","Zeige Orte" }, | 665 | { "Show location","Zeige Orte" }, |
666 | { "Show events that recur ","Zeige Termine, die sich wiederholen:" }, | 666 | { "Show events that recur ","Zeige Termine, die sich wiederholen:" }, |
667 | { "Show in every cell ","Zeige in jeder Zelle " }, | 667 | { "Show in every cell ","Zeige in jeder Zelle " }, |
668 | { "short month","kurzen Monat" }, | 668 | { "short month","kurzen Monat" }, |
669 | { "icons","Icons" }, | 669 | { "icons","Icons" }, |
670 | { "Show Sat/Sun together","Zeige Sam/Son zusammen" }, | 670 | { "Show Sat/Sun together","Zeige Sam/Son zusammen" }, |
671 | { "Category colors are applied to text","Kategorie Farben färben Text" }, | 671 | { "Category colors are applied to text","Kategorie Farben färben Text" }, |
672 | { "Month view uses day colors","Monatsansicht zeigt Tagesfarben" }, | 672 | { "Month view uses day colors","Monatsansicht zeigt Tagesfarben" }, |
673 | { "Day color odd months","Tagesfarbe ungerade Monate" }, | 673 | { "Day color odd months","Tagesfarbe ungerade Monate" }, |
674 | { "Day color even months","Tagesfarbe gerade Monate" }, | 674 | { "Day color even months","Tagesfarbe gerade Monate" }, |
675 | { "Color for Sundays + category \"Holiday\"","Farbe für Sonntag + Kateg.\" Feiertag\"" }, | 675 | { "Color for Sundays + category \"Holiday\"","Farbe für Sonntag + Kateg.\" Feiertag\"" }, |
676 | { "To-do view shows complete as 'xx %'","Zeige Prozent erledigt als 'xx %'" }, | 676 | { "To-do view shows complete as 'xx %'","Zeige Prozent erledigt als 'xx %'" }, |
677 | { "Small To-do view uses smaller font","Kleine To-do Ansicht nutzt kleineren Font" }, | 677 | { "Small To-do view uses smaller font","Kleine To-do Ansicht nutzt kleineren Font" }, |
678 | { "Colors are applied to text","Farben werden auf Text angewendet" }, | 678 | { "Colors are applied to text","Farben werden auf Text angewendet" }, |
679 | { "Use internal alarm notification","Nutze interne Alarm Benachrichtigung" }, | 679 | { "Use internal alarm notification","Nutze interne Alarm Benachrichtigung" }, |
680 | { "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" }, | 680 | { "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" }, |
681 | { "Play beeps count:","Anzahl der Alarmpiepse: " }, | 681 | { "Play beeps count:","Anzahl der Alarmpiepse: " }, |
682 | { "Beeps interval in sec:","Zeitintervall der Alarmpiepse: " }, | 682 | { "Beeps interval in sec:","Zeitintervall der Alarmpiepse: " }, |
683 | { "Default suspend time in min:","Standard Supendierungs Zeit: " }, | 683 | { "Default suspend time in min:","Standard Supendierungs Zeit: " }, |
684 | { "Auto suspend count:","Anzahl der auto Suspendierungen" }, | 684 | { "Auto suspend count:","Anzahl der auto Suspendierungen" }, |
685 | { "Alarm *.wav file for newly created alarm:","Alarm *.wav Datei für neu angelegte Alarme:" }, | 685 | { "Alarm *.wav file for newly created alarm:","Alarm *.wav Datei für neu angelegte Alarme:" }, |
686 | { "New profile","Neues Profil" }, | 686 | { "New profile","Neues Profil" }, |
687 | { "Clone profile","Klone Profil" }, | 687 | { "Clone profile","Klone Profil" }, |
688 | { "Delete profile","Lösche Profil" }, | 688 | { "Delete profile","Lösche Profil" }, |
689 | { "Profile:","Profil:" }, | 689 | { "Profile:","Profil:" }, |
690 | { "Include in multiple sync","Beziehe Profil in mehrfach Sync mit ein" }, | 690 | { "Include in multiple sync","Beziehe Profil in mehrfach Sync mit ein" }, |
691 | { "Force: Take local entry always","Erzwinge: Nimm immer lokalen Eintrag" }, | 691 | { "Force: Take local entry always","Erzwinge: Nimm immer lokalen Eintrag" }, |
692 | { "Force: Take remote entry always","Erzwinge: Nimm immer fernen Eintrag" }, | 692 | { "Force: Take remote entry always","Erzwinge: Nimm immer fernen Eintrag" }, |
693 | { "Show summary after sync","Zeige Zusammenfassung nach dem Synchronisieren" }, | 693 | { "Show summary after sync","Zeige Zusammenfassung nach dem Synchronisieren" }, |
694 | { "Write back file","Schreibe Datei zurück" }, | 694 | { "Write back file","Schreibe Datei zurück" }, |
695 | { "Remote file (w down/upload command)","Entfernte Datei (via down/upload Kommando)" }, | 695 | { "Remote file (w down/upload command)","Entfernte Datei (via down/upload Kommando)" }, |
696 | { "Pre sync (download) command:","Bevor Sync (download) Kommando:" }, | 696 | { "Pre sync (download) command:","Bevor Sync (download) Kommando:" }, |
697 | { "Local device name:","Name dieses Gerätes:" }, | 697 | { "Local device name:","Name dieses Gerätes:" }, |
698 | { "Ask for preferences before sync","Frage nach Synchronisationseinstellungen vor dem Syncen" }, | 698 | { "Ask for preferences before sync","Frage nach Synchronisationseinstellungen vor dem Syncen" }, |
699 | { "Sync preferences","Synchronisations Einstellungen" }, | 699 | { "Sync preferences","Synchronisations Einstellungen" }, |
700 | { "Profile kind","Profil Art" }, | 700 | { "Profile kind","Profil Art" }, |
701 | { "Local file","Lokale Datei" }, | 701 | { "Local file","Lokale Datei" }, |
702 | { "Local file:","Lokale Datei:" }, | 702 | { "Local file:","Lokale Datei:" }, |
703 | { "Post sync (upload) command:","Nach Sync (upload) Kommando:" }, | 703 | { "Post sync (upload) command:","Nach Sync (upload) Kommando:" }, |
704 | { "Fill in default values for:","Setze Beispiel Werte ein für:" }, | 704 | { "Fill in default values for:","Setze Beispiel Werte ein für:" }, |
705 | { "Hint: Use $PWD$ for placeholder of password!","Hinweis: Benutze $PWD$ als Platzhalter für ein Passwort!" }, | 705 | { "Hint: Use $PWD$ for placeholder of password!","Hinweis: Benutze $PWD$ als Platzhalter für ein Passwort!" }, |
706 | { "Synchronization Preferences","Einstellungen der Synchronisationsprofile"}, | 706 | { "Synchronization Preferences","Einstellungen der Synchronisationsprofile"}, |
707 | { "Device","Gerät:" }, | 707 | { "Device","Gerät:" }, |
708 | { "Sync with file \n...%1\nfrom:\n%2\n","Sync mit Datei \n...%1\nvom:\n%2\n" }, | 708 | { "Sync with file \n...%1\nfrom:\n%2\n","Sync mit Datei \n...%1\nvom:\n%2\n" }, |
709 | { "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" }, | 709 | { "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" }, |
710 | { "Synchronization successful","Synchronisation erfolgreich" }, | 710 | { "Synchronization successful","Synchronisation erfolgreich" }, |
711 | { "Sync cancelled or failed. Nothing synced.","Sync abgebrochen oder fehlgeschlagen. Nichts wurde gesynced." }, | 711 | { "Sync cancelled or failed. Nothing synced.","Sync abgebrochen oder fehlgeschlagen. Nichts wurde gesynced." }, |
712 | { "Sync file \n...%1\ndoes not exist!\nNothing synced!\n","Sync Datei \n...%1\nexistiert nicht!\nNichts wurde gesynced!\n" }, | 712 | { "Sync file \n...%1\ndoes not exist!\nNothing synced!\n","Sync Datei \n...%1\nexistiert nicht!\nNichts wurde gesynced!\n" }, |
713 | { "Sync filename(*.ics/*.vcs)","Sync Dateiname(*.ics/*.vcs)" }, | 713 | { "Sync filename(*.ics/*.vcs)","Sync Dateiname(*.ics/*.vcs)" }, |
714 | { "Enter password","Passwort eingeben" }, | 714 | { "Enter password","Passwort eingeben" }, |
715 | { "Do you really want\nto remote sync\nwith profile \n","Wollen Sie wirklich\nmit dem entfernten\nProfil syncen: \n" }, | 715 | { "Do you really want\nto remote sync\nwith profile \n","Wollen Sie wirklich\nmit dem entfernten\nProfil syncen: \n" }, |
716 | { "Copy remote file to local machine...","Kopiere entfernte Datei auf lokalen Rechner..." }, | 716 | { "Copy remote file to local machine...","Kopiere entfernte Datei auf lokalen Rechner..." }, |
717 | { "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" }, | 717 | { "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" }, |
718 | { "Writing back file result: ","Resultat des Dateizurückschreibens: " }, | 718 | { "Writing back file result: ","Resultat des Dateizurückschreibens: " }, |
719 | { "Syncronization sucessfully completed","Synchronisation erfolgreich abgeschlossen" }, | 719 | { "Syncronization sucessfully completed","Synchronisation erfolgreich abgeschlossen" }, |
720 | { "Edit Calendar Filters","Editiere Kalendar Filter" }, | 720 | { "Edit Calendar Filters","Editiere Kalendar Filter" }, |
721 | { "Enter filter name:","Neuer Filter Name:" }, | 721 | { "Enter filter name:","Neuer Filter Name:" }, |
722 | { "Add Filter","Filter hinzufügen" }, | 722 | { "Add Filter","Filter hinzufügen" }, |
723 | { "Question","Frage" }, | 723 | { "Question","Frage" }, |
724 | { "Filter position: ","Filter Position: " }, | 724 | { "Filter position: ","Filter Position: " }, |
725 | { "Month View","Monatsansicht" }, | 725 | { "Month View","Monatsansicht" }, |
726 | { "This profil cannot be deleted!\n","Dieses Profil kann\nnicht gelöscht werden!" }, | 726 | { "This profil cannot be deleted!\n","Dieses Profil kann\nnicht gelöscht werden!" }, |
727 | { "KO/Pi config error","KO/Pi Konfig. Fehler" }, | 727 | { "KO/Pi config error","KO/Pi Konfig. Fehler" }, |
728 | { "Local device name undefined!\nPlease define device name!","Name dieses Gerätes undefiniert!\nBitte Namen angeben!" }, | 728 | { "Local device name undefined!\nPlease define device name!","Name dieses Gerätes undefiniert!\nBitte Namen angeben!" }, |
729 | { "Multiple profiles with same name!\nPlease use unique profile names!","Mehrere Profile haben denselben Namen!\nBitte unterschiedliche Namen wählen!" }, | 729 | { "Multiple profiles with same name!\nPlease use unique profile names!","Mehrere Profile haben denselben Namen!\nBitte unterschiedliche Namen wählen!" }, |
730 | { "Access: ","Zugriff: " }, | 730 | { "Access: ","Zugriff: " }, |
731 | { "Needs Action","Aktion notwendig" }, | 731 | { "Needs Action","Aktion notwendig" }, |
732 | { "Accepted","Akzeptiert" }, | 732 | { "Accepted","Akzeptiert" }, |
733 | { "Declined","Abgelehnt" }, | 733 | { "Declined","Abgelehnt" }, |
734 | { "Tentative","Vorläufig" }, | 734 | { "Tentative","Vorläufig" }, |
735 | { "Delegated","Beauftragt" }, | 735 | { "Delegated","Beauftragt" }, |
736 | { "Completed","Vollständig" }, | 736 | { "Completed","Vollständig" }, |
737 | { "In Process","In Bearbeitung" }, | 737 | { "In Process","In Bearbeitung" }, |
738 | { "Participant","Teilnehmer" }, | 738 | { "Participant","Teilnehmer" }, |
739 | { "Optional Participant","Möglicher Teilnehmer" }, | 739 | { "Optional Participant","Möglicher Teilnehmer" }, |
740 | { "Observer","Beobachter" }, | 740 | { "Observer","Beobachter" }, |
741 | { "Chair","Vorsitzender" }, | 741 | { "Chair","Vorsitzender" }, |
742 | { "Not supported \non desktop!\n","" }, | 742 | { "Not supported \non desktop!\n","" }, |
743 | { "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 vertikale Auswahl zum Drucken zu bestimmen,\nbitte einen vertikalen Zeitraum (mit gedrückter linker Maustaste)\nin einer Spalte auswählen.\n(Es wird danach direkt der Termin Dialog angezeigt\n - dort bitte auf Abbrechen klicken) " }, | 743 | { "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 vertikale Auswahl zum Drucken zu bestimmen,\nbitte einen vertikalen Zeitraum (mit gedrückter linker Maustaste)\nin einer Spalte auswählen.\n(Es wird danach direkt der Termin Dialog angezeigt\n - dort bitte auf Abbrechen klicken) " }, |
744 | { "Date range: ","Datums Zeitspanne: " }, | 744 | { "Date range: ","Datums Zeitspanne: " }, |
745 | { "Not supported \non PDA!\n","Nicht verfügbar\nauf dem PDA. " }, | 745 | { "Not supported \non PDA!\n","Nicht verfügbar\nauf dem PDA. " }, |
746 | { "Syncing - close to abort!","Syncing-schließe um abzubrechen." }, | 746 | { "Syncing - close to abort!","Syncing-schließe um abzubrechen." }, |
747 | { "Add / remove events","Add./entferne Termine" }, | 747 | { "Add / remove events","Add./entferne Termine" }, |
748 | { "File does not exist:\n '%1'.","Datei existiert nicht:\n '%1'." }, | 748 | { "File does not exist:\n '%1'.","Datei existiert nicht:\n '%1'." }, |
749 | { "Couldn't load calendar\n '%1'.","Kann Kalender nicht laden:\n '%1'." }, | 749 | { "Couldn't load calendar\n '%1'.","Kann Kalender nicht laden:\n '%1'." }, |
750 | { "\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" }, | 750 | { "\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" }, |
751 | { "Overwrite","Überschreiben" }, | 751 | { "Overwrite","Überschreiben" }, |
752 | { "Sync+save","Syncen+speichern" }, | 752 | { "Sync+save","Syncen+speichern" }, |
753 | { "Default","Standard" }, | 753 | { "Default","Standard" }, |
754 | { " Categories added to list! "," Kategorien zur Liste hinzugefügt! " }, | 754 | { " Categories added to list! "," Kategorien zur Liste hinzugefügt! " }, |
755 | { " %d items?"," %d Einträge?" }, | 755 | { " %d items?"," %d Einträge?" }, |
756 | { "\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?" }, | 756 | { "\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?" }, |
757 | { " ?\n\nDelete:\n"," ?\n\nLösche:\n" }, | 757 | { " ?\n\nDelete:\n"," ?\n\nLösche:\n" }, |
758 | { "Current","Aktuelle" }, | 758 | { "Current","Aktuelle" }, |
759 | { "\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" }, | 759 | { "\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" }, |
760 | { "All","Alle" }, | 760 | { "All","Alle" }, |
761 | { "Data Loss Warning","Datenverlust Warnung" }, | 761 | { "Data Loss Warning","Datenverlust Warnung" }, |
762 | { "Proceed","Weitermachen" }, | 762 | { "Proceed","Weitermachen" }, |
763 | { "The journal entries can not be\nexported to a vCalendar file.","Die Journal Einträge können\nnicht in eine vCalendar\nDatei exportiert werden!" }, | 763 | { "The journal entries can not be\nexported to a vCalendar file.","Die Journal Einträge können\nnicht in eine vCalendar\nDatei exportiert werden!" }, |
764 | { "Filter disabled ","Filter abgeschaltet" }, | 764 | { "Filter disabled ","Filter abgeschaltet" }, |
765 | { "Filter selected: ","Gewählter Filter: " }, | 765 | { "Filter selected: ","Gewählter Filter: " }, |
766 | { "Toggle Cancel","Gecancelt ändern" }, | 766 | { "Toggle Cancel","Gecancelt ändern" }, |
767 | { "&Toggle Cancel","Gecancel&t ändern" }, | 767 | { "&Toggle Cancel","Gecancel&t ändern" }, |
768 | { "Configure Toolbar","Konfiguriere Toolbar" }, | 768 | { "Configure Toolbar","Konfiguriere Toolbar" }, |
769 | { "Stretched TB","Gedehnte TB" }, | 769 | { "Stretched TB","Gedehnte TB" }, |
770 | { "Import file \n...%1\ndoes not exist!\nNothing imported!\n","Import Datei \n...%1\nexistiert nicht!\nNichts importiert!\n" }, | 770 | { "Import file \n...%1\ndoes not exist!\nNothing imported!\n","Import Datei \n...%1\nexistiert nicht!\nNichts importiert!\n" }, |
771 | { "Import filename(*.ics/*.vcs)","Import Dateiname(*.ics/*.vcs)" }, | 771 | { "Import filename(*.ics/*.vcs)","Import Dateiname(*.ics/*.vcs)" }, |
772 | { "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" }, | 772 | { "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" }, |
773 | { "Not supported \non desktop!\n","Nur verfügbar auf PDA!" }, | 773 | { "Not supported \non desktop!\n","Nur verfügbar auf PDA!" }, |
774 | { "Imported file successfully","Datei erfolgreich importiert" }, | 774 | { "Imported file successfully","Datei erfolgreich importiert" }, |
775 | { "Error importing file","Fehler beim Importieren der Datei" }, | 775 | { "Error importing file","Fehler beim Importieren der Datei" }, |
776 | { "Export vcal filename(*.vcs)","Export vcal Dateiname(*.vcs)" }, | 776 | { "Export vcal filename(*.vcs)","Export vcal Dateiname(*.vcs)" }, |
777 | { "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" }, | 777 | { "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" }, |
778 | { "Overwrite!","Überschreiben!" }, | 778 | { "Overwrite!","Überschreiben!" }, |
779 | { "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" }, | 779 | { "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" }, |
780 | { "Load backup filename","Lade Backup Dateiname" }, | 780 | { "Load backup filename","Lade Backup Dateiname" }, |
781 | { "Backup file\ndoes not exist!\nNothing loaded!","Backup Datei\nexistiert nicht!\nNichts geladen!" }, | 781 | { "Backup file\ndoes not exist!\nNothing loaded!","Backup Datei\nexistiert nicht!\nNichts geladen!" }, |
782 | { "KO/Pi:Loaded %1","KO/Pi:Geladen %1" }, | 782 | { "KO/Pi:Loaded %1","KO/Pi:Geladen %1" }, |
783 | { "Save backup filename","Speichere Backup Dateiname" }, | 783 | { "Save backup filename","Speichere Backup Dateiname" }, |
784 | { "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" }, | 784 | { "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" }, |
785 | { "KO/Pi:Saved %1","KO/Pi:Gespeichert %1" }, | 785 | { "KO/Pi:Saved %1","KO/Pi:Gespeichert %1" }, |
786 | { "Details of attendee","Teilnehmerdetails" }, | 786 | { "Details of attendee","Teilnehmerdetails" }, |
787 | { "Work phone:\n","Telefon Arbeit:\n" }, | 787 | { "Work phone:\n","Telefon Arbeit:\n" }, |
788 | { "Work mobile phone:\n","Mobiltelefon Arbeit:\n" }, | 788 | { "Work mobile phone:\n","Mobiltelefon Arbeit:\n" }, |
789 | { "Home phone:\n","Telefon privat:\n" }, | 789 | { "Home phone:\n","Telefon privat:\n" }, |
790 | { "Mobile home phone:\n","Mobiltelefon privat:\n" }, | 790 | { "Mobile home phone:\n","Mobiltelefon privat:\n" }, |
791 | { "Email:\n","Email:\n" }, | 791 | { "Email:\n","Email:\n" }, |
792 | { "Alarm disabled for this item","Alarm deaktiviert für dieses Item" }, | 792 | { "Alarm disabled for this item","Alarm deaktiviert für dieses Item" }, |
793 | { "Audio Al.: ","Audio Al.: " }, | 793 | { "Audio Al.: ","Audio Al.: " }, |
794 | { "Proc.Al.: ","Proz.Al.: " }, | 794 | { "Proc.Al.: ","Proz.Al.: " }, |
795 | { "No sound set","Kein Sound definiert" }, | 795 | { "No sound set","Kein Sound definiert" }, |
796 | { "*.wav|Wav Files","*.wav|Wav Dateien" }, | 796 | { "*.wav|Wav Files","*.wav|Wav Dateien" }, |
797 | { "No program set","Kein Programm definiert" }, | 797 | { "No program set","Kein Programm definiert" }, |
798 | { "Running '%1'","Ausführen '%1'" }, | 798 | { "Running '%1'","Ausführen '%1'" }, |
799 | { "Playing '%1'","Abspielen '%1'" }, | 799 | { "Playing '%1'","Abspielen '%1'" }, |
800 | { "User defined (usertranslation.txt)","Benutzerdefiniert (usertranslation.txt)" }, | 800 | { "User defined (usertranslation.txt)","Benutzerdefiniert (usertranslation.txt)" }, |
801 | { "Load!","Laden!" }, | 801 | { "Load!","Laden!" }, |
802 | { "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" }, | 802 | { "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" }, |
803 | { "KO/Pi Features and hints","KO/Pi Eigenschaften und Tipps" }, | 803 | { "KO/Pi Features and hints","KO/Pi Eigenschaften und Tipps" }, |
804 | { "KO/Pi User translation HowTo","KO/Pi Benutzer-Übersetzung HowTo" }, | 804 | { "KO/Pi User translation HowTo","KO/Pi Benutzer-Übersetzung HowTo" }, |
805 | { "KO/Pi Synchronization HowTo","KO/Pi Synchronisation HowTo" }, | 805 | { "KO/Pi Synchronization HowTo","KO/Pi Synchronisation HowTo" }, |
806 | { "Features + hints...","Eigenschaften + Tipps..." }, | 806 | { "Features + hints...","Eigenschaften + Tipps..." }, |
807 | { "User translation...","Benutzer Übersetzung..." }, | 807 | { "User translation...","Benutzer Übersetzung..." }, |
808 | { "Sync HowTo...","Synchronisation HowTo..." }, | 808 | { "Sync HowTo...","Synchronisation HowTo..." }, |
809 | { "Print calendar...","Drucke Kalender..." }, | 809 | { "Print calendar...","Drucke Kalender..." }, |
810 | { "Anniversary","Jahrestag" }, | 810 | { "Anniversary","Jahrestag" }, |
811 | { "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" }, | 811 | { "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" }, |
812 | { "Import Birthdays (KA/Pi)","Importiere Geburtstage (KA/Pi)" }, | 812 | { "Import Birthdays (KA/Pi)","Importiere Geburtstage (KA/Pi)" }, |
813 | { "Next recurrence is on: ","Nächste Wiederholung ist am:" }, | 813 | { "Next recurrence is on: ","Nächste Wiederholung ist am:" }, |
814 | { "<b>Alarm on: </b>","<b>Alarm am: </b>" }, | 814 | { "<b>Alarm on: </b>","<b>Alarm am: </b>" }, |
815 | { "<b>Access: </b>","<b>Zugriff: </b>" }, | 815 | { "<b>Access: </b>","<b>Zugriff: </b>" }, |
816 | { "(%1 min before)","(%1 min vorher)" }, | 816 | { "(%1 min before)","(%1 min vorher)" }, |
817 | { "<b>Categories: </b>","<b>Kategorien: </b>" }, | 817 | { "<b>Categories: </b>","<b>Kategorien: </b>" }, |
818 | { "Save Journal/Description...","Speichere Journal/Details..." }, | 818 | { "Save Journal/Description...","Speichere Journal/Details..." }, |
819 | { "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." }, | 819 | { "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." }, |
820 | { "Continue","Weitermachen" }, | 820 | { "Continue","Weitermachen" }, |
821 | { " birthdays/anniversaries added!"," Geburts-/Jahrestage hinzugefügt" }, | 821 | { " birthdays/anniversaries added!"," Geburts-/Jahrestage hinzugefügt" }, |
822 | { "Attendee:","Teilnehmer:" }, | 822 | { "Attendee:","Teilnehmer:" }, |
823 | { "Click OK to search ->","Klicke zum Suchen auf OK ->" }, | 823 | { "Click OK to search ->","Klicke zum Suchen auf OK ->" }, |
824 | { "On day ","Am Tag " }, | 824 | { "On day ","Am Tag " }, |
825 | { "%1 of ","%1 des Monats" }, | 825 | { "%1 of ","%1 des Monats" }, |
826 | { "%1 of the year","%1 des Jahres" }, | 826 | { "%1 of the year","%1 des Jahres" }, |
827 | { "Anonymous","Anonymo" }, | 827 | { "Anonymous","Anonymo" }, |
828 | { "nobody@nowhere","niemand@nirgendwo" }, | 828 | { "nobody@nowhere","niemand@nirgendwo" }, |
829 | { "calendar.html","calendar.html" }, | 829 | { "calendar.html","calendar.html" }, |
830 | { " Local Time"," Locale Zeit" }, | 830 | { " Local Time"," Locale Zeit" }, |
831 | { "Unknown Name","Unbekannter Name" }, | 831 | { "Unknown Name","Unbekannter Name" }, |
832 | { "unknown@nowhere","unbekannt@nirgendwo" }, | 832 | { "unknown@nowhere","unbekannt@nirgendwo" }, |
833 | { "Beam via IR!","Beam via IR!" }, | 833 | { "Beam via IR!","Beam via IR!" }, |
834 | { "Next Month","Nächster Monat" }, | 834 | { "Next Month","Nächster Monat" }, |
835 | { "Prio","Prio" }, | 835 | { "Prio","Prio" }, |
836 | { "Reparent Todo","Mache Sub-Todo" }, | 836 | { "Reparent Todo","Mache Sub-Todo" }, |
837 | { "tomorrow","morgen" }, | 837 | { "tomorrow","morgen" }, |
838 | { "today","heute" }, | 838 | { "today","heute" }, |
839 | { "yesterday","gestern" }, | 839 | { "yesterday","gestern" }, |
840 | { "Ok","Ok" }, | 840 | { "Ok","Ok" }, |
841 | { "Ok+Agenda","Ok+Agenda" }, | 841 | { "Ok+Agenda","Ok+Agenda" }, |
842 | { "Email","Email" }, | 842 | { "Email","Email" }, |
843 | { "RSVP","RSVP" }, | 843 | { "RSVP","RSVP" }, |
844 | { "Email:","Email:" }, | 844 | { "Email:","Email:" }, |
845 | { "Appointment Time ","Termin Zeit " }, | 845 | { "Appointment Time ","Termin Zeit " }, |
846 | { "2","2" }, | 846 | { "2","2" }, |
847 | { "3","3" }, | 847 | { "3","3" }, |
848 | { "4","4" }, | 848 | { "4","4" }, |
849 | { " 0 %"," 0 %" }, | 849 | { " 0 %"," 0 %" }, |
850 | { " 20 %"," 20 %" }, | 850 | { " 20 %"," 20 %" }, |
851 | { " 40 %"," 40 %" }, | 851 | { " 40 %"," 40 %" }, |
852 | { " 60 %"," 60 %" }, | 852 | { " 60 %"," 60 %" }, |
853 | { " 80 %"," 80 %" }, | 853 | { " 80 %"," 80 %" }, |
854 | { "100 %","100 %" }, | 854 | { "100 %","100 %" }, |
855 | { "Filter","Filter" }, | 855 | { "Filter","Filter" }, |
856 | { "Configure","Konfiguriere" }, | 856 | { "Configure","Konfiguriere" }, |
857 | { "What's Next","What's Next" }, | 857 | { "What's Next","What's Next" }, |
858 | { "Complete calendar...","Kompletten Kalender..." }, | 858 | { "Complete calendar...","Kompletten Kalender..." }, |
859 | { "Filtered calendar...","Gefilterten Kalender..." }, | 859 | { "Filtered calendar...","Gefilterten Kalender..." }, |
860 | { "Export to phone","Exportiere zum Handy" }, | 860 | { "Export to phone","Exportiere zum Handy" }, |
861 | { "Beam receive enabled","Beam Empfang an" }, | 861 | { "Beam receive enabled","Beam Empfang an" }, |
862 | { "What's new?","Was ist neu?" }, | 862 | { "What's new?","Was ist neu?" }, |
863 | { "FAQ...","FAQ..." }, | 863 | { "FAQ...","FAQ..." }, |
864 | { "Licence...","Licence..." }, | 864 | { "Licence...","Licence..." }, |
865 | { "What's This?","What's This?" }, | 865 | { "What's This?","What's This?" }, |
866 | { "&Edit...","&Editiere..." }, | 866 | { "&Edit...","&Editiere..." }, |
867 | { "Oktober","Oktober" }, | 867 | { "Oktober","Oktober" }, |
868 | { "Title","Titel" }, | 868 | { "Title","Titel" }, |
869 | { "%1 %","%1 %" }, | 869 | { "%1 %","%1 %" }, |
870 | { "Enable Pi-Sync","Schalte Pi-Sync an" }, | 870 | { "Enable Pi-Sync","Schalte Pi-Sync an" }, |
871 | { "Import!","Importiere!" }, | 871 | { "Import!","Importiere!" }, |
872 | { "inserting birthdays - close to abort!","Burzeltage werden eingefügt - schließe um abzubrechen!" }, | 872 | { "inserting birthdays - close to abort!","Burzeltage werden eingefügt - schließe um abzubrechen!" }, |
873 | { "Export to phone options","Export ans Handy Optionen" }, | 873 | { "Export to phone options","Export ans Handy Optionen" }, |
874 | { "Please read Help-Sync Howto\nto know what settings to use.","Bitte lese Hilfe-Sync Howto\num zu erfahren welche Einstellungen\ndie richtigen sind." }, | 874 | { "Please read Help-Sync Howto\nto know what settings to use.","Bitte lese Hilfe-Sync Howto\num zu erfahren welche Einstellungen\ndie richtigen sind." }, |
875 | { "I/O device: ","I/O device: " }, | 875 | { "I/O device: ","I/O device: " }, |
876 | { "Connection: ","Connection: " }, | 876 | { "Connection: ","Connection: " }, |
877 | { "Model(opt.): ","Model(opt.): " }, | 877 | { "Model(opt.): ","Model(opt.): " }, |
878 | { "Write back events in future only","Schreibe nur zukünftige Termine zurück" }, | 878 | { "Write back events in future only","Schreibe nur zukünftige Termine zurück" }, |
879 | { "Max. weeks in future: ","Max. Wochen in der Zukunft: " }, | 879 | { "Max. weeks in future: ","Max. Wochen in der Zukunft: " }, |
880 | { "NOTE: This will remove all old\ntodo/calendar data on phone!","ACHTUNG: Das löscht alle alten\nTodo/Kalender Daten auf dem Handy!" }, | 880 | { "NOTE: This will remove all old\ntodo/calendar data on phone!","ACHTUNG: Das löscht alle alten\nTodo/Kalender Daten auf dem Handy!" }, |
881 | { "Export to mobile phone!","Exportiere auf das Handy!" }, | 881 | { "Export to mobile phone!","Exportiere auf das Handy!" }, |
882 | { "Export complete calendar","Exportiere kompletten Kalender" }, | 882 | { "Export complete calendar","Exportiere kompletten Kalender" }, |
883 | { "Writing to phone...","Sende Daten ans Handy..." }, | 883 | { "Writing to phone...","Sende Daten ans Handy..." }, |
884 | { " This may take 1-3 minutes!"," Das kann 1-3 Minuten dauern!" }, | 884 | { " This may take 1-3 minutes!"," Das kann 1-3 Minuten dauern!" }, |
885 | { "Retry","Nochmal versuchen" }, | 885 | { "Retry","Nochmal versuchen" }, |
886 | { "KDE/Pim phone access","KDE/Pim Handy Zugriff" }, | 886 | { "KDE/Pim phone access","KDE/Pim Handy Zugriff" }, |
887 | { "Error accessing device!\nPlease turn on connection\nand retry!","Fehler beim Zugriff auf das Gerät!\nBitte die Verbindung aktivieren\nund nochmal versuchen!" }, | 887 | { "Error accessing device!\nPlease turn on connection\nand retry!","Fehler beim Zugriff auf das Gerät!\nBitte die Verbindung aktivieren\nund nochmal versuchen!" }, |
888 | { "Error exporting to phone!","Fehler beim Export auf das Handy!" }, | 888 | { "Error exporting to phone!","Fehler beim Export auf das Handy!" }, |
889 | { "Export filtered calendar","Exportiere gefilterten Kalender" }, | 889 | { "Export filtered calendar","Exportiere gefilterten Kalender" }, |
890 | { "Preferences","Vorlieben" }, | 890 | { "Preferences","Vorlieben" }, |
891 | { "Global","Global" }, | 891 | { "Global","Global" }, |
892 | { "Phone","Phone" }, | 892 | { "Phone","Phone" }, |
893 | { "SMS","SMS" }, | 893 | { "SMS","SMS" }, |
894 | { "Fax","Fax" }, | 894 | { "Fax","Fax" }, |
895 | { "Pager","Pager" }, | 895 | { "Pager","Pager" }, |
896 | { "SIP","SIP" }, | 896 | { "SIP","SIP" }, |
897 | { "Italian","Italienisch" }, | 897 | { "Italian","Italienisch" }, |
898 | { "24:00","24:00" }, | 898 | { "24:00","24:00" }, |
899 | { "12:00am","12:00am" }, | 899 | { "12:00am","12:00am" }, |
900 | { "24.03.2004 (%d.%m.%Y|%A %d %B %Y)","24.03.2004 (%d.%m.%Y|%A %d %B %Y)" }, | 900 | { "24.03.2004 (%d.%m.%Y|%A %d %B %Y)","24.03.2004 (%d.%m.%Y|%A %d %B %Y)" }, |
901 | { "03.24.2004 (%m.%d.%Y|%A %B %d %Y)","03.24.2004 (%m.%d.%Y|%A %B %d %Y)" }, | 901 | { "03.24.2004 (%m.%d.%Y|%A %B %d %Y)","03.24.2004 (%m.%d.%Y|%A %B %d %Y)" }, |
902 | { "2004-03-24 (%Y-%m-%d|%A %Y %B %d)","2004-03-24 (%Y-%m-%d|%A %Y %B %d)" }, | 902 | { "2004-03-24 (%Y-%m-%d|%A %Y %B %d)","2004-03-24 (%Y-%m-%d|%A %Y %B %d)" }, |
903 | { "Mon 19.04.04: %a %d.%m.%y","Mon 19.04.04: %a %d.%m.%y" }, | 903 | { "Mon 19.04.04: %a %d.%m.%y","Mon 19.04.04: %a %d.%m.%y" }, |
904 | { "Mon, 19.Apr.04: %a, %d.%b.%y","Mon, 19.Apr.04: %a, %d.%b.%y" }, | 904 | { "Mon, 19.Apr.04: %a, %d.%b.%y","Mon, 19.Apr.04: %a, %d.%b.%y" }, |
905 | { "Add 30 min to selected Timezone","Addiere 30 min zur Zeitzone" }, | 905 | { "Add 30 min to selected Timezone","Addiere 30 min zur Zeitzone" }, |
906 | { "Used Mail Client","Benutzter Mail Client" }, | 906 | { "Used Mail Client","Benutzter Mail Client" }, |
907 | { "Channel:","Channel:" }, | 907 | { "Channel:","Channel:" }, |
908 | { "Message:","Message:" }, | 908 | { "Message:","Message:" }, |
909 | { "Parameters:","Parameter:" }, | 909 | { "Parameters:","Parameter:" }, |
910 | { "HINT: Delimiter=; Name=%1,Email=%2","Hinweis: Begrenzer=; Name=%1,Email=%2" }, | 910 | { "HINT: Delimiter=; Name=%1,Email=%2","Hinweis: Begrenzer=; Name=%1,Email=%2" }, |
911 | { "extra Message:","extra Message:" }, | 911 | { "extra Message:","extra Message:" }, |
912 | { "extra Parameters:","extra Parameter:" }, | 912 | { "extra Parameters:","extra Parameter:" }, |
913 | { "HINT: Emails=%1,Attachments=%2","Hinweis: Emails=%1,Attachments=%2" }, | 913 | { "HINT: Emails=%1,Attachments=%2","Hinweis: Emails=%1,Attachments=%2" }, |
914 | { "External Apps.","Externe Appl." }, | 914 | { "External Apps.","Externe Appl." }, |
915 | { "24 hours","24 Std." }, | 915 | { "24 hours","24 Std." }, |
916 | { "3 hours","3 Std." }, | 916 | { "3 hours","3 Std." }, |
917 | { "1 hour","1 Std." }, | 917 | { "1 hour","1 Std." }, |
918 | { "15 minutes","15 Min." }, | 918 | { "15 minutes","15 Min." }, |
919 | { "5 minutes","5 Min." }, | 919 | { "5 minutes","5 Min." }, |
920 | { "1 minute","1 Min." }, | 920 | { "1 minute","1 Min." }, |
921 | { "23","23" }, | 921 | { "23","23" }, |
922 | { "Mon 15","Mon 15" }, | 922 | { "Mon 15","Mon 15" }, |
923 | { "Configure KO","Konfiguriere KO" }, | 923 | { "Configure KO","Konfiguriere KO" }, |
924 | { "Event text","Termin Text" }, | 924 | { "Event text","Termin Text" }, |
925 | { "ToDo","Todo" }, | 925 | { "ToDo","Todo" }, |
926 | { "Today","Heute" }, | 926 | { "Today","Heute" }, |
927 | { "What's Next View","What's Next Ansicht" }, | 927 | { "What's Next View","What's Next Ansicht" }, |
928 | { "Allday Agenda view shows todos","Ganztag Agenda zeigt Todos" }, | 928 | { "Allday Agenda view shows todos","Ganztag Agenda zeigt Todos" }, |
929 | { "Alarm","Alarm" }, | 929 | { "Alarm","Alarm" }, |
930 | { "Used %1 Client","Benutzter %1 Client" }, | 930 | { "Used %1 Client","Benutzter %1 Client" }, |
931 | { "No email client installed","Kein Email Klient installiert" }, | 931 | { "No email client installed","Kein Email Klient installiert" }, |
932 | { "Userdefined email client","Benutzerdef. Email Klient" }, | 932 | { "Userdefined email client","Benutzerdef. Email Klient" }, |
933 | { "OM/Pi email client","OM/Pi Email Klient" }, | 933 | { "OM/Pi email client","OM/Pi Email Klient" }, |
934 | { "Include in multiple ","Beziehe in multiple " }, | 934 | { "Include in multiple ","Beziehe in multiple " }, |
935 | { "calendar ","Kalender " }, | 935 | { "calendar ","Kalender " }, |
936 | { "addressbook ","Adressbuch " }, | 936 | { "addressbook ","Adressbuch " }, |
937 | { "pwmanager","PWmanager" }, | 937 | { "pwmanager","PWmanager" }, |
938 | { " sync"," Sync ein" }, | 938 | { " sync"," Sync ein" }, |
939 | { "Write back synced data","Schreibe gesyncte Daten zurück" }, | 939 | { "Write back synced data","Schreibe gesyncte Daten zurück" }, |
940 | { "-- Write back (on remote) existing entries only","-- Schreibe nur existierende (entfernte) Einträge zurück" }, | 940 | { "-- Write back (on remote) existing entries only","-- Schreibe nur existierende (entfernte) Einträge zurück" }, |
941 | { "-- Write back (calendar) entries in future only","-- Schreibe nur zukünftige Kalender-Einträge zurück" }, | 941 | { "-- Write back (calendar) entries in future only","-- Schreibe nur zukünftige Kalender-Einträge zurück" }, |
942 | { "---- Max. weeks in future: ","---- Max. wochen in der Zukunft: " }, | 942 | { "---- Max. weeks in future: ","---- Max. wochen in der Zukunft: " }, |
943 | { "Pi-Sync ( direct Kx/Pi to Kx/Pi sync )","Pi-Sync ( direktes Kx/Pi zu Kx/Pi sync )" }, | 943 | { "Pi-Sync ( direct Kx/Pi to Kx/Pi sync )","Pi-Sync ( direktes Kx/Pi zu Kx/Pi sync )" }, |
944 | { "Mobile device (cell phone)","Mobiles Gerät (Handy)" }, | 944 | { "Mobile device (cell phone)","Mobiles Gerät (Handy)" }, |
945 | { "Help...","Hilfe..." }, | 945 | { "Help...","Hilfe..." }, |
946 | { "Local file Cal:","Lokale Datei Kal:" }, | 946 | { "Local file Cal:","Lokale Datei Kal:" }, |
947 | { "Local file ABook:","Lokale Datei ABuch:" }, | 947 | { "Local file ABook:","Lokale Datei ABuch:" }, |
948 | { "Local file PWMgr:","Lokale Datei PWMgr:" }, | 948 | { "Local file PWMgr:","Lokale Datei PWMgr:" }, |
949 | { "Addressbook file (*.vcf) is used by KA/Pi","Adressbuch Datei (*.vcf) wird von KA/Pi genutzt" }, | 949 | { "Addressbook file (*.vcf) is used by KA/Pi","Adressbuch Datei (*.vcf) wird von KA/Pi genutzt" }, |
950 | { "Calendar:","Kalender:" }, | 950 | { "Calendar:","Kalender:" }, |
951 | { "AddressBook:","AdressBuch:" }, | 951 | { "AddressBook:","AdressBuch:" }, |
952 | { "PWManager:","PWManager:" }, | 952 | { "PWManager:","PWManager:" }, |
953 | { "Addressbook file is used by KA/Pi","Adressbuch Datei wird von KA/Pi genutzt" }, | 953 | { "Addressbook file is used by KA/Pi","Adressbuch Datei wird von KA/Pi genutzt" }, |
954 | { "ssh/scp","ssh/scp" }, | 954 | { "ssh/scp","ssh/scp" }, |
955 | { "ftp","ftp" }, | 955 | { "ftp","ftp" }, |
956 | { "Password for remote access: (could be the same for each)","Passwort für entfernten Zugriff: (kann dasselbe sein für alle)" }, | 956 | { "Password for remote access: (could be the same for each)","Passwort für entfernten Zugriff: (kann dasselbe sein für alle)" }, |
957 | { "Remote IP address: (could be the same for each)","Entfernte IP Adresse: (kann dasselbe sein für alle)" }, | 957 | { "Remote IP address: (could be the same for each)","Entfernte IP Adresse: (kann dasselbe sein für alle)" }, |
958 | { "Remote port number: (should be different for each)","Entfernte Port Nummer: (Sollte für alle unterschiedlich sein)" }, | 958 | { "Remote port number: (should be different for each)","Entfernte Port Nummer: (Sollte für alle unterschiedlich sein)" }, |
959 | { "command for downloading remote file to local device","Kommando zum Download der entfernten Datei zum lokalen Gerät" }, | 959 | { "command for downloading remote file to local device","Kommando zum Download der entfernten Datei zum lokalen Gerät" }, |
960 | { "command for uploading local temp file to remote device","Kommando zum Upload der lokalen temp. Datei zum entfernten Gerät" }, | 960 | { "command for uploading local temp file to remote device","Kommando zum Upload der lokalen temp. Datei zum entfernten Gerät" }, |
961 | { "Insert device where\nphone is connected. E.g.:\n","Füge Device ein, an dem\ndas Handy angeschlossen ist. Z.B.:\n" }, | 961 | { "Insert device where\nphone is connected. E.g.:\n","Füge Device ein, an dem\ndas Handy angeschlossen ist. Z.B.:\n" }, |
962 | { "KDE-Pim sync config","KDE-Pim sync Konfig" }, | 962 | { "KDE-Pim sync config","KDE-Pim sync Konfig" }, |
963 | { "Insert kind of connection,e.g.:\n","Füge Art der Verbindung ein,z.B.:\n" }, | 963 | { "Insert kind of connection,e.g.:\n","Füge Art der Verbindung ein,z.B.:\n" }, |
964 | { "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" }, | 964 | { "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" }, |
965 | { "Port number (Default: %1)","Port Nummer (Default: %1)" }, | 965 | { "Port number (Default: %1)","Port Nummer (Default: %1)" }, |
966 | { "Password to enable\naccess from remote:","Passwort um entfernten\nZugriff zuzulassen:" }, | 966 | { "Password to enable\naccess from remote:","Passwort um entfernten\nZugriff zuzulassen:" }, |
967 | { "Automatically start\nat application startup","Starte automatisch\nbeim Programmstart" }, | 967 | { "Automatically start\nat application startup","Starte automatisch\nbeim Programmstart" }, |
968 | { "Automatically sync\nwith KDE-Desktop","Automatischer Sync\nmit dem KDE-Desktop" }, | 968 | { "Automatically sync\nwith KDE-Desktop","Automatischer Sync\nmit dem KDE-Desktop" }, |
969 | { "Enter port for Pi-Sync","Port Nummer für Pi-Sync" }, | 969 | { "Enter port for Pi-Sync","Port Nummer für Pi-Sync" }, |
970 | { "Disable Pi-Sync","Schalte Pi-Sync aus" }, | 970 | { "Disable Pi-Sync","Schalte Pi-Sync aus" }, |
971 | { "Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!","Wollen Sie wirklich\nmit allen selektierten\nProfilen \"Multi-Syncen\"?\nDas Syncen dauert einige Zeit -\nalle Profile werden zweimal gesynct!" }, | 971 | { "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!" }, |
972 | { "KDE-Pim Sync","KDE-Pim Sync" }, | 972 | { "KDE-Pim Sync","KDE-Pim Sync" }, |
973 | { "Multiple profiles","Multi-Sync Profile" }, | 973 | { "Multiple profiles","Multi-Sync Profile" }, |
974 | { "Device: ","Gerät: " }, | 974 | { "Device: ","Gerät: " }, |
975 | { "Multiple sync started.","Multi-Sync gestartet." }, | 975 | { "Multiple sync started.","Multi-Sync gestartet." }, |
976 | { "Nothing synced! No profiles defined for multisync!","Nichts gesynct! Keine Profile\nselektiert für Multi-Sync" }, | 976 | { "Nothing synced! No profiles defined for multisync!","Nichts gesynct! Keine Profile\nselektiert für Multi-Sync" }, |
977 | { "Turn filter on","Schalte Filter an" }, | 977 | { "Turn filter on","Schalte Filter an" }, |
978 | { "Turn filter off","Schalte Filter aus" }, | 978 | { "Turn filter off","Schalte Filter aus" }, |
979 | { "Key bindings KOrganizer/Pi","Tastatur Belegung KOrganizer/Pi" }, | 979 | { "Key bindings KOrganizer/Pi","Tastatur Belegung KOrganizer/Pi" }, |
980 | { "<p><b>White</b>: Item readonly</p>\n","<p><b>Weiss</b>: Eintrag schreibgeschützt</p>\n" }, | 980 | { "<p><b>White</b>: Item readonly</p>\n","<p><b>Weiss</b>: Eintrag schreibgeschützt</p>\n" }, |
981 | { "<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n","<p><b>Dunkelgelb</b>: Termin/Todo mit Teilnehmern.</p>\n" }, | 981 | { "<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n","<p><b>Dunkelgelb</b>: Termin/Todo mit Teilnehmern.</p>\n" }, |
982 | { "<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n","<p><b>Schwarz</b>: Termin/Todo mit Teilnehmern. Sie sind der Organisator!</p>\n" }, | 982 | { "<p><b>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" }, |
983 | { "<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n","<p><b>Dunkelgrün</b>: Information(Beschreibung) verfügbar.([i] in WN Ansicht)</p>\n" }, | 983 | { "<p><b>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" }, |
984 | { "<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n","<p><b>Blau</b>: Wiederholender Termin.([r] in Whats'Next Ansicht)</p>\n" }, | 984 | { "<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n","<p><b>Blau</b>: Wiederholender Termin.([r] in Whats'Next Ansicht)</p>\n" }, |
985 | { "<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n","<p><b>Rot</b>: Alarm gesetzt.([a] in Whats'Next Ansicht)</p>\n" }, | 985 | { "<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n","<p><b>Rot</b>: Alarm gesetzt.([a] in Whats'Next Ansicht)</p>\n" }, |
986 | { "<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n","<p><b>Kreuz</b>: Eintrag gecancelt.([c] in Whats'Next Ansicht)</p>\n" }, | 986 | { "<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n","<p><b>Kreuz</b>: Eintrag gecancelt.([c] in Whats'Next Ansicht)</p>\n" }, |
987 | { "<p><b>(for square icons in agenda and month view)</b></p>\n","<p><b>(für quadratische Icons in Agenda und Monats Ansicht)</b></p>\n" }, | 987 | { "<p><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" }, |
988 | { "<p><h2>KO/Pi icon colors:</h2></p>\n","<p><h2>KO/Pi Icon Farben:</h2></p>\n" }, | 988 | { "<p><h2>KO/Pi icon colors:</h2></p>\n","<p><h2>KO/Pi Icon Farben:</h2></p>\n" }, |
989 | { "<p><b>E</b>: Edit item</p>\n","<p><b>E</b>: Editiere Eintrag</p>\n" }, | 989 | { "<p><b>E</b>: Edit item</p>\n","<p><b>E</b>: Editiere Eintrag</p>\n" }, |
990 | { "<p><b>A</b>: Show agenda view.</p>\n","<p><b>A</b>: Zeige Agenda Ansicht.</p>\n" }, | 990 | { "<p><b>A</b>: Show agenda view.</p>\n","<p><b>A</b>: Zeige Agenda Ansicht.</p>\n" }, |
991 | { "<p><b>I,C</b>: Close dialog.</p>\n","<p><b>I,C</b>: Schließe Dialog.</p>\n" }, | 991 | { "<p><b>I,C</b>: Close dialog.</p>\n","<p><b>I,C</b>: Schließe Dialog.</p>\n" }, |
992 | { "<p><h3>In event/todo viewer:</h3></p>\n","<p><h3>In Termin/Todo Detail-Anzeige:</h3></p>\n" }, | 992 | { "<p><h3>In event/todo viewer:</h3></p>\n","<p><h3>In Termin/Todo Detail-Anzeige:</h3></p>\n" }, |
993 | { "<p><b>shift+up/down</b>: Goto first/last item</p>\n","<p><b>shift+up/down</b>: Gehe zum ersten/letzten Eintrag</p>\n" }, | 993 | { "<p><b>shift+up/down</b>: Goto first/last item</p>\n","<p><b>shift+up/down</b>: Gehe zum ersten/letzten Eintrag</p>\n" }, |
994 | { "<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n","<p><b>ctrl+up/down</b>: Gehe hoch/runter 20% aller Einträge</p>\n" }, | 994 | { "<p><b>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" }, |
995 | { "<p><b>up/down</b>: Next/prev item</p>\n","<p><b>up/down</b>: Nächster/vorheriger Eintrag</p>\n" }, | 995 | { "<p><b>up/down</b>: Next/prev item</p>\n","<p><b>up/down</b>: Nächster/vorheriger Eintrag</p>\n" }, |
996 | { "<p><b>return+shift</b>: Deselect item+one step down</p>\n","<p><b>return+shift</b>: Deselektiere Item+Cursor einen Eintrag runter</p>\n" }, | 996 | { "<p><b>return+shift</b>: Deselect item+one step down</p>\n","<p><b>return+shift</b>: Deselektiere Item+Cursor einen Eintrag runter</p>\n" }, |
997 | { "<p><b>return</b>: Select item+one step down</p>\n","<p><b>return</b>: Selektiere Item+Cursor einen Eintrag runter</p>\n" }, | 997 | { "<p><b>return</b>: Select item+one step down</p>\n","<p><b>return</b>: Selektiere Item+Cursor einen Eintrag runter</p>\n" }, |
998 | { "<p><b>I</b>: Show info of current item+one step down.</p>\n","<p><b>I</b>: Zeige Detail-Ansicht vom sel.Eintrag+Cursor einen Eintrag runter.</p>\n" }, | 998 | { "<p><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" }, |
999 | { "<p><h3>In list view:</h3></p>\n","<p><h3>In Listen Ansicht:</h3></p>\n" }, | 999 | { "<p><h3>In list view:</h3></p>\n","<p><h3>In Listen Ansicht:</h3></p>\n" }, |
1000 | { "<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n","<p><b>return+shift</b>: Markiere Todo als nicht erledigt+Cursor einen Eintrag runter</p>\n" }, | 1000 | { "<p><b>return+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" }, |
1001 | { "<p><b>return</b>: Mark item as completed+one step down.</p>\n","<p><b>return</b>: Markiere Todo als erledigt+Cursor einen Eintrag runter.</p>\n" }, | 1001 | { "<p><b>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" }, |
1002 | { "<p><b>Q</b>: Toggle quick todo line edit.</p>\n","<p><b>Q</b>: Zeige/verstecke Quick Todo Eingabe Zeile.</p>\n" }, | 1002 | { "<p><b>Q</b>: Toggle quick todo line edit.</p>\n","<p><b>Q</b>: Zeige/verstecke Quick Todo Eingabe Zeile.</p>\n" }, |
1003 | { "<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n","<p><b>shift+P</b>: Mache Todo zum neuen <b>P</b>arent Todo für das Todo, welches mit shift+Sselektiert wurde.</p>\n" }, | 1003 | { "<p><b>shift+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" }, |
1004 | { "<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n","<p><b>shift+S</b>: Mache Todo zum <b>S</b>ubtodo</p>\n" }, | 1004 | { "<p><b>shift+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" }, |
1005 | { "<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n","<p><b>shift+U</b>: <b>U</b>nparent Todo (Mache Sub-Todo zum Toplevel Todo)</p>\n" }, | 1005 | { "<p><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" }, |
1006 | { "<p><h3>In todo view:</h3></p>\n","<p><h3>In Todo Anzige:</h3></p>\n" }, | 1006 | { "<p><h3>In todo view:</h3></p>\n","<p><h3>In Todo Anzige:</h3></p>\n" }, |
1007 | { "<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n","<p><b>ctrl+up/down</b>: Scrolle kleine Todo Ansicht</p>\n" }, | 1007 | { "<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n","<p><b>ctrl+up/down</b>: Scrolle kleine Todo Ansicht</p>\n" }, |
1008 | { "<p><b>up/down</b>: Scroll agenda view</p>\n","<p><b>up/down</b>: Scrolle Agenda Ansicht</p>\n" }, | 1008 | { "<p><b>up/down</b>: Scroll agenda view</p>\n","<p><b>up/down</b>: Scrolle Agenda Ansicht</p>\n" }, |
1009 | { "<p><h3>In agenda view:</h3></p>\n","<p><h3>In Agenda Ansicht:</h3></p>\n" }, | 1009 | { "<p><h3>In agenda view:</h3></p>\n","<p><h3>In Agenda Ansicht:</h3></p>\n" }, |
1010 | { "<p><b>del,backspace</b>: Delete selected item</p>\n","<p><b>del,backspace</b>: Lösche selektiertes Item</p>\n" }, | 1010 | { "<p><b>del,backspace</b>: Delete selected item</p>\n","<p><b>del,backspace</b>: Lösche selektiertes Item</p>\n" }, |
1011 | { "<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n","<p><b>left</b>: Vorh. Woche | <b>left+ctrl</b>: Vorh. Monat</p>\n" }, | 1011 | { "<p><b>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" }, |
1012 | { "<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n","<p><b>right</b>: Nächste Woche | <b>right+ctrl</b>: Nächste Woche</p>\n" }, | 1012 | { "<p><b>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" }, |
1013 | { "<p><b>B</b>: Edit description (details) of selected item</p>\n","<p><b>B</b>: Editiere Beschreibung (Details) des selektierten Items</p>\n" }, | 1013 | { "<p><b>B</b>: Edit description (details) of selected item</p>\n","<p><b>B</b>: Editiere Beschreibung (Details) des selektierten Items</p>\n" }, |
1014 | { "<p><b>C</b>: Show current time in agenda view</p>\n","<p><b>C</b>: Zeige aktuelle Zeit in Agenda Ansicht</p>\n" }, | 1014 | { "<p><b>C</b>: Show current time in agenda view</p>\n","<p><b>C</b>: Zeige aktuelle Zeit in Agenda Ansicht</p>\n" }, |
1015 | { "<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n","<p><b>+,-</b> : Zoom rein/raus Agenda | <b>A</b>: Wechsle Ganztag Agenda Höhe</p>\n" }, | 1015 | { "<p><b>+,-</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" }, |
1016 | { "<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n","<p><b>S+ctrl</b>: Füge Sub-Todo hinzu | <b>X+ctrl</b>: Zeige/verstecke Datumsnavigator</p>\n" }, | 1016 | { "<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n","<p><b>S+ctrl</b>: Füge Sub-Todo hinzu | <b>X+ctrl</b>: Zeige/verstecke Datumsnavigator</p>\n" }, |
1017 | { "<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n","<p><b>T</b>: Gehe zu Heute | <b>T+ctrl</b>: Neues Todo</p>\n" }, | 1017 | { "<p><b>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" }, |
1018 | { "<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n","<p><b>E</b>: Editiere selektiertes Item |<b> E+ctrl</b>: Neuer Termin</p>\n" }, | 1018 | { "<p><b>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" }, |
1019 | { "<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n","<p><b>D</b>: Ein-Tages Ansicht | <b>M</b>: Monatsansicht</p>\n" }, | 1019 | { "<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n","<p><b>D</b>: Ein-Tages Ansicht | <b>M</b>: Monatsansicht</p>\n" }, |
1020 | { "<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n","<p><b>Z,Y</b>: Arbeitswochenansicht | <b>U</b>: Wochenansicht</p>\n" }, | 1020 | { "<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n","<p><b>Z,Y</b>: Arbeitswochenansicht | <b>U</b>: Wochenansicht</p>\n" }, |
1021 | { "<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n","<p><b>V</b>: Todo Ansicht | <b>L</b>: Termin Listen Ansicht</p>\n" }, | 1021 | { "<p><b>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" }, |
1022 | { "<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ","<p><b>X</b>: Nächste-X-Tage Ansicht | <b>W</b>: What's Next Ansicht\n " }, | 1022 | { "<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ","<p><b>X</b>: Nächste-X-Tage Ansicht | <b>W</b>: What's Next Ansicht\n " }, |
1023 | { "<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n","<p><b>1-0</b> (+<b>ctrl</b>): Selektiere Filter 1-10 (11-20)</p>\n" }, | 1023 | { "<p><b>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" }, |
1024 | { "<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n","<p><b>O</b>: Filter An/Aus | <b>J</b>: Journal Ansicht</p>\n" }, | 1024 | { "<p><b>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" }, |
1025 | { "<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n","<p><b>Space</b>: Zeige fullscreen | <b>P</b>: Datums Picker</p>\n" }, | 1025 | { "<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n","<p><b>Space</b>: Zeige fullscreen | <b>P</b>: Datums Picker</p>\n" }, |
1026 | { "<p><b>I</b>: Show info for selected event/todo</p>\n","<p><b>I</b>: Zeige Info (Details) für selektiertes Item</p>\n" }, | 1026 | { "<p><b>I</b>: Show info for selected event/todo</p>\n","<p><b>I</b>: Zeige Info (Details) für selektiertes Item</p>\n" }, |
1027 | { "<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n","<p><b>H</b>: Dieser Hilfe Dialog | <b>S</b>: Such Dialog</p>\n" }, | 1027 | { "<p><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" }, |
1028 | { "<p><h2>KO/Pi key shortcuts:</h2></p>\n","<p><h2>KO/Pi Tastatur Kurzbefehle:</h2></p>\n" }, | 1028 | { "<p><h2>KO/Pi key shortcuts:</h2></p>\n","<p><h2>KO/Pi Tastatur Kurzbefehle:</h2></p>\n" }, |
1029 | { "After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n","Nachdem etwas geändert wurde, werden die\nDaten automatisch in die Datei abgespeichert\n~/kdepim/apps/korganizer/mycalendar.ics\nnach (konfigurierbar) drei Minuten.\nAus Sicherheitsgründen wird noch einmal\nnach 10 Min. abgespeichert, wenn keine\nÄnderungen vorgenommen wurden. Die \nDaten werden automatisch gespeichert,\nwenn KO/Pi beendet wird.\nSie können eine Backup-Datei erstellen im\nMenu: Datei - Speichere Kalender Backup\n" }, | 1029 | { "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" }, |
1030 | { "Auto Saving in KOrganizer/Pi","Auto Speichern in KOrganizer/Pi" }, | 1030 | { "Auto Saving in KOrganizer/Pi","Auto Speichern in KOrganizer/Pi" }, |
1031 | { "\nhttp://sourceforge.net/projects/kdepimpi\n","\nhttp://sourceforge.net/projects/kdepimpi\n" }, | 1031 | { "\nhttp://sourceforge.net/projects/kdepimpi\n","\nhttp://sourceforge.net/projects/kdepimpi\n" }, |
1032 | { "\nor report them in the bugtracker on\n","\noder trage sie in dem Bugtracker ein auf\n" }, | 1032 | { "\nor report them in the bugtracker on\n","\noder trage sie in dem Bugtracker ein auf\n" }, |
1033 | { "\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n","\nBitte melde fehlerhaftes Verhalten an\nlutz@pi-sync.info\n" }, | 1033 | { "\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n","\nBitte melde fehlerhaftes Verhalten an\nlutz@pi-sync.info\n" }, |
1034 | { "2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n","2) Ein Audio Alarm Daemon\nfür den Zaurus ist verfügbar\nals zusätzliche Anwendung\n" }, | 1034 | { "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" }, |
1035 | { "1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n","1) Importieren von *.vcs oder *.ics Dateien von\nanderen Anwendungen kann möglicherweise\n nicht richtig funktionieren,\nwenn die Termine Eigenschaften haben,\ndie KO/Pi nicht unterstützt.\n" }, | 1035 | { "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" }, |
1036 | { "Known Problems in KOrganizer/Pi","Bekannte Probleme in KOrganizer/Pi" }, | 1036 | { "Known Problems in KOrganizer/Pi","Bekannte Probleme in KOrganizer/Pi" }, |
1037 | { "KO/Pi FAQ","KO/Pi FAQ" }, | 1037 | { "KO/Pi FAQ","KO/Pi FAQ" }, |
1038 | { "PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n","PDA-Edition\nfür: Zaurus 5x00/7x0/860/3000/6000\n" }, | 1038 | { "PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n","PDA-Edition\nfür: Zaurus 5x00/7x0/860/3000/6000\n" }, |
1039 | { "KOrganizer/Platform-independent\n","KOrganizer/Platform-independent\n" }, | 1039 | { "KOrganizer/Platform-independent\n","KOrganizer/Platform-independent\n" }, |
1040 | { "About KOrganizer/Pi","Über KOrganizer/Pi" }, | 1040 | { "About KOrganizer/Pi","Über KOrganizer/Pi" }, |
1041 | { "From: ","Von: " }, | 1041 | { "From: ","Von: " }, |
1042 | { "Remove sync info","Entferne Sync Info" }, | 1042 | { "Remove sync info","Entferne Sync Info" }, |
1043 | { "For all profiles","Für alle Profile" }, | 1043 | { "For all profiles","Für alle Profile" }, |
1044 | { "Hide not Running","Verstecke nicht Laufende" }, | 1044 | { "Hide not Running","Verstecke nicht Laufende" }, |
1045 | { "ME","ME" }, | 1045 | { "ME","ME" }, |
1046 | { "Toolbar","Toolbar" }, | 1046 | { "Toolbar","Toolbar" }, |
1047 | { "Undo Delete...","Löschen rückgängig machen..." }, | 1047 | { "Undo Delete...","Löschen rückgängig machen..." }, |
1048 | { "Undo Delete","Löschen rückgängig machen" }, | 1048 | { "Undo Delete","Löschen rückgängig machen" }, |
1049 | { "KDE Sync HowTo...","KDE Sync HowTo..." }, | 1049 | { "KDE Sync HowTo...","KDE Sync HowTo..." }, |
1050 | { "Multi Sync HowTo...","Multi Sync HowTo..." }, | 1050 | { "Multi Sync HowTo...","Multi Sync HowTo..." }, |
1051 | { "Januar","Januar" }, | 1051 | { "Januar","Januar" }, |
1052 | { "KO/Pi Keys + Colors","KO/Pi Tasten + Farben" }, | 1052 | { "KO/Pi Keys + Colors","KO/Pi Tasten + Farben" }, |
1053 | { "No Filter","Kein Filter" }, | 1053 | { "No Filter","Kein Filter" }, |
1054 | { "Multiple Sync options","Multi Sync Optionen" }, | 1054 | { "Multiple Sync options","Multi Sync Optionen" }, |
1055 | { "Sync algo options","Sync Ablauf Optionen" }, | 1055 | { "Sync algo options","Sync Ablauf Optionen" }, |
1056 | { "Apply filter when adding data to local:","Filter für das Hinzufügen von Daten zu Lokal:" }, | 1056 | { "Apply filter when adding data to local:","Filter für das Hinzufügen von Daten zu Lokal:" }, |
1057 | { "Incoming calendar filter:","Eingehender Kalender Filter:" }, | 1057 | { "Incoming calendar filter:","Eingehender Kalender Filter:" }, |
1058 | { "Incoming addressbook filter:","Eingehender Adressbuch Filter:" }, | 1058 | { "Incoming addressbook filter:","Eingehender Adressbuch Filter:" }, |
1059 | { "Write back options","Optionen zum Zurückschreiben" }, | 1059 | { "Write back options","Optionen zum Zurückschreiben" }, |
1060 | { "Write back (on remote) existing entries only","Schreibe nur existierende (auf Entfernt) Einträge zurück" }, | 1060 | { "Write back (on remote) existing entries only","Schreibe nur existierende (auf Entfernt) Einträge zurück" }, |
1061 | { "Apply filter when adding data to remote:","Filter für das Hinzufügen von Daten zu Entfernt:" }, | 1061 | { "Apply filter when adding data to remote:","Filter für das Hinzufügen von Daten zu Entfernt:" }, |
1062 | { "Outgoing calendar filter:","Ausgehender Kalender Filter:" }, | 1062 | { "Outgoing calendar filter:","Ausgehender Kalender Filter:" }, |
1063 | { "Outgoing addressbook filter:","Ausgehender Adressbuch Filter:" }, | 1063 | { "Outgoing addressbook filter:","Ausgehender Adressbuch Filter:" }, |
1064 | { "Write back (calendar) entries for time period only","Schreibe nur Kalender Einträge für Zeitspanne zurück" }, | 1064 | { "Write back (calendar) entries for time period only","Schreibe nur Kalender Einträge für Zeitspanne zurück" }, |
1065 | { "Time period","Zeitspanne" }, | 1065 | { "Time period","Zeitspanne" }, |
1066 | { "From ","Von " }, | 1066 | { "From ","Von " }, |
1067 | { " weeks in the past to "," Wochen in der Vergangenheit bis zu " }, | 1067 | { " weeks in the past to "," Wochen in der Vergangenheit bis zu " }, |
1068 | { " weeks in the future "," Wochen in der Zukunft " }, | 1068 | { " weeks in the future "," Wochen in der Zukunft " }, |
1069 | { "Profile kind specific settings","Profil Art abhängige Einstellungen" }, | 1069 | { "Profile kind specific settings","Profil Art abhängige Einstellungen" }, |
1070 | { "Local temp file:","Lokale temp Datei:" }, | 1070 | { "Local temp file:","Lokale temp Datei:" }, |
1071 | { "Multiple profiles with same name!\nPlease use unique profile names!","Mehrere Profile mit demselben Namen!\nBitte verschiedene Namen benutzen!" }, | 1071 | { "Multiple profiles with same name!\nPlease use unique profile names!","Mehrere Profile mit demselben Namen!\nBitte verschiedene Namen benutzen!" }, |
1072 | { "Aborted! Nothing synced!","Abgebrochen! Nichts wurde gesynct!" }, | 1072 | { "Aborted! Nothing synced!","Abgebrochen! Nichts wurde gesynct!" }, |
1073 | { "Language","Sprache" }, | 1073 | { "Language","Sprache" }, |
1074 | { "Time Format","Zeit Format" }, | 1074 | { "Time Format","Zeit Format" }, |
1075 | { "Time Zone","Zeit Zone" }, | 1075 | { "Time Zone","Zeit Zone" }, |
1076 | { "%1 groups subscribed","%1 Guppen abboniert" }, | 1076 | { "%1 groups subscribed","%1 Guppen abboniert" }, |
1077 | { "Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail","Aktuelles Speicherverzeichnis ist:\n%1\nIhre Mail wird gespeichert in:\n(speicherverz.)/apps/kopiemail/localmail" }, | 1077 | { "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" }, |
1078 | { "<b>New data storage dir:</b>","<b>Neues Datenspeicherverzeichnis:</b>" }, | 1078 | { "<b>New data storage dir:</b>","<b>Neues Datenspeicherverzeichnis:</b>" }, |
1079 | { "New dirs are created automatically","Neue Verzeichnisse werden aut. erstellt" }, | 1079 | { "New dirs are created automatically","Neue Verzeichnisse werden aut. erstellt" }, |
1080 | { "Save settings","Speichere Einstellungen" }, | 1080 | { "Save settings","Speichere Einstellungen" }, |
1081 | { "Save standard","Speichere Standard" }, | 1081 | { "Save standard","Speichere Standard" }, |
1082 | { "<b>New settings are used\nafter a restart</b>","<b>Neue Einstellungen werden nach\neinem Neustart genutzt</b>" }, | 1082 | { "<b>New settings are used\nafter a restart</b>","<b>Neue Einstellungen werden nach\neinem Neustart genutzt</b>" }, |
1083 | { "Settings are stored in\n%1","Einstellungen werden gespeichert in:\n%1" }, | 1083 | { "Settings are stored in\n%1","Einstellungen werden gespeichert in:\n%1" }, |
1084 | { "Data storage path","Daten Speicherpfad" }, | 1084 | { "Data storage path","Daten Speicherpfad" }, |
1085 | { "Language","Sprache" }, | 1085 | { "Language","Sprache" }, |
1086 | { "Show time in agenda items","Zeige Zeit in Agenda Items" }, | 1086 | { "Show time in agenda items","Zeige Zeit in Agenda Items" }, |
1087 | { "Color for Sundays + category "Holiday"","Farbe für Sonntags + Kategorie "Feiertag"" }, | 1087 | { "Color for Sundays + category "Holiday"","Farbe für Sonntags + Kategorie "Feiertag"" }, |
1088 | { "Show events that are done","Zeige abgelaufene Termine" }, | 1088 | { "Show events that are done","Zeige abgelaufene Termine" }, |
1089 | { "Hide not running Todos in To-do view","Verstecke nicht laufende Todos" }, | 1089 | { "Hide not running Todos in To-do view","Verstecke nicht laufende Todos" }, |
1090 | { "+01:00 Europe/Oslo(CET)","+01:00 Europe/Oslo(CET)" }, | 1090 | { "+01:00 Europe/Oslo(CET)","+01:00 Europe/Oslo(CET)" }, |
1091 | { "KO/Pi","KO/Pi" }, | 1091 | { "KO/Pi","KO/Pi" }, |
1092 | { "There is nothing to undo!","Es gibt nichts zum\nRückgängigmachen!" }, | 1092 | { "There is nothing to undo!","Es gibt nichts zum\nRückgängigmachen!" }, |
1093 | { "Recreating edit dialog. Please wait...","Recreating edit dialog. Please wait..." }, | 1093 | { "Recreating edit dialog. Please wait...","Recreating edit dialog. Please wait..." }, |
1094 | { "Sound.Al.: ","Sound.Al.: " }, | 1094 | { "Sound.Al.: ","Sound.Al.: " }, |
1095 | { "From: %1 To: %2 %3","Von: %1 Bis: %2 %3" }, | 1095 | { "From: %1 To: %2 %3","Von: %1 Bis: %2 %3" }, |
1096 | { "Restore","Wiederherstellen" }, | 1096 | { "Restore","Wiederherstellen" }, |
1097 | { "\nAre you sure you want\nto restore this?","\nMöchten Sie das wirklicht\nwiederherstellen?" }, | 1097 | { "\nAre you sure you want\nto restore this?","\nMöchten Sie das wirklicht\nwiederherstellen?" }, |
1098 | { "% completed","% erledigt" }, | 1098 | { "% completed","% erledigt" }, |
1099 | { "%d item(s) found.","%d Item(s) gefunden." }, | 1099 | { "%d item(s) found.","%d Item(s) gefunden." }, |
1100 | { "Set complete","Setze auf erledigt" }, | 1100 | { "Set complete","Setze auf erledigt" }, |
1101 | { "(cancelled)","(gecancelt)" }, | 1101 | { "(cancelled)","(gecancelt)" }, |
1102 | { "Click on the week number to\nshow week in agenda view","Klicke auf die Wochennummer\num die Woche in der Agenda anzuzeigen" }, | 1102 | { "Click on the week number to\nshow week in agenda view","Klicke auf die Wochennummer\num die Woche in der Agenda anzuzeigen" }, |
1103 | { " Local time "," Locale Zeit " }, | 1103 | { " Local time "," Locale Zeit " }, |
1104 | { "Form2","Form2" }, | 1104 | { "Form2","Form2" }, |
1105 | { "Filter enabled","Filter angeschaltet" }, | 1105 | { "Filter enabled","Filter angeschaltet" }, |
1106 | { "Edit Filters","Ändere Filter" }, | 1106 | { "Edit Filters","Ändere Filter" }, |
1107 | { "Print What's Next View...","Drucke What's Next Ansicht..." }, | 1107 | { "Print What's Next View...","Drucke What's Next Ansicht..." }, |
1108 | { "Agenda","Agenda" }, | 1108 | { "Agenda","Agenda" }, |
1109 | { " ("," (" }, | 1109 | { " ("," (" }, |
1110 | { "<p><b>Due on:</b> %1</p>","<p><b>Fällig am:</b> %1</p>" }, | 1110 | { "<p><b>Due on:</b> %1</p>","<p><b>Fällig am:</b> %1</p>" }, |
1111 | { "Print","Print" }, | 1111 | { "Print","Print" }, |
1112 | { "&Setup Printer...","Drucker &Setup..." }, | 1112 | { "&Setup Printer...","Drucker &Setup..." }, |
1113 | { "View Type","Zeige Typ" }, | 1113 | { "View Type","Zeige Typ" }, |
1114 | { "Page &orientation:","Seiten Ausrichtung:" }, | 1114 | { "Page &orientation:","Seiten Ausrichtung:" }, |
1115 | { "Use Default of Selected Style","Default des selektierten Stils" }, | 1115 | { "Use Default of Selected Style","Default des selektierten Stils" }, |
1116 | { "Use Default Setting of Printer","Default Einstellung des Druckers" }, | 1116 | { "Use Default Setting of Printer","Default Einstellung des Druckers" }, |
1117 | { "Portrait","Portrait" }, | 1117 | { "Portrait","Portrait" }, |
1118 | { "Landscape","Landschaft" }, | 1118 | { "Landscape","Landschaft" }, |
1119 | { "Print day","Drucke Tag" }, | 1119 | { "Print day","Drucke Tag" }, |
1120 | { "CalPrintDay_Base","CalPrintDay_Base" }, | 1120 | { "CalPrintDay_Base","CalPrintDay_Base" }, |
1121 | { "Date && Time Range","Datum && Zeitspanne" }, | 1121 | { "Date && Time Range","Datum && Zeitspanne" }, |
1122 | { "&End date:","&Enddatum:" }, | 1122 | { "&End date:","&Enddatum:" }, |
1123 | { "&Start date:","&Startdatum:" }, | 1123 | { "&Start date:","&Startdatum:" }, |
1124 | { "Start &time:","Startzeit:" }, | 1124 | { "Start &time:","Startzeit:" }, |
1125 | { "End ti&me:","Endzeit:" }, | 1125 | { "End ti&me:","Endzeit:" }, |
1126 | { "E&xtend time range to include all events","Erweitere Zeitspanne um alle Termine einzuschliessen" }, | 1126 | { "E&xtend time range to include all events","Erweitere Zeitspanne um alle Termine einzuschliessen" }, |
1127 | { "Include to&dos that are due on the printed day(s)","Inclusive To&dos, die an den selektierten Tagen fällig sind" }, | 1127 | { "Include to&dos that are due on the printed day(s)","Inclusive To&dos, die an den selektierten Tagen fällig sind" }, |
1128 | { "Alt+D","Alt+D" }, | 1128 | { "Alt+D","Alt+D" }, |
1129 | { "&Use colors","Nutze Farben" }, | 1129 | { "&Use colors","Nutze Farben" }, |
1130 | { "Alt+U","Alt+U" }, | 1130 | { "Alt+U","Alt+U" }, |
1131 | { "Print week","Drucke Woche" }, | 1131 | { "Print week","Drucke Woche" }, |
1132 | { "CalPrintWeek_Base","CalPrintWeek_Base" }, | 1132 | { "CalPrintWeek_Base","CalPrintWeek_Base" }, |
1133 | { "Use &colors","Nutze Farben" }, | 1133 | { "Use &colors","Nutze Farben" }, |
1134 | { "Type of View","Typ der Ansicht" }, | 1134 | { "Type of View","Typ der Ansicht" }, |
1135 | { "Print as &Filofax page","Drucke als &Filofax Seite" }, | 1135 | { "Print as &Filofax page","Drucke als &Filofax Seite" }, |
1136 | { "Alt+F","Alt+F" }, | 1136 | { "Alt+F","Alt+F" }, |
1137 | { "Print as &timetable view:","Drucke als Zeittabelle:" }, | 1137 | { "Print as &timetable view:","Drucke als Zeittabelle:" }, |
1138 | { "Alt+T","Alt+T" }, | 1138 | { "Alt+T","Alt+T" }, |
1139 | { "Print as split week view","Drucke als gesplittete Wochenansicht" }, | 1139 | { "Print as split week view","Drucke als gesplittete Wochenansicht" }, |
1140 | { "Print month","Drucke Monat" }, | 1140 | { "Print month","Drucke Monat" }, |
1141 | { "CalPrintMonth_Base","CalPrintMonth_Base" }, | 1141 | { "CalPrintMonth_Base","CalPrintMonth_Base" }, |
1142 | { "&Start month:","&Startmonat:" }, | 1142 | { "&Start month:","&Startmonat:" }, |
1143 | { "&End month:","&Endmonat:" }, | 1143 | { "&End month:","&Endmonat:" }, |
1144 | { "Print week &numbers","Drucke Wochen Nummer(n)" }, | 1144 | { "Print week &numbers","Drucke Wochen Nummer(n)" }, |
1145 | { "Print todos","Drucke Todos" }, | 1145 | { "Print todos","Drucke Todos" }, |
1146 | { "CalPrintTodoConfig_Base","CalPrintTodoConfig_Base" }, | 1146 | { "CalPrintTodoConfig_Base","CalPrintTodoConfig_Base" }, |
1147 | { "Include &description of the item","Inclusive Itembeschreibung" }, | 1147 | { "Include &description of the item","Inclusive Itembeschreibung" }, |
1148 | { "Include d&ue date of the item","Inclusive Fälligkeitsdatum des Items" }, | 1148 | { "Include d&ue date of the item","Inclusive Fälligkeitsdatum des Items" }, |
1149 | { "Include &priority of the item","Inclusive Priorität des Items" }, | 1149 | { "Include &priority of the item","Inclusive Priorität des Items" }, |
1150 | { "Items to Print","Zu druckende Items" }, | 1150 | { "Items to Print","Zu druckende Items" }, |
1151 | { "&From:","Von:" }, | 1151 | { "&From:","Von:" }, |
1152 | { "&To:","Bis:" }, | 1152 | { "&To:","Bis:" }, |
1153 | { "Print &all todo items","Drucke alle Todo Items" }, | 1153 | { "Print &all todo items","Drucke alle Todo Items" }, |
1154 | { "Print only &uncompleted items","Drucke nur nicht erledigte Todos" }, | 1154 | { "Print only &uncompleted items","Drucke nur nicht erledigte Todos" }, |
1155 | { "Only items due in the &range:","Nur Items in dem Zeitraum:" }, | 1155 | { "Only items due in the &range:","Nur Items in dem Zeitraum:" }, |
1156 | { "Todo List","Todo Liste" }, | 1156 | { "Todo List","Todo Liste" }, |
1157 | { "&Title:","&Titel:" }, | 1157 | { "&Title:","&Titel:" }, |
1158 | { "Co&nnect subtodos with its parent","Verbinde Untertodos mit ihren Ober-Todos" }, | 1158 | { "Co&nnect subtodos with its parent","Verbinde Untertodos mit ihren Ober-Todos" }, |
1159 | { "Todo list","Todo Liste" }, | 1159 | { "Todo list","Todo Liste" }, |
1160 | { "&Print...","Drucke..." }, | 1160 | { "&Print...","Drucke..." }, |
1161 | { "<qt>Printing on printer <b>%1</b></qt>","<qt>Drucke auf Drucker <b>%1</b></qt>" }, | 1161 | { "<qt>Printing on printer <b>%1</b></qt>","<qt>Drucke auf Drucker <b>%1</b></qt>" }, |
1162 | { "[Unconfigured]","[Unkonfiguriert]" }, | 1162 | { "[Unconfigured]","[Unkonfiguriert]" }, |
1163 | { "OK","OK" }, | 1163 | { "OK","OK" }, |
1164 | { "FilterEditor","FilterEditor" }, | 1164 | { "FilterEditor","FilterEditor" }, |
1165 | { "Include","Inclusive" }, | 1165 | { "Include","Inclusive" }, |
1166 | { "Exclude","Exclusive" }, | 1166 | { "Exclude","Exclusive" }, |
1167 | { "Edit Selection...","Editiere Auswahl" }, | 1167 | { "Edit Selection...","Editiere Auswahl" }, |
1168 | { "recurring events","wiederholende Termine" }, | 1168 | { "recurring events","wiederholende Termine" }, |
1169 | { "recurr. events","wiederh.Termine" }, | 1169 | { "recurr. events","wiederh.Termine" }, |
1170 | { "completed to-dos","erledigte Todos" }, | 1170 | { "completed to-dos","erledigte Todos" }, |
1171 | { "events","Termine" }, | 1171 | { "events","Termine" }, |
1172 | { "todos","Todos" }, | 1172 | { "todos","Todos" }, |
1173 | { "journals","Journale" }, | 1173 | { "journals","Journale" }, |
1174 | { "public","öffentl." }, | 1174 | { "public","öffentl." }, |
1175 | { "private","privat" }, | 1175 | { "private","privat" }, |
1176 | { "confidential","vertraul." }, | 1176 | { "confidential","vertraul." }, |
1177 | { "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Untertodos.\nAlle erledigten Untertodos\nwerden auch gelöscht!" }, | 1177 | { "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Untertodos.\nAlle erledigten Untertodos\nwerden auch gelöscht!" }, |
1178 | { "Yesterday","Gestern" }, | 1178 | { "Yesterday","Gestern" }, |
1179 | { "Day after tomorrow","Übermorgen" }, | 1179 | { "Day after tomorrow","Übermorgen" }, |
1180 | { "Tomorrow","Morgen" }, | 1180 | { "Tomorrow","Morgen" }, |
1181 | { "Day before yesterday","Vorgestern" }, | 1181 | { "Day before yesterday","Vorgestern" }, |
1182 | { "Size %1","Größe %1" }, | 1182 | { "Size %1","Größe %1" }, |
1183 | { "New Agendasize: %1","Neue Agendagröße: %1" }, | 1183 | { "New Agendasize: %1","Neue Agendagröße: %1" }, |
1184 | { " (%1 y.)"," (%1 J.)" }, | 1184 | { " (%1 y.)"," (%1 J.)" }, |
1185 | { "Allday:","Ganztägig:" }, | 1185 | { "Allday:","Ganztägig:" }, |
1186 | { "compl.todos","erled.Todos" }, | 1186 | { "compl.todos","erled.Todos" }, |
1187 | { "Day view","Tagesansicht" }, | 1187 | { "Day view","Tagesansicht" }, |
1188 | { "Next days","Nächste Tage" }, | 1188 | { "Next days","Nächste Tage" }, |
1189 | { "Next week","Nächste Woche" }, | 1189 | { "Next week","Nächste Woche" }, |
1190 | { "Next two weeks","Nächste zwei Wochen" }, | 1190 | { "Next two weeks","Nächste zwei Wochen" }, |
1191 | { "This month","Dieser Monat" }, | 1191 | { "This month","Dieser Monat" }, |
1192 | { "Journal view","Journal" }, | 1192 | { "Journal view","Journal" }, |
1193 | { "Display all opened","Zeige alle geöffnet" }, | 1193 | { "Display all opened","Zeige alle geöffnet" }, |
1194 | { "Display all closed","Zeige alle geschlossen" }, | 1194 | { "Display all closed","Zeige alle geschlossen" }, |
1195 | { "Display all flat","Zeige alle flach" }, | 1195 | { "Display all flat","Zeige alle flach" }, |
1196 | { "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" }, | 1196 | { "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" }, |
1197 | { "Default todo done color:","Standard Todo erledigt Farbe" }, | 1197 | { "Default todo done color:","Standard Todo erledigt Farbe" }, |
1198 | { "Select week %1-%2","Wähle Woche %1-%2" }, | 1198 | { "Select week %1-%2","Wähle Woche %1-%2" }, |
1199 | { "Select Week","Wähle Woche" }, | 1199 | { "Select Week","Wähle Woche" }, |
1200 | { "Set alarm for selected...","Setze Alarm für Selekt..." }, | 1200 | { "Set alarm for selected...","Setze Alarm für Selekt..." }, |
1201 | { "Set Alarm!","Setze Alarm!" }, | 1201 | { "Set Alarm!","Setze Alarm!" }, |
1202 | { "Changed alarm for %1 items","Alarm für %1 Items geändert" }, | 1202 | { "Changed alarm for %1 items","Alarm für %1 Items geändert" }, |
1203 | { " and "," und " }, | 1203 | { " and "," und " }, |
1204 | { "<IMG src="%1"> only )","nur <IMG src="%1"> )" }, | 1204 | { "<IMG src="%1"> only )","nur <IMG src="%1"> )" }, |
1205 | { "Mail to selected","Mail an Ausgewählte" }, | 1205 | { "Mail to selected","Mail an Ausgewählte" }, |
1206 | { "Mail to all","Mail an Alle" }, | 1206 | { "Mail to all","Mail an Alle" }, |
1207 | { "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" }, | 1207 | { "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" }, |
1208 | { "Set reminder ON with offset to:","Alarm AN mit Offset auf:" }, | 1208 | { "Set reminder ON with offset to:","Alarm AN mit Offset auf:" }, |
1209 | { " on"," am" }, | 1209 | { " on"," am" }, |
1210 | { " completed on "," erledigt am " }, | 1210 | { " completed on "," erledigt am " }, |
1211 | { "Save as Event template","Speichere als Vorlage" }, | 1211 | { "Save as Event template","Speichere als Vorlage" }, |
1212 | { "Load Event template","Lade Termin Vorlage" }, | 1212 | { "Load Event template","Lade Termin Vorlage" }, |
1213 | { "Save as Journal template","Speichere als Journal Vorlage" }, | 1213 | { "Save as Journal template","Speichere als Journal Vorlage" }, |
1214 | { "Insert Journal template","Füge Journal Vorlage ein" }, | 1214 | { "Insert Journal template","Füge Journal Vorlage ein" }, |
1215 | { "Sub todos:<br>","Unter Todos:<br>" }, | 1215 | { "Sub todos:<br>","Unter Todos:<br>" }, |
1216 | { "Parent todo:<br>","Über Todo:<br>" }, | 1216 | { "Parent todo:<br>","Über Todo:<br>" }, |
1217 | { "Set current as color category","Setze Gewählte als Farbkategorie" }, | 1217 | { "Set current as color category","Setze Gewählte als Farbkategorie" }, |
1218 | { " completed"," erledigt" }, | 1218 | { " completed"," erledigt" }, |
1219 | { "(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!","(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi basiert auf KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) und das KDE Team.\nKOrganizer/Pi ist lizensiert unter der GPL.\nKO/Pi kann kompiliert werden für\nLinux, Zaurus-PDA und Windows\nwww.pi-sync.info --- www.korganizer.org\nBesonderen Dank an Michael und Ben\nfür intensives Testen!" }, | 1219 | { "(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!","(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi basiert auf KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) und das KDE Team.\nKOrganizer/Pi ist lizensiert unter der GPL.\nKO/Pi kann kompiliert werden für\nLinux, Zaurus-PDA und Windows\nwww.pi-sync.info --- www.korganizer.org\nBesonderen Dank an Michael und Ben\nfür intensives Testen!" }, |
1220 | { "Syncing aborted. Nothing synced.","Syncing abgebrochen.Nichts wurde gesynct." }, | 1220 | { "Syncing aborted. Nothing synced.","Syncing abgebrochen.Nichts wurde gesynct." }, |
1221 | { "Connected! Sending request for remote file ...","Verbunden! Sende Daten Anfrage..." }, | 1221 | { "Connected! Sending request for remote file ...","Verbunden! Sende Daten Anfrage..." }, |
1222 | { "Trying to connect to remote...","Versuche mit Gegenstelle zu verbinden..." }, | 1222 | { "Trying to connect to remote...","Versuche mit Gegenstelle zu verbinden..." }, |
1223 | { "Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?","Verbindungsversuch wegen\nZeitüberschreitung gescheitert!\nWurde vergessen Pi-Sync auf\nder Gegenstelle anzuschalten?" }, | 1223 | { "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?" }, |
1224 | { "ERROR: Receiving remote file failed.","FEHLER: Empfang der entfernten Daten fehlgeschlagen." }, | 1224 | { "ERROR: Receiving remote file failed.","FEHLER: Empfang der entfernten Daten fehlgeschlagen." }, |
1225 | { "Error","Fehler" }, | 1225 | { "Error","Fehler" }, |
1226 | { ""You entered an invalid date!\n Date changed to current date.","Ungültiges Datum eingegeben.\nSetze heutiges Datum." }, | 1226 | { ""You entered an invalid date!\n Date changed to current date.","Ungültiges Datum eingegeben.\nSetze heutiges Datum." }, |
1227 | { "You entered an invalid date!\n Will use current date instead.","Ungültiges Datum eingegeben.\nSetze stattdessen heutiges Datum." }, | 1227 | { "You entered an invalid date!\n Will use current date instead.","Ungültiges Datum eingegeben.\nSetze stattdessen heutiges Datum." }, |
1228 | { "Warning","Warnung" }, | 1228 | { "Warning","Warnung" }, |
1229 | { "Select week number","Wähle Wochen Nummer" }, | 1229 | { "Select week number","Wähle Wochen Nummer" }, |
1230 | { "Februar","Februar" }, | 1230 | { "Februar","Februar" }, |
1231 | { "Click on the week number to\nshow week zoomed","Klicke auf die Wochennummer\num die Woche groß zu zeigen" }, | 1231 | { "Click on the week number to\nshow week zoomed","Klicke auf die Wochennummer\num die Woche groß zu zeigen" }, |
1232 | { "W","W" }, | 1232 | { "W","W" }, |
1233 | { "Click on this to\nselect week number","Klicke hierauf um\ndie Woche auszuwählen" }, | 1233 | { "Click on this to\nselect week number","Klicke hierauf um\ndie Woche auszuwählen" }, |
1234 | { "T: %1","T: %1" }, | 1234 | { "T: %1","T: %1" }, |
1235 | { "Start: ","Start: " }, | 1235 | { "Start: ","Start: " }, |
1236 | { "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " }, | 1236 | { "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " }, |
1237 | { "Password for remote access:","Passwort für fernen Zugriff:" }, | 1237 | { "Password for remote access:","Passwort für fernen Zugriff:" }, |
1238 | { "Remote IP address:","Ferne IP Adresse:" }, | 1238 | { "Remote IP address:","Ferne IP Adresse:" }, |
1239 | { "Remote port number:","Ferne Port Nummer:" }, | 1239 | { "Remote port number:","Ferne Port Nummer:" }, |
1240 | { "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." }, | 1240 | { "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." }, |
1241 | { "Remote from: ","Fern von: " }, | 1241 | { "Remote from: ","Fern von: " }, |
1242 | { "Local from: ","Lokal von: " }, | 1242 | { "Local from: ","Lokal von: " }, |
1243 | { "Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n","Synchronisationsübersicht:\n\n %d lokal hinzugefügt\n %d fern hinzugefügt\n %d lokal geändert\n %d fern geändert\n %d lokal gelöscht\n %d fern gelöscht\n %d eingehende ausgefiltert\n %d ausgehende ausgefiltert\n" }, | 1243 | { "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" }, |
1244 | { "Local calendar changed!\n","Lokaler Kalender geändert!\n" }, | 1244 | { "Local calendar changed!\n","Lokaler Kalender geändert!\n" }, |
1245 | { "Write back","Schreibe zurück" }, | 1245 | { "Write back","Schreibe zurück" }, |
1246 | { "KO/Pi Synchronization","KO/Pi Synchronisation" }, | 1246 | { "KO/Pi Synchronization","KO/Pi Synchronisation" }, |
1247 | { "Pi-Sync succesful!","Pi-Sync erfolgreich!" }, | 1247 | { "Pi-Sync succesful!","Pi-Sync erfolgreich!" }, |
1248 | { "Received sync request","Sync Anfrage erhalten" }, | 1248 | { "Received sync request","Sync Anfrage erhalten" }, |
1249 | { "Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog.","Ferne Synchronisation ...\n\nBenutze diese Anwendung nicht!\n\nWenn das Syncen fehlschlägt kann\ndieser Dialog geschlossen werden." }, | 1249 | { "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." }, |
1250 | { "Saving Data to temp file ...","Speichere Daten in temp Datei..." }, | 1250 | { "Saving Data to temp file ...","Speichere Daten in temp Datei..." }, |
1251 | { "Data saved to temp file!","Daten in temp Datei gespeichert!" }, | 1251 | { "Data saved to temp file!","Daten in temp Datei gespeichert!" }, |
1252 | { "Sending file...","Sende Datei..." }, | 1252 | { "Sending file...","Sende Datei..." }, |
1253 | { "Waiting for synced file...","Warte auf gesyncte Daten..." }, | 1253 | { "Waiting for synced file...","Warte auf gesyncte Daten..." }, |
1254 | { "Receiving synced file...","Gesyncte Daten erhalten..." }, | 1254 | { "Receiving synced file...","Gesyncte Daten erhalten..." }, |
1255 | { "Received %1 bytes","%1 Bytes erhalten" }, | 1255 | { "Received %1 bytes","%1 Bytes erhalten" }, |
1256 | { "Writing file to disk...","Speichere Datei..." }, | 1256 | { "Writing file to disk...","Speichere Datei..." }, |
1257 | { "Pi-Sync successful!","Pi-Sync erfolgreich!" }, | 1257 | { "Pi-Sync successful!","Pi-Sync erfolgreich!" }, |
1258 | { "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" }, | 1258 | { "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" }, |
1259 | { "Synchronize!","Synchronisiere!" }, | 1259 | { "Synchronize!","Synchronisiere!" }, |
1260 | { "High clock skew!","Großer Uhrzeitunterschied!" }, | 1260 | { "High clock skew!","Großer Uhrzeitunterschied!" }, |
1261 | { "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" }, | 1261 | { "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" }, |
1262 | { "The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!","Die Uhren der syncenden Geräte\nhaben einen Unterschied von\nmehr als 5 Minuten. Bitte die\nUhrzeiten anpassen. Sie können\nfalsche Sync-Resultate erhalten!\nBitte das Syncen bestätigen!" }, | 1262 | { "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!" }, |
1263 | { "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." }, | 1263 | { "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." }, |
1264 | { "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" }, | 1264 | { "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" }, |
1265 | { "List week view","Listenwochenansicht" }, | 1265 | { "List week view","Listenwochenansicht" }, |
1266 | { "List week","Listenwochenansicht" }, | 1266 | { "List week","Listenwochenansicht" }, |
1267 | { "Next Week","Nächste Woche" }, | 1267 | { "Next Week","Nächste Woche" }, |
1268 | { "Previous Week","Vorherige Woche" }, | 1268 | { "Previous Week","Vorherige Woche" }, |
1269 | { "No items were found matching\nyour search expression.\nUse the wildcard characters\n'*' and '?' where needed.","Keine Einträge gefunden die\ndem Suchausdruck entsprechen.\nBenutze Platzhalter Zeichen\n'*' und '?' wo benötigt." }, | 1269 | { "No items were found matching\nyour search expression.\nUse the wildcard characters\n'*' and '?' where needed.","Keine Einträge gefunden die\ndem Suchausdruck entsprechen.\nBenutze Platzhalter Zeichen\n'*' und '?' wo benötigt." }, |
1270 | { "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" }, | 1270 | { "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" }, |
1271 | { "Details","Details" }, | 1271 | { "Details","Details" }, |
1272 | { "Created time","Erstellt Zeit" }, | 1272 | { "Created time","Erstellt Zeit" }, |
1273 | { "Last modified time","Geändert Zeit" }, | 1273 | { "Last modified time","Geändert Zeit" }, |
1274 | { "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" }, | 1274 | { "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" }, |
1275 | { "View Options","Anzeige Optionen" }, | 1275 | { "View Options","Anzeige Optionen" }, |
1276 | { "<b>Created: ","<b>Erstellt am: " }, | 1276 | { "<b>Created: ","<b>Erstellt am: " }, |
1277 | { "<b>Last modified: ","<b>Zuletzt geändert am: " }, | 1277 | { "<b>Last modified: ","<b>Zuletzt geändert am: " }, |
1278 | { "Journal: ","Journal: " }, | 1278 | { "Journal: ","Journal: " }, |
1279 | { "yearly","jährlich" }, | 1279 | { "yearly","jährlich" }, |
1280 | { "(%1) ","%1-" }, | 1280 | { "(%1) ","%1-" }, |
1281 | { "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" }, | 1281 | { "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" }, |
1282 | { "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" }, | 1282 | { "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" }, |
1283 | { "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" }, | 1283 | { "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" }, |
1284 | { "Summary/Loc.","Titel/Ort" }, | 1284 | { "Summary/Loc.","Titel/Ort" }, |
1285 | { "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." }, | 1285 | { "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." }, |
1286 | { "Week Number","Wochennummer" }, | 1286 | { "Week Number","Wochennummer" }, |
1287 | { "Import","Importiere" }, | 1287 | { "Import","Importiere" }, |
1288 | { "Export","Exportiere" }, | 1288 | { "Export","Exportiere" }, |
1289 | { "Beam","Beame" }, | 1289 | { "Beam","Beame" }, |
1290 | { "Export selected","Exportiere Selektierte" }, | 1290 | { "Export selected","Exportiere Selektierte" }, |
1291 | { "As iCal (ics) file...","Als iCal (ics) Datei..." }, | 1291 | { "As iCal (ics) file...","Als iCal (ics) Datei..." }, |
1292 | { "As vCal (vcs) file...","Als vCal (vcs) Datei..." }, | 1292 | { "As vCal (vcs) file...","Als vCal (vcs) Datei..." }, |
1293 | { "Journal/Details...","Journale/Details..." }, | 1293 | { "Journal/Details...","Journale/Details..." }, |
1294 | { "Agenda View","Agenda Ansicht" }, | 1294 | { "Agenda View","Agenda Ansicht" }, |
1295 | { "Show current time","Zeige aktuelle Zeit" }, | 1295 | { "Show current time","Zeige aktuelle Zeit" }, |
1296 | { "Edit new item","Bearbeite neuen Eintrag" }, | 1296 | { "Edit new item","Bearbeite neuen Eintrag" }, |
1297 | { "Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals","Bitte wählen Sie mindestens\neinen dieser Typen\num darin zu suchen:\n\nTermine\nTodos\nJournale" }, | 1297 | { "Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals","Bitte wählen Sie mindestens\neinen dieser Typen\num darin zu suchen:\n\nTermine\nTodos\nJournale" }, |
1298 | { "There is no next alarm.","Es gibt keinen nächsten Alarm." }, | 1298 | { "There is no next alarm.","Es gibt keinen nächsten Alarm." }, |
1299 | { "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" }, | 1299 | { "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" }, |
1300 | { "The next alarm is in:\n","Der nächste Alarm ist in:\n" }, | 1300 | { "The next alarm is in:\n","Der nächste Alarm ist in:\n" }, |
1301 | { "%1 days\n","%1 Tagen\n" }, | 1301 | { "%1 days\n","%1 Tagen\n" }, |
1302 | { "1 day\n","1 Tag\n" }, | 1302 | { "1 day\n","1 Tag\n" }, |
1303 | { "%1 hours\n","%1 Stunden\n" }, | 1303 | { "%1 hours\n","%1 Stunden\n" }, |
1304 | { "1 hour\n","1 Stunde\n" }, | 1304 | { "1 hour\n","1 Stunde\n" }, |
1305 | { "%1 minutes\n","%1 Minuten\n" }, | 1305 | { "%1 minutes\n","%1 Minuten\n" }, |
1306 | { "1 minute\n","1 Minute\n" }, | 1306 | { "1 minute\n","1 Minute\n" }, |
1307 | { "Only one toolbar","Nur eine Toolbar" }, | 1307 | { "Only one toolbar","Nur eine Toolbar" }, |
1308 | { "Print","Drucke" }, | 1308 | { "Print","Drucke" }, |
1309 | { "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." }, | 1309 | { "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." }, |
1310 | { "There is nothing selected!","Es ist nichts ausgewählt!" }, | 1310 | { "There is nothing selected!","Es ist nichts ausgewählt!" }, |
1311 | { "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " }, | 1311 | { "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " }, |
1312 | { "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" }, | 1312 | { "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" }, |
1313 | { "This prints the view as you see it.\n(With the complete content, of course.)\nYou may change the print layout by resizing the view.\nPrint unscaled may print several pages\ndepending on the amount of data.\nPrint scaled down will print all on one page.\nPrint scaled up/down will print all on one page,\nbut will scale up the text to page boundaries,\nif the text is smaller than the page.\nYou can select page geometry setup in the next dialog.\n","Dies druckt die Ansicht wie man sie sieht.\n(Mit dem kompletten Inhalt natürlich.)\nMan kann das Layout ändern durch ändern der Fenstergröße.\nDrucke unskaliert druckt ggf. mehrere Seiten\nabhängig von der Menge der Daten.\nDrucke runterskaliert um auf eine Seite zu passen\ndruckt alles auf eine Seite.\nDrucke hoch/runterskaliert um genau auf eine Seite zu passen\nvergrößert den Text gegebenenfalls.\nDas Seitenlayout kann im nächsten Dialog gewählt werden.\n" }, | 1313 | { "This prints the view as you see it.\n(With the complete content, of course.)\nYou may change the print layout by resizing the view.\nPrint unscaled may print several pages\ndepending on the amount of data.\nPrint scaled down will print all on one page.\nPrint scaled up/down will print all on one page,\nbut will scale up the text to page boundaries,\nif the text is smaller than the page.\nYou can select page geometry setup in the next dialog.\n","Dies druckt die Ansicht wie man sie sieht.\n(Mit dem kompletten Inhalt natürlich.)\nMan kann das Layout ändern durch ändern der Fenstergröße.\nDrucke unskaliert druckt ggf. mehrere Seiten\nabhängig von der Menge der Daten.\nDrucke runterskaliert um auf eine Seite zu passen\ndruckt alles auf eine Seite.\nDrucke hoch/runterskaliert um genau auf eine Seite zu passen\nvergrößert den Text gegebenenfalls.\nDas Seitenlayout kann im nächsten Dialog gewählt werden.\n" }, |
1314 | { "KO/Pi Printout","KO/Pi Ausdruck" }, | 1314 | { "KO/Pi Printout","KO/Pi Ausdruck" }, |
1315 | { "Print unscaled","Drucke unskaliert" }, | 1315 | { "Print unscaled","Drucke unskaliert" }, |
1316 | { "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." }, | 1316 | { "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." }, |
1317 | { "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." }, | 1317 | { "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." }, |
1318 | { "Printout Mode","Druck Modus" }, | 1318 | { "Printout Mode","Druck Modus" }, |
1319 | { "Filter menu icon","Filtermenu Icon" }, | 1319 | { "Filter menu icon","Filtermenu Icon" }, |
1320 | { "<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n","<p><b>A+(shift oder ctrl)</b>: Zeige Zeit bis zum nächsten Alarm</p>\n" }, | 1320 | { "<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n","<p><b>A+(shift oder ctrl)</b>: Zeige Zeit bis zum nächsten Alarm</p>\n" }, |
1321 | { "<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n","<p><b>N</b>: Wechsle zur nächsten Ansicht, die ein Icon in der Toolbar hat</p>\n" }, | 1321 | { "<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n","<p><b>N</b>: Wechsle zur nächsten Ansicht, die ein Icon in der Toolbar hat</p>\n" }, |
1322 | { "%1d","%1t" }, | 1322 | { "%1d","%1t" }, |
1323 | { "%1h","%1std" }, | 1323 | { "%1h","%1std" }, |
1324 | { "%1min","%1min" }, | 1324 | { "%1min","%1min" }, |
1325 | { "( %1 before )","( %1 vorher )" }, | 1325 | { "( %1 before )","( %1 vorher )" }, |
1326 | { "The next alarm is in\nless than one minute!","Der nächste Alarm kommt in\nweniger als einer Minute!" }, | 1326 | { "The next alarm is in\nless than one minute!","Der nächste Alarm kommt in\nweniger als einer Minute!" }, |
1327 | { "\nThe internal alarm notification is disabled!\n","\nDie interne Alarmbenachrichtigung ist ausgeschaltet!\n" }, | 1327 | { "\nThe internal alarm notification is disabled!\n","\nDie interne Alarmbenachrichtigung ist ausgeschaltet!\n" }, |
1328 | { "Enable it in the settings menu, TAB alarm.","Schalten Sie sie an im Menu Einstellungen, TAB Alarm." }, | 1328 | { "Enable it in the settings menu, TAB alarm.","Schalten Sie sie an im Menu Einstellungen, TAB Alarm." }, |
1329 | { "Show Sync Events","Zeige Sync-Ereignisse" }, | 1329 | { "Show Sync Events","Zeige Sync-Ereignisse" }, |
1330 | { "Use short date in WN+Event view","Zeige Kurzdatum in WN+Terminanzeige" }, | 1330 | { "Use short date in WN+Event view","Zeige Kurzdatum in WN+Terminanzeige" }, |
1331 | { "Number of max.displayed todo prios:","Anzahl max.angezeigter Todo-Prios:" }, | 1331 | { "Number of max.displayed todo prios:","Anzahl max.angezeigter Todo-Prios:" }, |
1332 | { " on "," am " }, | 1332 | { " on "," am " }, |
1333 | { "On: ","Am: " }, | 1333 | { "On: ","Am: " }, |
1334 | { "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" }, | 1334 | { "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" }, |
1335 | { "Start/Stop todo...","Starte/Stoppe Todo..." }, | 1335 | { "Start/Stop todo...","Starte/Stoppe Todo..." }, |
1336 | { "Color for running todos:","Farbe für laufende Todos:" }, | 1336 | { "Color for running todos:","Farbe für laufende Todos:" }, |
1337 | { "The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?","Das Todo\n%1\nist gestartet.\nWollen Sie es\nauf gestoppt setzen?" }, | 1337 | { "The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?","Das Todo\n%1\nist gestartet.\nWollen Sie es\nauf gestoppt setzen?" }, |
1338 | { "Todo is started","Todo ist gestartet" }, | 1338 | { "Todo is started","Todo ist gestartet" }, |
1339 | { "Stop todo","Stoppe Todo" }, | 1339 | { "Stop todo","Stoppe Todo" }, |
1340 | { "Todo is stopped","Todo ist gestoppt" }, | 1340 | { "Todo is stopped","Todo ist gestoppt" }, |
1341 | { "Start todo","Starte Todo" }, | 1341 | { "Start todo","Starte Todo" }, |
1342 | { "The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?","Das Todo\n%1\nist gestoppt.\nWollen Sie es auf\ngestartet setzen?" }, | 1342 | { "The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?","Das Todo\n%1\nist gestoppt.\nWollen Sie es auf\ngestartet setzen?" }, |
1343 | { "The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?","Das Todo\n%1\nwird geklont!\nEs hat Untertodos!\nMöchten Sie alle\nUntertodos auch klonen?" }, | 1343 | { "The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?","Das Todo\n%1\nwird geklont!\nEs hat Untertodos!\nMöchten Sie alle\nUntertodos auch klonen?" }, |
1344 | { "Todo has subtodos","Todo hat Untertodos" }, | 1344 | { "Todo has subtodos","Todo hat Untertodos" }, |
1345 | { "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" }, | 1345 | { "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" }, |
1346 | { "Colors","Farben" }, | 1346 | { "Colors","Farben" }, |
1347 | { "Click on new parent item","Klicke auf neues Übertodo" }, | 1347 | { "Click on new parent item","Klicke auf neues Übertodo" }, |
1348 | { "Reparenting aborted!","Übertodo setzen abgebrochen" }, | 1348 | { "Reparenting aborted!","Übertodo setzen abgebrochen" }, |
1349 | { "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" }, | 1349 | { "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" }, |
1350 | { "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" }, | 1350 | { "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" }, |
1351 | { "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" }, | 1351 | { "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" }, |
1352 | { "Alternating background of list views","Abwechselnder Hintergrund für Listen" }, | 1352 | { "Alternating background of list views","Abwechselnder Hintergrund für Listen" }, |
1353 | { "times","Zeiten" }, | 1353 | { "times","Zeiten" }, |
1354 | { "The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?","Das Todo\n%1\nhat Untertodos!\nMöchten Sie die Kategorien\nauch für alle Untertodos setzen?" }, | 1354 | { "The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?","Das Todo\n%1\nhat Untertodos!\nMöchten Sie die Kategorien\nauch für alle Untertodos setzen?" }, |
1355 | { "Backup enabled","Backup angeschaltet" }, | 1355 | { "Backup enabled","Backup angeschaltet" }, |
1356 | { "Use standard backup dir","Standard Backupverzeichnis" }, | 1356 | { "Use standard backup dir","Standard Backupverzeichnis" }, |
1357 | { "Number of Backups:","Anzahl der Backups" }, | 1357 | { "Number of Backups:","Anzahl der Backups" }, |
1358 | { "Make backup every ","Mache ein Backup alle " }, | 1358 | { "Make backup every ","Mache ein Backup alle " }, |
1359 | { " days"," Tage" }, | 1359 | { " days"," Tage" }, |
1360 | { "Creating backup ... please wait ...","Erzeuge Backup ... bitte warten ..." }, | 1360 | { "Creating backup ... please wait ...","Erzeuge Backup ... bitte warten ..." }, |
1361 | { "Backup Failed!","Backup Problem!" }, | 1361 | { "Backup Failed!","Backup Problem!" }, |
1362 | { "Try again now","Versuche jetzt nochmal" }, | 1362 | { "Try again now","Versuche jetzt nochmal" }, |
1363 | { "Try again later","Versuche später nochmal" }, | 1363 | { "Try again later","Versuche später nochmal" }, |
1364 | { "Try again tomorrow","Versuche morgen nochmal" }, | 1364 | { "Try again tomorrow","Versuche morgen nochmal" }, |
1365 | { "Disable backup","Schalte Backup ab" }, | 1365 | { "Disable backup","Schalte Backup ab" }, |
1366 | { "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" }, | 1366 | { "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" }, |
1367 | { "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" }, | 1367 | { "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" }, |
1368 | { "Choose action","Wähle Aktion" }, | 1368 | { "Choose action","Wähle Aktion" }, |
1369 | { "Comment for todo:","Kommentar zum Todo:" }, | 1369 | { "Comment for todo:","Kommentar zum Todo:" }, |
1370 | { "Stop+note","Stop+Notiz" }, | 1370 | { "Stop+note","Stop+Notiz" }, |
1371 | { "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" }, | 1371 | { "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" }, |
1372 | { "KO/Pi: Missing alarms!","KO/Pi: Verpasste Alarme!" }, | 1372 | { "KO/Pi: Missing alarms!","KO/Pi: Verpasste Alarme!" }, |
1373 | { "You missed the alarms for the following events or todos:","Sie verpassten die Alarme für folgende Termine oder Todos:" }, | 1373 | { "You missed the alarms for the following events or todos:","Sie verpassten die Alarme für folgende Termine oder Todos:" }, |
1374 | { "Print complete list","Drucke komplette Liste" }, | 1374 | { "Print complete list","Drucke komplette Liste" }, |
1375 | { "Hide all selected","Verstecke Selektierte" }, | 1375 | { "Hide all selected","Verstecke Selektierte" }, |
1376 | { "Add items","hinzufügen" }, | 1376 | { "Add items","hinzufügen" }, |
1377 | { "One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?","Ein (oder mehrere) ausgewähltes\nTodo hat Untertodos!\nMöchten Sie der Auswahlliste\nalle Untertodos von allen\nausgewählten Todos hinzufügen?" }, | 1377 | { "One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?","Ein (oder mehrere) ausgewähltes\nTodo hat Untertodos!\nMöchten Sie der Auswahlliste\nalle Untertodos von allen\nausgewählten Todos hinzufügen?" }, |
1378 | { "Print List View...","Drucke Listenansicht..." }, | 1378 | { "Print List View...","Drucke Listenansicht..." }, |
1379 | { "You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items.","Sie können die <b>Listenansicht</b> und die Listenansicht im <b>Suchdialog</b> ausdrucken! Um das zu machen gehen Sie bitte zur <b>Listenansicht</b> oder zum <b>Suchdialog</b>. Rechtsklicken Sie auf die Liste. Wählen Sie im Popupmenu den Eintrag <b>Drucke komplette Liste</b>. Das druckt die Liste so, wie man sie sieht. Sie können Listeneinträge entfernen ohne die korrespondierenden Ereignisse/Todos zu löschen! Selektieren sie einfach alle Einträge, die sie nicht ausdrucken möchten. Dann Rechtsklicken Sie auf einen Eintrag und wählen <b>Verstecke Selektierte</b>. Danach können Sie die Liste ohne diese Einträge ausdrucken." }, | 1379 | { "You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items.","Sie können die <b>Listenansicht</b> und die Listenansicht im <b>Suchdialog</b> ausdrucken! Um das zu machen gehen Sie bitte zur <b>Listenansicht</b> oder zum <b>Suchdialog</b>. Rechtsklicken Sie auf die Liste. Wählen Sie im Popupmenu den Eintrag <b>Drucke komplette Liste</b>. Das druckt die Liste so, wie man sie sieht. Sie können Listeneinträge entfernen ohne die korrespondierenden Ereignisse/Todos zu löschen! Selektieren sie einfach alle Einträge, die sie nicht ausdrucken möchten. Dann Rechtsklicken Sie auf einen Eintrag und wählen <b>Verstecke Selektierte</b>. Danach können Sie die Liste ohne diese Einträge ausdrucken." }, |
1380 | { "Configure KO/Pi...","Konfiguriere KO/Pi..." }, | 1380 | { "Configure KO/Pi...","Konfiguriere KO/Pi..." }, |
1381 | { "Global Settings...","Globale Einstellungen..." }, | 1381 | { "Global Settings...","Globale Einstellungen..." }, |
1382 | { "<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n","<p><b>R</b>: Zeige Resource Ansicht | <b>F</b>: Editiere Filter </p>\n" }, | 1382 | { "<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n","<p><b>R</b>: Zeige Resource Ansicht | <b>F</b>: Editiere Filter </p>\n" }, |
1383 | { "","" }, | 1383 | { "(disabled)","(abgeschaltet)" }, |
1384 | { "","" }, | 1384 | { "","" }, |
1385 | { "","" }, | 1385 | { "","" }, |
1386 | { "","" }, | 1386 | { "","" }, |
1387 | { "","" }, | 1387 | { "","" }, |
1388 | { "","" }, | 1388 | { "","" }, |
1389 | { "","" }, | 1389 | { "","" }, |
1390 | { "","" }, \ No newline at end of file | 1390 | { "","" }, \ No newline at end of file |
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 07ec459..6e60c56 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1,4480 +1,4488 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Requires the Qt and KDE widget libraries, available at no cost at | 4 | Requires the Qt and KDE widget libraries, available at no cost at |
5 | http://www.troll.no and http://www.kde.org respectively | 5 | http://www.troll.no and http://www.kde.org respectively |
6 | 6 | ||
7 | Copyright (c) 1997, 1998, 1999 | 7 | Copyright (c) 1997, 1998, 1999 |
8 | Preston Brown (preton.brown@yale.edu) | 8 | Preston Brown (preton.brown@yale.edu) |
9 | Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl) | 9 | Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl) |
10 | Ian Dawes (iadawes@globalserve.net) | 10 | Ian Dawes (iadawes@globalserve.net) |
11 | Laszlo Boloni (boloni@cs.purdue.edu) | 11 | Laszlo Boloni (boloni@cs.purdue.edu) |
12 | 12 | ||
13 | Copyright (c) 2000, 2001, 2002 | 13 | Copyright (c) 2000, 2001, 2002 |
14 | Cornelius Schumacher <schumacher@kde.org> | 14 | Cornelius Schumacher <schumacher@kde.org> |
15 | 15 | ||
16 | This program is free software; you can redistribute it and/or modify | 16 | This program is free software; you can redistribute it and/or modify |
17 | it under the terms of the GNU General Public License as published by | 17 | it under the terms of the GNU General Public License as published by |
18 | the Free Software Foundation; either version 2 of the License, or | 18 | the Free Software Foundation; either version 2 of the License, or |
19 | (at your option) any later version. | 19 | (at your option) any later version. |
20 | 20 | ||
21 | This program is distributed in the hope that it will be useful, | 21 | This program is distributed in the hope that it will be useful, |
22 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 22 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
24 | GNU General Public License for more details. | 24 | GNU General Public License for more details. |
25 | 25 | ||
26 | You should have received a copy of the GNU General Public License | 26 | You should have received a copy of the GNU General Public License |
27 | along with this program; if not, write to the Free Software | 27 | along with this program; if not, write to the Free Software |
28 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 28 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | 32 | ||
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #include <qradiobutton.h> | 34 | #include <qradiobutton.h> |
35 | #include <qbuttongroup.h> | 35 | #include <qbuttongroup.h> |
36 | #include <qlayout.h> | 36 | #include <qlayout.h> |
37 | #include <qclipboard.h> | 37 | #include <qclipboard.h> |
38 | #include <qcursor.h> | 38 | #include <qcursor.h> |
39 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
40 | #include <qprogressbar.h> | 40 | #include <qprogressbar.h> |
41 | #include <qmultilineedit.h> | 41 | #include <qmultilineedit.h> |
42 | #include <qtimer.h> | 42 | #include <qtimer.h> |
43 | #include <qwidgetstack.h> | 43 | #include <qwidgetstack.h> |
44 | #include <qptrlist.h> | 44 | #include <qptrlist.h> |
45 | #include <qregexp.h> | 45 | #include <qregexp.h> |
46 | #include <qgroupbox.h> | 46 | #include <qgroupbox.h> |
47 | #include <qfile.h> | 47 | #include <qfile.h> |
48 | #include <qdir.h> | 48 | #include <qdir.h> |
49 | #ifndef KORG_NOSPLITTER | 49 | #ifndef KORG_NOSPLITTER |
50 | #include <qsplitter.h> | 50 | #include <qsplitter.h> |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #include <kglobal.h> | 53 | #include <kglobal.h> |
54 | #include <kdebug.h> | 54 | #include <kdebug.h> |
55 | #include <kstandarddirs.h> | 55 | #include <kstandarddirs.h> |
56 | #include <kfiledialog.h> | 56 | #include <kfiledialog.h> |
57 | #include <kmessagebox.h> | 57 | #include <kmessagebox.h> |
58 | #include <knotifyclient.h> | 58 | #include <knotifyclient.h> |
59 | #include <kconfig.h> | 59 | #include <kconfig.h> |
60 | 60 | ||
61 | #include <libkdepim/ksyncprefsdialog.h> | 61 | #include <libkdepim/ksyncprefsdialog.h> |
62 | #include <krun.h> | 62 | #include <krun.h> |
63 | #include <kdirwatch.h> | 63 | #include <kdirwatch.h> |
64 | #include <libkdepim/kdatepicker.h> | 64 | #include <libkdepim/kdatepicker.h> |
65 | #include <libkdepim/ksyncprofile.h> | 65 | #include <libkdepim/ksyncprofile.h> |
66 | #include <libkdepim/kpimglobalprefs.h> | 66 | #include <libkdepim/kpimglobalprefs.h> |
67 | 67 | ||
68 | #include <libkcal/vcaldrag.h> | 68 | #include <libkcal/vcaldrag.h> |
69 | #include <libkcal/icaldrag.h> | 69 | #include <libkcal/icaldrag.h> |
70 | #include <libkcal/icalformat.h> | 70 | #include <libkcal/icalformat.h> |
71 | #include <libkcal/vcalformat.h> | 71 | #include <libkcal/vcalformat.h> |
72 | #include <libkcal/scheduler.h> | 72 | #include <libkcal/scheduler.h> |
73 | #include <libkcal/calendarlocal.h> | 73 | #include <libkcal/calendarlocal.h> |
74 | #include <libkcal/journal.h> | 74 | #include <libkcal/journal.h> |
75 | #include <libkcal/calfilter.h> | 75 | #include <libkcal/calfilter.h> |
76 | #include <libkcal/attendee.h> | 76 | #include <libkcal/attendee.h> |
77 | #include <libkcal/dndfactory.h> | 77 | #include <libkcal/dndfactory.h> |
78 | #include <libkcal/freebusy.h> | 78 | #include <libkcal/freebusy.h> |
79 | #include <libkcal/filestorage.h> | 79 | #include <libkcal/filestorage.h> |
80 | #include <libkcal/calendarresources.h> | 80 | #include <libkcal/calendarresources.h> |
81 | #include <libkcal/qtopiaformat.h> | 81 | #include <libkcal/qtopiaformat.h> |
82 | #include "../kalarmd/alarmdialog.h" | 82 | #include "../kalarmd/alarmdialog.h" |
83 | 83 | ||
84 | #ifndef DESKTOP_VERSION | 84 | #ifndef DESKTOP_VERSION |
85 | #include <libkcal/sharpformat.h> | 85 | #include <libkcal/sharpformat.h> |
86 | #include <externalapphandler.h> | 86 | #include <externalapphandler.h> |
87 | #endif | 87 | #endif |
88 | #include <libkcal/phoneformat.h> | 88 | #include <libkcal/phoneformat.h> |
89 | #ifndef KORG_NOMAIL | 89 | #ifndef KORG_NOMAIL |
90 | #include "komailclient.h" | 90 | #include "komailclient.h" |
91 | #endif | 91 | #endif |
92 | #ifndef KORG_NOPRINTER | 92 | #ifndef KORG_NOPRINTER |
93 | #include "calprinter.h" | 93 | #include "calprinter.h" |
94 | #endif | 94 | #endif |
95 | #ifndef KORG_NOPLUGINS | 95 | #ifndef KORG_NOPLUGINS |
96 | #include "kocore.h" | 96 | #include "kocore.h" |
97 | #endif | 97 | #endif |
98 | #include "koeventeditor.h" | 98 | #include "koeventeditor.h" |
99 | #include "kotodoeditor.h" | 99 | #include "kotodoeditor.h" |
100 | #include "koprefs.h" | 100 | #include "koprefs.h" |
101 | #include "koeventviewerdialog.h" | 101 | #include "koeventviewerdialog.h" |
102 | #include "publishdialog.h" | 102 | #include "publishdialog.h" |
103 | #include "kofilterview.h" | 103 | #include "kofilterview.h" |
104 | #include "koglobals.h" | 104 | #include "koglobals.h" |
105 | #include "koviewmanager.h" | 105 | #include "koviewmanager.h" |
106 | #include "koagendaview.h" | 106 | #include "koagendaview.h" |
107 | #include "kodialogmanager.h" | 107 | #include "kodialogmanager.h" |
108 | #include "outgoingdialog.h" | 108 | #include "outgoingdialog.h" |
109 | #include "incomingdialog.h" | 109 | #include "incomingdialog.h" |
110 | #include "datenavigatorcontainer.h" | 110 | #include "datenavigatorcontainer.h" |
111 | #include "statusdialog.h" | 111 | #include "statusdialog.h" |
112 | #include "kdatenavigator.h" | 112 | #include "kdatenavigator.h" |
113 | #include "kotodoview.h" | 113 | #include "kotodoview.h" |
114 | #include "datenavigator.h" | 114 | #include "datenavigator.h" |
115 | #include "resourceview.h" | 115 | #include "resourceview.h" |
116 | #include "navigatorbar.h" | 116 | #include "navigatorbar.h" |
117 | #include "searchdialog.h" | 117 | #include "searchdialog.h" |
118 | #include "mainwindow.h" | 118 | #include "mainwindow.h" |
119 | 119 | ||
120 | #include "calendarview.h" | 120 | #include "calendarview.h" |
121 | #ifndef DESKTOP_VERSION | 121 | #ifndef DESKTOP_VERSION |
122 | #include <qtopia/alarmserver.h> | 122 | #include <qtopia/alarmserver.h> |
123 | #endif | 123 | #endif |
124 | #ifndef _WIN32_ | 124 | #ifndef _WIN32_ |
125 | #include <stdlib.h> | 125 | #include <stdlib.h> |
126 | #include <stdio.h> | 126 | #include <stdio.h> |
127 | #include <unistd.h> | 127 | #include <unistd.h> |
128 | #else | 128 | #else |
129 | #include <qprocess.h> | 129 | #include <qprocess.h> |
130 | #endif | 130 | #endif |
131 | 131 | ||
132 | #ifdef DESKTOP_VERSION | 132 | #ifdef DESKTOP_VERSION |
133 | #include <kabc/stdaddressbook.h> | 133 | #include <kabc/stdaddressbook.h> |
134 | #endif | 134 | #endif |
135 | using namespace KOrg; | 135 | using namespace KOrg; |
136 | using namespace KCal; | 136 | using namespace KCal; |
137 | extern int globalFlagBlockAgenda; | 137 | extern int globalFlagBlockAgenda; |
138 | extern int globalFlagBlockStartup; | 138 | extern int globalFlagBlockStartup; |
139 | 139 | ||
140 | 140 | ||
141 | MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent) | 141 | MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent) |
142 | 142 | ||
143 | { | 143 | { |
144 | mAlarms = alarms; | 144 | mAlarms = alarms; |
145 | viewport()->setBackgroundColor( QColor( 255, 255, 255 ) ); | 145 | viewport()->setBackgroundColor( QColor( 255, 255, 255 ) ); |
146 | QString mText = "<table width=\"100%\">\n"; | 146 | QString mText = "<table width=\"100%\">\n"; |
147 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; | 147 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; |
148 | #ifdef DESKTOP_VERSION | 148 | #ifdef DESKTOP_VERSION |
149 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; | 149 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; |
150 | #else | 150 | #else |
151 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>"; | 151 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>"; |
152 | #endif | 152 | #endif |
153 | // mText += "<img src=\""; | 153 | // mText += "<img src=\""; |
154 | // mText += ipath; | 154 | // mText += ipath; |
155 | // mText += "\">"; | 155 | // mText += "\">"; |
156 | //mEventDate = QDate::currentDate(); | 156 | //mEventDate = QDate::currentDate(); |
157 | #ifdef DESKTOP_VERSION | 157 | #ifdef DESKTOP_VERSION |
158 | mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>"; | 158 | mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>"; |
159 | #else | 159 | #else |
160 | mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>"; | 160 | mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>"; |
161 | #endif | 161 | #endif |
162 | //mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; | 162 | //mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; |
163 | 163 | ||
164 | Incidence * inc = getNextInc( start ); | 164 | Incidence * inc = getNextInc( start ); |
165 | int time = 0; | 165 | int time = 0; |
166 | //mText += "<table>"; | 166 | //mText += "<table>"; |
167 | while ( inc ) { | 167 | while ( inc ) { |
168 | QDateTime dt ; | 168 | QDateTime dt ; |
169 | QString tempText = "<a "; | 169 | QString tempText = "<a "; |
170 | bool ok; | 170 | bool ok; |
171 | dt = inc->getNextOccurence( start, &ok ); | 171 | dt = inc->getNextOccurence( start, &ok ); |
172 | if ( !ok ) continue; | 172 | if ( !ok ) continue; |
173 | if ( inc->typeID() == eventID ) { | 173 | if ( inc->typeID() == eventID ) { |
174 | tempText += "href=\"event:"; | 174 | tempText += "href=\"event:"; |
175 | } else if ( inc->typeID() == todoID ) { | 175 | } else if ( inc->typeID() == todoID ) { |
176 | tempText += "href=\"todo:"; | 176 | tempText += "href=\"todo:"; |
177 | } | 177 | } |
178 | tempText += inc->uid() + "\">"; | 178 | tempText += inc->uid() + "\">"; |
179 | if ( inc->typeID() == todoID ) | 179 | if ( inc->typeID() == todoID ) |
180 | tempText += i18n("Todo: "); | 180 | tempText += i18n("Todo: "); |
181 | if ( inc->summary().length() > 0 ) | 181 | if ( inc->summary().length() > 0 ) |
182 | tempText += inc->summary(); | 182 | tempText += inc->summary(); |
183 | else | 183 | else |
184 | tempText += i18n("-no summary-"); | 184 | tempText += i18n("-no summary-"); |
185 | QString timestr; | 185 | QString timestr; |
186 | if (!inc->doesFloat()) | 186 | if (!inc->doesFloat()) |
187 | timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": "; | 187 | timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": "; |
188 | else | 188 | else |
189 | timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 189 | timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
190 | if ( dt.date() < QDate::currentDate() && time == 0 ) { | 190 | if ( dt.date() < QDate::currentDate() && time == 0 ) { |
191 | mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; | 191 | mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; |
192 | mText += "<table>"; | 192 | mText += "<table>"; |
193 | time = 1; | 193 | time = 1; |
194 | } | 194 | } |
195 | if ( dt.date() == QDate::currentDate() && time <= 1 ) { | 195 | if ( dt.date() == QDate::currentDate() && time <= 1 ) { |
196 | if ( time > 0 ) | 196 | if ( time > 0 ) |
197 | mText +="</table>"; | 197 | mText +="</table>"; |
198 | mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>"; | 198 | mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>"; |
199 | mText += "<table>"; | 199 | mText += "<table>"; |
200 | time = 2; | 200 | time = 2; |
201 | 201 | ||
202 | } | 202 | } |
203 | if ( dt.date() > QDate::currentDate() && time <= 2 ) { | 203 | if ( dt.date() > QDate::currentDate() && time <= 2 ) { |
204 | if ( time > 0 ) | 204 | if ( time > 0 ) |
205 | mText +="</table>"; | 205 | mText +="</table>"; |
206 | mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>"; | 206 | mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>"; |
207 | mText += "<table>"; | 207 | mText += "<table>"; |
208 | time = 3; | 208 | time = 3; |
209 | } | 209 | } |
210 | mText +="<tr><td><b>"; | 210 | mText +="<tr><td><b>"; |
211 | mText += timestr; | 211 | mText += timestr; |
212 | mText += "</b></td><td>"; | 212 | mText += "</b></td><td>"; |
213 | mText += tempText; | 213 | mText += tempText; |
214 | mText += "</td></tr>\n"; | 214 | mText += "</td></tr>\n"; |
215 | inc = getNextInc( start ); | 215 | inc = getNextInc( start ); |
216 | } | 216 | } |
217 | mText +="</table>"; | 217 | mText +="</table>"; |
218 | setText( mText ); | 218 | setText( mText ); |
219 | } | 219 | } |
220 | 220 | ||
221 | MissedAlarmTextBrowser::~MissedAlarmTextBrowser() | 221 | MissedAlarmTextBrowser::~MissedAlarmTextBrowser() |
222 | { | 222 | { |
223 | //qDebug("delete MissedAlarmTextBrowser::~MissedAlarmTextBrowser() "); | 223 | //qDebug("delete MissedAlarmTextBrowser::~MissedAlarmTextBrowser() "); |
224 | } | 224 | } |
225 | Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start ) | 225 | Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start ) |
226 | { | 226 | { |
227 | QDateTime dt ; | 227 | QDateTime dt ; |
228 | Incidence * retInc; | 228 | Incidence * retInc; |
229 | Incidence * inc = mAlarms.first(); | 229 | Incidence * inc = mAlarms.first(); |
230 | if ( inc == 0 ) | 230 | if ( inc == 0 ) |
231 | return 0; | 231 | return 0; |
232 | bool ok; | 232 | bool ok; |
233 | dt = inc->getNextOccurence( start, &ok ); | 233 | dt = inc->getNextOccurence( start, &ok ); |
234 | if ( ! ok ) return 0; | 234 | if ( ! ok ) return 0; |
235 | QDateTime dtn ; | 235 | QDateTime dtn ; |
236 | retInc = inc; | 236 | retInc = inc; |
237 | inc = mAlarms.next(); | 237 | inc = mAlarms.next(); |
238 | while ( inc ) { | 238 | while ( inc ) { |
239 | dtn = inc->getNextOccurence( start, &ok ); | 239 | dtn = inc->getNextOccurence( start, &ok ); |
240 | if ( ! ok ) return 0; | 240 | if ( ! ok ) return 0; |
241 | if ( dtn < dt ) { | 241 | if ( dtn < dt ) { |
242 | dt = dtn; | 242 | dt = dtn; |
243 | retInc = inc; | 243 | retInc = inc; |
244 | } | 244 | } |
245 | inc = mAlarms.next(); | 245 | inc = mAlarms.next(); |
246 | } | 246 | } |
247 | mAlarms.remove( retInc ); | 247 | mAlarms.remove( retInc ); |
248 | return retInc; | 248 | return retInc; |
249 | 249 | ||
250 | } | 250 | } |
251 | void MissedAlarmTextBrowser::setSource(const QString & n) | 251 | void MissedAlarmTextBrowser::setSource(const QString & n) |
252 | { | 252 | { |
253 | if (n.startsWith("event:")) { | 253 | if (n.startsWith("event:")) { |
254 | #ifdef DESKTOP_VERSION | 254 | #ifdef DESKTOP_VERSION |
255 | emit showIncidence(n.mid(8)); | 255 | emit showIncidence(n.mid(8)); |
256 | #else | 256 | #else |
257 | emit showIncidence(n.mid(6)); | 257 | emit showIncidence(n.mid(6)); |
258 | #endif | 258 | #endif |
259 | return; | 259 | return; |
260 | } else if (n.startsWith("todo:")) { | 260 | } else if (n.startsWith("todo:")) { |
261 | #ifdef DESKTOP_VERSION | 261 | #ifdef DESKTOP_VERSION |
262 | emit showIncidence(n.mid(7)); | 262 | emit showIncidence(n.mid(7)); |
263 | #else | 263 | #else |
264 | emit showIncidence(n.mid(5)); | 264 | emit showIncidence(n.mid(5)); |
265 | #endif | 265 | #endif |
266 | return; | 266 | return; |
267 | } | 267 | } |
268 | } | 268 | } |
269 | 269 | ||
270 | 270 | ||
271 | class KOBeamPrefs : public QDialog | 271 | class KOBeamPrefs : public QDialog |
272 | { | 272 | { |
273 | public: | 273 | public: |
274 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : | 274 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : |
275 | QDialog( parent, name, true ) | 275 | QDialog( parent, name, true ) |
276 | { | 276 | { |
277 | setCaption( i18n("Beam Options") ); | 277 | setCaption( i18n("Beam Options") ); |
278 | QVBoxLayout* lay = new QVBoxLayout( this ); | 278 | QVBoxLayout* lay = new QVBoxLayout( this ); |
279 | lay->setSpacing( 3 ); | 279 | lay->setSpacing( 3 ); |
280 | lay->setMargin( 3 ); | 280 | lay->setMargin( 3 ); |
281 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); | 281 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); |
282 | lay->addWidget( format ); | 282 | lay->addWidget( format ); |
283 | format->setExclusive ( true ) ; | 283 | format->setExclusive ( true ) ; |
284 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); | 284 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); |
285 | lay->addWidget( time ); time->setExclusive ( true ) ; | 285 | lay->addWidget( time ); time->setExclusive ( true ) ; |
286 | vcal = new QRadioButton(" vCalendar ", format ); | 286 | vcal = new QRadioButton(" vCalendar ", format ); |
287 | ical = new QRadioButton(" iCalendar ", format ); | 287 | ical = new QRadioButton(" iCalendar ", format ); |
288 | vcal->setChecked( true ); | 288 | vcal->setChecked( true ); |
289 | tz = new QRadioButton(i18n(" With timezone "), time ); | 289 | tz = new QRadioButton(i18n(" With timezone "), time ); |
290 | local = new QRadioButton(i18n(" Local time "), time ); | 290 | local = new QRadioButton(i18n(" Local time "), time ); |
291 | tz->setChecked( true ); | 291 | tz->setChecked( true ); |
292 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); | 292 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); |
293 | lay->addWidget( ok ); | 293 | lay->addWidget( ok ); |
294 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 294 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
295 | lay->addWidget( cancel ); | 295 | lay->addWidget( cancel ); |
296 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 296 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
297 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 297 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
298 | resize( 200, 200 ); | 298 | resize( 200, 200 ); |
299 | } | 299 | } |
300 | 300 | ||
301 | bool beamVcal() { return vcal->isChecked(); } | 301 | bool beamVcal() { return vcal->isChecked(); } |
302 | bool beamLocal() { return local->isChecked(); } | 302 | bool beamLocal() { return local->isChecked(); } |
303 | private: | 303 | private: |
304 | QRadioButton* vcal, *ical, *local, *tz; | 304 | QRadioButton* vcal, *ical, *local, *tz; |
305 | }; | 305 | }; |
306 | class KOCatPrefs : public QDialog | 306 | class KOCatPrefs : public QDialog |
307 | { | 307 | { |
308 | public: | 308 | public: |
309 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : | 309 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : |
310 | QDialog( parent, name, true ) | 310 | QDialog( parent, name, true ) |
311 | { | 311 | { |
312 | setCaption( i18n("Manage new Categories") ); | 312 | setCaption( i18n("Manage new Categories") ); |
313 | QVBoxLayout* lay = new QVBoxLayout( this ); | 313 | QVBoxLayout* lay = new QVBoxLayout( this ); |
314 | lay->setSpacing( 3 ); | 314 | lay->setSpacing( 3 ); |
315 | lay->setMargin( 3 ); | 315 | lay->setMargin( 3 ); |
316 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); | 316 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); |
317 | lay->addWidget( lab ); | 317 | lay->addWidget( lab ); |
318 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 318 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
319 | lay->addWidget( format ); | 319 | lay->addWidget( format ); |
320 | format->setExclusive ( true ) ; | 320 | format->setExclusive ( true ) ; |
321 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 321 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
322 | new QRadioButton(i18n("Remove from Events/Todos"), format ); | 322 | new QRadioButton(i18n("Remove from Events/Todos"), format ); |
323 | addCatBut->setChecked( true ); | 323 | addCatBut->setChecked( true ); |
324 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 324 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
325 | lay->addWidget( ok ); | 325 | lay->addWidget( ok ); |
326 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 326 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
327 | lay->addWidget( cancel ); | 327 | lay->addWidget( cancel ); |
328 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 328 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
329 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 329 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
330 | resize( 200, 200 ); | 330 | resize( 200, 200 ); |
331 | } | 331 | } |
332 | 332 | ||
333 | bool addCat() { return addCatBut->isChecked(); } | 333 | bool addCat() { return addCatBut->isChecked(); } |
334 | private: | 334 | private: |
335 | QRadioButton* addCatBut; | 335 | QRadioButton* addCatBut; |
336 | }; | 336 | }; |
337 | 337 | ||
338 | 338 | ||
339 | 339 | ||
340 | CalendarView::CalendarView( CalendarResources *calendar, | 340 | CalendarView::CalendarView( CalendarResources *calendar, |
341 | QWidget *parent, const char *name ) | 341 | QWidget *parent, const char *name ) |
342 | : CalendarViewBase( parent, name ), | 342 | : CalendarViewBase( parent, name ), |
343 | mCalendar( calendar ), | 343 | mCalendar( calendar ), |
344 | mResourceManager( calendar->resourceManager() ) | 344 | mResourceManager( calendar->resourceManager() ) |
345 | { | 345 | { |
346 | 346 | ||
347 | mEventEditor = 0; | 347 | mEventEditor = 0; |
348 | mTodoEditor = 0; | 348 | mTodoEditor = 0; |
349 | 349 | ||
350 | init(); | 350 | init(); |
351 | } | 351 | } |
352 | 352 | ||
353 | CalendarView::CalendarView( Calendar *calendar, | 353 | CalendarView::CalendarView( Calendar *calendar, |
354 | QWidget *parent, const char *name ) | 354 | QWidget *parent, const char *name ) |
355 | : CalendarViewBase( parent, name ), | 355 | : CalendarViewBase( parent, name ), |
356 | mCalendar( calendar ), | 356 | mCalendar( calendar ), |
357 | mResourceManager( 0 ) | 357 | mResourceManager( 0 ) |
358 | { | 358 | { |
359 | 359 | ||
360 | mEventEditor = 0; | 360 | mEventEditor = 0; |
361 | mTodoEditor = 0; | 361 | mTodoEditor = 0; |
362 | init(); | 362 | init(); |
363 | } | 363 | } |
364 | 364 | ||
365 | void CalendarView::init() | 365 | void CalendarView::init() |
366 | { | 366 | { |
367 | mNextAlarmDateTime = QDateTime::currentDateTime(); | 367 | mNextAlarmDateTime = QDateTime::currentDateTime(); |
368 | setFocusPolicy ( NoFocus ); | 368 | setFocusPolicy ( NoFocus ); |
369 | mViewerCallerIsSearchDialog = false; | 369 | mViewerCallerIsSearchDialog = false; |
370 | mBlockShowDates = false; | 370 | mBlockShowDates = false; |
371 | beamDialog = new KOBeamPrefs(); | 371 | beamDialog = new KOBeamPrefs(); |
372 | mDatePickerMode = 0; | 372 | mDatePickerMode = 0; |
373 | mCurrentSyncDevice = ""; | 373 | mCurrentSyncDevice = ""; |
374 | writeLocale(); | 374 | writeLocale(); |
375 | mViewManager = new KOViewManager( this ); | 375 | mViewManager = new KOViewManager( this ); |
376 | mDialogManager = new KODialogManager( this ); | 376 | mDialogManager = new KODialogManager( this ); |
377 | mEventViewerDialog = 0; | 377 | mEventViewerDialog = 0; |
378 | mModified = false; | 378 | mModified = false; |
379 | mReadOnly = false; | 379 | mReadOnly = false; |
380 | mSelectedIncidence = 0; | 380 | mSelectedIncidence = 0; |
381 | mCalPrinter = 0; | 381 | mCalPrinter = 0; |
382 | mFilters.setAutoDelete(true); | 382 | mFilters.setAutoDelete(true); |
383 | 383 | ||
384 | mCalendar->registerObserver( this ); | 384 | mCalendar->registerObserver( this ); |
385 | // TODO: Make sure that view is updated, when calendar is changed. | 385 | // TODO: Make sure that view is updated, when calendar is changed. |
386 | 386 | ||
387 | mStorage = new FileStorage( mCalendar ); | 387 | mStorage = new FileStorage( mCalendar ); |
388 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 388 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
389 | 389 | ||
390 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 390 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
391 | #ifndef KORG_NOSPLITTER | 391 | #ifndef KORG_NOSPLITTER |
392 | // create the main layout frames. | 392 | // create the main layout frames. |
393 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 393 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
394 | topLayout->addWidget(mPanner); | 394 | topLayout->addWidget(mPanner); |
395 | 395 | ||
396 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 396 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
397 | "CalendarView::LeftFrame"); | 397 | "CalendarView::LeftFrame"); |
398 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 398 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
399 | 399 | ||
400 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, | 400 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, |
401 | "CalendarView::DateNavigator" ); | 401 | "CalendarView::DateNavigator" ); |
402 | 402 | ||
403 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 403 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
404 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 404 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
405 | mTodoList->setNavigator( mNavigator ); | 405 | mTodoList->setNavigator( mNavigator ); |
406 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 406 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
407 | 407 | ||
408 | #ifdef KORG_NORESOURCEVIEW | 408 | #ifdef KORG_NORESOURCEVIEW |
409 | mResourceView = 0; | 409 | mResourceView = 0; |
410 | #else | 410 | #else |
411 | if ( mResourceManager ) { | 411 | if ( mResourceManager ) { |
412 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 412 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
413 | mResourceView->updateView(); | 413 | mResourceView->updateView(); |
414 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 414 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
415 | SLOT( updateView() ) ); | 415 | SLOT( updateView() ) ); |
416 | } else { | 416 | } else { |
417 | mResourceView = 0; | 417 | mResourceView = 0; |
418 | } | 418 | } |
419 | #endif | 419 | #endif |
420 | QWidget *rightBox = new QWidget( mPanner ); | 420 | QWidget *rightBox = new QWidget( mPanner ); |
421 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 421 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
422 | 422 | ||
423 | mRightFrame = new QWidgetStack( rightBox ); | 423 | mRightFrame = new QWidgetStack( rightBox ); |
424 | rightLayout->addWidget( mRightFrame, 1 ); | 424 | rightLayout->addWidget( mRightFrame, 1 ); |
425 | 425 | ||
426 | mLeftFrame = mLeftSplitter; | 426 | mLeftFrame = mLeftSplitter; |
427 | #else | 427 | #else |
428 | //QWidget *mainBox = new QWidget( this ); | 428 | //QWidget *mainBox = new QWidget( this ); |
429 | //QWidget *leftFrame = new QWidget( mainBox ); | 429 | //QWidget *leftFrame = new QWidget( mainBox ); |
430 | //QBoxLayout * mainBoxLayout; | 430 | //QBoxLayout * mainBoxLayout; |
431 | if ( KOPrefs::instance()->mVerticalScreen ) { | 431 | if ( KOPrefs::instance()->mVerticalScreen ) { |
432 | //mainBoxLayout = new QVBoxLayout(mainBox); | 432 | //mainBoxLayout = new QVBoxLayout(mainBox); |
433 | //leftFrameLayout = new QHBoxLayout(leftFrame ); | 433 | //leftFrameLayout = new QHBoxLayout(leftFrame ); |
434 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); | 434 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); |
435 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 435 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
436 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; | 436 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; |
437 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 437 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
438 | } else { | 438 | } else { |
439 | //mainBoxLayout = new QHBoxLayout(mainBox); | 439 | //mainBoxLayout = new QHBoxLayout(mainBox); |
440 | //leftFrameLayout = new QVBoxLayout(leftFrame ); | 440 | //leftFrameLayout = new QVBoxLayout(leftFrame ); |
441 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 441 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
442 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); | 442 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); |
443 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); | 443 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); |
444 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 444 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
445 | } | 445 | } |
446 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); | 446 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); |
447 | //QBoxLayout * leftFrameLayout; | 447 | //QBoxLayout * leftFrameLayout; |
448 | topLayout->addWidget( mMainFrame ); | 448 | topLayout->addWidget( mMainFrame ); |
449 | //mainBoxLayout->addWidget (mLeftFrame); | 449 | //mainBoxLayout->addWidget (mLeftFrame); |
450 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, | 450 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, |
451 | "CalendarView::DateNavigator" ); | 451 | "CalendarView::DateNavigator" ); |
452 | #if 0 | 452 | #if 0 |
453 | // FIXME | 453 | // FIXME |
454 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, | 454 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, |
455 | "CalendarView::DateNavigator", QDate::currentDate()); | 455 | "CalendarView::DateNavigator", QDate::currentDate()); |
456 | #endif | 456 | #endif |
457 | // mDateNavigator->blockSignals( true ); | 457 | // mDateNavigator->blockSignals( true ); |
458 | //leftFrameLayout->addWidget( mDateNavigator ); | 458 | //leftFrameLayout->addWidget( mDateNavigator ); |
459 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); | 459 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); |
460 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); | 460 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); |
461 | mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); | 461 | mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); |
462 | connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); | 462 | connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); |
463 | connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); | 463 | connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); |
464 | connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) ); | 464 | connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) ); |
465 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); | 465 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); |
466 | connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); | ||
467 | connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); | ||
468 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); | ||
466 | mTodoList->setNavigator( mNavigator ); | 469 | mTodoList->setNavigator( mNavigator ); |
467 | #if 0 | 470 | #if 0 |
468 | if ( QApplication::desktop()->width() < 480 ) { | 471 | if ( QApplication::desktop()->width() < 480 ) { |
469 | leftFrameLayout->addWidget(mFilterView); | 472 | leftFrameLayout->addWidget(mFilterView); |
470 | leftFrameLayout->addWidget(mTodoList, 2 ); | 473 | leftFrameLayout->addWidget(mTodoList, 2 ); |
471 | 474 | ||
472 | } else { | 475 | } else { |
473 | leftFrameLayout->addWidget(mTodoList,2 ); | 476 | leftFrameLayout->addWidget(mTodoList,2 ); |
474 | leftFrameLayout->addWidget(mFilterView ); | 477 | leftFrameLayout->addWidget(mFilterView ); |
475 | } | 478 | } |
476 | #endif | 479 | #endif |
477 | mFilterView->hide(); | 480 | mFilterView->hide(); |
478 | mCalEditView->hide(); | 481 | mCalEditView->hide(); |
479 | QWidget *rightBox = new QWidget( mMainFrame ); | 482 | QWidget *rightBox = new QWidget( mMainFrame ); |
480 | //mainBoxLayout->addWidget ( rightBox, 10 ); | 483 | //mainBoxLayout->addWidget ( rightBox, 10 ); |
481 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 484 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
482 | mRightFrame = new QWidgetStack( rightBox ); | 485 | mRightFrame = new QWidgetStack( rightBox ); |
483 | rightLayout->addWidget( mRightFrame, 10 ); | 486 | rightLayout->addWidget( mRightFrame, 10 ); |
484 | 487 | ||
485 | //mLeftFrame = (QWidget *)leftFrame; | 488 | //mLeftFrame = (QWidget *)leftFrame; |
486 | if ( KOPrefs::instance()->mVerticalScreen ) { | 489 | if ( KOPrefs::instance()->mVerticalScreen ) { |
487 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); | 490 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); |
488 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); | 491 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); |
489 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 492 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
490 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 493 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
491 | } else { | 494 | } else { |
492 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); | 495 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); |
493 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 496 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
494 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 497 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
495 | } | 498 | } |
496 | if ( !KOPrefs::instance()->mShowDateNavigator) | 499 | if ( !KOPrefs::instance()->mShowDateNavigator) |
497 | mDateNavigator->hide(); | 500 | mDateNavigator->hide(); |
498 | //qDebug("Calendarview Size %d %d ", width(), height()); | 501 | //qDebug("Calendarview Size %d %d ", width(), height()); |
499 | #endif | 502 | #endif |
500 | 503 | ||
501 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 504 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
502 | SLOT( showDates( const KCal::DateList & ) ) ); | 505 | SLOT( showDates( const KCal::DateList & ) ) ); |
503 | 506 | ||
504 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 507 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
505 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 508 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
506 | 509 | ||
507 | 510 | ||
508 | 511 | ||
509 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), | 512 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), |
510 | mViewManager, SLOT( showMonth( const QDate & ) ) ); | 513 | mViewManager, SLOT( showMonth( const QDate & ) ) ); |
511 | 514 | ||
512 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 515 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
513 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 516 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
514 | 517 | ||
515 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 518 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
516 | mNavigator, SLOT( selectPreviousYear() ) ); | 519 | mNavigator, SLOT( selectPreviousYear() ) ); |
517 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 520 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
518 | mNavigator, SLOT( selectNextYear() ) ); | 521 | mNavigator, SLOT( selectNextYear() ) ); |
519 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 522 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
520 | mNavigator, SLOT( selectPreviousMonth() ) ); | 523 | mNavigator, SLOT( selectPreviousMonth() ) ); |
521 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 524 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
522 | mNavigator, SLOT( selectNextMonth() ) ); | 525 | mNavigator, SLOT( selectNextMonth() ) ); |
523 | 526 | ||
524 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 527 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
525 | mNavigator, SLOT( selectPrevious() ) ); | 528 | mNavigator, SLOT( selectPrevious() ) ); |
526 | connect( mDateNavigator, SIGNAL( goNext() ), | 529 | connect( mDateNavigator, SIGNAL( goNext() ), |
527 | mNavigator, SLOT( selectNext() ) ); | 530 | mNavigator, SLOT( selectNext() ) ); |
528 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 531 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
529 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 532 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
530 | 533 | ||
531 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 534 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
532 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 535 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
533 | #if 0 | 536 | #if 0 |
534 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), | 537 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), |
535 | SLOT( incidenceAdded( Incidence *) ) ); | 538 | SLOT( incidenceAdded( Incidence *) ) ); |
536 | #endif | 539 | #endif |
537 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 540 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
538 | 541 | ||
539 | connect( this, SIGNAL( configChanged() ), | 542 | connect( this, SIGNAL( configChanged() ), |
540 | mDateNavigator, SLOT( updateConfig() ) ); | 543 | mDateNavigator, SLOT( updateConfig() ) ); |
541 | 544 | ||
542 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 545 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
543 | SLOT( newTodo() ) ); | 546 | SLOT( newTodo() ) ); |
544 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 547 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
545 | SLOT( newSubTodo( Todo * ) ) ); | 548 | SLOT( newSubTodo( Todo * ) ) ); |
546 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 549 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
547 | SLOT( editTodo( Todo * ) ) ); | 550 | SLOT( editTodo( Todo * ) ) ); |
548 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 551 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
549 | SLOT( showTodo( Todo *) ) ); | 552 | SLOT( showTodo( Todo *) ) ); |
550 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 553 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
551 | SLOT( deleteTodo( Todo *) ) ); | 554 | SLOT( deleteTodo( Todo *) ) ); |
552 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 555 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
553 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 556 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
554 | SLOT( purgeCompleted() ) ); | 557 | SLOT( purgeCompleted() ) ); |
555 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 558 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
556 | SIGNAL( todoModified( Todo *, int ) ) ); | 559 | SIGNAL( todoModified( Todo *, int ) ) ); |
557 | 560 | ||
558 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 561 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
559 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 562 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
560 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 563 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
561 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 564 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
562 | 565 | ||
563 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 566 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
564 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 567 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
565 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 568 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
566 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 569 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
567 | 570 | ||
568 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 571 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
569 | this, SLOT ( todo_unsub( Todo * ) ) ); | 572 | this, SLOT ( todo_unsub( Todo * ) ) ); |
570 | 573 | ||
571 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 574 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
572 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 575 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
573 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 576 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
574 | SLOT( updateTodo( Todo *, int ) ) ); | 577 | SLOT( updateTodo( Todo *, int ) ) ); |
575 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 578 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
576 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 579 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
577 | 580 | ||
578 | 581 | ||
579 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 582 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
580 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 583 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
581 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 584 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
582 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 585 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
583 | 586 | ||
584 | 587 | ||
585 | 588 | ||
586 | 589 | ||
587 | 590 | ||
588 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 591 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
589 | SLOT(checkClipboard())); | 592 | SLOT(checkClipboard())); |
590 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 593 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
591 | SLOT( processTodoListSelection( Incidence * ) ) ); | 594 | SLOT( processTodoListSelection( Incidence * ) ) ); |
592 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 595 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
593 | 596 | ||
594 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 597 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
595 | 598 | ||
596 | mDateFrame = new QVBox(0,0,WType_Popup); | 599 | mDateFrame = new QVBox(0,0,WType_Popup); |
597 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 600 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
598 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 601 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
599 | mDateFrame->setLineWidth(3); | 602 | mDateFrame->setLineWidth(3); |
600 | mDateFrame->hide(); | 603 | mDateFrame->hide(); |
601 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 604 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
602 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 605 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
603 | 606 | ||
604 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 607 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
605 | 608 | ||
606 | mEventEditor = mDialogManager->getEventEditor(); | 609 | mEventEditor = mDialogManager->getEventEditor(); |
607 | mTodoEditor = mDialogManager->getTodoEditor(); | 610 | mTodoEditor = mDialogManager->getTodoEditor(); |
608 | 611 | ||
609 | mFlagEditDescription = false; | 612 | mFlagEditDescription = false; |
610 | 613 | ||
611 | mSuspendTimer = new QTimer( this ); | 614 | mSuspendTimer = new QTimer( this ); |
612 | mAlarmTimer = new QTimer( this ); | 615 | mAlarmTimer = new QTimer( this ); |
613 | mRecheckAlarmTimer = new QTimer( this ); | 616 | mRecheckAlarmTimer = new QTimer( this ); |
614 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 617 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
615 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 618 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
616 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 619 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
617 | mAlarmDialog = new AlarmDialog( this ); | 620 | mAlarmDialog = new AlarmDialog( this ); |
618 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 621 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
619 | mAlarmDialog->setServerNotification( false ); | 622 | mAlarmDialog->setServerNotification( false ); |
620 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 623 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
621 | 624 | ||
622 | 625 | ||
623 | #ifndef DESKTOP_VERSION | 626 | #ifndef DESKTOP_VERSION |
624 | //US listen for arriving address resultsets | 627 | //US listen for arriving address resultsets |
625 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 628 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
626 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 629 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
627 | #endif | 630 | #endif |
628 | mDateNavigator->setCalendar( mCalendar ); | 631 | mDateNavigator->setCalendar( mCalendar ); |
629 | } | 632 | } |
630 | 633 | ||
631 | 634 | ||
632 | CalendarView::~CalendarView() | 635 | CalendarView::~CalendarView() |
633 | { | 636 | { |
634 | // kdDebug() << "~CalendarView()" << endl; | 637 | // kdDebug() << "~CalendarView()" << endl; |
635 | //qDebug("CalendarView::~CalendarView() "); | 638 | //qDebug("CalendarView::~CalendarView() "); |
636 | delete mDialogManager; | 639 | delete mDialogManager; |
637 | delete mViewManager; | 640 | delete mViewManager; |
638 | delete mStorage; | 641 | delete mStorage; |
639 | delete mDateFrame ; | 642 | delete mDateFrame ; |
640 | delete beamDialog; | 643 | delete beamDialog; |
641 | delete mEventViewerDialog; | 644 | delete mEventViewerDialog; |
642 | //kdDebug() << "~CalendarView() done" << endl; | 645 | //kdDebug() << "~CalendarView() done" << endl; |
643 | } | 646 | } |
644 | void CalendarView::checkAlarms() | 647 | void CalendarView::checkAlarms() |
645 | { | 648 | { |
646 | KConfig *config = KOGlobals::config(); | 649 | KConfig *config = KOGlobals::config(); |
647 | config->setGroup( "AppRun" ); | 650 | config->setGroup( "AppRun" ); |
648 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 651 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
649 | int daysto = dt.daysTo( QDate::currentDate() ); | 652 | int daysto = dt.daysTo( QDate::currentDate() ); |
650 | int days = config->readNumEntry( "LatestProgramStopDays" , daysto); | 653 | int days = config->readNumEntry( "LatestProgramStopDays" , daysto); |
651 | dt = dt.addDays( days ); | 654 | dt = dt.addDays( days ); |
652 | int secto = dt.secsTo( QDateTime::currentDateTime() ); | 655 | int secto = dt.secsTo( QDateTime::currentDateTime() ); |
653 | int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; | 656 | int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; |
654 | //qDebug("KO: Reading program stop %d ", secs); | 657 | //qDebug("KO: Reading program stop %d ", secs); |
655 | //secs -= ( 3600 * 24*3 ); // debug only | 658 | //secs -= ( 3600 * 24*3 ); // debug only |
656 | QDateTime latest = dt.addSecs ( secs ); | 659 | QDateTime latest = dt.addSecs ( secs ); |
657 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); | 660 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); |
658 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); | 661 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); |
659 | QPtrList<Incidence> el = mCalendar->rawIncidences(); | 662 | QPtrList<Incidence> el = mCalendar->rawIncidences(); |
660 | QPtrList<Incidence> al; | 663 | QPtrList<Incidence> al; |
661 | Incidence* inL = el.first(); | 664 | Incidence* inL = el.first(); |
662 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); | 665 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); |
663 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); | 666 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); |
664 | while ( inL ) { | 667 | while ( inL ) { |
665 | bool ok = false; | 668 | bool ok = false; |
666 | int offset = 0; | 669 | int offset = 0; |
667 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; | 670 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; |
668 | if ( ok ) { | 671 | if ( ok ) { |
669 | //qDebug("OK %s",next.toString().latin1()); | 672 | //qDebug("OK %s",next.toString().latin1()); |
670 | if ( next < cur ) { | 673 | if ( next < cur ) { |
671 | al.append( inL ); | 674 | al.append( inL ); |
672 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); | 675 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); |
673 | } | 676 | } |
674 | } | 677 | } |
675 | inL = el.next(); | 678 | inL = el.next(); |
676 | } | 679 | } |
677 | if ( al.count() ) { | 680 | if ( al.count() ) { |
678 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); | 681 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); |
679 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); | 682 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); |
680 | QVBoxLayout* lay = new QVBoxLayout( dia ); | 683 | QVBoxLayout* lay = new QVBoxLayout( dia ); |
681 | lay->setSpacing( 0 ); | 684 | lay->setSpacing( 0 ); |
682 | lay->setMargin( 0 ); | 685 | lay->setMargin( 0 ); |
683 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); | 686 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); |
684 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); | 687 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); |
685 | lay->addWidget( matb ); | 688 | lay->addWidget( matb ); |
686 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { | 689 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { |
687 | int wid = 210; | 690 | int wid = 210; |
688 | int x = QApplication::desktop()->width() - wid - 7; | 691 | int x = QApplication::desktop()->width() - wid - 7; |
689 | int y = QApplication::desktop()->height() - wid - 70; | 692 | int y = QApplication::desktop()->height() - wid - 70; |
690 | dia->setGeometry ( x,y,wid,wid); | 693 | dia->setGeometry ( x,y,wid,wid); |
691 | } else { | 694 | } else { |
692 | int si = 220; | 695 | int si = 220; |
693 | if ( QApplication::desktop()->width() > 470 ) | 696 | if ( QApplication::desktop()->width() > 470 ) |
694 | si = 400; | 697 | si = 400; |
695 | dia->resize(si,si/2); | 698 | dia->resize(si,si/2); |
696 | } | 699 | } |
697 | dia->setBackgroundColor( QColor( 255, 255, 255 ) ); | 700 | dia->setBackgroundColor( QColor( 255, 255, 255 ) ); |
698 | dia->show(); | 701 | dia->show(); |
699 | 702 | ||
700 | } | 703 | } |
701 | } | 704 | } |
702 | void CalendarView::showDay( QDate d ) | 705 | void CalendarView::showDay( QDate d ) |
703 | { | 706 | { |
704 | dateNavigator()->blockSignals( true ); | 707 | dateNavigator()->blockSignals( true ); |
705 | dateNavigator()->selectDate( d ); | 708 | dateNavigator()->selectDate( d ); |
706 | dateNavigator()->blockSignals( false ); | 709 | dateNavigator()->blockSignals( false ); |
707 | mViewManager->showDayView(); | 710 | mViewManager->showDayView(); |
708 | //dateNavigator()->selectDate( d ); | 711 | //dateNavigator()->selectDate( d ); |
709 | } | 712 | } |
710 | void CalendarView::timerAlarm() | 713 | void CalendarView::timerAlarm() |
711 | { | 714 | { |
712 | //qDebug("CalendarView::timerAlarm() "); | 715 | //qDebug("CalendarView::timerAlarm() "); |
713 | computeAlarm(mAlarmNotification ); | 716 | computeAlarm(mAlarmNotification ); |
714 | } | 717 | } |
715 | 718 | ||
716 | void CalendarView::suspendAlarm() | 719 | void CalendarView::suspendAlarm() |
717 | { | 720 | { |
718 | //qDebug(" CalendarView::suspendAlarm() "); | 721 | //qDebug(" CalendarView::suspendAlarm() "); |
719 | computeAlarm(mSuspendAlarmNotification ); | 722 | computeAlarm(mSuspendAlarmNotification ); |
720 | 723 | ||
721 | } | 724 | } |
722 | 725 | ||
723 | void CalendarView::startAlarm( QString mess , QString filename) | 726 | void CalendarView::startAlarm( QString mess , QString filename) |
724 | { | 727 | { |
725 | 728 | ||
726 | topLevelWidget()->showNormal(); | 729 | topLevelWidget()->showNormal(); |
727 | topLevelWidget()->setActiveWindow(); | 730 | topLevelWidget()->setActiveWindow(); |
728 | topLevelWidget()->raise(); | 731 | topLevelWidget()->raise(); |
729 | 732 | ||
730 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 733 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
731 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); | 734 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); |
732 | 735 | ||
733 | } | 736 | } |
734 | 737 | ||
735 | void CalendarView::checkNextTimerAlarm() | 738 | void CalendarView::checkNextTimerAlarm() |
736 | { | 739 | { |
737 | mCalendar->checkAlarmForIncidence( 0, true ); | 740 | mCalendar->checkAlarmForIncidence( 0, true ); |
738 | } | 741 | } |
739 | 742 | ||
740 | void CalendarView::computeAlarm( QString msg ) | 743 | void CalendarView::computeAlarm( QString msg ) |
741 | { | 744 | { |
742 | 745 | ||
743 | QString mess = msg; | 746 | QString mess = msg; |
744 | QString mAlarmMessage = mess.mid( 9 ); | 747 | QString mAlarmMessage = mess.mid( 9 ); |
745 | QString filename = MainWindow::resourcePath(); | 748 | QString filename = MainWindow::resourcePath(); |
746 | filename += "koalarm.wav"; | 749 | filename += "koalarm.wav"; |
747 | QString tempfilename; | 750 | QString tempfilename; |
748 | if ( mess.left( 13 ) == "suspend_alarm") { | 751 | if ( mess.left( 13 ) == "suspend_alarm") { |
749 | bool error = false; | 752 | bool error = false; |
750 | int len = mess.mid( 13 ).find("+++"); | 753 | int len = mess.mid( 13 ).find("+++"); |
751 | if ( len < 2 ) | 754 | if ( len < 2 ) |
752 | error = true; | 755 | error = true; |
753 | else { | 756 | else { |
754 | tempfilename = mess.mid( 13, len ); | 757 | tempfilename = mess.mid( 13, len ); |
755 | if ( !QFile::exists( tempfilename ) ) | 758 | if ( !QFile::exists( tempfilename ) ) |
756 | error = true; | 759 | error = true; |
757 | } | 760 | } |
758 | if ( ! error ) { | 761 | if ( ! error ) { |
759 | filename = tempfilename; | 762 | filename = tempfilename; |
760 | } | 763 | } |
761 | mAlarmMessage = mess.mid( 13+len+3 ); | 764 | mAlarmMessage = mess.mid( 13+len+3 ); |
762 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 765 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
763 | startAlarm( mAlarmMessage, filename); | 766 | startAlarm( mAlarmMessage, filename); |
764 | return; | 767 | return; |
765 | } | 768 | } |
766 | if ( mess.left( 11 ) == "timer_alarm") { | 769 | if ( mess.left( 11 ) == "timer_alarm") { |
767 | //mTimerTime = 0; | 770 | //mTimerTime = 0; |
768 | startAlarm( mess.mid( 11 ), filename ); | 771 | startAlarm( mess.mid( 11 ), filename ); |
769 | return; | 772 | return; |
770 | } | 773 | } |
771 | if ( mess.left( 10 ) == "proc_alarm") { | 774 | if ( mess.left( 10 ) == "proc_alarm") { |
772 | bool error = false; | 775 | bool error = false; |
773 | int len = mess.mid( 10 ).find("+++"); | 776 | int len = mess.mid( 10 ).find("+++"); |
774 | if ( len < 2 ) | 777 | if ( len < 2 ) |
775 | error = true; | 778 | error = true; |
776 | else { | 779 | else { |
777 | tempfilename = mess.mid( 10, len ); | 780 | tempfilename = mess.mid( 10, len ); |
778 | if ( !QFile::exists( tempfilename ) ) | 781 | if ( !QFile::exists( tempfilename ) ) |
779 | error = true; | 782 | error = true; |
780 | } | 783 | } |
781 | if ( error ) { | 784 | if ( error ) { |
782 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 785 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
783 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 786 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
784 | } else { | 787 | } else { |
785 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 788 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
786 | //qDebug("-----system command %s ",tempfilename.latin1() ); | 789 | //qDebug("-----system command %s ",tempfilename.latin1() ); |
787 | #ifndef _WIN32_ | 790 | #ifndef _WIN32_ |
788 | if ( vfork () == 0 ) { | 791 | if ( vfork () == 0 ) { |
789 | execl ( tempfilename.latin1(), 0 ); | 792 | execl ( tempfilename.latin1(), 0 ); |
790 | return; | 793 | return; |
791 | } | 794 | } |
792 | #else | 795 | #else |
793 | QProcess* p = new QProcess(); | 796 | QProcess* p = new QProcess(); |
794 | p->addArgument( tempfilename.latin1() ); | 797 | p->addArgument( tempfilename.latin1() ); |
795 | p->start(); | 798 | p->start(); |
796 | return; | 799 | return; |
797 | #endif | 800 | #endif |
798 | 801 | ||
799 | return; | 802 | return; |
800 | } | 803 | } |
801 | 804 | ||
802 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); | 805 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); |
803 | } | 806 | } |
804 | if ( mess.left( 11 ) == "audio_alarm") { | 807 | if ( mess.left( 11 ) == "audio_alarm") { |
805 | bool error = false; | 808 | bool error = false; |
806 | int len = mess.mid( 11 ).find("+++"); | 809 | int len = mess.mid( 11 ).find("+++"); |
807 | if ( len < 2 ) | 810 | if ( len < 2 ) |
808 | error = true; | 811 | error = true; |
809 | else { | 812 | else { |
810 | tempfilename = mess.mid( 11, len ); | 813 | tempfilename = mess.mid( 11, len ); |
811 | if ( !QFile::exists( tempfilename ) ) | 814 | if ( !QFile::exists( tempfilename ) ) |
812 | error = true; | 815 | error = true; |
813 | } | 816 | } |
814 | if ( ! error ) { | 817 | if ( ! error ) { |
815 | filename = tempfilename; | 818 | filename = tempfilename; |
816 | } | 819 | } |
817 | mAlarmMessage = mess.mid( 11+len+3+9 ); | 820 | mAlarmMessage = mess.mid( 11+len+3+9 ); |
818 | //qDebug("audio file command %s ",tempfilename.latin1() ); | 821 | //qDebug("audio file command %s ",tempfilename.latin1() ); |
819 | } | 822 | } |
820 | if ( mess.left( 9 ) == "cal_alarm") { | 823 | if ( mess.left( 9 ) == "cal_alarm") { |
821 | mAlarmMessage = mess.mid( 9 ) ; | 824 | mAlarmMessage = mess.mid( 9 ) ; |
822 | } | 825 | } |
823 | 826 | ||
824 | startAlarm( mAlarmMessage, filename ); | 827 | startAlarm( mAlarmMessage, filename ); |
825 | 828 | ||
826 | 829 | ||
827 | } | 830 | } |
828 | 831 | ||
829 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) | 832 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) |
830 | { | 833 | { |
831 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 834 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
832 | 835 | ||
833 | mSuspendAlarmNotification = noti; | 836 | mSuspendAlarmNotification = noti; |
834 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; | 837 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; |
835 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); | 838 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); |
836 | mSuspendTimer->start( ms , true ); | 839 | mSuspendTimer->start( ms , true ); |
837 | 840 | ||
838 | } | 841 | } |
839 | 842 | ||
840 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) | 843 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) |
841 | { | 844 | { |
842 | mNextAlarmDateTime = qdt; | 845 | mNextAlarmDateTime = qdt; |
843 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 846 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
844 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 847 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
845 | #ifndef DESKTOP_VERSION | 848 | #ifndef DESKTOP_VERSION |
846 | AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); | 849 | AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); |
847 | #endif | 850 | #endif |
848 | return; | 851 | return; |
849 | } | 852 | } |
850 | int maxSec; | 853 | int maxSec; |
851 | //maxSec = 5; //testing only | 854 | //maxSec = 5; //testing only |
852 | maxSec = 86400+3600; // one day+1hour | 855 | maxSec = 86400+3600; // one day+1hour |
853 | mAlarmNotification = noti; | 856 | mAlarmNotification = noti; |
854 | int sec = QDateTime::currentDateTime().secsTo( qdt ); | 857 | int sec = QDateTime::currentDateTime().secsTo( qdt ); |
855 | if ( sec > maxSec ) { | 858 | if ( sec > maxSec ) { |
856 | mRecheckAlarmTimer->start( maxSec * 1000 ); | 859 | mRecheckAlarmTimer->start( maxSec * 1000 ); |
857 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); | 860 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); |
858 | return; | 861 | return; |
859 | } else { | 862 | } else { |
860 | mRecheckAlarmTimer->stop(); | 863 | mRecheckAlarmTimer->stop(); |
861 | } | 864 | } |
862 | //qDebug("Alarm timer started with secs: %d ", sec); | 865 | //qDebug("Alarm timer started with secs: %d ", sec); |
863 | mAlarmTimer->start( sec *1000 , true ); | 866 | mAlarmTimer->start( sec *1000 , true ); |
864 | 867 | ||
865 | } | 868 | } |
866 | // called by mRecheckAlarmTimer to get next alarm | 869 | // called by mRecheckAlarmTimer to get next alarm |
867 | // we need this, because a QTimer has only a max range of 25 days | 870 | // we need this, because a QTimer has only a max range of 25 days |
868 | void CalendarView::recheckTimerAlarm() | 871 | void CalendarView::recheckTimerAlarm() |
869 | { | 872 | { |
870 | mAlarmTimer->stop(); | 873 | mAlarmTimer->stop(); |
871 | mRecheckAlarmTimer->stop(); | 874 | mRecheckAlarmTimer->stop(); |
872 | mCalendar->checkAlarmForIncidence( 0, true ); | 875 | mCalendar->checkAlarmForIncidence( 0, true ); |
873 | } | 876 | } |
874 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) | 877 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) |
875 | { | 878 | { |
876 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 879 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
877 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 880 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
878 | #ifndef DESKTOP_VERSION | 881 | #ifndef DESKTOP_VERSION |
879 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); | 882 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); |
880 | #endif | 883 | #endif |
881 | return; | 884 | return; |
882 | } | 885 | } |
883 | mAlarmTimer->stop(); | 886 | mAlarmTimer->stop(); |
884 | } | 887 | } |
885 | void CalendarView::selectWeekNum ( int num ) | 888 | void CalendarView::selectWeekNum ( int num ) |
886 | { | 889 | { |
887 | dateNavigator()->blockSignals( true ); | 890 | dateNavigator()->blockSignals( true ); |
888 | dateNavigator()->selectWeek( num ); | 891 | dateNavigator()->selectWeek( num ); |
889 | dateNavigator()->blockSignals( false ); | 892 | dateNavigator()->blockSignals( false ); |
890 | mViewManager->showWeekView(); | 893 | mViewManager->showWeekView(); |
891 | } | 894 | } |
892 | KOViewManager *CalendarView::viewManager() | 895 | KOViewManager *CalendarView::viewManager() |
893 | { | 896 | { |
894 | return mViewManager; | 897 | return mViewManager; |
895 | } | 898 | } |
896 | 899 | ||
897 | KODialogManager *CalendarView::dialogManager() | 900 | KODialogManager *CalendarView::dialogManager() |
898 | { | 901 | { |
899 | return mDialogManager; | 902 | return mDialogManager; |
900 | } | 903 | } |
901 | 904 | ||
902 | QDate CalendarView::startDate() | 905 | QDate CalendarView::startDate() |
903 | { | 906 | { |
904 | DateList dates = mNavigator->selectedDates(); | 907 | DateList dates = mNavigator->selectedDates(); |
905 | 908 | ||
906 | return dates.first(); | 909 | return dates.first(); |
907 | } | 910 | } |
908 | 911 | ||
909 | QDate CalendarView::endDate() | 912 | QDate CalendarView::endDate() |
910 | { | 913 | { |
911 | DateList dates = mNavigator->selectedDates(); | 914 | DateList dates = mNavigator->selectedDates(); |
912 | 915 | ||
913 | return dates.last(); | 916 | return dates.last(); |
914 | } | 917 | } |
915 | 918 | ||
916 | 919 | ||
917 | void CalendarView::createPrinter() | 920 | void CalendarView::createPrinter() |
918 | { | 921 | { |
919 | #ifndef KORG_NOPRINTER | 922 | #ifndef KORG_NOPRINTER |
920 | if (!mCalPrinter) { | 923 | if (!mCalPrinter) { |
921 | mCalPrinter = new CalPrinter(this, mCalendar); | 924 | mCalPrinter = new CalPrinter(this, mCalendar); |
922 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); | 925 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); |
923 | } | 926 | } |
924 | #endif | 927 | #endif |
925 | } | 928 | } |
926 | 929 | ||
927 | 930 | ||
928 | //KOPrefs::instance()->mWriteBackFile | 931 | //KOPrefs::instance()->mWriteBackFile |
929 | //KOPrefs::instance()->mWriteBackExistingOnly | 932 | //KOPrefs::instance()->mWriteBackExistingOnly |
930 | 933 | ||
931 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); | 934 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); |
932 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); | 935 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); |
933 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); | 936 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); |
934 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); | 937 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); |
935 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); | 938 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); |
936 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); | 939 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); |
937 | 940 | ||
938 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) | 941 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) |
939 | { | 942 | { |
940 | 943 | ||
941 | // 0 equal | 944 | // 0 equal |
942 | // 1 take local | 945 | // 1 take local |
943 | // 2 take remote | 946 | // 2 take remote |
944 | // 3 cancel | 947 | // 3 cancel |
945 | QDateTime lastSync = mLastCalendarSync; | 948 | QDateTime lastSync = mLastCalendarSync; |
946 | QDateTime localMod = local->lastModified(); | 949 | QDateTime localMod = local->lastModified(); |
947 | QDateTime remoteMod = remote->lastModified(); | 950 | QDateTime remoteMod = remote->lastModified(); |
948 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 951 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
949 | bool remCh, locCh; | 952 | bool remCh, locCh; |
950 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); | 953 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); |
951 | //if ( remCh ) | 954 | //if ( remCh ) |
952 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); | 955 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); |
953 | locCh = ( localMod > mLastCalendarSync ); | 956 | locCh = ( localMod > mLastCalendarSync ); |
954 | if ( !remCh && ! locCh ) { | 957 | if ( !remCh && ! locCh ) { |
955 | //qDebug("both not changed "); | 958 | //qDebug("both not changed "); |
956 | lastSync = localMod.addDays(1); | 959 | lastSync = localMod.addDays(1); |
957 | if ( mode <= SYNC_PREF_ASK ) | 960 | if ( mode <= SYNC_PREF_ASK ) |
958 | return 0; | 961 | return 0; |
959 | } else { | 962 | } else { |
960 | if ( locCh ) { | 963 | if ( locCh ) { |
961 | //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); | 964 | //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); |
962 | lastSync = localMod.addDays( -1 ); | 965 | lastSync = localMod.addDays( -1 ); |
963 | if ( !remCh ) | 966 | if ( !remCh ) |
964 | remoteMod = ( lastSync.addDays( -1 ) ); | 967 | remoteMod = ( lastSync.addDays( -1 ) ); |
965 | } else { | 968 | } else { |
966 | //qDebug(" not loc changed "); | 969 | //qDebug(" not loc changed "); |
967 | lastSync = localMod.addDays( 1 ); | 970 | lastSync = localMod.addDays( 1 ); |
968 | if ( remCh ) | 971 | if ( remCh ) |
969 | remoteMod =( lastSync.addDays( 1 ) ); | 972 | remoteMod =( lastSync.addDays( 1 ) ); |
970 | 973 | ||
971 | } | 974 | } |
972 | } | 975 | } |
973 | full = true; | 976 | full = true; |
974 | if ( mode < SYNC_PREF_ASK ) | 977 | if ( mode < SYNC_PREF_ASK ) |
975 | mode = SYNC_PREF_ASK; | 978 | mode = SYNC_PREF_ASK; |
976 | } else { | 979 | } else { |
977 | if ( localMod == remoteMod ) | 980 | if ( localMod == remoteMod ) |
978 | // if ( local->revision() == remote->revision() ) | 981 | // if ( local->revision() == remote->revision() ) |
979 | return 0; | 982 | return 0; |
980 | 983 | ||
981 | } | 984 | } |
982 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); | 985 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); |
983 | 986 | ||
984 | //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); | 987 | //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); |
985 | //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); | 988 | //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); |
986 | //full = true; //debug only | 989 | //full = true; //debug only |
987 | if ( full ) { | 990 | if ( full ) { |
988 | bool equ = false; | 991 | bool equ = false; |
989 | if ( local->typeID() == eventID ) { | 992 | if ( local->typeID() == eventID ) { |
990 | equ = (*((Event*) local) == *((Event*) remote)); | 993 | equ = (*((Event*) local) == *((Event*) remote)); |
991 | } | 994 | } |
992 | else if ( local->typeID() == todoID ) | 995 | else if ( local->typeID() == todoID ) |
993 | equ = (*((Todo*) local) == (*(Todo*) remote)); | 996 | equ = (*((Todo*) local) == (*(Todo*) remote)); |
994 | else if ( local->typeID() == journalID ) | 997 | else if ( local->typeID() == journalID ) |
995 | equ = (*((Journal*) local) == *((Journal*) remote)); | 998 | equ = (*((Journal*) local) == *((Journal*) remote)); |
996 | if ( equ ) { | 999 | if ( equ ) { |
997 | //qDebug("equal "); | 1000 | //qDebug("equal "); |
998 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1001 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
999 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); | 1002 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); |
1000 | } | 1003 | } |
1001 | if ( mode < SYNC_PREF_FORCE_LOCAL ) | 1004 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
1002 | return 0; | 1005 | return 0; |
1003 | 1006 | ||
1004 | }//else //debug only | 1007 | }//else //debug only |
1005 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); | 1008 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); |
1006 | } | 1009 | } |
1007 | int result; | 1010 | int result; |
1008 | bool localIsNew; | 1011 | bool localIsNew; |
1009 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); | 1012 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); |
1010 | 1013 | ||
1011 | 1014 | ||
1012 | // ************************************************ | 1015 | // ************************************************ |
1013 | // ************************************************ | 1016 | // ************************************************ |
1014 | // ************************************************ | 1017 | // ************************************************ |
1015 | // We may have that lastSync > remoteMod AND lastSync > localMod | 1018 | // We may have that lastSync > remoteMod AND lastSync > localMod |
1016 | // BUT remoteMod != localMod | 1019 | // BUT remoteMod != localMod |
1017 | 1020 | ||
1018 | 1021 | ||
1019 | if ( full && mode < SYNC_PREF_NEWEST ) | 1022 | if ( full && mode < SYNC_PREF_NEWEST ) |
1020 | mode = SYNC_PREF_ASK; | 1023 | mode = SYNC_PREF_ASK; |
1021 | 1024 | ||
1022 | switch( mode ) { | 1025 | switch( mode ) { |
1023 | case SYNC_PREF_LOCAL: | 1026 | case SYNC_PREF_LOCAL: |
1024 | if ( lastSync > remoteMod ) | 1027 | if ( lastSync > remoteMod ) |
1025 | return 1; | 1028 | return 1; |
1026 | if ( lastSync > localMod ) | 1029 | if ( lastSync > localMod ) |
1027 | return 2; | 1030 | return 2; |
1028 | return 1; | 1031 | return 1; |
1029 | break; | 1032 | break; |
1030 | case SYNC_PREF_REMOTE: | 1033 | case SYNC_PREF_REMOTE: |
1031 | if ( lastSync > localMod ) | 1034 | if ( lastSync > localMod ) |
1032 | return 2; | 1035 | return 2; |
1033 | if ( lastSync > remoteMod ) | 1036 | if ( lastSync > remoteMod ) |
1034 | return 1; | 1037 | return 1; |
1035 | return 2; | 1038 | return 2; |
1036 | break; | 1039 | break; |
1037 | case SYNC_PREF_NEWEST: | 1040 | case SYNC_PREF_NEWEST: |
1038 | if ( localMod >= remoteMod ) | 1041 | if ( localMod >= remoteMod ) |
1039 | return 1; | 1042 | return 1; |
1040 | else | 1043 | else |
1041 | return 2; | 1044 | return 2; |
1042 | break; | 1045 | break; |
1043 | case SYNC_PREF_ASK: | 1046 | case SYNC_PREF_ASK: |
1044 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 1047 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
1045 | if ( lastSync > remoteMod && lastSync > localMod) | 1048 | if ( lastSync > remoteMod && lastSync > localMod) |
1046 | return 0; | 1049 | return 0; |
1047 | if ( lastSync > remoteMod ) | 1050 | if ( lastSync > remoteMod ) |
1048 | return 1; | 1051 | return 1; |
1049 | if ( lastSync > localMod ) | 1052 | if ( lastSync > localMod ) |
1050 | return 2; | 1053 | return 2; |
1051 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 1054 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
1052 | localIsNew = localMod >= remoteMod; | 1055 | localIsNew = localMod >= remoteMod; |
1053 | if ( localIsNew ) | 1056 | if ( localIsNew ) |
1054 | getEventViewerDialog()->setColorMode( 1 ); | 1057 | getEventViewerDialog()->setColorMode( 1 ); |
1055 | else | 1058 | else |
1056 | getEventViewerDialog()->setColorMode( 2 ); | 1059 | getEventViewerDialog()->setColorMode( 2 ); |
1057 | getEventViewerDialog()->setIncidence(local); | 1060 | getEventViewerDialog()->setIncidence(local); |
1058 | if ( localIsNew ) | 1061 | if ( localIsNew ) |
1059 | getEventViewerDialog()->setColorMode( 2 ); | 1062 | getEventViewerDialog()->setColorMode( 2 ); |
1060 | else | 1063 | else |
1061 | getEventViewerDialog()->setColorMode( 1 ); | 1064 | getEventViewerDialog()->setColorMode( 1 ); |
1062 | getEventViewerDialog()->addIncidence(remote); | 1065 | getEventViewerDialog()->addIncidence(remote); |
1063 | getEventViewerDialog()->setColorMode( 0 ); | 1066 | getEventViewerDialog()->setColorMode( 0 ); |
1064 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); | 1067 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); |
1065 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); | 1068 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); |
1066 | getEventViewerDialog()->showMe(); | 1069 | getEventViewerDialog()->showMe(); |
1067 | result = getEventViewerDialog()->executeS( localIsNew ); | 1070 | result = getEventViewerDialog()->executeS( localIsNew ); |
1068 | return result; | 1071 | return result; |
1069 | 1072 | ||
1070 | break; | 1073 | break; |
1071 | case SYNC_PREF_FORCE_LOCAL: | 1074 | case SYNC_PREF_FORCE_LOCAL: |
1072 | return 1; | 1075 | return 1; |
1073 | break; | 1076 | break; |
1074 | case SYNC_PREF_FORCE_REMOTE: | 1077 | case SYNC_PREF_FORCE_REMOTE: |
1075 | return 2; | 1078 | return 2; |
1076 | break; | 1079 | break; |
1077 | 1080 | ||
1078 | default: | 1081 | default: |
1079 | // SYNC_PREF_TAKE_BOTH not implemented | 1082 | // SYNC_PREF_TAKE_BOTH not implemented |
1080 | break; | 1083 | break; |
1081 | } | 1084 | } |
1082 | return 0; | 1085 | return 0; |
1083 | } | 1086 | } |
1084 | Event* CalendarView::getLastSyncEvent() | 1087 | Event* CalendarView::getLastSyncEvent() |
1085 | { | 1088 | { |
1086 | Event* lse; | 1089 | Event* lse; |
1087 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 1090 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
1088 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); | 1091 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); |
1089 | if (!lse) { | 1092 | if (!lse) { |
1090 | lse = new Event(); | 1093 | lse = new Event(); |
1091 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); | 1094 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); |
1092 | QString sum = ""; | 1095 | QString sum = ""; |
1093 | if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) | 1096 | if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) |
1094 | sum = "E: "; | 1097 | sum = "E: "; |
1095 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); | 1098 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); |
1096 | lse->setDtStart( mLastCalendarSync ); | 1099 | lse->setDtStart( mLastCalendarSync ); |
1097 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 1100 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
1098 | lse->setCategories( i18n("SyncEvent") ); | 1101 | lse->setCategories( i18n("SyncEvent") ); |
1099 | lse->setReadOnly( true ); | 1102 | lse->setReadOnly( true ); |
1100 | mCalendar->addEvent( lse ); | 1103 | mCalendar->addEvent( lse ); |
1101 | } | 1104 | } |
1102 | 1105 | ||
1103 | return lse; | 1106 | return lse; |
1104 | 1107 | ||
1105 | } | 1108 | } |
1106 | 1109 | ||
1107 | // we check, if the to delete event has a id for a profile | 1110 | // we check, if the to delete event has a id for a profile |
1108 | // if yes, we set this id in the profile to delete | 1111 | // if yes, we set this id in the profile to delete |
1109 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) | 1112 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) |
1110 | { | 1113 | { |
1111 | if ( lastSync.count() == 0 ) { | 1114 | if ( lastSync.count() == 0 ) { |
1112 | //qDebug(" lastSync.count() == 0"); | 1115 | //qDebug(" lastSync.count() == 0"); |
1113 | return; | 1116 | return; |
1114 | } | 1117 | } |
1115 | if ( toDelete->typeID() == journalID ) | 1118 | if ( toDelete->typeID() == journalID ) |
1116 | return; | 1119 | return; |
1117 | 1120 | ||
1118 | Event* eve = lastSync.first(); | 1121 | Event* eve = lastSync.first(); |
1119 | 1122 | ||
1120 | while ( eve ) { | 1123 | while ( eve ) { |
1121 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name | 1124 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name |
1122 | if ( !id.isEmpty() ) { | 1125 | if ( !id.isEmpty() ) { |
1123 | QString des = eve->description(); | 1126 | QString des = eve->description(); |
1124 | QString pref = "e"; | 1127 | QString pref = "e"; |
1125 | if ( toDelete->typeID() == todoID ) | 1128 | if ( toDelete->typeID() == todoID ) |
1126 | pref = "t"; | 1129 | pref = "t"; |
1127 | des += pref+ id + ","; | 1130 | des += pref+ id + ","; |
1128 | eve->setReadOnly( false ); | 1131 | eve->setReadOnly( false ); |
1129 | eve->setDescription( des ); | 1132 | eve->setDescription( des ); |
1130 | //qDebug("setdes %s ", des.latin1()); | 1133 | //qDebug("setdes %s ", des.latin1()); |
1131 | eve->setReadOnly( true ); | 1134 | eve->setReadOnly( true ); |
1132 | } | 1135 | } |
1133 | eve = lastSync.next(); | 1136 | eve = lastSync.next(); |
1134 | } | 1137 | } |
1135 | 1138 | ||
1136 | } | 1139 | } |
1137 | void CalendarView::checkExternalId( Incidence * inc ) | 1140 | void CalendarView::checkExternalId( Incidence * inc ) |
1138 | { | 1141 | { |
1139 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; | 1142 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; |
1140 | checkExternSyncEvent( lastSync, inc ); | 1143 | checkExternSyncEvent( lastSync, inc ); |
1141 | 1144 | ||
1142 | } | 1145 | } |
1143 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) | 1146 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) |
1144 | { | 1147 | { |
1145 | bool syncOK = true; | 1148 | bool syncOK = true; |
1146 | int addedEvent = 0; | 1149 | int addedEvent = 0; |
1147 | int addedEventR = 0; | 1150 | int addedEventR = 0; |
1148 | int deletedEventR = 0; | 1151 | int deletedEventR = 0; |
1149 | int deletedEventL = 0; | 1152 | int deletedEventL = 0; |
1150 | int changedLocal = 0; | 1153 | int changedLocal = 0; |
1151 | int changedRemote = 0; | 1154 | int changedRemote = 0; |
1152 | int filteredIN = 0; | 1155 | int filteredIN = 0; |
1153 | int filteredOUT = 0; | 1156 | int filteredOUT = 0; |
1154 | //QPtrList<Event> el = local->rawEvents(); | 1157 | //QPtrList<Event> el = local->rawEvents(); |
1155 | Event* eventR; | 1158 | Event* eventR; |
1156 | QString uid; | 1159 | QString uid; |
1157 | int take; | 1160 | int take; |
1158 | Event* eventL; | 1161 | Event* eventL; |
1159 | Event* eventRSync; | 1162 | Event* eventRSync; |
1160 | Event* eventLSync; | 1163 | Event* eventLSync; |
1161 | clearAllViews(); | 1164 | clearAllViews(); |
1162 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); | 1165 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); |
1163 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); | 1166 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); |
1164 | bool fullDateRange = false; | 1167 | bool fullDateRange = false; |
1165 | local->resetTempSyncStat(); | 1168 | local->resetTempSyncStat(); |
1166 | mLastCalendarSync = QDateTime::currentDateTime(); | 1169 | mLastCalendarSync = QDateTime::currentDateTime(); |
1167 | if ( mSyncManager->syncWithDesktop() ) { | 1170 | if ( mSyncManager->syncWithDesktop() ) { |
1168 | remote->resetPilotStat(1); | 1171 | remote->resetPilotStat(1); |
1169 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { | 1172 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { |
1170 | mLastCalendarSync = KSyncManager::mRequestedSyncEvent; | 1173 | mLastCalendarSync = KSyncManager::mRequestedSyncEvent; |
1171 | qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); | 1174 | qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); |
1172 | } else { | 1175 | } else { |
1173 | qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); | 1176 | qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); |
1174 | } | 1177 | } |
1175 | } | 1178 | } |
1176 | QDateTime modifiedCalendar = mLastCalendarSync; | 1179 | QDateTime modifiedCalendar = mLastCalendarSync; |
1177 | eventLSync = getLastSyncEvent(); | 1180 | eventLSync = getLastSyncEvent(); |
1178 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); | 1181 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); |
1179 | if ( eventR ) { | 1182 | if ( eventR ) { |
1180 | eventRSync = (Event*) eventR->clone(); | 1183 | eventRSync = (Event*) eventR->clone(); |
1181 | remote->deleteEvent(eventR ); | 1184 | remote->deleteEvent(eventR ); |
1182 | 1185 | ||
1183 | } else { | 1186 | } else { |
1184 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { | 1187 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { |
1185 | eventRSync = (Event*)eventLSync->clone(); | 1188 | eventRSync = (Event*)eventLSync->clone(); |
1186 | } else { | 1189 | } else { |
1187 | fullDateRange = true; | 1190 | fullDateRange = true; |
1188 | eventRSync = new Event(); | 1191 | eventRSync = new Event(); |
1189 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); | 1192 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); |
1190 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); | 1193 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); |
1191 | eventRSync->setDtStart( mLastCalendarSync ); | 1194 | eventRSync->setDtStart( mLastCalendarSync ); |
1192 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 1195 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
1193 | eventRSync->setCategories( i18n("SyncEvent") ); | 1196 | eventRSync->setCategories( i18n("SyncEvent") ); |
1194 | } | 1197 | } |
1195 | } | 1198 | } |
1196 | if ( eventLSync->dtStart() == mLastCalendarSync ) | 1199 | if ( eventLSync->dtStart() == mLastCalendarSync ) |
1197 | fullDateRange = true; | 1200 | fullDateRange = true; |
1198 | 1201 | ||
1199 | if ( ! fullDateRange ) { | 1202 | if ( ! fullDateRange ) { |
1200 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { | 1203 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { |
1201 | 1204 | ||
1202 | // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); | 1205 | // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); |
1203 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); | 1206 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); |
1204 | fullDateRange = true; | 1207 | fullDateRange = true; |
1205 | } | 1208 | } |
1206 | } | 1209 | } |
1207 | if ( mSyncManager->syncWithDesktop() ) { | 1210 | if ( mSyncManager->syncWithDesktop() ) { |
1208 | fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); | 1211 | fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); |
1209 | } | 1212 | } |
1210 | if ( fullDateRange ) | 1213 | if ( fullDateRange ) |
1211 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); | 1214 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); |
1212 | else | 1215 | else |
1213 | mLastCalendarSync = eventLSync->dtStart(); | 1216 | mLastCalendarSync = eventLSync->dtStart(); |
1214 | // for resyncing if own file has changed | 1217 | // for resyncing if own file has changed |
1215 | if ( mCurrentSyncDevice == "deleteaftersync" ) { | 1218 | if ( mCurrentSyncDevice == "deleteaftersync" ) { |
1216 | mLastCalendarSync = loadedFileVersion; | 1219 | mLastCalendarSync = loadedFileVersion; |
1217 | //qDebug("setting mLastCalendarSync "); | 1220 | //qDebug("setting mLastCalendarSync "); |
1218 | } | 1221 | } |
1219 | //qDebug("*************************** "); | 1222 | //qDebug("*************************** "); |
1220 | qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); | 1223 | qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); |
1221 | QPtrList<Incidence> er = remote->rawIncidences(); | 1224 | QPtrList<Incidence> er = remote->rawIncidences(); |
1222 | Incidence* inR = er.first(); | 1225 | Incidence* inR = er.first(); |
1223 | Incidence* inL; | 1226 | Incidence* inL; |
1224 | QProgressBar bar( er.count(),0 ); | 1227 | QProgressBar bar( er.count(),0 ); |
1225 | bar.setCaption (i18n("Syncing - close to abort!") ); | 1228 | bar.setCaption (i18n("Syncing - close to abort!") ); |
1226 | 1229 | ||
1227 | // ************** setting up filter ************* | 1230 | // ************** setting up filter ************* |
1228 | CalFilter *filterIN = 0; | 1231 | CalFilter *filterIN = 0; |
1229 | CalFilter *filterOUT = 0; | 1232 | CalFilter *filterOUT = 0; |
1230 | CalFilter *filter = mFilters.first(); | 1233 | CalFilter *filter = mFilters.first(); |
1231 | while(filter) { | 1234 | while(filter) { |
1232 | if ( filter->name() == mSyncManager->mFilterInCal ) | 1235 | if ( filter->name() == mSyncManager->mFilterInCal ) |
1233 | filterIN = filter; | 1236 | filterIN = filter; |
1234 | if ( filter->name() == mSyncManager->mFilterOutCal ) | 1237 | if ( filter->name() == mSyncManager->mFilterOutCal ) |
1235 | filterOUT = filter; | 1238 | filterOUT = filter; |
1236 | filter = mFilters.next(); | 1239 | filter = mFilters.next(); |
1237 | } | 1240 | } |
1238 | int w = 300; | 1241 | int w = 300; |
1239 | if ( QApplication::desktop()->width() < 320 ) | 1242 | if ( QApplication::desktop()->width() < 320 ) |
1240 | w = 220; | 1243 | w = 220; |
1241 | int h = bar.sizeHint().height() ; | 1244 | int h = bar.sizeHint().height() ; |
1242 | int dw = QApplication::desktop()->width(); | 1245 | int dw = QApplication::desktop()->width(); |
1243 | int dh = QApplication::desktop()->height(); | 1246 | int dh = QApplication::desktop()->height(); |
1244 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1247 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1245 | bar.show(); | 1248 | bar.show(); |
1246 | int modulo = (er.count()/10)+1; | 1249 | int modulo = (er.count()/10)+1; |
1247 | int incCounter = 0; | 1250 | int incCounter = 0; |
1248 | while ( inR ) { | 1251 | while ( inR ) { |
1249 | if ( ! bar.isVisible() ) | 1252 | if ( ! bar.isVisible() ) |
1250 | return false; | 1253 | return false; |
1251 | if ( incCounter % modulo == 0 ) | 1254 | if ( incCounter % modulo == 0 ) |
1252 | bar.setProgress( incCounter ); | 1255 | bar.setProgress( incCounter ); |
1253 | ++incCounter; | 1256 | ++incCounter; |
1254 | uid = inR->uid(); | 1257 | uid = inR->uid(); |
1255 | bool skipIncidence = false; | 1258 | bool skipIncidence = false; |
1256 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1259 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1257 | skipIncidence = true; | 1260 | skipIncidence = true; |
1258 | QString idS; | 1261 | QString idS; |
1259 | qApp->processEvents(); | 1262 | qApp->processEvents(); |
1260 | if ( !skipIncidence ) { | 1263 | if ( !skipIncidence ) { |
1261 | inL = local->incidence( uid ); | 1264 | inL = local->incidence( uid ); |
1262 | if ( inL ) { // maybe conflict - same uid in both calendars | 1265 | if ( inL ) { // maybe conflict - same uid in both calendars |
1263 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { | 1266 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { |
1264 | //qDebug("take %d %s ", take, inL->summary().latin1()); | 1267 | //qDebug("take %d %s ", take, inL->summary().latin1()); |
1265 | if ( take == 3 ) | 1268 | if ( take == 3 ) |
1266 | return false; | 1269 | return false; |
1267 | if ( take == 1 ) {// take local ********************** | 1270 | if ( take == 1 ) {// take local ********************** |
1268 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 1271 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
1269 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1272 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1270 | else | 1273 | else |
1271 | idS = inR->IDStr(); | 1274 | idS = inR->IDStr(); |
1272 | remote->deleteIncidence( inR ); | 1275 | remote->deleteIncidence( inR ); |
1273 | inR = inL->clone(); | 1276 | inR = inL->clone(); |
1274 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1277 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1275 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) | 1278 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) |
1276 | inR->setIDStr( idS ); | 1279 | inR->setIDStr( idS ); |
1277 | remote->addIncidence( inR ); | 1280 | remote->addIncidence( inR ); |
1278 | if ( mSyncManager->syncWithDesktop() ) | 1281 | if ( mSyncManager->syncWithDesktop() ) |
1279 | inR->setPilotId( 2 ); | 1282 | inR->setPilotId( 2 ); |
1280 | ++changedRemote; | 1283 | ++changedRemote; |
1281 | } else {// take remote ********************** | 1284 | } else {// take remote ********************** |
1282 | idS = inL->IDStr(); | 1285 | idS = inL->IDStr(); |
1283 | int pid = inL->pilotId(); | 1286 | int pid = inL->pilotId(); |
1284 | local->deleteIncidence( inL ); | 1287 | local->deleteIncidence( inL ); |
1285 | inL = inR->clone(); | 1288 | inL = inR->clone(); |
1286 | if ( mSyncManager->syncWithDesktop() ) | 1289 | if ( mSyncManager->syncWithDesktop() ) |
1287 | inL->setPilotId( pid ); | 1290 | inL->setPilotId( pid ); |
1288 | inL->setIDStr( idS ); | 1291 | inL->setIDStr( idS ); |
1289 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1292 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1290 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1293 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1291 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1294 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1292 | } | 1295 | } |
1293 | local->addIncidence( inL ); | 1296 | local->addIncidence( inL ); |
1294 | ++changedLocal; | 1297 | ++changedLocal; |
1295 | } | 1298 | } |
1296 | } | 1299 | } |
1297 | } else { // no conflict ********** add or delete remote | 1300 | } else { // no conflict ********** add or delete remote |
1298 | if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ | 1301 | if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ |
1299 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1302 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1300 | QString des = eventLSync->description(); | 1303 | QString des = eventLSync->description(); |
1301 | QString pref = "e"; | 1304 | QString pref = "e"; |
1302 | if ( inR->typeID() == todoID ) | 1305 | if ( inR->typeID() == todoID ) |
1303 | pref = "t"; | 1306 | pref = "t"; |
1304 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 1307 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
1305 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 1308 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
1306 | //remote->deleteIncidence( inR ); | 1309 | //remote->deleteIncidence( inR ); |
1307 | ++deletedEventR; | 1310 | ++deletedEventR; |
1308 | } else { | 1311 | } else { |
1309 | inR->setLastModified( modifiedCalendar ); | 1312 | inR->setLastModified( modifiedCalendar ); |
1310 | inL = inR->clone(); | 1313 | inL = inR->clone(); |
1311 | inL->setIDStr( ":" ); | 1314 | inL->setIDStr( ":" ); |
1312 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1315 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1313 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1316 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1314 | local->addIncidence( inL ); | 1317 | local->addIncidence( inL ); |
1315 | ++addedEvent; | 1318 | ++addedEvent; |
1316 | 1319 | ||
1317 | } | 1320 | } |
1318 | } else { | 1321 | } else { |
1319 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { | 1322 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { |
1320 | inR->setLastModified( modifiedCalendar ); | 1323 | inR->setLastModified( modifiedCalendar ); |
1321 | inL = inR->clone(); | 1324 | inL = inR->clone(); |
1322 | inL->setIDStr( ":" ); | 1325 | inL->setIDStr( ":" ); |
1323 | local->addIncidence( inL ); | 1326 | local->addIncidence( inL ); |
1324 | ++addedEvent; | 1327 | ++addedEvent; |
1325 | 1328 | ||
1326 | } else { | 1329 | } else { |
1327 | checkExternSyncEvent(eventRSyncSharp, inR); | 1330 | checkExternSyncEvent(eventRSyncSharp, inR); |
1328 | remote->deleteIncidence( inR ); | 1331 | remote->deleteIncidence( inR ); |
1329 | ++deletedEventR; | 1332 | ++deletedEventR; |
1330 | } | 1333 | } |
1331 | } | 1334 | } |
1332 | } else { | 1335 | } else { |
1333 | ++filteredIN; | 1336 | ++filteredIN; |
1334 | } | 1337 | } |
1335 | } | 1338 | } |
1336 | } | 1339 | } |
1337 | inR = er.next(); | 1340 | inR = er.next(); |
1338 | } | 1341 | } |
1339 | QPtrList<Incidence> el = local->rawIncidences(); | 1342 | QPtrList<Incidence> el = local->rawIncidences(); |
1340 | inL = el.first(); | 1343 | inL = el.first(); |
1341 | modulo = (el.count()/10)+1; | 1344 | modulo = (el.count()/10)+1; |
1342 | bar.setCaption (i18n("Add / remove events") ); | 1345 | bar.setCaption (i18n("Add / remove events") ); |
1343 | bar.setTotalSteps ( el.count() ) ; | 1346 | bar.setTotalSteps ( el.count() ) ; |
1344 | bar.show(); | 1347 | bar.show(); |
1345 | incCounter = 0; | 1348 | incCounter = 0; |
1346 | 1349 | ||
1347 | while ( inL ) { | 1350 | while ( inL ) { |
1348 | 1351 | ||
1349 | qApp->processEvents(); | 1352 | qApp->processEvents(); |
1350 | if ( ! bar.isVisible() ) | 1353 | if ( ! bar.isVisible() ) |
1351 | return false; | 1354 | return false; |
1352 | if ( incCounter % modulo == 0 ) | 1355 | if ( incCounter % modulo == 0 ) |
1353 | bar.setProgress( incCounter ); | 1356 | bar.setProgress( incCounter ); |
1354 | ++incCounter; | 1357 | ++incCounter; |
1355 | uid = inL->uid(); | 1358 | uid = inL->uid(); |
1356 | bool skipIncidence = false; | 1359 | bool skipIncidence = false; |
1357 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1360 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1358 | skipIncidence = true; | 1361 | skipIncidence = true; |
1359 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID ) | 1362 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID ) |
1360 | skipIncidence = true; | 1363 | skipIncidence = true; |
1361 | if ( !skipIncidence ) { | 1364 | if ( !skipIncidence ) { |
1362 | inR = remote->incidence( uid ); | 1365 | inR = remote->incidence( uid ); |
1363 | if ( ! inR ) { | 1366 | if ( ! inR ) { |
1364 | if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ | 1367 | if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ |
1365 | // no conflict ********** add or delete local | 1368 | // no conflict ********** add or delete local |
1366 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1369 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1367 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 1370 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
1368 | checkExternSyncEvent(eventLSyncSharp, inL); | 1371 | checkExternSyncEvent(eventLSyncSharp, inL); |
1369 | local->deleteIncidence( inL ); | 1372 | local->deleteIncidence( inL ); |
1370 | ++deletedEventL; | 1373 | ++deletedEventL; |
1371 | } else { | 1374 | } else { |
1372 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1375 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1373 | inL->removeID(mCurrentSyncDevice ); | 1376 | inL->removeID(mCurrentSyncDevice ); |
1374 | ++addedEventR; | 1377 | ++addedEventR; |
1375 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); | 1378 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); |
1376 | inL->setLastModified( modifiedCalendar ); | 1379 | inL->setLastModified( modifiedCalendar ); |
1377 | inR = inL->clone(); | 1380 | inR = inL->clone(); |
1378 | inR->setIDStr( ":" ); | 1381 | inR->setIDStr( ":" ); |
1379 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1382 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1380 | remote->addIncidence( inR ); | 1383 | remote->addIncidence( inR ); |
1381 | } | 1384 | } |
1382 | } | 1385 | } |
1383 | } else { | 1386 | } else { |
1384 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { | 1387 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { |
1385 | checkExternSyncEvent(eventLSyncSharp, inL); | 1388 | checkExternSyncEvent(eventLSyncSharp, inL); |
1386 | local->deleteIncidence( inL ); | 1389 | local->deleteIncidence( inL ); |
1387 | ++deletedEventL; | 1390 | ++deletedEventL; |
1388 | } else { | 1391 | } else { |
1389 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1392 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1390 | ++addedEventR; | 1393 | ++addedEventR; |
1391 | inL->setLastModified( modifiedCalendar ); | 1394 | inL->setLastModified( modifiedCalendar ); |
1392 | inR = inL->clone(); | 1395 | inR = inL->clone(); |
1393 | inR->setIDStr( ":" ); | 1396 | inR->setIDStr( ":" ); |
1394 | remote->addIncidence( inR ); | 1397 | remote->addIncidence( inR ); |
1395 | } | 1398 | } |
1396 | } | 1399 | } |
1397 | } | 1400 | } |
1398 | } else { | 1401 | } else { |
1399 | ++filteredOUT; | 1402 | ++filteredOUT; |
1400 | } | 1403 | } |
1401 | } | 1404 | } |
1402 | } | 1405 | } |
1403 | inL = el.next(); | 1406 | inL = el.next(); |
1404 | } | 1407 | } |
1405 | int delFut = 0; | 1408 | int delFut = 0; |
1406 | int remRem = 0; | 1409 | int remRem = 0; |
1407 | if ( mSyncManager->mWriteBackInFuture ) { | 1410 | if ( mSyncManager->mWriteBackInFuture ) { |
1408 | er = remote->rawIncidences(); | 1411 | er = remote->rawIncidences(); |
1409 | remRem = er.count(); | 1412 | remRem = er.count(); |
1410 | inR = er.first(); | 1413 | inR = er.first(); |
1411 | QDateTime dt; | 1414 | QDateTime dt; |
1412 | QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); | 1415 | QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); |
1413 | QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); | 1416 | QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); |
1414 | while ( inR ) { | 1417 | while ( inR ) { |
1415 | if ( inR->typeID() == todoID ) { | 1418 | if ( inR->typeID() == todoID ) { |
1416 | Todo * t = (Todo*)inR; | 1419 | Todo * t = (Todo*)inR; |
1417 | if ( t->hasDueDate() ) | 1420 | if ( t->hasDueDate() ) |
1418 | dt = t->dtDue(); | 1421 | dt = t->dtDue(); |
1419 | else | 1422 | else |
1420 | dt = cur.addSecs( 62 ); | 1423 | dt = cur.addSecs( 62 ); |
1421 | } | 1424 | } |
1422 | else if (inR->typeID() == eventID ) { | 1425 | else if (inR->typeID() == eventID ) { |
1423 | bool ok; | 1426 | bool ok; |
1424 | dt = inR->getNextOccurence( cur, &ok ); | 1427 | dt = inR->getNextOccurence( cur, &ok ); |
1425 | if ( !ok ) | 1428 | if ( !ok ) |
1426 | dt = cur.addSecs( -62 ); | 1429 | dt = cur.addSecs( -62 ); |
1427 | } | 1430 | } |
1428 | else | 1431 | else |
1429 | dt = inR->dtStart(); | 1432 | dt = inR->dtStart(); |
1430 | if ( dt < cur || dt > end ) { | 1433 | if ( dt < cur || dt > end ) { |
1431 | remote->deleteIncidence( inR ); | 1434 | remote->deleteIncidence( inR ); |
1432 | ++delFut; | 1435 | ++delFut; |
1433 | } | 1436 | } |
1434 | inR = er.next(); | 1437 | inR = er.next(); |
1435 | } | 1438 | } |
1436 | } | 1439 | } |
1437 | bar.hide(); | 1440 | bar.hide(); |
1438 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); | 1441 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); |
1439 | eventLSync->setReadOnly( false ); | 1442 | eventLSync->setReadOnly( false ); |
1440 | eventLSync->setDtStart( mLastCalendarSync ); | 1443 | eventLSync->setDtStart( mLastCalendarSync ); |
1441 | eventRSync->setDtStart( mLastCalendarSync ); | 1444 | eventRSync->setDtStart( mLastCalendarSync ); |
1442 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1445 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1443 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1446 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1444 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; | 1447 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; |
1445 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); | 1448 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); |
1446 | eventLSync->setReadOnly( true ); | 1449 | eventLSync->setReadOnly( true ); |
1447 | qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL ); | 1450 | qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL ); |
1448 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... | 1451 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... |
1449 | remote->addEvent( eventRSync ); | 1452 | remote->addEvent( eventRSync ); |
1450 | else | 1453 | else |
1451 | delete eventRSync; | 1454 | delete eventRSync; |
1452 | qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() ); | 1455 | qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() ); |
1453 | QString mes; | 1456 | QString mes; |
1454 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT ); | 1457 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT ); |
1455 | QString delmess; | 1458 | QString delmess; |
1456 | if ( delFut ) { | 1459 | if ( delFut ) { |
1457 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut); | 1460 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut); |
1458 | mes += delmess; | 1461 | mes += delmess; |
1459 | } | 1462 | } |
1460 | mes = i18n("Local calendar changed!\n") +mes; | 1463 | mes = i18n("Local calendar changed!\n") +mes; |
1461 | mCalendar->checkAlarmForIncidence( 0, true ); | 1464 | mCalendar->checkAlarmForIncidence( 0, true ); |
1462 | qDebug( mes ); | 1465 | qDebug( mes ); |
1463 | if ( mSyncManager->mShowSyncSummary ) { | 1466 | if ( mSyncManager->mShowSyncSummary ) { |
1464 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, | 1467 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, |
1465 | i18n("KO/Pi Synchronization"),i18n("Write back"))) { | 1468 | i18n("KO/Pi Synchronization"),i18n("Write back"))) { |
1466 | qDebug("KO: WB cancelled "); | 1469 | qDebug("KO: WB cancelled "); |
1467 | mSyncManager->mWriteBackFile = false; | 1470 | mSyncManager->mWriteBackFile = false; |
1468 | return syncOK; | 1471 | return syncOK; |
1469 | } | 1472 | } |
1470 | } | 1473 | } |
1471 | return syncOK; | 1474 | return syncOK; |
1472 | } | 1475 | } |
1473 | 1476 | ||
1474 | void CalendarView::setSyncDevice( QString s ) | 1477 | void CalendarView::setSyncDevice( QString s ) |
1475 | { | 1478 | { |
1476 | mCurrentSyncDevice= s; | 1479 | mCurrentSyncDevice= s; |
1477 | } | 1480 | } |
1478 | void CalendarView::setSyncName( QString s ) | 1481 | void CalendarView::setSyncName( QString s ) |
1479 | { | 1482 | { |
1480 | mCurrentSyncName= s; | 1483 | mCurrentSyncName= s; |
1481 | } | 1484 | } |
1482 | bool CalendarView::syncCalendar(QString filename, int mode) | 1485 | bool CalendarView::syncCalendar(QString filename, int mode) |
1483 | { | 1486 | { |
1484 | //qDebug("syncCalendar %s ", filename.latin1()); | 1487 | //qDebug("syncCalendar %s ", filename.latin1()); |
1485 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 1488 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
1486 | CalendarLocal* calendar = new CalendarLocal(); | 1489 | CalendarLocal* calendar = new CalendarLocal(); |
1487 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1490 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1488 | FileStorage* storage = new FileStorage( calendar ); | 1491 | FileStorage* storage = new FileStorage( calendar ); |
1489 | bool syncOK = false; | 1492 | bool syncOK = false; |
1490 | storage->setFileName( filename ); | 1493 | storage->setFileName( filename ); |
1491 | // qDebug("loading ... "); | 1494 | // qDebug("loading ... "); |
1492 | if ( storage->load() ) { | 1495 | if ( storage->load() ) { |
1493 | getEventViewerDialog()->setSyncMode( true ); | 1496 | getEventViewerDialog()->setSyncMode( true ); |
1494 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); | 1497 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); |
1495 | getEventViewerDialog()->setSyncMode( false ); | 1498 | getEventViewerDialog()->setSyncMode( false ); |
1496 | if ( syncOK ) { | 1499 | if ( syncOK ) { |
1497 | if ( mSyncManager->mWriteBackFile ) | 1500 | if ( mSyncManager->mWriteBackFile ) |
1498 | { | 1501 | { |
1499 | storage->setSaveFormat( new ICalFormat() ); | 1502 | storage->setSaveFormat( new ICalFormat() ); |
1500 | storage->save(); | 1503 | storage->save(); |
1501 | } | 1504 | } |
1502 | } | 1505 | } |
1503 | setModified( true ); | 1506 | setModified( true ); |
1504 | } | 1507 | } |
1505 | delete storage; | 1508 | delete storage; |
1506 | delete calendar; | 1509 | delete calendar; |
1507 | if ( syncOK ) | 1510 | if ( syncOK ) |
1508 | updateView(); | 1511 | updateView(); |
1509 | return syncOK; | 1512 | return syncOK; |
1510 | } | 1513 | } |
1511 | 1514 | ||
1512 | void CalendarView::syncExternal( int mode ) | 1515 | void CalendarView::syncExternal( int mode ) |
1513 | { | 1516 | { |
1514 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 1517 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
1515 | 1518 | ||
1516 | qApp->processEvents(); | 1519 | qApp->processEvents(); |
1517 | CalendarLocal* calendar = new CalendarLocal(); | 1520 | CalendarLocal* calendar = new CalendarLocal(); |
1518 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1521 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1519 | bool syncOK = false; | 1522 | bool syncOK = false; |
1520 | bool loadSuccess = false; | 1523 | bool loadSuccess = false; |
1521 | PhoneFormat* phoneFormat = 0; | 1524 | PhoneFormat* phoneFormat = 0; |
1522 | emit tempDisableBR(true); | 1525 | emit tempDisableBR(true); |
1523 | #ifndef DESKTOP_VERSION | 1526 | #ifndef DESKTOP_VERSION |
1524 | SharpFormat* sharpFormat = 0; | 1527 | SharpFormat* sharpFormat = 0; |
1525 | if ( mode == 0 ) { // sharp | 1528 | if ( mode == 0 ) { // sharp |
1526 | sharpFormat = new SharpFormat () ; | 1529 | sharpFormat = new SharpFormat () ; |
1527 | loadSuccess = sharpFormat->load( calendar, mCalendar ); | 1530 | loadSuccess = sharpFormat->load( calendar, mCalendar ); |
1528 | 1531 | ||
1529 | } else | 1532 | } else |
1530 | #endif | 1533 | #endif |
1531 | if ( mode == 1 ) { // phone | 1534 | if ( mode == 1 ) { // phone |
1532 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, | 1535 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, |
1533 | mSyncManager->mPhoneDevice, | 1536 | mSyncManager->mPhoneDevice, |
1534 | mSyncManager->mPhoneConnection, | 1537 | mSyncManager->mPhoneConnection, |
1535 | mSyncManager->mPhoneModel); | 1538 | mSyncManager->mPhoneModel); |
1536 | loadSuccess = phoneFormat->load( calendar,mCalendar); | 1539 | loadSuccess = phoneFormat->load( calendar,mCalendar); |
1537 | 1540 | ||
1538 | } else { | 1541 | } else { |
1539 | emit tempDisableBR(false); | 1542 | emit tempDisableBR(false); |
1540 | return; | 1543 | return; |
1541 | } | 1544 | } |
1542 | if ( loadSuccess ) { | 1545 | if ( loadSuccess ) { |
1543 | getEventViewerDialog()->setSyncMode( true ); | 1546 | getEventViewerDialog()->setSyncMode( true ); |
1544 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 1547 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1545 | getEventViewerDialog()->setSyncMode( false ); | 1548 | getEventViewerDialog()->setSyncMode( false ); |
1546 | qApp->processEvents(); | 1549 | qApp->processEvents(); |
1547 | if ( syncOK ) { | 1550 | if ( syncOK ) { |
1548 | if ( mSyncManager->mWriteBackFile ) | 1551 | if ( mSyncManager->mWriteBackFile ) |
1549 | { | 1552 | { |
1550 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); | 1553 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); |
1551 | Incidence* inc = iL.first(); | 1554 | Incidence* inc = iL.first(); |
1552 | if ( phoneFormat ) { | 1555 | if ( phoneFormat ) { |
1553 | while ( inc ) { | 1556 | while ( inc ) { |
1554 | inc->removeID(mCurrentSyncDevice); | 1557 | inc->removeID(mCurrentSyncDevice); |
1555 | inc = iL.next(); | 1558 | inc = iL.next(); |
1556 | } | 1559 | } |
1557 | } | 1560 | } |
1558 | #ifndef DESKTOP_VERSION | 1561 | #ifndef DESKTOP_VERSION |
1559 | if ( sharpFormat ) | 1562 | if ( sharpFormat ) |
1560 | sharpFormat->save(calendar); | 1563 | sharpFormat->save(calendar); |
1561 | #endif | 1564 | #endif |
1562 | if ( phoneFormat ) | 1565 | if ( phoneFormat ) |
1563 | phoneFormat->save(calendar); | 1566 | phoneFormat->save(calendar); |
1564 | iL = calendar->rawIncidences(); | 1567 | iL = calendar->rawIncidences(); |
1565 | inc = iL.first(); | 1568 | inc = iL.first(); |
1566 | Incidence* loc; | 1569 | Incidence* loc; |
1567 | while ( inc ) { | 1570 | while ( inc ) { |
1568 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { | 1571 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { |
1569 | loc = mCalendar->incidence(inc->uid() ); | 1572 | loc = mCalendar->incidence(inc->uid() ); |
1570 | if ( loc ) { | 1573 | if ( loc ) { |
1571 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); | 1574 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); |
1572 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); | 1575 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); |
1573 | } | 1576 | } |
1574 | } | 1577 | } |
1575 | inc = iL.next(); | 1578 | inc = iL.next(); |
1576 | } | 1579 | } |
1577 | Incidence* lse = getLastSyncEvent(); | 1580 | Incidence* lse = getLastSyncEvent(); |
1578 | if ( lse ) { | 1581 | if ( lse ) { |
1579 | lse->setReadOnly( false ); | 1582 | lse->setReadOnly( false ); |
1580 | lse->setDescription( "" ); | 1583 | lse->setDescription( "" ); |
1581 | lse->setReadOnly( true ); | 1584 | lse->setReadOnly( true ); |
1582 | } | 1585 | } |
1583 | } | 1586 | } |
1584 | } else { | 1587 | } else { |
1585 | topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); | 1588 | topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); |
1586 | } | 1589 | } |
1587 | setModified( true ); | 1590 | setModified( true ); |
1588 | } else { | 1591 | } else { |
1589 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; | 1592 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; |
1590 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), | 1593 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), |
1591 | question, i18n("Ok")) ; | 1594 | question, i18n("Ok")) ; |
1592 | 1595 | ||
1593 | } | 1596 | } |
1594 | delete calendar; | 1597 | delete calendar; |
1595 | updateView(); | 1598 | updateView(); |
1596 | emit tempDisableBR(false); | 1599 | emit tempDisableBR(false); |
1597 | return ;//syncOK; | 1600 | return ;//syncOK; |
1598 | 1601 | ||
1599 | } | 1602 | } |
1600 | 1603 | ||
1601 | bool CalendarView::importBday() | 1604 | bool CalendarView::importBday() |
1602 | { | 1605 | { |
1603 | #ifndef KORG_NOKABC | 1606 | #ifndef KORG_NOKABC |
1604 | 1607 | ||
1605 | #ifdef DESKTOP_VERSION | 1608 | #ifdef DESKTOP_VERSION |
1606 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 1609 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
1607 | KABC::AddressBook::Iterator it; | 1610 | KABC::AddressBook::Iterator it; |
1608 | int count = 0; | 1611 | int count = 0; |
1609 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1612 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1610 | ++count; | 1613 | ++count; |
1611 | } | 1614 | } |
1612 | QProgressBar bar(count,0 ); | 1615 | QProgressBar bar(count,0 ); |
1613 | int w = 300; | 1616 | int w = 300; |
1614 | if ( QApplication::desktop()->width() < 320 ) | 1617 | if ( QApplication::desktop()->width() < 320 ) |
1615 | w = 220; | 1618 | w = 220; |
1616 | int h = bar.sizeHint().height() ; | 1619 | int h = bar.sizeHint().height() ; |
1617 | int dw = QApplication::desktop()->width(); | 1620 | int dw = QApplication::desktop()->width(); |
1618 | int dh = QApplication::desktop()->height(); | 1621 | int dh = QApplication::desktop()->height(); |
1619 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1622 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1620 | bar.show(); | 1623 | bar.show(); |
1621 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); | 1624 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); |
1622 | qApp->processEvents(); | 1625 | qApp->processEvents(); |
1623 | count = 0; | 1626 | count = 0; |
1624 | int addCount = 0; | 1627 | int addCount = 0; |
1625 | KCal::Attendee* a = 0; | 1628 | KCal::Attendee* a = 0; |
1626 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1629 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1627 | if ( ! bar.isVisible() ) | 1630 | if ( ! bar.isVisible() ) |
1628 | return false; | 1631 | return false; |
1629 | bar.setProgress( count++ ); | 1632 | bar.setProgress( count++ ); |
1630 | qApp->processEvents(); | 1633 | qApp->processEvents(); |
1631 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); | 1634 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); |
1632 | if ( (*it).birthday().date().isValid() ){ | 1635 | if ( (*it).birthday().date().isValid() ){ |
1633 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1636 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1634 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) | 1637 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) |
1635 | ++addCount; | 1638 | ++addCount; |
1636 | } | 1639 | } |
1637 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); | 1640 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); |
1638 | if ( anni.isValid() ){ | 1641 | if ( anni.isValid() ){ |
1639 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1642 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1640 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) | 1643 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) |
1641 | ++addCount; | 1644 | ++addCount; |
1642 | } | 1645 | } |
1643 | } | 1646 | } |
1644 | updateView(); | 1647 | updateView(); |
1645 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1648 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1646 | #else //DESKTOP_VERSION | 1649 | #else //DESKTOP_VERSION |
1647 | 1650 | ||
1648 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 1651 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
1649 | // the result should now arrive through method insertBirthdays | 1652 | // the result should now arrive through method insertBirthdays |
1650 | 1653 | ||
1651 | #endif //DESKTOP_VERSION | 1654 | #endif //DESKTOP_VERSION |
1652 | 1655 | ||
1653 | #endif //KORG_NOKABC | 1656 | #endif //KORG_NOKABC |
1654 | 1657 | ||
1655 | 1658 | ||
1656 | return true; | 1659 | return true; |
1657 | } | 1660 | } |
1658 | 1661 | ||
1659 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI | 1662 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI |
1660 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, | 1663 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, |
1661 | const QStringList& anniversaryList, const QStringList& realNameList, | 1664 | const QStringList& anniversaryList, const QStringList& realNameList, |
1662 | const QStringList& emailList, const QStringList& assembledNameList, | 1665 | const QStringList& emailList, const QStringList& assembledNameList, |
1663 | const QStringList& uidList) | 1666 | const QStringList& uidList) |
1664 | { | 1667 | { |
1665 | //qDebug("KO::CalendarView::insertBirthdays"); | 1668 | //qDebug("KO::CalendarView::insertBirthdays"); |
1666 | if (uid == this->name()) | 1669 | if (uid == this->name()) |
1667 | { | 1670 | { |
1668 | int count = birthdayList.count(); | 1671 | int count = birthdayList.count(); |
1669 | int addCount = 0; | 1672 | int addCount = 0; |
1670 | KCal::Attendee* a = 0; | 1673 | KCal::Attendee* a = 0; |
1671 | 1674 | ||
1672 | //qDebug("CalView 1 %i", count); | 1675 | //qDebug("CalView 1 %i", count); |
1673 | 1676 | ||
1674 | QProgressBar bar(count,0 ); | 1677 | QProgressBar bar(count,0 ); |
1675 | int w = 300; | 1678 | int w = 300; |
1676 | if ( QApplication::desktop()->width() < 320 ) | 1679 | if ( QApplication::desktop()->width() < 320 ) |
1677 | w = 220; | 1680 | w = 220; |
1678 | int h = bar.sizeHint().height() ; | 1681 | int h = bar.sizeHint().height() ; |
1679 | int dw = QApplication::desktop()->width(); | 1682 | int dw = QApplication::desktop()->width(); |
1680 | int dh = QApplication::desktop()->height(); | 1683 | int dh = QApplication::desktop()->height(); |
1681 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1684 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1682 | bar.show(); | 1685 | bar.show(); |
1683 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); | 1686 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); |
1684 | qApp->processEvents(); | 1687 | qApp->processEvents(); |
1685 | 1688 | ||
1686 | QDate birthday; | 1689 | QDate birthday; |
1687 | QDate anniversary; | 1690 | QDate anniversary; |
1688 | QString realName; | 1691 | QString realName; |
1689 | QString email; | 1692 | QString email; |
1690 | QString assembledName; | 1693 | QString assembledName; |
1691 | QString uid; | 1694 | QString uid; |
1692 | bool ok = true; | 1695 | bool ok = true; |
1693 | for ( int i = 0; i < count; i++) | 1696 | for ( int i = 0; i < count; i++) |
1694 | { | 1697 | { |
1695 | if ( ! bar.isVisible() ) | 1698 | if ( ! bar.isVisible() ) |
1696 | return; | 1699 | return; |
1697 | bar.setProgress( i ); | 1700 | bar.setProgress( i ); |
1698 | qApp->processEvents(); | 1701 | qApp->processEvents(); |
1699 | 1702 | ||
1700 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); | 1703 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); |
1701 | if (!ok) { | 1704 | if (!ok) { |
1702 | ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); | 1705 | ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); |
1703 | } | 1706 | } |
1704 | 1707 | ||
1705 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); | 1708 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); |
1706 | if (!ok) { | 1709 | if (!ok) { |
1707 | ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); | 1710 | ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); |
1708 | } | 1711 | } |
1709 | realName = realNameList[i]; | 1712 | realName = realNameList[i]; |
1710 | email = emailList[i]; | 1713 | email = emailList[i]; |
1711 | assembledName = assembledNameList[i]; | 1714 | assembledName = assembledNameList[i]; |
1712 | uid = uidList[i]; | 1715 | uid = uidList[i]; |
1713 | //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); | 1716 | //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); |
1714 | 1717 | ||
1715 | if ( birthday.isValid() ){ | 1718 | if ( birthday.isValid() ){ |
1716 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1719 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, |
1717 | KCal::Attendee::ReqParticipant,uid) ; | 1720 | KCal::Attendee::ReqParticipant,uid) ; |
1718 | if ( addAnniversary( birthday, assembledName, a, true ) ) | 1721 | if ( addAnniversary( birthday, assembledName, a, true ) ) |
1719 | ++addCount; | 1722 | ++addCount; |
1720 | } | 1723 | } |
1721 | 1724 | ||
1722 | if ( anniversary.isValid() ){ | 1725 | if ( anniversary.isValid() ){ |
1723 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1726 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, |
1724 | KCal::Attendee::ReqParticipant,uid) ; | 1727 | KCal::Attendee::ReqParticipant,uid) ; |
1725 | if ( addAnniversary( anniversary, assembledName, a, false ) ) | 1728 | if ( addAnniversary( anniversary, assembledName, a, false ) ) |
1726 | ++addCount; | 1729 | ++addCount; |
1727 | } | 1730 | } |
1728 | } | 1731 | } |
1729 | 1732 | ||
1730 | updateView(); | 1733 | updateView(); |
1731 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1734 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1732 | 1735 | ||
1733 | } | 1736 | } |
1734 | 1737 | ||
1735 | } | 1738 | } |
1736 | 1739 | ||
1737 | 1740 | ||
1738 | 1741 | ||
1739 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) | 1742 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) |
1740 | { | 1743 | { |
1741 | //qDebug("addAnni "); | 1744 | //qDebug("addAnni "); |
1742 | Event * ev = new Event(); | 1745 | Event * ev = new Event(); |
1743 | ev->setOrganizer(KOPrefs::instance()->email()); | 1746 | ev->setOrganizer(KOPrefs::instance()->email()); |
1744 | if ( a ) { | 1747 | if ( a ) { |
1745 | ev->addAttendee( a ); | 1748 | ev->addAttendee( a ); |
1746 | } | 1749 | } |
1747 | QString kind; | 1750 | QString kind; |
1748 | if ( birthday ) { | 1751 | if ( birthday ) { |
1749 | kind = i18n( "Birthday" ); | 1752 | kind = i18n( "Birthday" ); |
1750 | ev->setSummary( name + " (" + QString::number(date.year()) +")"); | 1753 | ev->setSummary( name + " (" + QString::number(date.year()) +")"); |
1751 | } | 1754 | } |
1752 | else { | 1755 | else { |
1753 | kind = i18n( "Anniversary" ); | 1756 | kind = i18n( "Anniversary" ); |
1754 | ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); | 1757 | ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); |
1755 | } | 1758 | } |
1756 | ev->setCategories( kind ); | 1759 | ev->setCategories( kind ); |
1757 | ev->setDtStart( QDateTime(date) ); | 1760 | ev->setDtStart( QDateTime(date) ); |
1758 | ev->setDtEnd( QDateTime(date) ); | 1761 | ev->setDtEnd( QDateTime(date) ); |
1759 | ev->setFloats( true ); | 1762 | ev->setFloats( true ); |
1760 | Recurrence * rec = ev->recurrence(); | 1763 | Recurrence * rec = ev->recurrence(); |
1761 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); | 1764 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); |
1762 | rec->addYearlyNum( date.month() ); | 1765 | rec->addYearlyNum( date.month() ); |
1763 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { | 1766 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { |
1764 | delete ev; | 1767 | delete ev; |
1765 | return false; | 1768 | return false; |
1766 | } | 1769 | } |
1767 | return true; | 1770 | return true; |
1768 | 1771 | ||
1769 | } | 1772 | } |
1770 | bool CalendarView::importQtopia( const QString &categories, | 1773 | bool CalendarView::importQtopia( const QString &categories, |
1771 | const QString &datebook, | 1774 | const QString &datebook, |
1772 | const QString &todolist ) | 1775 | const QString &todolist ) |
1773 | { | 1776 | { |
1774 | 1777 | ||
1775 | QtopiaFormat qtopiaFormat; | 1778 | QtopiaFormat qtopiaFormat; |
1776 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1779 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1777 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); | 1780 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); |
1778 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); | 1781 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); |
1779 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); | 1782 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); |
1780 | 1783 | ||
1781 | updateView(); | 1784 | updateView(); |
1782 | return true; | 1785 | return true; |
1783 | 1786 | ||
1784 | #if 0 | 1787 | #if 0 |
1785 | mGlobalSyncMode = SYNC_MODE_QTOPIA; | 1788 | mGlobalSyncMode = SYNC_MODE_QTOPIA; |
1786 | mCurrentSyncDevice = "qtopia-XML"; | 1789 | mCurrentSyncDevice = "qtopia-XML"; |
1787 | if ( mSyncManager->mAskForPreferences ) | 1790 | if ( mSyncManager->mAskForPreferences ) |
1788 | edit_sync_options(); | 1791 | edit_sync_options(); |
1789 | qApp->processEvents(); | 1792 | qApp->processEvents(); |
1790 | CalendarLocal* calendar = new CalendarLocal(); | 1793 | CalendarLocal* calendar = new CalendarLocal(); |
1791 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1794 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1792 | bool syncOK = false; | 1795 | bool syncOK = false; |
1793 | QtopiaFormat qtopiaFormat; | 1796 | QtopiaFormat qtopiaFormat; |
1794 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1797 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1795 | bool loadOk = true; | 1798 | bool loadOk = true; |
1796 | if ( !categories.isEmpty() ) | 1799 | if ( !categories.isEmpty() ) |
1797 | loadOk = qtopiaFormat.load( calendar, categories ); | 1800 | loadOk = qtopiaFormat.load( calendar, categories ); |
1798 | if ( loadOk && !datebook.isEmpty() ) | 1801 | if ( loadOk && !datebook.isEmpty() ) |
1799 | loadOk = qtopiaFormat.load( calendar, datebook ); | 1802 | loadOk = qtopiaFormat.load( calendar, datebook ); |
1800 | if ( loadOk && !todolist.isEmpty() ) | 1803 | if ( loadOk && !todolist.isEmpty() ) |
1801 | loadOk = qtopiaFormat.load( calendar, todolist ); | 1804 | loadOk = qtopiaFormat.load( calendar, todolist ); |
1802 | 1805 | ||
1803 | if ( loadOk ) { | 1806 | if ( loadOk ) { |
1804 | getEventViewerDialog()->setSyncMode( true ); | 1807 | getEventViewerDialog()->setSyncMode( true ); |
1805 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 1808 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1806 | getEventViewerDialog()->setSyncMode( false ); | 1809 | getEventViewerDialog()->setSyncMode( false ); |
1807 | qApp->processEvents(); | 1810 | qApp->processEvents(); |
1808 | if ( syncOK ) { | 1811 | if ( syncOK ) { |
1809 | if ( mSyncManager->mWriteBackFile ) | 1812 | if ( mSyncManager->mWriteBackFile ) |
1810 | { | 1813 | { |
1811 | // write back XML file | 1814 | // write back XML file |
1812 | 1815 | ||
1813 | } | 1816 | } |
1814 | setModified( true ); | 1817 | setModified( true ); |
1815 | } | 1818 | } |
1816 | } else { | 1819 | } else { |
1817 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; | 1820 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; |
1818 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), | 1821 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), |
1819 | question, i18n("Ok")) ; | 1822 | question, i18n("Ok")) ; |
1820 | } | 1823 | } |
1821 | delete calendar; | 1824 | delete calendar; |
1822 | updateView(); | 1825 | updateView(); |
1823 | return syncOK; | 1826 | return syncOK; |
1824 | 1827 | ||
1825 | 1828 | ||
1826 | #endif | 1829 | #endif |
1827 | 1830 | ||
1828 | } | 1831 | } |
1829 | 1832 | ||
1830 | void CalendarView::setSyncEventsReadOnly() | 1833 | void CalendarView::setSyncEventsReadOnly() |
1831 | { | 1834 | { |
1832 | Event * ev; | 1835 | Event * ev; |
1833 | QPtrList<Event> eL = mCalendar->rawEvents(); | 1836 | QPtrList<Event> eL = mCalendar->rawEvents(); |
1834 | ev = eL.first(); | 1837 | ev = eL.first(); |
1835 | while ( ev ) { | 1838 | while ( ev ) { |
1836 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) | 1839 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) |
1837 | ev->setReadOnly( true ); | 1840 | ev->setReadOnly( true ); |
1838 | ev = eL.next(); | 1841 | ev = eL.next(); |
1839 | } | 1842 | } |
1840 | } | 1843 | } |
1841 | 1844 | ||
1842 | bool CalendarView::loadCalendars() | 1845 | bool CalendarView::loadCalendars() |
1843 | { | 1846 | { |
1844 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 1847 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
1845 | KopiCalendarFile * cal = calendars.first(); | 1848 | KopiCalendarFile * cal = calendars.first(); |
1846 | mCalendar->setDefaultCalendar( 1 ); | 1849 | mCalendar->setDefaultCalendar( 1 ); |
1847 | openCalendar( MainWindow::defaultFileName(), false ); | 1850 | openCalendar( MainWindow::defaultFileName(), false ); |
1848 | cal = calendars.next(); | 1851 | cal = calendars.next(); |
1849 | while ( cal ) { | 1852 | while ( cal ) { |
1850 | addCalendar( cal ); | 1853 | addCalendar( cal ); |
1851 | cal = calendars.next(); | 1854 | cal = calendars.next(); |
1852 | } | 1855 | } |
1853 | restoreCalendarSettings(); | 1856 | restoreCalendarSettings(); |
1854 | mCalendar->reInitAlarmSettings(); | 1857 | mCalendar->reInitAlarmSettings(); |
1855 | setSyncEventsReadOnly(); | 1858 | setSyncEventsReadOnly(); |
1856 | updateUnmanagedViews(); | 1859 | updateUnmanagedViews(); |
1857 | updateView(); | 1860 | updateView(); |
1858 | } | 1861 | } |
1859 | bool CalendarView::restoreCalendarSettings() | 1862 | bool CalendarView::restoreCalendarSettings() |
1860 | { | 1863 | { |
1861 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 1864 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
1862 | KopiCalendarFile * cal = calendars.first(); | 1865 | KopiCalendarFile * cal = calendars.first(); |
1863 | while ( cal ) { | 1866 | while ( cal ) { |
1864 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); | 1867 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); |
1865 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); | 1868 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); |
1866 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); | 1869 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); |
1867 | if ( cal->isStandard ) | 1870 | if ( cal->isStandard ) |
1868 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | 1871 | mCalendar->setDefaultCalendar( cal->mCalNumber ); |
1869 | cal = calendars.next(); | 1872 | cal = calendars.next(); |
1870 | } | 1873 | } |
1871 | } | 1874 | } |
1875 | void CalendarView::addCalendarId( int id ) | ||
1876 | { | ||
1877 | KopiCalendarFile * cal = KOPrefs::instance()->getCalendar( id ); | ||
1878 | addCalendar( cal ); | ||
1879 | } | ||
1872 | bool CalendarView::addCalendar( KopiCalendarFile * cal ) | 1880 | bool CalendarView::addCalendar( KopiCalendarFile * cal ) |
1873 | { | 1881 | { |
1874 | 1882 | ||
1875 | if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) | 1883 | if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) |
1876 | return true; | 1884 | return true; |
1877 | qDebug("KO: Error adding calendar file %1 ",cal->mFileName.latin1() ); | 1885 | qDebug("KO: Error adding calendar file %1 ",cal->mFileName.latin1() ); |
1878 | KMessageBox::error(this,i18n("Error loading calendar file\n%1.").arg(cal->mFileName)); | 1886 | KMessageBox::error(this,i18n("Error loading calendar file\n%1.").arg(cal->mFileName)); |
1879 | return false; | 1887 | return false; |
1880 | } | 1888 | } |
1881 | bool CalendarView::openCalendar(QString filename, bool merge) | 1889 | bool CalendarView::openCalendar(QString filename, bool merge) |
1882 | { | 1890 | { |
1883 | 1891 | ||
1884 | if (filename.isEmpty()) { | 1892 | if (filename.isEmpty()) { |
1885 | return false; | 1893 | return false; |
1886 | } | 1894 | } |
1887 | 1895 | ||
1888 | if (!QFile::exists(filename)) { | 1896 | if (!QFile::exists(filename)) { |
1889 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); | 1897 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); |
1890 | return false; | 1898 | return false; |
1891 | } | 1899 | } |
1892 | 1900 | ||
1893 | globalFlagBlockAgenda = 1; | 1901 | globalFlagBlockAgenda = 1; |
1894 | clearAllViews(); | 1902 | clearAllViews(); |
1895 | if (!merge) { | 1903 | if (!merge) { |
1896 | mViewManager->setDocumentId( filename ); | 1904 | mViewManager->setDocumentId( filename ); |
1897 | mCalendar->close(); | 1905 | mCalendar->close(); |
1898 | } | 1906 | } |
1899 | mStorage->setFileName( filename ); | 1907 | mStorage->setFileName( filename ); |
1900 | 1908 | ||
1901 | if ( mStorage->load() ) { | 1909 | if ( mStorage->load() ) { |
1902 | if ( merge ) ;//setModified( true ); | 1910 | if ( merge ) ;//setModified( true ); |
1903 | else { | 1911 | else { |
1904 | //setModified( true ); | 1912 | //setModified( true ); |
1905 | mViewManager->setDocumentId( filename ); | 1913 | mViewManager->setDocumentId( filename ); |
1906 | mDialogManager->setDocumentId( filename ); | 1914 | mDialogManager->setDocumentId( filename ); |
1907 | mTodoList->setDocumentId( filename ); | 1915 | mTodoList->setDocumentId( filename ); |
1908 | } | 1916 | } |
1909 | globalFlagBlockAgenda = 2; | 1917 | globalFlagBlockAgenda = 2; |
1910 | // if ( getLastSyncEvent() ) | 1918 | // if ( getLastSyncEvent() ) |
1911 | // getLastSyncEvent()->setReadOnly( true ); | 1919 | // getLastSyncEvent()->setReadOnly( true ); |
1912 | mCalendar->reInitAlarmSettings(); | 1920 | mCalendar->reInitAlarmSettings(); |
1913 | setSyncEventsReadOnly(); | 1921 | setSyncEventsReadOnly(); |
1914 | updateUnmanagedViews(); | 1922 | updateUnmanagedViews(); |
1915 | updateView(); | 1923 | updateView(); |
1916 | if ( filename != MainWindow::defaultFileName() ) { | 1924 | if ( filename != MainWindow::defaultFileName() ) { |
1917 | saveCalendar( MainWindow::defaultFileName() ); | 1925 | saveCalendar( MainWindow::defaultFileName() ); |
1918 | } else { | 1926 | } else { |
1919 | QFileInfo finf ( MainWindow::defaultFileName()); | 1927 | QFileInfo finf ( MainWindow::defaultFileName()); |
1920 | if ( finf.exists() ) { | 1928 | if ( finf.exists() ) { |
1921 | setLoadedFileVersion( finf.lastModified () ); | 1929 | setLoadedFileVersion( finf.lastModified () ); |
1922 | } | 1930 | } |
1923 | } | 1931 | } |
1924 | return true; | 1932 | return true; |
1925 | } else { | 1933 | } else { |
1926 | // while failing to load, the calendar object could | 1934 | // while failing to load, the calendar object could |
1927 | // have become partially populated. Clear it out. | 1935 | // have become partially populated. Clear it out. |
1928 | if ( !merge ) { | 1936 | if ( !merge ) { |
1929 | mCalendar->close(); | 1937 | mCalendar->close(); |
1930 | mViewManager->setDocumentId( filename ); | 1938 | mViewManager->setDocumentId( filename ); |
1931 | mDialogManager->setDocumentId( filename ); | 1939 | mDialogManager->setDocumentId( filename ); |
1932 | mTodoList->setDocumentId( filename ); | 1940 | mTodoList->setDocumentId( filename ); |
1933 | } | 1941 | } |
1934 | 1942 | ||
1935 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 1943 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
1936 | 1944 | ||
1937 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); | 1945 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); |
1938 | globalFlagBlockAgenda = 2; | 1946 | globalFlagBlockAgenda = 2; |
1939 | mCalendar->reInitAlarmSettings(); | 1947 | mCalendar->reInitAlarmSettings(); |
1940 | setSyncEventsReadOnly(); | 1948 | setSyncEventsReadOnly(); |
1941 | updateUnmanagedViews(); | 1949 | updateUnmanagedViews(); |
1942 | updateView(); | 1950 | updateView(); |
1943 | } | 1951 | } |
1944 | return false; | 1952 | return false; |
1945 | } | 1953 | } |
1946 | void CalendarView::showOpenError() | 1954 | void CalendarView::showOpenError() |
1947 | { | 1955 | { |
1948 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); | 1956 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); |
1949 | } | 1957 | } |
1950 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 1958 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
1951 | { | 1959 | { |
1952 | loadedFileVersion = dt; | 1960 | loadedFileVersion = dt; |
1953 | } | 1961 | } |
1954 | bool CalendarView::checkFileChanged(QString fn) | 1962 | bool CalendarView::checkFileChanged(QString fn) |
1955 | { | 1963 | { |
1956 | QFileInfo finf ( fn ); | 1964 | QFileInfo finf ( fn ); |
1957 | if ( !finf.exists() ) | 1965 | if ( !finf.exists() ) |
1958 | return true; | 1966 | return true; |
1959 | QDateTime dt = finf.lastModified (); | 1967 | QDateTime dt = finf.lastModified (); |
1960 | if ( dt <= loadedFileVersion ) | 1968 | if ( dt <= loadedFileVersion ) |
1961 | return false; | 1969 | return false; |
1962 | return true; | 1970 | return true; |
1963 | 1971 | ||
1964 | } | 1972 | } |
1965 | void CalendarView::watchSavedFile() | 1973 | void CalendarView::watchSavedFile() |
1966 | { | 1974 | { |
1967 | QFileInfo finf ( MainWindow::defaultFileName()); | 1975 | QFileInfo finf ( MainWindow::defaultFileName()); |
1968 | if ( !finf.exists() ) | 1976 | if ( !finf.exists() ) |
1969 | return; | 1977 | return; |
1970 | QDateTime dt = finf.lastModified (); | 1978 | QDateTime dt = finf.lastModified (); |
1971 | if ( dt < loadedFileVersion ) { | 1979 | if ( dt < loadedFileVersion ) { |
1972 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); | 1980 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); |
1973 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); | 1981 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); |
1974 | return; | 1982 | return; |
1975 | } | 1983 | } |
1976 | loadedFileVersion = dt; | 1984 | loadedFileVersion = dt; |
1977 | } | 1985 | } |
1978 | 1986 | ||
1979 | bool CalendarView::checkFileVersion(QString fn) | 1987 | bool CalendarView::checkFileVersion(QString fn) |
1980 | { | 1988 | { |
1981 | QFileInfo finf ( fn ); | 1989 | QFileInfo finf ( fn ); |
1982 | if ( !finf.exists() ) | 1990 | if ( !finf.exists() ) |
1983 | return true; | 1991 | return true; |
1984 | QDateTime dt = finf.lastModified (); | 1992 | QDateTime dt = finf.lastModified (); |
1985 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); | 1993 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); |
1986 | //qDebug("file on disk version %s",dt.toString().latin1()); | 1994 | //qDebug("file on disk version %s",dt.toString().latin1()); |
1987 | if ( dt <= loadedFileVersion ) | 1995 | if ( dt <= loadedFileVersion ) |
1988 | return true; | 1996 | return true; |
1989 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , | 1997 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , |
1990 | i18n("KO/Pi Warning"),i18n("Overwrite"), | 1998 | i18n("KO/Pi Warning"),i18n("Overwrite"), |
1991 | i18n("Sync+save")); | 1999 | i18n("Sync+save")); |
1992 | 2000 | ||
1993 | if ( km == KMessageBox::Cancel ) | 2001 | if ( km == KMessageBox::Cancel ) |
1994 | return false; | 2002 | return false; |
1995 | if ( km == KMessageBox::Yes ) | 2003 | if ( km == KMessageBox::Yes ) |
1996 | return true; | 2004 | return true; |
1997 | 2005 | ||
1998 | setSyncDevice("deleteaftersync" ); | 2006 | setSyncDevice("deleteaftersync" ); |
1999 | mSyncManager->mAskForPreferences = true; | 2007 | mSyncManager->mAskForPreferences = true; |
2000 | mSyncManager->mSyncAlgoPrefs = 3; | 2008 | mSyncManager->mSyncAlgoPrefs = 3; |
2001 | mSyncManager->mWriteBackFile = false; | 2009 | mSyncManager->mWriteBackFile = false; |
2002 | mSyncManager->mWriteBackExistingOnly = false; | 2010 | mSyncManager->mWriteBackExistingOnly = false; |
2003 | mSyncManager->mShowSyncSummary = false; | 2011 | mSyncManager->mShowSyncSummary = false; |
2004 | syncCalendar( fn, 3 ); | 2012 | syncCalendar( fn, 3 ); |
2005 | Event * e = getLastSyncEvent(); | 2013 | Event * e = getLastSyncEvent(); |
2006 | if ( e ) | 2014 | if ( e ) |
2007 | deleteEvent ( e ); | 2015 | deleteEvent ( e ); |
2008 | updateView(); | 2016 | updateView(); |
2009 | return true; | 2017 | return true; |
2010 | } | 2018 | } |
2011 | bool CalendarView::saveCalendars() | 2019 | bool CalendarView::saveCalendars() |
2012 | { | 2020 | { |
2013 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 2021 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
2014 | KopiCalendarFile * cal = calendars.first(); | 2022 | KopiCalendarFile * cal = calendars.first(); |
2015 | mCalendar->setDefaultCalendar( 1 ); | 2023 | mCalendar->setDefaultCalendar( 1 ); |
2016 | mCalendar->setDefaultCalendarEnabledOnly(); | 2024 | mCalendar->setDefaultCalendarEnabledOnly(); |
2017 | saveCalendar( MainWindow::defaultFileName() ); | 2025 | saveCalendar( MainWindow::defaultFileName() ); |
2018 | cal = calendars.next(); | 2026 | cal = calendars.next(); |
2019 | while ( cal ) { | 2027 | while ( cal ) { |
2020 | if ( !cal->isReadOnly ) { | 2028 | if ( !cal->isReadOnly ) { |
2021 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | 2029 | mCalendar->setDefaultCalendar( cal->mCalNumber ); |
2022 | mCalendar->setDefaultCalendarEnabledOnly(); | 2030 | mCalendar->setDefaultCalendarEnabledOnly(); |
2023 | saveCalendar( cal->mFileName ); | 2031 | saveCalendar( cal->mFileName ); |
2024 | } | 2032 | } |
2025 | cal = calendars.next(); | 2033 | cal = calendars.next(); |
2026 | } | 2034 | } |
2027 | restoreCalendarSettings(); | 2035 | restoreCalendarSettings(); |
2028 | } | 2036 | } |
2029 | bool CalendarView::saveCalendar( QString filename ) | 2037 | bool CalendarView::saveCalendar( QString filename ) |
2030 | { | 2038 | { |
2031 | 2039 | ||
2032 | // Store back all unsaved data into calendar object | 2040 | // Store back all unsaved data into calendar object |
2033 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); | 2041 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); |
2034 | if ( mViewManager->currentView() ) | 2042 | if ( mViewManager->currentView() ) |
2035 | mViewManager->currentView()->flushView(); | 2043 | mViewManager->currentView()->flushView(); |
2036 | 2044 | ||
2037 | 2045 | ||
2038 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); | 2046 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); |
2039 | mStorage->setSaveFormat( new ICalFormat() ); | 2047 | mStorage->setSaveFormat( new ICalFormat() ); |
2040 | mStorage->setFileName( filename ); | 2048 | mStorage->setFileName( filename ); |
2041 | bool success; | 2049 | bool success; |
2042 | success = mStorage->save(); | 2050 | success = mStorage->save(); |
2043 | if ( !success ) { | 2051 | if ( !success ) { |
2044 | return false; | 2052 | return false; |
2045 | } | 2053 | } |
2046 | if ( filename == MainWindow::defaultFileName() ) { | 2054 | if ( filename == MainWindow::defaultFileName() ) { |
2047 | setLoadedFileVersion( lfv ); | 2055 | setLoadedFileVersion( lfv ); |
2048 | watchSavedFile(); | 2056 | watchSavedFile(); |
2049 | } | 2057 | } |
2050 | return true; | 2058 | return true; |
2051 | } | 2059 | } |
2052 | 2060 | ||
2053 | void CalendarView::closeCalendar() | 2061 | void CalendarView::closeCalendar() |
2054 | { | 2062 | { |
2055 | 2063 | ||
2056 | // child windows no longer valid | 2064 | // child windows no longer valid |
2057 | clearAllViews(); | 2065 | clearAllViews(); |
2058 | emit closingDown(); | 2066 | emit closingDown(); |
2059 | 2067 | ||
2060 | mCalendar->close(); | 2068 | mCalendar->close(); |
2061 | setModified(false); | 2069 | setModified(false); |
2062 | updateView(); | 2070 | updateView(); |
2063 | } | 2071 | } |
2064 | 2072 | ||
2065 | void CalendarView::archiveCalendar() | 2073 | void CalendarView::archiveCalendar() |
2066 | { | 2074 | { |
2067 | mDialogManager->showArchiveDialog(); | 2075 | mDialogManager->showArchiveDialog(); |
2068 | } | 2076 | } |
2069 | 2077 | ||
2070 | 2078 | ||
2071 | void CalendarView::readSettings() | 2079 | void CalendarView::readSettings() |
2072 | { | 2080 | { |
2073 | 2081 | ||
2074 | 2082 | ||
2075 | // mViewManager->showAgendaView(); | 2083 | // mViewManager->showAgendaView(); |
2076 | QString str; | 2084 | QString str; |
2077 | //qDebug("CalendarView::readSettings() "); | 2085 | //qDebug("CalendarView::readSettings() "); |
2078 | // read settings from the KConfig, supplying reasonable | 2086 | // read settings from the KConfig, supplying reasonable |
2079 | // defaults where none are to be found | 2087 | // defaults where none are to be found |
2080 | KConfig *config = KOGlobals::config(); | 2088 | KConfig *config = KOGlobals::config(); |
2081 | #ifndef KORG_NOSPLITTER | 2089 | #ifndef KORG_NOSPLITTER |
2082 | config->setGroup("KOrganizer Geometry"); | 2090 | config->setGroup("KOrganizer Geometry"); |
2083 | 2091 | ||
2084 | QValueList<int> sizes = config->readIntListEntry("Separator1"); | 2092 | QValueList<int> sizes = config->readIntListEntry("Separator1"); |
2085 | if (sizes.count() != 2) { | 2093 | if (sizes.count() != 2) { |
2086 | sizes << mDateNavigator->minimumSizeHint().width(); | 2094 | sizes << mDateNavigator->minimumSizeHint().width(); |
2087 | sizes << 300; | 2095 | sizes << 300; |
2088 | } | 2096 | } |
2089 | mPanner->setSizes(sizes); | 2097 | mPanner->setSizes(sizes); |
2090 | 2098 | ||
2091 | sizes = config->readIntListEntry("Separator2"); | 2099 | sizes = config->readIntListEntry("Separator2"); |
2092 | if ( ( mResourceView && sizes.count() == 4 ) || | 2100 | if ( ( mResourceView && sizes.count() == 4 ) || |
2093 | ( !mResourceView && sizes.count() == 3 ) ) { | 2101 | ( !mResourceView && sizes.count() == 3 ) ) { |
2094 | mLeftSplitter->setSizes(sizes); | 2102 | mLeftSplitter->setSizes(sizes); |
2095 | } | 2103 | } |
2096 | #endif | 2104 | #endif |
2097 | globalFlagBlockAgenda = 1; | 2105 | globalFlagBlockAgenda = 1; |
2098 | mViewManager->showAgendaView(); | 2106 | mViewManager->showAgendaView(); |
2099 | //mViewManager->readSettings( config ); | 2107 | //mViewManager->readSettings( config ); |
2100 | mTodoList->restoreLayout(config,QString("Todo Layout")); | 2108 | mTodoList->restoreLayout(config,QString("Todo Layout")); |
2101 | readFilterSettings(config); | 2109 | readFilterSettings(config); |
2102 | 2110 | ||
2103 | #ifdef DESKTOP_VERSION | 2111 | #ifdef DESKTOP_VERSION |
2104 | config->setGroup("WidgetLayout"); | 2112 | config->setGroup("WidgetLayout"); |
2105 | QStringList list; | 2113 | QStringList list; |
2106 | list = config->readListEntry("MainLayout"); | 2114 | list = config->readListEntry("MainLayout"); |
2107 | int x,y,w,h; | 2115 | int x,y,w,h; |
2108 | if ( ! list.isEmpty() ) { | 2116 | if ( ! list.isEmpty() ) { |
2109 | x = list[0].toInt(); | 2117 | x = list[0].toInt(); |
2110 | y = list[1].toInt(); | 2118 | y = list[1].toInt(); |
2111 | w = list[2].toInt(); | 2119 | w = list[2].toInt(); |
2112 | h = list[3].toInt(); | 2120 | h = list[3].toInt(); |
2113 | KApplication::testCoords( &x,&y,&w,&h ); | 2121 | KApplication::testCoords( &x,&y,&w,&h ); |
2114 | topLevelWidget()->setGeometry(x,y,w,h); | 2122 | topLevelWidget()->setGeometry(x,y,w,h); |
2115 | 2123 | ||
2116 | } else { | 2124 | } else { |
2117 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 2125 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
2118 | } | 2126 | } |
2119 | list = config->readListEntry("EditEventLayout"); | 2127 | list = config->readListEntry("EditEventLayout"); |
2120 | if ( ! list.isEmpty() ) { | 2128 | if ( ! list.isEmpty() ) { |
2121 | x = list[0].toInt(); | 2129 | x = list[0].toInt(); |
2122 | y = list[1].toInt(); | 2130 | y = list[1].toInt(); |
2123 | w = list[2].toInt(); | 2131 | w = list[2].toInt(); |
2124 | h = list[3].toInt(); | 2132 | h = list[3].toInt(); |
2125 | KApplication::testCoords( &x,&y,&w,&h ); | 2133 | KApplication::testCoords( &x,&y,&w,&h ); |
2126 | mEventEditor->setGeometry(x,y,w,h); | 2134 | mEventEditor->setGeometry(x,y,w,h); |
2127 | 2135 | ||
2128 | } | 2136 | } |
2129 | list = config->readListEntry("EditTodoLayout"); | 2137 | list = config->readListEntry("EditTodoLayout"); |
2130 | if ( ! list.isEmpty() ) { | 2138 | if ( ! list.isEmpty() ) { |
2131 | x = list[0].toInt(); | 2139 | x = list[0].toInt(); |
2132 | y = list[1].toInt(); | 2140 | y = list[1].toInt(); |
2133 | w = list[2].toInt(); | 2141 | w = list[2].toInt(); |
2134 | h = list[3].toInt(); | 2142 | h = list[3].toInt(); |
2135 | KApplication::testCoords( &x,&y,&w,&h ); | 2143 | KApplication::testCoords( &x,&y,&w,&h ); |
2136 | mTodoEditor->setGeometry(x,y,w,h); | 2144 | mTodoEditor->setGeometry(x,y,w,h); |
2137 | 2145 | ||
2138 | } | 2146 | } |
2139 | list = config->readListEntry("ViewerLayout"); | 2147 | list = config->readListEntry("ViewerLayout"); |
2140 | if ( ! list.isEmpty() ) { | 2148 | if ( ! list.isEmpty() ) { |
2141 | x = list[0].toInt(); | 2149 | x = list[0].toInt(); |
2142 | y = list[1].toInt(); | 2150 | y = list[1].toInt(); |
2143 | w = list[2].toInt(); | 2151 | w = list[2].toInt(); |
2144 | h = list[3].toInt(); | 2152 | h = list[3].toInt(); |
2145 | KApplication::testCoords( &x,&y,&w,&h ); | 2153 | KApplication::testCoords( &x,&y,&w,&h ); |
2146 | getEventViewerDialog()->setGeometry(x,y,w,h); | 2154 | getEventViewerDialog()->setGeometry(x,y,w,h); |
2147 | } | 2155 | } |
2148 | #endif | 2156 | #endif |
2149 | config->setGroup( "Views" ); | 2157 | config->setGroup( "Views" ); |
2150 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 2158 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
2151 | 2159 | ||
2152 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); | 2160 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); |
2153 | 2161 | ||
2154 | int resetval = 0; | 2162 | int resetval = 0; |
2155 | int maxVal = 0; | 2163 | int maxVal = 0; |
2156 | if (sizes.count() != 3) { | 2164 | if (sizes.count() != 3) { |
2157 | if ( KOPrefs::instance()->mVerticalScreen ) { | 2165 | if ( KOPrefs::instance()->mVerticalScreen ) { |
2158 | resetval = mDateNavigator->sizeHint().width()+2; | 2166 | resetval = mDateNavigator->sizeHint().width()+2; |
2159 | } else { | 2167 | } else { |
2160 | resetval = mDateNavigator->sizeHint().height()+2; | 2168 | resetval = mDateNavigator->sizeHint().height()+2; |
2161 | } | 2169 | } |
2162 | } | 2170 | } |
2163 | if ( resetval ) { | 2171 | if ( resetval ) { |
2164 | sizes.clear(); | 2172 | sizes.clear(); |
2165 | if ( KOPrefs::instance()->mVerticalScreen ) { | 2173 | if ( KOPrefs::instance()->mVerticalScreen ) { |
2166 | maxVal = QApplication::desktop()->width() -10; | 2174 | maxVal = QApplication::desktop()->width() -10; |
2167 | } else { | 2175 | } else { |
2168 | maxVal = QApplication::desktop()->height()-10; | 2176 | maxVal = QApplication::desktop()->height()-10; |
2169 | } | 2177 | } |
2170 | sizes << resetval; | 2178 | sizes << resetval; |
2171 | if ( maxVal < resetval + resetval) | 2179 | if ( maxVal < resetval + resetval) |
2172 | resetval = maxVal - resetval; | 2180 | resetval = maxVal - resetval; |
2173 | sizes << resetval; | 2181 | sizes << resetval; |
2174 | sizes << 100; | 2182 | sizes << 100; |
2175 | } | 2183 | } |
2176 | mLeftFrame->setSizes(sizes); | 2184 | mLeftFrame->setSizes(sizes); |
2177 | sizes = config->readIntListEntry("Main Splitter Frame"); | 2185 | sizes = config->readIntListEntry("Main Splitter Frame"); |
2178 | resetval = 0; | 2186 | resetval = 0; |
2179 | maxVal = 0; | 2187 | maxVal = 0; |
2180 | if (sizes.count() != 2) { | 2188 | if (sizes.count() != 2) { |
2181 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 2189 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
2182 | resetval = mDateNavigator->sizeHint().width()+2; | 2190 | resetval = mDateNavigator->sizeHint().width()+2; |
2183 | } else { | 2191 | } else { |
2184 | resetval = mDateNavigator->sizeHint().height()+2; | 2192 | resetval = mDateNavigator->sizeHint().height()+2; |
2185 | } | 2193 | } |
2186 | } | 2194 | } |
2187 | if ( resetval ) { | 2195 | if ( resetval ) { |
2188 | sizes.clear(); | 2196 | sizes.clear(); |
2189 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 2197 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
2190 | maxVal = QApplication::desktop()->width() -10; | 2198 | maxVal = QApplication::desktop()->width() -10; |
2191 | } else { | 2199 | } else { |
2192 | maxVal = QApplication::desktop()->height()-10; | 2200 | maxVal = QApplication::desktop()->height()-10; |
2193 | } | 2201 | } |
2194 | sizes << resetval; | 2202 | sizes << resetval; |
2195 | if ( maxVal < resetval + resetval) | 2203 | if ( maxVal < resetval + resetval) |
2196 | resetval = maxVal - resetval; | 2204 | resetval = maxVal - resetval; |
2197 | sizes << resetval; | 2205 | sizes << resetval; |
2198 | } | 2206 | } |
2199 | mMainFrame->setSizes(sizes); | 2207 | mMainFrame->setSizes(sizes); |
2200 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 2208 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
2201 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 2209 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
2202 | else mNavigator->selectDates( dateCount ); | 2210 | else mNavigator->selectDates( dateCount ); |
2203 | // mViewManager->readSettings( config ); | 2211 | // mViewManager->readSettings( config ); |
2204 | updateConfig(); | 2212 | updateConfig(); |
2205 | globalFlagBlockAgenda = 2; | 2213 | globalFlagBlockAgenda = 2; |
2206 | mViewManager->readSettings( config ); | 2214 | mViewManager->readSettings( config ); |
2207 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); | 2215 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); |
2208 | } | 2216 | } |
2209 | 2217 | ||
2210 | 2218 | ||
2211 | void CalendarView::writeSettings() | 2219 | void CalendarView::writeSettings() |
2212 | { | 2220 | { |
2213 | // kdDebug() << "CalendarView::writeSettings" << endl; | 2221 | // kdDebug() << "CalendarView::writeSettings" << endl; |
2214 | 2222 | ||
2215 | KConfig *config = KOGlobals::config(); | 2223 | KConfig *config = KOGlobals::config(); |
2216 | 2224 | ||
2217 | mViewManager->writeSettings( config ); | 2225 | mViewManager->writeSettings( config ); |
2218 | mTodoList->saveLayout(config,QString("Todo Layout")); | 2226 | mTodoList->saveLayout(config,QString("Todo Layout")); |
2219 | mDialogManager->writeSettings( config ); | 2227 | mDialogManager->writeSettings( config ); |
2220 | //KOPrefs::instance()->usrWriteConfig(); | 2228 | //KOPrefs::instance()->usrWriteConfig(); |
2221 | KOPrefs::instance()->writeConfig(); | 2229 | KOPrefs::instance()->writeConfig(); |
2222 | 2230 | ||
2223 | writeFilterSettings(config); | 2231 | writeFilterSettings(config); |
2224 | config->setGroup( "AppRun" ); | 2232 | config->setGroup( "AppRun" ); |
2225 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 2233 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
2226 | int days = dt.daysTo( QDate::currentDate() ); | 2234 | int days = dt.daysTo( QDate::currentDate() ); |
2227 | dt = dt.addDays( days ); | 2235 | dt = dt.addDays( days ); |
2228 | int secs = dt.secsTo( QDateTime::currentDateTime() ); | 2236 | int secs = dt.secsTo( QDateTime::currentDateTime() ); |
2229 | config->writeEntry( "LatestProgramStopDays", days ); | 2237 | config->writeEntry( "LatestProgramStopDays", days ); |
2230 | config->writeEntry( "LatestProgramStopSecs", secs ); | 2238 | config->writeEntry( "LatestProgramStopSecs", secs ); |
2231 | //qDebug("KO: Writing stop time: %d ", secs); | 2239 | //qDebug("KO: Writing stop time: %d ", secs); |
2232 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); | 2240 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); |
2233 | //QDateTime latest = dt.addSecs ( secs ); | 2241 | //QDateTime latest = dt.addSecs ( secs ); |
2234 | //qDebug("KO: Termination on %s ", latest.toString().latin1()); | 2242 | //qDebug("KO: Termination on %s ", latest.toString().latin1()); |
2235 | config->setGroup( "Views" ); | 2243 | config->setGroup( "Views" ); |
2236 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 2244 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
2237 | 2245 | ||
2238 | #if 0 | 2246 | #if 0 |
2239 | qDebug("********************* "); | 2247 | qDebug("********************* "); |
2240 | qDebug("Testcode secsto "); | 2248 | qDebug("Testcode secsto "); |
2241 | QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) ); | 2249 | QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) ); |
2242 | QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) ); | 2250 | QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) ); |
2243 | int secsto = dt_nodaylight.secsTo( dt_daylight ); | 2251 | int secsto = dt_nodaylight.secsTo( dt_daylight ); |
2244 | QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto ); | 2252 | QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto ); |
2245 | qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() ); | 2253 | qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() ); |
2246 | qDebug("dt daylight %s ",dt_daylight.toString().latin1() ); | 2254 | qDebug("dt daylight %s ",dt_daylight.toString().latin1() ); |
2247 | qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() ); | 2255 | qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() ); |
2248 | qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600); | 2256 | qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600); |
2249 | qDebug("********************* testcode end"); | 2257 | qDebug("********************* testcode end"); |
2250 | 2258 | ||
2251 | #endif | 2259 | #endif |
2252 | 2260 | ||
2253 | QValueList<int> listINT = mLeftFrame->sizes(); | 2261 | QValueList<int> listINT = mLeftFrame->sizes(); |
2254 | config->writeEntry("Left Splitter Frame",listINT); | 2262 | config->writeEntry("Left Splitter Frame",listINT); |
2255 | QValueList<int> listINT2 = mMainFrame->sizes(); | 2263 | QValueList<int> listINT2 = mMainFrame->sizes(); |
2256 | config->writeEntry("Main Splitter Frame",listINT2); | 2264 | config->writeEntry("Main Splitter Frame",listINT2); |
2257 | #ifdef DESKTOP_VERSION | 2265 | #ifdef DESKTOP_VERSION |
2258 | config->setGroup("WidgetLayout"); | 2266 | config->setGroup("WidgetLayout"); |
2259 | QStringList list ;//= config->readListEntry("MainLayout"); | 2267 | QStringList list ;//= config->readListEntry("MainLayout"); |
2260 | int x,y,w,h; | 2268 | int x,y,w,h; |
2261 | QWidget* wid; | 2269 | QWidget* wid; |
2262 | wid = topLevelWidget(); | 2270 | wid = topLevelWidget(); |
2263 | x = wid->geometry().x(); | 2271 | x = wid->geometry().x(); |
2264 | y = wid->geometry().y(); | 2272 | y = wid->geometry().y(); |
2265 | w = wid->width(); | 2273 | w = wid->width(); |
2266 | h = wid->height(); | 2274 | h = wid->height(); |
2267 | list.clear(); | 2275 | list.clear(); |
2268 | list << QString::number( x ); | 2276 | list << QString::number( x ); |
2269 | list << QString::number( y ); | 2277 | list << QString::number( y ); |
2270 | list << QString::number( w ); | 2278 | list << QString::number( w ); |
2271 | list << QString::number( h ); | 2279 | list << QString::number( h ); |
2272 | config->writeEntry("MainLayout",list ); | 2280 | config->writeEntry("MainLayout",list ); |
2273 | 2281 | ||
2274 | wid = mEventEditor; | 2282 | wid = mEventEditor; |
2275 | x = wid->geometry().x(); | 2283 | x = wid->geometry().x(); |
2276 | y = wid->geometry().y(); | 2284 | y = wid->geometry().y(); |
2277 | w = wid->width(); | 2285 | w = wid->width(); |
2278 | h = wid->height(); | 2286 | h = wid->height(); |
2279 | list.clear(); | 2287 | list.clear(); |
2280 | list << QString::number( x ); | 2288 | list << QString::number( x ); |
2281 | list << QString::number( y ); | 2289 | list << QString::number( y ); |
2282 | list << QString::number( w ); | 2290 | list << QString::number( w ); |
2283 | list << QString::number( h ); | 2291 | list << QString::number( h ); |
2284 | config->writeEntry("EditEventLayout",list ); | 2292 | config->writeEntry("EditEventLayout",list ); |
2285 | 2293 | ||
2286 | wid = mTodoEditor; | 2294 | wid = mTodoEditor; |
2287 | x = wid->geometry().x(); | 2295 | x = wid->geometry().x(); |
2288 | y = wid->geometry().y(); | 2296 | y = wid->geometry().y(); |
2289 | w = wid->width(); | 2297 | w = wid->width(); |
2290 | h = wid->height(); | 2298 | h = wid->height(); |
2291 | list.clear(); | 2299 | list.clear(); |
2292 | list << QString::number( x ); | 2300 | list << QString::number( x ); |
2293 | list << QString::number( y ); | 2301 | list << QString::number( y ); |
2294 | list << QString::number( w ); | 2302 | list << QString::number( w ); |
2295 | list << QString::number( h ); | 2303 | list << QString::number( h ); |
2296 | config->writeEntry("EditTodoLayout",list ); | 2304 | config->writeEntry("EditTodoLayout",list ); |
2297 | wid = getEventViewerDialog(); | 2305 | wid = getEventViewerDialog(); |
2298 | x = wid->geometry().x(); | 2306 | x = wid->geometry().x(); |
2299 | y = wid->geometry().y(); | 2307 | y = wid->geometry().y(); |
2300 | w = wid->width(); | 2308 | w = wid->width(); |
2301 | h = wid->height(); | 2309 | h = wid->height(); |
2302 | list.clear(); | 2310 | list.clear(); |
2303 | list << QString::number( x ); | 2311 | list << QString::number( x ); |
2304 | list << QString::number( y ); | 2312 | list << QString::number( y ); |
2305 | list << QString::number( w ); | 2313 | list << QString::number( w ); |
2306 | list << QString::number( h ); | 2314 | list << QString::number( h ); |
2307 | config->writeEntry("ViewerLayout",list ); | 2315 | config->writeEntry("ViewerLayout",list ); |
2308 | wid = mDialogManager->getSearchDialog(); | 2316 | wid = mDialogManager->getSearchDialog(); |
2309 | if ( wid ) { | 2317 | if ( wid ) { |
2310 | x = wid->geometry().x(); | 2318 | x = wid->geometry().x(); |
2311 | y = wid->geometry().y(); | 2319 | y = wid->geometry().y(); |
2312 | w = wid->width(); | 2320 | w = wid->width(); |
2313 | h = wid->height(); | 2321 | h = wid->height(); |
2314 | list.clear(); | 2322 | list.clear(); |
2315 | list << QString::number( x ); | 2323 | list << QString::number( x ); |
2316 | list << QString::number( y ); | 2324 | list << QString::number( y ); |
2317 | list << QString::number( w ); | 2325 | list << QString::number( w ); |
2318 | list << QString::number( h ); | 2326 | list << QString::number( h ); |
2319 | config->writeEntry("SearchLayout",list ); | 2327 | config->writeEntry("SearchLayout",list ); |
2320 | } | 2328 | } |
2321 | #endif | 2329 | #endif |
2322 | 2330 | ||
2323 | 2331 | ||
2324 | config->sync(); | 2332 | config->sync(); |
2325 | } | 2333 | } |
2326 | 2334 | ||
2327 | void CalendarView::readFilterSettings(KConfig *config) | 2335 | void CalendarView::readFilterSettings(KConfig *config) |
2328 | { | 2336 | { |
2329 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 2337 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
2330 | 2338 | ||
2331 | mFilters.clear(); | 2339 | mFilters.clear(); |
2332 | 2340 | ||
2333 | config->setGroup("General"); | 2341 | config->setGroup("General"); |
2334 | QStringList filterList = config->readListEntry("CalendarFilters"); | 2342 | QStringList filterList = config->readListEntry("CalendarFilters"); |
2335 | 2343 | ||
2336 | QStringList::ConstIterator it = filterList.begin(); | 2344 | QStringList::ConstIterator it = filterList.begin(); |
2337 | QStringList::ConstIterator end = filterList.end(); | 2345 | QStringList::ConstIterator end = filterList.end(); |
2338 | while(it != end) { | 2346 | while(it != end) { |
2339 | // kdDebug() << " filter: " << (*it) << endl; | 2347 | // kdDebug() << " filter: " << (*it) << endl; |
2340 | 2348 | ||
2341 | CalFilter *filter; | 2349 | CalFilter *filter; |
2342 | filter = new CalFilter(*it); | 2350 | filter = new CalFilter(*it); |
2343 | config->setGroup("Filter_" + (*it).utf8()); | 2351 | config->setGroup("Filter_" + (*it).utf8()); |
2344 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 2352 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
2345 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 2353 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
2346 | filter->setCategoryList(config->readListEntry("CategoryList")); | 2354 | filter->setCategoryList(config->readListEntry("CategoryList")); |
2347 | mFilters.append(filter); | 2355 | mFilters.append(filter); |
2348 | 2356 | ||
2349 | ++it; | 2357 | ++it; |
2350 | } | 2358 | } |
2351 | 2359 | ||
2352 | if (mFilters.count() == 0) { | 2360 | if (mFilters.count() == 0) { |
2353 | CalFilter *filter = new CalFilter(i18n("Default")); | 2361 | CalFilter *filter = new CalFilter(i18n("Default")); |
2354 | mFilters.append(filter); | 2362 | mFilters.append(filter); |
2355 | } | 2363 | } |
2356 | mFilterView->updateFilters(); | 2364 | mFilterView->updateFilters(); |
2357 | config->setGroup("FilterView"); | 2365 | config->setGroup("FilterView"); |
2358 | 2366 | ||
2359 | mFilterView->blockSignals(true); | 2367 | mFilterView->blockSignals(true); |
2360 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 2368 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
2361 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 2369 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
2362 | mFilterView->blockSignals(false); | 2370 | mFilterView->blockSignals(false); |
2363 | // We do it manually to avoid it being done twice by the above calls | 2371 | // We do it manually to avoid it being done twice by the above calls |
2364 | updateFilter(); | 2372 | updateFilter(); |
2365 | } | 2373 | } |
2366 | 2374 | ||
2367 | void CalendarView::writeFilterSettings(KConfig *config) | 2375 | void CalendarView::writeFilterSettings(KConfig *config) |
2368 | { | 2376 | { |
2369 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 2377 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
2370 | 2378 | ||
2371 | QStringList filterList; | 2379 | QStringList filterList; |
2372 | 2380 | ||
2373 | CalFilter *filter = mFilters.first(); | 2381 | CalFilter *filter = mFilters.first(); |
2374 | while(filter) { | 2382 | while(filter) { |
2375 | // kdDebug() << " fn: " << filter->name() << endl; | 2383 | // kdDebug() << " fn: " << filter->name() << endl; |
2376 | filterList << filter->name(); | 2384 | filterList << filter->name(); |
2377 | config->setGroup("Filter_" + filter->name().utf8()); | 2385 | config->setGroup("Filter_" + filter->name().utf8()); |
2378 | config->writeEntry("Criteria",filter->criteria()); | 2386 | config->writeEntry("Criteria",filter->criteria()); |
2379 | config->writeEntry("CategoryList",filter->categoryList()); | 2387 | config->writeEntry("CategoryList",filter->categoryList()); |
2380 | filter = mFilters.next(); | 2388 | filter = mFilters.next(); |
2381 | } | 2389 | } |
2382 | config->setGroup("General"); | 2390 | config->setGroup("General"); |
2383 | config->writeEntry("CalendarFilters",filterList); | 2391 | config->writeEntry("CalendarFilters",filterList); |
2384 | 2392 | ||
2385 | config->setGroup("FilterView"); | 2393 | config->setGroup("FilterView"); |
2386 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 2394 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
2387 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 2395 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
2388 | } | 2396 | } |
2389 | 2397 | ||
2390 | 2398 | ||
2391 | void CalendarView::goToday() | 2399 | void CalendarView::goToday() |
2392 | { | 2400 | { |
2393 | if ( mViewManager->currentView()->isMonthView() ) | 2401 | if ( mViewManager->currentView()->isMonthView() ) |
2394 | mNavigator->selectTodayMonth(); | 2402 | mNavigator->selectTodayMonth(); |
2395 | else | 2403 | else |
2396 | mNavigator->selectToday(); | 2404 | mNavigator->selectToday(); |
2397 | } | 2405 | } |
2398 | 2406 | ||
2399 | void CalendarView::goNext() | 2407 | void CalendarView::goNext() |
2400 | { | 2408 | { |
2401 | mNavigator->selectNext(); | 2409 | mNavigator->selectNext(); |
2402 | } | 2410 | } |
2403 | 2411 | ||
2404 | void CalendarView::goPrevious() | 2412 | void CalendarView::goPrevious() |
2405 | { | 2413 | { |
2406 | mNavigator->selectPrevious(); | 2414 | mNavigator->selectPrevious(); |
2407 | } | 2415 | } |
2408 | void CalendarView::goNextMonth() | 2416 | void CalendarView::goNextMonth() |
2409 | { | 2417 | { |
2410 | mNavigator->selectNextMonth(); | 2418 | mNavigator->selectNextMonth(); |
2411 | } | 2419 | } |
2412 | 2420 | ||
2413 | void CalendarView::goPreviousMonth() | 2421 | void CalendarView::goPreviousMonth() |
2414 | { | 2422 | { |
2415 | mNavigator->selectPreviousMonth(); | 2423 | mNavigator->selectPreviousMonth(); |
2416 | } | 2424 | } |
2417 | void CalendarView::writeLocale() | 2425 | void CalendarView::writeLocale() |
2418 | { | 2426 | { |
2419 | //KPimGlobalPrefs::instance()->setGlobalConfig(); | 2427 | //KPimGlobalPrefs::instance()->setGlobalConfig(); |
2420 | #if 0 | 2428 | #if 0 |
2421 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); | 2429 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); |
2422 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); | 2430 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); |
2423 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); | 2431 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); |
2424 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); | 2432 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); |
2425 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; | 2433 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; |
2426 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 2434 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
2427 | dummy = KOPrefs::instance()->mUserDateFormatShort; | 2435 | dummy = KOPrefs::instance()->mUserDateFormatShort; |
2428 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 2436 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
2429 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, | 2437 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, |
2430 | KOPrefs::instance()->mDaylightsavingStart, | 2438 | KOPrefs::instance()->mDaylightsavingStart, |
2431 | KOPrefs::instance()->mDaylightsavingEnd ); | 2439 | KOPrefs::instance()->mDaylightsavingEnd ); |
2432 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); | 2440 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); |
2433 | #endif | 2441 | #endif |
2434 | } | 2442 | } |
2435 | void CalendarView::updateConfig() | 2443 | void CalendarView::updateConfig() |
2436 | { | 2444 | { |
2437 | writeLocale(); | 2445 | writeLocale(); |
2438 | if ( KOPrefs::instance()->mUseAppColors ) | 2446 | if ( KOPrefs::instance()->mUseAppColors ) |
2439 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2447 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2440 | emit configChanged(); | 2448 | emit configChanged(); |
2441 | mTodoList->updateConfig(); | 2449 | mTodoList->updateConfig(); |
2442 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2450 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2443 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2451 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2444 | // To make the "fill window" configurations work | 2452 | // To make the "fill window" configurations work |
2445 | //mViewManager->raiseCurrentView(); | 2453 | //mViewManager->raiseCurrentView(); |
2446 | } | 2454 | } |
2447 | 2455 | ||
2448 | 2456 | ||
2449 | void CalendarView::eventChanged(Event *event) | 2457 | void CalendarView::eventChanged(Event *event) |
2450 | { | 2458 | { |
2451 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 2459 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
2452 | //updateUnmanagedViews(); | 2460 | //updateUnmanagedViews(); |
2453 | } | 2461 | } |
2454 | 2462 | ||
2455 | void CalendarView::eventAdded(Event *event) | 2463 | void CalendarView::eventAdded(Event *event) |
2456 | { | 2464 | { |
2457 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 2465 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
2458 | } | 2466 | } |
2459 | 2467 | ||
2460 | void CalendarView::eventToBeDeleted(Event *) | 2468 | void CalendarView::eventToBeDeleted(Event *) |
2461 | { | 2469 | { |
2462 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 2470 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
2463 | } | 2471 | } |
2464 | 2472 | ||
2465 | void CalendarView::eventDeleted() | 2473 | void CalendarView::eventDeleted() |
2466 | { | 2474 | { |
2467 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 2475 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
2468 | } | 2476 | } |
2469 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 2477 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
2470 | { | 2478 | { |
2471 | changeIncidenceDisplay((Incidence *)which, action); | 2479 | changeIncidenceDisplay((Incidence *)which, action); |
2472 | mDateNavigator->updateView(); //LR | 2480 | mDateNavigator->updateView(); //LR |
2473 | //mDialogManager->updateSearchDialog(); | 2481 | //mDialogManager->updateSearchDialog(); |
2474 | 2482 | ||
2475 | if (which) { | 2483 | if (which) { |
2476 | mViewManager->updateWNview(); | 2484 | mViewManager->updateWNview(); |
2477 | //mTodoList->updateView(); | 2485 | //mTodoList->updateView(); |
2478 | } | 2486 | } |
2479 | 2487 | ||
2480 | } | 2488 | } |
2481 | 2489 | ||
2482 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 2490 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
2483 | { | 2491 | { |
2484 | updateUnmanagedViews(); | 2492 | updateUnmanagedViews(); |
2485 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 2493 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
2486 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 2494 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
2487 | mCalendar->checkAlarmForIncidence( 0, true ); | 2495 | mCalendar->checkAlarmForIncidence( 0, true ); |
2488 | if ( mEventViewerDialog ) | 2496 | if ( mEventViewerDialog ) |
2489 | mEventViewerDialog->hide(); | 2497 | mEventViewerDialog->hide(); |
2490 | } | 2498 | } |
2491 | else | 2499 | else |
2492 | mCalendar->checkAlarmForIncidence( which , false ); | 2500 | mCalendar->checkAlarmForIncidence( which , false ); |
2493 | } | 2501 | } |
2494 | 2502 | ||
2495 | // most of the changeEventDisplays() right now just call the view's | 2503 | // most of the changeEventDisplays() right now just call the view's |
2496 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 2504 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
2497 | void CalendarView::changeEventDisplay(Event *which, int action) | 2505 | void CalendarView::changeEventDisplay(Event *which, int action) |
2498 | { | 2506 | { |
2499 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 2507 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
2500 | changeIncidenceDisplay((Incidence *)which, action); | 2508 | changeIncidenceDisplay((Incidence *)which, action); |
2501 | mDateNavigator->updateView(); | 2509 | mDateNavigator->updateView(); |
2502 | //mDialogManager->updateSearchDialog(); | 2510 | //mDialogManager->updateSearchDialog(); |
2503 | 2511 | ||
2504 | if (which) { | 2512 | if (which) { |
2505 | // If there is an event view visible update the display | 2513 | // If there is an event view visible update the display |
2506 | mViewManager->currentView()->changeEventDisplay(which,action); | 2514 | mViewManager->currentView()->changeEventDisplay(which,action); |
2507 | // TODO: check, if update needed | 2515 | // TODO: check, if update needed |
2508 | // if (which->getTodoStatus()) { | 2516 | // if (which->getTodoStatus()) { |
2509 | mTodoList->updateView(); | 2517 | mTodoList->updateView(); |
2510 | // } | 2518 | // } |
2511 | } else { | 2519 | } else { |
2512 | mViewManager->currentView()->updateView(); | 2520 | mViewManager->currentView()->updateView(); |
2513 | } | 2521 | } |
2514 | } | 2522 | } |
2515 | 2523 | ||
2516 | 2524 | ||
2517 | void CalendarView::updateTodoViews() | 2525 | void CalendarView::updateTodoViews() |
2518 | { | 2526 | { |
2519 | mTodoList->updateView(); | 2527 | mTodoList->updateView(); |
2520 | mViewManager->currentView()->updateView(); | 2528 | mViewManager->currentView()->updateView(); |
2521 | 2529 | ||
2522 | } | 2530 | } |
2523 | 2531 | ||
2524 | 2532 | ||
2525 | void CalendarView::updateView(const QDate &start, const QDate &end) | 2533 | void CalendarView::updateView(const QDate &start, const QDate &end) |
2526 | { | 2534 | { |
2527 | mTodoList->updateView(); | 2535 | mTodoList->updateView(); |
2528 | mViewManager->updateView(start, end); | 2536 | mViewManager->updateView(start, end); |
2529 | //mDateNavigator->updateView(); | 2537 | //mDateNavigator->updateView(); |
2530 | } | 2538 | } |
2531 | 2539 | ||
2532 | void CalendarView::clearAllViews() | 2540 | void CalendarView::clearAllViews() |
2533 | { | 2541 | { |
2534 | mTodoList->clearList(); | 2542 | mTodoList->clearList(); |
2535 | mViewManager->clearAllViews(); | 2543 | mViewManager->clearAllViews(); |
2536 | SearchDialog * sd = mDialogManager->getSearchDialog(); | 2544 | SearchDialog * sd = mDialogManager->getSearchDialog(); |
2537 | if ( sd ) { | 2545 | if ( sd ) { |
2538 | KOListView* kol = sd->listview(); | 2546 | KOListView* kol = sd->listview(); |
2539 | if ( kol ) | 2547 | if ( kol ) |
2540 | kol->clearList(); | 2548 | kol->clearList(); |
2541 | } | 2549 | } |
2542 | } | 2550 | } |
2543 | void CalendarView::updateView() | 2551 | void CalendarView::updateView() |
2544 | { | 2552 | { |
2545 | DateList tmpList = mNavigator->selectedDates(); | 2553 | DateList tmpList = mNavigator->selectedDates(); |
2546 | 2554 | ||
2547 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2555 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2548 | mTodoList->updateView(); | 2556 | mTodoList->updateView(); |
2549 | // We assume that the navigator only selects consecutive days. | 2557 | // We assume that the navigator only selects consecutive days. |
2550 | updateView( tmpList.first(), tmpList.last() ); | 2558 | updateView( tmpList.first(), tmpList.last() ); |
2551 | } | 2559 | } |
2552 | 2560 | ||
2553 | void CalendarView::updateUnmanagedViews() | 2561 | void CalendarView::updateUnmanagedViews() |
2554 | { | 2562 | { |
2555 | mDateNavigator->updateDayMatrix(); | 2563 | mDateNavigator->updateDayMatrix(); |
2556 | } | 2564 | } |
2557 | 2565 | ||
2558 | int CalendarView::msgItemDelete(const QString name) | 2566 | int CalendarView::msgItemDelete(const QString name) |
2559 | { | 2567 | { |
2560 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ | 2568 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
2561 | i18n("This item will be\npermanently deleted."), | 2569 | i18n("This item will be\npermanently deleted."), |
2562 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2570 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2563 | } | 2571 | } |
2564 | 2572 | ||
2565 | 2573 | ||
2566 | void CalendarView::edit_cut() | 2574 | void CalendarView::edit_cut() |
2567 | { | 2575 | { |
2568 | Event *anEvent=0; | 2576 | Event *anEvent=0; |
2569 | 2577 | ||
2570 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2578 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2571 | 2579 | ||
2572 | if (mViewManager->currentView()->isEventView()) { | 2580 | if (mViewManager->currentView()->isEventView()) { |
2573 | if ( incidence && incidence->typeID() == eventID ) { | 2581 | if ( incidence && incidence->typeID() == eventID ) { |
2574 | anEvent = static_cast<Event *>(incidence); | 2582 | anEvent = static_cast<Event *>(incidence); |
2575 | } | 2583 | } |
2576 | } | 2584 | } |
2577 | 2585 | ||
2578 | if (!anEvent) { | 2586 | if (!anEvent) { |
2579 | KNotifyClient::beep(); | 2587 | KNotifyClient::beep(); |
2580 | return; | 2588 | return; |
2581 | } | 2589 | } |
2582 | DndFactory factory( mCalendar ); | 2590 | DndFactory factory( mCalendar ); |
2583 | factory.cutIncidence(anEvent); | 2591 | factory.cutIncidence(anEvent); |
2584 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2592 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2585 | } | 2593 | } |
2586 | 2594 | ||
2587 | void CalendarView::edit_copy() | 2595 | void CalendarView::edit_copy() |
2588 | { | 2596 | { |
2589 | Event *anEvent=0; | 2597 | Event *anEvent=0; |
2590 | 2598 | ||
2591 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2599 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2592 | 2600 | ||
2593 | if (mViewManager->currentView()->isEventView()) { | 2601 | if (mViewManager->currentView()->isEventView()) { |
2594 | if ( incidence && incidence->typeID() == eventID ) { | 2602 | if ( incidence && incidence->typeID() == eventID ) { |
2595 | anEvent = static_cast<Event *>(incidence); | 2603 | anEvent = static_cast<Event *>(incidence); |
2596 | } | 2604 | } |
2597 | } | 2605 | } |
2598 | 2606 | ||
2599 | if (!anEvent) { | 2607 | if (!anEvent) { |
2600 | KNotifyClient::beep(); | 2608 | KNotifyClient::beep(); |
2601 | return; | 2609 | return; |
2602 | } | 2610 | } |
2603 | DndFactory factory( mCalendar ); | 2611 | DndFactory factory( mCalendar ); |
2604 | factory.copyIncidence(anEvent); | 2612 | factory.copyIncidence(anEvent); |
2605 | } | 2613 | } |
2606 | 2614 | ||
2607 | void CalendarView::edit_paste() | 2615 | void CalendarView::edit_paste() |
2608 | { | 2616 | { |
2609 | QDate date = mNavigator->selectedDates().first(); | 2617 | QDate date = mNavigator->selectedDates().first(); |
2610 | 2618 | ||
2611 | DndFactory factory( mCalendar ); | 2619 | DndFactory factory( mCalendar ); |
2612 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); | 2620 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); |
2613 | 2621 | ||
2614 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 2622 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
2615 | } | 2623 | } |
2616 | void CalendarView::edit_global_options() | 2624 | void CalendarView::edit_global_options() |
2617 | { | 2625 | { |
2618 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; | 2626 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; |
2619 | emit save(); | 2627 | emit save(); |
2620 | emit saveStopTimer(); | 2628 | emit saveStopTimer(); |
2621 | mDialogManager->showGlobalOptionsDialog(); | 2629 | mDialogManager->showGlobalOptionsDialog(); |
2622 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { | 2630 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { |
2623 | emit saveStopTimer(); | 2631 | emit saveStopTimer(); |
2624 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), | 2632 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), |
2625 | i18n("Timezone settings"),i18n("Reload"))) { | 2633 | i18n("Timezone settings"),i18n("Reload"))) { |
2626 | qDebug("KO: TZ reload cancelled "); | 2634 | qDebug("KO: TZ reload cancelled "); |
2627 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2635 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2628 | return; | 2636 | return; |
2629 | } | 2637 | } |
2630 | qDebug("KO: Timezone change "); | 2638 | qDebug("KO: Timezone change "); |
2631 | openCalendar( MainWindow::defaultFileName() ); | 2639 | openCalendar( MainWindow::defaultFileName() ); |
2632 | setModified(true); | 2640 | setModified(true); |
2633 | } | 2641 | } |
2634 | else | 2642 | else |
2635 | qDebug("KO: No tz change "); | 2643 | qDebug("KO: No tz change "); |
2636 | } | 2644 | } |
2637 | void CalendarView::edit_options() | 2645 | void CalendarView::edit_options() |
2638 | { | 2646 | { |
2639 | mDialogManager->showOptionsDialog(); | 2647 | mDialogManager->showOptionsDialog(); |
2640 | } | 2648 | } |
2641 | 2649 | ||
2642 | 2650 | ||
2643 | void CalendarView::slotSelectPickerDate( QDate d) | 2651 | void CalendarView::slotSelectPickerDate( QDate d) |
2644 | { | 2652 | { |
2645 | mDateFrame->hide(); | 2653 | mDateFrame->hide(); |
2646 | if ( mDatePickerMode == 1 ) { | 2654 | if ( mDatePickerMode == 1 ) { |
2647 | mNavigator->slotDaySelect( d ); | 2655 | mNavigator->slotDaySelect( d ); |
2648 | } else if ( mDatePickerMode == 2 ) { | 2656 | } else if ( mDatePickerMode == 2 ) { |
2649 | if ( mMoveIncidence->typeID() == todoID ) { | 2657 | if ( mMoveIncidence->typeID() == todoID ) { |
2650 | Todo * to = (Todo *) mMoveIncidence; | 2658 | Todo * to = (Todo *) mMoveIncidence; |
2651 | QTime tim; | 2659 | QTime tim; |
2652 | int len = 0; | 2660 | int len = 0; |
2653 | if ( to->hasStartDate() && to->hasDueDate() ) | 2661 | if ( to->hasStartDate() && to->hasDueDate() ) |
2654 | len = to->dtStart().secsTo( to->dtDue()); | 2662 | len = to->dtStart().secsTo( to->dtDue()); |
2655 | if ( to->hasDueDate() ) | 2663 | if ( to->hasDueDate() ) |
2656 | tim = to->dtDue().time(); | 2664 | tim = to->dtDue().time(); |
2657 | else { | 2665 | else { |
2658 | tim = QTime ( 0,0,0 ); | 2666 | tim = QTime ( 0,0,0 ); |
2659 | to->setFloats( true ); | 2667 | to->setFloats( true ); |
2660 | to->setHasDueDate( true ); | 2668 | to->setHasDueDate( true ); |
2661 | } | 2669 | } |
2662 | QDateTime dt ( d,tim ); | 2670 | QDateTime dt ( d,tim ); |
2663 | to->setDtDue( dt ); | 2671 | to->setDtDue( dt ); |
2664 | 2672 | ||
2665 | if ( to->hasStartDate() ) { | 2673 | if ( to->hasStartDate() ) { |
2666 | if ( len>0 ) | 2674 | if ( len>0 ) |
2667 | to->setDtStart(to->dtDue().addSecs( -len )); | 2675 | to->setDtStart(to->dtDue().addSecs( -len )); |
2668 | else | 2676 | else |
2669 | if (to->dtStart() > to->dtDue() ) | 2677 | if (to->dtStart() > to->dtDue() ) |
2670 | to->setDtStart(to->dtDue().addDays( -3 )); | 2678 | to->setDtStart(to->dtDue().addDays( -3 )); |
2671 | } | 2679 | } |
2672 | 2680 | ||
2673 | todoChanged( to ); | 2681 | todoChanged( to ); |
2674 | } else { | 2682 | } else { |
2675 | if ( mMoveIncidence->doesRecur() ) { | 2683 | if ( mMoveIncidence->doesRecur() ) { |
2676 | #if 0 | 2684 | #if 0 |
2677 | // PENDING implement this | 2685 | // PENDING implement this |
2678 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); | 2686 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); |
2679 | mCalendar()->addIncidence( newInc ); | 2687 | mCalendar()->addIncidence( newInc ); |
2680 | if ( mMoveIncidence->typeID() == todoID ) | 2688 | if ( mMoveIncidence->typeID() == todoID ) |
2681 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); | 2689 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); |
2682 | else | 2690 | else |
2683 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); | 2691 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); |
2684 | mMoveIncidence = newInc; | 2692 | mMoveIncidence = newInc; |
2685 | 2693 | ||
2686 | #endif | 2694 | #endif |
2687 | } | 2695 | } |
2688 | QTime tim = mMoveIncidence->dtStart().time(); | 2696 | QTime tim = mMoveIncidence->dtStart().time(); |
2689 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); | 2697 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); |
2690 | QDateTime dt ( d,tim ); | 2698 | QDateTime dt ( d,tim ); |
2691 | mMoveIncidence->setDtStart( dt ); | 2699 | mMoveIncidence->setDtStart( dt ); |
2692 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); | 2700 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); |
2693 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); | 2701 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); |
2694 | } | 2702 | } |
2695 | 2703 | ||
2696 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); | 2704 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); |
2697 | } | 2705 | } |
2698 | } | 2706 | } |
2699 | 2707 | ||
2700 | void CalendarView::removeCategories() | 2708 | void CalendarView::removeCategories() |
2701 | { | 2709 | { |
2702 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2710 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2703 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2711 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2704 | QStringList catIncList; | 2712 | QStringList catIncList; |
2705 | QStringList newCatList; | 2713 | QStringList newCatList; |
2706 | Incidence* inc = incList.first(); | 2714 | Incidence* inc = incList.first(); |
2707 | int i; | 2715 | int i; |
2708 | int count = 0; | 2716 | int count = 0; |
2709 | while ( inc ) { | 2717 | while ( inc ) { |
2710 | newCatList.clear(); | 2718 | newCatList.clear(); |
2711 | catIncList = inc->categories() ; | 2719 | catIncList = inc->categories() ; |
2712 | for( i = 0; i< catIncList.count(); ++i ) { | 2720 | for( i = 0; i< catIncList.count(); ++i ) { |
2713 | if ( catList.contains (catIncList[i])) | 2721 | if ( catList.contains (catIncList[i])) |
2714 | newCatList.append( catIncList[i] ); | 2722 | newCatList.append( catIncList[i] ); |
2715 | } | 2723 | } |
2716 | newCatList.sort(); | 2724 | newCatList.sort(); |
2717 | inc->setCategories( newCatList.join(",") ); | 2725 | inc->setCategories( newCatList.join(",") ); |
2718 | inc = incList.next(); | 2726 | inc = incList.next(); |
2719 | } | 2727 | } |
2720 | } | 2728 | } |
2721 | 2729 | ||
2722 | int CalendarView::addCategories() | 2730 | int CalendarView::addCategories() |
2723 | { | 2731 | { |
2724 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2732 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2725 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2733 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2726 | QStringList catIncList; | 2734 | QStringList catIncList; |
2727 | Incidence* inc = incList.first(); | 2735 | Incidence* inc = incList.first(); |
2728 | int i; | 2736 | int i; |
2729 | int count = 0; | 2737 | int count = 0; |
2730 | while ( inc ) { | 2738 | while ( inc ) { |
2731 | catIncList = inc->categories() ; | 2739 | catIncList = inc->categories() ; |
2732 | for( i = 0; i< catIncList.count(); ++i ) { | 2740 | for( i = 0; i< catIncList.count(); ++i ) { |
2733 | if ( !catList.contains (catIncList[i])) { | 2741 | if ( !catList.contains (catIncList[i])) { |
2734 | catList.append( catIncList[i] ); | 2742 | catList.append( catIncList[i] ); |
2735 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2743 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2736 | ++count; | 2744 | ++count; |
2737 | } | 2745 | } |
2738 | } | 2746 | } |
2739 | inc = incList.next(); | 2747 | inc = incList.next(); |
2740 | } | 2748 | } |
2741 | catList.sort(); | 2749 | catList.sort(); |
2742 | KOPrefs::instance()->mCustomCategories = catList; | 2750 | KOPrefs::instance()->mCustomCategories = catList; |
2743 | return count; | 2751 | return count; |
2744 | } | 2752 | } |
2745 | 2753 | ||
2746 | void CalendarView::manageCategories() | 2754 | void CalendarView::manageCategories() |
2747 | { | 2755 | { |
2748 | KOCatPrefs* cp = new KOCatPrefs(); | 2756 | KOCatPrefs* cp = new KOCatPrefs(); |
2749 | cp->show(); | 2757 | cp->show(); |
2750 | int w =cp->sizeHint().width() ; | 2758 | int w =cp->sizeHint().width() ; |
2751 | int h = cp->sizeHint().height() ; | 2759 | int h = cp->sizeHint().height() ; |
2752 | int dw = QApplication::desktop()->width(); | 2760 | int dw = QApplication::desktop()->width(); |
2753 | int dh = QApplication::desktop()->height(); | 2761 | int dh = QApplication::desktop()->height(); |
2754 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2762 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2755 | if ( !cp->exec() ) { | 2763 | if ( !cp->exec() ) { |
2756 | delete cp; | 2764 | delete cp; |
2757 | return; | 2765 | return; |
2758 | } | 2766 | } |
2759 | int count = 0; | 2767 | int count = 0; |
2760 | if ( cp->addCat() ) { | 2768 | if ( cp->addCat() ) { |
2761 | count = addCategories(); | 2769 | count = addCategories(); |
2762 | if ( count ) { | 2770 | if ( count ) { |
2763 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); | 2771 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); |
2764 | writeSettings(); | 2772 | writeSettings(); |
2765 | } else | 2773 | } else |
2766 | topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); | 2774 | topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); |
2767 | } else { | 2775 | } else { |
2768 | removeCategories(); | 2776 | removeCategories(); |
2769 | updateView(); | 2777 | updateView(); |
2770 | } | 2778 | } |
2771 | delete cp; | 2779 | delete cp; |
2772 | } | 2780 | } |
2773 | 2781 | ||
2774 | void CalendarView::beamIncidence(Incidence * Inc) | 2782 | void CalendarView::beamIncidence(Incidence * Inc) |
2775 | { | 2783 | { |
2776 | QPtrList<Incidence> delSel ; | 2784 | QPtrList<Incidence> delSel ; |
2777 | delSel.append(Inc); | 2785 | delSel.append(Inc); |
2778 | beamIncidenceList( delSel ); | 2786 | beamIncidenceList( delSel ); |
2779 | } | 2787 | } |
2780 | void CalendarView::beamCalendar() | 2788 | void CalendarView::beamCalendar() |
2781 | { | 2789 | { |
2782 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); | 2790 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); |
2783 | //qDebug("beamCalendar() "); | 2791 | //qDebug("beamCalendar() "); |
2784 | beamIncidenceList( delSel ); | 2792 | beamIncidenceList( delSel ); |
2785 | } | 2793 | } |
2786 | void CalendarView::beamFilteredCalendar() | 2794 | void CalendarView::beamFilteredCalendar() |
2787 | { | 2795 | { |
2788 | QPtrList<Incidence> delSel = mCalendar->incidences(); | 2796 | QPtrList<Incidence> delSel = mCalendar->incidences(); |
2789 | //qDebug("beamFilteredCalendar() "); | 2797 | //qDebug("beamFilteredCalendar() "); |
2790 | beamIncidenceList( delSel ); | 2798 | beamIncidenceList( delSel ); |
2791 | } | 2799 | } |
2792 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) | 2800 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) |
2793 | { | 2801 | { |
2794 | if ( beamDialog->exec () == QDialog::Rejected ) | 2802 | if ( beamDialog->exec () == QDialog::Rejected ) |
2795 | return; | 2803 | return; |
2796 | #ifdef DESKTOP_VERSION | 2804 | #ifdef DESKTOP_VERSION |
2797 | QString fn = locateLocal( "tmp", "kopibeamfile" ); | 2805 | QString fn = locateLocal( "tmp", "kopibeamfile" ); |
2798 | #else | 2806 | #else |
2799 | QString fn = "/tmp/kopibeamfile"; | 2807 | QString fn = "/tmp/kopibeamfile"; |
2800 | #endif | 2808 | #endif |
2801 | QString mes; | 2809 | QString mes; |
2802 | bool createbup = true; | 2810 | bool createbup = true; |
2803 | if ( createbup ) { | 2811 | if ( createbup ) { |
2804 | QString description = "\n"; | 2812 | QString description = "\n"; |
2805 | CalendarLocal* cal = new CalendarLocal(); | 2813 | CalendarLocal* cal = new CalendarLocal(); |
2806 | if ( beamDialog->beamLocal() ) | 2814 | if ( beamDialog->beamLocal() ) |
2807 | cal->setLocalTime(); | 2815 | cal->setLocalTime(); |
2808 | else | 2816 | else |
2809 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2817 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2810 | Incidence *incidence = delSel.first(); | 2818 | Incidence *incidence = delSel.first(); |
2811 | bool addText = false; | 2819 | bool addText = false; |
2812 | if ( delSel.count() < 10 ) | 2820 | if ( delSel.count() < 10 ) |
2813 | addText = true; | 2821 | addText = true; |
2814 | else { | 2822 | else { |
2815 | description.sprintf(i18n(" %d items?"),delSel.count() ); | 2823 | description.sprintf(i18n(" %d items?"),delSel.count() ); |
2816 | } | 2824 | } |
2817 | while ( incidence ) { | 2825 | while ( incidence ) { |
2818 | Incidence *in = incidence->clone(); | 2826 | Incidence *in = incidence->clone(); |
2819 | if ( ! in->summary().isEmpty() ) { | 2827 | if ( ! in->summary().isEmpty() ) { |
2820 | in->setDescription(""); | 2828 | in->setDescription(""); |
2821 | } else { | 2829 | } else { |
2822 | in->setSummary( in->description().left(20)); | 2830 | in->setSummary( in->description().left(20)); |
2823 | in->setDescription(""); | 2831 | in->setDescription(""); |
2824 | } | 2832 | } |
2825 | if ( addText ) | 2833 | if ( addText ) |
2826 | description += in->summary() + "\n"; | 2834 | description += in->summary() + "\n"; |
2827 | cal->addIncidence( in ); | 2835 | cal->addIncidence( in ); |
2828 | incidence = delSel.next(); | 2836 | incidence = delSel.next(); |
2829 | } | 2837 | } |
2830 | if ( beamDialog->beamVcal() ) { | 2838 | if ( beamDialog->beamVcal() ) { |
2831 | fn += ".vcs"; | 2839 | fn += ".vcs"; |
2832 | FileStorage storage( cal, fn, new VCalFormat ); | 2840 | FileStorage storage( cal, fn, new VCalFormat ); |
2833 | storage.save(); | 2841 | storage.save(); |
2834 | } else { | 2842 | } else { |
2835 | fn += ".ics"; | 2843 | fn += ".ics"; |
2836 | FileStorage storage( cal, fn, new ICalFormat( ) ); | 2844 | FileStorage storage( cal, fn, new ICalFormat( ) ); |
2837 | storage.save(); | 2845 | storage.save(); |
2838 | } | 2846 | } |
2839 | delete cal; | 2847 | delete cal; |
2840 | mes = i18n("KO/Pi: Ready for beaming"); | 2848 | mes = i18n("KO/Pi: Ready for beaming"); |
2841 | topLevelWidget()->setCaption(mes); | 2849 | topLevelWidget()->setCaption(mes); |
2842 | KApplication::convert2latin1( fn ); | 2850 | KApplication::convert2latin1( fn ); |
2843 | #ifndef DESKTOP_VERSION | 2851 | #ifndef DESKTOP_VERSION |
2844 | Ir *ir = new Ir( this ); | 2852 | Ir *ir = new Ir( this ); |
2845 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 2853 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
2846 | ir->send( fn, description, "text/x-vCalendar" ); | 2854 | ir->send( fn, description, "text/x-vCalendar" ); |
2847 | #endif | 2855 | #endif |
2848 | } | 2856 | } |
2849 | } | 2857 | } |
2850 | void CalendarView::beamDone( Ir *ir ) | 2858 | void CalendarView::beamDone( Ir *ir ) |
2851 | { | 2859 | { |
2852 | #ifndef DESKTOP_VERSION | 2860 | #ifndef DESKTOP_VERSION |
2853 | delete ir; | 2861 | delete ir; |
2854 | #endif | 2862 | #endif |
2855 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); | 2863 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); |
2856 | topLevelWidget()->raise(); | 2864 | topLevelWidget()->raise(); |
2857 | } | 2865 | } |
2858 | 2866 | ||
2859 | void CalendarView::moveIncidence(Incidence * inc ) | 2867 | void CalendarView::moveIncidence(Incidence * inc ) |
2860 | { | 2868 | { |
2861 | if ( !inc ) return; | 2869 | if ( !inc ) return; |
2862 | showDatePickerPopup(); | 2870 | showDatePickerPopup(); |
2863 | mDatePickerMode = 2; | 2871 | mDatePickerMode = 2; |
2864 | mMoveIncidence = inc ; | 2872 | mMoveIncidence = inc ; |
2865 | QDate da; | 2873 | QDate da; |
2866 | if ( mMoveIncidence->typeID() == todoID ) { | 2874 | if ( mMoveIncidence->typeID() == todoID ) { |
2867 | Todo * to = (Todo *) mMoveIncidence; | 2875 | Todo * to = (Todo *) mMoveIncidence; |
2868 | if ( to->hasDueDate() ) | 2876 | if ( to->hasDueDate() ) |
2869 | da = to->dtDue().date(); | 2877 | da = to->dtDue().date(); |
2870 | else | 2878 | else |
2871 | da = QDate::currentDate(); | 2879 | da = QDate::currentDate(); |
2872 | } else { | 2880 | } else { |
2873 | da = mMoveIncidence->dtStart().date(); | 2881 | da = mMoveIncidence->dtStart().date(); |
2874 | } | 2882 | } |
2875 | //PENDING set date for recurring incidence to date of recurrence | 2883 | //PENDING set date for recurring incidence to date of recurrence |
2876 | //mMoveIncidenceOldDate; | 2884 | //mMoveIncidenceOldDate; |
2877 | mDatePicker->setDate( da ); | 2885 | mDatePicker->setDate( da ); |
2878 | } | 2886 | } |
2879 | void CalendarView::showDatePickerPopup() | 2887 | void CalendarView::showDatePickerPopup() |
2880 | { | 2888 | { |
2881 | if ( mDateFrame->isVisible() ) | 2889 | if ( mDateFrame->isVisible() ) |
2882 | mDateFrame->hide(); | 2890 | mDateFrame->hide(); |
2883 | else { | 2891 | else { |
2884 | int offX = 0, offY = 0; | 2892 | int offX = 0, offY = 0; |
2885 | #ifdef DESKTOP_VERSION | 2893 | #ifdef DESKTOP_VERSION |
2886 | int w =mDatePicker->sizeHint().width() ; | 2894 | int w =mDatePicker->sizeHint().width() ; |
2887 | int h = mDatePicker->sizeHint().height() ; | 2895 | int h = mDatePicker->sizeHint().height() ; |
2888 | int dw = topLevelWidget()->width(); | 2896 | int dw = topLevelWidget()->width(); |
2889 | int dh = topLevelWidget()->height(); | 2897 | int dh = topLevelWidget()->height(); |
2890 | offX = topLevelWidget()->x(); | 2898 | offX = topLevelWidget()->x(); |
2891 | offY = topLevelWidget()->y(); | 2899 | offY = topLevelWidget()->y(); |
2892 | #else | 2900 | #else |
2893 | int w =mDatePicker->sizeHint().width() ; | 2901 | int w =mDatePicker->sizeHint().width() ; |
2894 | int h = mDatePicker->sizeHint().height() ; | 2902 | int h = mDatePicker->sizeHint().height() ; |
2895 | int dw = QApplication::desktop()->width(); | 2903 | int dw = QApplication::desktop()->width(); |
2896 | int dh = QApplication::desktop()->height(); | 2904 | int dh = QApplication::desktop()->height(); |
2897 | #endif | 2905 | #endif |
2898 | mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); | 2906 | mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); |
2899 | mDateFrame->show(); | 2907 | mDateFrame->show(); |
2900 | } | 2908 | } |
2901 | } | 2909 | } |
2902 | void CalendarView::showDatePicker( ) | 2910 | void CalendarView::showDatePicker( ) |
2903 | { | 2911 | { |
2904 | showDatePickerPopup(); | 2912 | showDatePickerPopup(); |
2905 | mDatePickerMode = 1; | 2913 | mDatePickerMode = 1; |
2906 | mDatePicker->setDate( mNavigator->selectedDates().first() ); | 2914 | mDatePicker->setDate( mNavigator->selectedDates().first() ); |
2907 | } | 2915 | } |
2908 | 2916 | ||
2909 | void CalendarView::showEventEditor() | 2917 | void CalendarView::showEventEditor() |
2910 | { | 2918 | { |
2911 | #ifdef DESKTOP_VERSION | 2919 | #ifdef DESKTOP_VERSION |
2912 | int x,y,w,h; | 2920 | int x,y,w,h; |
2913 | x = mEventEditor->geometry().x(); | 2921 | x = mEventEditor->geometry().x(); |
2914 | y = mEventEditor->geometry().y(); | 2922 | y = mEventEditor->geometry().y(); |
2915 | w = mEventEditor->width(); | 2923 | w = mEventEditor->width(); |
2916 | h = mEventEditor->height(); | 2924 | h = mEventEditor->height(); |
2917 | mEventEditor->show(); | 2925 | mEventEditor->show(); |
2918 | mEventEditor->setGeometry(x,y,w,h); | 2926 | mEventEditor->setGeometry(x,y,w,h); |
2919 | #else | 2927 | #else |
2920 | if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { | 2928 | if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { |
2921 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); | 2929 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
2922 | qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); | 2930 | qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); |
2923 | qApp->processEvents(); | 2931 | qApp->processEvents(); |
2924 | delete mEventEditor; | 2932 | delete mEventEditor; |
2925 | mEventEditor = mDialogManager->getEventEditor(); | 2933 | mEventEditor = mDialogManager->getEventEditor(); |
2926 | topLevelWidget()->setCaption( i18n("") ); | 2934 | topLevelWidget()->setCaption( i18n("") ); |
2927 | } | 2935 | } |
2928 | mEventEditor->showMaximized(); | 2936 | mEventEditor->showMaximized(); |
2929 | #endif | 2937 | #endif |
2930 | } | 2938 | } |
2931 | void CalendarView::showTodoEditor() | 2939 | void CalendarView::showTodoEditor() |
2932 | { | 2940 | { |
2933 | #ifdef DESKTOP_VERSION | 2941 | #ifdef DESKTOP_VERSION |
2934 | int x,y,w,h; | 2942 | int x,y,w,h; |
2935 | x = mTodoEditor->geometry().x(); | 2943 | x = mTodoEditor->geometry().x(); |
2936 | y = mTodoEditor->geometry().y(); | 2944 | y = mTodoEditor->geometry().y(); |
2937 | w = mTodoEditor->width(); | 2945 | w = mTodoEditor->width(); |
2938 | h = mTodoEditor->height(); | 2946 | h = mTodoEditor->height(); |
2939 | mTodoEditor->show(); | 2947 | mTodoEditor->show(); |
2940 | mTodoEditor->setGeometry(x,y,w,h); | 2948 | mTodoEditor->setGeometry(x,y,w,h); |
2941 | #else | 2949 | #else |
2942 | if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { | 2950 | if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { |
2943 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); | 2951 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
2944 | qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); | 2952 | qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); |
2945 | qApp->processEvents(); | 2953 | qApp->processEvents(); |
2946 | delete mTodoEditor; | 2954 | delete mTodoEditor; |
2947 | mTodoEditor = mDialogManager->getTodoEditor(); | 2955 | mTodoEditor = mDialogManager->getTodoEditor(); |
2948 | topLevelWidget()->setCaption( i18n("") ); | 2956 | topLevelWidget()->setCaption( i18n("") ); |
2949 | } | 2957 | } |
2950 | mTodoEditor->showMaximized(); | 2958 | mTodoEditor->showMaximized(); |
2951 | #endif | 2959 | #endif |
2952 | } | 2960 | } |
2953 | 2961 | ||
2954 | void CalendarView::cloneIncidence() | 2962 | void CalendarView::cloneIncidence() |
2955 | { | 2963 | { |
2956 | Incidence *incidence = currentSelection(); | 2964 | Incidence *incidence = currentSelection(); |
2957 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2965 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2958 | if ( incidence ) { | 2966 | if ( incidence ) { |
2959 | cloneIncidence(incidence); | 2967 | cloneIncidence(incidence); |
2960 | } | 2968 | } |
2961 | } | 2969 | } |
2962 | void CalendarView::moveIncidence() | 2970 | void CalendarView::moveIncidence() |
2963 | { | 2971 | { |
2964 | Incidence *incidence = currentSelection(); | 2972 | Incidence *incidence = currentSelection(); |
2965 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2973 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2966 | if ( incidence ) { | 2974 | if ( incidence ) { |
2967 | moveIncidence(incidence); | 2975 | moveIncidence(incidence); |
2968 | } | 2976 | } |
2969 | } | 2977 | } |
2970 | void CalendarView::beamIncidence() | 2978 | void CalendarView::beamIncidence() |
2971 | { | 2979 | { |
2972 | Incidence *incidence = currentSelection(); | 2980 | Incidence *incidence = currentSelection(); |
2973 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2981 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2974 | if ( incidence ) { | 2982 | if ( incidence ) { |
2975 | beamIncidence(incidence); | 2983 | beamIncidence(incidence); |
2976 | } | 2984 | } |
2977 | } | 2985 | } |
2978 | void CalendarView::toggleCancelIncidence() | 2986 | void CalendarView::toggleCancelIncidence() |
2979 | { | 2987 | { |
2980 | Incidence *incidence = currentSelection(); | 2988 | Incidence *incidence = currentSelection(); |
2981 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2989 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2982 | if ( incidence ) { | 2990 | if ( incidence ) { |
2983 | cancelIncidence(incidence); | 2991 | cancelIncidence(incidence); |
2984 | } | 2992 | } |
2985 | } | 2993 | } |
2986 | 2994 | ||
2987 | 2995 | ||
2988 | void CalendarView::cancelIncidence(Incidence * inc ) | 2996 | void CalendarView::cancelIncidence(Incidence * inc ) |
2989 | { | 2997 | { |
2990 | inc->setCancelled( ! inc->cancelled() ); | 2998 | inc->setCancelled( ! inc->cancelled() ); |
2991 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); | 2999 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); |
2992 | updateView(); | 3000 | updateView(); |
2993 | } | 3001 | } |
2994 | void CalendarView::cloneIncidence(Incidence * orgInc ) | 3002 | void CalendarView::cloneIncidence(Incidence * orgInc ) |
2995 | { | 3003 | { |
2996 | Incidence * newInc = orgInc->clone(); | 3004 | Incidence * newInc = orgInc->clone(); |
2997 | newInc->recreate(); | 3005 | newInc->recreate(); |
2998 | 3006 | ||
2999 | if ( newInc->typeID() == todoID ) { | 3007 | if ( newInc->typeID() == todoID ) { |
3000 | Todo* t = (Todo*) newInc; | 3008 | Todo* t = (Todo*) newInc; |
3001 | bool cloneSub = false; | 3009 | bool cloneSub = false; |
3002 | if ( orgInc->relations().count() ) { | 3010 | if ( orgInc->relations().count() ) { |
3003 | int result = KMessageBox::warningYesNoCancel(this, | 3011 | int result = KMessageBox::warningYesNoCancel(this, |
3004 | i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( newInc->summary().left ( 25 ) ), | 3012 | i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( newInc->summary().left ( 25 ) ), |
3005 | i18n("Todo has subtodos"), | 3013 | i18n("Todo has subtodos"), |
3006 | i18n("Yes"), | 3014 | i18n("Yes"), |
3007 | i18n("No")); | 3015 | i18n("No")); |
3008 | 3016 | ||
3009 | if ( result == KMessageBox::Cancel ) { | 3017 | if ( result == KMessageBox::Cancel ) { |
3010 | delete t; | 3018 | delete t; |
3011 | return; | 3019 | return; |
3012 | } | 3020 | } |
3013 | if (result == KMessageBox::Yes) cloneSub = true; | 3021 | if (result == KMessageBox::Yes) cloneSub = true; |
3014 | } | 3022 | } |
3015 | showTodoEditor(); | 3023 | showTodoEditor(); |
3016 | mTodoEditor->editTodo( t ); | 3024 | mTodoEditor->editTodo( t ); |
3017 | if ( mTodoEditor->exec() ) { | 3025 | if ( mTodoEditor->exec() ) { |
3018 | if ( cloneSub ) { | 3026 | if ( cloneSub ) { |
3019 | orgInc->cloneRelations( t ); | 3027 | orgInc->cloneRelations( t ); |
3020 | mCalendar->addIncidenceBranch( t ); | 3028 | mCalendar->addIncidenceBranch( t ); |
3021 | updateView(); | 3029 | updateView(); |
3022 | 3030 | ||
3023 | } else { | 3031 | } else { |
3024 | mCalendar->addTodo( t ); | 3032 | mCalendar->addTodo( t ); |
3025 | updateView(); | 3033 | updateView(); |
3026 | } | 3034 | } |
3027 | } else { | 3035 | } else { |
3028 | delete t; | 3036 | delete t; |
3029 | } | 3037 | } |
3030 | } | 3038 | } |
3031 | else { | 3039 | else { |
3032 | Event* e = (Event*) newInc; | 3040 | Event* e = (Event*) newInc; |
3033 | showEventEditor(); | 3041 | showEventEditor(); |
3034 | mEventEditor->editEvent( e ); | 3042 | mEventEditor->editEvent( e ); |
3035 | if ( mEventEditor->exec() ) { | 3043 | if ( mEventEditor->exec() ) { |
3036 | mCalendar->addEvent( e ); | 3044 | mCalendar->addEvent( e ); |
3037 | updateView(); | 3045 | updateView(); |
3038 | } else { | 3046 | } else { |
3039 | delete e; | 3047 | delete e; |
3040 | } | 3048 | } |
3041 | } | 3049 | } |
3042 | setActiveWindow(); | 3050 | setActiveWindow(); |
3043 | } | 3051 | } |
3044 | 3052 | ||
3045 | void CalendarView::newEvent() | 3053 | void CalendarView::newEvent() |
3046 | { | 3054 | { |
3047 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. | 3055 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. |
3048 | KOAgendaView *aView = mViewManager->agendaView(); | 3056 | KOAgendaView *aView = mViewManager->agendaView(); |
3049 | if (aView) { | 3057 | if (aView) { |
3050 | if (aView->selectionStart().isValid()) { | 3058 | if (aView->selectionStart().isValid()) { |
3051 | if (aView->selectedIsAllDay()) { | 3059 | if (aView->selectedIsAllDay()) { |
3052 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); | 3060 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); |
3053 | } else { | 3061 | } else { |
3054 | newEvent(aView->selectionStart(),aView->selectionEnd()); | 3062 | newEvent(aView->selectionStart(),aView->selectionEnd()); |
3055 | } | 3063 | } |
3056 | return; | 3064 | return; |
3057 | } | 3065 | } |
3058 | } | 3066 | } |
3059 | 3067 | ||
3060 | QDate date = mNavigator->selectedDates().first(); | 3068 | QDate date = mNavigator->selectedDates().first(); |
3061 | QDateTime current = QDateTime::currentDateTime(); | 3069 | QDateTime current = QDateTime::currentDateTime(); |
3062 | if ( date <= current.date() ) { | 3070 | if ( date <= current.date() ) { |
3063 | int hour = current.time().hour() +1; | 3071 | int hour = current.time().hour() +1; |
3064 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), | 3072 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), |
3065 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 3073 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
3066 | } else | 3074 | } else |
3067 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), | 3075 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), |
3068 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + | 3076 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + |
3069 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 3077 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
3070 | } | 3078 | } |
3071 | 3079 | ||
3072 | void CalendarView::newEvent(QDateTime fh) | 3080 | void CalendarView::newEvent(QDateTime fh) |
3073 | { | 3081 | { |
3074 | newEvent(fh, | 3082 | newEvent(fh, |
3075 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); | 3083 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); |
3076 | } | 3084 | } |
3077 | 3085 | ||
3078 | void CalendarView::newEvent(QDate dt) | 3086 | void CalendarView::newEvent(QDate dt) |
3079 | { | 3087 | { |
3080 | newEvent(QDateTime(dt, QTime(0,0,0)), | 3088 | newEvent(QDateTime(dt, QTime(0,0,0)), |
3081 | QDateTime(dt, QTime(0,0,0)), true); | 3089 | QDateTime(dt, QTime(0,0,0)), true); |
3082 | } | 3090 | } |
3083 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint) | 3091 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint) |
3084 | { | 3092 | { |
3085 | newEvent(fromHint, toHint, false); | 3093 | newEvent(fromHint, toHint, false); |
3086 | } | 3094 | } |
3087 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) | 3095 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) |
3088 | { | 3096 | { |
3089 | 3097 | ||
3090 | showEventEditor(); | 3098 | showEventEditor(); |
3091 | mEventEditor->newEvent(fromHint,toHint,allDay); | 3099 | mEventEditor->newEvent(fromHint,toHint,allDay); |
3092 | if ( mFilterView->filtersEnabled() ) { | 3100 | if ( mFilterView->filtersEnabled() ) { |
3093 | CalFilter *filter = mFilterView->selectedFilter(); | 3101 | CalFilter *filter = mFilterView->selectedFilter(); |
3094 | if (filter && filter->showCategories()) { | 3102 | if (filter && filter->showCategories()) { |
3095 | mEventEditor->setCategories(filter->categoryList().join(",") ); | 3103 | mEventEditor->setCategories(filter->categoryList().join(",") ); |
3096 | } | 3104 | } |
3097 | if ( filter ) | 3105 | if ( filter ) |
3098 | mEventEditor->setSecrecy( filter->getSecrecy() ); | 3106 | mEventEditor->setSecrecy( filter->getSecrecy() ); |
3099 | } | 3107 | } |
3100 | mEventEditor->exec(); | 3108 | mEventEditor->exec(); |
3101 | setActiveWindow(); | 3109 | setActiveWindow(); |
3102 | } | 3110 | } |
3103 | void CalendarView::todoAdded(Todo * t) | 3111 | void CalendarView::todoAdded(Todo * t) |
3104 | { | 3112 | { |
3105 | 3113 | ||
3106 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); | 3114 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); |
3107 | updateTodoViews(); | 3115 | updateTodoViews(); |
3108 | } | 3116 | } |
3109 | void CalendarView::todoChanged(Todo * t) | 3117 | void CalendarView::todoChanged(Todo * t) |
3110 | { | 3118 | { |
3111 | emit todoModified( t, 4 ); | 3119 | emit todoModified( t, 4 ); |
3112 | // updateTodoViews(); | 3120 | // updateTodoViews(); |
3113 | } | 3121 | } |
3114 | void CalendarView::todoToBeDeleted(Todo *) | 3122 | void CalendarView::todoToBeDeleted(Todo *) |
3115 | { | 3123 | { |
3116 | //qDebug("todoToBeDeleted(Todo *) "); | 3124 | //qDebug("todoToBeDeleted(Todo *) "); |
3117 | updateTodoViews(); | 3125 | updateTodoViews(); |
3118 | } | 3126 | } |
3119 | void CalendarView::todoDeleted() | 3127 | void CalendarView::todoDeleted() |
3120 | { | 3128 | { |
3121 | //qDebug(" todoDeleted()"); | 3129 | //qDebug(" todoDeleted()"); |
3122 | updateTodoViews(); | 3130 | updateTodoViews(); |
3123 | } | 3131 | } |
3124 | 3132 | ||
3125 | 3133 | ||
3126 | void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) | 3134 | void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) |
3127 | { | 3135 | { |
3128 | showTodoEditor(); | 3136 | showTodoEditor(); |
3129 | mTodoEditor->newTodo(dt,0,allday); | 3137 | mTodoEditor->newTodo(dt,0,allday); |
3130 | if ( mFilterView->filtersEnabled() ) { | 3138 | if ( mFilterView->filtersEnabled() ) { |
3131 | CalFilter *filter = mFilterView->selectedFilter(); | 3139 | CalFilter *filter = mFilterView->selectedFilter(); |
3132 | if (filter && filter->showCategories()) { | 3140 | if (filter && filter->showCategories()) { |
3133 | mTodoEditor->setCategories(filter->categoryList().join(",") ); | 3141 | mTodoEditor->setCategories(filter->categoryList().join(",") ); |
3134 | } | 3142 | } |
3135 | if ( filter ) | 3143 | if ( filter ) |
3136 | mTodoEditor->setSecrecy( filter->getSecrecy() ); | 3144 | mTodoEditor->setSecrecy( filter->getSecrecy() ); |
3137 | } | 3145 | } |
3138 | mTodoEditor->exec(); | 3146 | mTodoEditor->exec(); |
3139 | setActiveWindow(); | 3147 | setActiveWindow(); |
3140 | } | 3148 | } |
3141 | 3149 | ||
3142 | void CalendarView::newTodo() | 3150 | void CalendarView::newTodo() |
3143 | { | 3151 | { |
3144 | newTodoDateTime( QDateTime(),true ); | 3152 | newTodoDateTime( QDateTime(),true ); |
3145 | } | 3153 | } |
3146 | 3154 | ||
3147 | void CalendarView::newSubTodo() | 3155 | void CalendarView::newSubTodo() |
3148 | { | 3156 | { |
3149 | Todo *todo = selectedTodo(); | 3157 | Todo *todo = selectedTodo(); |
3150 | if ( todo ) newSubTodo( todo ); | 3158 | if ( todo ) newSubTodo( todo ); |
3151 | } | 3159 | } |
3152 | 3160 | ||
3153 | void CalendarView::newSubTodo(Todo *parentEvent) | 3161 | void CalendarView::newSubTodo(Todo *parentEvent) |
3154 | { | 3162 | { |
3155 | 3163 | ||
3156 | showTodoEditor(); | 3164 | showTodoEditor(); |
3157 | mTodoEditor->newTodo(QDateTime(),parentEvent,true); | 3165 | mTodoEditor->newTodo(QDateTime(),parentEvent,true); |
3158 | mTodoEditor->exec(); | 3166 | mTodoEditor->exec(); |
3159 | setActiveWindow(); | 3167 | setActiveWindow(); |
3160 | } | 3168 | } |
3161 | 3169 | ||
3162 | void CalendarView::newFloatingEvent() | 3170 | void CalendarView::newFloatingEvent() |
3163 | { | 3171 | { |
3164 | DateList tmpList = mNavigator->selectedDates(); | 3172 | DateList tmpList = mNavigator->selectedDates(); |
3165 | QDate date = tmpList.first(); | 3173 | QDate date = tmpList.first(); |
3166 | 3174 | ||
3167 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), | 3175 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), |
3168 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); | 3176 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); |
3169 | } | 3177 | } |
3170 | 3178 | ||
3171 | 3179 | ||
3172 | void CalendarView::editEvent( Event *event ) | 3180 | void CalendarView::editEvent( Event *event ) |
3173 | { | 3181 | { |
3174 | 3182 | ||
3175 | if ( !event ) return; | 3183 | if ( !event ) return; |
3176 | if ( event->isReadOnly() ) { | 3184 | if ( event->isReadOnly() ) { |
3177 | showEvent( event ); | 3185 | showEvent( event ); |
3178 | return; | 3186 | return; |
3179 | } | 3187 | } |
3180 | showEventEditor(); | 3188 | showEventEditor(); |
3181 | mEventEditor->editEvent( event , mFlagEditDescription); | 3189 | mEventEditor->editEvent( event , mFlagEditDescription); |
3182 | mEventEditor->exec(); | 3190 | mEventEditor->exec(); |
3183 | setActiveWindow(); | 3191 | setActiveWindow(); |
3184 | 3192 | ||
3185 | } | 3193 | } |
3186 | void CalendarView::editJournal( Journal *jour ) | 3194 | void CalendarView::editJournal( Journal *jour ) |
3187 | { | 3195 | { |
3188 | if ( !jour ) return; | 3196 | if ( !jour ) return; |
3189 | mDialogManager->hideSearchDialog(); | 3197 | mDialogManager->hideSearchDialog(); |
3190 | mViewManager->showJournalView(); | 3198 | mViewManager->showJournalView(); |
3191 | mNavigator->slotDaySelect( jour->dtStart().date() ); | 3199 | mNavigator->slotDaySelect( jour->dtStart().date() ); |
3192 | } | 3200 | } |
3193 | void CalendarView::editTodo( Todo *todo ) | 3201 | void CalendarView::editTodo( Todo *todo ) |
3194 | { | 3202 | { |
3195 | if ( !todo ) return; | 3203 | if ( !todo ) return; |
3196 | 3204 | ||
3197 | if ( todo->isReadOnly() ) { | 3205 | if ( todo->isReadOnly() ) { |
3198 | showTodo( todo ); | 3206 | showTodo( todo ); |
3199 | return; | 3207 | return; |
3200 | } | 3208 | } |
3201 | showTodoEditor(); | 3209 | showTodoEditor(); |
3202 | mTodoEditor->editTodo( todo ,mFlagEditDescription); | 3210 | mTodoEditor->editTodo( todo ,mFlagEditDescription); |
3203 | mTodoEditor->exec(); | 3211 | mTodoEditor->exec(); |
3204 | setActiveWindow(); | 3212 | setActiveWindow(); |
3205 | 3213 | ||
3206 | } | 3214 | } |
3207 | 3215 | ||
3208 | KOEventViewerDialog* CalendarView::getEventViewerDialog() | 3216 | KOEventViewerDialog* CalendarView::getEventViewerDialog() |
3209 | { | 3217 | { |
3210 | if ( !mEventViewerDialog ) { | 3218 | if ( !mEventViewerDialog ) { |
3211 | mEventViewerDialog = new KOEventViewerDialog(0); | 3219 | mEventViewerDialog = new KOEventViewerDialog(0); |
3212 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); | 3220 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); |
3213 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); | 3221 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); |
3214 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), | 3222 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), |
3215 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); | 3223 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); |
3216 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), | 3224 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), |
3217 | viewManager(), SLOT( showAgendaView( bool ) ) ); | 3225 | viewManager(), SLOT( showAgendaView( bool ) ) ); |
3218 | connect( mEventViewerDialog, SIGNAL(signalViewerClosed()), | 3226 | connect( mEventViewerDialog, SIGNAL(signalViewerClosed()), |
3219 | this, SLOT( slotViewerClosed() ) ); | 3227 | this, SLOT( slotViewerClosed() ) ); |
3220 | connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), | 3228 | connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), |
3221 | this, SLOT( todoChanged(Todo *) ) ); | 3229 | this, SLOT( todoChanged(Todo *) ) ); |
3222 | mEventViewerDialog->resize( 640, 480 ); | 3230 | mEventViewerDialog->resize( 640, 480 ); |
3223 | 3231 | ||
3224 | } | 3232 | } |
3225 | return mEventViewerDialog; | 3233 | return mEventViewerDialog; |
3226 | } | 3234 | } |
3227 | void CalendarView::showEvent(Event *event) | 3235 | void CalendarView::showEvent(Event *event) |
3228 | { | 3236 | { |
3229 | getEventViewerDialog()->setEvent(event); | 3237 | getEventViewerDialog()->setEvent(event); |
3230 | getEventViewerDialog()->showMe(); | 3238 | getEventViewerDialog()->showMe(); |
3231 | } | 3239 | } |
3232 | 3240 | ||
3233 | void CalendarView::showTodo(Todo *event) | 3241 | void CalendarView::showTodo(Todo *event) |
3234 | { | 3242 | { |
3235 | getEventViewerDialog()->setTodo(event); | 3243 | getEventViewerDialog()->setTodo(event); |
3236 | getEventViewerDialog()->showMe(); | 3244 | getEventViewerDialog()->showMe(); |
3237 | } | 3245 | } |
3238 | void CalendarView::showJournal( Journal *jour ) | 3246 | void CalendarView::showJournal( Journal *jour ) |
3239 | { | 3247 | { |
3240 | getEventViewerDialog()->setJournal(jour); | 3248 | getEventViewerDialog()->setJournal(jour); |
3241 | getEventViewerDialog()->showMe(); | 3249 | getEventViewerDialog()->showMe(); |
3242 | 3250 | ||
3243 | } | 3251 | } |
3244 | // void CalendarView::todoModified (Todo *event, int changed) | 3252 | // void CalendarView::todoModified (Todo *event, int changed) |
3245 | // { | 3253 | // { |
3246 | // // if (mDialogList.find (event) != mDialogList.end ()) { | 3254 | // // if (mDialogList.find (event) != mDialogList.end ()) { |
3247 | // // kdDebug() << "Todo modified and open" << endl; | 3255 | // // kdDebug() << "Todo modified and open" << endl; |
3248 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; | 3256 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; |
3249 | // // temp->modified (changed); | 3257 | // // temp->modified (changed); |
3250 | 3258 | ||
3251 | // // } | 3259 | // // } |
3252 | 3260 | ||
3253 | // mViewManager->updateView(); | 3261 | // mViewManager->updateView(); |
3254 | // } | 3262 | // } |
3255 | 3263 | ||
3256 | void CalendarView::appointment_show() | 3264 | void CalendarView::appointment_show() |
3257 | { | 3265 | { |
3258 | Event *anEvent = 0; | 3266 | Event *anEvent = 0; |
3259 | 3267 | ||
3260 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 3268 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
3261 | 3269 | ||
3262 | if (mViewManager->currentView()->isEventView()) { | 3270 | if (mViewManager->currentView()->isEventView()) { |
3263 | if ( incidence && incidence->typeID() == eventID ) { | 3271 | if ( incidence && incidence->typeID() == eventID ) { |
3264 | anEvent = static_cast<Event *>(incidence); | 3272 | anEvent = static_cast<Event *>(incidence); |
3265 | } | 3273 | } |
3266 | } | 3274 | } |
3267 | 3275 | ||
3268 | if (!anEvent) { | 3276 | if (!anEvent) { |
3269 | KNotifyClient::beep(); | 3277 | KNotifyClient::beep(); |
3270 | return; | 3278 | return; |
3271 | } | 3279 | } |
3272 | 3280 | ||
3273 | showEvent(anEvent); | 3281 | showEvent(anEvent); |
3274 | } | 3282 | } |
3275 | 3283 | ||
3276 | void CalendarView::appointment_edit() | 3284 | void CalendarView::appointment_edit() |
3277 | { | 3285 | { |
3278 | Event *anEvent = 0; | 3286 | Event *anEvent = 0; |
3279 | 3287 | ||
3280 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 3288 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
3281 | 3289 | ||
3282 | if (mViewManager->currentView()->isEventView()) { | 3290 | if (mViewManager->currentView()->isEventView()) { |
3283 | if ( incidence && incidence->typeID() == eventID ) { | 3291 | if ( incidence && incidence->typeID() == eventID ) { |
3284 | anEvent = static_cast<Event *>(incidence); | 3292 | anEvent = static_cast<Event *>(incidence); |
3285 | } | 3293 | } |
3286 | } | 3294 | } |
3287 | 3295 | ||
3288 | if (!anEvent) { | 3296 | if (!anEvent) { |
3289 | KNotifyClient::beep(); | 3297 | KNotifyClient::beep(); |
3290 | return; | 3298 | return; |
3291 | } | 3299 | } |
3292 | 3300 | ||
3293 | editEvent(anEvent); | 3301 | editEvent(anEvent); |
3294 | } | 3302 | } |
3295 | 3303 | ||
3296 | void CalendarView::appointment_delete() | 3304 | void CalendarView::appointment_delete() |
3297 | { | 3305 | { |
3298 | Event *anEvent = 0; | 3306 | Event *anEvent = 0; |
3299 | 3307 | ||
3300 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 3308 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
3301 | 3309 | ||
3302 | if (mViewManager->currentView()->isEventView()) { | 3310 | if (mViewManager->currentView()->isEventView()) { |
3303 | if ( incidence && incidence->typeID() == eventID ) { | 3311 | if ( incidence && incidence->typeID() == eventID ) { |
3304 | anEvent = static_cast<Event *>(incidence); | 3312 | anEvent = static_cast<Event *>(incidence); |
3305 | } | 3313 | } |
3306 | } | 3314 | } |
3307 | 3315 | ||
3308 | if (!anEvent) { | 3316 | if (!anEvent) { |
3309 | KNotifyClient::beep(); | 3317 | KNotifyClient::beep(); |
3310 | return; | 3318 | return; |
3311 | } | 3319 | } |
3312 | 3320 | ||
3313 | deleteEvent(anEvent); | 3321 | deleteEvent(anEvent); |
3314 | } | 3322 | } |
3315 | 3323 | ||
3316 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) | 3324 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) |
3317 | { | 3325 | { |
3318 | if (!sub) return; | 3326 | if (!sub) return; |
3319 | if ( sub->relatedTo() == parent ) | 3327 | if ( sub->relatedTo() == parent ) |
3320 | return; | 3328 | return; |
3321 | sub->setRelatedTo(parent); | 3329 | sub->setRelatedTo(parent); |
3322 | sub->updated(); | 3330 | sub->updated(); |
3323 | setModified(true); | 3331 | setModified(true); |
3324 | updateView(); | 3332 | updateView(); |
3325 | } | 3333 | } |
3326 | void CalendarView::todo_unsub(Todo *anTodo ) | 3334 | void CalendarView::todo_unsub(Todo *anTodo ) |
3327 | { | 3335 | { |
3328 | todo_resub( 0, anTodo ); | 3336 | todo_resub( 0, anTodo ); |
3329 | } | 3337 | } |
3330 | 3338 | ||
3331 | void CalendarView::deleteTodo(Todo *todo) | 3339 | void CalendarView::deleteTodo(Todo *todo) |
3332 | { | 3340 | { |
3333 | if (!todo) { | 3341 | if (!todo) { |
3334 | KNotifyClient::beep(); | 3342 | KNotifyClient::beep(); |
3335 | return; | 3343 | return; |
3336 | } | 3344 | } |
3337 | if (KOPrefs::instance()->mConfirm) { | 3345 | if (KOPrefs::instance()->mConfirm) { |
3338 | QString text = todo->summary().left(20); | 3346 | QString text = todo->summary().left(20); |
3339 | if (!todo->relations().isEmpty()) { | 3347 | if (!todo->relations().isEmpty()) { |
3340 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); | 3348 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); |
3341 | 3349 | ||
3342 | } | 3350 | } |
3343 | switch (msgItemDelete(text)) { | 3351 | switch (msgItemDelete(text)) { |
3344 | case KMessageBox::Continue: // OK | 3352 | case KMessageBox::Continue: // OK |
3345 | bool deleteT = false; | 3353 | bool deleteT = false; |
3346 | if (!todo->relations().isEmpty()) { | 3354 | if (!todo->relations().isEmpty()) { |
3347 | deleteT = removeCompletedSubTodos( todo ); | 3355 | deleteT = removeCompletedSubTodos( todo ); |
3348 | } | 3356 | } |
3349 | // deleteT == true: todo already deleted in removeCompletedSubTodos | 3357 | // deleteT == true: todo already deleted in removeCompletedSubTodos |
3350 | if ( !deleteT ) { | 3358 | if ( !deleteT ) { |
3351 | checkExternalId( todo ); | 3359 | checkExternalId( todo ); |
3352 | calendar()->deleteTodo(todo); | 3360 | calendar()->deleteTodo(todo); |
3353 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 3361 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
3354 | updateView(); | 3362 | updateView(); |
3355 | } | 3363 | } |
3356 | break; | 3364 | break; |
3357 | } // switch | 3365 | } // switch |
3358 | } else { | 3366 | } else { |
3359 | checkExternalId( todo ); | 3367 | checkExternalId( todo ); |
3360 | mCalendar->deleteTodo(todo); | 3368 | mCalendar->deleteTodo(todo); |
3361 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 3369 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
3362 | updateView(); | 3370 | updateView(); |
3363 | } | 3371 | } |
3364 | 3372 | ||
3365 | emit updateSearchDialog(); | 3373 | emit updateSearchDialog(); |
3366 | } | 3374 | } |
3367 | void CalendarView::deleteJournal(Journal *jour) | 3375 | void CalendarView::deleteJournal(Journal *jour) |
3368 | { | 3376 | { |
3369 | if (!jour) { | 3377 | if (!jour) { |
3370 | KNotifyClient::beep(); | 3378 | KNotifyClient::beep(); |
3371 | return; | 3379 | return; |
3372 | } | 3380 | } |
3373 | if (KOPrefs::instance()->mConfirm) { | 3381 | if (KOPrefs::instance()->mConfirm) { |
3374 | switch (msgItemDelete( jour->description().left(20))) { | 3382 | switch (msgItemDelete( jour->description().left(20))) { |
3375 | case KMessageBox::Continue: // OK | 3383 | case KMessageBox::Continue: // OK |
3376 | calendar()->deleteJournal(jour); | 3384 | calendar()->deleteJournal(jour); |
3377 | updateView(); | 3385 | updateView(); |
3378 | break; | 3386 | break; |
3379 | } // switch | 3387 | } // switch |
3380 | } else { | 3388 | } else { |
3381 | calendar()->deleteJournal(jour);; | 3389 | calendar()->deleteJournal(jour);; |
3382 | updateView(); | 3390 | updateView(); |
3383 | } | 3391 | } |
3384 | emit updateSearchDialog(); | 3392 | emit updateSearchDialog(); |
3385 | } | 3393 | } |
3386 | 3394 | ||
3387 | void CalendarView::deleteEvent(Event *anEvent) | 3395 | void CalendarView::deleteEvent(Event *anEvent) |
3388 | { | 3396 | { |
3389 | if (!anEvent) { | 3397 | if (!anEvent) { |
3390 | KNotifyClient::beep(); | 3398 | KNotifyClient::beep(); |
3391 | return; | 3399 | return; |
3392 | } | 3400 | } |
3393 | 3401 | ||
3394 | if (anEvent->recurrence()->doesRecur()) { | 3402 | if (anEvent->recurrence()->doesRecur()) { |
3395 | QDate itemDate = mViewManager->currentSelectionDate(); | 3403 | QDate itemDate = mViewManager->currentSelectionDate(); |
3396 | int km; | 3404 | int km; |
3397 | if (!itemDate.isValid()) { | 3405 | if (!itemDate.isValid()) { |
3398 | //kdDebug() << "Date Not Valid" << endl; | 3406 | //kdDebug() << "Date Not Valid" << endl; |
3399 | if (KOPrefs::instance()->mConfirm) { | 3407 | if (KOPrefs::instance()->mConfirm) { |
3400 | km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + | 3408 | km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + |
3401 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), | 3409 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), |
3402 | i18n("KO/Pi Confirmation"),i18n("Delete All")); | 3410 | i18n("KO/Pi Confirmation"),i18n("Delete All")); |
3403 | if ( km == KMessageBox::Continue ) | 3411 | if ( km == KMessageBox::Continue ) |
3404 | km = KMessageBox::No; // No = all below | 3412 | km = KMessageBox::No; // No = all below |
3405 | } else | 3413 | } else |
3406 | km = KMessageBox::No; | 3414 | km = KMessageBox::No; |
3407 | } else { | 3415 | } else { |
3408 | km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) + | 3416 | km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) + |
3409 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ | 3417 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ |
3410 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), | 3418 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), |
3411 | i18n("KO/Pi Confirmation"),i18n("Current"), | 3419 | i18n("KO/Pi Confirmation"),i18n("Current"), |
3412 | i18n("All")); | 3420 | i18n("All")); |
3413 | } | 3421 | } |
3414 | switch(km) { | 3422 | switch(km) { |
3415 | 3423 | ||
3416 | case KMessageBox::No: // Continue // all | 3424 | case KMessageBox::No: // Continue // all |
3417 | //qDebug("KMessageBox::No "); | 3425 | //qDebug("KMessageBox::No "); |
3418 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 3426 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
3419 | schedule(Scheduler::Cancel,anEvent); | 3427 | schedule(Scheduler::Cancel,anEvent); |
3420 | 3428 | ||
3421 | checkExternalId( anEvent); | 3429 | checkExternalId( anEvent); |
3422 | mCalendar->deleteEvent(anEvent); | 3430 | mCalendar->deleteEvent(anEvent); |
3423 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); | 3431 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); |
3424 | break; | 3432 | break; |
3425 | 3433 | ||
3426 | // Disabled because it does not work | 3434 | // Disabled because it does not work |
3427 | //#if 0 | 3435 | //#if 0 |
3428 | case KMessageBox::Yes: // just this one | 3436 | case KMessageBox::Yes: // just this one |
3429 | //QDate qd = mNavigator->selectedDates().first(); | 3437 | //QDate qd = mNavigator->selectedDates().first(); |
3430 | //if (!qd.isValid()) { | 3438 | //if (!qd.isValid()) { |
3431 | // kdDebug() << "no date selected, or invalid date" << endl; | 3439 | // kdDebug() << "no date selected, or invalid date" << endl; |
3432 | // KNotifyClient::beep(); | 3440 | // KNotifyClient::beep(); |
3433 | // return; | 3441 | // return; |
3434 | //} | 3442 | //} |
3435 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); | 3443 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); |
3436 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { | 3444 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { |
3437 | anEvent->addExDate(itemDate); | 3445 | anEvent->addExDate(itemDate); |
3438 | int duration = anEvent->recurrence()->duration(); | 3446 | int duration = anEvent->recurrence()->duration(); |
3439 | if ( duration > 0 ) { | 3447 | if ( duration > 0 ) { |
3440 | anEvent->recurrence()->setDuration( duration - 1 ); | 3448 | anEvent->recurrence()->setDuration( duration - 1 ); |
3441 | } | 3449 | } |
3442 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); | 3450 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); |
3443 | } | 3451 | } |
3444 | break; | 3452 | break; |
3445 | //#endif | 3453 | //#endif |
3446 | } // switch | 3454 | } // switch |
3447 | } else { | 3455 | } else { |
3448 | if (KOPrefs::instance()->mConfirm) { | 3456 | if (KOPrefs::instance()->mConfirm) { |
3449 | switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + | 3457 | switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + |
3450 | i18n("\nAre you sure you want\nto delete this event?"), | 3458 | i18n("\nAre you sure you want\nto delete this event?"), |
3451 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { | 3459 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { |
3452 | case KMessageBox::Continue: // OK | 3460 | case KMessageBox::Continue: // OK |
3453 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 3461 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
3454 | schedule(Scheduler::Cancel,anEvent); | 3462 | schedule(Scheduler::Cancel,anEvent); |
3455 | checkExternalId( anEvent); | 3463 | checkExternalId( anEvent); |
3456 | mCalendar->deleteEvent(anEvent); | 3464 | mCalendar->deleteEvent(anEvent); |
3457 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 3465 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
3458 | break; | 3466 | break; |
3459 | } // switch | 3467 | } // switch |
3460 | } else { | 3468 | } else { |
3461 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 3469 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
3462 | schedule(Scheduler::Cancel,anEvent); | 3470 | schedule(Scheduler::Cancel,anEvent); |
3463 | checkExternalId( anEvent); | 3471 | checkExternalId( anEvent); |
3464 | mCalendar->deleteEvent(anEvent); | 3472 | mCalendar->deleteEvent(anEvent); |
3465 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 3473 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
3466 | } | 3474 | } |
3467 | } // if-else | 3475 | } // if-else |
3468 | emit updateSearchDialog(); | 3476 | emit updateSearchDialog(); |
3469 | } | 3477 | } |
3470 | 3478 | ||
3471 | bool CalendarView::deleteEvent(const QString &uid) | 3479 | bool CalendarView::deleteEvent(const QString &uid) |
3472 | { | 3480 | { |
3473 | Event *ev = mCalendar->event(uid); | 3481 | Event *ev = mCalendar->event(uid); |
3474 | if (ev) { | 3482 | if (ev) { |
3475 | deleteEvent(ev); | 3483 | deleteEvent(ev); |
3476 | return true; | 3484 | return true; |
3477 | } else { | 3485 | } else { |
3478 | return false; | 3486 | return false; |
3479 | } | 3487 | } |
3480 | } | 3488 | } |
3481 | 3489 | ||
3482 | /*****************************************************************************/ | 3490 | /*****************************************************************************/ |
3483 | 3491 | ||
3484 | void CalendarView::action_mail() | 3492 | void CalendarView::action_mail() |
3485 | { | 3493 | { |
3486 | #ifndef KORG_NOMAIL | 3494 | #ifndef KORG_NOMAIL |
3487 | KOMailClient mailClient; | 3495 | KOMailClient mailClient; |
3488 | 3496 | ||
3489 | Incidence *incidence = currentSelection(); | 3497 | Incidence *incidence = currentSelection(); |
3490 | 3498 | ||
3491 | if (!incidence) { | 3499 | if (!incidence) { |
3492 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 3500 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
3493 | return; | 3501 | return; |
3494 | } | 3502 | } |
3495 | if(incidence->attendeeCount() == 0 ) { | 3503 | if(incidence->attendeeCount() == 0 ) { |
3496 | KMessageBox::sorry(this, | 3504 | KMessageBox::sorry(this, |
3497 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 3505 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
3498 | return; | 3506 | return; |
3499 | } | 3507 | } |
3500 | 3508 | ||
3501 | CalendarLocal cal_tmp; | 3509 | CalendarLocal cal_tmp; |
3502 | Event *event = 0; | 3510 | Event *event = 0; |
3503 | Event *ev = 0; | 3511 | Event *ev = 0; |
3504 | if ( incidence && incidence->typeID() == eventID ) { | 3512 | if ( incidence && incidence->typeID() == eventID ) { |
3505 | event = static_cast<Event *>(incidence); | 3513 | event = static_cast<Event *>(incidence); |
3506 | ev = new Event(*event); | 3514 | ev = new Event(*event); |
3507 | cal_tmp.addEvent(ev); | 3515 | cal_tmp.addEvent(ev); |
3508 | } | 3516 | } |
3509 | ICalFormat mForm(); | 3517 | ICalFormat mForm(); |
3510 | QString attachment = mForm.toString( &cal_tmp ); | 3518 | QString attachment = mForm.toString( &cal_tmp ); |
3511 | if (ev) delete(ev); | 3519 | if (ev) delete(ev); |
3512 | 3520 | ||
3513 | mailClient.mailAttendees(currentSelection(), attachment); | 3521 | mailClient.mailAttendees(currentSelection(), attachment); |
3514 | 3522 | ||
3515 | #endif | 3523 | #endif |
3516 | 3524 | ||
3517 | #if 0 | 3525 | #if 0 |
3518 | Event *anEvent = 0; | 3526 | Event *anEvent = 0; |
3519 | if (mViewManager->currentView()->isEventView()) { | 3527 | if (mViewManager->currentView()->isEventView()) { |
3520 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); | 3528 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); |
3521 | } | 3529 | } |
3522 | 3530 | ||
3523 | if (!anEvent) { | 3531 | if (!anEvent) { |
3524 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 3532 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
3525 | return; | 3533 | return; |
3526 | } | 3534 | } |
3527 | if(anEvent->attendeeCount() == 0 ) { | 3535 | if(anEvent->attendeeCount() == 0 ) { |
3528 | KMessageBox::sorry(this, | 3536 | KMessageBox::sorry(this, |
3529 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 3537 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
3530 | return; | 3538 | return; |
3531 | } | 3539 | } |
3532 | 3540 | ||
3533 | mailobject.emailEvent(anEvent); | 3541 | mailobject.emailEvent(anEvent); |
3534 | #endif | 3542 | #endif |
3535 | } | 3543 | } |
3536 | 3544 | ||
3537 | 3545 | ||
3538 | void CalendarView::schedule_publish(Incidence *incidence) | 3546 | void CalendarView::schedule_publish(Incidence *incidence) |
3539 | { | 3547 | { |
3540 | Event *event = 0; | 3548 | Event *event = 0; |
3541 | Todo *todo = 0; | 3549 | Todo *todo = 0; |
3542 | 3550 | ||
3543 | if (incidence == 0) { | 3551 | if (incidence == 0) { |
3544 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 3552 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
3545 | if (incidence == 0) { | 3553 | if (incidence == 0) { |
3546 | incidence = mTodoList->selectedIncidences().first(); | 3554 | incidence = mTodoList->selectedIncidences().first(); |
3547 | } | 3555 | } |
3548 | } | 3556 | } |
3549 | if ( incidence && incidence->typeID() == eventID ) { | 3557 | if ( incidence && incidence->typeID() == eventID ) { |
3550 | event = static_cast<Event *>(incidence); | 3558 | event = static_cast<Event *>(incidence); |
3551 | } else { | 3559 | } else { |
3552 | if ( incidence && incidence->typeID() == todoID ) { | 3560 | if ( incidence && incidence->typeID() == todoID ) { |
3553 | todo = static_cast<Todo *>(incidence); | 3561 | todo = static_cast<Todo *>(incidence); |
3554 | } | 3562 | } |
3555 | } | 3563 | } |
3556 | 3564 | ||
3557 | if (!event && !todo) { | 3565 | if (!event && !todo) { |
3558 | KMessageBox::sorry(this,i18n("No event selected.")); | 3566 | KMessageBox::sorry(this,i18n("No event selected.")); |
3559 | return; | 3567 | return; |
3560 | } | 3568 | } |
3561 | 3569 | ||
3562 | PublishDialog *publishdlg = new PublishDialog(); | 3570 | PublishDialog *publishdlg = new PublishDialog(); |
3563 | if (incidence->attendeeCount()>0) { | 3571 | if (incidence->attendeeCount()>0) { |
3564 | QPtrList<Attendee> attendees = incidence->attendees(); | 3572 | QPtrList<Attendee> attendees = incidence->attendees(); |
3565 | attendees.first(); | 3573 | attendees.first(); |
3566 | while ( attendees.current()!=0 ) { | 3574 | while ( attendees.current()!=0 ) { |
3567 | publishdlg->addAttendee(attendees.current()); | 3575 | publishdlg->addAttendee(attendees.current()); |
3568 | attendees.next(); | 3576 | attendees.next(); |
3569 | } | 3577 | } |
3570 | } | 3578 | } |
3571 | bool send = true; | 3579 | bool send = true; |
3572 | if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { | 3580 | if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { |
3573 | if ( publishdlg->exec() != QDialog::Accepted ) | 3581 | if ( publishdlg->exec() != QDialog::Accepted ) |
3574 | send = false; | 3582 | send = false; |
3575 | } | 3583 | } |
3576 | if ( send ) { | 3584 | if ( send ) { |
3577 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 3585 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
3578 | if ( event ) { | 3586 | if ( event ) { |
3579 | Event *ev = new Event(*event); | 3587 | Event *ev = new Event(*event); |
3580 | ev->registerObserver(0); | 3588 | ev->registerObserver(0); |
3581 | ev->clearAttendees(); | 3589 | ev->clearAttendees(); |
3582 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { | 3590 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { |
3583 | delete(ev); | 3591 | delete(ev); |
3584 | } | 3592 | } |
3585 | } else { | 3593 | } else { |
3586 | if ( todo ) { | 3594 | if ( todo ) { |
3587 | Todo *ev = new Todo(*todo); | 3595 | Todo *ev = new Todo(*todo); |
3588 | ev->registerObserver(0); | 3596 | ev->registerObserver(0); |
3589 | ev->clearAttendees(); | 3597 | ev->clearAttendees(); |
3590 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { | 3598 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { |
3591 | delete(ev); | 3599 | delete(ev); |
3592 | } | 3600 | } |
3593 | } | 3601 | } |
3594 | } | 3602 | } |
3595 | } | 3603 | } |
3596 | delete publishdlg; | 3604 | delete publishdlg; |
3597 | } | 3605 | } |
3598 | 3606 | ||
3599 | void CalendarView::schedule_request(Incidence *incidence) | 3607 | void CalendarView::schedule_request(Incidence *incidence) |
3600 | { | 3608 | { |
3601 | schedule(Scheduler::Request,incidence); | 3609 | schedule(Scheduler::Request,incidence); |
3602 | } | 3610 | } |
3603 | 3611 | ||
3604 | void CalendarView::schedule_refresh(Incidence *incidence) | 3612 | void CalendarView::schedule_refresh(Incidence *incidence) |
3605 | { | 3613 | { |
3606 | schedule(Scheduler::Refresh,incidence); | 3614 | schedule(Scheduler::Refresh,incidence); |
3607 | } | 3615 | } |
3608 | 3616 | ||
3609 | void CalendarView::schedule_cancel(Incidence *incidence) | 3617 | void CalendarView::schedule_cancel(Incidence *incidence) |
3610 | { | 3618 | { |
3611 | schedule(Scheduler::Cancel,incidence); | 3619 | schedule(Scheduler::Cancel,incidence); |
3612 | } | 3620 | } |
3613 | 3621 | ||
3614 | void CalendarView::schedule_add(Incidence *incidence) | 3622 | void CalendarView::schedule_add(Incidence *incidence) |
3615 | { | 3623 | { |
3616 | schedule(Scheduler::Add,incidence); | 3624 | schedule(Scheduler::Add,incidence); |
3617 | } | 3625 | } |
3618 | 3626 | ||
3619 | void CalendarView::schedule_reply(Incidence *incidence) | 3627 | void CalendarView::schedule_reply(Incidence *incidence) |
3620 | { | 3628 | { |
3621 | schedule(Scheduler::Reply,incidence); | 3629 | schedule(Scheduler::Reply,incidence); |
3622 | } | 3630 | } |
3623 | 3631 | ||
3624 | void CalendarView::schedule_counter(Incidence *incidence) | 3632 | void CalendarView::schedule_counter(Incidence *incidence) |
3625 | { | 3633 | { |
3626 | schedule(Scheduler::Counter,incidence); | 3634 | schedule(Scheduler::Counter,incidence); |
3627 | } | 3635 | } |
3628 | 3636 | ||
3629 | void CalendarView::schedule_declinecounter(Incidence *incidence) | 3637 | void CalendarView::schedule_declinecounter(Incidence *incidence) |
3630 | { | 3638 | { |
3631 | schedule(Scheduler::Declinecounter,incidence); | 3639 | schedule(Scheduler::Declinecounter,incidence); |
3632 | } | 3640 | } |
3633 | 3641 | ||
3634 | void CalendarView::schedule_publish_freebusy(int daysToPublish) | 3642 | void CalendarView::schedule_publish_freebusy(int daysToPublish) |
3635 | { | 3643 | { |
3636 | QDateTime start = QDateTime::currentDateTime(); | 3644 | QDateTime start = QDateTime::currentDateTime(); |
3637 | QDateTime end = start.addDays(daysToPublish); | 3645 | QDateTime end = start.addDays(daysToPublish); |
3638 | 3646 | ||
3639 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); | 3647 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); |
3640 | freebusy->setOrganizer(KOPrefs::instance()->email()); | 3648 | freebusy->setOrganizer(KOPrefs::instance()->email()); |
3641 | 3649 | ||
3642 | 3650 | ||
3643 | PublishDialog *publishdlg = new PublishDialog(); | 3651 | PublishDialog *publishdlg = new PublishDialog(); |
3644 | if ( publishdlg->exec() == QDialog::Accepted ) { | 3652 | if ( publishdlg->exec() == QDialog::Accepted ) { |
3645 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 3653 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
3646 | if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { | 3654 | if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { |
3647 | delete(freebusy); | 3655 | delete(freebusy); |
3648 | } | 3656 | } |
3649 | } | 3657 | } |
3650 | delete publishdlg; | 3658 | delete publishdlg; |
3651 | } | 3659 | } |
3652 | 3660 | ||
3653 | void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) | 3661 | void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) |
3654 | { | 3662 | { |
3655 | Event *event = 0; | 3663 | Event *event = 0; |
3656 | Todo *todo = 0; | 3664 | Todo *todo = 0; |
3657 | 3665 | ||
3658 | if (incidence == 0) { | 3666 | if (incidence == 0) { |
3659 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 3667 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
3660 | if (incidence == 0) { | 3668 | if (incidence == 0) { |
3661 | incidence = mTodoList->selectedIncidences().first(); | 3669 | incidence = mTodoList->selectedIncidences().first(); |
3662 | } | 3670 | } |
3663 | } | 3671 | } |
3664 | if ( incidence && incidence->typeID() == eventID ) { | 3672 | if ( incidence && incidence->typeID() == eventID ) { |
3665 | event = static_cast<Event *>(incidence); | 3673 | event = static_cast<Event *>(incidence); |
3666 | } | 3674 | } |
3667 | if ( incidence && incidence->typeID() == todoID ) { | 3675 | if ( incidence && incidence->typeID() == todoID ) { |
3668 | todo = static_cast<Todo *>(incidence); | 3676 | todo = static_cast<Todo *>(incidence); |
3669 | } | 3677 | } |
3670 | 3678 | ||
3671 | if (!event && !todo) { | 3679 | if (!event && !todo) { |
3672 | KMessageBox::sorry(this,i18n("No event selected.")); | 3680 | KMessageBox::sorry(this,i18n("No event selected.")); |
3673 | return; | 3681 | return; |
3674 | } | 3682 | } |
3675 | 3683 | ||
3676 | if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { | 3684 | if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { |
3677 | KMessageBox::sorry(this,i18n("The event has no attendees.")); | 3685 | KMessageBox::sorry(this,i18n("The event has no attendees.")); |
3678 | return; | 3686 | return; |
3679 | } | 3687 | } |
3680 | 3688 | ||
3681 | Event *ev = 0; | 3689 | Event *ev = 0; |
3682 | if (event) ev = new Event(*event); | 3690 | if (event) ev = new Event(*event); |
3683 | Todo *to = 0; | 3691 | Todo *to = 0; |
3684 | if (todo) to = new Todo(*todo); | 3692 | if (todo) to = new Todo(*todo); |
3685 | 3693 | ||
3686 | if (method == Scheduler::Reply || method == Scheduler::Refresh) { | 3694 | if (method == Scheduler::Reply || method == Scheduler::Refresh) { |
3687 | Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 3695 | Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
3688 | if (!me) { | 3696 | if (!me) { |
3689 | KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); | 3697 | KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); |
3690 | return; | 3698 | return; |
3691 | } | 3699 | } |
3692 | if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { | 3700 | if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { |
3693 | StatusDialog *statdlg = new StatusDialog(this); | 3701 | StatusDialog *statdlg = new StatusDialog(this); |
3694 | if (!statdlg->exec()==QDialog::Accepted) return; | 3702 | if (!statdlg->exec()==QDialog::Accepted) return; |
3695 | me->setStatus( statdlg->status() ); | 3703 | me->setStatus( statdlg->status() ); |
3696 | delete(statdlg); | 3704 | delete(statdlg); |
3697 | } | 3705 | } |
3698 | Attendee *menew = new Attendee(*me); | 3706 | Attendee *menew = new Attendee(*me); |
3699 | if (ev) { | 3707 | if (ev) { |
3700 | ev->clearAttendees(); | 3708 | ev->clearAttendees(); |
3701 | ev->addAttendee(menew,false); | 3709 | ev->addAttendee(menew,false); |
3702 | } else { | 3710 | } else { |
3703 | if (to) { | 3711 | if (to) { |
3704 | todo->clearAttendees(); | 3712 | todo->clearAttendees(); |
3705 | todo->addAttendee(menew,false); | 3713 | todo->addAttendee(menew,false); |
3706 | } | 3714 | } |
3707 | } | 3715 | } |
3708 | } | 3716 | } |
3709 | 3717 | ||
3710 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 3718 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
3711 | if (ev) { | 3719 | if (ev) { |
3712 | if ( !dlg->addMessage(ev,method) ) delete(ev); | 3720 | if ( !dlg->addMessage(ev,method) ) delete(ev); |
3713 | } else { | 3721 | } else { |
3714 | if (to) { | 3722 | if (to) { |
3715 | if ( !dlg->addMessage(to,method) ) delete(to); | 3723 | if ( !dlg->addMessage(to,method) ) delete(to); |
3716 | } | 3724 | } |
3717 | } | 3725 | } |
3718 | } | 3726 | } |
3719 | 3727 | ||
3720 | void CalendarView::openAddressbook() | 3728 | void CalendarView::openAddressbook() |
3721 | { | 3729 | { |
3722 | KRun::runCommand("kaddressbook"); | 3730 | KRun::runCommand("kaddressbook"); |
3723 | } | 3731 | } |
3724 | 3732 | ||
3725 | void CalendarView::setModified(bool modified) | 3733 | void CalendarView::setModified(bool modified) |
3726 | { | 3734 | { |
3727 | if ( modified ) | 3735 | if ( modified ) |
3728 | emit signalmodified(); | 3736 | emit signalmodified(); |
3729 | if (mModified != modified) { | 3737 | if (mModified != modified) { |
3730 | mModified = modified; | 3738 | mModified = modified; |
3731 | emit modifiedChanged(mModified); | 3739 | emit modifiedChanged(mModified); |
3732 | } | 3740 | } |
3733 | } | 3741 | } |
3734 | 3742 | ||
3735 | bool CalendarView::isReadOnly() | 3743 | bool CalendarView::isReadOnly() |
3736 | { | 3744 | { |
3737 | return mReadOnly; | 3745 | return mReadOnly; |
3738 | } | 3746 | } |
3739 | 3747 | ||
3740 | void CalendarView::setReadOnly(bool readOnly) | 3748 | void CalendarView::setReadOnly(bool readOnly) |
3741 | { | 3749 | { |
3742 | if (mReadOnly != readOnly) { | 3750 | if (mReadOnly != readOnly) { |
3743 | mReadOnly = readOnly; | 3751 | mReadOnly = readOnly; |
3744 | emit readOnlyChanged(mReadOnly); | 3752 | emit readOnlyChanged(mReadOnly); |
3745 | } | 3753 | } |
3746 | } | 3754 | } |
3747 | 3755 | ||
3748 | bool CalendarView::isModified() | 3756 | bool CalendarView::isModified() |
3749 | { | 3757 | { |
3750 | return mModified; | 3758 | return mModified; |
3751 | } | 3759 | } |
3752 | void CalendarView::slotprintSelInc() | 3760 | void CalendarView::slotprintSelInc() |
3753 | { | 3761 | { |
3754 | if ( currentSelection() == 0 ) { | 3762 | if ( currentSelection() == 0 ) { |
3755 | KMessageBox::sorry(this,i18n("There is nothing selected!")); | 3763 | KMessageBox::sorry(this,i18n("There is nothing selected!")); |
3756 | return; | 3764 | return; |
3757 | } | 3765 | } |
3758 | showIncidence(); | 3766 | showIncidence(); |
3759 | getEventViewerDialog()->print(); | 3767 | getEventViewerDialog()->print(); |
3760 | 3768 | ||
3761 | } | 3769 | } |
3762 | void CalendarView::printSetup() | 3770 | void CalendarView::printSetup() |
3763 | { | 3771 | { |
3764 | #ifndef KORG_NOPRINTER | 3772 | #ifndef KORG_NOPRINTER |
3765 | createPrinter(); | 3773 | createPrinter(); |
3766 | 3774 | ||
3767 | mCalPrinter->setupPrinter(); | 3775 | mCalPrinter->setupPrinter(); |
3768 | #endif | 3776 | #endif |
3769 | } | 3777 | } |
3770 | 3778 | ||
3771 | void CalendarView::print() | 3779 | void CalendarView::print() |
3772 | { | 3780 | { |
3773 | #ifndef KORG_NOPRINTER | 3781 | #ifndef KORG_NOPRINTER |
3774 | createPrinter(); | 3782 | createPrinter(); |
3775 | 3783 | ||
3776 | DateList tmpDateList = mNavigator->selectedDates(); | 3784 | DateList tmpDateList = mNavigator->selectedDates(); |
3777 | mCalPrinter->print(CalPrinter::Month, | 3785 | mCalPrinter->print(CalPrinter::Month, |
3778 | tmpDateList.first(), tmpDateList.last()); | 3786 | tmpDateList.first(), tmpDateList.last()); |
3779 | #endif | 3787 | #endif |
3780 | } | 3788 | } |
3781 | 3789 | ||
3782 | void CalendarView::printPreview() | 3790 | void CalendarView::printPreview() |
3783 | { | 3791 | { |
3784 | #ifndef KORG_NOPRINTER | 3792 | #ifndef KORG_NOPRINTER |
3785 | kdDebug() << "CalendarView::printPreview()" << endl; | 3793 | kdDebug() << "CalendarView::printPreview()" << endl; |
3786 | 3794 | ||
3787 | createPrinter(); | 3795 | createPrinter(); |
3788 | 3796 | ||
3789 | DateList tmpDateList = mNavigator->selectedDates(); | 3797 | DateList tmpDateList = mNavigator->selectedDates(); |
3790 | 3798 | ||
3791 | mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), | 3799 | mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), |
3792 | tmpDateList.last()); | 3800 | tmpDateList.last()); |
3793 | #endif | 3801 | #endif |
3794 | } | 3802 | } |
3795 | 3803 | ||
3796 | void CalendarView::exportICalendar() | 3804 | void CalendarView::exportICalendar() |
3797 | { | 3805 | { |
3798 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); | 3806 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); |
3799 | 3807 | ||
3800 | // Force correct extension | 3808 | // Force correct extension |
3801 | if (filename.right(4) != ".ics") filename += ".ics"; | 3809 | if (filename.right(4) != ".ics") filename += ".ics"; |
3802 | 3810 | ||
3803 | FileStorage storage( mCalendar, filename, new ICalFormat() ); | 3811 | FileStorage storage( mCalendar, filename, new ICalFormat() ); |
3804 | storage.save(); | 3812 | storage.save(); |
3805 | } | 3813 | } |
3806 | 3814 | ||
3807 | bool CalendarView::exportVCalendar( QString filename ) | 3815 | bool CalendarView::exportVCalendar( QString filename ) |
3808 | { | 3816 | { |
3809 | if (mCalendar->journals().count() > 0) { | 3817 | if (mCalendar->journals().count() > 0) { |
3810 | int result = KMessageBox::warningContinueCancel(this, | 3818 | int result = KMessageBox::warningContinueCancel(this, |
3811 | i18n("The journal entries can not be\nexported to a vCalendar file."), | 3819 | i18n("The journal entries can not be\nexported to a vCalendar file."), |
3812 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), | 3820 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), |
3813 | true); | 3821 | true); |
3814 | if (result != KMessageBox::Continue) return false; | 3822 | if (result != KMessageBox::Continue) return false; |
3815 | } | 3823 | } |
3816 | 3824 | ||
3817 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); | 3825 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); |
3818 | 3826 | ||
3819 | // Force correct extension | 3827 | // Force correct extension |
3820 | if (filename.right(4) != ".vcs") filename += ".vcs"; | 3828 | if (filename.right(4) != ".vcs") filename += ".vcs"; |
3821 | 3829 | ||
3822 | FileStorage storage( mCalendar, filename, new VCalFormat ); | 3830 | FileStorage storage( mCalendar, filename, new VCalFormat ); |
3823 | return storage.save(); | 3831 | return storage.save(); |
3824 | 3832 | ||
3825 | } | 3833 | } |
3826 | 3834 | ||
3827 | void CalendarView::eventUpdated(Incidence *) | 3835 | void CalendarView::eventUpdated(Incidence *) |
3828 | { | 3836 | { |
3829 | setModified(); | 3837 | setModified(); |
3830 | // Don't call updateView here. The code, which has caused the update of the | 3838 | // Don't call updateView here. The code, which has caused the update of the |
3831 | // event is responsible for updating the view. | 3839 | // event is responsible for updating the view. |
3832 | // updateView(); | 3840 | // updateView(); |
3833 | } | 3841 | } |
3834 | 3842 | ||
3835 | void CalendarView::adaptNavigationUnits() | 3843 | void CalendarView::adaptNavigationUnits() |
3836 | { | 3844 | { |
3837 | if (mViewManager->currentView()->isEventView()) { | 3845 | if (mViewManager->currentView()->isEventView()) { |
3838 | int days = mViewManager->currentView()->currentDateCount(); | 3846 | int days = mViewManager->currentView()->currentDateCount(); |
3839 | if (days == 1) { | 3847 | if (days == 1) { |
3840 | emit changeNavStringPrev(i18n("&Previous Day")); | 3848 | emit changeNavStringPrev(i18n("&Previous Day")); |
3841 | emit changeNavStringNext(i18n("&Next Day")); | 3849 | emit changeNavStringNext(i18n("&Next Day")); |
3842 | } else { | 3850 | } else { |
3843 | emit changeNavStringPrev(i18n("&Previous Week")); | 3851 | emit changeNavStringPrev(i18n("&Previous Week")); |
3844 | emit changeNavStringNext(i18n("&Next Week")); | 3852 | emit changeNavStringNext(i18n("&Next Week")); |
3845 | } | 3853 | } |
3846 | } | 3854 | } |
3847 | } | 3855 | } |
3848 | 3856 | ||
3849 | void CalendarView::processMainViewSelection( Incidence *incidence ) | 3857 | void CalendarView::processMainViewSelection( Incidence *incidence ) |
3850 | { | 3858 | { |
3851 | if ( incidence ) mTodoList->clearSelection(); | 3859 | if ( incidence ) mTodoList->clearSelection(); |
3852 | processIncidenceSelection( incidence ); | 3860 | processIncidenceSelection( incidence ); |
3853 | } | 3861 | } |
3854 | 3862 | ||
3855 | void CalendarView::processTodoListSelection( Incidence *incidence ) | 3863 | void CalendarView::processTodoListSelection( Incidence *incidence ) |
3856 | { | 3864 | { |
3857 | if ( incidence && mViewManager->currentView() ) { | 3865 | if ( incidence && mViewManager->currentView() ) { |
3858 | mViewManager->currentView()->clearSelection(); | 3866 | mViewManager->currentView()->clearSelection(); |
3859 | } | 3867 | } |
3860 | processIncidenceSelection( incidence ); | 3868 | processIncidenceSelection( incidence ); |
3861 | } | 3869 | } |
3862 | 3870 | ||
3863 | void CalendarView::processIncidenceSelection( Incidence *incidence ) | 3871 | void CalendarView::processIncidenceSelection( Incidence *incidence ) |
3864 | { | 3872 | { |
3865 | if ( incidence == mSelectedIncidence ) return; | 3873 | if ( incidence == mSelectedIncidence ) return; |
3866 | 3874 | ||
3867 | mSelectedIncidence = incidence; | 3875 | mSelectedIncidence = incidence; |
3868 | 3876 | ||
3869 | emit incidenceSelected( mSelectedIncidence ); | 3877 | emit incidenceSelected( mSelectedIncidence ); |
3870 | 3878 | ||
3871 | if ( incidence && incidence->typeID() == eventID ) { | 3879 | if ( incidence && incidence->typeID() == eventID ) { |
3872 | Event *event = static_cast<Event *>( incidence ); | 3880 | Event *event = static_cast<Event *>( incidence ); |
3873 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 3881 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
3874 | emit organizerEventsSelected( true ); | 3882 | emit organizerEventsSelected( true ); |
3875 | } else { | 3883 | } else { |
3876 | emit organizerEventsSelected(false); | 3884 | emit organizerEventsSelected(false); |
3877 | } | 3885 | } |
3878 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 3886 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
3879 | KOPrefs::instance()->email() ) ) { | 3887 | KOPrefs::instance()->email() ) ) { |
3880 | emit groupEventsSelected( true ); | 3888 | emit groupEventsSelected( true ); |
3881 | } else { | 3889 | } else { |
3882 | emit groupEventsSelected(false); | 3890 | emit groupEventsSelected(false); |
3883 | } | 3891 | } |
3884 | return; | 3892 | return; |
3885 | } else { | 3893 | } else { |
3886 | if ( incidence && incidence->typeID() == todoID ) { | 3894 | if ( incidence && incidence->typeID() == todoID ) { |
3887 | emit todoSelected( true ); | 3895 | emit todoSelected( true ); |
3888 | Todo *event = static_cast<Todo *>( incidence ); | 3896 | Todo *event = static_cast<Todo *>( incidence ); |
3889 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 3897 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
3890 | emit organizerEventsSelected( true ); | 3898 | emit organizerEventsSelected( true ); |
3891 | } else { | 3899 | } else { |
3892 | emit organizerEventsSelected(false); | 3900 | emit organizerEventsSelected(false); |
3893 | } | 3901 | } |
3894 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 3902 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
3895 | KOPrefs::instance()->email() ) ) { | 3903 | KOPrefs::instance()->email() ) ) { |
3896 | emit groupEventsSelected( true ); | 3904 | emit groupEventsSelected( true ); |
3897 | } else { | 3905 | } else { |
3898 | emit groupEventsSelected(false); | 3906 | emit groupEventsSelected(false); |
3899 | } | 3907 | } |
3900 | return; | 3908 | return; |
3901 | } else { | 3909 | } else { |
3902 | emit todoSelected( false ); | 3910 | emit todoSelected( false ); |
3903 | emit organizerEventsSelected(false); | 3911 | emit organizerEventsSelected(false); |
3904 | emit groupEventsSelected(false); | 3912 | emit groupEventsSelected(false); |
3905 | } | 3913 | } |
3906 | return; | 3914 | return; |
3907 | } | 3915 | } |
3908 | 3916 | ||
3909 | /* if ( incidence && incidence->typeID() == todoID ) { | 3917 | /* if ( incidence && incidence->typeID() == todoID ) { |
3910 | emit todoSelected( true ); | 3918 | emit todoSelected( true ); |
3911 | } else { | 3919 | } else { |
3912 | emit todoSelected( false ); | 3920 | emit todoSelected( false ); |
3913 | }*/ | 3921 | }*/ |
3914 | } | 3922 | } |
3915 | 3923 | ||
3916 | 3924 | ||
3917 | void CalendarView::checkClipboard() | 3925 | void CalendarView::checkClipboard() |
3918 | { | 3926 | { |
3919 | #ifndef KORG_NODND | 3927 | #ifndef KORG_NODND |
3920 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { | 3928 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { |
3921 | emit pasteEnabled(true); | 3929 | emit pasteEnabled(true); |
3922 | } else { | 3930 | } else { |
3923 | emit pasteEnabled(false); | 3931 | emit pasteEnabled(false); |
3924 | } | 3932 | } |
3925 | #endif | 3933 | #endif |
3926 | } | 3934 | } |
3927 | 3935 | ||
3928 | void CalendarView::showDates(const DateList &selectedDates) | 3936 | void CalendarView::showDates(const DateList &selectedDates) |
3929 | { | 3937 | { |
3930 | // kdDebug() << "CalendarView::selectDates()" << endl; | 3938 | // kdDebug() << "CalendarView::selectDates()" << endl; |
3931 | 3939 | ||
3932 | 3940 | ||
3933 | if ( !mBlockShowDates ) { | 3941 | if ( !mBlockShowDates ) { |
3934 | if ( mViewManager->currentView() ) { | 3942 | if ( mViewManager->currentView() ) { |
3935 | updateView( selectedDates.first(), selectedDates.last() ); | 3943 | updateView( selectedDates.first(), selectedDates.last() ); |
3936 | } else { | 3944 | } else { |
3937 | mViewManager->showAgendaView(); | 3945 | mViewManager->showAgendaView(); |
3938 | } | 3946 | } |
3939 | } | 3947 | } |
3940 | 3948 | ||
3941 | QDate date = selectedDates.first(); | 3949 | QDate date = selectedDates.first(); |
3942 | if ( ! date.isValid() ) { | 3950 | if ( ! date.isValid() ) { |
3943 | topLevelWidget()->setCaption(""); | 3951 | topLevelWidget()->setCaption(""); |
3944 | return; | 3952 | return; |
3945 | } | 3953 | } |
3946 | 3954 | ||
3947 | QString selDates; | 3955 | QString selDates; |
3948 | selDates = KGlobal::locale()->formatDate( date, true); | 3956 | selDates = KGlobal::locale()->formatDate( date, true); |
3949 | if (selectedDates.first() < selectedDates.last() ) | 3957 | if (selectedDates.first() < selectedDates.last() ) |
3950 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); | 3958 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); |
3951 | else { | 3959 | else { |
3952 | QString addString; | 3960 | QString addString; |
3953 | if ( date == QDateTime::currentDateTime().date() ) | 3961 | if ( date == QDateTime::currentDateTime().date() ) |
3954 | addString = i18n("Today"); | 3962 | addString = i18n("Today"); |
3955 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) | 3963 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) |
3956 | addString = i18n("Tomorrow"); | 3964 | addString = i18n("Tomorrow"); |
3957 | else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) | 3965 | else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) |
3958 | addString = i18n("Yesterday"); | 3966 | addString = i18n("Yesterday"); |
3959 | else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) | 3967 | else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) |
3960 | addString = i18n("Day before yesterday"); | 3968 | addString = i18n("Day before yesterday"); |
3961 | else if ( date == QDateTime::currentDateTime().date().addDays(2) ) | 3969 | else if ( date == QDateTime::currentDateTime().date().addDays(2) ) |
3962 | addString = i18n("Day after tomorrow"); | 3970 | addString = i18n("Day after tomorrow"); |
3963 | if ( !addString.isEmpty() ) { | 3971 | if ( !addString.isEmpty() ) { |
3964 | topLevelWidget()->setCaption( addString+", " + selDates ); | 3972 | topLevelWidget()->setCaption( addString+", " + selDates ); |
3965 | return; | 3973 | return; |
3966 | } | 3974 | } |
3967 | } | 3975 | } |
3968 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); | 3976 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); |
3969 | 3977 | ||
3970 | } | 3978 | } |
3971 | 3979 | ||
3972 | QPtrList<CalFilter> CalendarView::filters() | 3980 | QPtrList<CalFilter> CalendarView::filters() |
3973 | { | 3981 | { |
3974 | return mFilters; | 3982 | return mFilters; |
3975 | 3983 | ||
3976 | } | 3984 | } |
3977 | void CalendarView::editFilters() | 3985 | void CalendarView::editFilters() |
3978 | { | 3986 | { |
3979 | // kdDebug() << "CalendarView::editFilters()" << endl; | 3987 | // kdDebug() << "CalendarView::editFilters()" << endl; |
3980 | 3988 | ||
3981 | CalFilter *filter = mFilters.first(); | 3989 | CalFilter *filter = mFilters.first(); |
3982 | while(filter) { | 3990 | while(filter) { |
3983 | kdDebug() << " Filter: " << filter->name() << endl; | 3991 | kdDebug() << " Filter: " << filter->name() << endl; |
3984 | filter = mFilters.next(); | 3992 | filter = mFilters.next(); |
3985 | } | 3993 | } |
3986 | 3994 | ||
3987 | mDialogManager->showFilterEditDialog(&mFilters); | 3995 | mDialogManager->showFilterEditDialog(&mFilters); |
3988 | } | 3996 | } |
3989 | void CalendarView::toggleFilter() | 3997 | void CalendarView::toggleFilter() |
3990 | { | 3998 | { |
3991 | showFilter(! mCalEditView->isVisible()); | 3999 | showFilter(! mCalEditView->isVisible()); |
3992 | } | 4000 | } |
3993 | 4001 | ||
3994 | KOFilterView *CalendarView::filterView() | 4002 | KOFilterView *CalendarView::filterView() |
3995 | { | 4003 | { |
3996 | return mFilterView; | 4004 | return mFilterView; |
3997 | } | 4005 | } |
3998 | void CalendarView::selectFilter( int fil ) | 4006 | void CalendarView::selectFilter( int fil ) |
3999 | { | 4007 | { |
4000 | mFilterView->setSelectedFilter( fil ); | 4008 | mFilterView->setSelectedFilter( fil ); |
4001 | } | 4009 | } |
4002 | void CalendarView::showFilter(bool visible) | 4010 | void CalendarView::showFilter(bool visible) |
4003 | { | 4011 | { |
4004 | #if 1 | 4012 | #if 1 |
4005 | if (visible) { | 4013 | if (visible) { |
4006 | mCalEditView->readConfig(); | 4014 | mCalEditView->readConfig(); |
4007 | mCalEditView->show(); | 4015 | mCalEditView->show(); |
4008 | QValueList<int> sizes; | 4016 | QValueList<int> sizes; |
4009 | sizes = mLeftFrame->sizes(); | 4017 | sizes = mLeftFrame->sizes(); |
4010 | if ( sizes.count() == 4 && sizes[3] < 20 ) { | 4018 | if ( sizes.count() == 4 && sizes[3] < 20 ) { |
4011 | sizes.clear(); | 4019 | sizes.clear(); |
4012 | sizes << 100; | 4020 | sizes << 100; |
4013 | sizes << 0; | 4021 | sizes << 0; |
4014 | sizes << 0; | 4022 | sizes << 0; |
4015 | sizes << 100; | 4023 | sizes << 100; |
4016 | mLeftFrame->setSizes(sizes); | 4024 | mLeftFrame->setSizes(sizes); |
4017 | } | 4025 | } |
4018 | #if 0 | 4026 | #if 0 |
4019 | sizes = mLeftFrame->sizes(); | 4027 | sizes = mLeftFrame->sizes(); |
4020 | int ccc = 0; | 4028 | int ccc = 0; |
4021 | while ( ccc < sizes.count()) { | 4029 | while ( ccc < sizes.count()) { |
4022 | qDebug("size %d %d ", ccc, sizes[ccc]); | 4030 | qDebug("size %d %d ", ccc, sizes[ccc]); |
4023 | ++ccc; | 4031 | ++ccc; |
4024 | } | 4032 | } |
4025 | #endif | 4033 | #endif |
4026 | 4034 | ||
4027 | } | 4035 | } |
4028 | else { | 4036 | else { |
4029 | mCalEditView->hide(); | 4037 | mCalEditView->hide(); |
4030 | } | 4038 | } |
4031 | #else | 4039 | #else |
4032 | if (visible) mFilterView->show(); | 4040 | if (visible) mFilterView->show(); |
4033 | else mFilterView->hide(); | 4041 | else mFilterView->hide(); |
4034 | #endif | 4042 | #endif |
4035 | } | 4043 | } |
4036 | void CalendarView::toggleFilerEnabled( ) | 4044 | void CalendarView::toggleFilerEnabled( ) |
4037 | { | 4045 | { |
4038 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); | 4046 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); |
4039 | if ( !mFilterView->filtersEnabled() ) | 4047 | if ( !mFilterView->filtersEnabled() ) |
4040 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); | 4048 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); |
4041 | 4049 | ||
4042 | } | 4050 | } |
4043 | void CalendarView::updateFilter() | 4051 | void CalendarView::updateFilter() |
4044 | { | 4052 | { |
4045 | CalFilter *filter = mFilterView->selectedFilter(); | 4053 | CalFilter *filter = mFilterView->selectedFilter(); |
4046 | if (filter) { | 4054 | if (filter) { |
4047 | QString mess; | 4055 | QString mess; |
4048 | if (mFilterView->filtersEnabled()) { | 4056 | if (mFilterView->filtersEnabled()) { |
4049 | mess = i18n("Filter selected: ")+filter->name(); | 4057 | mess = i18n("Filter selected: ")+filter->name(); |
4050 | filter->setEnabled(true); | 4058 | filter->setEnabled(true); |
4051 | } | 4059 | } |
4052 | else filter->setEnabled(false); | 4060 | else filter->setEnabled(false); |
4053 | mCalendar->setFilter(filter); | 4061 | mCalendar->setFilter(filter); |
4054 | updateView(); | 4062 | updateView(); |
4055 | if ( !mess.isEmpty() ) | 4063 | if ( !mess.isEmpty() ) |
4056 | topLevelWidget()->setCaption( mess ); | 4064 | topLevelWidget()->setCaption( mess ); |
4057 | 4065 | ||
4058 | } | 4066 | } |
4059 | } | 4067 | } |
4060 | 4068 | ||
4061 | void CalendarView::filterEdited() | 4069 | void CalendarView::filterEdited() |
4062 | { | 4070 | { |
4063 | mFilterView->updateFilters(); | 4071 | mFilterView->updateFilters(); |
4064 | updateFilter(); | 4072 | updateFilter(); |
4065 | writeSettings(); | 4073 | writeSettings(); |
4066 | } | 4074 | } |
4067 | 4075 | ||
4068 | 4076 | ||
4069 | void CalendarView::takeOverEvent() | 4077 | void CalendarView::takeOverEvent() |
4070 | { | 4078 | { |
4071 | Incidence *incidence = currentSelection(); | 4079 | Incidence *incidence = currentSelection(); |
4072 | 4080 | ||
4073 | if (!incidence) return; | 4081 | if (!incidence) return; |
4074 | 4082 | ||
4075 | incidence->setOrganizer(KOPrefs::instance()->email()); | 4083 | incidence->setOrganizer(KOPrefs::instance()->email()); |
4076 | incidence->recreate(); | 4084 | incidence->recreate(); |
4077 | incidence->setReadOnly(false); | 4085 | incidence->setReadOnly(false); |
4078 | 4086 | ||
4079 | updateView(); | 4087 | updateView(); |
4080 | } | 4088 | } |
4081 | 4089 | ||
4082 | void CalendarView::takeOverCalendar() | 4090 | void CalendarView::takeOverCalendar() |
4083 | { | 4091 | { |
4084 | // TODO: Create Calendar::allIncidences() function and use it here | 4092 | // TODO: Create Calendar::allIncidences() function and use it here |
4085 | 4093 | ||
4086 | clearAllViews(); | 4094 | clearAllViews(); |
4087 | QPtrList<Event> events = mCalendar->events(); | 4095 | QPtrList<Event> events = mCalendar->events(); |
4088 | for(uint i=0; i<events.count(); ++i) { | 4096 | for(uint i=0; i<events.count(); ++i) { |
4089 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); | 4097 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); |
4090 | events.at(i)->recreate(); | 4098 | events.at(i)->recreate(); |
4091 | events.at(i)->setReadOnly(false); | 4099 | events.at(i)->setReadOnly(false); |
4092 | } | 4100 | } |
4093 | 4101 | ||
4094 | QPtrList<Todo> todos = mCalendar->todos(); | 4102 | QPtrList<Todo> todos = mCalendar->todos(); |
4095 | for(uint i=0; i<todos.count(); ++i) { | 4103 | for(uint i=0; i<todos.count(); ++i) { |
4096 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); | 4104 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); |
4097 | todos.at(i)->recreate(); | 4105 | todos.at(i)->recreate(); |
4098 | todos.at(i)->setReadOnly(false); | 4106 | todos.at(i)->setReadOnly(false); |
4099 | } | 4107 | } |
4100 | 4108 | ||
4101 | QPtrList<Journal> journals = mCalendar->journals(); | 4109 | QPtrList<Journal> journals = mCalendar->journals(); |
4102 | for(uint i=0; i<journals.count(); ++i) { | 4110 | for(uint i=0; i<journals.count(); ++i) { |
4103 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); | 4111 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); |
4104 | journals.at(i)->recreate(); | 4112 | journals.at(i)->recreate(); |
4105 | journals.at(i)->setReadOnly(false); | 4113 | journals.at(i)->setReadOnly(false); |
4106 | } | 4114 | } |
4107 | 4115 | ||
4108 | updateView(); | 4116 | updateView(); |
4109 | } | 4117 | } |
4110 | 4118 | ||
4111 | void CalendarView::showIntro() | 4119 | void CalendarView::showIntro() |
4112 | { | 4120 | { |
4113 | kdDebug() << "To be implemented." << endl; | 4121 | kdDebug() << "To be implemented." << endl; |
4114 | } | 4122 | } |
4115 | 4123 | ||
4116 | QWidgetStack *CalendarView::viewStack() | 4124 | QWidgetStack *CalendarView::viewStack() |
4117 | { | 4125 | { |
4118 | return mRightFrame; | 4126 | return mRightFrame; |
4119 | } | 4127 | } |
4120 | 4128 | ||
4121 | QWidget *CalendarView::leftFrame() | 4129 | QWidget *CalendarView::leftFrame() |
4122 | { | 4130 | { |
4123 | return ( QWidget *)mLeftFrame; | 4131 | return ( QWidget *)mLeftFrame; |
4124 | } | 4132 | } |
4125 | 4133 | ||
4126 | DateNavigator *CalendarView::dateNavigator() | 4134 | DateNavigator *CalendarView::dateNavigator() |
4127 | { | 4135 | { |
4128 | return mNavigator; | 4136 | return mNavigator; |
4129 | } | 4137 | } |
4130 | 4138 | ||
4131 | KDateNavigator* CalendarView::dateNavigatorWidget() | 4139 | KDateNavigator* CalendarView::dateNavigatorWidget() |
4132 | { | 4140 | { |
4133 | return mDateNavigator->navigatorView(); | 4141 | return mDateNavigator->navigatorView(); |
4134 | } | 4142 | } |
4135 | void CalendarView::toggleDateNavigatorWidget() | 4143 | void CalendarView::toggleDateNavigatorWidget() |
4136 | { | 4144 | { |
4137 | KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; | 4145 | KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; |
4138 | 4146 | ||
4139 | if (!KOPrefs::instance()->mShowDateNavigator ) | 4147 | if (!KOPrefs::instance()->mShowDateNavigator ) |
4140 | mDateNavigator->hide(); | 4148 | mDateNavigator->hide(); |
4141 | else | 4149 | else |
4142 | mDateNavigator->show(); | 4150 | mDateNavigator->show(); |
4143 | } | 4151 | } |
4144 | void CalendarView::addView(KOrg::BaseView *view) | 4152 | void CalendarView::addView(KOrg::BaseView *view) |
4145 | { | 4153 | { |
4146 | mViewManager->addView(view); | 4154 | mViewManager->addView(view); |
4147 | } | 4155 | } |
4148 | 4156 | ||
4149 | void CalendarView::showView(KOrg::BaseView *view) | 4157 | void CalendarView::showView(KOrg::BaseView *view) |
4150 | { | 4158 | { |
4151 | mViewManager->showView(view, mLeftFrame->isVisible()); | 4159 | mViewManager->showView(view, mLeftFrame->isVisible()); |
4152 | } | 4160 | } |
4153 | 4161 | ||
4154 | Incidence *CalendarView::currentSelection() | 4162 | Incidence *CalendarView::currentSelection() |
4155 | { | 4163 | { |
4156 | return mViewManager->currentSelection(); | 4164 | return mViewManager->currentSelection(); |
4157 | } | 4165 | } |
4158 | void CalendarView::toggleAllDaySize() | 4166 | void CalendarView::toggleAllDaySize() |
4159 | { | 4167 | { |
4160 | /* | 4168 | /* |
4161 | if ( KOPrefs::instance()->mAllDaySize > 47 ) | 4169 | if ( KOPrefs::instance()->mAllDaySize > 47 ) |
4162 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; | 4170 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; |
4163 | else | 4171 | else |
4164 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; | 4172 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; |
4165 | */ | 4173 | */ |
4166 | viewManager()->agendaView()->toggleAllDay(); | 4174 | viewManager()->agendaView()->toggleAllDay(); |
4167 | } | 4175 | } |
4168 | void CalendarView::toggleExpand() | 4176 | void CalendarView::toggleExpand() |
4169 | { | 4177 | { |
4170 | // if ( mLeftFrame->isHidden() ) { | 4178 | // if ( mLeftFrame->isHidden() ) { |
4171 | // mLeftFrame->show(); | 4179 | // mLeftFrame->show(); |
4172 | // emit calendarViewExpanded( false ); | 4180 | // emit calendarViewExpanded( false ); |
4173 | // } else { | 4181 | // } else { |
4174 | // mLeftFrame->hide(); | 4182 | // mLeftFrame->hide(); |
4175 | // emit calendarViewExpanded( true ); | 4183 | // emit calendarViewExpanded( true ); |
4176 | // } | 4184 | // } |
4177 | //qDebug(" CalendarView::toggleExpand()"); | 4185 | //qDebug(" CalendarView::toggleExpand()"); |
4178 | globalFlagBlockAgenda = 1; | 4186 | globalFlagBlockAgenda = 1; |
4179 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); | 4187 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); |
4180 | globalFlagBlockAgenda = 5; | 4188 | globalFlagBlockAgenda = 5; |
4181 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); | 4189 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); |
4182 | //mViewManager->showView( 0, true ); | 4190 | //mViewManager->showView( 0, true ); |
4183 | } | 4191 | } |
4184 | 4192 | ||
4185 | void CalendarView::calendarModified( bool modified, Calendar * ) | 4193 | void CalendarView::calendarModified( bool modified, Calendar * ) |
4186 | { | 4194 | { |
4187 | setModified( modified ); | 4195 | setModified( modified ); |
4188 | } | 4196 | } |
4189 | 4197 | ||
4190 | Todo *CalendarView::selectedTodo() | 4198 | Todo *CalendarView::selectedTodo() |
4191 | { | 4199 | { |
4192 | Incidence *incidence = currentSelection(); | 4200 | Incidence *incidence = currentSelection(); |
4193 | if ( incidence && incidence->typeID() == todoID ) { | 4201 | if ( incidence && incidence->typeID() == todoID ) { |
4194 | return static_cast<Todo *>( incidence ); | 4202 | return static_cast<Todo *>( incidence ); |
4195 | } | 4203 | } |
4196 | 4204 | ||
4197 | incidence = mTodoList->selectedIncidences().first(); | 4205 | incidence = mTodoList->selectedIncidences().first(); |
4198 | if ( incidence && incidence->typeID() == todoID ) { | 4206 | if ( incidence && incidence->typeID() == todoID ) { |
4199 | return static_cast<Todo *>( incidence ); | 4207 | return static_cast<Todo *>( incidence ); |
4200 | } | 4208 | } |
4201 | 4209 | ||
4202 | return 0; | 4210 | return 0; |
4203 | } | 4211 | } |
4204 | 4212 | ||
4205 | void CalendarView::dialogClosing(Incidence *in) | 4213 | void CalendarView::dialogClosing(Incidence *in) |
4206 | { | 4214 | { |
4207 | // mDialogList.remove(in); | 4215 | // mDialogList.remove(in); |
4208 | } | 4216 | } |
4209 | 4217 | ||
4210 | void CalendarView::showIncidence() | 4218 | void CalendarView::showIncidence() |
4211 | { | 4219 | { |
4212 | mViewerCallerIsSearchDialog = false; | 4220 | mViewerCallerIsSearchDialog = false; |
4213 | Incidence *incidence = currentSelection(); | 4221 | Incidence *incidence = currentSelection(); |
4214 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 4222 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
4215 | if ( incidence ) { | 4223 | if ( incidence ) { |
4216 | ShowIncidenceVisitor v; | 4224 | ShowIncidenceVisitor v; |
4217 | v.act( incidence, this ); | 4225 | v.act( incidence, this ); |
4218 | } | 4226 | } |
4219 | } | 4227 | } |
4220 | void CalendarView::editIncidenceDescription() | 4228 | void CalendarView::editIncidenceDescription() |
4221 | { | 4229 | { |
4222 | mFlagEditDescription = true; | 4230 | mFlagEditDescription = true; |
4223 | editIncidence(); | 4231 | editIncidence(); |
4224 | mFlagEditDescription = false; | 4232 | mFlagEditDescription = false; |
4225 | } | 4233 | } |
4226 | void CalendarView::editIncidence() | 4234 | void CalendarView::editIncidence() |
4227 | { | 4235 | { |
4228 | // qDebug("editIncidence() "); | 4236 | // qDebug("editIncidence() "); |
4229 | Incidence *incidence = currentSelection(); | 4237 | Incidence *incidence = currentSelection(); |
4230 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 4238 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
4231 | if ( incidence ) { | 4239 | if ( incidence ) { |
4232 | EditIncidenceVisitor v; | 4240 | EditIncidenceVisitor v; |
4233 | v.act( incidence, this ); | 4241 | v.act( incidence, this ); |
4234 | } | 4242 | } |
4235 | } | 4243 | } |
4236 | 4244 | ||
4237 | void CalendarView::deleteIncidence() | 4245 | void CalendarView::deleteIncidence() |
4238 | { | 4246 | { |
4239 | Incidence *incidence = currentSelection(); | 4247 | Incidence *incidence = currentSelection(); |
4240 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 4248 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
4241 | if ( incidence ) { | 4249 | if ( incidence ) { |
4242 | deleteIncidence(incidence); | 4250 | deleteIncidence(incidence); |
4243 | } | 4251 | } |
4244 | } | 4252 | } |
4245 | void CalendarView::showIncidence(QString uid) | 4253 | void CalendarView::showIncidence(QString uid) |
4246 | { | 4254 | { |
4247 | Incidence *inc = mCalendar->incidence( uid ); | 4255 | Incidence *inc = mCalendar->incidence( uid ); |
4248 | if ( inc ) | 4256 | if ( inc ) |
4249 | showIncidence( inc ); | 4257 | showIncidence( inc ); |
4250 | } | 4258 | } |
4251 | void CalendarView::showIncidence(Incidence *incidence) | 4259 | void CalendarView::showIncidence(Incidence *incidence) |
4252 | { | 4260 | { |
4253 | mViewerCallerIsSearchDialog = false; | 4261 | mViewerCallerIsSearchDialog = false; |
4254 | //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); | 4262 | //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); |
4255 | if ( sender() && mDialogManager->getSearchDialog() ) { | 4263 | if ( sender() && mDialogManager->getSearchDialog() ) { |
4256 | if ( sender () == mDialogManager->getSearchDialog()->listview() ) { | 4264 | if ( sender () == mDialogManager->getSearchDialog()->listview() ) { |
4257 | mViewerCallerIsSearchDialog = true; | 4265 | mViewerCallerIsSearchDialog = true; |
4258 | } | 4266 | } |
4259 | } | 4267 | } |
4260 | if ( incidence ) { | 4268 | if ( incidence ) { |
4261 | ShowIncidenceVisitor v; | 4269 | ShowIncidenceVisitor v; |
4262 | v.act( incidence, this ); | 4270 | v.act( incidence, this ); |
4263 | } | 4271 | } |
4264 | } | 4272 | } |
4265 | 4273 | ||
4266 | void CalendarView::editIncidence(Incidence *incidence) | 4274 | void CalendarView::editIncidence(Incidence *incidence) |
4267 | { | 4275 | { |
4268 | if ( incidence ) { | 4276 | if ( incidence ) { |
4269 | 4277 | ||
4270 | EditIncidenceVisitor v; | 4278 | EditIncidenceVisitor v; |
4271 | v.act( incidence, this ); | 4279 | v.act( incidence, this ); |
4272 | 4280 | ||
4273 | } | 4281 | } |
4274 | } | 4282 | } |
4275 | 4283 | ||
4276 | void CalendarView::deleteIncidence(Incidence *incidence) | 4284 | void CalendarView::deleteIncidence(Incidence *incidence) |
4277 | { | 4285 | { |
4278 | //qDebug(" CalendarView::deleteIncidence "); | 4286 | //qDebug(" CalendarView::deleteIncidence "); |
4279 | if ( incidence ) { | 4287 | if ( incidence ) { |
4280 | DeleteIncidenceVisitor v; | 4288 | DeleteIncidenceVisitor v; |
4281 | v.act( incidence, this ); | 4289 | v.act( incidence, this ); |
4282 | } | 4290 | } |
4283 | } | 4291 | } |
4284 | 4292 | ||
4285 | 4293 | ||
4286 | void CalendarView::lookForOutgoingMessages() | 4294 | void CalendarView::lookForOutgoingMessages() |
4287 | { | 4295 | { |
4288 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); | 4296 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); |
4289 | ogd->loadMessages(); | 4297 | ogd->loadMessages(); |
4290 | } | 4298 | } |
4291 | 4299 | ||
4292 | void CalendarView::lookForIncomingMessages() | 4300 | void CalendarView::lookForIncomingMessages() |
4293 | { | 4301 | { |
4294 | IncomingDialog *icd = mDialogManager->incomingDialog(); | 4302 | IncomingDialog *icd = mDialogManager->incomingDialog(); |
4295 | icd->retrieve(); | 4303 | icd->retrieve(); |
4296 | } | 4304 | } |
4297 | 4305 | ||
4298 | bool CalendarView::removeCompletedSubTodos( Todo* t ) | 4306 | bool CalendarView::removeCompletedSubTodos( Todo* t ) |
4299 | { | 4307 | { |
4300 | bool deleteTodo = true; | 4308 | bool deleteTodo = true; |
4301 | QPtrList<Incidence> subTodos; | 4309 | QPtrList<Incidence> subTodos; |
4302 | Incidence *aTodo; | 4310 | Incidence *aTodo; |
4303 | subTodos = t->relations(); | 4311 | subTodos = t->relations(); |
4304 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { | 4312 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { |
4305 | if (! removeCompletedSubTodos( (Todo*) aTodo )) | 4313 | if (! removeCompletedSubTodos( (Todo*) aTodo )) |
4306 | deleteTodo = false; | 4314 | deleteTodo = false; |
4307 | } | 4315 | } |
4308 | if ( deleteTodo ) { | 4316 | if ( deleteTodo ) { |
4309 | if ( t->isCompleted() && !t->doesRecur()) { | 4317 | if ( t->isCompleted() && !t->doesRecur()) { |
4310 | checkExternalId( t ); | 4318 | checkExternalId( t ); |
4311 | mCalendar->deleteTodo( t ); | 4319 | mCalendar->deleteTodo( t ); |
4312 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); | 4320 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); |
4313 | } | 4321 | } |
4314 | else | 4322 | else |
4315 | deleteTodo = false; | 4323 | deleteTodo = false; |
4316 | } | 4324 | } |
4317 | return deleteTodo; | 4325 | return deleteTodo; |
4318 | 4326 | ||
4319 | } | 4327 | } |
4320 | void CalendarView::purgeCompleted() | 4328 | void CalendarView::purgeCompleted() |
4321 | { | 4329 | { |
4322 | int result = KMessageBox::warningContinueCancel(this, | 4330 | int result = KMessageBox::warningContinueCancel(this, |
4323 | i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); | 4331 | i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); |
4324 | 4332 | ||
4325 | if (result == KMessageBox::Continue) { | 4333 | if (result == KMessageBox::Continue) { |
4326 | 4334 | ||
4327 | QPtrList<Todo> todoCal; | 4335 | QPtrList<Todo> todoCal; |
4328 | QPtrList<Todo> rootTodos; | 4336 | QPtrList<Todo> rootTodos; |
4329 | //QPtrList<Incidence> rel; | 4337 | //QPtrList<Incidence> rel; |
4330 | Todo *aTodo;//, *rTodo; | 4338 | Todo *aTodo;//, *rTodo; |
4331 | Incidence *rIncidence; | 4339 | Incidence *rIncidence; |
4332 | bool childDelete = false; | 4340 | bool childDelete = false; |
4333 | bool deletedOne = true; | 4341 | bool deletedOne = true; |
4334 | todoCal = calendar()->todos(); | 4342 | todoCal = calendar()->todos(); |
4335 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { | 4343 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { |
4336 | if ( !aTodo->relatedTo() ) | 4344 | if ( !aTodo->relatedTo() ) |
4337 | rootTodos.append( aTodo ); | 4345 | rootTodos.append( aTodo ); |
4338 | } | 4346 | } |
4339 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { | 4347 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { |
4340 | removeCompletedSubTodos( aTodo ); | 4348 | removeCompletedSubTodos( aTodo ); |
4341 | } | 4349 | } |
4342 | 4350 | ||
4343 | updateView(); | 4351 | updateView(); |
4344 | } | 4352 | } |
4345 | } | 4353 | } |
4346 | 4354 | ||
4347 | void CalendarView::slotCalendarChanged() | 4355 | void CalendarView::slotCalendarChanged() |
4348 | { | 4356 | { |
4349 | ; | 4357 | ; |
4350 | } | 4358 | } |
4351 | 4359 | ||
4352 | void CalendarView::keyPressEvent ( QKeyEvent *e) | 4360 | void CalendarView::keyPressEvent ( QKeyEvent *e) |
4353 | { | 4361 | { |
4354 | //qDebug(" alendarView::keyPressEvent "); | 4362 | //qDebug(" alendarView::keyPressEvent "); |
4355 | e->ignore(); | 4363 | e->ignore(); |
4356 | } | 4364 | } |
4357 | 4365 | ||
4358 | 4366 | ||
4359 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) | 4367 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) |
4360 | { | 4368 | { |
4361 | // mSyncManager = manager; | 4369 | // mSyncManager = manager; |
4362 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { | 4370 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { |
4363 | qDebug("KO: SyncKDE request detected!"); | 4371 | qDebug("KO: SyncKDE request detected!"); |
4364 | } | 4372 | } |
4365 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 4373 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
4366 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 4374 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
4367 | return syncCalendar( filename, mode ); | 4375 | return syncCalendar( filename, mode ); |
4368 | } | 4376 | } |
4369 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) | 4377 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) |
4370 | { | 4378 | { |
4371 | //mSyncManager = manager; | 4379 | //mSyncManager = manager; |
4372 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 4380 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
4373 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 4381 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
4374 | if ( resource == "sharp" ) | 4382 | if ( resource == "sharp" ) |
4375 | syncExternal( 0 ); | 4383 | syncExternal( 0 ); |
4376 | if ( resource == "phone" ) | 4384 | if ( resource == "phone" ) |
4377 | syncExternal( 1 ); | 4385 | syncExternal( 1 ); |
4378 | // pending setmodified | 4386 | // pending setmodified |
4379 | return true; | 4387 | return true; |
4380 | } | 4388 | } |
4381 | void CalendarView::setSyncManager(KSyncManager* manager) | 4389 | void CalendarView::setSyncManager(KSyncManager* manager) |
4382 | { | 4390 | { |
4383 | mSyncManager = manager; | 4391 | mSyncManager = manager; |
4384 | } | 4392 | } |
4385 | 4393 | ||
4386 | void CalendarView::removeSyncInfo( QString syncProfile) | 4394 | void CalendarView::removeSyncInfo( QString syncProfile) |
4387 | { | 4395 | { |
4388 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); | 4396 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); |
4389 | mCalendar->removeSyncInfo( syncProfile ); | 4397 | mCalendar->removeSyncInfo( syncProfile ); |
4390 | 4398 | ||
4391 | } | 4399 | } |
4392 | 4400 | ||
4393 | void CalendarView::undo_delete() | 4401 | void CalendarView::undo_delete() |
4394 | { | 4402 | { |
4395 | //qDebug("undo_delete() "); | 4403 | //qDebug("undo_delete() "); |
4396 | Incidence* undo = mCalendar->undoIncidence(); | 4404 | Incidence* undo = mCalendar->undoIncidence(); |
4397 | if ( !undo ) { | 4405 | if ( !undo ) { |
4398 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), | 4406 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), |
4399 | i18n("KO/Pi")); | 4407 | i18n("KO/Pi")); |
4400 | return; | 4408 | return; |
4401 | } | 4409 | } |
4402 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + | 4410 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + |
4403 | i18n("\nAre you sure you want\nto restore this?"), | 4411 | i18n("\nAre you sure you want\nto restore this?"), |
4404 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { | 4412 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { |
4405 | mCalendar->undoDeleteIncidence(); | 4413 | mCalendar->undoDeleteIncidence(); |
4406 | updateView(); | 4414 | updateView(); |
4407 | } | 4415 | } |
4408 | } | 4416 | } |
4409 | 4417 | ||
4410 | void CalendarView::slotViewerClosed() | 4418 | void CalendarView::slotViewerClosed() |
4411 | { | 4419 | { |
4412 | QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); | 4420 | QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); |
4413 | } | 4421 | } |
4414 | 4422 | ||
4415 | void CalendarView::resetFocus() | 4423 | void CalendarView::resetFocus() |
4416 | { | 4424 | { |
4417 | if ( mViewerCallerIsSearchDialog ) { | 4425 | if ( mViewerCallerIsSearchDialog ) { |
4418 | if ( mDialogManager->getSearchDialog()->isVisible() ){ | 4426 | if ( mDialogManager->getSearchDialog()->isVisible() ){ |
4419 | mDialogManager->getSearchDialog()->raise(); | 4427 | mDialogManager->getSearchDialog()->raise(); |
4420 | mDialogManager->getSearchDialog()->setActiveWindow(); | 4428 | mDialogManager->getSearchDialog()->setActiveWindow(); |
4421 | mDialogManager->getSearchDialog()->listview()->resetFocus(); | 4429 | mDialogManager->getSearchDialog()->listview()->resetFocus(); |
4422 | } else | 4430 | } else |
4423 | mViewerCallerIsSearchDialog = false; | 4431 | mViewerCallerIsSearchDialog = false; |
4424 | } | 4432 | } |
4425 | if ( !mViewerCallerIsSearchDialog ) { | 4433 | if ( !mViewerCallerIsSearchDialog ) { |
4426 | //mViewManager->currentView()->setFocus(); | 4434 | //mViewManager->currentView()->setFocus(); |
4427 | //qDebug("sssssssssssssssset focus "); | 4435 | //qDebug("sssssssssssssssset focus "); |
4428 | topLevelWidget()->raise(); | 4436 | topLevelWidget()->raise(); |
4429 | setActiveWindow(); | 4437 | setActiveWindow(); |
4430 | //setFocus(); | 4438 | //setFocus(); |
4431 | } | 4439 | } |
4432 | mViewerCallerIsSearchDialog = false; | 4440 | mViewerCallerIsSearchDialog = false; |
4433 | } | 4441 | } |
4434 | 4442 | ||
4435 | void CalendarView::showNextAlarms() | 4443 | void CalendarView::showNextAlarms() |
4436 | { | 4444 | { |
4437 | QString message; | 4445 | QString message; |
4438 | QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); | 4446 | QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); |
4439 | if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) { | 4447 | if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) { |
4440 | QString sum = mCalendar->nextSummary(); | 4448 | QString sum = mCalendar->nextSummary(); |
4441 | QDateTime nextA = mNextAlarmDateTime; | 4449 | QDateTime nextA = mNextAlarmDateTime; |
4442 | QDateTime cur = QDateTime::currentDateTime(); | 4450 | QDateTime cur = QDateTime::currentDateTime(); |
4443 | int secs = cur.secsTo( nextA ); | 4451 | int secs = cur.secsTo( nextA ); |
4444 | int min = secs /60; | 4452 | int min = secs /60; |
4445 | int hours = min /60; | 4453 | int hours = min /60; |
4446 | min = min % 60; | 4454 | min = min % 60; |
4447 | int days = hours /24; | 4455 | int days = hours /24; |
4448 | hours = hours % 24; | 4456 | hours = hours % 24; |
4449 | 4457 | ||
4450 | //message = i18n("The next alarm is in:\n"); | 4458 | //message = i18n("The next alarm is in:\n"); |
4451 | if ( days > 1 ) | 4459 | if ( days > 1 ) |
4452 | message += i18n("%1 days\n").arg( days ); | 4460 | message += i18n("%1 days\n").arg( days ); |
4453 | else if ( days == 1 ) | 4461 | else if ( days == 1 ) |
4454 | message += i18n("1 day\n"); | 4462 | message += i18n("1 day\n"); |
4455 | if ( hours > 1 ) | 4463 | if ( hours > 1 ) |
4456 | message += i18n("%1 hours\n").arg( hours ); | 4464 | message += i18n("%1 hours\n").arg( hours ); |
4457 | else if ( hours == 1 ) | 4465 | else if ( hours == 1 ) |
4458 | message += i18n("1 hour\n"); | 4466 | message += i18n("1 hour\n"); |
4459 | if ( min > 1 ) | 4467 | if ( min > 1 ) |
4460 | message += i18n("%1 minutes\n").arg( min ); | 4468 | message += i18n("%1 minutes\n").arg( min ); |
4461 | else if ( min == 1 ) | 4469 | else if ( min == 1 ) |
4462 | message += i18n("1 minute\n"); | 4470 | message += i18n("1 minute\n"); |
4463 | if ( message.isEmpty() ) | 4471 | if ( message.isEmpty() ) |
4464 | message = i18n("The next alarm is in\nless than one minute!"); | 4472 | message = i18n("The next alarm is in\nless than one minute!"); |
4465 | else | 4473 | else |
4466 | message = i18n("The next alarm is in:\n") + message; | 4474 | message = i18n("The next alarm is in:\n") + message; |
4467 | message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; | 4475 | message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; |
4468 | } else { | 4476 | } else { |
4469 | message = i18n("There is no next alarm."); | 4477 | message = i18n("There is no next alarm."); |
4470 | 4478 | ||
4471 | } | 4479 | } |
4472 | #ifdef DESKTOP_VERSION | 4480 | #ifdef DESKTOP_VERSION |
4473 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 4481 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
4474 | message += i18n("\nThe internal alarm notification is disabled!\n"); | 4482 | message += i18n("\nThe internal alarm notification is disabled!\n"); |
4475 | message += i18n("Enable it in the settings menu, TAB alarm."); | 4483 | message += i18n("Enable it in the settings menu, TAB alarm."); |
4476 | } | 4484 | } |
4477 | 4485 | ||
4478 | #endif | 4486 | #endif |
4479 | KMessageBox::information( this, message); | 4487 | KMessageBox::information( this, message); |
4480 | } | 4488 | } |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 0144ba4..ec5b7ab 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -1,650 +1,651 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000, 2001 | 3 | Copyright (c) 2000, 2001 |
4 | Cornelius Schumacher <schumacher@kde.org> | 4 | Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | #ifndef CALENDARVIEW_H | 24 | #ifndef CALENDARVIEW_H |
25 | #define CALENDARVIEW_H | 25 | #define CALENDARVIEW_H |
26 | 26 | ||
27 | #include <qframe.h> | 27 | #include <qframe.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | #include <qptrlist.h> | 30 | #include <qptrlist.h> |
31 | #include <qvbox.h> | 31 | #include <qvbox.h> |
32 | #include <qmap.h> | 32 | #include <qmap.h> |
33 | #ifndef DESKTOP_VERSION | 33 | #ifndef DESKTOP_VERSION |
34 | #include <qtopia/ir.h> | 34 | #include <qtopia/ir.h> |
35 | #else | 35 | #else |
36 | #define Ir char | 36 | #define Ir char |
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendar.h> | 38 | #include <libkcal/calendar.h> |
39 | #include <libkcal/scheduler.h> | 39 | #include <libkcal/scheduler.h> |
40 | #include <libkcal/calendarresources.h> | 40 | #include <libkcal/calendarresources.h> |
41 | #include <libkcal/resourcecalendar.h> | 41 | #include <libkcal/resourcecalendar.h> |
42 | #include <KDGanttMinimizeSplitter.h> | 42 | #include <KDGanttMinimizeSplitter.h> |
43 | 43 | ||
44 | #include <korganizer/calendarviewbase.h> | 44 | #include <korganizer/calendarviewbase.h> |
45 | 45 | ||
46 | #include <ksyncmanager.h> | 46 | #include <ksyncmanager.h> |
47 | //#include <koprefs.h> | 47 | //#include <koprefs.h> |
48 | 48 | ||
49 | class QWidgetStack; | 49 | class QWidgetStack; |
50 | class QSplitter; | 50 | class QSplitter; |
51 | class KopiCalendarFile; | 51 | class KopiCalendarFile; |
52 | class CalPrinter; | 52 | class CalPrinter; |
53 | class KOFilterView; | 53 | class KOFilterView; |
54 | class KOCalEditView; | 54 | class KOCalEditView; |
55 | class KOViewManager; | 55 | class KOViewManager; |
56 | class KODialogManager; | 56 | class KODialogManager; |
57 | class KOTodoView; | 57 | class KOTodoView; |
58 | class KDateNavigator; | 58 | class KDateNavigator; |
59 | class DateNavigatorContainer; | 59 | class DateNavigatorContainer; |
60 | class DateNavigator; | 60 | class DateNavigator; |
61 | class KOIncidenceEditor; | 61 | class KOIncidenceEditor; |
62 | class KDatePicker; | 62 | class KDatePicker; |
63 | class ResourceView; | 63 | class ResourceView; |
64 | class KOEventEditor; | 64 | class KOEventEditor; |
65 | class KOTodoEditor ; | 65 | class KOTodoEditor ; |
66 | class KOEventViewerDialog; | 66 | class KOEventViewerDialog; |
67 | class KOBeamPrefs; | 67 | class KOBeamPrefs; |
68 | class KSyncProfile; | 68 | class KSyncProfile; |
69 | class AlarmDialog; | 69 | class AlarmDialog; |
70 | class KCal::Attendee; | 70 | class KCal::Attendee; |
71 | 71 | ||
72 | namespace KCal { class FileStorage; } | 72 | namespace KCal { class FileStorage; } |
73 | 73 | ||
74 | using namespace KCal; | 74 | using namespace KCal; |
75 | 75 | ||
76 | /** | 76 | /** |
77 | This is the main calendar widget. It provides the different vies on t he | 77 | This is the main calendar widget. It provides the different vies on t he |
78 | calendar data as well as the date navigator. It also handles synchronisation | 78 | calendar data as well as the date navigator. It also handles synchronisation |
79 | of the different views and controls the different dialogs like preferences, | 79 | of the different views and controls the different dialogs like preferences, |
80 | event editor, search dialog etc. | 80 | event editor, search dialog etc. |
81 | 81 | ||
82 | @short main calendar view widget | 82 | @short main calendar view widget |
83 | @author Cornelius Schumacher | 83 | @author Cornelius Schumacher |
84 | */ | 84 | */ |
85 | 85 | ||
86 | #include <qtextbrowser.h> | 86 | #include <qtextbrowser.h> |
87 | #include <qtextcodec.h> | 87 | #include <qtextcodec.h> |
88 | 88 | ||
89 | class MissedAlarmTextBrowser : public QTextBrowser { | 89 | class MissedAlarmTextBrowser : public QTextBrowser { |
90 | Q_OBJECT | 90 | Q_OBJECT |
91 | public: | 91 | public: |
92 | MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start); | 92 | MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start); |
93 | ~MissedAlarmTextBrowser(); | 93 | ~MissedAlarmTextBrowser(); |
94 | void setSource(const QString & n); | 94 | void setSource(const QString & n); |
95 | 95 | ||
96 | private: | 96 | private: |
97 | Incidence * getNextInc(QDateTime start ); | 97 | Incidence * getNextInc(QDateTime start ); |
98 | QPtrList<Incidence> mAlarms; | 98 | QPtrList<Incidence> mAlarms; |
99 | signals: | 99 | signals: |
100 | void showIncidence( QString uid); | 100 | void showIncidence( QString uid); |
101 | }; | 101 | }; |
102 | 102 | ||
103 | 103 | ||
104 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface | 104 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface |
105 | { | 105 | { |
106 | Q_OBJECT | 106 | Q_OBJECT |
107 | public: | 107 | public: |
108 | /** | 108 | /** |
109 | Constructs a new calendar view widget. | 109 | Constructs a new calendar view widget. |
110 | 110 | ||
111 | @param calendar calendar document | 111 | @param calendar calendar document |
112 | @param parent parent window | 112 | @param parent parent window |
113 | @param name Qt internal widget object name | 113 | @param name Qt internal widget object name |
114 | */ | 114 | */ |
115 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, | 115 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, |
116 | const char *name = 0 ); | 116 | const char *name = 0 ); |
117 | CalendarView( Calendar *calendar, QWidget *parent = 0, | 117 | CalendarView( Calendar *calendar, QWidget *parent = 0, |
118 | const char *name = 0 ); | 118 | const char *name = 0 ); |
119 | virtual ~CalendarView(); | 119 | virtual ~CalendarView(); |
120 | 120 | ||
121 | Calendar *calendar() { return mCalendar; } | 121 | Calendar *calendar() { return mCalendar; } |
122 | 122 | ||
123 | KOViewManager *viewManager(); | 123 | KOViewManager *viewManager(); |
124 | KODialogManager *dialogManager(); | 124 | KODialogManager *dialogManager(); |
125 | 125 | ||
126 | QDate startDate(); | 126 | QDate startDate(); |
127 | QDate endDate(); | 127 | QDate endDate(); |
128 | 128 | ||
129 | QWidgetStack *viewStack(); | 129 | QWidgetStack *viewStack(); |
130 | QWidget *leftFrame(); | 130 | QWidget *leftFrame(); |
131 | 131 | ||
132 | DateNavigator *dateNavigator(); | 132 | DateNavigator *dateNavigator(); |
133 | KDateNavigator *dateNavigatorWidget(); | 133 | KDateNavigator *dateNavigatorWidget(); |
134 | 134 | ||
135 | void addView(KOrg::BaseView *); | 135 | void addView(KOrg::BaseView *); |
136 | void showView(KOrg::BaseView *); | 136 | void showView(KOrg::BaseView *); |
137 | KOEventViewerDialog* getEventViewerDialog(); | 137 | KOEventViewerDialog* getEventViewerDialog(); |
138 | Incidence *currentSelection(); | 138 | Incidence *currentSelection(); |
139 | 139 | ||
140 | signals: | 140 | signals: |
141 | void save (); | 141 | void save (); |
142 | void saveStopTimer (); | 142 | void saveStopTimer (); |
143 | void tempDisableBR(bool); | 143 | void tempDisableBR(bool); |
144 | /** This todo has been modified */ | 144 | /** This todo has been modified */ |
145 | void todoModified(Todo *, int); | 145 | void todoModified(Todo *, int); |
146 | 146 | ||
147 | /** when change is made to options dialog, the topwidget will catch this | 147 | /** when change is made to options dialog, the topwidget will catch this |
148 | * and emit this signal which notifies all widgets which have registered | 148 | * and emit this signal which notifies all widgets which have registered |
149 | * for notification to update their settings. */ | 149 | * for notification to update their settings. */ |
150 | void configChanged(); | 150 | void configChanged(); |
151 | /** emitted when the topwidget is closing down, so that any attached | 151 | /** emitted when the topwidget is closing down, so that any attached |
152 | child windows can also close. */ | 152 | child windows can also close. */ |
153 | void closingDown(); | 153 | void closingDown(); |
154 | /** emitted right before we die */ | 154 | /** emitted right before we die */ |
155 | void closed(QWidget *); | 155 | void closed(QWidget *); |
156 | 156 | ||
157 | /** Emitted when state of modified flag changes */ | 157 | /** Emitted when state of modified flag changes */ |
158 | void modifiedChanged(bool); | 158 | void modifiedChanged(bool); |
159 | void signalmodified(); | 159 | void signalmodified(); |
160 | 160 | ||
161 | /** Emitted when state of read-only flag changes */ | 161 | /** Emitted when state of read-only flag changes */ |
162 | void readOnlyChanged(bool); | 162 | void readOnlyChanged(bool); |
163 | 163 | ||
164 | /** Emitted when the unit of navigation changes */ | 164 | /** Emitted when the unit of navigation changes */ |
165 | void changeNavStringPrev(const QString &); | 165 | void changeNavStringPrev(const QString &); |
166 | void changeNavStringNext(const QString &); | 166 | void changeNavStringNext(const QString &); |
167 | 167 | ||
168 | /** Emitted when state of events selection has changed and user is organizer*/ | 168 | /** Emitted when state of events selection has changed and user is organizer*/ |
169 | void organizerEventsSelected(bool); | 169 | void organizerEventsSelected(bool); |
170 | /** Emitted when state of events selection has changed and user is attendee*/ | 170 | /** Emitted when state of events selection has changed and user is attendee*/ |
171 | void groupEventsSelected(bool); | 171 | void groupEventsSelected(bool); |
172 | /** | 172 | /** |
173 | Emitted when an incidence gets selected. If the selection is cleared the | 173 | Emitted when an incidence gets selected. If the selection is cleared the |
174 | signal is emitted with 0 as argument. | 174 | signal is emitted with 0 as argument. |
175 | */ | 175 | */ |
176 | void incidenceSelected( Incidence * ); | 176 | void incidenceSelected( Incidence * ); |
177 | /** Emitted, when a todoitem is selected or deselected. */ | 177 | /** Emitted, when a todoitem is selected or deselected. */ |
178 | void todoSelected( bool ); | 178 | void todoSelected( bool ); |
179 | 179 | ||
180 | /** | 180 | /** |
181 | Emitted, when clipboard content changes. Parameter indicates if paste | 181 | Emitted, when clipboard content changes. Parameter indicates if paste |
182 | is possible or not. | 182 | is possible or not. |
183 | */ | 183 | */ |
184 | void pasteEnabled(bool); | 184 | void pasteEnabled(bool); |
185 | 185 | ||
186 | /** Emitted, when the number of incoming messages has changed. */ | 186 | /** Emitted, when the number of incoming messages has changed. */ |
187 | void numIncomingChanged(int); | 187 | void numIncomingChanged(int); |
188 | 188 | ||
189 | /** Emitted, when the number of outgoing messages has changed. */ | 189 | /** Emitted, when the number of outgoing messages has changed. */ |
190 | void numOutgoingChanged(int); | 190 | void numOutgoingChanged(int); |
191 | 191 | ||
192 | /** Send status message, which can e.g. be displayed in the status bar. */ | 192 | /** Send status message, which can e.g. be displayed in the status bar. */ |
193 | void statusMessage(const QString &); | 193 | void statusMessage(const QString &); |
194 | 194 | ||
195 | void calendarViewExpanded( bool ); | 195 | void calendarViewExpanded( bool ); |
196 | void updateSearchDialog(); | 196 | void updateSearchDialog(); |
197 | 197 | ||
198 | 198 | ||
199 | public slots: | 199 | public slots: |
200 | void checkAlarms(); | 200 | void checkAlarms(); |
201 | void slotprintSelInc(); | 201 | void slotprintSelInc(); |
202 | void showNextAlarms(); | 202 | void showNextAlarms(); |
203 | void showOpenError(); | 203 | void showOpenError(); |
204 | void watchSavedFile(); | 204 | void watchSavedFile(); |
205 | void recheckTimerAlarm(); | 205 | void recheckTimerAlarm(); |
206 | void checkNextTimerAlarm(); | 206 | void checkNextTimerAlarm(); |
207 | void addAlarm(const QDateTime &qdt, const QString ¬i ); | 207 | void addAlarm(const QDateTime &qdt, const QString ¬i ); |
208 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); | 208 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); |
209 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); | 209 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); |
210 | 210 | ||
211 | /** options dialog made a changed to the configuration. we catch this | 211 | /** options dialog made a changed to the configuration. we catch this |
212 | * and notify all widgets which need to update their configuration. */ | 212 | * and notify all widgets which need to update their configuration. */ |
213 | void updateConfig(); | 213 | void updateConfig(); |
214 | 214 | ||
215 | void insertBirthdays(const QString& uid, const QStringList& birthdayList, | 215 | void insertBirthdays(const QString& uid, const QStringList& birthdayList, |
216 | const QStringList& anniversaryList, const QStringList& realNameList, | 216 | const QStringList& anniversaryList, const QStringList& realNameList, |
217 | const QStringList& emailList, const QStringList& assembledNameList, | 217 | const QStringList& emailList, const QStringList& assembledNameList, |
218 | const QStringList& uidList); | 218 | const QStringList& uidList); |
219 | 219 | ||
220 | /** | 220 | /** |
221 | Load calendar from file \a filename. If \a merge is true, load | 221 | Load calendar from file \a filename. If \a merge is true, load |
222 | calendar into existing one, if it is false, clear calendar, before | 222 | calendar into existing one, if it is false, clear calendar, before |
223 | loading. Return true, if calendar could be successfully loaded. | 223 | loading. Return true, if calendar could be successfully loaded. |
224 | */ | 224 | */ |
225 | bool openCalendar(QString filename, bool merge=false); | 225 | bool openCalendar(QString filename, bool merge=false); |
226 | bool loadCalendars(); | 226 | bool loadCalendars(); |
227 | bool saveCalendars(); | 227 | bool saveCalendars(); |
228 | bool restoreCalendarSettings(); | 228 | bool restoreCalendarSettings(); |
229 | bool addCalendar( KopiCalendarFile * ); | 229 | bool addCalendar( KopiCalendarFile * ); |
230 | void addCalendarId( int id ); | ||
230 | bool syncCalendar(QString filename,int mode = 0 ); | 231 | bool syncCalendar(QString filename,int mode = 0 ); |
231 | 232 | ||
232 | /** | 233 | /** |
233 | Save calendar data to file. Return true if calendar could be | 234 | Save calendar data to file. Return true if calendar could be |
234 | successfully saved. | 235 | successfully saved. |
235 | */ | 236 | */ |
236 | bool saveCalendar(QString filename); | 237 | bool saveCalendar(QString filename); |
237 | 238 | ||
238 | /** | 239 | /** |
239 | Close calendar. Clear calendar data and reset views to display an empty | 240 | Close calendar. Clear calendar data and reset views to display an empty |
240 | calendar. | 241 | calendar. |
241 | */ | 242 | */ |
242 | void closeCalendar(); | 243 | void closeCalendar(); |
243 | 244 | ||
244 | /** Archive old events of calendar */ | 245 | /** Archive old events of calendar */ |
245 | void archiveCalendar(); | 246 | void archiveCalendar(); |
246 | 247 | ||
247 | void showIncidence(); | 248 | void showIncidence(); |
248 | void editIncidence(); | 249 | void editIncidence(); |
249 | void editIncidenceDescription(); | 250 | void editIncidenceDescription(); |
250 | void deleteIncidence(); | 251 | void deleteIncidence(); |
251 | void cloneIncidence(); | 252 | void cloneIncidence(); |
252 | void moveIncidence(); | 253 | void moveIncidence(); |
253 | void beamIncidence(); | 254 | void beamIncidence(); |
254 | void toggleCancelIncidence(); | 255 | void toggleCancelIncidence(); |
255 | 256 | ||
256 | /** create an editeventwin with supplied date/time, and if bool is true, | 257 | /** create an editeventwin with supplied date/time, and if bool is true, |
257 | * make the event take all day. */ | 258 | * make the event take all day. */ |
258 | void newEvent(QDateTime, QDateTime, bool allDay ); | 259 | void newEvent(QDateTime, QDateTime, bool allDay ); |
259 | void newEvent(QDateTime, QDateTime); | 260 | void newEvent(QDateTime, QDateTime); |
260 | void newEvent(QDateTime fh); | 261 | void newEvent(QDateTime fh); |
261 | void newEvent(QDate dt); | 262 | void newEvent(QDate dt); |
262 | /** create new event without having a date hint. Takes current date as | 263 | /** create new event without having a date hint. Takes current date as |
263 | default hint. */ | 264 | default hint. */ |
264 | void newEvent(); | 265 | void newEvent(); |
265 | void newFloatingEvent(); | 266 | void newFloatingEvent(); |
266 | 267 | ||
267 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ | 268 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ |
268 | void showIncidence(Incidence *); | 269 | void showIncidence(Incidence *); |
269 | void showIncidence(QString uid); | 270 | void showIncidence(QString uid); |
270 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ | 271 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ |
271 | void editIncidence(Incidence *); | 272 | void editIncidence(Incidence *); |
272 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ | 273 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ |
273 | void deleteIncidence(Incidence *); | 274 | void deleteIncidence(Incidence *); |
274 | void cloneIncidence(Incidence *); | 275 | void cloneIncidence(Incidence *); |
275 | void cancelIncidence(Incidence *); | 276 | void cancelIncidence(Incidence *); |
276 | /** Create an editor for the supplied event. */ | 277 | /** Create an editor for the supplied event. */ |
277 | void editEvent(Event *); | 278 | void editEvent(Event *); |
278 | /** Delete the supplied event. */ | 279 | /** Delete the supplied event. */ |
279 | void deleteEvent(Event *); | 280 | void deleteEvent(Event *); |
280 | /** Delete the event with the given unique ID. Returns false, if event wasn't | 281 | /** Delete the event with the given unique ID. Returns false, if event wasn't |
281 | found. */ | 282 | found. */ |
282 | bool deleteEvent(const QString &uid); | 283 | bool deleteEvent(const QString &uid); |
283 | /** Create a read-only viewer dialog for the supplied event. */ | 284 | /** Create a read-only viewer dialog for the supplied event. */ |
284 | void showEvent(Event *); | 285 | void showEvent(Event *); |
285 | 286 | ||
286 | void editJournal(Journal *); | 287 | void editJournal(Journal *); |
287 | void showJournal(Journal *); | 288 | void showJournal(Journal *); |
288 | void deleteJournal(Journal *); | 289 | void deleteJournal(Journal *); |
289 | /** Create an editor dialog for a todo */ | 290 | /** Create an editor dialog for a todo */ |
290 | void editTodo(Todo *); | 291 | void editTodo(Todo *); |
291 | /** Create a read-only viewer dialog for the supplied todo */ | 292 | /** Create a read-only viewer dialog for the supplied todo */ |
292 | void showTodo(Todo *); | 293 | void showTodo(Todo *); |
293 | /** create new todo */ | 294 | /** create new todo */ |
294 | void newTodo(); | 295 | void newTodo(); |
295 | void newTodoDateTime(QDateTime, bool allday); | 296 | void newTodoDateTime(QDateTime, bool allday); |
296 | /** create new todo with a parent todo */ | 297 | /** create new todo with a parent todo */ |
297 | void newSubTodo(); | 298 | void newSubTodo(); |
298 | /** create new todo with a parent todo */ | 299 | /** create new todo with a parent todo */ |
299 | void newSubTodo(Todo *); | 300 | void newSubTodo(Todo *); |
300 | /** Delete todo */ | 301 | /** Delete todo */ |
301 | void deleteTodo(Todo *); | 302 | void deleteTodo(Todo *); |
302 | 303 | ||
303 | 304 | ||
304 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is | 305 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is |
305 | * emitted as result. */ | 306 | * emitted as result. */ |
306 | void checkClipboard(); | 307 | void checkClipboard(); |
307 | 308 | ||
308 | /** using the KConfig associated with the kapp variable, read in the | 309 | /** using the KConfig associated with the kapp variable, read in the |
309 | * settings from the config file. | 310 | * settings from the config file. |
310 | */ | 311 | */ |
311 | void readSettings(); | 312 | void readSettings(); |
312 | 313 | ||
313 | /** write current state to config file. */ | 314 | /** write current state to config file. */ |
314 | void writeSettings(); | 315 | void writeSettings(); |
315 | 316 | ||
316 | /** read settings for calendar filters */ | 317 | /** read settings for calendar filters */ |
317 | void readFilterSettings(KConfig *config); | 318 | void readFilterSettings(KConfig *config); |
318 | 319 | ||
319 | /** write settings for calendar filters */ | 320 | /** write settings for calendar filters */ |
320 | void writeFilterSettings(KConfig *config); | 321 | void writeFilterSettings(KConfig *config); |
321 | 322 | ||
322 | /** passes on the message that an event has changed to the currently | 323 | /** passes on the message that an event has changed to the currently |
323 | * activated view so that it can make appropriate display changes. */ | 324 | * activated view so that it can make appropriate display changes. */ |
324 | void changeEventDisplay(Event *, int); | 325 | void changeEventDisplay(Event *, int); |
325 | void changeIncidenceDisplay(Incidence *, int); | 326 | void changeIncidenceDisplay(Incidence *, int); |
326 | void changeTodoDisplay(Todo *, int); | 327 | void changeTodoDisplay(Todo *, int); |
327 | 328 | ||
328 | void eventAdded(Event *); | 329 | void eventAdded(Event *); |
329 | void eventChanged(Event *); | 330 | void eventChanged(Event *); |
330 | void eventToBeDeleted(Event *); | 331 | void eventToBeDeleted(Event *); |
331 | void eventDeleted(); | 332 | void eventDeleted(); |
332 | 333 | ||
333 | void todoAdded(Todo *); | 334 | void todoAdded(Todo *); |
334 | void todoChanged(Todo *); | 335 | void todoChanged(Todo *); |
335 | void todoToBeDeleted(Todo *); | 336 | void todoToBeDeleted(Todo *); |
336 | void todoDeleted(); | 337 | void todoDeleted(); |
337 | 338 | ||
338 | void updateView(const QDate &start, const QDate &end); | 339 | void updateView(const QDate &start, const QDate &end); |
339 | void updateView(); | 340 | void updateView(); |
340 | void clearAllViews(); | 341 | void clearAllViews(); |
341 | 342 | ||
342 | /** Full update of visible todo views */ | 343 | /** Full update of visible todo views */ |
343 | void updateTodoViews(); | 344 | void updateTodoViews(); |
344 | 345 | ||
345 | void updateUnmanagedViews(); | 346 | void updateUnmanagedViews(); |
346 | 347 | ||
347 | /** cut the current appointment to the clipboard */ | 348 | /** cut the current appointment to the clipboard */ |
348 | void edit_cut(); | 349 | void edit_cut(); |
349 | 350 | ||
350 | /** copy the current appointment(s) to the clipboard */ | 351 | /** copy the current appointment(s) to the clipboard */ |
351 | void edit_copy(); | 352 | void edit_copy(); |
352 | 353 | ||
353 | /** paste the current vobject(s) in the clipboard buffer into calendar */ | 354 | /** paste the current vobject(s) in the clipboard buffer into calendar */ |
354 | void edit_paste(); | 355 | void edit_paste(); |
355 | 356 | ||
356 | /** edit viewing and configuration options. */ | 357 | /** edit viewing and configuration options. */ |
357 | void edit_options(); | 358 | void edit_options(); |
358 | void edit_global_options(); | 359 | void edit_global_options(); |
359 | /** | 360 | /** |
360 | Functions for printing, previewing a print, and setting up printing | 361 | Functions for printing, previewing a print, and setting up printing |
361 | parameters. | 362 | parameters. |
362 | */ | 363 | */ |
363 | void print(); | 364 | void print(); |
364 | void printSetup(); | 365 | void printSetup(); |
365 | void printPreview(); | 366 | void printPreview(); |
366 | 367 | ||
367 | /** Export as iCalendar file */ | 368 | /** Export as iCalendar file */ |
368 | void exportICalendar(); | 369 | void exportICalendar(); |
369 | 370 | ||
370 | /** Export as vCalendar file */ | 371 | /** Export as vCalendar file */ |
371 | bool exportVCalendar( QString fn); | 372 | bool exportVCalendar( QString fn); |
372 | 373 | ||
373 | /** pop up a dialog to show an existing appointment. */ | 374 | /** pop up a dialog to show an existing appointment. */ |
374 | void appointment_show(); | 375 | void appointment_show(); |
375 | /** | 376 | /** |
376 | * pop up an Appointment Dialog to edit an existing appointment.Get | 377 | * pop up an Appointment Dialog to edit an existing appointment.Get |
377 | * information on the appointment from the list of unique IDs that is | 378 | * information on the appointment from the list of unique IDs that is |
378 | * currently in the View, called currIds. | 379 | * currently in the View, called currIds. |
379 | */ | 380 | */ |
380 | void appointment_edit(); | 381 | void appointment_edit(); |
381 | /** | 382 | /** |
382 | * pop up dialog confirming deletion of currently selected event in the | 383 | * pop up dialog confirming deletion of currently selected event in the |
383 | * View. | 384 | * View. |
384 | */ | 385 | */ |
385 | void appointment_delete(); | 386 | void appointment_delete(); |
386 | 387 | ||
387 | /** mails the currently selected event to a particular user as a vCalendar | 388 | /** mails the currently selected event to a particular user as a vCalendar |
388 | attachment. */ | 389 | attachment. */ |
389 | void action_mail(); | 390 | void action_mail(); |
390 | 391 | ||
391 | /* frees a subtodo from it's relation */ | 392 | /* frees a subtodo from it's relation */ |
392 | void todo_unsub( Todo * ); | 393 | void todo_unsub( Todo * ); |
393 | void todo_resub( Todo * parent, Todo * sub ); | 394 | void todo_resub( Todo * parent, Todo * sub ); |
394 | 395 | ||
395 | /** Take ownership of selected event. */ | 396 | /** Take ownership of selected event. */ |
396 | void takeOverEvent(); | 397 | void takeOverEvent(); |
397 | 398 | ||
398 | /** Take ownership of all events in calendar. */ | 399 | /** Take ownership of all events in calendar. */ |
399 | void takeOverCalendar(); | 400 | void takeOverCalendar(); |
400 | 401 | ||
401 | /** query whether or not the calendar is "dirty". */ | 402 | /** query whether or not the calendar is "dirty". */ |
402 | bool isModified(); | 403 | bool isModified(); |
403 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ | 404 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ |
404 | void setModified(bool modified=true); | 405 | void setModified(bool modified=true); |
405 | 406 | ||
406 | /** query if the calendar is read-only. */ | 407 | /** query if the calendar is read-only. */ |
407 | bool isReadOnly(); | 408 | bool isReadOnly(); |
408 | /** set state of calendar to read-only */ | 409 | /** set state of calendar to read-only */ |
409 | void setReadOnly(bool readOnly=true); | 410 | void setReadOnly(bool readOnly=true); |
410 | 411 | ||
411 | void eventUpdated(Incidence *); | 412 | void eventUpdated(Incidence *); |
412 | 413 | ||
413 | /* iTIP scheduling actions */ | 414 | /* iTIP scheduling actions */ |
414 | void schedule_publish(Incidence *incidence = 0); | 415 | void schedule_publish(Incidence *incidence = 0); |
415 | void schedule_request(Incidence *incidence = 0); | 416 | void schedule_request(Incidence *incidence = 0); |
416 | void schedule_refresh(Incidence *incidence = 0); | 417 | void schedule_refresh(Incidence *incidence = 0); |
417 | void schedule_cancel(Incidence *incidence = 0); | 418 | void schedule_cancel(Incidence *incidence = 0); |
418 | void schedule_add(Incidence *incidence = 0); | 419 | void schedule_add(Incidence *incidence = 0); |
419 | void schedule_reply(Incidence *incidence = 0); | 420 | void schedule_reply(Incidence *incidence = 0); |
420 | void schedule_counter(Incidence *incidence = 0); | 421 | void schedule_counter(Incidence *incidence = 0); |
421 | void schedule_declinecounter(Incidence *incidence = 0); | 422 | void schedule_declinecounter(Incidence *incidence = 0); |
422 | void schedule_publish_freebusy(int daysToPublish = 30); | 423 | void schedule_publish_freebusy(int daysToPublish = 30); |
423 | 424 | ||
424 | void openAddressbook(); | 425 | void openAddressbook(); |
425 | 426 | ||
426 | void editFilters(); | 427 | void editFilters(); |
427 | void toggleFilerEnabled(); | 428 | void toggleFilerEnabled(); |
428 | QPtrList<CalFilter> filters(); | 429 | QPtrList<CalFilter> filters(); |
429 | void toggleFilter(); | 430 | void toggleFilter(); |
430 | void showFilter(bool visible); | 431 | void showFilter(bool visible); |
431 | void updateFilter(); | 432 | void updateFilter(); |
432 | void filterEdited(); | 433 | void filterEdited(); |
433 | void selectFilter( int ); | 434 | void selectFilter( int ); |
434 | KOFilterView *filterView(); | 435 | KOFilterView *filterView(); |
435 | 436 | ||
436 | void showIntro(); | 437 | void showIntro(); |
437 | 438 | ||
438 | /** Move the curdatepient view date to today */ | 439 | /** Move the curdatepient view date to today */ |
439 | void goToday(); | 440 | void goToday(); |
440 | 441 | ||
441 | /** Move to the next date(s) in the current view */ | 442 | /** Move to the next date(s) in the current view */ |
442 | void goNext(); | 443 | void goNext(); |
443 | 444 | ||
444 | /** Move to the previous date(s) in the current view */ | 445 | /** Move to the previous date(s) in the current view */ |
445 | void goPrevious(); | 446 | void goPrevious(); |
446 | /** Move to the next date(s) in the current view */ | 447 | /** Move to the next date(s) in the current view */ |
447 | void goNextMonth(); | 448 | void goNextMonth(); |
448 | 449 | ||
449 | /** Move to the previous date(s) in the current view */ | 450 | /** Move to the previous date(s) in the current view */ |
450 | void goPreviousMonth(); | 451 | void goPreviousMonth(); |
451 | 452 | ||
452 | void toggleExpand(); | 453 | void toggleExpand(); |
453 | void toggleDateNavigatorWidget(); | 454 | void toggleDateNavigatorWidget(); |
454 | void toggleAllDaySize(); | 455 | void toggleAllDaySize(); |
455 | void dialogClosing(Incidence *); | 456 | void dialogClosing(Incidence *); |
456 | 457 | ||
457 | /** Look for new messages in the inbox */ | 458 | /** Look for new messages in the inbox */ |
458 | void lookForIncomingMessages(); | 459 | void lookForIncomingMessages(); |
459 | /** Look for new messages in the outbox */ | 460 | /** Look for new messages in the outbox */ |
460 | void lookForOutgoingMessages(); | 461 | void lookForOutgoingMessages(); |
461 | 462 | ||
462 | void processMainViewSelection( Incidence * ); | 463 | void processMainViewSelection( Incidence * ); |
463 | void processTodoListSelection( Incidence * ); | 464 | void processTodoListSelection( Incidence * ); |
464 | 465 | ||
465 | void processIncidenceSelection( Incidence * ); | 466 | void processIncidenceSelection( Incidence * ); |
466 | 467 | ||
467 | void purgeCompleted(); | 468 | void purgeCompleted(); |
468 | bool removeCompletedSubTodos( Todo* ); | 469 | bool removeCompletedSubTodos( Todo* ); |
469 | void slotCalendarChanged(); | 470 | void slotCalendarChanged(); |
470 | bool importBday(); | 471 | bool importBday(); |
471 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); | 472 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); |
472 | bool importQtopia( const QString &categoriesFile, | 473 | bool importQtopia( const QString &categoriesFile, |
473 | const QString &datebookFile, | 474 | const QString &datebookFile, |
474 | const QString &tasklistFile ); | 475 | const QString &tasklistFile ); |
475 | void syncExternal( int mode ); | 476 | void syncExternal( int mode ); |
476 | void slotSelectPickerDate( QDate ) ; | 477 | void slotSelectPickerDate( QDate ) ; |
477 | void showDatePicker() ; | 478 | void showDatePicker() ; |
478 | void showDatePickerPopup() ; | 479 | void showDatePickerPopup() ; |
479 | void moveIncidence(Incidence *) ; | 480 | void moveIncidence(Incidence *) ; |
480 | void beamIncidence(Incidence *) ; | 481 | void beamIncidence(Incidence *) ; |
481 | void beamCalendar() ; | 482 | void beamCalendar() ; |
482 | void beamFilteredCalendar() ; | 483 | void beamFilteredCalendar() ; |
483 | void beamIncidenceList(QPtrList<Incidence>) ; | 484 | void beamIncidenceList(QPtrList<Incidence>) ; |
484 | void manageCategories(); | 485 | void manageCategories(); |
485 | int addCategories(); | 486 | int addCategories(); |
486 | void removeCategories(); | 487 | void removeCategories(); |
487 | void setSyncDevice( QString ); | 488 | void setSyncDevice( QString ); |
488 | void setSyncName( QString ); | 489 | void setSyncName( QString ); |
489 | void showDay( QDate ); | 490 | void showDay( QDate ); |
490 | void undo_delete(); | 491 | void undo_delete(); |
491 | protected slots: | 492 | protected slots: |
492 | void resetFocus(); | 493 | void resetFocus(); |
493 | void slotViewerClosed(); | 494 | void slotViewerClosed(); |
494 | void timerAlarm(); | 495 | void timerAlarm(); |
495 | void suspendAlarm(); | 496 | void suspendAlarm(); |
496 | void beamDone( Ir *ir ); | 497 | void beamDone( Ir *ir ); |
497 | /** Select a view or adapt the current view to display the specified dates. */ | 498 | /** Select a view or adapt the current view to display the specified dates. */ |
498 | void showDates( const KCal::DateList & ); | 499 | void showDates( const KCal::DateList & ); |
499 | void selectWeekNum ( int ); | 500 | void selectWeekNum ( int ); |
500 | 501 | ||
501 | public: | 502 | public: |
502 | // show a standard warning | 503 | // show a standard warning |
503 | // returns KMsgBox::yesNoCancel() | 504 | // returns KMsgBox::yesNoCancel() |
504 | int msgCalModified(); | 505 | int msgCalModified(); |
505 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 506 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
506 | 507 | ||
507 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 508 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
508 | virtual void removeSyncInfo( QString syncProfile); | 509 | virtual void removeSyncInfo( QString syncProfile); |
509 | void setSyncManager(KSyncManager* manager); | 510 | void setSyncManager(KSyncManager* manager); |
510 | void setLoadedFileVersion(QDateTime); | 511 | void setLoadedFileVersion(QDateTime); |
511 | bool checkFileVersion(QString fn); | 512 | bool checkFileVersion(QString fn); |
512 | bool checkFileChanged(QString fn); | 513 | bool checkFileChanged(QString fn); |
513 | Event* getLastSyncEvent(); | 514 | Event* getLastSyncEvent(); |
514 | /** Adapt navigation units correpsonding to step size of navigation of the | 515 | /** Adapt navigation units correpsonding to step size of navigation of the |
515 | * current view. | 516 | * current view. |
516 | */ | 517 | */ |
517 | void adaptNavigationUnits(); | 518 | void adaptNavigationUnits(); |
518 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 519 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
519 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 520 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
520 | //Attendee* getYourAttendee(Event *event); | 521 | //Attendee* getYourAttendee(Event *event); |
521 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} | 522 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} |
522 | protected: | 523 | protected: |
523 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 524 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
524 | 525 | ||
525 | // returns KMsgBox::OKCandel() | 526 | // returns KMsgBox::OKCandel() |
526 | int msgItemDelete(const QString name); | 527 | int msgItemDelete(const QString name); |
527 | void showEventEditor(); | 528 | void showEventEditor(); |
528 | void showTodoEditor(); | 529 | void showTodoEditor(); |
529 | void writeLocale(); | 530 | void writeLocale(); |
530 | Todo *selectedTodo(); | 531 | Todo *selectedTodo(); |
531 | 532 | ||
532 | private: | 533 | private: |
533 | QDateTime mNextAlarmDateTime; | 534 | QDateTime mNextAlarmDateTime; |
534 | bool mViewerCallerIsSearchDialog; | 535 | bool mViewerCallerIsSearchDialog; |
535 | bool mBlockShowDates; | 536 | bool mBlockShowDates; |
536 | KSyncManager* mSyncManager; | 537 | KSyncManager* mSyncManager; |
537 | AlarmDialog * mAlarmDialog; | 538 | AlarmDialog * mAlarmDialog; |
538 | QString mAlarmNotification; | 539 | QString mAlarmNotification; |
539 | QString mSuspendAlarmNotification; | 540 | QString mSuspendAlarmNotification; |
540 | QTimer* mSuspendTimer; | 541 | QTimer* mSuspendTimer; |
541 | QTimer* mAlarmTimer; | 542 | QTimer* mAlarmTimer; |
542 | QTimer* mRecheckAlarmTimer; | 543 | QTimer* mRecheckAlarmTimer; |
543 | void computeAlarm( QString ); | 544 | void computeAlarm( QString ); |
544 | void startAlarm( QString, QString ); | 545 | void startAlarm( QString, QString ); |
545 | void setSyncEventsReadOnly(); | 546 | void setSyncEventsReadOnly(); |
546 | 547 | ||
547 | QDateTime loadedFileVersion; | 548 | QDateTime loadedFileVersion; |
548 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); | 549 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); |
549 | void checkExternalId( Incidence * inc ); | 550 | void checkExternalId( Incidence * inc ); |
550 | int mGlobalSyncMode; | 551 | int mGlobalSyncMode; |
551 | QString mCurrentSyncDevice; | 552 | QString mCurrentSyncDevice; |
552 | QString mCurrentSyncName; | 553 | QString mCurrentSyncName; |
553 | KOBeamPrefs* beamDialog; | 554 | KOBeamPrefs* beamDialog; |
554 | void init(); | 555 | void init(); |
555 | int mDatePickerMode; | 556 | int mDatePickerMode; |
556 | bool mFlagEditDescription; | 557 | bool mFlagEditDescription; |
557 | QDateTime mLastCalendarSync; | 558 | QDateTime mLastCalendarSync; |
558 | void createPrinter(); | 559 | void createPrinter(); |
559 | 560 | ||
560 | void calendarModified( bool, Calendar * ); | 561 | void calendarModified( bool, Calendar * ); |
561 | 562 | ||
562 | CalPrinter *mCalPrinter; | 563 | CalPrinter *mCalPrinter; |
563 | 564 | ||
564 | QSplitter *mPanner; | 565 | QSplitter *mPanner; |
565 | QSplitter *mLeftSplitter; | 566 | QSplitter *mLeftSplitter; |
566 | KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; | 567 | KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; |
567 | QWidgetStack *mRightFrame; | 568 | QWidgetStack *mRightFrame; |
568 | 569 | ||
569 | KDatePicker* mDatePicker; | 570 | KDatePicker* mDatePicker; |
570 | QVBox* mDateFrame; | 571 | QVBox* mDateFrame; |
571 | 572 | ||
572 | DateNavigatorContainer *mDateNavigator; // widget showing small month view. | 573 | DateNavigatorContainer *mDateNavigator; // widget showing small month view. |
573 | 574 | ||
574 | KOFilterView *mFilterView; | 575 | KOFilterView *mFilterView; |
575 | KOCalEditView *mCalEditView; | 576 | KOCalEditView *mCalEditView; |
576 | 577 | ||
577 | ResourceView *mResourceView; | 578 | ResourceView *mResourceView; |
578 | 579 | ||
579 | // calendar object for this viewing instance | 580 | // calendar object for this viewing instance |
580 | Calendar *mCalendar; | 581 | Calendar *mCalendar; |
581 | 582 | ||
582 | CalendarResourceManager *mResourceManager; | 583 | CalendarResourceManager *mResourceManager; |
583 | 584 | ||
584 | FileStorage *mStorage; | 585 | FileStorage *mStorage; |
585 | 586 | ||
586 | DateNavigator *mNavigator; | 587 | DateNavigator *mNavigator; |
587 | 588 | ||
588 | KOViewManager *mViewManager; | 589 | KOViewManager *mViewManager; |
589 | KODialogManager *mDialogManager; | 590 | KODialogManager *mDialogManager; |
590 | 591 | ||
591 | // Calendar filters | 592 | // Calendar filters |
592 | QPtrList<CalFilter> mFilters; | 593 | QPtrList<CalFilter> mFilters; |
593 | 594 | ||
594 | // various housekeeping variables. | 595 | // various housekeeping variables. |
595 | bool mModified; // flag indicating if calendar is modified | 596 | bool mModified; // flag indicating if calendar is modified |
596 | bool mReadOnly; // flag indicating if calendar is read-only | 597 | bool mReadOnly; // flag indicating if calendar is read-only |
597 | QDate mSaveSingleDate; | 598 | QDate mSaveSingleDate; |
598 | 599 | ||
599 | Incidence *mSelectedIncidence; | 600 | Incidence *mSelectedIncidence; |
600 | Incidence *mMoveIncidence; | 601 | Incidence *mMoveIncidence; |
601 | QDate mMoveIncidenceOldDate; | 602 | QDate mMoveIncidenceOldDate; |
602 | KOTodoView *mTodoList; | 603 | KOTodoView *mTodoList; |
603 | KOEventEditor * mEventEditor; | 604 | KOEventEditor * mEventEditor; |
604 | KOTodoEditor * mTodoEditor; | 605 | KOTodoEditor * mTodoEditor; |
605 | KOEventViewerDialog * mEventViewerDialog; | 606 | KOEventViewerDialog * mEventViewerDialog; |
606 | void keyPressEvent ( QKeyEvent *e) ; | 607 | void keyPressEvent ( QKeyEvent *e) ; |
607 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; | 608 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; |
608 | }; | 609 | }; |
609 | 610 | ||
610 | 611 | ||
611 | class CalendarViewVisitor : public Incidence::Visitor | 612 | class CalendarViewVisitor : public Incidence::Visitor |
612 | { | 613 | { |
613 | public: | 614 | public: |
614 | CalendarViewVisitor() : mView( 0 ) {} | 615 | CalendarViewVisitor() : mView( 0 ) {} |
615 | 616 | ||
616 | bool act( Incidence *incidence, CalendarView *view ) | 617 | bool act( Incidence *incidence, CalendarView *view ) |
617 | { | 618 | { |
618 | mView = view; | 619 | mView = view; |
619 | return incidence->accept( *this ); | 620 | return incidence->accept( *this ); |
620 | } | 621 | } |
621 | 622 | ||
622 | protected: | 623 | protected: |
623 | CalendarView *mView; | 624 | CalendarView *mView; |
624 | }; | 625 | }; |
625 | 626 | ||
626 | class ShowIncidenceVisitor : public CalendarViewVisitor | 627 | class ShowIncidenceVisitor : public CalendarViewVisitor |
627 | { | 628 | { |
628 | protected: | 629 | protected: |
629 | bool visit( Event *event ) { mView->showEvent( event ); return true; } | 630 | bool visit( Event *event ) { mView->showEvent( event ); return true; } |
630 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } | 631 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } |
631 | bool visit( Journal * j ) { mView->showJournal( j );return true; } | 632 | bool visit( Journal * j ) { mView->showJournal( j );return true; } |
632 | }; | 633 | }; |
633 | 634 | ||
634 | class EditIncidenceVisitor : public CalendarViewVisitor | 635 | class EditIncidenceVisitor : public CalendarViewVisitor |
635 | { | 636 | { |
636 | protected: | 637 | protected: |
637 | bool visit( Event *event ) { mView->editEvent( event ); return true; } | 638 | bool visit( Event *event ) { mView->editEvent( event ); return true; } |
638 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } | 639 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } |
639 | bool visit( Journal *j ) { mView->editJournal( j); return true; } | 640 | bool visit( Journal *j ) { mView->editJournal( j); return true; } |
640 | }; | 641 | }; |
641 | 642 | ||
642 | class DeleteIncidenceVisitor : public CalendarViewVisitor | 643 | class DeleteIncidenceVisitor : public CalendarViewVisitor |
643 | { | 644 | { |
644 | protected: | 645 | protected: |
645 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } | 646 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } |
646 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } | 647 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } |
647 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } | 648 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } |
648 | }; | 649 | }; |
649 | 650 | ||
650 | #endif | 651 | #endif |
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 5a3c4d2..c7bc6eb 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -1,824 +1,824 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <qlabel.h> | 20 | #include <qlabel.h> |
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | #include <qhbox.h> | 22 | #include <qhbox.h> |
23 | #include <qvbox.h> | 23 | #include <qvbox.h> |
24 | #include <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qwhatsthis.h> | 25 | #include <qwhatsthis.h> |
26 | #include <qdragobject.h> | 26 | #include <qdragobject.h> |
27 | #include <qdrawutil.h> | 27 | #include <qdrawutil.h> |
28 | #include <qpainter.h> | 28 | #include <qpainter.h> |
29 | 29 | ||
30 | #include <kiconloader.h> | 30 | #include <kiconloader.h> |
31 | #include <kdebug.h> | 31 | #include <kdebug.h> |
32 | #include <kglobal.h> | 32 | #include <kglobal.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #ifndef DESKTOP_VERSION | 34 | #ifndef DESKTOP_VERSION |
35 | #include <qpe/qpeapplication.h> | 35 | #include <qpe/qpeapplication.h> |
36 | #define AGENDA_ICON_SIZE 5 | 36 | #define AGENDA_ICON_SIZE 5 |
37 | #else | 37 | #else |
38 | #include <qapplication.h> | 38 | #include <qapplication.h> |
39 | #define AGENDA_ICON_SIZE 7 | 39 | #define AGENDA_ICON_SIZE 7 |
40 | #endif | 40 | #endif |
41 | #include <libkcal/icaldrag.h> | 41 | #include <libkcal/icaldrag.h> |
42 | #include <libkcal/vcaldrag.h> | 42 | #include <libkcal/vcaldrag.h> |
43 | #include <libkcal/kincidenceformatter.h> | 43 | #include <libkcal/kincidenceformatter.h> |
44 | extern int globalFlagBlockAgenda; | 44 | extern int globalFlagBlockAgenda; |
45 | extern int globalFlagBlockAgendaItemPaint; | 45 | extern int globalFlagBlockAgendaItemPaint; |
46 | extern int globalFlagBlockAgendaItemUpdate; | 46 | extern int globalFlagBlockAgendaItemUpdate; |
47 | 47 | ||
48 | #include "koprefs.h" | 48 | #include "koprefs.h" |
49 | 49 | ||
50 | #include "koagendaitem.h" | 50 | #include "koagendaitem.h" |
51 | //#include "koagendaitem.moc" | 51 | //#include "koagendaitem.moc" |
52 | 52 | ||
53 | 53 | ||
54 | //-------------------------------------------------------------------------- | 54 | //-------------------------------------------------------------------------- |
55 | 55 | ||
56 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; | 56 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; |
57 | 57 | ||
58 | //-------------------------------------------------------------------------- | 58 | //-------------------------------------------------------------------------- |
59 | 59 | ||
60 | class KOAgendaItemWhatsThis :public QWhatsThis | 60 | class KOAgendaItemWhatsThis :public QWhatsThis |
61 | { | 61 | { |
62 | public: | 62 | public: |
63 | KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; | 63 | KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; |
64 | 64 | ||
65 | protected: | 65 | protected: |
66 | virtual QString text( const QPoint& ) | 66 | virtual QString text( const QPoint& ) |
67 | { | 67 | { |
68 | return _view->getWhatsThisText() ; | 68 | return _view->getWhatsThisText() ; |
69 | } | 69 | } |
70 | private: | 70 | private: |
71 | KOAgendaItem * _view; | 71 | KOAgendaItem * _view; |
72 | }; | 72 | }; |
73 | 73 | ||
74 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, | 74 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, |
75 | const char *name,WFlags) : | 75 | const char *name,WFlags) : |
76 | QWidget(parent, name), mIncidence(incidence), mDate(qd) | 76 | QWidget(parent, name), mIncidence(incidence), mDate(qd) |
77 | { | 77 | { |
78 | #ifndef DESKTOP_VERSION | 78 | #ifndef DESKTOP_VERSION |
79 | //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | 79 | //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
80 | #endif | 80 | #endif |
81 | mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this); | 81 | mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this); |
82 | int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase | 82 | int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase |
83 | setWFlags ( wflags); | 83 | setWFlags ( wflags); |
84 | mAllDay = allday; | 84 | mAllDay = allday; |
85 | init ( incidence, qd ); | 85 | init ( incidence, qd ); |
86 | //setMouseTracking(true); | 86 | //setMouseTracking(true); |
87 | //setAcceptDrops(true); | 87 | //setAcceptDrops(true); |
88 | xPaintCoord = -1; | 88 | xPaintCoord = -1; |
89 | yPaintCoord = -1; | 89 | yPaintCoord = -1; |
90 | } | 90 | } |
91 | QString KOAgendaItem::getWhatsThisText() | 91 | QString KOAgendaItem::getWhatsThisText() |
92 | { | 92 | { |
93 | if ( mIncidence ) | 93 | if ( mIncidence ) |
94 | return KIncidenceFormatter::instance()->getFormattedText( mIncidence, | 94 | return KIncidenceFormatter::instance()->getFormattedText( mIncidence, |
95 | KOPrefs::instance()->mWTshowDetails, | 95 | KOPrefs::instance()->mWTshowDetails, |
96 | KOPrefs::instance()->mWTshowCreated, | 96 | KOPrefs::instance()->mWTshowCreated, |
97 | KOPrefs::instance()->mWTshowChanged); | 97 | KOPrefs::instance()->mWTshowChanged); |
98 | return "KOAgendaItem::getWhatsThisText()::internal error"; | 98 | return "KOAgendaItem::getWhatsThisText()::internal error"; |
99 | } | 99 | } |
100 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) | 100 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) |
101 | { | 101 | { |
102 | mIncidence = incidence; | 102 | mIncidence = incidence; |
103 | mDate = qd; | 103 | mDate = qd; |
104 | mFirstMultiItem = 0; | 104 | mFirstMultiItem = 0; |
105 | mNextMultiItem = 0; | 105 | mNextMultiItem = 0; |
106 | mLastMultiItem = 0; | 106 | mLastMultiItem = 0; |
107 | computeText(); | 107 | computeText(); |
108 | 108 | ||
109 | if ( (incidence->typeID() == todoID ) && | 109 | if ( (incidence->typeID() == todoID ) && |
110 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && | 110 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && |
111 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { | 111 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { |
112 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) | 112 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) |
113 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; | 113 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; |
114 | else | 114 | else |
115 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; | 115 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; |
116 | } | 116 | } |
117 | else { | 117 | else { |
118 | QStringList categories = mIncidence->categories(); | 118 | QStringList categories = mIncidence->categories(); |
119 | QString cat = categories.first(); | 119 | QString cat = categories.first(); |
120 | if (cat.isEmpty()) { | 120 | if (cat.isEmpty()) { |
121 | if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) | 121 | if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) |
122 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; | 122 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; |
123 | else | 123 | else |
124 | mBackgroundColor =KOPrefs::instance()->mEventColor; | 124 | mBackgroundColor =KOPrefs::instance()->defaultColor( incidence->calID() ); |
125 | } else { | 125 | } else { |
126 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); | 126 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); |
127 | if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) { | 127 | if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) { |
128 | if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) | 128 | if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) |
129 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; | 129 | mBackgroundColor = KOPrefs::instance()->mTodoDoneColor; |
130 | } | 130 | } |
131 | } | 131 | } |
132 | 132 | ||
133 | } | 133 | } |
134 | mColorGroup = QColorGroup( mBackgroundColor.light(), | 134 | mColorGroup = QColorGroup( mBackgroundColor.light(), |
135 | mBackgroundColor.dark(),mBackgroundColor.light(), | 135 | mBackgroundColor.dark(),mBackgroundColor.light(), |
136 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; | 136 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; |
137 | setBackgroundColor( mBackgroundColor ); | 137 | setBackgroundColor( mBackgroundColor ); |
138 | 138 | ||
139 | mConflictItems.clear(); | 139 | mConflictItems.clear(); |
140 | setCellXY(0,0,1); | 140 | setCellXY(0,0,1); |
141 | setCellXWidth(0); | 141 | setCellXWidth(0); |
142 | setSubCell(0); | 142 | setSubCell(0); |
143 | setSubCells(1); | 143 | setSubCells(1); |
144 | setMultiItem(0,0,0); | 144 | setMultiItem(0,0,0); |
145 | startMove(); | 145 | startMove(); |
146 | mSelected = true; | 146 | mSelected = true; |
147 | select(false); | 147 | select(false); |
148 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); | 148 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); |
149 | mFontPixelSize = fontinf.height();; | 149 | mFontPixelSize = fontinf.height();; |
150 | hide(); | 150 | hide(); |
151 | xPaintCoord = -1; | 151 | xPaintCoord = -1; |
152 | yPaintCoord = -1; | 152 | yPaintCoord = -1; |
153 | } | 153 | } |
154 | 154 | ||
155 | 155 | ||
156 | KOAgendaItem::~KOAgendaItem() | 156 | KOAgendaItem::~KOAgendaItem() |
157 | { | 157 | { |
158 | #if QT_VERSION >= 0x030000 | 158 | #if QT_VERSION >= 0x030000 |
159 | 159 | ||
160 | #else | 160 | #else |
161 | delete mKOAgendaItemWhatsThis; | 161 | delete mKOAgendaItemWhatsThis; |
162 | #endif | 162 | #endif |
163 | 163 | ||
164 | } | 164 | } |
165 | 165 | ||
166 | void KOAgendaItem::recreateIncidence() | 166 | void KOAgendaItem::recreateIncidence() |
167 | { | 167 | { |
168 | #if 0 | 168 | #if 0 |
169 | Incidence* newInc = mIncidence->clone(); | 169 | Incidence* newInc = mIncidence->clone(); |
170 | newInc->recreate(); | 170 | newInc->recreate(); |
171 | if ( mIncidence->doesRecur() ) { | 171 | if ( mIncidence->doesRecur() ) { |
172 | mIncidence->addExDate( mDate ); | 172 | mIncidence->addExDate( mDate ); |
173 | newInc->recurrence()->unsetRecurs(); | 173 | newInc->recurrence()->unsetRecurs(); |
174 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); | 174 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); |
175 | QTime tim = mIncidence->dtStart().time(); | 175 | QTime tim = mIncidence->dtStart().time(); |
176 | newInc->setDtStart( QDateTime(mDate, tim) ); | 176 | newInc->setDtStart( QDateTime(mDate, tim) ); |
177 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 177 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); |
178 | } | 178 | } |
179 | #endif | 179 | #endif |
180 | mIncidence = mIncidence->recreateCloneException( mDate ); | 180 | mIncidence = mIncidence->recreateCloneException( mDate ); |
181 | } | 181 | } |
182 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) | 182 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) |
183 | { | 183 | { |
184 | int size = AGENDA_ICON_SIZE; | 184 | int size = AGENDA_ICON_SIZE; |
185 | 185 | ||
186 | int yOff = 0; | 186 | int yOff = 0; |
187 | int xOff = 0; | 187 | int xOff = 0; |
188 | int x = pos().x() +3; | 188 | int x = pos().x() +3; |
189 | int y; | 189 | int y; |
190 | if ( mAllDay ) | 190 | if ( mAllDay ) |
191 | y = pos().y()+3; | 191 | y = pos().y()+3; |
192 | else | 192 | else |
193 | y = mCellYTop * ( height() / cellHeight() ) +3; | 193 | y = mCellYTop * ( height() / cellHeight() ) +3; |
194 | if (mIncidence->cancelled()) { | 194 | if (mIncidence->cancelled()) { |
195 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; | 195 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; |
196 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; | 196 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; |
197 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); | 197 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); |
198 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); | 198 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); |
199 | if ( horLayout ) | 199 | if ( horLayout ) |
200 | ++xOff; | 200 | ++xOff; |
201 | else | 201 | else |
202 | ++yOff; | 202 | ++yOff; |
203 | } | 203 | } |
204 | if (mIncidence->isAlarmEnabled()) { | 204 | if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) { |
205 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); | 205 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); |
206 | if ( horLayout ) | 206 | if ( horLayout ) |
207 | ++xOff; | 207 | ++xOff; |
208 | else | 208 | else |
209 | ++yOff; | 209 | ++yOff; |
210 | } | 210 | } |
211 | if (mIncidence->recurrence()->doesRecur()) { | 211 | if (mIncidence->recurrence()->doesRecur()) { |
212 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); | 212 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); |
213 | if ( horLayout ) | 213 | if ( horLayout ) |
214 | ++xOff; | 214 | ++xOff; |
215 | else | 215 | else |
216 | ++yOff; | 216 | ++yOff; |
217 | } | 217 | } |
218 | if (mIncidence->description().length() > 0) { | 218 | if (mIncidence->description().length() > 0) { |
219 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); | 219 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); |
220 | if ( horLayout ) | 220 | if ( horLayout ) |
221 | ++xOff; | 221 | ++xOff; |
222 | else | 222 | else |
223 | ++yOff; | 223 | ++yOff; |
224 | } | 224 | } |
225 | if (mIncidence->isReadOnly()) { | 225 | if (mIncidence->isReadOnly()) { |
226 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); | 226 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); |
227 | if ( horLayout ) | 227 | if ( horLayout ) |
228 | ++xOff; | 228 | ++xOff; |
229 | else | 229 | else |
230 | ++yOff; | 230 | ++yOff; |
231 | } | 231 | } |
232 | 232 | ||
233 | if (mIncidence->attendeeCount()>0) { | 233 | if (mIncidence->attendeeCount()>0) { |
234 | 234 | ||
235 | if (mIncidence->organizer() == KOPrefs::instance()->email()) { | 235 | if (mIncidence->organizer() == KOPrefs::instance()->email()) { |
236 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); | 236 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); |
237 | if ( horLayout ) | 237 | if ( horLayout ) |
238 | ++xOff; | 238 | ++xOff; |
239 | else | 239 | else |
240 | ++yOff; | 240 | ++yOff; |
241 | } else { | 241 | } else { |
242 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 242 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
243 | if (me!=0) { | 243 | if (me!=0) { |
244 | 244 | ||
245 | 245 | ||
246 | } else { | 246 | } else { |
247 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); | 247 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); |
248 | if ( horLayout ) | 248 | if ( horLayout ) |
249 | ++xOff; | 249 | ++xOff; |
250 | else | 250 | else |
251 | ++yOff; | 251 | ++yOff; |
252 | 252 | ||
253 | } | 253 | } |
254 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); | 254 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); |
255 | if ( horLayout ) | 255 | if ( horLayout ) |
256 | ++xOff; | 256 | ++xOff; |
257 | else | 257 | else |
258 | ++yOff; | 258 | ++yOff; |
259 | 259 | ||
260 | } | 260 | } |
261 | 261 | ||
262 | } | 262 | } |
263 | return ( yOff || xOff ); | 263 | return ( yOff || xOff ); |
264 | } | 264 | } |
265 | 265 | ||
266 | 266 | ||
267 | void KOAgendaItem::select(bool selected) | 267 | void KOAgendaItem::select(bool selected) |
268 | { | 268 | { |
269 | //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); | 269 | //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); |
270 | if (mSelected == selected) return; | 270 | if (mSelected == selected) return; |
271 | mSelected = selected; | 271 | mSelected = selected; |
272 | if ( ! isVisible() ) | 272 | if ( ! isVisible() ) |
273 | return; | 273 | return; |
274 | if ( firstMultiItem() ) | 274 | if ( firstMultiItem() ) |
275 | firstMultiItem()->select( selected ); | 275 | firstMultiItem()->select( selected ); |
276 | if ( !firstMultiItem() && nextMultiItem() ) { | 276 | if ( !firstMultiItem() && nextMultiItem() ) { |
277 | KOAgendaItem * placeItem = nextMultiItem(); | 277 | KOAgendaItem * placeItem = nextMultiItem(); |
278 | while ( placeItem ) { | 278 | while ( placeItem ) { |
279 | placeItem->select( selected ); | 279 | placeItem->select( selected ); |
280 | placeItem = placeItem->nextMultiItem(); | 280 | placeItem = placeItem->nextMultiItem(); |
281 | } | 281 | } |
282 | } | 282 | } |
283 | globalFlagBlockAgendaItemUpdate = 0; | 283 | globalFlagBlockAgendaItemUpdate = 0; |
284 | paintMe( selected ); | 284 | paintMe( selected ); |
285 | globalFlagBlockAgendaItemUpdate = 1; | 285 | globalFlagBlockAgendaItemUpdate = 1; |
286 | repaint( false ); | 286 | repaint( false ); |
287 | } | 287 | } |
288 | 288 | ||
289 | 289 | ||
290 | /* | 290 | /* |
291 | The eventFilter has to filter the mouse events of the agenda item childs. The | 291 | The eventFilter has to filter the mouse events of the agenda item childs. The |
292 | events are fed into the event handling method of KOAgendaItem. This allows the | 292 | events are fed into the event handling method of KOAgendaItem. This allows the |
293 | KOAgenda to handle the KOAgendaItems by using an eventFilter. | 293 | KOAgenda to handle the KOAgendaItems by using an eventFilter. |
294 | */ | 294 | */ |
295 | bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) | 295 | bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) |
296 | { | 296 | { |
297 | if (e->type() == QEvent::MouseButtonPress || | 297 | if (e->type() == QEvent::MouseButtonPress || |
298 | e->type() == QEvent::MouseButtonDblClick || | 298 | e->type() == QEvent::MouseButtonDblClick || |
299 | e->type() == QEvent::MouseButtonRelease || | 299 | e->type() == QEvent::MouseButtonRelease || |
300 | e->type() == QEvent::MouseMove) { | 300 | e->type() == QEvent::MouseMove) { |
301 | QMouseEvent *me = (QMouseEvent *)e; | 301 | QMouseEvent *me = (QMouseEvent *)e; |
302 | QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> | 302 | QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> |
303 | mapToGlobal(me->pos())); | 303 | mapToGlobal(me->pos())); |
304 | QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); | 304 | QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); |
305 | return event(&returnEvent); | 305 | return event(&returnEvent); |
306 | } else { | 306 | } else { |
307 | return false; | 307 | return false; |
308 | } | 308 | } |
309 | } | 309 | } |
310 | void KOAgendaItem::repaintMe( ) | 310 | void KOAgendaItem::repaintMe( ) |
311 | { | 311 | { |
312 | paintMe ( mSelected ); | 312 | paintMe ( mSelected ); |
313 | } | 313 | } |
314 | void KOAgendaItem::paintMe( bool selected, QPainter* paint ) | 314 | void KOAgendaItem::paintMe( bool selected, QPainter* paint ) |
315 | { | 315 | { |
316 | if ( globalFlagBlockAgendaItemUpdate && ! selected) | 316 | if ( globalFlagBlockAgendaItemUpdate && ! selected) |
317 | return; | 317 | return; |
318 | QPainter pa; | 318 | QPainter pa; |
319 | 319 | ||
320 | if ( mSelected ) { | 320 | if ( mSelected ) { |
321 | pa.begin( paintPixSel() ); | 321 | pa.begin( paintPixSel() ); |
322 | } else { | 322 | } else { |
323 | if ( mAllDay ) | 323 | if ( mAllDay ) |
324 | pa.begin( paintPixAllday() ); | 324 | pa.begin( paintPixAllday() ); |
325 | else | 325 | else |
326 | pa.begin( paintPix() ); | 326 | pa.begin( paintPix() ); |
327 | } | 327 | } |
328 | int x, yy, w, h; | 328 | int x, yy, w, h; |
329 | float nfh = 7.0; | 329 | float nfh = 7.0; |
330 | x = pos().x(); w = width(); h = height (); | 330 | x = pos().x(); w = width(); h = height (); |
331 | if ( mAllDay ) | 331 | if ( mAllDay ) |
332 | yy = y(); | 332 | yy = y(); |
333 | else | 333 | else |
334 | yy = mCellYTop * ( height() / cellHeight() ); | 334 | yy = mCellYTop * ( height() / cellHeight() ); |
335 | xPaintCoord= x; | 335 | xPaintCoord= x; |
336 | yPaintCoord = yy; | 336 | yPaintCoord = yy; |
337 | wPaintCoord = width(); | 337 | wPaintCoord = width(); |
338 | hPaintCoord = height(); | 338 | hPaintCoord = height(); |
339 | //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); | 339 | //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); |
340 | if ( paint == 0 ) | 340 | if ( paint == 0 ) |
341 | paint = &pa; | 341 | paint = &pa; |
342 | bool horLayout = ( w < h ); | 342 | bool horLayout = ( w < h ); |
343 | int maxhei = mFontPixelSize+4; | 343 | int maxhei = mFontPixelSize+4; |
344 | if ( horLayout ) | 344 | if ( horLayout ) |
345 | maxhei += AGENDA_ICON_SIZE -4; | 345 | maxhei += AGENDA_ICON_SIZE -4; |
346 | bool small = ( h < maxhei ); | 346 | bool small = ( h < maxhei ); |
347 | if ( ! small ) | 347 | if ( ! small ) |
348 | paint->setFont(KOPrefs::instance()->mAgendaViewFont); | 348 | paint->setFont(KOPrefs::instance()->mAgendaViewFont); |
349 | else { | 349 | else { |
350 | QFont f = KOPrefs::instance()->mAgendaViewFont; | 350 | QFont f = KOPrefs::instance()->mAgendaViewFont; |
351 | f.setBold( false ); | 351 | f.setBold( false ); |
352 | int fh = f.pointSize(); | 352 | int fh = f.pointSize(); |
353 | nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; | 353 | nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; |
354 | if ( nfh < 6 ) | 354 | if ( nfh < 6 ) |
355 | nfh = 6; | 355 | nfh = 6; |
356 | f.setPointSize( nfh ); | 356 | f.setPointSize( nfh ); |
357 | paint->setFont(f); | 357 | paint->setFont(f); |
358 | } | 358 | } |
359 | paint->fillRect ( x, yy, w, h, mBackgroundColor ); | 359 | paint->fillRect ( x, yy, w, h, mBackgroundColor ); |
360 | static const QPixmap completedPxmp = SmallIcon("greenhook16"); | 360 | static const QPixmap completedPxmp = SmallIcon("greenhook16"); |
361 | static const QPixmap overduePxmp = SmallIcon("redcross16"); | 361 | static const QPixmap overduePxmp = SmallIcon("redcross16"); |
362 | if ( mIncidence->typeID() == todoID ) { | 362 | if ( mIncidence->typeID() == todoID ) { |
363 | Todo* tempTodo = static_cast<Todo*>(mIncidence); | 363 | Todo* tempTodo = static_cast<Todo*>(mIncidence); |
364 | int xx = pos().x()+(width()-completedPxmp.width()-3 ); | 364 | int xx = pos().x()+(width()-completedPxmp.width()-3 ); |
365 | int yyy = yy+3; | 365 | int yyy = yy+3; |
366 | if ( tempTodo->isCompleted() ) | 366 | if ( tempTodo->isCompleted() ) |
367 | paint->drawPixmap ( xx, yyy, completedPxmp ); | 367 | paint->drawPixmap ( xx, yyy, completedPxmp ); |
368 | else { | 368 | else { |
369 | paint->drawPixmap ( xx, yyy, overduePxmp ); | 369 | paint->drawPixmap ( xx, yyy, overduePxmp ); |
370 | 370 | ||
371 | } | 371 | } |
372 | } | 372 | } |
373 | bool addIcon = false; | 373 | bool addIcon = false; |
374 | if ( ! small || w > 3 * h || h > 3* w ) | 374 | if ( ! small || w > 3 * h || h > 3* w ) |
375 | addIcon = updateIcons( paint, horLayout ); | 375 | addIcon = updateIcons( paint, horLayout ); |
376 | 376 | ||
377 | qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); | 377 | qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); |
378 | //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); | 378 | //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); |
379 | if ( ! small ) { | 379 | if ( ! small ) { |
380 | x += 3; yy += 3;w -= 6; h-= 5; | 380 | x += 3; yy += 3;w -= 6; h-= 5; |
381 | } else { | 381 | } else { |
382 | x += 2; yy += 1;w -= 4; h-= 4; | 382 | x += 2; yy += 1;w -= 4; h-= 4; |
383 | if ( nfh < 6.01 ) { | 383 | if ( nfh < 6.01 ) { |
384 | yy -= 2; | 384 | yy -= 2; |
385 | h += 4; | 385 | h += 4; |
386 | } | 386 | } |
387 | else | 387 | else |
388 | if ( nfh < h -2 ) | 388 | if ( nfh < h -2 ) |
389 | ++yy; | 389 | ++yy; |
390 | } | 390 | } |
391 | int align; | 391 | int align; |
392 | #ifndef DESKTOP_VERSION | 392 | #ifndef DESKTOP_VERSION |
393 | align = ( AlignLeft|WordBreak|AlignTop); | 393 | align = ( AlignLeft|WordBreak|AlignTop); |
394 | #else | 394 | #else |
395 | align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 395 | align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
396 | #endif | 396 | #endif |
397 | if ( addIcon ) { | 397 | if ( addIcon ) { |
398 | if ( ! horLayout ) { | 398 | if ( ! horLayout ) { |
399 | x += AGENDA_ICON_SIZE+3; | 399 | x += AGENDA_ICON_SIZE+3; |
400 | w -= (AGENDA_ICON_SIZE+3); | 400 | w -= (AGENDA_ICON_SIZE+3); |
401 | } | 401 | } |
402 | else { | 402 | else { |
403 | yy+= AGENDA_ICON_SIZE+2; | 403 | yy+= AGENDA_ICON_SIZE+2; |
404 | h -=(AGENDA_ICON_SIZE+3); | 404 | h -=(AGENDA_ICON_SIZE+3); |
405 | } | 405 | } |
406 | } | 406 | } |
407 | int colsum = mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue(); | 407 | int colsum = mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue(); |
408 | if ( colsum < 250 ) | 408 | if ( colsum < 250 ) |
409 | paint->setPen ( white); | 409 | paint->setPen ( white); |
410 | if ( x < 0 ) { | 410 | if ( x < 0 ) { |
411 | w = w+x-3; | 411 | w = w+x-3; |
412 | x = 3; | 412 | x = 3; |
413 | if ( w > parentWidget()->width() ){ | 413 | if ( w > parentWidget()->width() ){ |
414 | w = parentWidget()->width() - 6; | 414 | w = parentWidget()->width() - 6; |
415 | #ifndef DESKTOP_VERSION | 415 | #ifndef DESKTOP_VERSION |
416 | align = ( AlignHCenter|WordBreak|AlignTop); | 416 | align = ( AlignHCenter|WordBreak|AlignTop); |
417 | #else | 417 | #else |
418 | align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop); | 418 | align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop); |
419 | #endif | 419 | #endif |
420 | 420 | ||
421 | } | 421 | } |
422 | } | 422 | } |
423 | QRect dr; | 423 | QRect dr; |
424 | if ( w + x > parentWidget()->width() ) | 424 | if ( w + x > parentWidget()->width() ) |
425 | w = parentWidget()->width()-x; | 425 | w = parentWidget()->width()-x; |
426 | paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); | 426 | paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); |
427 | //qDebug("%d %d %d %d ", x, yy, w, h ); | 427 | //qDebug("%d %d %d %d ", x, yy, w, h ); |
428 | if ( mIncidence->cancelled() ){ | 428 | if ( mIncidence->cancelled() ){ |
429 | 429 | ||
430 | 430 | ||
431 | small = ( height() < 20 ); | 431 | small = ( height() < 20 ); |
432 | 432 | ||
433 | if ( ! small ) { | 433 | if ( ! small ) { |
434 | QFontMetrics fm ( paint->font() ); | 434 | QFontMetrics fm ( paint->font() ); |
435 | paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); | 435 | paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); |
436 | } | 436 | } |
437 | 437 | ||
438 | } | 438 | } |
439 | pa.end(); | 439 | pa.end(); |
440 | 440 | ||
441 | } | 441 | } |
442 | void KOAgendaItem::resizePixmap( int w , int h ) | 442 | void KOAgendaItem::resizePixmap( int w , int h ) |
443 | { | 443 | { |
444 | paintPix()->resize( w, h ); | 444 | paintPix()->resize( w, h ); |
445 | paintPixSel()->resize( w, h ); | 445 | paintPixSel()->resize( w, h ); |
446 | 446 | ||
447 | } | 447 | } |
448 | QPixmap * KOAgendaItem::paintPix() | 448 | QPixmap * KOAgendaItem::paintPix() |
449 | { | 449 | { |
450 | static QPixmap* mPaintPix = 0; | 450 | static QPixmap* mPaintPix = 0; |
451 | if ( ! mPaintPix ) { | 451 | if ( ! mPaintPix ) { |
452 | int w = QApplication::desktop()->width(); | 452 | int w = QApplication::desktop()->width(); |
453 | int h = QApplication::desktop()->height(); | 453 | int h = QApplication::desktop()->height(); |
454 | mPaintPix = new QPixmap(w,h); | 454 | mPaintPix = new QPixmap(w,h); |
455 | } | 455 | } |
456 | return mPaintPix ; | 456 | return mPaintPix ; |
457 | } | 457 | } |
458 | QPixmap * KOAgendaItem::paintPixAllday() | 458 | QPixmap * KOAgendaItem::paintPixAllday() |
459 | { | 459 | { |
460 | static QPixmap* mPaintPixA = 0; | 460 | static QPixmap* mPaintPixA = 0; |
461 | if ( ! mPaintPixA ) { | 461 | if ( ! mPaintPixA ) { |
462 | int w = QApplication::desktop()->width(); | 462 | int w = QApplication::desktop()->width(); |
463 | int h = QApplication::desktop()->height()/3; | 463 | int h = QApplication::desktop()->height()/3; |
464 | mPaintPixA = new QPixmap(w,h); | 464 | mPaintPixA = new QPixmap(w,h); |
465 | } | 465 | } |
466 | return mPaintPixA ; | 466 | return mPaintPixA ; |
467 | } | 467 | } |
468 | QPixmap * KOAgendaItem::paintPixSel() | 468 | QPixmap * KOAgendaItem::paintPixSel() |
469 | { | 469 | { |
470 | static QPixmap* mPaintPixSel = 0; | 470 | static QPixmap* mPaintPixSel = 0; |
471 | if ( ! mPaintPixSel ) { | 471 | if ( ! mPaintPixSel ) { |
472 | int w = QApplication::desktop()->width(); | 472 | int w = QApplication::desktop()->width(); |
473 | int h = QApplication::desktop()->height(); | 473 | int h = QApplication::desktop()->height(); |
474 | mPaintPixSel = new QPixmap(w,h); | 474 | mPaintPixSel = new QPixmap(w,h); |
475 | } | 475 | } |
476 | return mPaintPixSel ; | 476 | return mPaintPixSel ; |
477 | } | 477 | } |
478 | void KOAgendaItem::paintEvent ( QPaintEvent *e ) | 478 | void KOAgendaItem::paintEvent ( QPaintEvent *e ) |
479 | { | 479 | { |
480 | 480 | ||
481 | if ( globalFlagBlockAgendaItemPaint ) | 481 | if ( globalFlagBlockAgendaItemPaint ) |
482 | return; | 482 | return; |
483 | if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) | 483 | if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) |
484 | return; | 484 | return; |
485 | int yy; | 485 | int yy; |
486 | if ( mAllDay ) | 486 | if ( mAllDay ) |
487 | yy = y(); | 487 | yy = y(); |
488 | else | 488 | else |
489 | yy = mCellYTop * ( height() / cellHeight() ); | 489 | yy = mCellYTop * ( height() / cellHeight() ); |
490 | int xx = x(); | 490 | int xx = x(); |
491 | 491 | ||
492 | if ( xPaintCoord != xx || yPaintCoord != yy || | 492 | if ( xPaintCoord != xx || yPaintCoord != yy || |
493 | wPaintCoord != width() || hPaintCoord != height()) { | 493 | wPaintCoord != width() || hPaintCoord != height()) { |
494 | xPaintCoord= xx; | 494 | xPaintCoord= xx; |
495 | yPaintCoord = yy; | 495 | yPaintCoord = yy; |
496 | wPaintCoord = width(); | 496 | wPaintCoord = width(); |
497 | hPaintCoord = height(); | 497 | hPaintCoord = height(); |
498 | globalFlagBlockAgendaItemUpdate = 0; | 498 | globalFlagBlockAgendaItemUpdate = 0; |
499 | paintMe( mSelected ); | 499 | paintMe( mSelected ); |
500 | //qDebug("calling paintMe "); | 500 | //qDebug("calling paintMe "); |
501 | globalFlagBlockAgendaItemUpdate = 1; | 501 | globalFlagBlockAgendaItemUpdate = 1; |
502 | } | 502 | } |
503 | int rx, ry, rw, rh; | 503 | int rx, ry, rw, rh; |
504 | rx = e->rect().x(); | 504 | rx = e->rect().x(); |
505 | ry = e->rect().y(); | 505 | ry = e->rect().y(); |
506 | rw = e->rect().width(); | 506 | rw = e->rect().width(); |
507 | rh = e->rect().height(); | 507 | rh = e->rect().height(); |
508 | //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); | 508 | //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); |
509 | 509 | ||
510 | QPixmap* paintFrom ; | 510 | QPixmap* paintFrom ; |
511 | if ( mSelected ) { | 511 | if ( mSelected ) { |
512 | paintFrom = paintPixSel(); | 512 | paintFrom = paintPixSel(); |
513 | } else { | 513 | } else { |
514 | if ( mAllDay ) | 514 | if ( mAllDay ) |
515 | paintFrom = paintPixAllday(); | 515 | paintFrom = paintPixAllday(); |
516 | else | 516 | else |
517 | paintFrom = paintPix(); | 517 | paintFrom = paintPix(); |
518 | } | 518 | } |
519 | xx += rx; | 519 | xx += rx; |
520 | 520 | ||
521 | if ( xx < 0 ) { | 521 | if ( xx < 0 ) { |
522 | rw = rw + xx; | 522 | rw = rw + xx; |
523 | rx -= xx; | 523 | rx -= xx; |
524 | xx = 0; | 524 | xx = 0; |
525 | if ( rw <= 1 ) { | 525 | if ( rw <= 1 ) { |
526 | //qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1()); | 526 | //qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1()); |
527 | return; | 527 | return; |
528 | } | 528 | } |
529 | } | 529 | } |
530 | if ( paintFrom->width() < xx+rw ) { | 530 | if ( paintFrom->width() < xx+rw ) { |
531 | rw = paintFrom->width() - xx; | 531 | rw = paintFrom->width() - xx; |
532 | if ( rw <= 1 ) { | 532 | if ( rw <= 1 ) { |
533 | //qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() ); | 533 | //qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() ); |
534 | return; | 534 | return; |
535 | } | 535 | } |
536 | } | 536 | } |
537 | //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh); | 537 | //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh); |
538 | bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP); | 538 | bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP); |
539 | } | 539 | } |
540 | void KOAgendaItem::computeText() | 540 | void KOAgendaItem::computeText() |
541 | { | 541 | { |
542 | mDisplayedText = mIncidence->summary(); | 542 | mDisplayedText = mIncidence->summary(); |
543 | if ( (mIncidence->typeID() == todoID ) ) { | 543 | if ( (mIncidence->typeID() == todoID ) ) { |
544 | if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { | 544 | if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { |
545 | if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) | 545 | if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) |
546 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; | 546 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; |
547 | else if ( !(mIncidence->doesFloat())) | 547 | else if ( !(mIncidence->doesFloat())) |
548 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; | 548 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; |
549 | } | 549 | } |
550 | } else { | 550 | } else { |
551 | if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) | 551 | if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) |
552 | mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + " - " + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; | 552 | mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + " - " + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; |
553 | 553 | ||
554 | if ( mAllDay ) { | 554 | if ( mAllDay ) { |
555 | if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { | 555 | if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { |
556 | if ( mIncidence->doesRecur() ) { | 556 | if ( mIncidence->doesRecur() ) { |
557 | mDisplayedText += " (" + mIncidence->recurrence()->recurrenceText() + ")"; | 557 | mDisplayedText += " (" + mIncidence->recurrence()->recurrenceText() + ")"; |
558 | } else { | 558 | } else { |
559 | mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; | 559 | mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; |
560 | } | 560 | } |
561 | } | 561 | } |
562 | } | 562 | } |
563 | } | 563 | } |
564 | 564 | ||
565 | if ( !mIncidence->location().isEmpty() ) { | 565 | if ( !mIncidence->location().isEmpty() ) { |
566 | if ( mAllDay ) | 566 | if ( mAllDay ) |
567 | mDisplayedText += " ("; | 567 | mDisplayedText += " ("; |
568 | else | 568 | else |
569 | mDisplayedText += "\n("; | 569 | mDisplayedText += "\n("; |
570 | mDisplayedText += mIncidence->location() +")"; | 570 | mDisplayedText += mIncidence->location() +")"; |
571 | } | 571 | } |
572 | #ifdef DESKTOP_VERSION | 572 | #ifdef DESKTOP_VERSION |
573 | QString tipText = mIncidence->summary(); | 573 | QString tipText = mIncidence->summary(); |
574 | if ( !mIncidence->doesFloat() ) { | 574 | if ( !mIncidence->doesFloat() ) { |
575 | if ( mIncidence->typeID() == eventID ) { | 575 | if ( mIncidence->typeID() == eventID ) { |
576 | if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { | 576 | if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { |
577 | tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); | 577 | tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); |
578 | tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); | 578 | tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); |
579 | } | 579 | } |
580 | else { | 580 | else { |
581 | tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); | 581 | tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); |
582 | tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); | 582 | tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); |
583 | } | 583 | } |
584 | } | 584 | } |
585 | else if ( mIncidence->typeID() == todoID ) { | 585 | else if ( mIncidence->typeID() == todoID ) { |
586 | if (mIncidence->hasStartDate()) | 586 | if (mIncidence->hasStartDate()) |
587 | tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr(); | 587 | tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr(); |
588 | if (((Todo*)mIncidence)->hasDueDate()) | 588 | if (((Todo*)mIncidence)->hasDueDate()) |
589 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr(); | 589 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr(); |
590 | } | 590 | } |
591 | } else if ( mIncidence->typeID() == todoID ) { | 591 | } else if ( mIncidence->typeID() == todoID ) { |
592 | if (mIncidence->hasStartDate()) | 592 | if (mIncidence->hasStartDate()) |
593 | tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr(); | 593 | tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr(); |
594 | if (((Todo*)mIncidence)->hasDueDate()) | 594 | if (((Todo*)mIncidence)->hasDueDate()) |
595 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr(); | 595 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr(); |
596 | } | 596 | } |
597 | 597 | ||
598 | if (!mIncidence->location().isEmpty()) { | 598 | if (!mIncidence->location().isEmpty()) { |
599 | tipText += "\n"+i18n("Location: ")+mIncidence->location(); | 599 | tipText += "\n"+i18n("Location: ")+mIncidence->location(); |
600 | } | 600 | } |
601 | QToolTip::add(this,tipText,toolTipGroup(),""); | 601 | QToolTip::add(this,tipText,toolTipGroup(),""); |
602 | #endif | 602 | #endif |
603 | } | 603 | } |
604 | void KOAgendaItem::updateItem() | 604 | void KOAgendaItem::updateItem() |
605 | { | 605 | { |
606 | computeText(); | 606 | computeText(); |
607 | 607 | ||
608 | //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); | 608 | //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); |
609 | paintMe( mSelected ); | 609 | paintMe( mSelected ); |
610 | repaint( false); | 610 | repaint( false); |
611 | } | 611 | } |
612 | 612 | ||
613 | void KOAgendaItem::resizeEvent ( QResizeEvent *ev ) | 613 | void KOAgendaItem::resizeEvent ( QResizeEvent *ev ) |
614 | { | 614 | { |
615 | //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1()); | 615 | //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1()); |
616 | paintMe( mSelected ); | 616 | paintMe( mSelected ); |
617 | repaint( false ); | 617 | repaint( false ); |
618 | } | 618 | } |
619 | 619 | ||
620 | /* | 620 | /* |
621 | Return height of item in units of agenda cells | 621 | Return height of item in units of agenda cells |
622 | */ | 622 | */ |
623 | int KOAgendaItem::cellHeight() | 623 | int KOAgendaItem::cellHeight() |
624 | { | 624 | { |
625 | int ret = mCellYBottom - mCellYTop + 1; | 625 | int ret = mCellYBottom - mCellYTop + 1; |
626 | if ( ret <= 0 ) { | 626 | if ( ret <= 0 ) { |
627 | ret = 1; | 627 | ret = 1; |
628 | mCellYBottom = 0; | 628 | mCellYBottom = 0; |
629 | mCellYTop = 0; | 629 | mCellYTop = 0; |
630 | } | 630 | } |
631 | return ret; | 631 | return ret; |
632 | } | 632 | } |
633 | 633 | ||
634 | /* | 634 | /* |
635 | Return height of item in units of agenda cells | 635 | Return height of item in units of agenda cells |
636 | */ | 636 | */ |
637 | int KOAgendaItem::cellWidth() | 637 | int KOAgendaItem::cellWidth() |
638 | { | 638 | { |
639 | return mCellXWidth - mCellX + 1; | 639 | return mCellXWidth - mCellX + 1; |
640 | } | 640 | } |
641 | 641 | ||
642 | void KOAgendaItem::setItemDate(QDate qd) | 642 | void KOAgendaItem::setItemDate(QDate qd) |
643 | { | 643 | { |
644 | mDate = qd; | 644 | mDate = qd; |
645 | } | 645 | } |
646 | 646 | ||
647 | void KOAgendaItem::setCellXY(int X, int YTop, int YBottom) | 647 | void KOAgendaItem::setCellXY(int X, int YTop, int YBottom) |
648 | { | 648 | { |
649 | mCellX = X; | 649 | mCellX = X; |
650 | mCellYTop = YTop; | 650 | mCellYTop = YTop; |
651 | mCellYBottom = YBottom; | 651 | mCellYBottom = YBottom; |
652 | } | 652 | } |
653 | 653 | ||
654 | void KOAgendaItem::setCellXWidth(int xwidth) | 654 | void KOAgendaItem::setCellXWidth(int xwidth) |
655 | { | 655 | { |
656 | mCellXWidth = xwidth; | 656 | mCellXWidth = xwidth; |
657 | } | 657 | } |
658 | 658 | ||
659 | void KOAgendaItem::setCellX(int XLeft, int XRight) | 659 | void KOAgendaItem::setCellX(int XLeft, int XRight) |
660 | { | 660 | { |
661 | mCellX = XLeft; | 661 | mCellX = XLeft; |
662 | mCellXWidth = XRight; | 662 | mCellXWidth = XRight; |
663 | } | 663 | } |
664 | 664 | ||
665 | void KOAgendaItem::setCellY(int YTop, int YBottom) | 665 | void KOAgendaItem::setCellY(int YTop, int YBottom) |
666 | { | 666 | { |
667 | mCellYTop = YTop; | 667 | mCellYTop = YTop; |
668 | mCellYBottom = YBottom; | 668 | mCellYBottom = YBottom; |
669 | } | 669 | } |
670 | 670 | ||
671 | void KOAgendaItem::setSubCell(int subCell) | 671 | void KOAgendaItem::setSubCell(int subCell) |
672 | { | 672 | { |
673 | mSubCell = subCell; | 673 | mSubCell = subCell; |
674 | } | 674 | } |
675 | 675 | ||
676 | void KOAgendaItem::setSubCells(int subCells) | 676 | void KOAgendaItem::setSubCells(int subCells) |
677 | { | 677 | { |
678 | mSubCells = subCells; | 678 | mSubCells = subCells; |
679 | } | 679 | } |
680 | 680 | ||
681 | void KOAgendaItem::setMultiItem(KOAgendaItem *first,KOAgendaItem *next, | 681 | void KOAgendaItem::setMultiItem(KOAgendaItem *first,KOAgendaItem *next, |
682 | KOAgendaItem *last) | 682 | KOAgendaItem *last) |
683 | { | 683 | { |
684 | mFirstMultiItem = first; | 684 | mFirstMultiItem = first; |
685 | mNextMultiItem = next; | 685 | mNextMultiItem = next; |
686 | mLastMultiItem = last; | 686 | mLastMultiItem = last; |
687 | } | 687 | } |
688 | 688 | ||
689 | void KOAgendaItem::startMove() | 689 | void KOAgendaItem::startMove() |
690 | { | 690 | { |
691 | mStartCellX = mCellX; | 691 | mStartCellX = mCellX; |
692 | mStartCellXWidth = mCellXWidth; | 692 | mStartCellXWidth = mCellXWidth; |
693 | mStartCellYTop = mCellYTop; | 693 | mStartCellYTop = mCellYTop; |
694 | mStartCellYBottom = mCellYBottom; | 694 | mStartCellYBottom = mCellYBottom; |
695 | } | 695 | } |
696 | 696 | ||
697 | void KOAgendaItem::resetMove() | 697 | void KOAgendaItem::resetMove() |
698 | { | 698 | { |
699 | mCellX = mStartCellX; | 699 | mCellX = mStartCellX; |
700 | mCellXWidth = mStartCellXWidth; | 700 | mCellXWidth = mStartCellXWidth; |
701 | mCellYTop = mStartCellYTop; | 701 | mCellYTop = mStartCellYTop; |
702 | mCellYBottom = mStartCellYBottom; | 702 | mCellYBottom = mStartCellYBottom; |
703 | } | 703 | } |
704 | 704 | ||
705 | void KOAgendaItem::moveRelative(int dx, int dy) | 705 | void KOAgendaItem::moveRelative(int dx, int dy) |
706 | { | 706 | { |
707 | int newX = cellX() + dx; | 707 | int newX = cellX() + dx; |
708 | int newXWidth = cellXWidth() + dx; | 708 | int newXWidth = cellXWidth() + dx; |
709 | int newYTop = cellYTop() + dy; | 709 | int newYTop = cellYTop() + dy; |
710 | int newYBottom = cellYBottom() + dy; | 710 | int newYBottom = cellYBottom() + dy; |
711 | setCellXY(newX,newYTop,newYBottom); | 711 | setCellXY(newX,newYTop,newYBottom); |
712 | setCellXWidth(newXWidth); | 712 | setCellXWidth(newXWidth); |
713 | } | 713 | } |
714 | 714 | ||
715 | void KOAgendaItem::expandTop(int dy) | 715 | void KOAgendaItem::expandTop(int dy) |
716 | { | 716 | { |
717 | int newYTop = cellYTop() + dy; | 717 | int newYTop = cellYTop() + dy; |
718 | int newYBottom = cellYBottom(); | 718 | int newYBottom = cellYBottom(); |
719 | if (newYTop > newYBottom) newYTop = newYBottom; | 719 | if (newYTop > newYBottom) newYTop = newYBottom; |
720 | setCellY(newYTop, newYBottom); | 720 | setCellY(newYTop, newYBottom); |
721 | } | 721 | } |
722 | 722 | ||
723 | void KOAgendaItem::expandBottom(int dy) | 723 | void KOAgendaItem::expandBottom(int dy) |
724 | { | 724 | { |
725 | int newYTop = cellYTop(); | 725 | int newYTop = cellYTop(); |
726 | int newYBottom = cellYBottom() + dy; | 726 | int newYBottom = cellYBottom() + dy; |
727 | if (newYBottom < newYTop) newYBottom = newYTop; | 727 | if (newYBottom < newYTop) newYBottom = newYTop; |
728 | setCellY(newYTop, newYBottom); | 728 | setCellY(newYTop, newYBottom); |
729 | } | 729 | } |
730 | 730 | ||
731 | void KOAgendaItem::expandLeft(int dx) | 731 | void KOAgendaItem::expandLeft(int dx) |
732 | { | 732 | { |
733 | int newX = cellX() + dx; | 733 | int newX = cellX() + dx; |
734 | int newXWidth = cellXWidth(); | 734 | int newXWidth = cellXWidth(); |
735 | if (newX > newXWidth) newX = newXWidth; | 735 | if (newX > newXWidth) newX = newXWidth; |
736 | setCellX(newX,newXWidth); | 736 | setCellX(newX,newXWidth); |
737 | } | 737 | } |
738 | 738 | ||
739 | void KOAgendaItem::expandRight(int dx) | 739 | void KOAgendaItem::expandRight(int dx) |
740 | { | 740 | { |
741 | int newX = cellX(); | 741 | int newX = cellX(); |
742 | int newXWidth = cellXWidth() + dx; | 742 | int newXWidth = cellXWidth() + dx; |
743 | if (newXWidth < newX) newXWidth = newX; | 743 | if (newXWidth < newX) newXWidth = newX; |
744 | setCellX(newX,newXWidth); | 744 | setCellX(newX,newXWidth); |
745 | } | 745 | } |
746 | 746 | ||
747 | QToolTipGroup *KOAgendaItem::toolTipGroup() | 747 | QToolTipGroup *KOAgendaItem::toolTipGroup() |
748 | { | 748 | { |
749 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 749 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
750 | return mToolTipGroup; | 750 | return mToolTipGroup; |
751 | } | 751 | } |
752 | 752 | ||
753 | void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e ) | 753 | void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e ) |
754 | { | 754 | { |
755 | #ifndef KORG_NODND | 755 | #ifndef KORG_NODND |
756 | if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) || | 756 | if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) || |
757 | !QTextDrag::canDecode( e ) ) { | 757 | !QTextDrag::canDecode( e ) ) { |
758 | e->ignore(); | 758 | e->ignore(); |
759 | return; | 759 | return; |
760 | } | 760 | } |
761 | e->accept(); | 761 | e->accept(); |
762 | #endif | 762 | #endif |
763 | } | 763 | } |
764 | 764 | ||
765 | void KOAgendaItem::dropEvent( QDropEvent *e ) | 765 | void KOAgendaItem::dropEvent( QDropEvent *e ) |
766 | { | 766 | { |
767 | #ifndef KORG_NODND | 767 | #ifndef KORG_NODND |
768 | QString text; | 768 | QString text; |
769 | if(QTextDrag::decode(e,text)) | 769 | if(QTextDrag::decode(e,text)) |
770 | { | 770 | { |
771 | kdDebug() << "Dropped : " << text << endl; | 771 | kdDebug() << "Dropped : " << text << endl; |
772 | QStringList emails = QStringList::split(",",text); | 772 | QStringList emails = QStringList::split(",",text); |
773 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { | 773 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { |
774 | kdDebug() << " Email: " << (*it) << endl; | 774 | kdDebug() << " Email: " << (*it) << endl; |
775 | int pos = (*it).find("<"); | 775 | int pos = (*it).find("<"); |
776 | QString name = (*it).left(pos); | 776 | QString name = (*it).left(pos); |
777 | QString email = (*it).mid(pos); | 777 | QString email = (*it).mid(pos); |
778 | if (!email.isEmpty()) { | 778 | if (!email.isEmpty()) { |
779 | mIncidence->addAttendee(new Attendee(name,email)); | 779 | mIncidence->addAttendee(new Attendee(name,email)); |
780 | } | 780 | } |
781 | } | 781 | } |
782 | } | 782 | } |
783 | #endif | 783 | #endif |
784 | } | 784 | } |
785 | 785 | ||
786 | 786 | ||
787 | QPtrList<KOAgendaItem> KOAgendaItem::conflictItems() | 787 | QPtrList<KOAgendaItem> KOAgendaItem::conflictItems() |
788 | { | 788 | { |
789 | return mConflictItems; | 789 | return mConflictItems; |
790 | } | 790 | } |
791 | 791 | ||
792 | void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci) | 792 | void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci) |
793 | { | 793 | { |
794 | mConflictItems = ci; | 794 | mConflictItems = ci; |
795 | KOAgendaItem *item; | 795 | KOAgendaItem *item; |
796 | for ( item=mConflictItems.first(); item != 0; | 796 | for ( item=mConflictItems.first(); item != 0; |
797 | item=mConflictItems.next() ) { | 797 | item=mConflictItems.next() ) { |
798 | item->addConflictItem(this); | 798 | item->addConflictItem(this); |
799 | } | 799 | } |
800 | } | 800 | } |
801 | 801 | ||
802 | void KOAgendaItem::addConflictItem(KOAgendaItem *ci) | 802 | void KOAgendaItem::addConflictItem(KOAgendaItem *ci) |
803 | { | 803 | { |
804 | if (mConflictItems.find(ci)<0) | 804 | if (mConflictItems.find(ci)<0) |
805 | mConflictItems.append(ci); | 805 | mConflictItems.append(ci); |
806 | } | 806 | } |
807 | 807 | ||
808 | bool KOAgendaItem::checkLayout() | 808 | bool KOAgendaItem::checkLayout() |
809 | { | 809 | { |
810 | if ( !mConflictItems.count() ) | 810 | if ( !mConflictItems.count() ) |
811 | return true; | 811 | return true; |
812 | int max = 0; | 812 | int max = 0; |
813 | KOAgendaItem *item; | 813 | KOAgendaItem *item; |
814 | for ( item=mConflictItems.first(); item != 0; | 814 | for ( item=mConflictItems.first(); item != 0; |
815 | item=mConflictItems.next() ) { | 815 | item=mConflictItems.next() ) { |
816 | if ( item->subCells() > max ) | 816 | if ( item->subCells() > max ) |
817 | max = item->subCells(); | 817 | max = item->subCells(); |
818 | } | 818 | } |
819 | if ( max > subCells() ) { | 819 | if ( max > subCells() ) { |
820 | setSubCells( max ); | 820 | setSubCells( max ); |
821 | return false; | 821 | return false; |
822 | } | 822 | } |
823 | return true; | 823 | return true; |
824 | } | 824 | } |
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index 29a4393..2b16347 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp | |||
@@ -1,383 +1,387 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | #include <qcombobox.h> | 25 | #include <qcombobox.h> |
26 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qdialog.h> | 29 | #include <qdialog.h> |
30 | 30 | ||
31 | 31 | ||
32 | #include <libkcal/calfilter.h> | 32 | #include <libkcal/calfilter.h> |
33 | 33 | ||
34 | #include "kofilterview.h" | 34 | #include "kofilterview.h" |
35 | #include "koprefs.h" | 35 | #include "koprefs.h" |
36 | #include <kiconloader.h> | 36 | #include <kiconloader.h> |
37 | #include <kglobal.h> | 37 | #include <kglobal.h> |
38 | #include <kcolorbutton.h> | 38 | #include <kcolorbutton.h> |
39 | #include <kmessagebox.h> | 39 | #include <kmessagebox.h> |
40 | 40 | ||
41 | 41 | ||
42 | #include <kurlrequester.h> | 42 | #include <kurlrequester.h> |
43 | #include <klineedit.h> | 43 | #include <klineedit.h> |
44 | 44 | ||
45 | class KONewCalPrefs : public QDialog | 45 | class KONewCalPrefs : public QDialog |
46 | { | 46 | { |
47 | public: | 47 | public: |
48 | KONewCalPrefs( QWidget *parent=0, const char *name=0 ) : | 48 | KONewCalPrefs( QWidget *parent=0, const char *name=0 ) : |
49 | QDialog( parent, name, true ) | 49 | QDialog( parent, name, true ) |
50 | { | 50 | { |
51 | setCaption( i18n("Add new Calendar") ); | 51 | setCaption( i18n("Add new Calendar") ); |
52 | QVBoxLayout* lay = new QVBoxLayout( this ); | 52 | QVBoxLayout* lay = new QVBoxLayout( this ); |
53 | lay->setSpacing( 3 ); | 53 | lay->setSpacing( 3 ); |
54 | lay->setMargin( 3 ); | 54 | lay->setMargin( 3 ); |
55 | QLabel * lab = new QLabel( i18n("<b>Name of new calendar:</b>"), this ); | 55 | QLabel * lab = new QLabel( i18n("<b>Name of new calendar:</b>"), this ); |
56 | lay->addWidget( lab ); | 56 | lay->addWidget( lab ); |
57 | nameE = new KLineEdit( this ); | 57 | nameE = new KLineEdit( this ); |
58 | lay->addWidget( nameE ); | 58 | lay->addWidget( nameE ); |
59 | lab = new QLabel( i18n("Local ical (*.ics) file:"), this ); | 59 | lab = new QLabel( i18n("Local ical (*.ics) file:"), this ); |
60 | lay->addWidget( lab ); | 60 | lay->addWidget( lab ); |
61 | url = new KURLRequester ( this ); | 61 | url = new KURLRequester ( this ); |
62 | lay->addWidget( url ); | 62 | lay->addWidget( url ); |
63 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 63 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
64 | lay->addWidget( ok ); | 64 | lay->addWidget( ok ); |
65 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 65 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
66 | lay->addWidget( cancel ); | 66 | lay->addWidget( cancel ); |
67 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 67 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
68 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 68 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
69 | //resize( 200, 200 ); | 69 | //resize( 200, 200 ); |
70 | } | 70 | } |
71 | 71 | ||
72 | QString calName() { return nameE->text(); } | 72 | QString calName() { return nameE->text(); } |
73 | QString calFileName() { return url->url(); } | 73 | QString calFileName() { return url->url(); } |
74 | private: | 74 | private: |
75 | KLineEdit* nameE; | 75 | KLineEdit* nameE; |
76 | KURLRequester *url; | 76 | KURLRequester *url; |
77 | }; | 77 | }; |
78 | 78 | ||
79 | 79 | ||
80 | KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, | 80 | KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, |
81 | const char* name,WFlags fl ) | 81 | const char* name,WFlags fl ) |
82 | : KOFilterView_base(parent,name,fl) | 82 | : KOFilterView_base(parent,name,fl) |
83 | { | 83 | { |
84 | mFilters = filterList; | 84 | mFilters = filterList; |
85 | 85 | ||
86 | connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); | 86 | connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); |
87 | connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); | 87 | connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); |
88 | connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); | 88 | connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); |
89 | } | 89 | } |
90 | 90 | ||
91 | KOFilterView::~KOFilterView() | 91 | KOFilterView::~KOFilterView() |
92 | { | 92 | { |
93 | // no need to delete child widgets, Qt does it all for us | 93 | // no need to delete child widgets, Qt does it all for us |
94 | } | 94 | } |
95 | 95 | ||
96 | bool KOFilterView::filtersEnabled() | 96 | bool KOFilterView::filtersEnabled() |
97 | { | 97 | { |
98 | return mEnabledCheck->isChecked(); | 98 | return mEnabledCheck->isChecked(); |
99 | } | 99 | } |
100 | 100 | ||
101 | void KOFilterView::setFiltersEnabled(bool set) | 101 | void KOFilterView::setFiltersEnabled(bool set) |
102 | { | 102 | { |
103 | mEnabledCheck->setChecked(set); | 103 | mEnabledCheck->setChecked(set); |
104 | emit filterChanged(); | 104 | emit filterChanged(); |
105 | } | 105 | } |
106 | 106 | ||
107 | 107 | ||
108 | void KOFilterView::updateFilters() | 108 | void KOFilterView::updateFilters() |
109 | { | 109 | { |
110 | mSelectionCombo->clear(); | 110 | mSelectionCombo->clear(); |
111 | 111 | ||
112 | CalFilter *filter = mFilters->first(); | 112 | CalFilter *filter = mFilters->first(); |
113 | while(filter) { | 113 | while(filter) { |
114 | mSelectionCombo->insertItem(filter->name()); | 114 | mSelectionCombo->insertItem(filter->name()); |
115 | filter = mFilters->next(); | 115 | filter = mFilters->next(); |
116 | } | 116 | } |
117 | } | 117 | } |
118 | 118 | ||
119 | CalFilter *KOFilterView::selectedFilter() | 119 | CalFilter *KOFilterView::selectedFilter() |
120 | { | 120 | { |
121 | CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); | 121 | CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); |
122 | return f; | 122 | return f; |
123 | } | 123 | } |
124 | 124 | ||
125 | void KOFilterView::setSelectedFilter(QString filterName) | 125 | void KOFilterView::setSelectedFilter(QString filterName) |
126 | { | 126 | { |
127 | int filter_num = mSelectionCombo->count(); | 127 | int filter_num = mSelectionCombo->count(); |
128 | int i; | 128 | int i; |
129 | for (i=0;i<filter_num;i++) { | 129 | for (i=0;i<filter_num;i++) { |
130 | if (mSelectionCombo->text(i)==filterName) | 130 | if (mSelectionCombo->text(i)==filterName) |
131 | mSelectionCombo->setCurrentItem(i); | 131 | mSelectionCombo->setCurrentItem(i); |
132 | } | 132 | } |
133 | emit filterChanged(); | 133 | emit filterChanged(); |
134 | } | 134 | } |
135 | void KOFilterView::setSelectedFilter( int fil ) | 135 | void KOFilterView::setSelectedFilter( int fil ) |
136 | { | 136 | { |
137 | if ( fil >= mSelectionCombo->count() ) | 137 | if ( fil >= mSelectionCombo->count() ) |
138 | return; | 138 | return; |
139 | mSelectionCombo->setCurrentItem( fil ); | 139 | mSelectionCombo->setCurrentItem( fil ); |
140 | emit filterChanged(); | 140 | emit filterChanged(); |
141 | } | 141 | } |
142 | 142 | ||
143 | 143 | ||
144 | 144 | ||
145 | KOCalEditView::KOCalEditView(QWidget* parent, | 145 | KOCalEditView::KOCalEditView(QWidget* parent, |
146 | const char* name ) | 146 | const char* name ) |
147 | : QWidget(parent,name) | 147 | : QWidget(parent,name) |
148 | { | 148 | { |
149 | mw = 0; | 149 | mw = 0; |
150 | ml = new QVBoxLayout ( this ); | 150 | ml = new QVBoxLayout ( this ); |
151 | } | 151 | } |
152 | 152 | ||
153 | KOCalEditView::~KOCalEditView() | 153 | KOCalEditView::~KOCalEditView() |
154 | { | 154 | { |
155 | // no need to delete child widgets, Qt does it all for us | 155 | // no need to delete child widgets, Qt does it all for us |
156 | } | 156 | } |
157 | void KOCalEditView::selectCal(int id ,bool b) | 157 | void KOCalEditView::selectCal(int id ,bool b) |
158 | { | 158 | { |
159 | KOPrefs::instance()->getCalendar( id )->isEnabled = b; | 159 | KOPrefs::instance()->getCalendar( id )->isEnabled = b; |
160 | emit calendarEnabled ( id, b ); | 160 | emit calendarEnabled ( id, b ); |
161 | emit needsUpdate(); | ||
161 | 162 | ||
162 | } | 163 | } |
163 | void KOCalEditView::selectStdCal( int id, bool b ) | 164 | void KOCalEditView::selectStdCal( int id, bool b ) |
164 | { | 165 | { |
165 | 166 | ||
166 | if ( !b ) { | 167 | if ( !b ) { |
167 | KOCalCheckButton* it = (KOCalCheckButton*) sender(); | 168 | KOCalCheckButton* it = (KOCalCheckButton*) sender(); |
168 | if ( it ) { | 169 | if ( it ) { |
169 | it->blockSignals( true ); | 170 | it->blockSignals( true ); |
170 | it->setChecked( true ); | 171 | it->setChecked( true ); |
171 | it->blockSignals( false ); | 172 | it->blockSignals( false ); |
172 | return; | 173 | return; |
173 | } | 174 | } |
174 | return; | 175 | return; |
175 | } | 176 | } |
176 | KOCalCheckButton* sen = (KOCalCheckButton*) sender(); | 177 | KOCalCheckButton* sen = (KOCalCheckButton*) sender(); |
177 | KOCalCheckButton* it = mStdandardB.first(); | 178 | KOCalCheckButton* it = mStdandardB.first(); |
178 | while ( it ) { | 179 | while ( it ) { |
179 | if ( it->isChecked() ) { | 180 | if ( it->isChecked() ) { |
180 | if ( it != sen ) { | 181 | if ( it != sen ) { |
181 | it->blockSignals( true ); | 182 | it->blockSignals( true ); |
182 | it->setChecked( false ); | 183 | it->setChecked( false ); |
183 | it->blockSignals( false ); | 184 | it->blockSignals( false ); |
184 | break; | 185 | break; |
185 | } | 186 | } |
186 | } | 187 | } |
187 | it = mStdandardB.next(); | 188 | it = mStdandardB.next(); |
188 | } | 189 | } |
189 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 190 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
190 | while ( kkf ) { | 191 | while ( kkf ) { |
191 | kkf->isStandard = false; | 192 | kkf->isStandard = false; |
192 | kkf = KOPrefs::instance()->mCalendars.next(); | 193 | kkf = KOPrefs::instance()->mCalendars.next(); |
193 | } | 194 | } |
194 | KOPrefs::instance()->getCalendar( id )->isStandard = true; | 195 | KOPrefs::instance()->getCalendar( id )->isStandard = true; |
195 | emit setCalendarDefault ( id ); | 196 | emit setCalendarDefault ( id ); |
196 | } | 197 | } |
197 | 198 | ||
198 | void KOCalEditView::selectCalAlarm(int id ,bool b ) | 199 | void KOCalEditView::selectCalAlarm(int id ,bool b ) |
199 | { | 200 | { |
200 | KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; | 201 | KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; |
201 | emit alarmEnabled ( id , b ); | 202 | emit alarmEnabled ( id , b ); |
203 | emit needsUpdate(); | ||
202 | } | 204 | } |
203 | void KOCalEditView::selectReadOnly(int id ,bool b ) | 205 | void KOCalEditView::selectReadOnly(int id ,bool b ) |
204 | { | 206 | { |
205 | KOPrefs::instance()->getCalendar( id )->isReadOnly = b; | 207 | KOPrefs::instance()->getCalendar( id )->isReadOnly = b; |
206 | emit calendarReadonly ( id , b ); | 208 | emit calendarReadonly ( id , b ); |
209 | emit needsUpdate(); | ||
207 | 210 | ||
208 | } | 211 | } |
209 | void KOCalEditView::setColor( const QColor& c, int id ) | 212 | void KOCalEditView::setColor( const QColor& c, int id ) |
210 | { | 213 | { |
211 | KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; | 214 | KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; |
215 | emit needsUpdate(); | ||
212 | } | 216 | } |
213 | void KOCalEditView::deleteCal( int id ) | 217 | void KOCalEditView::deleteCal( int id ) |
214 | { | 218 | { |
215 | KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); | 219 | KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); |
216 | QString name = kkf->mName; | 220 | QString name = kkf->mName; |
217 | QString file = kkf->mFileName; | 221 | QString file = kkf->mFileName; |
218 | if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b><tr> Do you want to remove this calendar from KO/Pi? (The file is not removed, of course!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; | 222 | if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b><tr> Do you want to remove this calendar from KO/Pi? (The file is not removed, of course!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; |
219 | emit removeCalendar ( id ); | 223 | emit removeCalendar ( id ); |
220 | KOPrefs::instance()->mCalendars.remove ( kkf ); | 224 | KOPrefs::instance()->mCalendars.remove ( kkf ); |
221 | readConfig(); | 225 | readConfig(); |
222 | } | 226 | } |
223 | void KOCalEditView::infoCal( int id ) | 227 | void KOCalEditView::infoCal( int id ) |
224 | { | 228 | { |
225 | QString name = KOPrefs::instance()->getCalendar( id )->mName; | 229 | QString name = KOPrefs::instance()->getCalendar( id )->mName; |
226 | QString file = KOPrefs::instance()->getCalendar( id )->mFileName; | 230 | QString file = KOPrefs::instance()->getCalendar( id )->mFileName; |
227 | KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); | 231 | KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); |
228 | } | 232 | } |
229 | void KOCalEditView::readConfig() | 233 | void KOCalEditView::readConfig() |
230 | { | 234 | { |
231 | 235 | ||
232 | mStdandardB.clear(); | 236 | mStdandardB.clear(); |
233 | mEnabledB.clear(); | 237 | mEnabledB.clear(); |
234 | mAlarmB.clear(); | 238 | mAlarmB.clear(); |
235 | mROB.clear(); | 239 | mROB.clear(); |
236 | 240 | ||
237 | if ( mw ) delete mw; | 241 | if ( mw ) delete mw; |
238 | mw = new QWidget ( this ); | 242 | mw = new QWidget ( this ); |
239 | ml->addWidget ( mw ); | 243 | ml->addWidget ( mw ); |
240 | 244 | ||
241 | mainLayout = new QGridLayout ( mw , 2, 8 ); | 245 | mainLayout = new QGridLayout ( mw , 2, 8 ); |
242 | //mainLayout->setSpacing( 3 ); | 246 | //mainLayout->setSpacing( 3 ); |
243 | QPushButton * addBut = new QPushButton ( mw ); | 247 | QPushButton * addBut = new QPushButton ( mw ); |
244 | mainLayout->addWidget( addBut,0,0 ); | 248 | mainLayout->addWidget( addBut,0,0 ); |
245 | addBut->setPixmap ( SmallIcon("plus")); | 249 | addBut->setPixmap ( SmallIcon("plus")); |
246 | connect(addBut,SIGNAL(clicked()),SLOT(addCal())); | 250 | connect(addBut,SIGNAL(clicked()),SLOT(addCal())); |
247 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 251 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
248 | 252 | ||
249 | addBut = new QPushButton ( mw ); | 253 | addBut = new QPushButton ( mw ); |
250 | mainLayout->addWidget( addBut,0,1 ); | 254 | mainLayout->addWidget( addBut,0,1 ); |
251 | addBut->setPixmap ( SmallIcon("eye")); | 255 | addBut->setPixmap ( SmallIcon("eye")); |
252 | connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); | 256 | connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); |
253 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 257 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
254 | 258 | ||
255 | QLabel* lab = new QLabel ( " "+i18n("Calendar")+" ", mw ); | 259 | QLabel* lab = new QLabel ( " "+i18n("Calendar")+" ", mw ); |
256 | mainLayout->addWidget( lab,0,2 ); | 260 | mainLayout->addWidget( lab,0,2 ); |
257 | 261 | ||
258 | addBut = new QPushButton ( mw ); | 262 | addBut = new QPushButton ( mw ); |
259 | mainLayout->addWidget( addBut,0,3 ); | 263 | mainLayout->addWidget( addBut,0,3 ); |
260 | addBut->setPixmap ( SmallIcon("bell")); | 264 | addBut->setPixmap ( SmallIcon("bell")); |
261 | connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); | 265 | connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); |
262 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 266 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
263 | 267 | ||
264 | addBut = new QPushButton ( mw ); | 268 | addBut = new QPushButton ( mw ); |
265 | mainLayout->addWidget( addBut,0,4 ); | 269 | mainLayout->addWidget( addBut,0,4 ); |
266 | addBut->setPixmap ( SmallIcon("pencil")); | 270 | addBut->setPixmap ( SmallIcon("pencil")); |
267 | connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); | 271 | connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); |
268 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 272 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
269 | 273 | ||
270 | lab = new QLabel ( i18n(" Color "), mw ); | 274 | lab = new QLabel ( i18n(" Color "), mw ); |
271 | mainLayout->addWidget( lab,0,5 ); | 275 | mainLayout->addWidget( lab,0,5 ); |
272 | #if 0 | 276 | #if 0 |
273 | addBut = new QPushButton ( mw ); | 277 | addBut = new QPushButton ( mw ); |
274 | mainLayout->addWidget( addBut,0,6 ); | 278 | mainLayout->addWidget( addBut,0,6 ); |
275 | addBut->setPixmap ( SmallIcon("minus")); | 279 | addBut->setPixmap ( SmallIcon("minus")); |
276 | connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); | 280 | connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); |
277 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 281 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
278 | #endif | 282 | #endif |
279 | 283 | ||
280 | 284 | ||
281 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 285 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
282 | int row = 1; | 286 | int row = 1; |
283 | while ( kkf ) { | 287 | while ( kkf ) { |
284 | 288 | ||
285 | KOCalCheckButton* cb = new KOCalCheckButton( mw ); | 289 | KOCalCheckButton* cb = new KOCalCheckButton( mw ); |
286 | mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb ); | 290 | mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb ); |
287 | cb->setChecked( kkf->isStandard ); | 291 | cb->setChecked( kkf->isStandard ); |
288 | cb->setNum( kkf->mCalNumber ); | 292 | cb->setNum( kkf->mCalNumber ); |
289 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); | 293 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); |
290 | cb = new KOCalCheckButton( mw ); | 294 | cb = new KOCalCheckButton( mw ); |
291 | mainLayout->addWidget( cb,row,1 );mEnabledB.append( cb ); | 295 | mainLayout->addWidget( cb,row,1 );mEnabledB.append( cb ); |
292 | cb->setChecked( kkf->isEnabled ); | 296 | cb->setChecked( kkf->isEnabled ); |
293 | cb->setNum( kkf->mCalNumber ); | 297 | cb->setNum( kkf->mCalNumber ); |
294 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); | 298 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); |
295 | KOCalButton* name = new KOCalButton( mw ); | 299 | KOCalButton* name = new KOCalButton( mw ); |
296 | name->setNum( kkf->mCalNumber ); | 300 | name->setNum( kkf->mCalNumber ); |
297 | name->setText( kkf->mName ); | 301 | name->setText( kkf->mName ); |
298 | mainLayout->addWidget( name,row,2 ); | 302 | mainLayout->addWidget( name,row,2 ); |
299 | connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); | 303 | connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); |
300 | cb = new KOCalCheckButton( mw ); | 304 | cb = new KOCalCheckButton( mw ); |
301 | mainLayout->addWidget( cb,row,3 );mAlarmB.append( cb ); | 305 | mainLayout->addWidget( cb,row,3 );mAlarmB.append( cb ); |
302 | cb->setChecked( kkf->isAlarmEnabled ); | 306 | cb->setChecked( kkf->isAlarmEnabled ); |
303 | cb->setNum( kkf->mCalNumber ); | 307 | cb->setNum( kkf->mCalNumber ); |
304 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); | 308 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); |
305 | cb = new KOCalCheckButton( mw ); | 309 | cb = new KOCalCheckButton( mw ); |
306 | mainLayout->addWidget( cb,row,4 );mROB.append( cb ); | 310 | mainLayout->addWidget( cb,row,4 );mROB.append( cb ); |
307 | cb->setChecked( kkf->isReadOnly ); | 311 | cb->setChecked( kkf->isReadOnly ); |
308 | cb->setNum( kkf->mCalNumber ); | 312 | cb->setNum( kkf->mCalNumber ); |
309 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); | 313 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); |
310 | KColorButton *colb = new KColorButton( mw ); | 314 | KColorButton *colb = new KColorButton( mw ); |
311 | mainLayout->addWidget( colb,row,5 ); | 315 | mainLayout->addWidget( colb,row,5 ); |
312 | colb->setID( kkf->mCalNumber ); | 316 | colb->setID( kkf->mCalNumber ); |
313 | colb->setColor( kkf->mDefaultColor ); | 317 | colb->setColor( kkf->mDefaultColor ); |
314 | connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); | 318 | connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); |
315 | if ( row > 1) { | 319 | if ( row > 1) { |
316 | KOCalButton* calb = new KOCalButton( mw ); | 320 | KOCalButton* calb = new KOCalButton( mw ); |
317 | mainLayout->addWidget( calb,row,6 ); | 321 | mainLayout->addWidget( calb,row,6 ); |
318 | calb->setNum( kkf->mCalNumber ); | 322 | calb->setNum( kkf->mCalNumber ); |
319 | calb->setPixmap ( SmallIcon("minus")); | 323 | calb->setPixmap ( SmallIcon("minus")); |
320 | connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); | 324 | connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); |
321 | int hei = calb->sizeHint().height(); | 325 | int hei = calb->sizeHint().height(); |
322 | //calb->setMaximumSize( hei*9/10, hei*9/10 ); | 326 | //calb->setMaximumSize( hei*9/10, hei*9/10 ); |
323 | } | 327 | } |
324 | ++row; | 328 | ++row; |
325 | kkf = KOPrefs::instance()->mCalendars.next(); | 329 | kkf = KOPrefs::instance()->mCalendars.next(); |
326 | } | 330 | } |
327 | lab = new QLabel ( "", mw ); | 331 | lab = new QLabel ( "", mw ); |
328 | mainLayout->addWidget( lab,row,0 ); | 332 | mainLayout->addWidget( lab,row,0 ); |
329 | mw->show(); | 333 | mw->show(); |
330 | 334 | ||
331 | } | 335 | } |
332 | void KOCalEditView::addCal() | 336 | void KOCalEditView::addCal() |
333 | { | 337 | { |
334 | qDebug("addcal "); | 338 | qDebug("addcal "); |
335 | KONewCalPrefs prefs ( this ); | 339 | KONewCalPrefs prefs ( this ); |
336 | if ( ! prefs.exec() ) | 340 | if ( ! prefs.exec() ) |
337 | return; | 341 | return; |
338 | QString name = prefs.calName(); | 342 | QString name = prefs.calName(); |
339 | QString file = prefs.calFileName(); | 343 | QString file = prefs.calFileName(); |
340 | QFileInfo fi ( file ); | 344 | QFileInfo fi ( file ); |
341 | if (!fi.exists() ) { | 345 | if (!fi.exists() ) { |
342 | KMessageBox::information( this, i18n("File does not exist!\nNo calendar added!")); | 346 | KMessageBox::information( this, i18n("File does not exist!\nNo calendar added!")); |
343 | return; | 347 | return; |
344 | } | 348 | } |
345 | KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); | 349 | KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); |
346 | kkf->mName = name; | 350 | kkf->mName = name; |
347 | kkf->mFileName = file; | 351 | kkf->mFileName = file; |
348 | emit calendarAdded( kkf->mCalNumber ); | 352 | emit calendarAdded( kkf->mCalNumber ); |
349 | readConfig(); | 353 | readConfig(); |
350 | } | 354 | } |
351 | void KOCalEditView::enableAll() | 355 | void KOCalEditView::enableAll() |
352 | { | 356 | { |
353 | toggleList( mEnabledB ); | 357 | toggleList( mEnabledB ); |
354 | } | 358 | } |
355 | void KOCalEditView::enableAlarm() | 359 | void KOCalEditView::enableAlarm() |
356 | { | 360 | { |
357 | toggleList( mAlarmB ); | 361 | toggleList( mAlarmB ); |
358 | } | 362 | } |
359 | void KOCalEditView::disableRO() | 363 | void KOCalEditView::disableRO() |
360 | { | 364 | { |
361 | toggleList( mROB ); | 365 | toggleList( mROB ); |
362 | } | 366 | } |
363 | void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) | 367 | void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) |
364 | { | 368 | { |
365 | bool dis = false; | 369 | bool dis = false; |
366 | KOCalCheckButton* it = list.first(); | 370 | KOCalCheckButton* it = list.first(); |
367 | while ( it ) { | 371 | while ( it ) { |
368 | if ( !it->isChecked() ) { | 372 | if ( !it->isChecked() ) { |
369 | dis = true; | 373 | dis = true; |
370 | break; | 374 | break; |
371 | } | 375 | } |
372 | it = list.next(); | 376 | it = list.next(); |
373 | } | 377 | } |
374 | it = list.first(); | 378 | it = list.first(); |
375 | while ( it ) { | 379 | while ( it ) { |
376 | it->setChecked(dis); | 380 | it->setChecked(dis); |
377 | it = list.next(); | 381 | it = list.next(); |
378 | } | 382 | } |
379 | } | 383 | } |
380 | void KOCalEditView::deleteAll() | 384 | void KOCalEditView::deleteAll() |
381 | { | 385 | { |
382 | qDebug("delteAll"); | 386 | qDebug("delteAll"); |
383 | } | 387 | } |
diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h index aaf0eb6..4a0cd8a 100644 --- a/korganizer/kofilterview.h +++ b/korganizer/kofilterview.h | |||
@@ -1,155 +1,156 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef KOFILTERVIEW_H | 23 | #ifndef KOFILTERVIEW_H |
24 | #define KOFILTERVIEW_H | 24 | #define KOFILTERVIEW_H |
25 | 25 | ||
26 | #include <qstring.h> | 26 | #include <qstring.h> |
27 | #include <qcheckbox.h> | 27 | #include <qcheckbox.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <kconfig.h> | 29 | #include <kconfig.h> |
30 | #include "kofilterview_base.h" | 30 | #include "kofilterview_base.h" |
31 | 31 | ||
32 | #include <libkcal/calfilter.h> | 32 | #include <libkcal/calfilter.h> |
33 | 33 | ||
34 | class QGridLayout; | 34 | class QGridLayout; |
35 | 35 | ||
36 | using namespace KCal; | 36 | using namespace KCal; |
37 | class KOCalButton : public QPushButton | 37 | class KOCalButton : public QPushButton |
38 | { | 38 | { |
39 | Q_OBJECT | 39 | Q_OBJECT |
40 | public: | 40 | public: |
41 | KOCalButton( QWidget *parent=0, const char *name=0 ) : | 41 | KOCalButton( QWidget *parent=0, const char *name=0 ) : |
42 | QPushButton( parent, name) | 42 | QPushButton( parent, name) |
43 | { | 43 | { |
44 | connect( this, SIGNAL( clicked() ), | 44 | connect( this, SIGNAL( clicked() ), |
45 | SLOT( bottonClicked() )); | 45 | SLOT( bottonClicked() )); |
46 | mNumber = -1; | 46 | mNumber = -1; |
47 | } | 47 | } |
48 | void setNum ( int num ) {mNumber = num; } | 48 | void setNum ( int num ) {mNumber = num; } |
49 | signals: | 49 | signals: |
50 | void selectNum ( int ); | 50 | void selectNum ( int ); |
51 | private: | 51 | private: |
52 | int mNumber; | 52 | int mNumber; |
53 | void keyPressEvent ( QKeyEvent * e ) | 53 | void keyPressEvent ( QKeyEvent * e ) |
54 | { | 54 | { |
55 | e->ignore(); | 55 | e->ignore(); |
56 | } | 56 | } |
57 | 57 | ||
58 | private slots : | 58 | private slots : |
59 | void bottonClicked() { if ( mNumber > 0 ) emit selectNum ( mNumber ); } | 59 | void bottonClicked() { if ( mNumber > 0 ) emit selectNum ( mNumber ); } |
60 | }; | 60 | }; |
61 | class KOCalCheckButton : public QCheckBox | 61 | class KOCalCheckButton : public QCheckBox |
62 | { | 62 | { |
63 | Q_OBJECT | 63 | Q_OBJECT |
64 | public: | 64 | public: |
65 | KOCalCheckButton( QWidget *parent=0, const char *name=0 ) : | 65 | KOCalCheckButton( QWidget *parent=0, const char *name=0 ) : |
66 | QCheckBox( parent, name) | 66 | QCheckBox( parent, name) |
67 | { | 67 | { |
68 | connect( this, SIGNAL( toggled ( bool ) ), | 68 | connect( this, SIGNAL( toggled ( bool ) ), |
69 | SLOT( bottonClicked( bool ) )); | 69 | SLOT( bottonClicked( bool ) )); |
70 | mNumber = -1; | 70 | mNumber = -1; |
71 | //setMaximumWidth( 10 ); | 71 | //setMaximumWidth( 10 ); |
72 | 72 | ||
73 | } | 73 | } |
74 | void setNum ( int num ) {mNumber = num; } | 74 | void setNum ( int num ) {mNumber = num; } |
75 | signals: | 75 | signals: |
76 | void selectNum ( int, bool ); | 76 | void selectNum ( int, bool ); |
77 | private: | 77 | private: |
78 | int mNumber; | 78 | int mNumber; |
79 | void keyPressEvent ( QKeyEvent * e ) | 79 | void keyPressEvent ( QKeyEvent * e ) |
80 | { | 80 | { |
81 | e->ignore(); | 81 | e->ignore(); |
82 | } | 82 | } |
83 | 83 | ||
84 | private slots : | 84 | private slots : |
85 | void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); } | 85 | void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); } |
86 | }; | 86 | }; |
87 | 87 | ||
88 | 88 | ||
89 | 89 | ||
90 | class KOFilterView : public KOFilterView_base | 90 | class KOFilterView : public KOFilterView_base |
91 | { | 91 | { |
92 | Q_OBJECT | 92 | Q_OBJECT |
93 | public: | 93 | public: |
94 | KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0); | 94 | KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0); |
95 | ~KOFilterView(); | 95 | ~KOFilterView(); |
96 | 96 | ||
97 | void updateFilters(); | 97 | void updateFilters(); |
98 | 98 | ||
99 | bool filtersEnabled(); | 99 | bool filtersEnabled(); |
100 | void setFiltersEnabled(bool); | 100 | void setFiltersEnabled(bool); |
101 | CalFilter *selectedFilter(); | 101 | CalFilter *selectedFilter(); |
102 | void setSelectedFilter(QString); | 102 | void setSelectedFilter(QString); |
103 | void setSelectedFilter( int ); | 103 | void setSelectedFilter( int ); |
104 | 104 | ||
105 | signals: | 105 | signals: |
106 | void filterChanged(); | 106 | void filterChanged(); |
107 | void editFilters(); | 107 | void editFilters(); |
108 | 108 | ||
109 | private: | 109 | private: |
110 | QPtrList<CalFilter> *mFilters; | 110 | QPtrList<CalFilter> *mFilters; |
111 | }; | 111 | }; |
112 | 112 | ||
113 | class KOCalEditView : public QWidget | 113 | class KOCalEditView : public QWidget |
114 | { | 114 | { |
115 | Q_OBJECT | 115 | Q_OBJECT |
116 | public: | 116 | public: |
117 | KOCalEditView( QWidget* parent=0,const char* name=0); | 117 | KOCalEditView( QWidget* parent=0,const char* name=0); |
118 | ~KOCalEditView(); | 118 | ~KOCalEditView(); |
119 | 119 | ||
120 | void readConfig(); | 120 | void readConfig(); |
121 | public slots: | 121 | public slots: |
122 | void addCal(); | 122 | void addCal(); |
123 | void enableAll(); | 123 | void enableAll(); |
124 | void enableAlarm(); | 124 | void enableAlarm(); |
125 | void disableRO(); | 125 | void disableRO(); |
126 | void deleteAll(); | 126 | void deleteAll(); |
127 | void selectStdCal(int,bool ); | 127 | void selectStdCal(int,bool ); |
128 | void selectCal(int,bool ); | 128 | void selectCal(int,bool ); |
129 | void selectCalAlarm(int,bool ); | 129 | void selectCalAlarm(int,bool ); |
130 | void selectReadOnly(int,bool ); | 130 | void selectReadOnly(int,bool ); |
131 | void setColor(const QColor &,int) ; | 131 | void setColor(const QColor &,int) ; |
132 | void deleteCal(int) ; | 132 | void deleteCal(int) ; |
133 | void infoCal(int) ; | 133 | void infoCal(int) ; |
134 | signals: | 134 | signals: |
135 | void alarmEnabled ( int cal, bool enable ); | 135 | void alarmEnabled ( int cal, bool enable ); |
136 | void calendarEnabled ( int cal, bool enable ); | 136 | void calendarEnabled ( int cal, bool enable ); |
137 | void calendarReadonly ( int cal, bool readonly ); | 137 | void calendarReadonly ( int cal, bool readonly ); |
138 | void setCalendarDefault ( int cal ); | 138 | void setCalendarDefault ( int cal ); |
139 | void removeCalendar ( int cal ); | 139 | void removeCalendar ( int cal ); |
140 | void calendarAdded( int ); | 140 | void calendarAdded( int ); |
141 | void needsUpdate(); | ||
141 | 142 | ||
142 | private: | 143 | private: |
143 | QVBoxLayout* ml; | 144 | QVBoxLayout* ml; |
144 | QWidget *mw; | 145 | QWidget *mw; |
145 | void toggleList ( QPtrList<KOCalCheckButton> ); | 146 | void toggleList ( QPtrList<KOCalCheckButton> ); |
146 | QPtrList<KOCalCheckButton> mStdandardB; | 147 | QPtrList<KOCalCheckButton> mStdandardB; |
147 | QPtrList<KOCalCheckButton> mEnabledB; | 148 | QPtrList<KOCalCheckButton> mEnabledB; |
148 | QPtrList<KOCalCheckButton> mAlarmB; | 149 | QPtrList<KOCalCheckButton> mAlarmB; |
149 | QPtrList<KOCalCheckButton> mROB; | 150 | QPtrList<KOCalCheckButton> mROB; |
150 | QGridLayout* mainLayout; | 151 | QGridLayout* mainLayout; |
151 | }; | 152 | }; |
152 | 153 | ||
153 | 154 | ||
154 | 155 | ||
155 | #endif // KOFILTERVIEW_H | 156 | #endif // KOFILTERVIEW_H |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index c868270..96f2502 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1,2096 +1,2096 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <qpopupmenu.h> | 20 | #include <qpopupmenu.h> |
21 | #include <qfont.h> | 21 | #include <qfont.h> |
22 | #include <qfontmetrics.h> | 22 | #include <qfontmetrics.h> |
23 | #include <qkeycode.h> | 23 | #include <qkeycode.h> |
24 | #include <qhbox.h> | 24 | #include <qhbox.h> |
25 | #include <qvbox.h> | 25 | #include <qvbox.h> |
26 | #include <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
27 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
28 | #include <qtooltip.h> | 28 | #include <qtooltip.h> |
29 | #include <qpainter.h> | 29 | #include <qpainter.h> |
30 | #include <qtimer.h> | 30 | #include <qtimer.h> |
31 | #include <qwhatsthis.h> | 31 | #include <qwhatsthis.h> |
32 | #ifndef DESKTOP_VERSION | 32 | #ifndef DESKTOP_VERSION |
33 | #include <qpe/qpeapplication.h> | 33 | #include <qpe/qpeapplication.h> |
34 | #else | 34 | #else |
35 | #include <qapplication.h> | 35 | #include <qapplication.h> |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #include <kdebug.h> | 38 | #include <kdebug.h> |
39 | #include <klocale.h> | 39 | #include <klocale.h> |
40 | #include <kglobal.h> | 40 | #include <kglobal.h> |
41 | #include <kconfig.h> | 41 | #include <kconfig.h> |
42 | #include <kiconloader.h> | 42 | #include <kiconloader.h> |
43 | 43 | ||
44 | #include <kcalendarsystem.h> | 44 | #include <kcalendarsystem.h> |
45 | 45 | ||
46 | #ifndef KORG_NOPRINTER | 46 | #ifndef KORG_NOPRINTER |
47 | #include "calprinter.h" | 47 | #include "calprinter.h" |
48 | #endif | 48 | #endif |
49 | #include "koprefs.h" | 49 | #include "koprefs.h" |
50 | #ifndef KORG_NOPLUGINS | 50 | #ifndef KORG_NOPLUGINS |
51 | #include "kocore.h" | 51 | #include "kocore.h" |
52 | #endif | 52 | #endif |
53 | #include "koglobals.h" | 53 | #include "koglobals.h" |
54 | #include <libkcal/kincidenceformatter.h> | 54 | #include <libkcal/kincidenceformatter.h> |
55 | 55 | ||
56 | #include "komonthview.h" | 56 | #include "komonthview.h" |
57 | 57 | ||
58 | #define PIXMAP_SIZE 5 | 58 | #define PIXMAP_SIZE 5 |
59 | #ifdef DESKTOP_VERSION | 59 | #ifdef DESKTOP_VERSION |
60 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; | 60 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; |
61 | #endif | 61 | #endif |
62 | class KNOWhatsThis :public QWhatsThis | 62 | class KNOWhatsThis :public QWhatsThis |
63 | { | 63 | { |
64 | public: | 64 | public: |
65 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; | 65 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; |
66 | //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; | 66 | //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; |
67 | 67 | ||
68 | protected: | 68 | protected: |
69 | virtual QString text( const QPoint& p) | 69 | virtual QString text( const QPoint& p) |
70 | { | 70 | { |
71 | return _wid->getWhatsThisText(p) ; | 71 | return _wid->getWhatsThisText(p) ; |
72 | }; | 72 | }; |
73 | private: | 73 | private: |
74 | KNoScrollListBox* _wid; | 74 | KNoScrollListBox* _wid; |
75 | 75 | ||
76 | }; | 76 | }; |
77 | 77 | ||
78 | 78 | ||
79 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) | 79 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) |
80 | : QListBox(parent, name, WRepaintNoErase) | 80 | : QListBox(parent, name, WRepaintNoErase) |
81 | { | 81 | { |
82 | #ifndef DESKTOP_VERSION | 82 | #ifndef DESKTOP_VERSION |
83 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 83 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
84 | #endif | 84 | #endif |
85 | mWT = new KNOWhatsThis(this); | 85 | mWT = new KNOWhatsThis(this); |
86 | resetOnFocusIn = true; | 86 | resetOnFocusIn = true; |
87 | setVScrollBarMode(QScrollView::AlwaysOff); | 87 | setVScrollBarMode(QScrollView::AlwaysOff); |
88 | setHScrollBarMode(QScrollView::AlwaysOff); | 88 | setHScrollBarMode(QScrollView::AlwaysOff); |
89 | } | 89 | } |
90 | KNoScrollListBox::~KNoScrollListBox() | 90 | KNoScrollListBox::~KNoScrollListBox() |
91 | { | 91 | { |
92 | #if QT_VERSION >= 0x030000 | 92 | #if QT_VERSION >= 0x030000 |
93 | 93 | ||
94 | #else | 94 | #else |
95 | delete mWT; | 95 | delete mWT; |
96 | #endif | 96 | #endif |
97 | } | 97 | } |
98 | 98 | ||
99 | 99 | ||
100 | void KNoScrollListBox::focusInEvent ( QFocusEvent * e ) | 100 | void KNoScrollListBox::focusInEvent ( QFocusEvent * e ) |
101 | { | 101 | { |
102 | QListBox::focusInEvent ( e ); | 102 | QListBox::focusInEvent ( e ); |
103 | if ( count() ){ | 103 | if ( count() ){ |
104 | int ci = currentItem(); | 104 | int ci = currentItem(); |
105 | if ( ci < 0 ) ci = 0; | 105 | if ( ci < 0 ) ci = 0; |
106 | 106 | ||
107 | setCurrentItem( ci ); | 107 | setCurrentItem( ci ); |
108 | setSelected ( ci, true ); | 108 | setSelected ( ci, true ); |
109 | emit highlighted( item ( ci ) ); | 109 | emit highlighted( item ( ci ) ); |
110 | 110 | ||
111 | resetOnFocusIn = true; | 111 | resetOnFocusIn = true; |
112 | 112 | ||
113 | if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) { | 113 | if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) { |
114 | QListBoxItem *fi = firstItem (); | 114 | QListBoxItem *fi = firstItem (); |
115 | if (fi ) { | 115 | if (fi ) { |
116 | int ihei = fi->height( this ); | 116 | int ihei = fi->height( this ); |
117 | int hei = numRows () * ihei; | 117 | int hei = numRows () * ihei; |
118 | if ( hei < height() - horizontalScrollBar()->height () ) { | 118 | if ( hei < height() - horizontalScrollBar()->height () ) { |
119 | setVScrollBarMode(QScrollView::AlwaysOff); | 119 | setVScrollBarMode(QScrollView::AlwaysOff); |
120 | } | 120 | } |
121 | else | 121 | else |
122 | setVScrollBarMode(QScrollView::Auto); | 122 | setVScrollBarMode(QScrollView::Auto); |
123 | if ( ihei *3 > height() ) { | 123 | if ( ihei *3 > height() ) { |
124 | setHScrollBarMode(QScrollView::AlwaysOff); | 124 | setHScrollBarMode(QScrollView::AlwaysOff); |
125 | } | 125 | } |
126 | else { | 126 | else { |
127 | setHScrollBarMode(QScrollView::Auto); | 127 | setHScrollBarMode(QScrollView::Auto); |
128 | } | 128 | } |
129 | } else { | 129 | } else { |
130 | setVScrollBarMode(QScrollView::Auto); | 130 | setVScrollBarMode(QScrollView::Auto); |
131 | setHScrollBarMode(QScrollView::Auto); | 131 | setHScrollBarMode(QScrollView::Auto); |
132 | } | 132 | } |
133 | } | 133 | } |
134 | } | 134 | } |
135 | } | 135 | } |
136 | void KNoScrollListBox::focusOutEvent ( QFocusEvent * e ) | 136 | void KNoScrollListBox::focusOutEvent ( QFocusEvent * e ) |
137 | { | 137 | { |
138 | int i = currentItem (); | 138 | int i = currentItem (); |
139 | if ( i >= 0 ) { | 139 | if ( i >= 0 ) { |
140 | setSelected ( i, false ); | 140 | setSelected ( i, false ); |
141 | } | 141 | } |
142 | QListBox::focusOutEvent ( e ); | 142 | QListBox::focusOutEvent ( e ); |
143 | setVScrollBarMode(QScrollView::AlwaysOff); | 143 | setVScrollBarMode(QScrollView::AlwaysOff); |
144 | setHScrollBarMode(QScrollView::AlwaysOff); | 144 | setHScrollBarMode(QScrollView::AlwaysOff); |
145 | } | 145 | } |
146 | 146 | ||
147 | QString KNoScrollListBox::getWhatsThisText(QPoint p) | 147 | QString KNoScrollListBox::getWhatsThisText(QPoint p) |
148 | { | 148 | { |
149 | QListBoxItem* item = itemAt ( p ); | 149 | QListBoxItem* item = itemAt ( p ); |
150 | if ( ! item ) { | 150 | if ( ! item ) { |
151 | return i18n("Click in the cell\nto add an event!"); | 151 | return i18n("Click in the cell\nto add an event!"); |
152 | } | 152 | } |
153 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), | 153 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), |
154 | KOPrefs::instance()->mWTshowDetails, | 154 | KOPrefs::instance()->mWTshowDetails, |
155 | KOPrefs::instance()->mWTshowCreated, | 155 | KOPrefs::instance()->mWTshowCreated, |
156 | KOPrefs::instance()->mWTshowChanged); | 156 | KOPrefs::instance()->mWTshowChanged); |
157 | } | 157 | } |
158 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | 158 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) |
159 | { | 159 | { |
160 | //qDebug("KNoScrollListBox::keyPressEvent "); | 160 | //qDebug("KNoScrollListBox::keyPressEvent "); |
161 | switch(e->key()) { | 161 | switch(e->key()) { |
162 | case Key_Right: | 162 | case Key_Right: |
163 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 163 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
164 | { | 164 | { |
165 | e->ignore(); | 165 | e->ignore(); |
166 | return; | 166 | return; |
167 | } | 167 | } |
168 | scrollBy(10,0); | 168 | scrollBy(10,0); |
169 | break; | 169 | break; |
170 | case Key_Left: | 170 | case Key_Left: |
171 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 171 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
172 | { | 172 | { |
173 | e->ignore(); | 173 | e->ignore(); |
174 | return; | 174 | return; |
175 | } | 175 | } |
176 | scrollBy(-10,0); | 176 | scrollBy(-10,0); |
177 | break; | 177 | break; |
178 | case Key_Up: | 178 | case Key_Up: |
179 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 179 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
180 | e->ignore(); | 180 | e->ignore(); |
181 | break; | 181 | break; |
182 | } | 182 | } |
183 | if ( count() ) { | 183 | if ( count() ) { |
184 | if ( currentItem() == 0 ) { | 184 | if ( currentItem() == 0 ) { |
185 | emit prevCell(); | 185 | emit prevCell(); |
186 | } else { | 186 | } else { |
187 | setCurrentItem((currentItem()+count()-1)%count()); | 187 | setCurrentItem((currentItem()+count()-1)%count()); |
188 | if(!itemVisible(currentItem())) { | 188 | if(!itemVisible(currentItem())) { |
189 | if((unsigned int) currentItem() == (count()-1)) { | 189 | if((unsigned int) currentItem() == (count()-1)) { |
190 | setTopItem(currentItem()-numItemsVisible()+1); | 190 | setTopItem(currentItem()-numItemsVisible()+1); |
191 | } else { | 191 | } else { |
192 | setTopItem(topItem()-1); | 192 | setTopItem(topItem()-1); |
193 | } | 193 | } |
194 | } | 194 | } |
195 | } | 195 | } |
196 | } | 196 | } |
197 | break; | 197 | break; |
198 | case Key_Down: | 198 | case Key_Down: |
199 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 199 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
200 | e->ignore(); | 200 | e->ignore(); |
201 | break; | 201 | break; |
202 | } | 202 | } |
203 | if ( count () ) { | 203 | if ( count () ) { |
204 | if ( currentItem()+1 == count () ) { | 204 | if ( currentItem()+1 == count () ) { |
205 | emit nextCell(); | 205 | emit nextCell(); |
206 | } else { | 206 | } else { |
207 | setCurrentItem((currentItem()+1)%count()); | 207 | setCurrentItem((currentItem()+1)%count()); |
208 | if(!itemVisible(currentItem())) { | 208 | if(!itemVisible(currentItem())) { |
209 | if(currentItem() == 0) { | 209 | if(currentItem() == 0) { |
210 | setTopItem(0); | 210 | setTopItem(0); |
211 | } else { | 211 | } else { |
212 | setTopItem(topItem()+1); | 212 | setTopItem(topItem()+1); |
213 | } | 213 | } |
214 | } | 214 | } |
215 | } | 215 | } |
216 | } | 216 | } |
217 | break; | 217 | break; |
218 | case Key_I: | 218 | case Key_I: |
219 | QTimer::singleShot( 1, this, SLOT ( oneDown() ) ); | 219 | QTimer::singleShot( 1, this, SLOT ( oneDown() ) ); |
220 | e->ignore(); | 220 | e->ignore(); |
221 | break; | 221 | break; |
222 | case Key_Return: | 222 | case Key_Return: |
223 | case Key_Enter: | 223 | case Key_Enter: |
224 | { | 224 | { |
225 | if ( currentItem() >= 0 ) { | 225 | if ( currentItem() >= 0 ) { |
226 | emit doubleClicked( item( currentItem() ) ); | 226 | emit doubleClicked( item( currentItem() ) ); |
227 | e->accept(); | 227 | e->accept(); |
228 | } else { | 228 | } else { |
229 | e->ignore(); | 229 | e->ignore(); |
230 | } | 230 | } |
231 | } | 231 | } |
232 | break; | 232 | break; |
233 | case Key_Shift: | 233 | case Key_Shift: |
234 | emit shiftDown(); | 234 | emit shiftDown(); |
235 | break; | 235 | break; |
236 | default: | 236 | default: |
237 | e->ignore(); | 237 | e->ignore(); |
238 | break; | 238 | break; |
239 | } | 239 | } |
240 | } | 240 | } |
241 | 241 | ||
242 | void KNoScrollListBox::oneDown() | 242 | void KNoScrollListBox::oneDown() |
243 | { | 243 | { |
244 | if ( count () ) { | 244 | if ( count () ) { |
245 | if ( currentItem()+1 == count () ) { | 245 | if ( currentItem()+1 == count () ) { |
246 | emit nextCell(); | 246 | emit nextCell(); |
247 | } else { | 247 | } else { |
248 | resetOnFocusIn = false; | 248 | resetOnFocusIn = false; |
249 | setCurrentItem((currentItem()+1)%count()); | 249 | setCurrentItem((currentItem()+1)%count()); |
250 | if(!itemVisible(currentItem())) { | 250 | if(!itemVisible(currentItem())) { |
251 | if(currentItem() == 0) { | 251 | if(currentItem() == 0) { |
252 | setTopItem(0); | 252 | setTopItem(0); |
253 | } else { | 253 | } else { |
254 | setTopItem(topItem()+1); | 254 | setTopItem(topItem()+1); |
255 | } | 255 | } |
256 | } | 256 | } |
257 | } | 257 | } |
258 | } | 258 | } |
259 | } | 259 | } |
260 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) | 260 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) |
261 | { | 261 | { |
262 | switch(e->key()) { | 262 | switch(e->key()) { |
263 | case Key_Shift: | 263 | case Key_Shift: |
264 | emit shiftUp(); | 264 | emit shiftUp(); |
265 | break; | 265 | break; |
266 | default: | 266 | default: |
267 | break; | 267 | break; |
268 | } | 268 | } |
269 | } | 269 | } |
270 | 270 | ||
271 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | 271 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) |
272 | { | 272 | { |
273 | QListBox::mousePressEvent(e); | 273 | QListBox::mousePressEvent(e); |
274 | 274 | ||
275 | if(e->button() == RightButton) { | 275 | if(e->button() == RightButton) { |
276 | emit rightClick(); | 276 | emit rightClick(); |
277 | } | 277 | } |
278 | } | 278 | } |
279 | 279 | ||
280 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) | 280 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) |
281 | : QListBoxItem() | 281 | : QListBoxItem() |
282 | { | 282 | { |
283 | mblockRepaint = true; | 283 | mblockRepaint = true; |
284 | setText( s ); | 284 | setText( s ); |
285 | mMultiday = 0; | 285 | mMultiday = 0; |
286 | mIncidence = incidence; | 286 | mIncidence = incidence; |
287 | mDate = qd; | 287 | mDate = qd; |
288 | mRecur = false; | 288 | mRecur = false; |
289 | mAlarm = false; | 289 | mAlarm = false; |
290 | mReply = false; | 290 | mReply = false; |
291 | mInfo = false; | 291 | mInfo = false; |
292 | mdayPos = 0; | 292 | mdayPos = 0; |
293 | isWeekItem = KOPrefs::instance()->mMonthViewWeek; | 293 | isWeekItem = KOPrefs::instance()->mMonthViewWeek; |
294 | } | 294 | } |
295 | void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s) | 295 | void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s) |
296 | { | 296 | { |
297 | setText( s ); | 297 | setText( s ); |
298 | mMultiday = 0; | 298 | mMultiday = 0; |
299 | mIncidence = incidence; | 299 | mIncidence = incidence; |
300 | mDate = qd; | 300 | mDate = qd; |
301 | mRecur = false; | 301 | mRecur = false; |
302 | mAlarm = false; | 302 | mAlarm = false; |
303 | mReply = false; | 303 | mReply = false; |
304 | mInfo = false; | 304 | mInfo = false; |
305 | mdayPos = 0; | 305 | mdayPos = 0; |
306 | } | 306 | } |
307 | 307 | ||
308 | void MonthViewItem::paint(QPainter *p) | 308 | void MonthViewItem::paint(QPainter *p) |
309 | { | 309 | { |
310 | if ( mblockRepaint ) { | 310 | if ( mblockRepaint ) { |
311 | return; | 311 | return; |
312 | } | 312 | } |
313 | #if QT_VERSION >= 0x030000 | 313 | #if QT_VERSION >= 0x030000 |
314 | bool sel = isSelected(); | 314 | bool sel = isSelected(); |
315 | #else | 315 | #else |
316 | bool sel = selected(); | 316 | bool sel = selected(); |
317 | #endif | 317 | #endif |
318 | 318 | ||
319 | 319 | ||
320 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) | 320 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) |
321 | { | 321 | { |
322 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 322 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
323 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); | 323 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); |
324 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); | 324 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); |
325 | } | 325 | } |
326 | int x = 1; | 326 | int x = 1; |
327 | //int y = 3;//(height() - mRecurPixmap.height()) /2; | 327 | //int y = 3;//(height() - mRecurPixmap.height()) /2; |
328 | int size = PIXMAP_SIZE; | 328 | int size = PIXMAP_SIZE; |
329 | if ( QApplication::desktop()->width() < 300 ) | 329 | if ( QApplication::desktop()->width() < 300 ) |
330 | size = 3; | 330 | size = 3; |
331 | int heihei = height( listBox () ); | 331 | int heihei = height( listBox () ); |
332 | int y = (heihei - size -1 ) /2; | 332 | int y = (heihei - size -1 ) /2; |
333 | 333 | ||
334 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 334 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
335 | if ( mInfo ) { | 335 | if ( mInfo ) { |
336 | p->fillRect ( x, y,size,size, Qt::darkGreen ); | 336 | p->fillRect ( x, y,size,size, Qt::darkGreen ); |
337 | x += size + 1; | 337 | x += size + 1; |
338 | } | 338 | } |
339 | if ( mRecur ) { | 339 | if ( mRecur ) { |
340 | p->fillRect ( x, y,size,size, Qt::blue ); | 340 | p->fillRect ( x, y,size,size, Qt::blue ); |
341 | x += size + 1; | 341 | x += size + 1; |
342 | } | 342 | } |
343 | if ( mAlarm ) { | 343 | if ( mAlarm ) { |
344 | p->fillRect ( x, y,size,size, Qt::red ); | 344 | p->fillRect ( x, y,size,size, Qt::red ); |
345 | x += size + 1; | 345 | x += size + 1; |
346 | } | 346 | } |
347 | if ( mReply ) { | 347 | if ( mReply ) { |
348 | p->fillRect ( x, y,size,size, Qt::yellow ); | 348 | p->fillRect ( x, y,size,size, Qt::yellow ); |
349 | x += size + 1; | 349 | x += size + 1; |
350 | } | 350 | } |
351 | } | 351 | } |
352 | if ( mMultiday ) { | 352 | if ( mMultiday ) { |
353 | int yyy = y+(size/2); | 353 | int yyy = y+(size/2); |
354 | int sizeM = size+2; | 354 | int sizeM = size+2; |
355 | p->setBrush( QBrush::SolidPattern ); | 355 | p->setBrush( QBrush::SolidPattern ); |
356 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; | 356 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; |
357 | if ( mMultiday == 2 || mMultiday == 3 ) { | 357 | if ( mMultiday == 2 || mMultiday == 3 ) { |
358 | QPointArray pa ( 3 ); | 358 | QPointArray pa ( 3 ); |
359 | pa.setPoint (0, x, yyy ); | 359 | pa.setPoint (0, x, yyy ); |
360 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); | 360 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); |
361 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); | 361 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); |
362 | p->drawPolygon( pa ); | 362 | p->drawPolygon( pa ); |
363 | } | 363 | } |
364 | if ( mMultiday == 2 || mMultiday == 1 ) { | 364 | if ( mMultiday == 2 || mMultiday == 1 ) { |
365 | QPointArray pa ( 3 ); | 365 | QPointArray pa ( 3 ); |
366 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); | 366 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); |
367 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); | 367 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); |
368 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); | 368 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); |
369 | p->drawPolygon( pa ); | 369 | p->drawPolygon( pa ); |
370 | } | 370 | } |
371 | if ( mMultiday == 1 ) { | 371 | if ( mMultiday == 1 ) { |
372 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 372 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
373 | 373 | ||
374 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); | 374 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); |
375 | } | 375 | } |
376 | if ( mMultiday == 3 ) { | 376 | if ( mMultiday == 3 ) { |
377 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 377 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
378 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); | 378 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); |
379 | 379 | ||
380 | } | 380 | } |
381 | x += sizeM/2 + 1; | 381 | x += sizeM/2 + 1; |
382 | x += sizeM + 1; | 382 | x += sizeM + 1; |
383 | } | 383 | } |
384 | 384 | ||
385 | if ( mIncidence->typeID() == todoID ){ | 385 | if ( mIncidence->typeID() == todoID ){ |
386 | Todo* td = ( Todo* ) mIncidence; | 386 | Todo* td = ( Todo* ) mIncidence; |
387 | if ( td->isCompleted() ) { | 387 | if ( td->isCompleted() ) { |
388 | int half = size/2; | 388 | int half = size/2; |
389 | p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; | 389 | p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; |
390 | p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; | 390 | p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; |
391 | x += half+half + 4; | 391 | x += half+half + 4; |
392 | 392 | ||
393 | } else { | 393 | } else { |
394 | int val = td->percentComplete()/20; | 394 | int val = td->percentComplete()/20; |
395 | p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); | 395 | p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); |
396 | p->drawRect ( x, y-2,7,size+4); | 396 | p->drawRect ( x, y-2,7,size+4); |
397 | x += size + 3; | 397 | x += size + 3; |
398 | } | 398 | } |
399 | } | 399 | } |
400 | QFontMetrics fm = p->fontMetrics(); | 400 | QFontMetrics fm = p->fontMetrics(); |
401 | int yPos; | 401 | int yPos; |
402 | int pmheight = size; | 402 | int pmheight = size; |
403 | if( pmheight < fm.height() ) | 403 | if( pmheight < fm.height() ) |
404 | yPos = fm.ascent() + fm.leading()/2; | 404 | yPos = fm.ascent() + fm.leading()/2; |
405 | else | 405 | else |
406 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 406 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
407 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 407 | p->setPen( palette().color( QPalette::Normal, sel ? \ |
408 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | 408 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); |
409 | if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) { | 409 | if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) { |
410 | p->drawText( x, yPos, text() ); | 410 | p->drawText( x, yPos, text() ); |
411 | if ( mIncidence->cancelled() ) { | 411 | if ( mIncidence->cancelled() ) { |
412 | int wid = fm.width( text() ); | 412 | int wid = fm.width( text() ); |
413 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); | 413 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); |
414 | } | 414 | } |
415 | } else { | 415 | } else { |
416 | QString pText = text(); | 416 | QString pText = text(); |
417 | if( pText.mid(2,1) == ":" ) | 417 | if( pText.mid(2,1) == ":" ) |
418 | pText = pText.mid( 6 ); | 418 | pText = pText.mid( 6 ); |
419 | p->drawText( x, yPos, pText ); | 419 | p->drawText( x, yPos, pText ); |
420 | if ( mIncidence->cancelled() ) { | 420 | if ( mIncidence->cancelled() ) { |
421 | int wid = fm.width( pText ); | 421 | int wid = fm.width( pText ); |
422 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); | 422 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); |
423 | } | 423 | } |
424 | } | 424 | } |
425 | } | 425 | } |
426 | 426 | ||
427 | int MonthViewItem::height(const QListBox *lb) const | 427 | int MonthViewItem::height(const QListBox *lb) const |
428 | { | 428 | { |
429 | int ret = 10; | 429 | int ret = 10; |
430 | if ( lb ) | 430 | if ( lb ) |
431 | ret = lb->fontMetrics().lineSpacing()+1; | 431 | ret = lb->fontMetrics().lineSpacing()+1; |
432 | return ret; | 432 | return ret; |
433 | } | 433 | } |
434 | 434 | ||
435 | int MonthViewItem::width(const QListBox *lb) const | 435 | int MonthViewItem::width(const QListBox *lb) const |
436 | { | 436 | { |
437 | if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) { | 437 | if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) { |
438 | int size = PIXMAP_SIZE; | 438 | int size = PIXMAP_SIZE; |
439 | if ( QApplication::desktop()->width() < 300 ) | 439 | if ( QApplication::desktop()->width() < 300 ) |
440 | size = 3; | 440 | size = 3; |
441 | int x = 1; | 441 | int x = 1; |
442 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 442 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
443 | if ( mInfo ) { | 443 | if ( mInfo ) { |
444 | x += size + 1; | 444 | x += size + 1; |
445 | } | 445 | } |
446 | if( mRecur ) { | 446 | if( mRecur ) { |
447 | x += size+1; | 447 | x += size+1; |
448 | } | 448 | } |
449 | if( mAlarm ) { | 449 | if( mAlarm ) { |
450 | x += size+1; | 450 | x += size+1; |
451 | } | 451 | } |
452 | if( mReply ) { | 452 | if( mReply ) { |
453 | x += size+1; | 453 | x += size+1; |
454 | } | 454 | } |
455 | } | 455 | } |
456 | if( mMultiday ) { | 456 | if( mMultiday ) { |
457 | x += size+1+2+size/2; | 457 | x += size+1+2+size/2; |
458 | } | 458 | } |
459 | return( x + lb->fontMetrics().width( text() ) + 1 ); | 459 | return( x + lb->fontMetrics().width( text() ) + 1 ); |
460 | } | 460 | } |
461 | if ( ! lb ) | 461 | if ( ! lb ) |
462 | return 10; | 462 | return 10; |
463 | return lb->width(); | 463 | return lb->width(); |
464 | } | 464 | } |
465 | 465 | ||
466 | 466 | ||
467 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) | 467 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) |
468 | : KNoScrollListBox( par ), | 468 | : KNoScrollListBox( par ), |
469 | mMonthView( parent ) | 469 | mMonthView( parent ) |
470 | { | 470 | { |
471 | //QVBoxLayout *topLayout = new QVBoxLayout( this ); | 471 | //QVBoxLayout *topLayout = new QVBoxLayout( this ); |
472 | currentPalette = 0; | 472 | currentPalette = 0; |
473 | // mLabel = new QLabel( this );QPushButton | 473 | // mLabel = new QLabel( this );QPushButton |
474 | mLabel = new QPushButton( this ); | 474 | mLabel = new QPushButton( this ); |
475 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 475 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
476 | //mLabel->setLineWidth( 1 ); | 476 | //mLabel->setLineWidth( 1 ); |
477 | //mLabel->setAlignment( AlignCenter ); | 477 | //mLabel->setAlignment( AlignCenter ); |
478 | mLabel->setFlat( true ); | 478 | mLabel->setFlat( true ); |
479 | mLabel->setFocusPolicy(NoFocus); | 479 | mLabel->setFocusPolicy(NoFocus); |
480 | //mItemList = new KNoScrollListBox( this ); | 480 | //mItemList = new KNoScrollListBox( this ); |
481 | setMinimumSize( 10, 10 ); | 481 | setMinimumSize( 10, 10 ); |
482 | setFrameStyle( QFrame::Panel | QFrame::Plain ); | 482 | setFrameStyle( QFrame::Panel | QFrame::Plain ); |
483 | setLineWidth( 1 ); | 483 | setLineWidth( 1 ); |
484 | //topLayout->addWidget( mItemList ); | 484 | //topLayout->addWidget( mItemList ); |
485 | mLabel->raise(); | 485 | mLabel->raise(); |
486 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) | 486 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) |
487 | mStandardPalette = palette(); | 487 | mStandardPalette = palette(); |
488 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); | 488 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); |
489 | 489 | ||
490 | enableScrollBars( false ); | 490 | enableScrollBars( false ); |
491 | updateConfig(); | 491 | updateConfig(); |
492 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); | 492 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); |
493 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); | 493 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); |
494 | connect( this , SIGNAL( doubleClicked( QListBoxItem *) ), | 494 | connect( this , SIGNAL( doubleClicked( QListBoxItem *) ), |
495 | SLOT( defaultAction( QListBoxItem * ) ) ); | 495 | SLOT( defaultAction( QListBoxItem * ) ) ); |
496 | connect( this, SIGNAL( rightButtonPressed( QListBoxItem *, | 496 | connect( this, SIGNAL( rightButtonPressed( QListBoxItem *, |
497 | const QPoint &) ), | 497 | const QPoint &) ), |
498 | SLOT( contextMenu( QListBoxItem * ) ) ); | 498 | SLOT( contextMenu( QListBoxItem * ) ) ); |
499 | connect( this, SIGNAL( highlighted( QListBoxItem *) ), | 499 | connect( this, SIGNAL( highlighted( QListBoxItem *) ), |
500 | SLOT( selection( QListBoxItem * ) ) ); | 500 | SLOT( selection( QListBoxItem * ) ) ); |
501 | 501 | ||
502 | /* | 502 | /* |
503 | connect( this, SIGNAL( clicked( QListBoxItem * ) ), | 503 | connect( this, SIGNAL( clicked( QListBoxItem * ) ), |
504 | SLOT( selection( QListBoxItem * ) ) ); | 504 | SLOT( selection( QListBoxItem * ) ) ); |
505 | */ | 505 | */ |
506 | } | 506 | } |
507 | #ifdef DESKTOP_VERSION | 507 | #ifdef DESKTOP_VERSION |
508 | QToolTipGroup *MonthViewCell::toolTipGroup() | 508 | QToolTipGroup *MonthViewCell::toolTipGroup() |
509 | { | 509 | { |
510 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 510 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
511 | return mToolTipGroup; | 511 | return mToolTipGroup; |
512 | } | 512 | } |
513 | #endif | 513 | #endif |
514 | 514 | ||
515 | void MonthViewCell::setDate( const QDate &date ) | 515 | void MonthViewCell::setDate( const QDate &date ) |
516 | { | 516 | { |
517 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; | 517 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; |
518 | mDate = date; | 518 | mDate = date; |
519 | 519 | ||
520 | 520 | ||
521 | 521 | ||
522 | //resizeEvent( 0 ); | 522 | //resizeEvent( 0 ); |
523 | } | 523 | } |
524 | 524 | ||
525 | QDate MonthViewCell::date() const | 525 | QDate MonthViewCell::date() const |
526 | { | 526 | { |
527 | return mDate; | 527 | return mDate; |
528 | } | 528 | } |
529 | 529 | ||
530 | void MonthViewCell::setPrimary( bool primary ) | 530 | void MonthViewCell::setPrimary( bool primary ) |
531 | { | 531 | { |
532 | mPrimary = primary; | 532 | mPrimary = primary; |
533 | //setMyPalette(); | 533 | //setMyPalette(); |
534 | } | 534 | } |
535 | void MonthViewCell::setMyPalette() | 535 | void MonthViewCell::setMyPalette() |
536 | { | 536 | { |
537 | 537 | ||
538 | if ( mHoliday) { | 538 | if ( mHoliday) { |
539 | if ( currentPalette == 1 ) return; | 539 | if ( currentPalette == 1 ) return; |
540 | mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) )); | 540 | mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) )); |
541 | setPalette( mHolidayPalette ); | 541 | setPalette( mHolidayPalette ); |
542 | //mLabel->setPalette( mHolidayPalette ); | 542 | //mLabel->setPalette( mHolidayPalette ); |
543 | currentPalette = 1; | 543 | currentPalette = 1; |
544 | 544 | ||
545 | } else { | 545 | } else { |
546 | if ( mPrimary ) { | 546 | if ( mPrimary ) { |
547 | if ( currentPalette == 2 ) return; | 547 | if ( currentPalette == 2 ) return; |
548 | mLabel->setPalette( QPalette ( mPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); | 548 | mLabel->setPalette( QPalette ( mPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); |
549 | //mLabel->setPalette( mPrimaryPalette ); | 549 | //mLabel->setPalette( mPrimaryPalette ); |
550 | setPalette( mPrimaryPalette ); | 550 | setPalette( mPrimaryPalette ); |
551 | currentPalette = 2; | 551 | currentPalette = 2; |
552 | 552 | ||
553 | } else { | 553 | } else { |
554 | if ( currentPalette == 3 ) return; | 554 | if ( currentPalette == 3 ) return; |
555 | setPalette( mNonPrimaryPalette ); | 555 | setPalette( mNonPrimaryPalette ); |
556 | mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); | 556 | mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); |
557 | //mLabel->setPalette( mNonPrimaryPalette );; | 557 | //mLabel->setPalette( mNonPrimaryPalette );; |
558 | currentPalette = 3; | 558 | currentPalette = 3; |
559 | } | 559 | } |
560 | } | 560 | } |
561 | //QPalette pal = palette(); | 561 | //QPalette pal = palette(); |
562 | 562 | ||
563 | //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); | 563 | //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); |
564 | } | 564 | } |
565 | QPalette MonthViewCell::getPalette () | 565 | QPalette MonthViewCell::getPalette () |
566 | { | 566 | { |
567 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) | 567 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) |
568 | return mStandardPalette; | 568 | return mStandardPalette; |
569 | if ( mHoliday) { | 569 | if ( mHoliday) { |
570 | return mHolidayPalette ; | 570 | return mHolidayPalette ; |
571 | } else { | 571 | } else { |
572 | if ( mPrimary ) { | 572 | if ( mPrimary ) { |
573 | return mPrimaryPalette ; | 573 | return mPrimaryPalette ; |
574 | } | 574 | } |
575 | } | 575 | } |
576 | return mNonPrimaryPalette; | 576 | return mNonPrimaryPalette; |
577 | } | 577 | } |
578 | bool MonthViewCell::isPrimary() const | 578 | bool MonthViewCell::isPrimary() const |
579 | { | 579 | { |
580 | return mPrimary; | 580 | return mPrimary; |
581 | } | 581 | } |
582 | 582 | ||
583 | void MonthViewCell::setHoliday( bool holiday ) | 583 | void MonthViewCell::setHoliday( bool holiday ) |
584 | { | 584 | { |
585 | mHoliday = holiday; | 585 | mHoliday = holiday; |
586 | //setMyPalette(); | 586 | //setMyPalette(); |
587 | } | 587 | } |
588 | 588 | ||
589 | void MonthViewCell::setHoliday( const QString &holiday ) | 589 | void MonthViewCell::setHoliday( const QString &holiday ) |
590 | { | 590 | { |
591 | mHolidayString = holiday; | 591 | mHolidayString = holiday; |
592 | 592 | ||
593 | if ( !holiday.isEmpty() ) { | 593 | if ( !holiday.isEmpty() ) { |
594 | setHoliday( true ); | 594 | setHoliday( true ); |
595 | } | 595 | } |
596 | } | 596 | } |
597 | 597 | ||
598 | void MonthViewCell::startUpdateCell() | 598 | void MonthViewCell::startUpdateCell() |
599 | { | 599 | { |
600 | mdayCount = 0; | 600 | mdayCount = 0; |
601 | setFocusPolicy(NoFocus); | 601 | setFocusPolicy(NoFocus); |
602 | if ( !mMonthView->isUpdatePossible() ) | 602 | if ( !mMonthView->isUpdatePossible() ) |
603 | return; | 603 | return; |
604 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 604 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
605 | while ( mitem ) { | 605 | while ( mitem ) { |
606 | mitem->setBlockRepaint( true ); | 606 | mitem->setBlockRepaint( true ); |
607 | mitem = (MonthViewItem *)mitem->next(); | 607 | mitem = (MonthViewItem *)mitem->next(); |
608 | } | 608 | } |
609 | if ( mAvailItemList.count() > 20 ) { | 609 | if ( mAvailItemList.count() > 20 ) { |
610 | mAvailItemList.setAutoDelete( true ); | 610 | mAvailItemList.setAutoDelete( true ); |
611 | mAvailItemList.clear(); | 611 | mAvailItemList.clear(); |
612 | mAvailItemList.setAutoDelete( false ); | 612 | mAvailItemList.setAutoDelete( false ); |
613 | } | 613 | } |
614 | 614 | ||
615 | setPrimary( mDate.month()%2 ); | 615 | setPrimary( mDate.month()%2 ); |
616 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 616 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
617 | if ( mDate == QDate::currentDate() ) { | 617 | if ( mDate == QDate::currentDate() ) { |
618 | setLineWidth( 3 ); | 618 | setLineWidth( 3 ); |
619 | } else { | 619 | } else { |
620 | setLineWidth( 1 ); | 620 | setLineWidth( 1 ); |
621 | } | 621 | } |
622 | MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem (); | 622 | MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem (); |
623 | //clear(); | 623 | //clear(); |
624 | while ( CurrentAvailItem ) { | 624 | while ( CurrentAvailItem ) { |
625 | MonthViewItem *item = CurrentAvailItem; | 625 | MonthViewItem *item = CurrentAvailItem; |
626 | CurrentAvailItem = (MonthViewItem *)item->next(); | 626 | CurrentAvailItem = (MonthViewItem *)item->next(); |
627 | mAvailItemList.append( item ); | 627 | mAvailItemList.append( item ); |
628 | takeItem ( item ); | 628 | takeItem ( item ); |
629 | } | 629 | } |
630 | 630 | ||
631 | #ifdef DESKTOP_VERSION | 631 | #ifdef DESKTOP_VERSION |
632 | QToolTip::remove(this); | 632 | QToolTip::remove(this); |
633 | #endif | 633 | #endif |
634 | mToolTip.clear(); | 634 | mToolTip.clear(); |
635 | //qApp->processEvents(); | 635 | //qApp->processEvents(); |
636 | #if 0 | 636 | #if 0 |
637 | if ( !mHolidayString.isEmpty() ) { | 637 | if ( !mHolidayString.isEmpty() ) { |
638 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 638 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
639 | item->setPalette( mHolidayPalette ); | 639 | item->setPalette( mHolidayPalette ); |
640 | insertItem( item ); | 640 | insertItem( item ); |
641 | mToolTip.append ( mHolidayString ); | 641 | mToolTip.append ( mHolidayString ); |
642 | } | 642 | } |
643 | #endif | 643 | #endif |
644 | } | 644 | } |
645 | 645 | ||
646 | int MonthViewCell::insertEvent(Event *event) | 646 | int MonthViewCell::insertEvent(Event *event) |
647 | { | 647 | { |
648 | bool useToolTips = true; | 648 | bool useToolTips = true; |
649 | #ifndef DESKTOP_VERSION | 649 | #ifndef DESKTOP_VERSION |
650 | useToolTips = false; | 650 | useToolTips = false; |
651 | #endif | 651 | #endif |
652 | QString mToolTipText; | 652 | QString mToolTipText; |
653 | setFocusPolicy(WheelFocus); | 653 | setFocusPolicy(WheelFocus); |
654 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 654 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
655 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 655 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
656 | return mdayCount; | 656 | return mdayCount; |
657 | else | 657 | else |
658 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | 658 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) |
659 | return mdayCount; | 659 | return mdayCount; |
660 | } | 660 | } |
661 | 661 | ||
662 | if ( event->isHoliday()) { | 662 | if ( event->isHoliday()) { |
663 | setHoliday( true ); | 663 | setHoliday( true ); |
664 | if ( mDate.dayOfWeek() == 7 ) | 664 | if ( mDate.dayOfWeek() == 7 ) |
665 | setLineWidth( 3 ); | 665 | setLineWidth( 3 ); |
666 | } | 666 | } |
667 | QString text; | 667 | QString text; |
668 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day | 668 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day |
669 | if (event->isMultiDay()) { | 669 | if (event->isMultiDay()) { |
670 | QString prefix = "<->";multiday = 2; | 670 | QString prefix = "<->";multiday = 2; |
671 | QString time; | 671 | QString time; |
672 | if ( event->doesRecur() ) { | 672 | if ( event->doesRecur() ) { |
673 | if ( event->recursOn( mDate) ) { | 673 | if ( event->recursOn( mDate) ) { |
674 | prefix ="->" ;multiday = 1; | 674 | prefix ="->" ;multiday = 1; |
675 | } | 675 | } |
676 | else { | 676 | else { |
677 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 677 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
678 | if ( event->recursOn( mDate.addDays( -days)) ) { | 678 | if ( event->recursOn( mDate.addDays( -days)) ) { |
679 | prefix ="<-" ;multiday = 3; | 679 | prefix ="<-" ;multiday = 3; |
680 | } | 680 | } |
681 | } | 681 | } |
682 | 682 | ||
683 | } else { | 683 | } else { |
684 | if (mDate == event->dtStart().date()) { | 684 | if (mDate == event->dtStart().date()) { |
685 | prefix ="->" ;multiday = 1; | 685 | prefix ="->" ;multiday = 1; |
686 | } else if (mDate == event->dtEnd().date()) { | 686 | } else if (mDate == event->dtEnd().date()) { |
687 | prefix ="<-" ;multiday = 3; | 687 | prefix ="<-" ;multiday = 3; |
688 | } | 688 | } |
689 | } | 689 | } |
690 | if ( !event->doesFloat() ) { | 690 | if ( !event->doesFloat() ) { |
691 | if ( mDate == event->dtStart().date () ) | 691 | if ( mDate == event->dtStart().date () ) |
692 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 692 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
693 | else if ( mDate == event->dtEnd().date () ) | 693 | else if ( mDate == event->dtEnd().date () ) |
694 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | 694 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; |
695 | 695 | ||
696 | } | 696 | } |
697 | text = time + event->summary(); | 697 | text = time + event->summary(); |
698 | if ( useToolTips ) | 698 | if ( useToolTips ) |
699 | mToolTipText += prefix + text; | 699 | mToolTipText += prefix + text; |
700 | } else { | 700 | } else { |
701 | if (event->doesFloat()) { | 701 | if (event->doesFloat()) { |
702 | text = event->summary(); | 702 | text = event->summary(); |
703 | if ( useToolTips ) | 703 | if ( useToolTips ) |
704 | mToolTipText += text; | 704 | mToolTipText += text; |
705 | } | 705 | } |
706 | else { | 706 | else { |
707 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 707 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
708 | text += " " + event->summary(); | 708 | text += " " + event->summary(); |
709 | if ( useToolTips ) | 709 | if ( useToolTips ) |
710 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 710 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
711 | } | 711 | } |
712 | } | 712 | } |
713 | if ( useToolTips && ! event->location().isEmpty() ) { | 713 | if ( useToolTips && ! event->location().isEmpty() ) { |
714 | mToolTipText += " (" + event->location() +")"; | 714 | mToolTipText += " (" + event->location() +")"; |
715 | } | 715 | } |
716 | MonthViewItem *item ; | 716 | MonthViewItem *item ; |
717 | 717 | ||
718 | if ( mAvailItemList.count() ) { | 718 | if ( mAvailItemList.count() ) { |
719 | item = mAvailItemList.first(); | 719 | item = mAvailItemList.first(); |
720 | mAvailItemList.remove( item ); | 720 | mAvailItemList.remove( item ); |
721 | item->recycle( event, mDate, text ); | 721 | item->recycle( event, mDate, text ); |
722 | } else { | 722 | } else { |
723 | item = new MonthViewItem( event, mDate, text ); | 723 | item = new MonthViewItem( event, mDate, text ); |
724 | } | 724 | } |
725 | 725 | ||
726 | QPalette pal; | 726 | QPalette pal; |
727 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 727 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
728 | QStringList categories = event->categories(); | 728 | QStringList categories = event->categories(); |
729 | QString cat = categories.first(); | 729 | QString cat = categories.first(); |
730 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 730 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
731 | pal = getPalette(); | 731 | pal = getPalette(); |
732 | if (cat.isEmpty()) { | 732 | if (cat.isEmpty()) { |
733 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 733 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
734 | } else { | 734 | } else { |
735 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 735 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
736 | } | 736 | } |
737 | 737 | ||
738 | } else { | 738 | } else { |
739 | if (cat.isEmpty()) { | 739 | if (cat.isEmpty()) { |
740 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 740 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
741 | } else { | 741 | } else { |
742 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 742 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
743 | } | 743 | } |
744 | } | 744 | } |
745 | 745 | ||
746 | } else { | 746 | } else { |
747 | pal = mStandardPalette ; | 747 | pal = mStandardPalette ; |
748 | } | 748 | } |
749 | item->setPalette( pal ); | 749 | item->setPalette( pal ); |
750 | item->setRecur( event->recurrence()->doesRecur() ); | 750 | item->setRecur( event->recurrence()->doesRecur() ); |
751 | item->setAlarm( event->isAlarmEnabled() && multiday < 2 ); | 751 | item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() ); |
752 | item->setMoreInfo( event->description().length() > 0 ); | 752 | item->setMoreInfo( event->description().length() > 0 ); |
753 | #ifdef DESKTOP_VERSION | 753 | #ifdef DESKTOP_VERSION |
754 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 754 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
755 | KOPrefs::instance()->email()); | 755 | KOPrefs::instance()->email()); |
756 | if ( me != 0 ) { | 756 | if ( me != 0 ) { |
757 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 757 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
758 | item->setReply(true && multiday < 2); | 758 | item->setReply(true && multiday < 2); |
759 | else | 759 | else |
760 | item->setReply(false); | 760 | item->setReply(false); |
761 | } else | 761 | } else |
762 | item->setReply(false); | 762 | item->setReply(false); |
763 | #endif | 763 | #endif |
764 | item->setMultiDay( multiday ); | 764 | item->setMultiDay( multiday ); |
765 | if ( multiday ) { | 765 | if ( multiday ) { |
766 | insertItem( item ,mdayCount); | 766 | insertItem( item ,mdayCount); |
767 | ++mdayCount; | 767 | ++mdayCount; |
768 | } else { | 768 | } else { |
769 | uint i; | 769 | uint i; |
770 | int pos = mdayCount; | 770 | int pos = mdayCount; |
771 | for ( i = mdayCount; i < count();++i ) { | 771 | for ( i = mdayCount; i < count();++i ) { |
772 | QListBoxItem* it = this->item ( i ); | 772 | QListBoxItem* it = this->item ( i ); |
773 | if ( it && text < it->text() ) { | 773 | if ( it && text < it->text() ) { |
774 | pos = i; | 774 | pos = i; |
775 | break; | 775 | break; |
776 | } | 776 | } |
777 | ++pos; | 777 | ++pos; |
778 | } | 778 | } |
779 | insertItem( item ,pos); | 779 | insertItem( item ,pos); |
780 | } | 780 | } |
781 | if ( useToolTips ) { | 781 | if ( useToolTips ) { |
782 | mToolTip.append( mToolTipText ); | 782 | mToolTip.append( mToolTipText ); |
783 | } | 783 | } |
784 | return mdayCount; | 784 | return mdayCount; |
785 | } | 785 | } |
786 | void MonthViewCell::insertTodo(Todo *todo) | 786 | void MonthViewCell::insertTodo(Todo *todo) |
787 | { | 787 | { |
788 | setFocusPolicy(WheelFocus); | 788 | setFocusPolicy(WheelFocus); |
789 | QString text; | 789 | QString text; |
790 | if (todo->hasDueDate()) { | 790 | if (todo->hasDueDate()) { |
791 | if (!todo->doesFloat()) { | 791 | if (!todo->doesFloat()) { |
792 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 792 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
793 | text += " "; | 793 | text += " "; |
794 | } | 794 | } |
795 | } | 795 | } |
796 | text += todo->summary(); | 796 | text += todo->summary(); |
797 | MonthViewItem *item ; | 797 | MonthViewItem *item ; |
798 | if ( mAvailItemList.count() ) { | 798 | if ( mAvailItemList.count() ) { |
799 | item = mAvailItemList.first(); | 799 | item = mAvailItemList.first(); |
800 | mAvailItemList.remove( item ); | 800 | mAvailItemList.remove( item ); |
801 | item->recycle( todo, mDate, text ); | 801 | item->recycle( todo, mDate, text ); |
802 | } else { | 802 | } else { |
803 | item = new MonthViewItem( todo, mDate, text ); | 803 | item = new MonthViewItem( todo, mDate, text ); |
804 | } | 804 | } |
805 | //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 805 | //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
806 | //item->setPalette( mStandardPalette ); | 806 | //item->setPalette( mStandardPalette ); |
807 | QPalette pal; | 807 | QPalette pal; |
808 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 808 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
809 | QStringList categories = todo->categories(); | 809 | QStringList categories = todo->categories(); |
810 | QString cat = categories.first(); | 810 | QString cat = categories.first(); |
811 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 811 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
812 | pal = getPalette(); | 812 | pal = getPalette(); |
813 | if (cat.isEmpty()) { | 813 | if (cat.isEmpty()) { |
814 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 814 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
815 | } else { | 815 | } else { |
816 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 816 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
817 | } | 817 | } |
818 | 818 | ||
819 | } else { | 819 | } else { |
820 | if (cat.isEmpty()) { | 820 | if (cat.isEmpty()) { |
821 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 821 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
822 | } else { | 822 | } else { |
823 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 823 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
824 | } | 824 | } |
825 | } | 825 | } |
826 | 826 | ||
827 | } else { | 827 | } else { |
828 | pal = mStandardPalette ; | 828 | pal = mStandardPalette ; |
829 | } | 829 | } |
830 | item->setPalette( pal ); | 830 | item->setPalette( pal ); |
831 | item->setRecur( todo->recurrence()->doesRecur() ); | 831 | item->setRecur( todo->recurrence()->doesRecur() ); |
832 | item->setAlarm( todo->isAlarmEnabled() ); | 832 | item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() ); |
833 | item->setMoreInfo( todo->description().length() > 0 ); | 833 | item->setMoreInfo( todo->description().length() > 0 ); |
834 | insertItem( item , count()); | 834 | insertItem( item , count()); |
835 | #ifdef DESKTOP_VERSION | 835 | #ifdef DESKTOP_VERSION |
836 | mToolTip.append( text ); | 836 | mToolTip.append( text ); |
837 | #endif | 837 | #endif |
838 | } | 838 | } |
839 | void MonthViewCell::repaintfinishUpdateCell() | 839 | void MonthViewCell::repaintfinishUpdateCell() |
840 | { | 840 | { |
841 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 841 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
842 | while ( mitem ) { | 842 | while ( mitem ) { |
843 | mitem->setBlockRepaint( false ); | 843 | mitem->setBlockRepaint( false ); |
844 | updateItem ( mitem ); | 844 | updateItem ( mitem ); |
845 | mitem = (MonthViewItem *)mitem->next(); | 845 | mitem = (MonthViewItem *)mitem->next(); |
846 | } | 846 | } |
847 | } | 847 | } |
848 | void MonthViewCell::finishUpdateCell() | 848 | void MonthViewCell::finishUpdateCell() |
849 | { | 849 | { |
850 | 850 | ||
851 | 851 | ||
852 | 852 | ||
853 | #ifdef DESKTOP_VERSION | 853 | #ifdef DESKTOP_VERSION |
854 | if (mToolTip.count() > 0 ) { | 854 | if (mToolTip.count() > 0 ) { |
855 | mToolTip.sort(); | 855 | mToolTip.sort(); |
856 | QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); | 856 | QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); |
857 | } | 857 | } |
858 | #endif | 858 | #endif |
859 | //sort(); | 859 | //sort(); |
860 | //setMyPalette(); | 860 | //setMyPalette(); |
861 | setMyPalette(); | 861 | setMyPalette(); |
862 | 862 | ||
863 | resizeEvent( 0 ); | 863 | resizeEvent( 0 ); |
864 | 864 | ||
865 | } | 865 | } |
866 | void MonthViewCell::updateCell() | 866 | void MonthViewCell::updateCell() |
867 | { | 867 | { |
868 | if ( !mMonthView->isUpdatePossible() ) | 868 | if ( !mMonthView->isUpdatePossible() ) |
869 | return; | 869 | return; |
870 | startUpdateCell(); | 870 | startUpdateCell(); |
871 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 871 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
872 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 872 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
873 | Event *event; | 873 | Event *event; |
874 | for( event = events.first(); event; event = events.next() ) { // for event | 874 | for( event = events.first(); event; event = events.next() ) { // for event |
875 | insertEvent(event); | 875 | insertEvent(event); |
876 | } | 876 | } |
877 | // insert due todos | 877 | // insert due todos |
878 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); | 878 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); |
879 | Todo *todo; | 879 | Todo *todo; |
880 | for(todo = todos.first(); todo; todo = todos.next()) { | 880 | for(todo = todos.first(); todo; todo = todos.next()) { |
881 | insertTodo( todo ); | 881 | insertTodo( todo ); |
882 | } | 882 | } |
883 | finishUpdateCell(); | 883 | finishUpdateCell(); |
884 | // if ( isVisible()) | 884 | // if ( isVisible()) |
885 | //qApp->processEvents(); | 885 | //qApp->processEvents(); |
886 | } | 886 | } |
887 | 887 | ||
888 | void MonthViewCell::updateConfig( bool bigFont ) // = false | 888 | void MonthViewCell::updateConfig( bool bigFont ) // = false |
889 | { | 889 | { |
890 | 890 | ||
891 | if ( bigFont ) { | 891 | if ( bigFont ) { |
892 | QFont fo = KOPrefs::instance()->mMonthViewFont; | 892 | QFont fo = KOPrefs::instance()->mMonthViewFont; |
893 | int ps = fo.pointSize() + 2; | 893 | int ps = fo.pointSize() + 2; |
894 | if ( ps < 18 ) | 894 | if ( ps < 18 ) |
895 | ps += 2; | 895 | ps += 2; |
896 | fo.setPointSize( ps ); | 896 | fo.setPointSize( ps ); |
897 | setFont( fo ); | 897 | setFont( fo ); |
898 | } else | 898 | } else |
899 | setFont( KOPrefs::instance()->mMonthViewFont ); | 899 | setFont( KOPrefs::instance()->mMonthViewFont ); |
900 | 900 | ||
901 | QFontMetrics fm( font() ); | 901 | QFontMetrics fm( font() ); |
902 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); | 902 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); |
903 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); | 903 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); |
904 | mHolidayPalette = mStandardPalette; | 904 | mHolidayPalette = mStandardPalette; |
905 | mPrimaryPalette = mStandardPalette; | 905 | mPrimaryPalette = mStandardPalette; |
906 | mNonPrimaryPalette = mStandardPalette; | 906 | mNonPrimaryPalette = mStandardPalette; |
907 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { | 907 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { |
908 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); | 908 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); |
909 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); | 909 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); |
910 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); | 910 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); |
911 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); | 911 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); |
912 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); | 912 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); |
913 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); | 913 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); |
914 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); | 914 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); |
915 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); | 915 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); |
916 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); | 916 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); |
917 | } | 917 | } |
918 | //updateCell(); | 918 | //updateCell(); |
919 | } | 919 | } |
920 | 920 | ||
921 | void MonthViewCell::enableScrollBars( bool enabled ) | 921 | void MonthViewCell::enableScrollBars( bool enabled ) |
922 | { | 922 | { |
923 | 923 | ||
924 | return; | 924 | return; |
925 | if ( enabled ) { | 925 | if ( enabled ) { |
926 | QListBoxItem *fi = firstItem (); | 926 | QListBoxItem *fi = firstItem (); |
927 | if (fi ) { | 927 | if (fi ) { |
928 | int ihei = fi->height( this ); | 928 | int ihei = fi->height( this ); |
929 | int hei = numRows () * ihei; | 929 | int hei = numRows () * ihei; |
930 | if ( hei < height() - horizontalScrollBar()->height () ) { | 930 | if ( hei < height() - horizontalScrollBar()->height () ) { |
931 | setVScrollBarMode(QScrollView::AlwaysOff); | 931 | setVScrollBarMode(QScrollView::AlwaysOff); |
932 | } | 932 | } |
933 | else | 933 | else |
934 | setVScrollBarMode(QScrollView::Auto); | 934 | setVScrollBarMode(QScrollView::Auto); |
935 | if ( ihei *3 > height() ) { | 935 | if ( ihei *3 > height() ) { |
936 | setHScrollBarMode(QScrollView::AlwaysOff); | 936 | setHScrollBarMode(QScrollView::AlwaysOff); |
937 | } | 937 | } |
938 | else { | 938 | else { |
939 | setHScrollBarMode(QScrollView::Auto); | 939 | setHScrollBarMode(QScrollView::Auto); |
940 | } | 940 | } |
941 | } else { | 941 | } else { |
942 | setVScrollBarMode(QScrollView::Auto); | 942 | setVScrollBarMode(QScrollView::Auto); |
943 | setHScrollBarMode(QScrollView::Auto); | 943 | setHScrollBarMode(QScrollView::Auto); |
944 | } | 944 | } |
945 | } else { | 945 | } else { |
946 | setVScrollBarMode(QScrollView::AlwaysOff); | 946 | setVScrollBarMode(QScrollView::AlwaysOff); |
947 | setHScrollBarMode(QScrollView::AlwaysOff); | 947 | setHScrollBarMode(QScrollView::AlwaysOff); |
948 | } | 948 | } |
949 | } | 949 | } |
950 | 950 | ||
951 | Incidence *MonthViewCell::selectedIncidence() | 951 | Incidence *MonthViewCell::selectedIncidence() |
952 | { | 952 | { |
953 | int index = currentItem(); | 953 | int index = currentItem(); |
954 | if ( index < 0 ) return 0; | 954 | if ( index < 0 ) return 0; |
955 | 955 | ||
956 | MonthViewItem *mitem = | 956 | MonthViewItem *mitem = |
957 | static_cast<MonthViewItem *>( item( index ) ); | 957 | static_cast<MonthViewItem *>( item( index ) ); |
958 | 958 | ||
959 | if ( !mitem ) return 0; | 959 | if ( !mitem ) return 0; |
960 | 960 | ||
961 | return mitem->incidence(); | 961 | return mitem->incidence(); |
962 | } | 962 | } |
963 | 963 | ||
964 | QDate MonthViewCell::selectedIncidenceDate() | 964 | QDate MonthViewCell::selectedIncidenceDate() |
965 | { | 965 | { |
966 | QDate qd; | 966 | QDate qd; |
967 | int index = currentItem(); | 967 | int index = currentItem(); |
968 | if ( index < 0 ) return qd; | 968 | if ( index < 0 ) return qd; |
969 | 969 | ||
970 | MonthViewItem *mitem = | 970 | MonthViewItem *mitem = |
971 | static_cast<MonthViewItem *>( item( index ) ); | 971 | static_cast<MonthViewItem *>( item( index ) ); |
972 | 972 | ||
973 | if ( !mitem ) return qd; | 973 | if ( !mitem ) return qd; |
974 | 974 | ||
975 | return mitem->incidenceDate(); | 975 | return mitem->incidenceDate(); |
976 | } | 976 | } |
977 | 977 | ||
978 | void MonthViewCell::deselect() | 978 | void MonthViewCell::deselect() |
979 | { | 979 | { |
980 | clearSelection(); | 980 | clearSelection(); |
981 | enableScrollBars( false ); | 981 | enableScrollBars( false ); |
982 | // updateCell(); | 982 | // updateCell(); |
983 | } | 983 | } |
984 | void MonthViewCell::select() | 984 | void MonthViewCell::select() |
985 | { | 985 | { |
986 | ;// updateCell(); | 986 | ;// updateCell(); |
987 | } | 987 | } |
988 | 988 | ||
989 | void MonthViewCell::resizeEvent ( QResizeEvent * e ) | 989 | void MonthViewCell::resizeEvent ( QResizeEvent * e ) |
990 | { | 990 | { |
991 | if ( !mMonthView->isUpdatePossible() ) | 991 | if ( !mMonthView->isUpdatePossible() ) |
992 | return; | 992 | return; |
993 | //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); | 993 | //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); |
994 | deselect(); | 994 | deselect(); |
995 | mLabel->setMaximumHeight( height() - lineWidth()*2 ); | 995 | mLabel->setMaximumHeight( height() - lineWidth()*2 ); |
996 | 996 | ||
997 | QString text; | 997 | QString text; |
998 | mLabel->setText( text ); | 998 | mLabel->setText( text ); |
999 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 999 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
1000 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 1000 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
1001 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | 1001 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; |
1002 | mLabel->resize( mLabelBigSize ); | 1002 | mLabel->resize( mLabelBigSize ); |
1003 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 1003 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
1004 | } else { | 1004 | } else { |
1005 | mLabel->resize( mLabelSize ); | 1005 | mLabel->resize( mLabelSize ); |
1006 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 1006 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
1007 | } | 1007 | } |
1008 | mLabel->setText( text ); | 1008 | mLabel->setText( text ); |
1009 | 1009 | ||
1010 | int size = height() - mLabel->height() - lineWidth()-1; | 1010 | int size = height() - mLabel->height() - lineWidth()-1; |
1011 | //qDebug("LW %d ", lineWidth()); | 1011 | //qDebug("LW %d ", lineWidth()); |
1012 | if ( size > 0 ) | 1012 | if ( size > 0 ) |
1013 | verticalScrollBar()->setMaximumHeight( size ); | 1013 | verticalScrollBar()->setMaximumHeight( size ); |
1014 | size = width() - mLabel->width() -lineWidth()-1; | 1014 | size = width() - mLabel->width() -lineWidth()-1; |
1015 | if ( size > 0 ) | 1015 | if ( size > 0 ) |
1016 | horizontalScrollBar()->setMaximumWidth( size ); | 1016 | horizontalScrollBar()->setMaximumWidth( size ); |
1017 | mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); | 1017 | mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); |
1018 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 1018 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
1019 | // mItemList->resize ( width(), height () ); | 1019 | // mItemList->resize ( width(), height () ); |
1020 | if ( e ) | 1020 | if ( e ) |
1021 | KNoScrollListBox::resizeEvent ( e ); | 1021 | KNoScrollListBox::resizeEvent ( e ); |
1022 | } | 1022 | } |
1023 | 1023 | ||
1024 | void MonthViewCell::defaultAction( QListBoxItem *item ) | 1024 | void MonthViewCell::defaultAction( QListBoxItem *item ) |
1025 | { | 1025 | { |
1026 | 1026 | ||
1027 | if ( !item ) { | 1027 | if ( !item ) { |
1028 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 1028 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
1029 | emit newEventSignal( dt ); | 1029 | emit newEventSignal( dt ); |
1030 | return; | 1030 | return; |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 1033 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
1034 | Incidence *incidence = eventItem->incidence(); | 1034 | Incidence *incidence = eventItem->incidence(); |
1035 | if ( incidence ) mMonthView->defaultAction( incidence ); | 1035 | if ( incidence ) mMonthView->defaultAction( incidence ); |
1036 | } | 1036 | } |
1037 | void MonthViewCell::showDay() | 1037 | void MonthViewCell::showDay() |
1038 | { | 1038 | { |
1039 | emit showDaySignal( date() ); | 1039 | emit showDaySignal( date() ); |
1040 | } | 1040 | } |
1041 | void MonthViewCell::newEvent() | 1041 | void MonthViewCell::newEvent() |
1042 | { | 1042 | { |
1043 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 1043 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
1044 | emit newEventSignal( dt ); | 1044 | emit newEventSignal( dt ); |
1045 | } | 1045 | } |
1046 | void MonthViewCell::cellClicked( QListBoxItem *item ) | 1046 | void MonthViewCell::cellClicked( QListBoxItem *item ) |
1047 | { | 1047 | { |
1048 | mMonthView->setSelectedCell( this ); | 1048 | mMonthView->setSelectedCell( this ); |
1049 | if ( item == 0 ) { | 1049 | if ( item == 0 ) { |
1050 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 1050 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
1051 | emit newEventSignal( dt ); | 1051 | emit newEventSignal( dt ); |
1052 | return; | 1052 | return; |
1053 | } | 1053 | } |
1054 | 1054 | ||
1055 | } | 1055 | } |
1056 | 1056 | ||
1057 | void MonthViewCell::contextMenu( QListBoxItem *item ) | 1057 | void MonthViewCell::contextMenu( QListBoxItem *item ) |
1058 | { | 1058 | { |
1059 | mMonthView->setPopupCell( this ); | 1059 | mMonthView->setPopupCell( this ); |
1060 | if ( !item ) { | 1060 | if ( !item ) { |
1061 | mMonthView->showContextMenu( 0 ); | 1061 | mMonthView->showContextMenu( 0 ); |
1062 | return; | 1062 | return; |
1063 | } | 1063 | } |
1064 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 1064 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
1065 | Incidence *incidence = eventItem->incidence(); | 1065 | Incidence *incidence = eventItem->incidence(); |
1066 | if ( incidence ) mMonthView->showContextMenu( incidence ); | 1066 | if ( incidence ) mMonthView->showContextMenu( incidence ); |
1067 | } | 1067 | } |
1068 | 1068 | ||
1069 | void MonthViewCell::selection( QListBoxItem *item ) | 1069 | void MonthViewCell::selection( QListBoxItem *item ) |
1070 | { | 1070 | { |
1071 | if ( !item ) return; | 1071 | if ( !item ) return; |
1072 | 1072 | ||
1073 | mMonthView->setSelectedCell( this ); | 1073 | mMonthView->setSelectedCell( this ); |
1074 | } | 1074 | } |
1075 | 1075 | ||
1076 | 1076 | ||
1077 | // ******************************************************************************* | 1077 | // ******************************************************************************* |
1078 | // ******************************************************************************* | 1078 | // ******************************************************************************* |
1079 | // ******************************************************************************* | 1079 | // ******************************************************************************* |
1080 | 1080 | ||
1081 | 1081 | ||
1082 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | 1082 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) |
1083 | : KOEventView( calendar, parent, name ), | 1083 | : KOEventView( calendar, parent, name ), |
1084 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), | 1084 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), |
1085 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) | 1085 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) |
1086 | { | 1086 | { |
1087 | mFlagKeyPressed = false; | 1087 | mFlagKeyPressed = false; |
1088 | mShortDayLabelsM = false; | 1088 | mShortDayLabelsM = false; |
1089 | mShortDayLabelsW = false; | 1089 | mShortDayLabelsW = false; |
1090 | skipResize = false; | 1090 | skipResize = false; |
1091 | clPending = true; | 1091 | clPending = true; |
1092 | mPopupCell = 0; | 1092 | mPopupCell = 0; |
1093 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); | 1093 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); |
1094 | mWidStack = new QWidgetStack( this ); | 1094 | mWidStack = new QWidgetStack( this ); |
1095 | QVBoxLayout* hb = new QVBoxLayout( this ); | 1095 | QVBoxLayout* hb = new QVBoxLayout( this ); |
1096 | mMonthView = new QWidget( mWidStack ); | 1096 | mMonthView = new QWidget( mWidStack ); |
1097 | mWeekView = new QWidget( mWidStack ); | 1097 | mWeekView = new QWidget( mWidStack ); |
1098 | #if QT_VERSION >= 0x030000 | 1098 | #if QT_VERSION >= 0x030000 |
1099 | mWidStack->addWidget(mMonthView ); | 1099 | mWidStack->addWidget(mMonthView ); |
1100 | mWidStack->addWidget(mWeekView ); | 1100 | mWidStack->addWidget(mWeekView ); |
1101 | #else | 1101 | #else |
1102 | mWidStack->addWidget( mMonthView, 1 ); | 1102 | mWidStack->addWidget( mMonthView, 1 ); |
1103 | mWidStack->addWidget( mWeekView , 1 ); | 1103 | mWidStack->addWidget( mWeekView , 1 ); |
1104 | #endif | 1104 | #endif |
1105 | hb->addWidget( mNavigatorBar ); | 1105 | hb->addWidget( mNavigatorBar ); |
1106 | hb->addWidget( mWidStack ); | 1106 | hb->addWidget( mWidStack ); |
1107 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; | 1107 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; |
1108 | updatePossible = false; | 1108 | updatePossible = false; |
1109 | //updatePossible = true; | 1109 | //updatePossible = true; |
1110 | mCells.setAutoDelete( true ); | 1110 | mCells.setAutoDelete( true ); |
1111 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 1111 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
1112 | mDayLabels.resize( mDaysPerWeek ); | 1112 | mDayLabels.resize( mDaysPerWeek ); |
1113 | mDayLabelsW.resize( mDaysPerWeek ); | 1113 | mDayLabelsW.resize( mDaysPerWeek ); |
1114 | QFont bfont = font(); | 1114 | QFont bfont = font(); |
1115 | if ( QApplication::desktop()->width() < 650 ) { | 1115 | if ( QApplication::desktop()->width() < 650 ) { |
1116 | bfont.setPointSize( bfont.pointSize() - 2 ); | 1116 | bfont.setPointSize( bfont.pointSize() - 2 ); |
1117 | } | 1117 | } |
1118 | bfont.setBold( true ); | 1118 | bfont.setBold( true ); |
1119 | int i; | 1119 | int i; |
1120 | 1120 | ||
1121 | for( i = 0; i < mDaysPerWeek; i++ ) { | 1121 | for( i = 0; i < mDaysPerWeek; i++ ) { |
1122 | QLabel *label = new QLabel( mMonthView ); | 1122 | QLabel *label = new QLabel( mMonthView ); |
1123 | label->setFont(bfont); | 1123 | label->setFont(bfont); |
1124 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 1124 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
1125 | label->setLineWidth(1); | 1125 | label->setLineWidth(1); |
1126 | label->setAlignment(AlignCenter); | 1126 | label->setAlignment(AlignCenter); |
1127 | mDayLabels.insert( i, label ); | 1127 | mDayLabels.insert( i, label ); |
1128 | label = new QLabel( mWeekView ); | 1128 | label = new QLabel( mWeekView ); |
1129 | label->setFont(bfont); | 1129 | label->setFont(bfont); |
1130 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 1130 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
1131 | label->setLineWidth(1); | 1131 | label->setLineWidth(1); |
1132 | label->setAlignment(AlignCenter); | 1132 | label->setAlignment(AlignCenter); |
1133 | mDayLabelsW.insert( i, label ); | 1133 | mDayLabelsW.insert( i, label ); |
1134 | } | 1134 | } |
1135 | 1135 | ||
1136 | bfont.setBold( false ); | 1136 | bfont.setBold( false ); |
1137 | mWeekLabels.resize( mNumWeeks+1 ); | 1137 | mWeekLabels.resize( mNumWeeks+1 ); |
1138 | mWeekLabelsW.resize( 2 ); | 1138 | mWeekLabelsW.resize( 2 ); |
1139 | for( i = 0; i < mNumWeeks+1; i++ ) { | 1139 | for( i = 0; i < mNumWeeks+1; i++ ) { |
1140 | KOWeekButton *label = new KOWeekButton( mMonthView ); | 1140 | KOWeekButton *label = new KOWeekButton( mMonthView ); |
1141 | label->setFocusPolicy(NoFocus); | 1141 | label->setFocusPolicy(NoFocus); |
1142 | label->setFont(bfont); | 1142 | label->setFont(bfont); |
1143 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 1143 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
1144 | label->setFlat(true); | 1144 | label->setFlat(true); |
1145 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 1145 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
1146 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 1146 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
1147 | //label->setLineWidth(1); | 1147 | //label->setLineWidth(1); |
1148 | //label->setAlignment(AlignCenter); | 1148 | //label->setAlignment(AlignCenter); |
1149 | mWeekLabels.insert( i, label ); | 1149 | mWeekLabels.insert( i, label ); |
1150 | } | 1150 | } |
1151 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1151 | mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1152 | mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus); | 1152 | mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus); |
1153 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); | 1153 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); |
1154 | 1154 | ||
1155 | for( i = 0; i < 1+1; i++ ) { | 1155 | for( i = 0; i < 1+1; i++ ) { |
1156 | KOWeekButton *label = new KOWeekButton( mWeekView ); | 1156 | KOWeekButton *label = new KOWeekButton( mWeekView ); |
1157 | label->setFocusPolicy(NoFocus); | 1157 | label->setFocusPolicy(NoFocus); |
1158 | label->setFont(bfont); | 1158 | label->setFont(bfont); |
1159 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 1159 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
1160 | label->setFlat(true); | 1160 | label->setFlat(true); |
1161 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 1161 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
1162 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 1162 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
1163 | //label->setLineWidth(1); | 1163 | //label->setLineWidth(1); |
1164 | //label->setAlignment(AlignCenter); | 1164 | //label->setAlignment(AlignCenter); |
1165 | mWeekLabelsW.insert( i, label ); | 1165 | mWeekLabelsW.insert( i, label ); |
1166 | } | 1166 | } |
1167 | mWeekLabelsW[1]->setText( i18n("W")); | 1167 | mWeekLabelsW[1]->setText( i18n("W")); |
1168 | mWeekLabelsW[1]->setFocusPolicy(WheelFocus); | 1168 | mWeekLabelsW[1]->setFocusPolicy(WheelFocus); |
1169 | 1169 | ||
1170 | 1170 | ||
1171 | int row, col; | 1171 | int row, col; |
1172 | mCells.resize( mNumCells ); | 1172 | mCells.resize( mNumCells ); |
1173 | for( row = 0; row < mNumWeeks; ++row ) { | 1173 | for( row = 0; row < mNumWeeks; ++row ) { |
1174 | for( col = 0; col < mDaysPerWeek; ++col ) { | 1174 | for( col = 0; col < mDaysPerWeek; ++col ) { |
1175 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); | 1175 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); |
1176 | mCells.insert( row * mDaysPerWeek + col, cell ); | 1176 | mCells.insert( row * mDaysPerWeek + col, cell ); |
1177 | 1177 | ||
1178 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 1178 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
1179 | SLOT( defaultAction( Incidence * ) ) ); | 1179 | SLOT( defaultAction( Incidence * ) ) ); |
1180 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 1180 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
1181 | SIGNAL( newEventSignal( QDateTime ) ) ); | 1181 | SIGNAL( newEventSignal( QDateTime ) ) ); |
1182 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 1182 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
1183 | SIGNAL( showDaySignal( QDate ) ) ); | 1183 | SIGNAL( showDaySignal( QDate ) ) ); |
1184 | connect( cell, SIGNAL( nextCell() ), | 1184 | connect( cell, SIGNAL( nextCell() ), |
1185 | SLOT( nextCell() ) ); | 1185 | SLOT( nextCell() ) ); |
1186 | connect( cell, SIGNAL( prevCell() ), | 1186 | connect( cell, SIGNAL( prevCell() ), |
1187 | SLOT( prevCell() ) ); | 1187 | SLOT( prevCell() ) ); |
1188 | } | 1188 | } |
1189 | } | 1189 | } |
1190 | mCellsW.resize( mDaysPerWeek ); | 1190 | mCellsW.resize( mDaysPerWeek ); |
1191 | for( col = 0; col < mDaysPerWeek; ++col ) { | 1191 | for( col = 0; col < mDaysPerWeek; ++col ) { |
1192 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); | 1192 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); |
1193 | mCellsW.insert( col, cell ); | 1193 | mCellsW.insert( col, cell ); |
1194 | 1194 | ||
1195 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 1195 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
1196 | SLOT( defaultAction( Incidence * ) ) ); | 1196 | SLOT( defaultAction( Incidence * ) ) ); |
1197 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 1197 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
1198 | SIGNAL( newEventSignal( QDateTime ) ) ); | 1198 | SIGNAL( newEventSignal( QDateTime ) ) ); |
1199 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 1199 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
1200 | SIGNAL( showDaySignal( QDate ) ) ); | 1200 | SIGNAL( showDaySignal( QDate ) ) ); |
1201 | connect( cell, SIGNAL( nextCell() ), | 1201 | connect( cell, SIGNAL( nextCell() ), |
1202 | SLOT( nextCell() ) ); | 1202 | SLOT( nextCell() ) ); |
1203 | connect( cell, SIGNAL( prevCell() ), | 1203 | connect( cell, SIGNAL( prevCell() ), |
1204 | SLOT( prevCell() ) ); | 1204 | SLOT( prevCell() ) ); |
1205 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); | 1205 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); |
1206 | } | 1206 | } |
1207 | 1207 | ||
1208 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); | 1208 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); |
1209 | mContextMenu = eventPopup(); | 1209 | mContextMenu = eventPopup(); |
1210 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), | 1210 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), |
1211 | i18n("New Event..."),this, | 1211 | i18n("New Event..."),this, |
1212 | SLOT(slotNewEvent()),false); | 1212 | SLOT(slotNewEvent()),false); |
1213 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), | 1213 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), |
1214 | i18n("New Todo..."),this, | 1214 | i18n("New Todo..."),this, |
1215 | SLOT(slotNewTodo()),false); | 1215 | SLOT(slotNewTodo()),false); |
1216 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), | 1216 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), |
1217 | i18n("Journal"),this, | 1217 | i18n("Journal"),this, |
1218 | SLOT(slotEditJournal()),false); | 1218 | SLOT(slotEditJournal()),false); |
1219 | 1219 | ||
1220 | 1220 | ||
1221 | 1221 | ||
1222 | QString pathString = ""; | 1222 | QString pathString = ""; |
1223 | if ( !KOPrefs::instance()->mToolBarMiniIcons ) { | 1223 | if ( !KOPrefs::instance()->mToolBarMiniIcons ) { |
1224 | if ( QApplication::desktop()->width() < 480 ) | 1224 | if ( QApplication::desktop()->width() < 480 ) |
1225 | pathString += "icons16/"; | 1225 | pathString += "icons16/"; |
1226 | } else | 1226 | } else |
1227 | pathString += "iconsmini/"; | 1227 | pathString += "iconsmini/"; |
1228 | mNewItemMenu = new QPopupMenu( this ); | 1228 | mNewItemMenu = new QPopupMenu( this ); |
1229 | mNewItemMenu->insertItem( SmallIcon( pathString +"newevent" ), i18n("New Event..."),this, SLOT(slotNewEvent())); | 1229 | mNewItemMenu->insertItem( SmallIcon( pathString +"newevent" ), i18n("New Event..."),this, SLOT(slotNewEvent())); |
1230 | mNewItemMenu->insertItem( SmallIcon( pathString +"newtodo" ),i18n("New Todo..."),this,SLOT(slotNewTodo()),false); | 1230 | mNewItemMenu->insertItem( SmallIcon( pathString +"newtodo" ),i18n("New Todo..."),this,SLOT(slotNewTodo()),false); |
1231 | mNewItemMenu->insertItem( SmallIcon( pathString +"journal" ),i18n("Journal"),this,SLOT(slotEditJournal()),false); | 1231 | mNewItemMenu->insertItem( SmallIcon( pathString +"journal" ),i18n("Journal"),this,SLOT(slotEditJournal()),false); |
1232 | 1232 | ||
1233 | // updateConfig(); //useless here... | 1233 | // updateConfig(); //useless here... |
1234 | // ... but we need mWidthLongDayLabel computed | 1234 | // ... but we need mWidthLongDayLabel computed |
1235 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 1235 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
1236 | mWidthLongDayLabel = 0; | 1236 | mWidthLongDayLabel = 0; |
1237 | for (int i = 0; i < 7; i++) { | 1237 | for (int i = 0; i < 7; i++) { |
1238 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 1238 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
1239 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 1239 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
1240 | } | 1240 | } |
1241 | 1241 | ||
1242 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1242 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1243 | 1243 | ||
1244 | #if 0 | 1244 | #if 0 |
1245 | if ( mShowWeekView ) | 1245 | if ( mShowWeekView ) |
1246 | mWidStack->raiseWidget( mWeekView ); | 1246 | mWidStack->raiseWidget( mWeekView ); |
1247 | else | 1247 | else |
1248 | mWidStack->raiseWidget( mMonthView ); | 1248 | mWidStack->raiseWidget( mMonthView ); |
1249 | #endif | 1249 | #endif |
1250 | 1250 | ||
1251 | emit incidenceSelected( 0 ); | 1251 | emit incidenceSelected( 0 ); |
1252 | 1252 | ||
1253 | mComputeLayoutTimer = new QTimer( this ); | 1253 | mComputeLayoutTimer = new QTimer( this ); |
1254 | connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout())); | 1254 | connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout())); |
1255 | 1255 | ||
1256 | 1256 | ||
1257 | #ifndef DESKTOP_VERSION | 1257 | #ifndef DESKTOP_VERSION |
1258 | resize( QApplication::desktop()->size() ); | 1258 | resize( QApplication::desktop()->size() ); |
1259 | #else | 1259 | #else |
1260 | resize(640, 480 ); | 1260 | resize(640, 480 ); |
1261 | updatePossible = true; | 1261 | updatePossible = true; |
1262 | #endif | 1262 | #endif |
1263 | computeLayout(); | 1263 | computeLayout(); |
1264 | 1264 | ||
1265 | if ( mShowWeekView ) | 1265 | if ( mShowWeekView ) |
1266 | mWidStack->raiseWidget( mWeekView ); | 1266 | mWidStack->raiseWidget( mWeekView ); |
1267 | else | 1267 | else |
1268 | mWidStack->raiseWidget( mMonthView ); | 1268 | mWidStack->raiseWidget( mMonthView ); |
1269 | } | 1269 | } |
1270 | 1270 | ||
1271 | KOMonthView::~KOMonthView() | 1271 | KOMonthView::~KOMonthView() |
1272 | { | 1272 | { |
1273 | delete mContextMenu; | 1273 | delete mContextMenu; |
1274 | } | 1274 | } |
1275 | 1275 | ||
1276 | void KOMonthView::selectInternalWeekNum ( int n ) | 1276 | void KOMonthView::selectInternalWeekNum ( int n ) |
1277 | { | 1277 | { |
1278 | switchView(); | 1278 | switchView(); |
1279 | if ( !KOPrefs::instance()->mMonthViewWeek ) | 1279 | if ( !KOPrefs::instance()->mMonthViewWeek ) |
1280 | emit selectMonth (); | 1280 | emit selectMonth (); |
1281 | else | 1281 | else |
1282 | emit selectWeekNum ( n ); | 1282 | emit selectWeekNum ( n ); |
1283 | } | 1283 | } |
1284 | 1284 | ||
1285 | int KOMonthView::currentWeek() | 1285 | int KOMonthView::currentWeek() |
1286 | { | 1286 | { |
1287 | if ( mShowWeekView ) | 1287 | if ( mShowWeekView ) |
1288 | return mWeekLabelsW[0]->getWeekNum(); | 1288 | return mWeekLabelsW[0]->getWeekNum(); |
1289 | return mWeekLabels[0]->getWeekNum(); | 1289 | return mWeekLabels[0]->getWeekNum(); |
1290 | } | 1290 | } |
1291 | void KOMonthView::switchView() | 1291 | void KOMonthView::switchView() |
1292 | { | 1292 | { |
1293 | if ( selectedCell( ) ) | 1293 | if ( selectedCell( ) ) |
1294 | selectedCell()->deselect(); | 1294 | selectedCell()->deselect(); |
1295 | mShowWeekView = !mShowWeekView; | 1295 | mShowWeekView = !mShowWeekView; |
1296 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; | 1296 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; |
1297 | if ( clPending ) { | 1297 | if ( clPending ) { |
1298 | computeLayout(); | 1298 | computeLayout(); |
1299 | updateConfig(); | 1299 | updateConfig(); |
1300 | } | 1300 | } |
1301 | if ( mShowWeekView ) | 1301 | if ( mShowWeekView ) |
1302 | mWidStack->raiseWidget( mWeekView ); | 1302 | mWidStack->raiseWidget( mWeekView ); |
1303 | else | 1303 | else |
1304 | mWidStack->raiseWidget( mMonthView ); | 1304 | mWidStack->raiseWidget( mMonthView ); |
1305 | clPending = false; | 1305 | clPending = false; |
1306 | } | 1306 | } |
1307 | 1307 | ||
1308 | int KOMonthView::maxDatesHint() | 1308 | int KOMonthView::maxDatesHint() |
1309 | { | 1309 | { |
1310 | return mNumCells; | 1310 | return mNumCells; |
1311 | } | 1311 | } |
1312 | 1312 | ||
1313 | int KOMonthView::currentDateCount() | 1313 | int KOMonthView::currentDateCount() |
1314 | { | 1314 | { |
1315 | return mNumCells; | 1315 | return mNumCells; |
1316 | } | 1316 | } |
1317 | 1317 | ||
1318 | QPtrList<Incidence> KOMonthView::selectedIncidences() | 1318 | QPtrList<Incidence> KOMonthView::selectedIncidences() |
1319 | { | 1319 | { |
1320 | QPtrList<Incidence> selected; | 1320 | QPtrList<Incidence> selected; |
1321 | 1321 | ||
1322 | if ( mSelectedCell ) { | 1322 | if ( mSelectedCell ) { |
1323 | Incidence *incidence = mSelectedCell->selectedIncidence(); | 1323 | Incidence *incidence = mSelectedCell->selectedIncidence(); |
1324 | if ( incidence ) selected.append( incidence ); | 1324 | if ( incidence ) selected.append( incidence ); |
1325 | } | 1325 | } |
1326 | 1326 | ||
1327 | return selected; | 1327 | return selected; |
1328 | } | 1328 | } |
1329 | 1329 | ||
1330 | DateList KOMonthView::selectedDates() | 1330 | DateList KOMonthView::selectedDates() |
1331 | { | 1331 | { |
1332 | DateList selected; | 1332 | DateList selected; |
1333 | 1333 | ||
1334 | if ( mSelectedCell ) { | 1334 | if ( mSelectedCell ) { |
1335 | QDate qd = mSelectedCell->selectedIncidenceDate(); | 1335 | QDate qd = mSelectedCell->selectedIncidenceDate(); |
1336 | if ( qd.isValid() ) selected.append( qd ); | 1336 | if ( qd.isValid() ) selected.append( qd ); |
1337 | } | 1337 | } |
1338 | 1338 | ||
1339 | return selected; | 1339 | return selected; |
1340 | } | 1340 | } |
1341 | 1341 | ||
1342 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1342 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1343 | const QDate &td) | 1343 | const QDate &td) |
1344 | { | 1344 | { |
1345 | #ifndef KORG_NOPRINTER | 1345 | #ifndef KORG_NOPRINTER |
1346 | calPrinter->preview(CalPrinter::Month, fd, td); | 1346 | calPrinter->preview(CalPrinter::Month, fd, td); |
1347 | #endif | 1347 | #endif |
1348 | } | 1348 | } |
1349 | 1349 | ||
1350 | void KOMonthView::updateConfig() | 1350 | void KOMonthView::updateConfig() |
1351 | { | 1351 | { |
1352 | 1352 | ||
1353 | int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 1353 | int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
1354 | 1354 | ||
1355 | if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { | 1355 | if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { |
1356 | mWeekStartsMonday = true; | 1356 | mWeekStartsMonday = true; |
1357 | } | 1357 | } |
1358 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 1358 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
1359 | mWidthLongDayLabel = 0; | 1359 | mWidthLongDayLabel = 0; |
1360 | 1360 | ||
1361 | for (int i = 0; i < 7; i++) { | 1361 | for (int i = 0; i < 7; i++) { |
1362 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 1362 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
1363 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 1363 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
1364 | } | 1364 | } |
1365 | bool temp = mShowSatSunComp ; | 1365 | bool temp = mShowSatSunComp ; |
1366 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 1366 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
1367 | if ( ! mShowWeekView ) { | 1367 | if ( ! mShowWeekView ) { |
1368 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) | 1368 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) |
1369 | computeLayout(); | 1369 | computeLayout(); |
1370 | } | 1370 | } |
1371 | updateDayLabels(); | 1371 | updateDayLabels(); |
1372 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); | 1372 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); |
1373 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; | 1373 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; |
1374 | //resizeEvent( 0 ); | 1374 | //resizeEvent( 0 ); |
1375 | for (uint i = 0; i < mCells.count(); ++i) { | 1375 | for (uint i = 0; i < mCells.count(); ++i) { |
1376 | mCells[i]->updateConfig(); | 1376 | mCells[i]->updateConfig(); |
1377 | } | 1377 | } |
1378 | 1378 | ||
1379 | for (uint i = 0; i < mCellsW.count(); ++i) { | 1379 | for (uint i = 0; i < mCellsW.count(); ++i) { |
1380 | mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); | 1380 | mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); |
1381 | } | 1381 | } |
1382 | #ifdef DESKTOP_VERSION | 1382 | #ifdef DESKTOP_VERSION |
1383 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); | 1383 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); |
1384 | #endif | 1384 | #endif |
1385 | updateView(); | 1385 | updateView(); |
1386 | } | 1386 | } |
1387 | 1387 | ||
1388 | void KOMonthView::updateDayLabels() | 1388 | void KOMonthView::updateDayLabels() |
1389 | { | 1389 | { |
1390 | 1390 | ||
1391 | QPtrVector<QLabel> *mDayLabelsT; | 1391 | QPtrVector<QLabel> *mDayLabelsT; |
1392 | 1392 | ||
1393 | mDayLabelsT = &mDayLabelsW; | 1393 | mDayLabelsT = &mDayLabelsW; |
1394 | for (int i = 0; i < 7; i++) { | 1394 | for (int i = 0; i < 7; i++) { |
1395 | { | 1395 | { |
1396 | bool show = mShortDayLabelsW; | 1396 | bool show = mShortDayLabelsW; |
1397 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1397 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1398 | show = true; | 1398 | show = true; |
1399 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1399 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1400 | } | 1400 | } |
1401 | } | 1401 | } |
1402 | mDayLabelsT = &mDayLabels; | 1402 | mDayLabelsT = &mDayLabels; |
1403 | for (int i = 0; i < 7; i++) { | 1403 | for (int i = 0; i < 7; i++) { |
1404 | if (KGlobal::locale()->weekStartsMonday() || KOPrefs::instance()->mMonthViewSatSunTog ) { | 1404 | if (KGlobal::locale()->weekStartsMonday() || KOPrefs::instance()->mMonthViewSatSunTog ) { |
1405 | bool show = mShortDayLabelsM; | 1405 | bool show = mShortDayLabelsM; |
1406 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1406 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1407 | show = true; | 1407 | show = true; |
1408 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1408 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1409 | } else { | 1409 | } else { |
1410 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); | 1410 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); |
1411 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); | 1411 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); |
1412 | 1412 | ||
1413 | } | 1413 | } |
1414 | } | 1414 | } |
1415 | 1415 | ||
1416 | } | 1416 | } |
1417 | 1417 | ||
1418 | void KOMonthView::clearList() | 1418 | void KOMonthView::clearList() |
1419 | { | 1419 | { |
1420 | unsigned int i; | 1420 | unsigned int i; |
1421 | for( i = 0; i < mCells.size(); ++i ) { | 1421 | for( i = 0; i < mCells.size(); ++i ) { |
1422 | mCells[i]->clear(); | 1422 | mCells[i]->clear(); |
1423 | } | 1423 | } |
1424 | for( i = 0; i < mCellsW.size(); ++i ) { | 1424 | for( i = 0; i < mCellsW.size(); ++i ) { |
1425 | mCellsW[i]->clear(); | 1425 | mCellsW[i]->clear(); |
1426 | } | 1426 | } |
1427 | } | 1427 | } |
1428 | void KOMonthView::showDates(const QDate &start, const QDate &) | 1428 | void KOMonthView::showDates(const QDate &start, const QDate &) |
1429 | { | 1429 | { |
1430 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; | 1430 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; |
1431 | 1431 | ||
1432 | QPtrVector<MonthViewCell> *cells; | 1432 | QPtrVector<MonthViewCell> *cells; |
1433 | QPtrVector<QLabel> *dayLabels; | 1433 | QPtrVector<QLabel> *dayLabels; |
1434 | QPtrVector<KOWeekButton> *weekLabels; | 1434 | QPtrVector<KOWeekButton> *weekLabels; |
1435 | int weekNum = 6; | 1435 | int weekNum = 6; |
1436 | mStartDate = start; | 1436 | mStartDate = start; |
1437 | if ( mShowWeekView ) { | 1437 | if ( mShowWeekView ) { |
1438 | weekNum = 1; | 1438 | weekNum = 1; |
1439 | cells = &mCellsW; | 1439 | cells = &mCellsW; |
1440 | dayLabels = &mDayLabelsW; | 1440 | dayLabels = &mDayLabelsW; |
1441 | weekLabels = &mWeekLabelsW; | 1441 | weekLabels = &mWeekLabelsW; |
1442 | if ( !KGlobal::locale()->weekStartsMonday() ) { | 1442 | if ( !KGlobal::locale()->weekStartsMonday() ) { |
1443 | mStartDate = mStartDate.addDays( 1 ); | 1443 | mStartDate = mStartDate.addDays( 1 ); |
1444 | } | 1444 | } |
1445 | } else { | 1445 | } else { |
1446 | cells = &mCells; | 1446 | cells = &mCells; |
1447 | dayLabels = &mDayLabels; | 1447 | dayLabels = &mDayLabels; |
1448 | weekLabels = &mWeekLabels; | 1448 | weekLabels = &mWeekLabels; |
1449 | } | 1449 | } |
1450 | 1450 | ||
1451 | int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 1451 | int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
1452 | 1452 | ||
1453 | if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { | 1453 | if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { |
1454 | mWeekStartsMonday = true; | 1454 | mWeekStartsMonday = true; |
1455 | } | 1455 | } |
1456 | int startWeekDay = mWeekStartsMonday ? 1 : 7; | 1456 | int startWeekDay = mWeekStartsMonday ? 1 : 7; |
1457 | 1457 | ||
1458 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { | 1458 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { |
1459 | mStartDate = mStartDate.addDays( -1 ); | 1459 | mStartDate = mStartDate.addDays( -1 ); |
1460 | } | 1460 | } |
1461 | bool primary = false; | 1461 | bool primary = false; |
1462 | uint i; | 1462 | uint i; |
1463 | for( i = 0; i < (*cells).size(); ++i ) { | 1463 | for( i = 0; i < (*cells).size(); ++i ) { |
1464 | QDate date = mStartDate.addDays( i ); | 1464 | QDate date = mStartDate.addDays( i ); |
1465 | (*cells)[i]->setDate( date ); | 1465 | (*cells)[i]->setDate( date ); |
1466 | 1466 | ||
1467 | #ifndef KORG_NOPLUGINS | 1467 | #ifndef KORG_NOPLUGINS |
1468 | // add holiday, if present | 1468 | // add holiday, if present |
1469 | QString hstring(KOCore::self()->holiday(date)); | 1469 | QString hstring(KOCore::self()->holiday(date)); |
1470 | (*cells)[i]->setHoliday( hstring ); | 1470 | (*cells)[i]->setHoliday( hstring ); |
1471 | #endif | 1471 | #endif |
1472 | 1472 | ||
1473 | } | 1473 | } |
1474 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); | 1474 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); |
1475 | for( i = 0; i < weekNum; ++i ) { | 1475 | for( i = 0; i < weekNum; ++i ) { |
1476 | int wno; | 1476 | int wno; |
1477 | // remember, according to ISO 8601, the first week of the year is the | 1477 | // remember, according to ISO 8601, the first week of the year is the |
1478 | // first week that contains a thursday. Thus we must subtract off 4, | 1478 | // first week that contains a thursday. Thus we must subtract off 4, |
1479 | // not just 1. | 1479 | // not just 1. |
1480 | int dayOfYear = date.dayOfYear(); | 1480 | int dayOfYear = date.dayOfYear(); |
1481 | if (dayOfYear % 7 != 0) | 1481 | if (dayOfYear % 7 != 0) |
1482 | wno = dayOfYear / 7 + 1; | 1482 | wno = dayOfYear / 7 + 1; |
1483 | else | 1483 | else |
1484 | wno =dayOfYear / 7; | 1484 | wno =dayOfYear / 7; |
1485 | (*weekLabels)[i]->setWeekNum( wno ); | 1485 | (*weekLabels)[i]->setWeekNum( wno ); |
1486 | date = date.addDays( 7 ); | 1486 | date = date.addDays( 7 ); |
1487 | } | 1487 | } |
1488 | updateView(); | 1488 | updateView(); |
1489 | } | 1489 | } |
1490 | 1490 | ||
1491 | void KOMonthView::showEvents(QPtrList<Event>) | 1491 | void KOMonthView::showEvents(QPtrList<Event>) |
1492 | { | 1492 | { |
1493 | qDebug("KOMonthView::selectEvents is not implemented yet. "); | 1493 | qDebug("KOMonthView::selectEvents is not implemented yet. "); |
1494 | } | 1494 | } |
1495 | 1495 | ||
1496 | void KOMonthView::changeEventDisplay(Event *, int) | 1496 | void KOMonthView::changeEventDisplay(Event *, int) |
1497 | { | 1497 | { |
1498 | // this should be re-written to be much more efficient, but this | 1498 | // this should be re-written to be much more efficient, but this |
1499 | // quick-and-dirty-hack gets the job done for right now. | 1499 | // quick-and-dirty-hack gets the job done for right now. |
1500 | //qDebug("KOMonthView::changeEventDisplay "); | 1500 | //qDebug("KOMonthView::changeEventDisplay "); |
1501 | updateView(); | 1501 | updateView(); |
1502 | } | 1502 | } |
1503 | 1503 | ||
1504 | void KOMonthView::updateView() | 1504 | void KOMonthView::updateView() |
1505 | { | 1505 | { |
1506 | 1506 | ||
1507 | if ( !updatePossible ) | 1507 | if ( !updatePossible ) |
1508 | return; | 1508 | return; |
1509 | //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU "); | 1509 | //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU "); |
1510 | //QTime ti; | 1510 | //QTime ti; |
1511 | //ti.start(); | 1511 | //ti.start(); |
1512 | clearSelection(); | 1512 | clearSelection(); |
1513 | QPtrVector<MonthViewCell> *cells; | 1513 | QPtrVector<MonthViewCell> *cells; |
1514 | if ( mShowWeekView ) { | 1514 | if ( mShowWeekView ) { |
1515 | cells = &mCellsW; | 1515 | cells = &mCellsW; |
1516 | } else { | 1516 | } else { |
1517 | cells = &mCells; | 1517 | cells = &mCells; |
1518 | } | 1518 | } |
1519 | #if 1 | 1519 | #if 1 |
1520 | int i; | 1520 | int i; |
1521 | int timeSpan = (*cells).size()-1; | 1521 | int timeSpan = (*cells).size()-1; |
1522 | if ( KOPrefs::instance()->mMonthViewWeek ) | 1522 | if ( KOPrefs::instance()->mMonthViewWeek ) |
1523 | timeSpan = 6; | 1523 | timeSpan = 6; |
1524 | for( i = 0; i < timeSpan + 1; ++i ) { | 1524 | for( i = 0; i < timeSpan + 1; ++i ) { |
1525 | (*cells)[i]->startUpdateCell(); | 1525 | (*cells)[i]->startUpdateCell(); |
1526 | } | 1526 | } |
1527 | 1527 | ||
1528 | QPtrList<Event> events = calendar()->events(); | 1528 | QPtrList<Event> events = calendar()->events(); |
1529 | Event *event; | 1529 | Event *event; |
1530 | QDateTime dt; | 1530 | QDateTime dt; |
1531 | bool ok; | 1531 | bool ok; |
1532 | QDate endDate = mStartDate.addDays( timeSpan ); | 1532 | QDate endDate = mStartDate.addDays( timeSpan ); |
1533 | for( event = events.first(); event; event = events.next() ) { // for event | 1533 | for( event = events.first(); event; event = events.next() ) { // for event |
1534 | if ( event->doesRecur() ) { | 1534 | if ( event->doesRecur() ) { |
1535 | bool last; | 1535 | bool last; |
1536 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); | 1536 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); |
1537 | QDateTime incidenceEnd; | 1537 | QDateTime incidenceEnd; |
1538 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 1538 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
1539 | bool invalid = false; | 1539 | bool invalid = false; |
1540 | while( true ) { | 1540 | while( true ) { |
1541 | if ( incidenceStart.isValid() ) { | 1541 | if ( incidenceStart.isValid() ) { |
1542 | incidenceEnd = incidenceStart.addDays( eventlen ); | 1542 | incidenceEnd = incidenceStart.addDays( eventlen ); |
1543 | int st = incidenceStart.date().daysTo( endDate ); | 1543 | int st = incidenceStart.date().daysTo( endDate ); |
1544 | if ( st >= 0 ) { // start before timeend | 1544 | if ( st >= 0 ) { // start before timeend |
1545 | int end = mStartDate.daysTo( incidenceEnd.date() ); | 1545 | int end = mStartDate.daysTo( incidenceEnd.date() ); |
1546 | if ( end >= 0 ) { // end after timestart --- got one! | 1546 | if ( end >= 0 ) { // end after timestart --- got one! |
1547 | //normalize | 1547 | //normalize |
1548 | st = timeSpan - st; | 1548 | st = timeSpan - st; |
1549 | if ( st < 0 ) st = 0; | 1549 | if ( st < 0 ) st = 0; |
1550 | if ( end > timeSpan ) end = timeSpan; | 1550 | if ( end > timeSpan ) end = timeSpan; |
1551 | int iii; | 1551 | int iii; |
1552 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); | 1552 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); |
1553 | for ( iii = st;iii<= end;++iii) | 1553 | for ( iii = st;iii<= end;++iii) |
1554 | (*cells)[iii]->insertEvent( event ); | 1554 | (*cells)[iii]->insertEvent( event ); |
1555 | } | 1555 | } |
1556 | } | 1556 | } |
1557 | } else { | 1557 | } else { |
1558 | if ( invalid ) | 1558 | if ( invalid ) |
1559 | break; | 1559 | break; |
1560 | invalid = true; | 1560 | invalid = true; |
1561 | //qDebug("invalid %s", event->summary().latin1()); | 1561 | //qDebug("invalid %s", event->summary().latin1()); |
1562 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; | 1562 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; |
1563 | } | 1563 | } |
1564 | if ( last ) | 1564 | if ( last ) |
1565 | break; | 1565 | break; |
1566 | bool ok; | 1566 | bool ok; |
1567 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); | 1567 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); |
1568 | if ( ! ok ) | 1568 | if ( ! ok ) |
1569 | break; | 1569 | break; |
1570 | if ( incidenceStart.date() > endDate ) | 1570 | if ( incidenceStart.date() > endDate ) |
1571 | break; | 1571 | break; |
1572 | } | 1572 | } |
1573 | } else { // no recur | 1573 | } else { // no recur |
1574 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) | 1574 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) |
1575 | if ( event->uid().left(15) == QString("last-syncEvent-") ) | 1575 | if ( event->uid().left(15) == QString("last-syncEvent-") ) |
1576 | continue; | 1576 | continue; |
1577 | int st = event->dtStart().date().daysTo( endDate ); | 1577 | int st = event->dtStart().date().daysTo( endDate ); |
1578 | if ( st >= 0 ) { // start before timeend | 1578 | if ( st >= 0 ) { // start before timeend |
1579 | int end = mStartDate.daysTo( event->dtEnd().date() ); | 1579 | int end = mStartDate.daysTo( event->dtEnd().date() ); |
1580 | if ( end >= 0 ) { // end after timestart --- got one! | 1580 | if ( end >= 0 ) { // end after timestart --- got one! |
1581 | //normalize | 1581 | //normalize |
1582 | st = timeSpan - st; | 1582 | st = timeSpan - st; |
1583 | if ( st < 0 ) st = 0; | 1583 | if ( st < 0 ) st = 0; |
1584 | if ( end > timeSpan ) end = timeSpan; | 1584 | if ( end > timeSpan ) end = timeSpan; |
1585 | int iii; | 1585 | int iii; |
1586 | for ( iii = st;iii<= end;++iii) | 1586 | for ( iii = st;iii<= end;++iii) |
1587 | (*cells)[iii]->insertEvent( event ); | 1587 | (*cells)[iii]->insertEvent( event ); |
1588 | } | 1588 | } |
1589 | } | 1589 | } |
1590 | } | 1590 | } |
1591 | } | 1591 | } |
1592 | // insert due todos | 1592 | // insert due todos |
1593 | QPtrList<Todo> todos = calendar()->todos( ); | 1593 | QPtrList<Todo> todos = calendar()->todos( ); |
1594 | Todo *todo; | 1594 | Todo *todo; |
1595 | for(todo = todos.first(); todo; todo = todos.next()) { | 1595 | for(todo = todos.first(); todo; todo = todos.next()) { |
1596 | //insertTodo( todo ); | 1596 | //insertTodo( todo ); |
1597 | if ( todo->hasDueDate() ) { | 1597 | if ( todo->hasDueDate() ) { |
1598 | int day = mStartDate.daysTo( todo->dtDue().date() ); | 1598 | int day = mStartDate.daysTo( todo->dtDue().date() ); |
1599 | if ( day >= 0 && day < timeSpan + 1) { | 1599 | if ( day >= 0 && day < timeSpan + 1) { |
1600 | (*cells)[day]->insertTodo( todo ); | 1600 | (*cells)[day]->insertTodo( todo ); |
1601 | } | 1601 | } |
1602 | } | 1602 | } |
1603 | } | 1603 | } |
1604 | 1604 | ||
1605 | for( i = 0; i < timeSpan+1; ++i ) { | 1605 | for( i = 0; i < timeSpan+1; ++i ) { |
1606 | (*cells)[i]->finishUpdateCell(); | 1606 | (*cells)[i]->finishUpdateCell(); |
1607 | } | 1607 | } |
1608 | processSelectionChange(); | 1608 | processSelectionChange(); |
1609 | //qApp->processEvents(); | 1609 | //qApp->processEvents(); |
1610 | for( i = 0; i < timeSpan+1; ++i ) { | 1610 | for( i = 0; i < timeSpan+1; ++i ) { |
1611 | (*cells)[i]->repaintfinishUpdateCell(); | 1611 | (*cells)[i]->repaintfinishUpdateCell(); |
1612 | } | 1612 | } |
1613 | setKeyBFocus(); | 1613 | setKeyBFocus(); |
1614 | #else | 1614 | #else |
1615 | // old code | 1615 | // old code |
1616 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); | 1616 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
1617 | int i; | 1617 | int i; |
1618 | for( i = 0; i < (*cells).count(); ++i ) { | 1618 | for( i = 0; i < (*cells).count(); ++i ) { |
1619 | (*cells)[i]->updateCell(); | 1619 | (*cells)[i]->updateCell(); |
1620 | } | 1620 | } |
1621 | 1621 | ||
1622 | //qDebug("KOMonthView::updateView() "); | 1622 | //qDebug("KOMonthView::updateView() "); |
1623 | processSelectionChange(); | 1623 | processSelectionChange(); |
1624 | // qDebug("---------------------------------------------------------------------+ "); | 1624 | // qDebug("---------------------------------------------------------------------+ "); |
1625 | (*cells)[0]->setFocus(); | 1625 | (*cells)[0]->setFocus(); |
1626 | #endif | 1626 | #endif |
1627 | 1627 | ||
1628 | //qDebug("update time %d ", ti.elapsed()); | 1628 | //qDebug("update time %d ", ti.elapsed()); |
1629 | } | 1629 | } |
1630 | 1630 | ||
1631 | void KOMonthView::setKeyBoardFocus() | 1631 | void KOMonthView::setKeyBoardFocus() |
1632 | { | 1632 | { |
1633 | //qDebug("KOMonthView::setKeyBoardFocus() "); | 1633 | //qDebug("KOMonthView::setKeyBoardFocus() "); |
1634 | bool shootAgain = false; | 1634 | bool shootAgain = false; |
1635 | if ( mShowWeekView ) { | 1635 | if ( mShowWeekView ) { |
1636 | shootAgain = !mWeekLabelsW[1]->hasFocus(); | 1636 | shootAgain = !mWeekLabelsW[1]->hasFocus(); |
1637 | mWeekLabelsW[1]->setFocus(); | 1637 | mWeekLabelsW[1]->setFocus(); |
1638 | } | 1638 | } |
1639 | else { | 1639 | else { |
1640 | shootAgain = !mWeekLabels[mNumWeeks]->hasFocus(); | 1640 | shootAgain = !mWeekLabels[mNumWeeks]->hasFocus(); |
1641 | mWeekLabels[mNumWeeks]->setFocus(); | 1641 | mWeekLabels[mNumWeeks]->setFocus(); |
1642 | } | 1642 | } |
1643 | if ( shootAgain ) { | 1643 | if ( shootAgain ) { |
1644 | QTimer::singleShot( 0, this, SLOT ( setKeyBFocus() ) ); | 1644 | QTimer::singleShot( 0, this, SLOT ( setKeyBFocus() ) ); |
1645 | } | 1645 | } |
1646 | } | 1646 | } |
1647 | void KOMonthView::setKeyBFocus() | 1647 | void KOMonthView::setKeyBFocus() |
1648 | { | 1648 | { |
1649 | //qDebug("KOMonthView::setKeyBFocus() "); | 1649 | //qDebug("KOMonthView::setKeyBFocus() "); |
1650 | QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) ); | 1650 | QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) ); |
1651 | } | 1651 | } |
1652 | void KOMonthView::resizeEvent(QResizeEvent * e) | 1652 | void KOMonthView::resizeEvent(QResizeEvent * e) |
1653 | { | 1653 | { |
1654 | //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); | 1654 | //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); |
1655 | if ( isVisible() ) { | 1655 | if ( isVisible() ) { |
1656 | //qDebug("KOMonthView::isVisible "); | 1656 | //qDebug("KOMonthView::isVisible "); |
1657 | slotComputeLayout(); | 1657 | slotComputeLayout(); |
1658 | } else | 1658 | } else |
1659 | mComputeLayoutTimer->start( 100 ); | 1659 | mComputeLayoutTimer->start( 100 ); |
1660 | } | 1660 | } |
1661 | 1661 | ||
1662 | void KOMonthView::slotComputeLayout() | 1662 | void KOMonthView::slotComputeLayout() |
1663 | { | 1663 | { |
1664 | mComputeLayoutTimer->stop(); | 1664 | mComputeLayoutTimer->stop(); |
1665 | //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); | 1665 | //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); |
1666 | computeLayout(); | 1666 | computeLayout(); |
1667 | clPending = true; | 1667 | clPending = true; |
1668 | setKeyBFocus(); | 1668 | setKeyBFocus(); |
1669 | } | 1669 | } |
1670 | void KOMonthView::computeLayoutWeek() | 1670 | void KOMonthView::computeLayoutWeek() |
1671 | { | 1671 | { |
1672 | static int lastWid = 0; | 1672 | static int lastWid = 0; |
1673 | static int lastHei = 0; | 1673 | static int lastHei = 0; |
1674 | int daysToShow; | 1674 | int daysToShow; |
1675 | bool combinedSatSun = false; | 1675 | bool combinedSatSun = false; |
1676 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 1676 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1677 | daysToShow = 6; | 1677 | daysToShow = 6; |
1678 | combinedSatSun = true; | 1678 | combinedSatSun = true; |
1679 | } | 1679 | } |
1680 | int tWid = topLevelWidget()->size().width(); | 1680 | int tWid = topLevelWidget()->size().width(); |
1681 | int tHei = topLevelWidget()->size().height(); | 1681 | int tHei = topLevelWidget()->size().height(); |
1682 | 1682 | ||
1683 | int wid = width();//e | 1683 | int wid = width();//e |
1684 | int hei = height()-1-mNavigatorBar->height(); | 1684 | int hei = height()-1-mNavigatorBar->height(); |
1685 | 1685 | ||
1686 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 1686 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
1687 | return; | 1687 | return; |
1688 | 1688 | ||
1689 | if ( lastWid == width() && lastHei == height() ) { | 1689 | if ( lastWid == width() && lastHei == height() ) { |
1690 | //qDebug("KOListWeekView::No compute layout needed "); | 1690 | //qDebug("KOListWeekView::No compute layout needed "); |
1691 | return; | 1691 | return; |
1692 | } | 1692 | } |
1693 | lastWid = width(); | 1693 | lastWid = width(); |
1694 | lastHei = height(); | 1694 | lastHei = height(); |
1695 | 1695 | ||
1696 | 1696 | ||
1697 | if ( wid < hei ) | 1697 | if ( wid < hei ) |
1698 | daysToShow = 2; | 1698 | daysToShow = 2; |
1699 | else | 1699 | else |
1700 | daysToShow = 3; | 1700 | daysToShow = 3; |
1701 | mShowSatSunComp = true; | 1701 | mShowSatSunComp = true; |
1702 | combinedSatSun = true; | 1702 | combinedSatSun = true; |
1703 | 1703 | ||
1704 | //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); | 1704 | //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); |
1705 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1705 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1706 | int weeklabelwid = fm.width( "888" ); | 1706 | int weeklabelwid = fm.width( "888" ); |
1707 | wid -= weeklabelwid; | 1707 | wid -= weeklabelwid; |
1708 | 1708 | ||
1709 | int colWid = wid / daysToShow; | 1709 | int colWid = wid / daysToShow; |
1710 | int lastCol = wid - ( colWid*6 ); | 1710 | int lastCol = wid - ( colWid*6 ); |
1711 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); | 1711 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); |
1712 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); | 1712 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); |
1713 | int colModulo = wid % daysToShow; | 1713 | int colModulo = wid % daysToShow; |
1714 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; | 1714 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; |
1715 | //qDebug("rowmod %d ", rowModulo); | 1715 | //qDebug("rowmod %d ", rowModulo); |
1716 | int i; | 1716 | int i; |
1717 | int x,y,w,h; | 1717 | int x,y,w,h; |
1718 | x= 0; | 1718 | x= 0; |
1719 | y= 0; | 1719 | y= 0; |
1720 | w = colWid; | 1720 | w = colWid; |
1721 | h = dayLabelHei ; | 1721 | h = dayLabelHei ; |
1722 | for ( i = 0; i < 7; i++) { | 1722 | for ( i = 0; i < 7; i++) { |
1723 | if ( i && !( i % daysToShow) && i < 6) { | 1723 | if ( i && !( i % daysToShow) && i < 6) { |
1724 | y += hei/(5-daysToShow); | 1724 | y += hei/(5-daysToShow); |
1725 | x = 0; | 1725 | x = 0; |
1726 | w = colWid; | 1726 | w = colWid; |
1727 | } | 1727 | } |
1728 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1728 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1729 | ++w; | 1729 | ++w; |
1730 | } | 1730 | } |
1731 | if ( i >= 5 ) { | 1731 | if ( i >= 5 ) { |
1732 | int wi = width() - x - weeklabelwid; | 1732 | int wi = width() - x - weeklabelwid; |
1733 | if ( i == 5 ) { | 1733 | if ( i == 5 ) { |
1734 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi/2+wi%2,h); | 1734 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi/2+wi%2,h); |
1735 | } else { | 1735 | } else { |
1736 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h); | 1736 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h); |
1737 | } | 1737 | } |
1738 | x = x - w + wi - (wi/2 ); | 1738 | x = x - w + wi - (wi/2 ); |
1739 | } | 1739 | } |
1740 | else { | 1740 | else { |
1741 | int wi = w; | 1741 | int wi = w; |
1742 | if ( !(( i+1) % daysToShow)) { | 1742 | if ( !(( i+1) % daysToShow)) { |
1743 | wi = width() - x - weeklabelwid; | 1743 | wi = width() - x - weeklabelwid; |
1744 | } | 1744 | } |
1745 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h); | 1745 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h); |
1746 | } | 1746 | } |
1747 | x += w; | 1747 | x += w; |
1748 | } | 1748 | } |
1749 | x= 0; | 1749 | x= 0; |
1750 | y= dayLabelHei; | 1750 | y= dayLabelHei; |
1751 | w = colWid; | 1751 | w = colWid; |
1752 | h = cellHei; | 1752 | h = cellHei; |
1753 | int max = 0; | 1753 | int max = 0; |
1754 | for ( i = 0; i < mCellsW.count(); ++i) { | 1754 | for ( i = 0; i < mCellsW.count(); ++i) { |
1755 | if ( i > 6 ) { | 1755 | if ( i > 6 ) { |
1756 | mCellsW[i]->hide(); | 1756 | mCellsW[i]->hide(); |
1757 | continue; | 1757 | continue; |
1758 | } | 1758 | } |
1759 | 1759 | ||
1760 | w = colWid; | 1760 | w = colWid; |
1761 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1761 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1762 | ++w; | 1762 | ++w; |
1763 | } | 1763 | } |
1764 | if ( i == (daysToShow-1-rowModulo)*7) | 1764 | if ( i == (daysToShow-1-rowModulo)*7) |
1765 | ++h; | 1765 | ++h; |
1766 | 1766 | ||
1767 | if ( i >= 5 ) { | 1767 | if ( i >= 5 ) { |
1768 | if ( i ==5 ) { | 1768 | if ( i ==5 ) { |
1769 | max = h/2; | 1769 | max = h/2; |
1770 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); | 1770 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); |
1771 | x -= w ;y += h/2; | 1771 | x -= w ;y += h/2; |
1772 | } else { | 1772 | } else { |
1773 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { | 1773 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { |
1774 | ++w; | 1774 | ++w; |
1775 | } | 1775 | } |
1776 | max = h-h/2; | 1776 | max = h-h/2; |
1777 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); | 1777 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); |
1778 | y -= h/2; | 1778 | y -= h/2; |
1779 | } | 1779 | } |
1780 | } else { | 1780 | } else { |
1781 | max = h; | 1781 | max = h; |
1782 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1782 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1783 | } | 1783 | } |
1784 | 1784 | ||
1785 | 1785 | ||
1786 | x += w; | 1786 | x += w; |
1787 | if ( x + w/2 > wid ) { | 1787 | if ( x + w/2 > wid ) { |
1788 | x = 0; | 1788 | x = 0; |
1789 | y += h+dayLabelHei ; | 1789 | y += h+dayLabelHei ; |
1790 | } | 1790 | } |
1791 | //mCellsW[i]->dateLabel()->setMaximumHeight( max - mCellsW[i]->lineWidth()*2 ); | 1791 | //mCellsW[i]->dateLabel()->setMaximumHeight( max - mCellsW[i]->lineWidth()*2 ); |
1792 | } | 1792 | } |
1793 | y= dayLabelHei; | 1793 | y= dayLabelHei; |
1794 | h = cellHei ; | 1794 | h = cellHei ; |
1795 | mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); | 1795 | mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); |
1796 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1796 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1797 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1797 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1798 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1798 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1799 | mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ; | 1799 | mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ; |
1800 | updateDayLabels(); | 1800 | updateDayLabels(); |
1801 | //bool forceUpdate = !updatePossible; | 1801 | //bool forceUpdate = !updatePossible; |
1802 | updatePossible = true; | 1802 | updatePossible = true; |
1803 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); | 1803 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); |
1804 | //if ( forceUpdate ) | 1804 | //if ( forceUpdate ) |
1805 | // updateView(); | 1805 | // updateView(); |
1806 | } | 1806 | } |
1807 | void KOMonthView::computeLayout() | 1807 | void KOMonthView::computeLayout() |
1808 | { | 1808 | { |
1809 | 1809 | ||
1810 | 1810 | ||
1811 | static int lastWid = 0; | 1811 | static int lastWid = 0; |
1812 | static int lastHei = 0; | 1812 | static int lastHei = 0; |
1813 | 1813 | ||
1814 | if ( mShowWeekView ){ | 1814 | if ( mShowWeekView ){ |
1815 | computeLayoutWeek(); | 1815 | computeLayoutWeek(); |
1816 | return; | 1816 | return; |
1817 | } | 1817 | } |
1818 | int daysToShow = 7; | 1818 | int daysToShow = 7; |
1819 | bool combinedSatSun = false; | 1819 | bool combinedSatSun = false; |
1820 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 1820 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1821 | daysToShow = 6; | 1821 | daysToShow = 6; |
1822 | combinedSatSun = true; | 1822 | combinedSatSun = true; |
1823 | } | 1823 | } |
1824 | int tWid = topLevelWidget()->size().width(); | 1824 | int tWid = topLevelWidget()->size().width(); |
1825 | int tHei = topLevelWidget()->size().height(); | 1825 | int tHei = topLevelWidget()->size().height(); |
1826 | 1826 | ||
1827 | int wid = width();//e | 1827 | int wid = width();//e |
1828 | int hei = height()-1-mNavigatorBar->height(); | 1828 | int hei = height()-1-mNavigatorBar->height(); |
1829 | 1829 | ||
1830 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) { | 1830 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) { |
1831 | return; | 1831 | return; |
1832 | } | 1832 | } |
1833 | if ( lastWid == width() && lastHei == height() ){ | 1833 | if ( lastWid == width() && lastHei == height() ){ |
1834 | //qDebug("KOMonthview::No compute layout needed "); | 1834 | //qDebug("KOMonthview::No compute layout needed "); |
1835 | return; | 1835 | return; |
1836 | } | 1836 | } |
1837 | 1837 | ||
1838 | lastWid = width(); | 1838 | lastWid = width(); |
1839 | lastHei = height(); | 1839 | lastHei = height(); |
1840 | //qDebug("KOMonthView::computeLayout() MMM ------------------- "); | 1840 | //qDebug("KOMonthView::computeLayout() MMM ------------------- "); |
1841 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1841 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1842 | int weeklabelwid = fm.width( "888" ); | 1842 | int weeklabelwid = fm.width( "888" ); |
1843 | wid -= weeklabelwid; | 1843 | wid -= weeklabelwid; |
1844 | 1844 | ||
1845 | int colWid = wid / daysToShow; | 1845 | int colWid = wid / daysToShow; |
1846 | int lastCol = wid - ( colWid*6 ); | 1846 | int lastCol = wid - ( colWid*6 ); |
1847 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); | 1847 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); |
1848 | int cellHei = (hei - dayLabelHei) /6; | 1848 | int cellHei = (hei - dayLabelHei) /6; |
1849 | int colModulo = wid % daysToShow; | 1849 | int colModulo = wid % daysToShow; |
1850 | int rowModulo = (hei- dayLabelHei) % 6; | 1850 | int rowModulo = (hei- dayLabelHei) % 6; |
1851 | //qDebug("rowmod %d ", rowModulo); | 1851 | //qDebug("rowmod %d ", rowModulo); |
1852 | int i; | 1852 | int i; |
1853 | int x,y,w,h; | 1853 | int x,y,w,h; |
1854 | x= 0; | 1854 | x= 0; |
1855 | y= 0; | 1855 | y= 0; |
1856 | w = colWid; | 1856 | w = colWid; |
1857 | h = dayLabelHei ; | 1857 | h = dayLabelHei ; |
1858 | for ( i = 0; i < 7; i++) { | 1858 | for ( i = 0; i < 7; i++) { |
1859 | if ( i == daysToShow-colModulo ) | 1859 | if ( i == daysToShow-colModulo ) |
1860 | ++w; | 1860 | ++w; |
1861 | if ( combinedSatSun ) { | 1861 | if ( combinedSatSun ) { |
1862 | if ( i >= daysToShow-1 ) { | 1862 | if ( i >= daysToShow-1 ) { |
1863 | 1863 | ||
1864 | if ( i == 6 ) | 1864 | if ( i == 6 ) |
1865 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,width()-x-weeklabelwid,h); | 1865 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,width()-x-weeklabelwid,h); |
1866 | else | 1866 | else |
1867 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); | 1867 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); |
1868 | x -= w/2 ; | 1868 | x -= w/2 ; |
1869 | } | 1869 | } |
1870 | else | 1870 | else |
1871 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1871 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1872 | } else | 1872 | } else |
1873 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1873 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1874 | x += w; | 1874 | x += w; |
1875 | } | 1875 | } |
1876 | x= 0; | 1876 | x= 0; |
1877 | y= dayLabelHei; | 1877 | y= dayLabelHei; |
1878 | w = colWid; | 1878 | w = colWid; |
1879 | h = cellHei ; | 1879 | h = cellHei ; |
1880 | int max = 0; | 1880 | int max = 0; |
1881 | for ( i = 0; i < mCells.count(); ++i) { | 1881 | for ( i = 0; i < mCells.count(); ++i) { |
1882 | //qDebug("iii %d ", i); | 1882 | //qDebug("iii %d ", i); |
1883 | w = colWid; | 1883 | w = colWid; |
1884 | if ( ((i) % 7) >= 7-colModulo ) { | 1884 | if ( ((i) % 7) >= 7-colModulo ) { |
1885 | ++w; | 1885 | ++w; |
1886 | } | 1886 | } |
1887 | if ( i == (6-rowModulo)*7) | 1887 | if ( i == (6-rowModulo)*7) |
1888 | ++h; | 1888 | ++h; |
1889 | if ( combinedSatSun ) { | 1889 | if ( combinedSatSun ) { |
1890 | if ( (i)%7 >= daysToShow-1 ) { | 1890 | if ( (i)%7 >= daysToShow-1 ) { |
1891 | if ( (i)%7 == daysToShow-1 ) { | 1891 | if ( (i)%7 == daysToShow-1 ) { |
1892 | w = width()-x-weeklabelwid; | 1892 | w = width()-x-weeklabelwid; |
1893 | max = h/2; | 1893 | max = h/2; |
1894 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); | 1894 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); |
1895 | x -= w ;y += h/2; | 1895 | x -= w ;y += h/2; |
1896 | } else { | 1896 | } else { |
1897 | w = width()-x-weeklabelwid; | 1897 | w = width()-x-weeklabelwid; |
1898 | max = h-h/2; | 1898 | max = h-h/2; |
1899 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); | 1899 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); |
1900 | y -= h/2; | 1900 | y -= h/2; |
1901 | } | 1901 | } |
1902 | } else { | 1902 | } else { |
1903 | max = h; | 1903 | max = h; |
1904 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1904 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1905 | } | 1905 | } |
1906 | 1906 | ||
1907 | } | 1907 | } |
1908 | else { | 1908 | else { |
1909 | max = h; | 1909 | max = h; |
1910 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1910 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1911 | } | 1911 | } |
1912 | x += w; | 1912 | x += w; |
1913 | if ( x + w/2 > wid ) { | 1913 | if ( x + w/2 > wid ) { |
1914 | x = 0; | 1914 | x = 0; |
1915 | y += h; | 1915 | y += h; |
1916 | } | 1916 | } |
1917 | //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 ); | 1917 | //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 ); |
1918 | } | 1918 | } |
1919 | y= dayLabelHei; | 1919 | y= dayLabelHei; |
1920 | h = cellHei ; | 1920 | h = cellHei ; |
1921 | for ( i = 0; i < 6; i++) { | 1921 | for ( i = 0; i < 6; i++) { |
1922 | if ( i == (6-rowModulo)) | 1922 | if ( i == (6-rowModulo)) |
1923 | ++h; | 1923 | ++h; |
1924 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); | 1924 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); |
1925 | y += h; | 1925 | y += h; |
1926 | } | 1926 | } |
1927 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1927 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1928 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1928 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1929 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1929 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1930 | mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; | 1930 | mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; |
1931 | updateDayLabels(); | 1931 | updateDayLabels(); |
1932 | //bool forceUpdate = !updatePossible; | 1932 | //bool forceUpdate = !updatePossible; |
1933 | updatePossible = true; | 1933 | updatePossible = true; |
1934 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1934 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1935 | } | 1935 | } |
1936 | 1936 | ||
1937 | void KOMonthView::showContextMenu( Incidence *incidence ) | 1937 | void KOMonthView::showContextMenu( Incidence *incidence ) |
1938 | { | 1938 | { |
1939 | if( incidence ) | 1939 | if( incidence ) |
1940 | mContextMenu->showIncidencePopup(incidence); | 1940 | mContextMenu->showIncidencePopup(incidence); |
1941 | else { | 1941 | else { |
1942 | //qDebug("KOMonthView::showContextMenu "); | 1942 | //qDebug("KOMonthView::showContextMenu "); |
1943 | mNewItemMenu->popup(QCursor::pos()); | 1943 | mNewItemMenu->popup(QCursor::pos()); |
1944 | } | 1944 | } |
1945 | /* | 1945 | /* |
1946 | if( incidence && incidence->typeID() == eventID ) { | 1946 | if( incidence && incidence->typeID() == eventID ) { |
1947 | Event *event = static_cast<Event *>(incidence); | 1947 | Event *event = static_cast<Event *>(incidence); |
1948 | mContextMenu->showEventPopup(event); | 1948 | mContextMenu->showEventPopup(event); |
1949 | } else { | 1949 | } else { |
1950 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | 1950 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; |
1951 | } | 1951 | } |
1952 | */ | 1952 | */ |
1953 | } | 1953 | } |
1954 | MonthViewCell * KOMonthView::selectedCell( ) | 1954 | MonthViewCell * KOMonthView::selectedCell( ) |
1955 | { | 1955 | { |
1956 | return mSelectedCell; | 1956 | return mSelectedCell; |
1957 | } | 1957 | } |
1958 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) | 1958 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) |
1959 | { | 1959 | { |
1960 | //qDebug("KOMonthView::setSelectedCell %d", cell); | 1960 | //qDebug("KOMonthView::setSelectedCell %d", cell); |
1961 | if ( mSelectedCell && mSelectedCell != cell ) { | 1961 | if ( mSelectedCell && mSelectedCell != cell ) { |
1962 | MonthViewCell * mvc = mSelectedCell; | 1962 | MonthViewCell * mvc = mSelectedCell; |
1963 | mSelectedCell = cell; | 1963 | mSelectedCell = cell; |
1964 | mvc->deselect(); | 1964 | mvc->deselect(); |
1965 | } else | 1965 | } else |
1966 | mSelectedCell = cell; | 1966 | mSelectedCell = cell; |
1967 | // if ( mSelectedCell ) | 1967 | // if ( mSelectedCell ) |
1968 | // mSelectedCell->select(); | 1968 | // mSelectedCell->select(); |
1969 | if ( !mSelectedCell ) | 1969 | if ( !mSelectedCell ) |
1970 | emit incidenceSelected( 0 ); | 1970 | emit incidenceSelected( 0 ); |
1971 | else | 1971 | else |
1972 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); | 1972 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); |
1973 | } | 1973 | } |
1974 | 1974 | ||
1975 | void KOMonthView::processSelectionChange() | 1975 | void KOMonthView::processSelectionChange() |
1976 | { | 1976 | { |
1977 | QPtrList<Incidence> incidences = selectedIncidences(); | 1977 | QPtrList<Incidence> incidences = selectedIncidences(); |
1978 | if (incidences.count() > 0) { | 1978 | if (incidences.count() > 0) { |
1979 | emit incidenceSelected( incidences.first() ); | 1979 | emit incidenceSelected( incidences.first() ); |
1980 | } else { | 1980 | } else { |
1981 | emit incidenceSelected( 0 ); | 1981 | emit incidenceSelected( 0 ); |
1982 | clearSelection(); | 1982 | clearSelection(); |
1983 | } | 1983 | } |
1984 | } | 1984 | } |
1985 | 1985 | ||
1986 | void KOMonthView::clearSelection() | 1986 | void KOMonthView::clearSelection() |
1987 | { | 1987 | { |
1988 | if ( mSelectedCell ) { | 1988 | if ( mSelectedCell ) { |
1989 | mSelectedCell->deselect(); | 1989 | mSelectedCell->deselect(); |
1990 | mSelectedCell = 0; | 1990 | mSelectedCell = 0; |
1991 | } | 1991 | } |
1992 | } | 1992 | } |
1993 | 1993 | ||
1994 | void KOMonthView::keyReleaseEvent ( QKeyEvent * e) | 1994 | void KOMonthView::keyReleaseEvent ( QKeyEvent * e) |
1995 | { | 1995 | { |
1996 | if ( !e->isAutoRepeat() ) { | 1996 | if ( !e->isAutoRepeat() ) { |
1997 | mFlagKeyPressed = false; | 1997 | mFlagKeyPressed = false; |
1998 | } | 1998 | } |
1999 | } | 1999 | } |
2000 | 2000 | ||
2001 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) | 2001 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) |
2002 | { | 2002 | { |
2003 | 2003 | ||
2004 | qApp->processEvents(); | 2004 | qApp->processEvents(); |
2005 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 2005 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
2006 | //e->ignore(); | 2006 | //e->ignore(); |
2007 | e->accept(); | 2007 | e->accept(); |
2008 | return; | 2008 | return; |
2009 | } | 2009 | } |
2010 | if (! e->isAutoRepeat() ) | 2010 | if (! e->isAutoRepeat() ) |
2011 | mFlagKeyPressed = true; | 2011 | mFlagKeyPressed = true; |
2012 | switch(e->key()) { | 2012 | switch(e->key()) { |
2013 | case Key_Up: | 2013 | case Key_Up: |
2014 | { | 2014 | { |
2015 | if ( mShowWeekView ) { | 2015 | if ( mShowWeekView ) { |
2016 | emit selectWeekNum ( currentWeek() - 1 ); | 2016 | emit selectWeekNum ( currentWeek() - 1 ); |
2017 | } | 2017 | } |
2018 | else { | 2018 | else { |
2019 | emit prevMonth(); | 2019 | emit prevMonth(); |
2020 | } | 2020 | } |
2021 | } | 2021 | } |
2022 | e->accept(); | 2022 | e->accept(); |
2023 | break; | 2023 | break; |
2024 | case Key_Down: | 2024 | case Key_Down: |
2025 | { | 2025 | { |
2026 | if ( mShowWeekView ) { | 2026 | if ( mShowWeekView ) { |
2027 | emit selectWeekNum ( currentWeek() +1); | 2027 | emit selectWeekNum ( currentWeek() +1); |
2028 | } | 2028 | } |
2029 | else { | 2029 | else { |
2030 | emit nextMonth(); | 2030 | emit nextMonth(); |
2031 | } | 2031 | } |
2032 | 2032 | ||
2033 | } | 2033 | } |
2034 | e->accept(); | 2034 | e->accept(); |
2035 | break; | 2035 | break; |
2036 | case Key_Return: | 2036 | case Key_Return: |
2037 | case Key_Enter: | 2037 | case Key_Enter: |
2038 | { | 2038 | { |
2039 | selectInternalWeekNum ( currentWeek() ); | 2039 | selectInternalWeekNum ( currentWeek() ); |
2040 | } | 2040 | } |
2041 | e->accept(); | 2041 | e->accept(); |
2042 | break; | 2042 | break; |
2043 | case Key_D: | 2043 | case Key_D: |
2044 | if ( mSelectedCell ) { | 2044 | if ( mSelectedCell ) { |
2045 | mSelectedCell->showDay(); | 2045 | mSelectedCell->showDay(); |
2046 | e->accept(); | 2046 | e->accept(); |
2047 | } else { | 2047 | } else { |
2048 | e->ignore(); | 2048 | e->ignore(); |
2049 | } | 2049 | } |
2050 | break; | 2050 | break; |
2051 | default: | 2051 | default: |
2052 | e->ignore(); | 2052 | e->ignore(); |
2053 | break; | 2053 | break; |
2054 | } | 2054 | } |
2055 | } | 2055 | } |
2056 | 2056 | ||
2057 | void KOMonthView::nextCell() | 2057 | void KOMonthView::nextCell() |
2058 | { | 2058 | { |
2059 | bool res = focusNextPrevChild ( true ); | 2059 | bool res = focusNextPrevChild ( true ); |
2060 | } | 2060 | } |
2061 | void KOMonthView::prevCell() | 2061 | void KOMonthView::prevCell() |
2062 | { | 2062 | { |
2063 | focusNextPrevChild ( false ); | 2063 | focusNextPrevChild ( false ); |
2064 | } | 2064 | } |
2065 | 2065 | ||
2066 | void KOMonthView::slotNewTodo() | 2066 | void KOMonthView::slotNewTodo() |
2067 | { | 2067 | { |
2068 | //qDebug("KOMonthView::slotNewTodo() "); | 2068 | //qDebug("KOMonthView::slotNewTodo() "); |
2069 | if ( mPopupCell ){ | 2069 | if ( mPopupCell ){ |
2070 | QDateTime dt( mPopupCell->date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 2070 | QDateTime dt( mPopupCell->date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
2071 | emit newTodoSignal(dt,true); | 2071 | emit newTodoSignal(dt,true); |
2072 | } | 2072 | } |
2073 | mPopupCell = 0; | 2073 | mPopupCell = 0; |
2074 | } | 2074 | } |
2075 | void KOMonthView::slotNewEvent() | 2075 | void KOMonthView::slotNewEvent() |
2076 | { | 2076 | { |
2077 | if ( mPopupCell ) { | 2077 | if ( mPopupCell ) { |
2078 | QDateTime dt( mPopupCell->date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 2078 | QDateTime dt( mPopupCell->date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
2079 | emit newEventSignal( dt ); | 2079 | emit newEventSignal( dt ); |
2080 | } | 2080 | } |
2081 | //qDebug("KOMonthView::slotNewEvent() "); | 2081 | //qDebug("KOMonthView::slotNewEvent() "); |
2082 | mPopupCell = 0; | 2082 | mPopupCell = 0; |
2083 | } | 2083 | } |
2084 | 2084 | ||
2085 | void KOMonthView::slotEditJournal() | 2085 | void KOMonthView::slotEditJournal() |
2086 | { | 2086 | { |
2087 | if ( mPopupCell ) | 2087 | if ( mPopupCell ) |
2088 | emit showJournalSignal( 7, mPopupCell->date() ); | 2088 | emit showJournalSignal( 7, mPopupCell->date() ); |
2089 | //qDebug("KOMonthView::slotEditJournal() "); | 2089 | //qDebug("KOMonthView::slotEditJournal() "); |
2090 | mPopupCell = 0; | 2090 | mPopupCell = 0; |
2091 | } | 2091 | } |
2092 | 2092 | ||
2093 | void KOMonthView::setPopupCell( MonthViewCell * c) | 2093 | void KOMonthView::setPopupCell( MonthViewCell * c) |
2094 | { | 2094 | { |
2095 | mPopupCell = c; | 2095 | mPopupCell = c; |
2096 | } | 2096 | } |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 2602487..35c2a9f 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -1,1465 +1,1467 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qheader.h> | 25 | #include <qheader.h> |
26 | #include <qcursor.h> | 26 | #include <qcursor.h> |
27 | #include <qwhatsthis.h> | 27 | #include <qwhatsthis.h> |
28 | 28 | ||
29 | #include <qinputdialog.h> | 29 | #include <qinputdialog.h> |
30 | 30 | ||
31 | #include <qvbox.h> | 31 | #include <qvbox.h> |
32 | #include <kdebug.h> | 32 | #include <kdebug.h> |
33 | #include "koprefs.h" | 33 | #include "koprefs.h" |
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | #include <kglobal.h> | 35 | #include <kglobal.h> |
36 | #include <kiconloader.h> | 36 | #include <kiconloader.h> |
37 | #include <kmessagebox.h> | 37 | #include <kmessagebox.h> |
38 | 38 | ||
39 | #include <libkcal/icaldrag.h> | 39 | #include <libkcal/icaldrag.h> |
40 | #include <libkcal/vcaldrag.h> | 40 | #include <libkcal/vcaldrag.h> |
41 | #include <libkcal/calfilter.h> | 41 | #include <libkcal/calfilter.h> |
42 | #include <libkcal/dndfactory.h> | 42 | #include <libkcal/dndfactory.h> |
43 | #include <libkcal/calendarresources.h> | 43 | #include <libkcal/calendarresources.h> |
44 | #include <libkcal/resourcecalendar.h> | 44 | #include <libkcal/resourcecalendar.h> |
45 | #include <kresources/resourceselectdialog.h> | 45 | #include <kresources/resourceselectdialog.h> |
46 | #include <libkcal/kincidenceformatter.h> | 46 | #include <libkcal/kincidenceformatter.h> |
47 | #ifndef DESKTOP_VERSION | 47 | #ifndef DESKTOP_VERSION |
48 | #include <qpe/qpeapplication.h> | 48 | #include <qpe/qpeapplication.h> |
49 | #else | 49 | #else |
50 | #include <qapplication.h> | 50 | #include <qapplication.h> |
51 | #endif | 51 | #endif |
52 | #ifndef KORG_NOPRINTER | 52 | #ifndef KORG_NOPRINTER |
53 | #include "calprinter.h" | 53 | #include "calprinter.h" |
54 | #endif | 54 | #endif |
55 | #include "docprefs.h" | 55 | #include "docprefs.h" |
56 | 56 | ||
57 | #include "kotodoview.h" | 57 | #include "kotodoview.h" |
58 | using namespace KOrg; | 58 | using namespace KOrg; |
59 | 59 | ||
60 | 60 | ||
61 | class KOTodoViewWhatsThis :public QWhatsThis | 61 | class KOTodoViewWhatsThis :public QWhatsThis |
62 | { | 62 | { |
63 | public: | 63 | public: |
64 | KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; | 64 | KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; |
65 | 65 | ||
66 | protected: | 66 | protected: |
67 | virtual QString text( const QPoint& p) | 67 | virtual QString text( const QPoint& p) |
68 | { | 68 | { |
69 | return _view->getWhatsThisText(p) ; | 69 | return _view->getWhatsThisText(p) ; |
70 | } | 70 | } |
71 | private: | 71 | private: |
72 | QWidget* _wid; | 72 | QWidget* _wid; |
73 | KOTodoView * _view; | 73 | KOTodoView * _view; |
74 | }; | 74 | }; |
75 | 75 | ||
76 | KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, | 76 | KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, |
77 | const char *name) : | 77 | const char *name) : |
78 | KListView(parent,name) | 78 | KListView(parent,name) |
79 | { | 79 | { |
80 | mName = QString ( name ); | 80 | mName = QString ( name ); |
81 | mCalendar = calendar; | 81 | mCalendar = calendar; |
82 | #ifndef DESKTOP_VERSION | 82 | #ifndef DESKTOP_VERSION |
83 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 83 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
84 | #endif | 84 | #endif |
85 | mOldCurrent = 0; | 85 | mOldCurrent = 0; |
86 | mMousePressed = false; | 86 | mMousePressed = false; |
87 | 87 | ||
88 | setAcceptDrops(true); | 88 | setAcceptDrops(true); |
89 | viewport()->setAcceptDrops(true); | 89 | viewport()->setAcceptDrops(true); |
90 | int size = 16; | 90 | int size = 16; |
91 | if (qApp->desktop()->width() < 300 ) | 91 | if (qApp->desktop()->width() < 300 ) |
92 | size = 12; | 92 | size = 12; |
93 | setTreeStepSize( size + 6 ); | 93 | setTreeStepSize( size + 6 ); |
94 | 94 | ||
95 | } | 95 | } |
96 | 96 | ||
97 | void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) | 97 | void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) |
98 | { | 98 | { |
99 | #ifndef KORG_NODND | 99 | #ifndef KORG_NODND |
100 | // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; | 100 | // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; |
101 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 101 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
102 | !QTextDrag::canDecode( e ) ) { | 102 | !QTextDrag::canDecode( e ) ) { |
103 | e->ignore(); | 103 | e->ignore(); |
104 | return; | 104 | return; |
105 | } | 105 | } |
106 | 106 | ||
107 | mOldCurrent = currentItem(); | 107 | mOldCurrent = currentItem(); |
108 | #endif | 108 | #endif |
109 | } | 109 | } |
110 | 110 | ||
111 | 111 | ||
112 | void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) | 112 | void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) |
113 | { | 113 | { |
114 | #ifndef KORG_NODND | 114 | #ifndef KORG_NODND |
115 | // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; | 115 | // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; |
116 | 116 | ||
117 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 117 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
118 | !QTextDrag::canDecode( e ) ) { | 118 | !QTextDrag::canDecode( e ) ) { |
119 | e->ignore(); | 119 | e->ignore(); |
120 | return; | 120 | return; |
121 | } | 121 | } |
122 | 122 | ||
123 | e->accept(); | 123 | e->accept(); |
124 | #endif | 124 | #endif |
125 | } | 125 | } |
126 | 126 | ||
127 | void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) | 127 | void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) |
128 | { | 128 | { |
129 | #ifndef KORG_NODND | 129 | #ifndef KORG_NODND |
130 | // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; | 130 | // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; |
131 | 131 | ||
132 | setCurrentItem(mOldCurrent); | 132 | setCurrentItem(mOldCurrent); |
133 | setSelected(mOldCurrent,true); | 133 | setSelected(mOldCurrent,true); |
134 | #endif | 134 | #endif |
135 | } | 135 | } |
136 | 136 | ||
137 | void KOTodoListView::contentsDropEvent(QDropEvent *e) | 137 | void KOTodoListView::contentsDropEvent(QDropEvent *e) |
138 | { | 138 | { |
139 | #ifndef KORG_NODND | 139 | #ifndef KORG_NODND |
140 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; | 140 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; |
141 | 141 | ||
142 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 142 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
143 | !QTextDrag::canDecode( e ) ) { | 143 | !QTextDrag::canDecode( e ) ) { |
144 | e->ignore(); | 144 | e->ignore(); |
145 | return; | 145 | return; |
146 | } | 146 | } |
147 | 147 | ||
148 | DndFactory factory( mCalendar ); | 148 | DndFactory factory( mCalendar ); |
149 | Todo *todo = factory.createDropTodo(e); | 149 | Todo *todo = factory.createDropTodo(e); |
150 | 150 | ||
151 | if (todo) { | 151 | if (todo) { |
152 | e->acceptAction(); | 152 | e->acceptAction(); |
153 | 153 | ||
154 | KOTodoViewItem *destination = | 154 | KOTodoViewItem *destination = |
155 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); | 155 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); |
156 | Todo *destinationEvent = 0; | 156 | Todo *destinationEvent = 0; |
157 | if (destination) destinationEvent = destination->todo(); | 157 | if (destination) destinationEvent = destination->todo(); |
158 | 158 | ||
159 | Todo *existingTodo = mCalendar->todo(todo->uid()); | 159 | Todo *existingTodo = mCalendar->todo(todo->uid()); |
160 | 160 | ||
161 | if(existingTodo) { | 161 | if(existingTodo) { |
162 | Incidence *to = destinationEvent; | 162 | Incidence *to = destinationEvent; |
163 | while(to) { | 163 | while(to) { |
164 | if (to->uid() == todo->uid()) { | 164 | if (to->uid() == todo->uid()) { |
165 | KMessageBox::sorry(this, | 165 | KMessageBox::sorry(this, |
166 | i18n("Cannot move Todo to itself\nor a child of itself"), | 166 | i18n("Cannot move Todo to itself\nor a child of itself"), |
167 | i18n("Drop Todo")); | 167 | i18n("Drop Todo")); |
168 | delete todo; | 168 | delete todo; |
169 | return; | 169 | return; |
170 | } | 170 | } |
171 | to = to->relatedTo(); | 171 | to = to->relatedTo(); |
172 | } | 172 | } |
173 | internalDrop = true; | 173 | internalDrop = true; |
174 | if ( destinationEvent ) | 174 | if ( destinationEvent ) |
175 | reparentTodoSignal( destinationEvent, existingTodo ); | 175 | reparentTodoSignal( destinationEvent, existingTodo ); |
176 | else | 176 | else |
177 | unparentTodoSignal(existingTodo); | 177 | unparentTodoSignal(existingTodo); |
178 | delete todo; | 178 | delete todo; |
179 | } else { | 179 | } else { |
180 | mCalendar->addTodo(todo); | 180 | mCalendar->addTodo(todo); |
181 | emit todoDropped(todo, KOGlobals::EVENTADDED); | 181 | emit todoDropped(todo, KOGlobals::EVENTADDED); |
182 | if ( destinationEvent ) | 182 | if ( destinationEvent ) |
183 | reparentTodoSignal( destinationEvent, todo ); | 183 | reparentTodoSignal( destinationEvent, todo ); |
184 | } | 184 | } |
185 | } | 185 | } |
186 | else { | 186 | else { |
187 | QString text; | 187 | QString text; |
188 | if (QTextDrag::decode(e,text)) { | 188 | if (QTextDrag::decode(e,text)) { |
189 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); | 189 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); |
190 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); | 190 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); |
191 | qDebug("Dropped : " + text); | 191 | qDebug("Dropped : " + text); |
192 | QStringList emails = QStringList::split(",",text); | 192 | QStringList emails = QStringList::split(",",text); |
193 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { | 193 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { |
194 | int pos = (*it).find("<"); | 194 | int pos = (*it).find("<"); |
195 | QString name = (*it).left(pos); | 195 | QString name = (*it).left(pos); |
196 | QString email = (*it).mid(pos); | 196 | QString email = (*it).mid(pos); |
197 | if (!email.isEmpty() && todoi) { | 197 | if (!email.isEmpty() && todoi) { |
198 | todoi->todo()->addAttendee(new Attendee(name,email)); | 198 | todoi->todo()->addAttendee(new Attendee(name,email)); |
199 | } | 199 | } |
200 | } | 200 | } |
201 | } | 201 | } |
202 | else { | 202 | else { |
203 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); | 203 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); |
204 | e->ignore(); | 204 | e->ignore(); |
205 | } | 205 | } |
206 | } | 206 | } |
207 | #endif | 207 | #endif |
208 | } | 208 | } |
209 | void KOTodoListView::wheelEvent (QWheelEvent *e) | 209 | void KOTodoListView::wheelEvent (QWheelEvent *e) |
210 | { | 210 | { |
211 | QListView::wheelEvent (e); | 211 | QListView::wheelEvent (e); |
212 | } | 212 | } |
213 | 213 | ||
214 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) | 214 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) |
215 | { | 215 | { |
216 | 216 | ||
217 | QPoint p(contentsToViewport(e->pos())); | 217 | QPoint p(contentsToViewport(e->pos())); |
218 | QListViewItem *i = itemAt(p); | 218 | QListViewItem *i = itemAt(p); |
219 | bool rootClicked = true; | 219 | bool rootClicked = true; |
220 | if (i) { | 220 | if (i) { |
221 | // if the user clicked into the root decoration of the item, don't | 221 | // if the user clicked into the root decoration of the item, don't |
222 | // try to start a drag! | 222 | // try to start a drag! |
223 | int X = p.x(); | 223 | int X = p.x(); |
224 | //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); | 224 | //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); |
225 | if (X > header()->sectionPos(0) + | 225 | if (X > header()->sectionPos(0) + |
226 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + | 226 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + |
227 | itemMargin() +i->height()|| | 227 | itemMargin() +i->height()|| |
228 | X < header()->sectionPos(0)) { | 228 | X < header()->sectionPos(0)) { |
229 | rootClicked = false; | 229 | rootClicked = false; |
230 | } | 230 | } |
231 | } else { | 231 | } else { |
232 | rootClicked = false; | 232 | rootClicked = false; |
233 | } | 233 | } |
234 | #ifndef KORG_NODND | 234 | #ifndef KORG_NODND |
235 | mMousePressed = false; | 235 | mMousePressed = false; |
236 | if (! rootClicked && !( e->button() == RightButton) ) { | 236 | if (! rootClicked && !( e->button() == RightButton) ) { |
237 | mPressPos = e->pos(); | 237 | mPressPos = e->pos(); |
238 | mMousePressed = true; | 238 | mMousePressed = true; |
239 | } else { | 239 | } else { |
240 | mMousePressed = false; | 240 | mMousePressed = false; |
241 | } | 241 | } |
242 | #endif | 242 | #endif |
243 | //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); | 243 | //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); |
244 | #ifndef DESKTOP_VERSION | 244 | #ifndef DESKTOP_VERSION |
245 | if (!( e->button() == RightButton && rootClicked) ) | 245 | if (!( e->button() == RightButton && rootClicked) ) |
246 | QListView::contentsMousePressEvent(e); | 246 | QListView::contentsMousePressEvent(e); |
247 | #else | 247 | #else |
248 | QListView::contentsMousePressEvent(e); | 248 | QListView::contentsMousePressEvent(e); |
249 | #endif | 249 | #endif |
250 | } | 250 | } |
251 | void KOTodoListView::paintEvent(QPaintEvent* e) | 251 | void KOTodoListView::paintEvent(QPaintEvent* e) |
252 | { | 252 | { |
253 | emit paintNeeded(); | 253 | emit paintNeeded(); |
254 | QListView::paintEvent( e); | 254 | QListView::paintEvent( e); |
255 | } | 255 | } |
256 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) | 256 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) |
257 | { | 257 | { |
258 | 258 | ||
259 | #ifndef KORG_NODND | 259 | #ifndef KORG_NODND |
260 | //QListView::contentsMouseMoveEvent(e); | 260 | //QListView::contentsMouseMoveEvent(e); |
261 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > | 261 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > |
262 | QApplication::startDragDistance()*3) { | 262 | QApplication::startDragDistance()*3) { |
263 | mMousePressed = false; | 263 | mMousePressed = false; |
264 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); | 264 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); |
265 | if (item) { | 265 | if (item) { |
266 | DndFactory factory( mCalendar ); | 266 | DndFactory factory( mCalendar ); |
267 | ICalDrag *vd = factory.createDrag( | 267 | ICalDrag *vd = factory.createDrag( |
268 | ((KOTodoViewItem *)item)->todo(),viewport()); | 268 | ((KOTodoViewItem *)item)->todo(),viewport()); |
269 | internalDrop = false; | 269 | internalDrop = false; |
270 | // we cannot do any senseful here, because the DnD is still broken in Qt | 270 | // we cannot do any senseful here, because the DnD is still broken in Qt |
271 | if (vd->drag()) { | 271 | if (vd->drag()) { |
272 | if ( !internalDrop ) { | 272 | if ( !internalDrop ) { |
273 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); | 273 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); |
274 | qDebug("Dnd: External move: Delete drag source "); | 274 | qDebug("Dnd: External move: Delete drag source "); |
275 | } else | 275 | } else |
276 | qDebug("Dnd: Internal move "); | 276 | qDebug("Dnd: Internal move "); |
277 | 277 | ||
278 | } else { | 278 | } else { |
279 | if ( !internalDrop ) { | 279 | if ( !internalDrop ) { |
280 | qDebug("Dnd: External Copy"); | 280 | qDebug("Dnd: External Copy"); |
281 | } else | 281 | } else |
282 | qDebug("DnD: Internal copy: Copy pending"); | 282 | qDebug("DnD: Internal copy: Copy pending"); |
283 | } | 283 | } |
284 | } | 284 | } |
285 | } | 285 | } |
286 | #endif | 286 | #endif |
287 | } | 287 | } |
288 | void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) | 288 | void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) |
289 | { | 289 | { |
290 | if ( !e->isAutoRepeat() ) { | 290 | if ( !e->isAutoRepeat() ) { |
291 | mFlagKeyPressed = false; | 291 | mFlagKeyPressed = false; |
292 | } | 292 | } |
293 | } | 293 | } |
294 | 294 | ||
295 | 295 | ||
296 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) | 296 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) |
297 | { | 297 | { |
298 | qApp->processEvents(); | 298 | qApp->processEvents(); |
299 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 299 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
300 | e->ignore(); | 300 | e->ignore(); |
301 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 301 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
302 | return; | 302 | return; |
303 | } | 303 | } |
304 | if (! e->isAutoRepeat() ) | 304 | if (! e->isAutoRepeat() ) |
305 | mFlagKeyPressed = true; | 305 | mFlagKeyPressed = true; |
306 | QListViewItem* cn; | 306 | QListViewItem* cn; |
307 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { | 307 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { |
308 | cn = currentItem(); | 308 | cn = currentItem(); |
309 | if ( cn ) { | 309 | if ( cn ) { |
310 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 310 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
311 | if ( ci ){ | 311 | if ( ci ){ |
312 | if ( e->state() == ShiftButton ) | 312 | if ( e->state() == ShiftButton ) |
313 | ci->setOn( false ); | 313 | ci->setOn( false ); |
314 | else | 314 | else |
315 | ci->setOn( true ); | 315 | ci->setOn( true ); |
316 | cn = cn->itemBelow(); | 316 | cn = cn->itemBelow(); |
317 | if ( cn ) { | 317 | if ( cn ) { |
318 | setCurrentItem ( cn ); | 318 | setCurrentItem ( cn ); |
319 | ensureItemVisible ( cn ); | 319 | ensureItemVisible ( cn ); |
320 | } | 320 | } |
321 | 321 | ||
322 | } | 322 | } |
323 | } | 323 | } |
324 | 324 | ||
325 | return; | 325 | return; |
326 | } | 326 | } |
327 | 327 | ||
328 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { | 328 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { |
329 | switch ( e->key() ) { | 329 | switch ( e->key() ) { |
330 | case Qt::Key_Down: | 330 | case Qt::Key_Down: |
331 | case Qt::Key_Up: | 331 | case Qt::Key_Up: |
332 | QListView::keyPressEvent ( e ); | 332 | QListView::keyPressEvent ( e ); |
333 | break; | 333 | break; |
334 | case Qt::Key_Left: | 334 | case Qt::Key_Left: |
335 | case Qt::Key_Right: | 335 | case Qt::Key_Right: |
336 | QListView::keyPressEvent ( e ); | 336 | QListView::keyPressEvent ( e ); |
337 | e->accept(); | 337 | e->accept(); |
338 | return; | 338 | return; |
339 | break; | 339 | break; |
340 | default: | 340 | default: |
341 | e->ignore(); | 341 | e->ignore(); |
342 | break; | 342 | break; |
343 | } | 343 | } |
344 | return; | 344 | return; |
345 | } | 345 | } |
346 | e->ignore(); | 346 | e->ignore(); |
347 | } | 347 | } |
348 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) | 348 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) |
349 | { | 349 | { |
350 | QListView::contentsMouseReleaseEvent(e); | 350 | QListView::contentsMouseReleaseEvent(e); |
351 | mMousePressed = false; | 351 | mMousePressed = false; |
352 | } | 352 | } |
353 | 353 | ||
354 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 354 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
355 | { | 355 | { |
356 | if (!e) return; | 356 | if (!e) return; |
357 | 357 | ||
358 | QPoint vp = contentsToViewport(e->pos()); | 358 | QPoint vp = contentsToViewport(e->pos()); |
359 | 359 | ||
360 | QListViewItem *item = itemAt(vp); | 360 | QListViewItem *item = itemAt(vp); |
361 | 361 | ||
362 | emit double_Clicked(item); | 362 | emit double_Clicked(item); |
363 | if (!item) return; | 363 | if (!item) return; |
364 | 364 | ||
365 | emit doubleClicked(item,vp,0); | 365 | emit doubleClicked(item,vp,0); |
366 | } | 366 | } |
367 | 367 | ||
368 | ///////////////////////////////////////////////////////////////////////////// | 368 | ///////////////////////////////////////////////////////////////////////////// |
369 | 369 | ||
370 | KOQuickTodo::KOQuickTodo(QWidget *parent) : | 370 | KOQuickTodo::KOQuickTodo(QWidget *parent) : |
371 | QLineEdit(parent) | 371 | QLineEdit(parent) |
372 | { | 372 | { |
373 | setText(i18n("Click to add a new Todo")); | 373 | setText(i18n("Click to add a new Todo")); |
374 | } | 374 | } |
375 | 375 | ||
376 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) | 376 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) |
377 | { | 377 | { |
378 | if ( text()==i18n("Click to add a new Todo") ) | 378 | if ( text()==i18n("Click to add a new Todo") ) |
379 | setText(""); | 379 | setText(""); |
380 | QLineEdit::focusInEvent(ev); | 380 | QLineEdit::focusInEvent(ev); |
381 | } | 381 | } |
382 | 382 | ||
383 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) | 383 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) |
384 | { | 384 | { |
385 | setText(i18n("Click to add a new Todo")); | 385 | setText(i18n("Click to add a new Todo")); |
386 | QLineEdit::focusOutEvent(ev); | 386 | QLineEdit::focusOutEvent(ev); |
387 | } | 387 | } |
388 | 388 | ||
389 | ///////////////////////////////////////////////////////////////////////////// | 389 | ///////////////////////////////////////////////////////////////////////////// |
390 | 390 | ||
391 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | 391 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : |
392 | KOrg::BaseView(calendar,parent,name) | 392 | KOrg::BaseView(calendar,parent,name) |
393 | { | 393 | { |
394 | mPendingUpdateBeforeRepaint = false; | 394 | mPendingUpdateBeforeRepaint = false; |
395 | isFlatDisplay = false; | 395 | isFlatDisplay = false; |
396 | mNavigator = 0; | 396 | mNavigator = 0; |
397 | QBoxLayout *topLayout = new QVBoxLayout(this); | 397 | QBoxLayout *topLayout = new QVBoxLayout(this); |
398 | mName = QString ( name ); | 398 | mName = QString ( name ); |
399 | mBlockUpdate = false; | 399 | mBlockUpdate = false; |
400 | mQuickAdd = new KOQuickTodo(this); | 400 | mQuickAdd = new KOQuickTodo(this); |
401 | topLayout->addWidget(mQuickAdd); | 401 | topLayout->addWidget(mQuickAdd); |
402 | 402 | ||
403 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); | 403 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); |
404 | 404 | ||
405 | mTodoListView = new KOTodoListView(calendar,this, name ); | 405 | mTodoListView = new KOTodoListView(calendar,this, name ); |
406 | topLayout->addWidget(mTodoListView); | 406 | topLayout->addWidget(mTodoListView); |
407 | //mTodoListView->header()->setMaximumHeight(30); | 407 | //mTodoListView->header()->setMaximumHeight(30); |
408 | mTodoListView->setRootIsDecorated(true); | 408 | mTodoListView->setRootIsDecorated(true); |
409 | mTodoListView->setAllColumnsShowFocus(true); | 409 | mTodoListView->setAllColumnsShowFocus(true); |
410 | 410 | ||
411 | mTodoListView->setShowSortIndicator(true); | 411 | mTodoListView->setShowSortIndicator(true); |
412 | 412 | ||
413 | mTodoListView->addColumn(i18n("Todo")); | 413 | mTodoListView->addColumn(i18n("Todo")); |
414 | mTodoListView->addColumn(i18n("Prio")); | 414 | mTodoListView->addColumn(i18n("Prio")); |
415 | mTodoListView->setColumnAlignment(1,AlignHCenter); | 415 | mTodoListView->setColumnAlignment(1,AlignHCenter); |
416 | mTodoListView->addColumn(i18n("Complete")); | 416 | mTodoListView->addColumn(i18n("Complete")); |
417 | mTodoListView->setColumnAlignment(2,AlignCenter); | 417 | mTodoListView->setColumnAlignment(2,AlignCenter); |
418 | 418 | ||
419 | mTodoListView->addColumn(i18n("Due Date")); | 419 | mTodoListView->addColumn(i18n("Due Date")); |
420 | mTodoListView->setColumnAlignment(3,AlignLeft); | 420 | mTodoListView->setColumnAlignment(3,AlignLeft); |
421 | mTodoListView->addColumn(i18n("Due Time")); | 421 | mTodoListView->addColumn(i18n("Due Time")); |
422 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 422 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
423 | 423 | ||
424 | mTodoListView->addColumn(i18n("Start Date")); | 424 | mTodoListView->addColumn(i18n("Start Date")); |
425 | mTodoListView->setColumnAlignment(5,AlignLeft); | 425 | mTodoListView->setColumnAlignment(5,AlignLeft); |
426 | mTodoListView->addColumn(i18n("Start Time")); | 426 | mTodoListView->addColumn(i18n("Start Time")); |
427 | mTodoListView->setColumnAlignment(6,AlignHCenter); | 427 | mTodoListView->setColumnAlignment(6,AlignHCenter); |
428 | 428 | ||
429 | mTodoListView->addColumn(i18n("Cancelled")); | 429 | mTodoListView->addColumn(i18n("Cancelled")); |
430 | mTodoListView->addColumn(i18n("Categories")); | 430 | mTodoListView->addColumn(i18n("Categories")); |
431 | #if 0 | 431 | #if 0 |
432 | mTodoListView->addColumn(i18n("Sort Id")); | 432 | mTodoListView->addColumn(i18n("Sort Id")); |
433 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 433 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
434 | #endif | 434 | #endif |
435 | 435 | ||
436 | mTodoListView->setMinimumHeight( 60 ); | 436 | mTodoListView->setMinimumHeight( 60 ); |
437 | mTodoListView->setItemsRenameable( true ); | 437 | mTodoListView->setItemsRenameable( true ); |
438 | mTodoListView->setRenameable( 0 ); | 438 | mTodoListView->setRenameable( 0 ); |
439 | mTodoListView->setColumnWidth( 0, 120 ); | 439 | mTodoListView->setColumnWidth( 0, 120 ); |
440 | mTodoListView->setColumnWidthMode(0, QListView::Manual); | 440 | mTodoListView->setColumnWidthMode(0, QListView::Manual); |
441 | mTodoListView->setColumnWidthMode(1, QListView::Manual); | 441 | mTodoListView->setColumnWidthMode(1, QListView::Manual); |
442 | mTodoListView->setColumnWidthMode(2, QListView::Manual); | 442 | mTodoListView->setColumnWidthMode(2, QListView::Manual); |
443 | mTodoListView->setColumnWidthMode(3, QListView::Manual); | 443 | mTodoListView->setColumnWidthMode(3, QListView::Manual); |
444 | mTodoListView->setColumnWidthMode(4, QListView::Manual); | 444 | mTodoListView->setColumnWidthMode(4, QListView::Manual); |
445 | mTodoListView->setColumnWidthMode(5, QListView::Manual); | 445 | mTodoListView->setColumnWidthMode(5, QListView::Manual); |
446 | mTodoListView->setColumnWidthMode(6, QListView::Manual); | 446 | mTodoListView->setColumnWidthMode(6, QListView::Manual); |
447 | mTodoListView->setColumnWidthMode(7, QListView::Manual); | 447 | mTodoListView->setColumnWidthMode(7, QListView::Manual); |
448 | mTodoListView->setColumnWidthMode(8, QListView::Manual); | 448 | mTodoListView->setColumnWidthMode(8, QListView::Manual); |
449 | 449 | ||
450 | 450 | ||
451 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); | 451 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); |
452 | 452 | ||
453 | mPriorityPopupMenu = new QPopupMenu(this); | 453 | mPriorityPopupMenu = new QPopupMenu(this); |
454 | for (int i = 1; i <= 5; i++) { | 454 | for (int i = 1; i <= 5; i++) { |
455 | QString label = QString ("%1").arg (i); | 455 | QString label = QString ("%1").arg (i); |
456 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; | 456 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; |
457 | } | 457 | } |
458 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); | 458 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); |
459 | 459 | ||
460 | mPercentageCompletedPopupMenu = new QPopupMenu(this); | 460 | mPercentageCompletedPopupMenu = new QPopupMenu(this); |
461 | for (int i = 0; i <= 100; i+=20) { | 461 | for (int i = 0; i <= 100; i+=20) { |
462 | QString label = QString ("%1 %").arg (i); | 462 | QString label = QString ("%1 %").arg (i); |
463 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; | 463 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; |
464 | } | 464 | } |
465 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); | 465 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); |
466 | 466 | ||
467 | 467 | ||
468 | 468 | ||
469 | mItemPopupMenu = new QPopupMenu(this); | 469 | mItemPopupMenu = new QPopupMenu(this); |
470 | mItemPopupMenu->insertItem(i18n("Show..."), this, | 470 | mItemPopupMenu->insertItem(i18n("Show..."), this, |
471 | SLOT (showTodo())); | 471 | SLOT (showTodo())); |
472 | mItemPopupMenu->insertItem(i18n("Edit..."), this, | 472 | mItemPopupMenu->insertItem(i18n("Edit..."), this, |
473 | SLOT (editTodo())); | 473 | SLOT (editTodo())); |
474 | mItemPopupMenu->insertItem( i18n("Delete"), this, | 474 | mItemPopupMenu->insertItem( i18n("Delete"), this, |
475 | SLOT (deleteTodo())); | 475 | SLOT (deleteTodo())); |
476 | mItemPopupMenu->insertItem( i18n("Clone..."), this, | 476 | mItemPopupMenu->insertItem( i18n("Clone..."), this, |
477 | SLOT (cloneTodo())); | 477 | SLOT (cloneTodo())); |
478 | mItemPopupMenu->insertItem( i18n("Move..."), this, | 478 | mItemPopupMenu->insertItem( i18n("Move..."), this, |
479 | SLOT (moveTodo())); | 479 | SLOT (moveTodo())); |
480 | #ifndef DESKTOP_VERSION | 480 | #ifndef DESKTOP_VERSION |
481 | mItemPopupMenu->insertItem( i18n("Beam..."), this, | 481 | mItemPopupMenu->insertItem( i18n("Beam..."), this, |
482 | SLOT (beamTodo())); | 482 | SLOT (beamTodo())); |
483 | #endif | 483 | #endif |
484 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, | 484 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, |
485 | SLOT (cancelTodo())); | 485 | SLOT (cancelTodo())); |
486 | mItemPopupMenu->insertSeparator(); | 486 | mItemPopupMenu->insertSeparator(); |
487 | mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, | 487 | mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, |
488 | SLOT (toggleRunningItem())); | 488 | SLOT (toggleRunningItem())); |
489 | mItemPopupMenu->insertSeparator(); | 489 | mItemPopupMenu->insertSeparator(); |
490 | /* | 490 | /* |
491 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, | 491 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, |
492 | SLOT (newTodo())); | 492 | SLOT (newTodo())); |
493 | */ | 493 | */ |
494 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, | 494 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, |
495 | SLOT (newSubTodo())); | 495 | SLOT (newSubTodo())); |
496 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, | 496 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, |
497 | SLOT (unparentTodo()),0,21); | 497 | SLOT (unparentTodo()),0,21); |
498 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, | 498 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, |
499 | SLOT (reparentTodo()),0,22); | 499 | SLOT (reparentTodo()),0,22); |
500 | mItemPopupMenu->insertSeparator(); | 500 | mItemPopupMenu->insertSeparator(); |
501 | #if 0 | 501 | #if 0 |
502 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), | 502 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), |
503 | this, SLOT( purgeCompleted() ) ); | 503 | this, SLOT( purgeCompleted() ) ); |
504 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), | 504 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), |
505 | this, SLOT( toggleCompleted() ),0, 33 ); | 505 | this, SLOT( toggleCompleted() ),0, 33 ); |
506 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 506 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
507 | this, SLOT( toggleQuickTodo() ),0, 34 ); | 507 | this, SLOT( toggleQuickTodo() ),0, 34 ); |
508 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 508 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
509 | this, SLOT( toggleRunning() ),0, 35 ); | 509 | this, SLOT( toggleRunning() ),0, 35 ); |
510 | 510 | ||
511 | #endif | 511 | #endif |
512 | mPopupMenu = new QPopupMenu(this); | 512 | mPopupMenu = new QPopupMenu(this); |
513 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, | 513 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, |
514 | SLOT (newTodo()),0,1); | 514 | SLOT (newTodo()),0,1); |
515 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), | 515 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), |
516 | this, SLOT(purgeCompleted()),0,2); | 516 | this, SLOT(purgeCompleted()),0,2); |
517 | mPopupMenu->insertItem(i18n("Show Completed"), | 517 | mPopupMenu->insertItem(i18n("Show Completed"), |
518 | this, SLOT( toggleCompleted() ),0,3 ); | 518 | this, SLOT( toggleCompleted() ),0,3 ); |
519 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 519 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
520 | this, SLOT( toggleRunning() ),0,5 ); | 520 | this, SLOT( toggleRunning() ),0,5 ); |
521 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), | 521 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), |
522 | this, SLOT( setAllOpen() ),0,6 ); | 522 | this, SLOT( setAllOpen() ),0,6 ); |
523 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), | 523 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), |
524 | this, SLOT( setAllClose() ),0,7 ); | 524 | this, SLOT( setAllClose() ),0,7 ); |
525 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), | 525 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), |
526 | this, SLOT( setAllFlat() ),0,8 ); | 526 | this, SLOT( setAllFlat() ),0,8 ); |
527 | mPopupMenu->insertSeparator(); | 527 | mPopupMenu->insertSeparator(); |
528 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 528 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
529 | this, SLOT( toggleQuickTodo() ),0,4 ); | 529 | this, SLOT( toggleQuickTodo() ),0,4 ); |
530 | mDocPrefs = new DocPrefs( name ); | 530 | mDocPrefs = new DocPrefs( name ); |
531 | 531 | ||
532 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); | 532 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); |
533 | mPopupMenu->setCheckable( true ); | 533 | mPopupMenu->setCheckable( true ); |
534 | mItemPopupMenu->setCheckable( true ); | 534 | mItemPopupMenu->setCheckable( true ); |
535 | 535 | ||
536 | 536 | ||
537 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 537 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
538 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 538 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
539 | 539 | ||
540 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 540 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
541 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 541 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
542 | 542 | ||
543 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 543 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
544 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 544 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
545 | 545 | ||
546 | 546 | ||
547 | // Double clicking conflicts with opening/closing the subtree | 547 | // Double clicking conflicts with opening/closing the subtree |
548 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), | 548 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), |
549 | SLOT( editItem( QListViewItem *) ) ); | 549 | SLOT( editItem( QListViewItem *) ) ); |
550 | /* | 550 | /* |
551 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, | 551 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, |
552 | const QPoint &,int ) ), | 552 | const QPoint &,int ) ), |
553 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 553 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
554 | */ | 554 | */ |
555 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, | 555 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, |
556 | const QPoint &,int ) ), | 556 | const QPoint &,int ) ), |
557 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 557 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
558 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), | 558 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), |
559 | SLOT( itemClicked( QListViewItem * ) ) ); | 559 | SLOT( itemClicked( QListViewItem * ) ) ); |
560 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), | 560 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), |
561 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); | 561 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); |
562 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 562 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
563 | SLOT( updateView() ) ); | 563 | SLOT( updateView() ) ); |
564 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 564 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
565 | SLOT( todoModified(Todo *, int) ) ); | 565 | SLOT( todoModified(Todo *, int) ) ); |
566 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), | 566 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), |
567 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 567 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
568 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), | 568 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), |
569 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 569 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
570 | connect( mTodoListView, SIGNAL( paintNeeded() ), | 570 | connect( mTodoListView, SIGNAL( paintNeeded() ), |
571 | SLOT( paintNeeded()) ); | 571 | SLOT( paintNeeded()) ); |
572 | 572 | ||
573 | #if 0 | 573 | #if 0 |
574 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), | 574 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), |
575 | SLOT(selectionChanged(QListViewItem *))); | 575 | SLOT(selectionChanged(QListViewItem *))); |
576 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), | 576 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), |
577 | SLOT(selectionChanged(QListViewItem *))); | 577 | SLOT(selectionChanged(QListViewItem *))); |
578 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), | 578 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), |
579 | SLOT(selectionChanged(QListViewItem *))); | 579 | SLOT(selectionChanged(QListViewItem *))); |
580 | #endif | 580 | #endif |
581 | 581 | ||
582 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); | 582 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); |
583 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); | 583 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); |
584 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); | 584 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); |
585 | 585 | ||
586 | connect( mTodoListView, SIGNAL(selectionChanged() ), | 586 | connect( mTodoListView, SIGNAL(selectionChanged() ), |
587 | SLOT( processSelectionChange() ) ); | 587 | SLOT( processSelectionChange() ) ); |
588 | connect( mQuickAdd, SIGNAL( returnPressed () ), | 588 | connect( mQuickAdd, SIGNAL( returnPressed () ), |
589 | SLOT( addQuickTodo() ) ); | 589 | SLOT( addQuickTodo() ) ); |
590 | 590 | ||
591 | } | 591 | } |
592 | 592 | ||
593 | KOTodoView::~KOTodoView() | 593 | KOTodoView::~KOTodoView() |
594 | { | 594 | { |
595 | 595 | ||
596 | #if QT_VERSION >= 0x030000 | 596 | #if QT_VERSION >= 0x030000 |
597 | 597 | ||
598 | #else | 598 | #else |
599 | delete mKOTodoViewWhatsThis; | 599 | delete mKOTodoViewWhatsThis; |
600 | #endif | 600 | #endif |
601 | 601 | ||
602 | delete mDocPrefs; | 602 | delete mDocPrefs; |
603 | } | 603 | } |
604 | QString KOTodoView::getWhatsThisText(QPoint p) | 604 | QString KOTodoView::getWhatsThisText(QPoint p) |
605 | { | 605 | { |
606 | KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); | 606 | KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); |
607 | if ( item ) | 607 | if ( item ) |
608 | return KIncidenceFormatter::instance()->getFormattedText( item->todo(), | 608 | return KIncidenceFormatter::instance()->getFormattedText( item->todo(), |
609 | KOPrefs::instance()->mWTshowDetails, | 609 | KOPrefs::instance()->mWTshowDetails, |
610 | KOPrefs::instance()->mWTshowCreated, | 610 | KOPrefs::instance()->mWTshowCreated, |
611 | KOPrefs::instance()->mWTshowChanged); | 611 | KOPrefs::instance()->mWTshowChanged); |
612 | return i18n("That is the todo view" ); | 612 | return i18n("That is the todo view" ); |
613 | 613 | ||
614 | } | 614 | } |
615 | 615 | ||
616 | void KOTodoView::jumpToDate () | 616 | void KOTodoView::jumpToDate () |
617 | { | 617 | { |
618 | // if (mActiveItem) { | 618 | // if (mActiveItem) { |
619 | // mActiveItem->todo()); | 619 | // mActiveItem->todo()); |
620 | // if ( mActiveItem->todo()->hasDueDate() ) | 620 | // if ( mActiveItem->todo()->hasDueDate() ) |
621 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); | 621 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); |
622 | } | 622 | } |
623 | void KOTodoView::paintNeeded() | 623 | void KOTodoView::paintNeeded() |
624 | { | 624 | { |
625 | if ( mPendingUpdateBeforeRepaint ) { | 625 | if ( mPendingUpdateBeforeRepaint ) { |
626 | updateView(); | 626 | updateView(); |
627 | mPendingUpdateBeforeRepaint = false; | 627 | mPendingUpdateBeforeRepaint = false; |
628 | } | 628 | } |
629 | } | 629 | } |
630 | void KOTodoView::paintEvent(QPaintEvent * pevent) | 630 | void KOTodoView::paintEvent(QPaintEvent * pevent) |
631 | { | 631 | { |
632 | if ( mPendingUpdateBeforeRepaint ) { | 632 | if ( mPendingUpdateBeforeRepaint ) { |
633 | updateView(); | 633 | updateView(); |
634 | mPendingUpdateBeforeRepaint = false; | 634 | mPendingUpdateBeforeRepaint = false; |
635 | } | 635 | } |
636 | KOrg::BaseView::paintEvent( pevent); | 636 | KOrg::BaseView::paintEvent( pevent); |
637 | } | 637 | } |
638 | 638 | ||
639 | void KOTodoView::updateView() | 639 | void KOTodoView::updateView() |
640 | { | 640 | { |
641 | pendingSubtodo = 0; | 641 | pendingSubtodo = 0; |
642 | if ( mBlockUpdate ) { | 642 | if ( mBlockUpdate ) { |
643 | return; | 643 | return; |
644 | } | 644 | } |
645 | if ( !isVisible() ) { | 645 | if ( !isVisible() ) { |
646 | mPendingUpdateBeforeRepaint = true; | 646 | mPendingUpdateBeforeRepaint = true; |
647 | return; | 647 | return; |
648 | } | 648 | } |
649 | storeCurrentItem(); | 649 | storeCurrentItem(); |
650 | //qDebug("KOTodoView::updateView() %x", this); | 650 | //qDebug("KOTodoView::updateView() %x", this); |
651 | if ( isFlatDisplay ) { | 651 | if ( isFlatDisplay ) { |
652 | displayAllFlat(); | 652 | displayAllFlat(); |
653 | resetCurrentItem(); | 653 | resetCurrentItem(); |
654 | return; | 654 | return; |
655 | } | 655 | } |
656 | //qDebug("update "); | 656 | //qDebug("update "); |
657 | // kdDebug() << "KOTodoView::updateView()" << endl; | 657 | // kdDebug() << "KOTodoView::updateView()" << endl; |
658 | QFont fo = KOPrefs::instance()->mTodoViewFont; | 658 | QFont fo = KOPrefs::instance()->mTodoViewFont; |
659 | 659 | ||
660 | 660 | ||
661 | mTodoListView->clear(); | 661 | mTodoListView->clear(); |
662 | if ( mName == "todolistsmall" ) { | 662 | if ( mName == "todolistsmall" ) { |
663 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { | 663 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { |
664 | int ps = fo.pointSize() -2; | 664 | int ps = fo.pointSize() -2; |
665 | if ( ps > 12 ) | 665 | if ( ps > 12 ) |
666 | ps -= 2; | 666 | ps -= 2; |
667 | fo.setPointSize( ps ); | 667 | fo.setPointSize( ps ); |
668 | } | 668 | } |
669 | } | 669 | } |
670 | 670 | ||
671 | mTodoListView->setFont( fo ); | 671 | mTodoListView->setFont( fo ); |
672 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); | 672 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); |
673 | //mTodoListView->header()->setMaximumHeight(fm.height()); | 673 | //mTodoListView->header()->setMaximumHeight(fm.height()); |
674 | QPtrList<Todo> todoList = calendar()->todos(); | 674 | QPtrList<Todo> todoList = calendar()->todos(); |
675 | 675 | ||
676 | /* | 676 | /* |
677 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; | 677 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; |
678 | Event *t; | 678 | Event *t; |
679 | for(t = todoList.first(); t; t = todoList.next()) { | 679 | for(t = todoList.first(); t; t = todoList.next()) { |
680 | kdDebug() << " " << t->getSummary() << endl; | 680 | kdDebug() << " " << t->getSummary() << endl; |
681 | 681 | ||
682 | if (t->getRelatedTo()) { | 682 | if (t->getRelatedTo()) { |
683 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; | 683 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; |
684 | } | 684 | } |
685 | 685 | ||
686 | QPtrList<Event> l = t->getRelations(); | 686 | QPtrList<Event> l = t->getRelations(); |
687 | Event *c; | 687 | Event *c; |
688 | for(c=l.first();c;c=l.next()) { | 688 | for(c=l.first();c;c=l.next()) { |
689 | kdDebug() << " - relation: " << c->getSummary() << endl; | 689 | kdDebug() << " - relation: " << c->getSummary() << endl; |
690 | } | 690 | } |
691 | } | 691 | } |
692 | */ | 692 | */ |
693 | 693 | ||
694 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a | 694 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a |
695 | // specific order of events. That means that we have to generate parent items | 695 | // specific order of events. That means that we have to generate parent items |
696 | // recursively for proper hierarchical display of Todos. | 696 | // recursively for proper hierarchical display of Todos. |
697 | mTodoMap.clear(); | 697 | mTodoMap.clear(); |
698 | Todo *todo; | 698 | Todo *todo; |
699 | todo = todoList.first();// todo; todo = todoList.next()) { | 699 | todo = todoList.first();// todo; todo = todoList.next()) { |
700 | while ( todo ) { | 700 | while ( todo ) { |
701 | bool next = true; | 701 | bool next = true; |
702 | // qDebug("todo %s ", todo->summary().latin1()); | 702 | // qDebug("todo %s ", todo->summary().latin1()); |
703 | Incidence *incidence = todo->relatedTo(); | 703 | Incidence *incidence = todo->relatedTo(); |
704 | while ( incidence ) { | 704 | while ( incidence ) { |
705 | if ( incidence->typeID() == todoID ) { | 705 | if ( incidence->typeID() == todoID ) { |
706 | //qDebug("related %s ",incidence->summary().latin1() ); | 706 | //qDebug("related %s ",incidence->summary().latin1() ); |
707 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { | 707 | if ( !(todoList.contains ( ((Todo* )incidence ) ) ) && incidence->calEnabled() ) { |
708 | //qDebug("related not found "); | 708 | //qDebug("related not found "); |
709 | todoList.remove( ); | 709 | todoList.remove( ); |
710 | todo = todoList.current(); | 710 | todo = todoList.current(); |
711 | next = false; | 711 | next = false; |
712 | incidence = 0; | 712 | incidence = 0; |
713 | 713 | ||
714 | } else { | 714 | } else { |
715 | //qDebug("related found "); | 715 | //qDebug("related found "); |
716 | incidence = incidence->relatedTo(); | 716 | incidence = incidence->relatedTo(); |
717 | } | 717 | } |
718 | } else | 718 | } else |
719 | incidence = 0; | 719 | incidence = 0; |
720 | } | 720 | } |
721 | if ( next ) | 721 | if ( next ) |
722 | todo = todoList.next(); | 722 | todo = todoList.next(); |
723 | } | 723 | } |
724 | 724 | ||
725 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 725 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
726 | if (!mTodoMap.contains(todo) && checkTodo( todo ) ) | 726 | if (!mTodoMap.contains(todo) && checkTodo( todo ) ) |
727 | { | 727 | { |
728 | insertTodoItem(todo); | 728 | insertTodoItem(todo); |
729 | } | 729 | } |
730 | } | 730 | } |
731 | // Restore opened/closed state | 731 | // Restore opened/closed state |
732 | mTodoListView->blockSignals( true ); | 732 | mTodoListView->blockSignals( true ); |
733 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); | 733 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); |
734 | mTodoListView->blockSignals( false ); | 734 | mTodoListView->blockSignals( false ); |
735 | resetCurrentItem(); | 735 | resetCurrentItem(); |
736 | processSelectionChange(); | 736 | processSelectionChange(); |
737 | } | 737 | } |
738 | 738 | ||
739 | void KOTodoView::storeCurrentItem() | 739 | void KOTodoView::storeCurrentItem() |
740 | { | 740 | { |
741 | mCurItem = 0; | 741 | mCurItem = 0; |
742 | mCurItemRootParent = 0; | 742 | mCurItemRootParent = 0; |
743 | mCurItemParent = 0; | 743 | mCurItemParent = 0; |
744 | mCurItemAbove = 0; | 744 | mCurItemAbove = 0; |
745 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 745 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
746 | if (mActiveItem) { | 746 | if (mActiveItem) { |
747 | mCurItem = mActiveItem->todo(); | 747 | mCurItem = mActiveItem->todo(); |
748 | KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); | 748 | KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); |
749 | if ( activeItemAbove ) | 749 | if ( activeItemAbove ) |
750 | mCurItemAbove = activeItemAbove->todo(); | 750 | mCurItemAbove = activeItemAbove->todo(); |
751 | mCurItemRootParent = mCurItem; | 751 | mCurItemRootParent = mCurItem; |
752 | mCurItemParent = mCurItemRootParent->relatedTo(); | 752 | mCurItemParent = mCurItemRootParent->relatedTo(); |
753 | while ( mCurItemRootParent->relatedTo() != 0 ) | 753 | while ( mCurItemRootParent->relatedTo() != 0 ) |
754 | mCurItemRootParent = mCurItemRootParent->relatedTo(); | 754 | mCurItemRootParent = mCurItemRootParent->relatedTo(); |
755 | } | 755 | } |
756 | mActiveItem = 0; | 756 | mActiveItem = 0; |
757 | } | 757 | } |
758 | 758 | ||
759 | void KOTodoView::resetCurrentItem() | 759 | void KOTodoView::resetCurrentItem() |
760 | { | 760 | { |
761 | mTodoListView->setFocus(); | 761 | mTodoListView->setFocus(); |
762 | KOTodoViewItem* foundItem = 0; | 762 | KOTodoViewItem* foundItem = 0; |
763 | KOTodoViewItem* foundItemRoot = 0; | 763 | KOTodoViewItem* foundItemRoot = 0; |
764 | KOTodoViewItem* foundItemParent = 0; | 764 | KOTodoViewItem* foundItemParent = 0; |
765 | KOTodoViewItem* foundItemAbove = 0; | 765 | KOTodoViewItem* foundItemAbove = 0; |
766 | if ( mTodoListView->firstChild () ) { | 766 | if ( mTodoListView->firstChild () ) { |
767 | if ( mCurItem ) { | 767 | if ( mCurItem ) { |
768 | KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); | 768 | KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); |
769 | while ( item ) { | 769 | while ( item ) { |
770 | if ( item->todo() == mCurItem ) { | 770 | if ( item->todo() == mCurItem ) { |
771 | foundItem = item; | 771 | foundItem = item; |
772 | break; | 772 | break; |
773 | } else if ( item->todo() == mCurItemAbove ) { | 773 | } else if ( item->todo() == mCurItemAbove ) { |
774 | foundItemAbove = item; | 774 | foundItemAbove = item; |
775 | 775 | ||
776 | } | 776 | } |
777 | if ( item->todo() == mCurItemRootParent ) { | 777 | if ( item->todo() == mCurItemRootParent ) { |
778 | foundItemRoot = item; | 778 | foundItemRoot = item; |
779 | } | 779 | } |
780 | if ( item->todo() == mCurItemParent ) { | 780 | if ( item->todo() == mCurItemParent ) { |
781 | foundItemParent = item; | 781 | foundItemParent = item; |
782 | } | 782 | } |
783 | item = (KOTodoViewItem*)item->itemBelow(); | 783 | item = (KOTodoViewItem*)item->itemBelow(); |
784 | } | 784 | } |
785 | if ( ! foundItem ) { | 785 | if ( ! foundItem ) { |
786 | if ( foundItemParent ) { | 786 | if ( foundItemParent ) { |
787 | foundItem = foundItemParent; | 787 | foundItem = foundItemParent; |
788 | } else { | 788 | } else { |
789 | if ( foundItemRoot ) | 789 | if ( foundItemRoot ) |
790 | foundItem = foundItemRoot; | 790 | foundItem = foundItemRoot; |
791 | else | 791 | else |
792 | foundItem = foundItemAbove; | 792 | foundItem = foundItemAbove; |
793 | } | 793 | } |
794 | } | 794 | } |
795 | } | 795 | } |
796 | if ( foundItem ) { | 796 | if ( foundItem ) { |
797 | mTodoListView->setCurrentItem( foundItem ); | 797 | mTodoListView->setCurrentItem( foundItem ); |
798 | mTodoListView->ensureItemVisible( foundItem ); | 798 | mTodoListView->ensureItemVisible( foundItem ); |
799 | } else { | 799 | } else { |
800 | mTodoListView->setCurrentItem( mTodoListView->firstChild () ); | 800 | mTodoListView->setCurrentItem( mTodoListView->firstChild () ); |
801 | } | 801 | } |
802 | } | 802 | } |
803 | mTodoListView->setFocus(); | 803 | mTodoListView->setFocus(); |
804 | } | 804 | } |
805 | //Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; | 805 | //Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; |
806 | bool KOTodoView::checkTodo( Todo * todo ) | 806 | bool KOTodoView::checkTodo( Todo * todo ) |
807 | { | 807 | { |
808 | 808 | ||
809 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) | 809 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) |
810 | return false; | 810 | return false; |
811 | if ( !todo->isCompleted() ) { | 811 | if ( !todo->isCompleted() ) { |
812 | if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) | 812 | if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) |
813 | return true; | 813 | return true; |
814 | } | 814 | } |
815 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { | 815 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { |
816 | if ( todo->hasStartDate() ) | 816 | if ( todo->hasStartDate() ) |
817 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) | 817 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) |
818 | return false; | 818 | return false; |
819 | if ( todo->hasDueDate() ) | 819 | if ( todo->hasDueDate() ) |
820 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) | 820 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) |
821 | return false; | 821 | return false; |
822 | } | 822 | } |
823 | return true; | 823 | return true; |
824 | } | 824 | } |
825 | 825 | ||
826 | void KOTodoView::restoreItemState( QListViewItem *item ) | 826 | void KOTodoView::restoreItemState( QListViewItem *item ) |
827 | { | 827 | { |
828 | pendingSubtodo = 0; | 828 | pendingSubtodo = 0; |
829 | while( item ) { | 829 | while( item ) { |
830 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 830 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
831 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); | 831 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); |
832 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); | 832 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); |
833 | item = item->nextSibling(); | 833 | item = item->nextSibling(); |
834 | } | 834 | } |
835 | } | 835 | } |
836 | 836 | ||
837 | 837 | ||
838 | QMap<Todo *,KOTodoViewItem *>::ConstIterator | 838 | QMap<Todo *,KOTodoViewItem *>::ConstIterator |
839 | KOTodoView::insertTodoItem(Todo *todo) | 839 | KOTodoView::insertTodoItem(Todo *todo) |
840 | { | 840 | { |
841 | 841 | ||
842 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; | 842 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; |
843 | // TODO: Check, if dynmaic cast is necessary | 843 | // TODO: Check, if dynmaic cast is necessary |
844 | 844 | ||
845 | pendingSubtodo = 0; | 845 | pendingSubtodo = 0; |
846 | Incidence *incidence = todo->relatedTo(); | 846 | Incidence *incidence = todo->relatedTo(); |
847 | if (incidence && incidence->typeID() == todoID ) { | 847 | while ( incidence && !incidence->calEnabled() ) |
848 | Todo *relatedTodo = static_cast<Todo *>(incidence); | 848 | incidence = incidence->relatedTo(); |
849 | 849 | if (incidence && incidence->typeID() == todoID ) { | |
850 | // kdDebug() << " has Related" << endl; | 850 | Todo *relatedTodo = static_cast<Todo *>(incidence); |
851 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 851 | |
852 | itemIterator = mTodoMap.find(relatedTodo); | 852 | // kdDebug() << " has Related" << endl; |
853 | if (itemIterator == mTodoMap.end()) { | 853 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
854 | // kdDebug() << " related not yet in list" << endl; | 854 | itemIterator = mTodoMap.find(relatedTodo); |
855 | itemIterator = insertTodoItem (relatedTodo); | 855 | if (itemIterator == mTodoMap.end()) { |
856 | // kdDebug() << " related not yet in list" << endl; | ||
857 | itemIterator = insertTodoItem (relatedTodo); | ||
858 | } | ||
859 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem | ||
860 | // and one into the map. Sure finding is more easy but why? -zecke | ||
861 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); | ||
862 | return mTodoMap.insert(todo,todoItem); | ||
863 | } else { | ||
864 | // kdDebug() << " no Related" << endl; | ||
865 | // see above -zecke | ||
866 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | ||
867 | return mTodoMap.insert(todo,todoItem); | ||
856 | } | 868 | } |
857 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem | ||
858 | // and one into the map. Sure finding is more easy but why? -zecke | ||
859 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); | ||
860 | return mTodoMap.insert(todo,todoItem); | ||
861 | } else { | ||
862 | // kdDebug() << " no Related" << endl; | ||
863 | // see above -zecke | ||
864 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | ||
865 | return mTodoMap.insert(todo,todoItem); | ||
866 | } | ||
867 | } | 869 | } |
868 | 870 | ||
869 | 871 | ||
870 | void KOTodoView::updateConfig() | 872 | void KOTodoView::updateConfig() |
871 | { | 873 | { |
872 | updateView(); | 874 | updateView(); |
873 | mTodoListView->repaintContents(); | 875 | mTodoListView->repaintContents(); |
874 | } | 876 | } |
875 | 877 | ||
876 | QPtrList<Incidence> KOTodoView::selectedIncidences() | 878 | QPtrList<Incidence> KOTodoView::selectedIncidences() |
877 | { | 879 | { |
878 | QPtrList<Incidence> selected; | 880 | QPtrList<Incidence> selected; |
879 | 881 | ||
880 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 882 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
881 | // if (!item) item = mActiveItem; | 883 | // if (!item) item = mActiveItem; |
882 | if (item) selected.append(item->todo()); | 884 | if (item) selected.append(item->todo()); |
883 | 885 | ||
884 | return selected; | 886 | return selected; |
885 | } | 887 | } |
886 | 888 | ||
887 | QPtrList<Todo> KOTodoView::selectedTodos() | 889 | QPtrList<Todo> KOTodoView::selectedTodos() |
888 | { | 890 | { |
889 | QPtrList<Todo> selected; | 891 | QPtrList<Todo> selected; |
890 | 892 | ||
891 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 893 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
892 | // if (!item) item = mActiveItem; | 894 | // if (!item) item = mActiveItem; |
893 | if (item) selected.append(item->todo()); | 895 | if (item) selected.append(item->todo()); |
894 | 896 | ||
895 | return selected; | 897 | return selected; |
896 | } | 898 | } |
897 | 899 | ||
898 | void KOTodoView::changeEventDisplay(Event *, int) | 900 | void KOTodoView::changeEventDisplay(Event *, int) |
899 | { | 901 | { |
900 | updateView(); | 902 | updateView(); |
901 | } | 903 | } |
902 | 904 | ||
903 | void KOTodoView::showDates(const QDate &, const QDate &) | 905 | void KOTodoView::showDates(const QDate &, const QDate &) |
904 | { | 906 | { |
905 | } | 907 | } |
906 | 908 | ||
907 | void KOTodoView::showEvents(QPtrList<Event>) | 909 | void KOTodoView::showEvents(QPtrList<Event>) |
908 | { | 910 | { |
909 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; | 911 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; |
910 | } | 912 | } |
911 | 913 | ||
912 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 914 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
913 | const QDate &td) | 915 | const QDate &td) |
914 | { | 916 | { |
915 | #ifndef KORG_NOPRINTER | 917 | #ifndef KORG_NOPRINTER |
916 | calPrinter->preview(CalPrinter::Todolist, fd, td); | 918 | calPrinter->preview(CalPrinter::Todolist, fd, td); |
917 | #endif | 919 | #endif |
918 | } | 920 | } |
919 | 921 | ||
920 | void KOTodoView::editItem(QListViewItem *item ) | 922 | void KOTodoView::editItem(QListViewItem *item ) |
921 | { | 923 | { |
922 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); | 924 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); |
923 | } | 925 | } |
924 | 926 | ||
925 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) | 927 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) |
926 | { | 928 | { |
927 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); | 929 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); |
928 | } | 930 | } |
929 | 931 | ||
930 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) | 932 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) |
931 | { | 933 | { |
932 | pendingSubtodo = 0; | 934 | pendingSubtodo = 0; |
933 | mActiveItem = (KOTodoViewItem *)item; | 935 | mActiveItem = (KOTodoViewItem *)item; |
934 | if (item) { | 936 | if (item) { |
935 | switch (column){ | 937 | switch (column){ |
936 | case 1: | 938 | case 1: |
937 | mPriorityPopupMenu->popup(QCursor::pos ()); break; | 939 | mPriorityPopupMenu->popup(QCursor::pos ()); break; |
938 | case 2: | 940 | case 2: |
939 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; | 941 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; |
940 | case 3: | 942 | case 3: |
941 | moveTodo(); | 943 | moveTodo(); |
942 | break; | 944 | break; |
943 | case 8: | 945 | case 8: |
944 | getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; | 946 | getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; |
945 | default: | 947 | default: |
946 | mItemPopupMenu->popup(QCursor::pos()); | 948 | mItemPopupMenu->popup(QCursor::pos()); |
947 | } | 949 | } |
948 | } else mPopupMenu->popup(QCursor::pos()); | 950 | } else mPopupMenu->popup(QCursor::pos()); |
949 | } | 951 | } |
950 | void KOTodoView::newTodo() | 952 | void KOTodoView::newTodo() |
951 | { | 953 | { |
952 | emit newTodoSignal(); | 954 | emit newTodoSignal(); |
953 | } | 955 | } |
954 | 956 | ||
955 | void KOTodoView::newSubTodo() | 957 | void KOTodoView::newSubTodo() |
956 | { | 958 | { |
957 | if (mActiveItem) { | 959 | if (mActiveItem) { |
958 | emit newSubTodoSignal(mActiveItem->todo()); | 960 | emit newSubTodoSignal(mActiveItem->todo()); |
959 | } | 961 | } |
960 | } | 962 | } |
961 | void KOTodoView::unparentTodo() | 963 | void KOTodoView::unparentTodo() |
962 | { | 964 | { |
963 | if (mActiveItem) { | 965 | if (mActiveItem) { |
964 | emit unparentTodoSignal(mActiveItem->todo()); | 966 | emit unparentTodoSignal(mActiveItem->todo()); |
965 | } | 967 | } |
966 | } | 968 | } |
967 | 969 | ||
968 | void KOTodoView::reparentTodo() | 970 | void KOTodoView::reparentTodo() |
969 | { | 971 | { |
970 | if (mActiveItem) { | 972 | if (mActiveItem) { |
971 | topLevelWidget()->setCaption(i18n("Click on new parent item")); | 973 | topLevelWidget()->setCaption(i18n("Click on new parent item")); |
972 | pendingSubtodo = mActiveItem; | 974 | pendingSubtodo = mActiveItem; |
973 | } | 975 | } |
974 | } | 976 | } |
975 | void KOTodoView::editTodo() | 977 | void KOTodoView::editTodo() |
976 | { | 978 | { |
977 | if (mActiveItem) { | 979 | if (mActiveItem) { |
978 | emit editTodoSignal(mActiveItem->todo()); | 980 | emit editTodoSignal(mActiveItem->todo()); |
979 | } | 981 | } |
980 | } | 982 | } |
981 | void KOTodoView::cloneTodo() | 983 | void KOTodoView::cloneTodo() |
982 | { | 984 | { |
983 | if (mActiveItem) { | 985 | if (mActiveItem) { |
984 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); | 986 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); |
985 | } | 987 | } |
986 | } | 988 | } |
987 | void KOTodoView::cancelTodo() | 989 | void KOTodoView::cancelTodo() |
988 | { | 990 | { |
989 | if (mActiveItem) { | 991 | if (mActiveItem) { |
990 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); | 992 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); |
991 | } | 993 | } |
992 | } | 994 | } |
993 | void KOTodoView::moveTodo() | 995 | void KOTodoView::moveTodo() |
994 | { | 996 | { |
995 | if (mActiveItem) { | 997 | if (mActiveItem) { |
996 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); | 998 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); |
997 | } | 999 | } |
998 | } | 1000 | } |
999 | void KOTodoView::beamTodo() | 1001 | void KOTodoView::beamTodo() |
1000 | { | 1002 | { |
1001 | if (mActiveItem) { | 1003 | if (mActiveItem) { |
1002 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); | 1004 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); |
1003 | } | 1005 | } |
1004 | } | 1006 | } |
1005 | 1007 | ||
1006 | 1008 | ||
1007 | void KOTodoView::showTodo() | 1009 | void KOTodoView::showTodo() |
1008 | { | 1010 | { |
1009 | if (mActiveItem) { | 1011 | if (mActiveItem) { |
1010 | emit showTodoSignal(mActiveItem->todo()); | 1012 | emit showTodoSignal(mActiveItem->todo()); |
1011 | } | 1013 | } |
1012 | } | 1014 | } |
1013 | 1015 | ||
1014 | void KOTodoView::deleteTodo() | 1016 | void KOTodoView::deleteTodo() |
1015 | { | 1017 | { |
1016 | if (mActiveItem) { | 1018 | if (mActiveItem) { |
1017 | emit deleteTodoSignal(mActiveItem->todo()); | 1019 | emit deleteTodoSignal(mActiveItem->todo()); |
1018 | } | 1020 | } |
1019 | } | 1021 | } |
1020 | 1022 | ||
1021 | void KOTodoView::setNewPriority(int index) | 1023 | void KOTodoView::setNewPriority(int index) |
1022 | { | 1024 | { |
1023 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1025 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1024 | mActiveItem->todo()->setPriority(mPriority[index]); | 1026 | mActiveItem->todo()->setPriority(mPriority[index]); |
1025 | mActiveItem->construct(); | 1027 | mActiveItem->construct(); |
1026 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); | 1028 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); |
1027 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1029 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1028 | } | 1030 | } |
1029 | } | 1031 | } |
1030 | 1032 | ||
1031 | void KOTodoView::setNewPercentage(int index) | 1033 | void KOTodoView::setNewPercentage(int index) |
1032 | { | 1034 | { |
1033 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1035 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1034 | 1036 | ||
1035 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { | 1037 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { |
1036 | mActiveItem->setOn( true ); | 1038 | mActiveItem->setOn( true ); |
1037 | return; | 1039 | return; |
1038 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { | 1040 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { |
1039 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); | 1041 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); |
1040 | if ( par && par->isOn() ) | 1042 | if ( par && par->isOn() ) |
1041 | par->setOn( false ); | 1043 | par->setOn( false ); |
1042 | } | 1044 | } |
1043 | if (mPercentage[index] == 100) { | 1045 | if (mPercentage[index] == 100) { |
1044 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); | 1046 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); |
1045 | } else { | 1047 | } else { |
1046 | mActiveItem->todo()->setCompleted(false); | 1048 | mActiveItem->todo()->setCompleted(false); |
1047 | } | 1049 | } |
1048 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); | 1050 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); |
1049 | mActiveItem->construct(); | 1051 | mActiveItem->construct(); |
1050 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); | 1052 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); |
1051 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1053 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1052 | } | 1054 | } |
1053 | } | 1055 | } |
1054 | 1056 | ||
1055 | 1057 | ||
1056 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) | 1058 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) |
1057 | { | 1059 | { |
1058 | QPopupMenu* tempMenu = new QPopupMenu (this); | 1060 | QPopupMenu* tempMenu = new QPopupMenu (this); |
1059 | QStringList checkedCategories = todoItem->todo()->categories (); | 1061 | QStringList checkedCategories = todoItem->todo()->categories (); |
1060 | 1062 | ||
1061 | tempMenu->setCheckable (true); | 1063 | tempMenu->setCheckable (true); |
1062 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 1064 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
1063 | it != KOPrefs::instance()->mCustomCategories.end (); | 1065 | it != KOPrefs::instance()->mCustomCategories.end (); |
1064 | ++it) { | 1066 | ++it) { |
1065 | int index = tempMenu->insertItem (*it); | 1067 | int index = tempMenu->insertItem (*it); |
1066 | mCategory[index] = *it; | 1068 | mCategory[index] = *it; |
1067 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); | 1069 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); |
1068 | } | 1070 | } |
1069 | 1071 | ||
1070 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); | 1072 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); |
1071 | return tempMenu; | 1073 | return tempMenu; |
1072 | 1074 | ||
1073 | 1075 | ||
1074 | } | 1076 | } |
1075 | void KOTodoView::changedCategories(int index) | 1077 | void KOTodoView::changedCategories(int index) |
1076 | { | 1078 | { |
1077 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1079 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1078 | QStringList categories = mActiveItem->todo()->categories (); | 1080 | QStringList categories = mActiveItem->todo()->categories (); |
1079 | QString colcat = categories.first(); | 1081 | QString colcat = categories.first(); |
1080 | if (categories.find (mCategory[index]) != categories.end ()) | 1082 | if (categories.find (mCategory[index]) != categories.end ()) |
1081 | categories.remove (mCategory[index]); | 1083 | categories.remove (mCategory[index]); |
1082 | else | 1084 | else |
1083 | categories.insert (categories.end(), mCategory[index]); | 1085 | categories.insert (categories.end(), mCategory[index]); |
1084 | categories.sort (); | 1086 | categories.sort (); |
1085 | if ( !colcat.isEmpty() ) { | 1087 | if ( !colcat.isEmpty() ) { |
1086 | if ( categories.find ( colcat ) != categories.end () ) { | 1088 | if ( categories.find ( colcat ) != categories.end () ) { |
1087 | categories.remove( colcat ); | 1089 | categories.remove( colcat ); |
1088 | categories.prepend( colcat ); | 1090 | categories.prepend( colcat ); |
1089 | } | 1091 | } |
1090 | } | 1092 | } |
1091 | mActiveItem->todo()->setCategories (categories); | 1093 | mActiveItem->todo()->setCategories (categories); |
1092 | mActiveItem->construct(); | 1094 | mActiveItem->construct(); |
1093 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1095 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1094 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); | 1096 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); |
1095 | } | 1097 | } |
1096 | } | 1098 | } |
1097 | void KOTodoView::itemDoubleClicked(QListViewItem *item) | 1099 | void KOTodoView::itemDoubleClicked(QListViewItem *item) |
1098 | { | 1100 | { |
1099 | if ( pendingSubtodo != 0 ) { | 1101 | if ( pendingSubtodo != 0 ) { |
1100 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 1102 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
1101 | } | 1103 | } |
1102 | pendingSubtodo = 0; | 1104 | pendingSubtodo = 0; |
1103 | //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); | 1105 | //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); |
1104 | int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); | 1106 | int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); |
1105 | //qDebug("ROW %d ", row); | 1107 | //qDebug("ROW %d ", row); |
1106 | if (!item) { | 1108 | if (!item) { |
1107 | newTodo(); | 1109 | newTodo(); |
1108 | return; | 1110 | return; |
1109 | } else { | 1111 | } else { |
1110 | if ( row == 2 || row == 1 ) { | 1112 | if ( row == 2 || row == 1 ) { |
1111 | mActiveItem = (KOTodoViewItem *) item; | 1113 | mActiveItem = (KOTodoViewItem *) item; |
1112 | newSubTodo(); | 1114 | newSubTodo(); |
1113 | return; | 1115 | return; |
1114 | } | 1116 | } |
1115 | if ( row == 5 || row == 6 ) { | 1117 | if ( row == 5 || row == 6 ) { |
1116 | mActiveItem = (KOTodoViewItem *) item; | 1118 | mActiveItem = (KOTodoViewItem *) item; |
1117 | toggleRunningItem(); | 1119 | toggleRunningItem(); |
1118 | return; | 1120 | return; |
1119 | } | 1121 | } |
1120 | } | 1122 | } |
1121 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 1123 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
1122 | editItem( item ); | 1124 | editItem( item ); |
1123 | else | 1125 | else |
1124 | showItem( item , QPoint(), 0 ); | 1126 | showItem( item , QPoint(), 0 ); |
1125 | } | 1127 | } |
1126 | void KOTodoView::toggleRunningItem() | 1128 | void KOTodoView::toggleRunningItem() |
1127 | { | 1129 | { |
1128 | // qDebug("KOTodoView::toggleRunning() "); | 1130 | // qDebug("KOTodoView::toggleRunning() "); |
1129 | if ( ! mActiveItem ) | 1131 | if ( ! mActiveItem ) |
1130 | return; | 1132 | return; |
1131 | Todo * t = mActiveItem->todo(); | 1133 | Todo * t = mActiveItem->todo(); |
1132 | if ( t->isRunning() ) { | 1134 | if ( t->isRunning() ) { |
1133 | #if 0 | 1135 | #if 0 |
1134 | int result = KMessageBox::warningContinueCancel(this, | 1136 | int result = KMessageBox::warningContinueCancel(this, |
1135 | i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop todo"),i18n("Cancel"), true); | 1137 | i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop todo"),i18n("Cancel"), true); |
1136 | #endif | 1138 | #endif |
1137 | 1139 | ||
1138 | int result = KMessageBox::warningYesNoCancel(this, | 1140 | int result = KMessageBox::warningYesNoCancel(this, |
1139 | i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop"),i18n("Stop+note")); | 1141 | i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop"),i18n("Stop+note")); |
1140 | if (result == KMessageBox::Cancel) return; | 1142 | if (result == KMessageBox::Cancel) return; |
1141 | if ( result == KMessageBox::No ) { | 1143 | if ( result == KMessageBox::No ) { |
1142 | QString comment = QInputDialog::getText(mActiveItem->text(0).left( 25 ),i18n("Comment for todo:") ); | 1144 | QString comment = QInputDialog::getText(mActiveItem->text(0).left( 25 ),i18n("Comment for todo:") ); |
1143 | t->setRunningFalse( comment ); | 1145 | t->setRunningFalse( comment ); |
1144 | } else { | 1146 | } else { |
1145 | t->setRunning( false ); | 1147 | t->setRunning( false ); |
1146 | } | 1148 | } |
1147 | mActiveItem->construct(); | 1149 | mActiveItem->construct(); |
1148 | } else { | 1150 | } else { |
1149 | int result = KMessageBox::warningContinueCancel(this, | 1151 | int result = KMessageBox::warningContinueCancel(this, |
1150 | i18n("The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is stopped"),i18n("Start todo"),i18n("Cancel"), true); | 1152 | i18n("The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is stopped"),i18n("Start todo"),i18n("Cancel"), true); |
1151 | if (result != KMessageBox::Continue) return; | 1153 | if (result != KMessageBox::Continue) return; |
1152 | t->setRunning( true ); | 1154 | t->setRunning( true ); |
1153 | mActiveItem->construct(); | 1155 | mActiveItem->construct(); |
1154 | } | 1156 | } |
1155 | } | 1157 | } |
1156 | 1158 | ||
1157 | void KOTodoView::itemClicked(QListViewItem *item) | 1159 | void KOTodoView::itemClicked(QListViewItem *item) |
1158 | { | 1160 | { |
1159 | //qDebug("KOTodoView::itemClicked %d", item); | 1161 | //qDebug("KOTodoView::itemClicked %d", item); |
1160 | if (!item) { | 1162 | if (!item) { |
1161 | if ( pendingSubtodo != 0 ) { | 1163 | if ( pendingSubtodo != 0 ) { |
1162 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 1164 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
1163 | } | 1165 | } |
1164 | pendingSubtodo = 0; | 1166 | pendingSubtodo = 0; |
1165 | return; | 1167 | return; |
1166 | } | 1168 | } |
1167 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1169 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1168 | if ( pendingSubtodo != 0 ) { | 1170 | if ( pendingSubtodo != 0 ) { |
1169 | bool allowReparent = true; | 1171 | bool allowReparent = true; |
1170 | QListViewItem *par = item; | 1172 | QListViewItem *par = item; |
1171 | while ( par ) { | 1173 | while ( par ) { |
1172 | if ( par == pendingSubtodo ) { | 1174 | if ( par == pendingSubtodo ) { |
1173 | allowReparent = false; | 1175 | allowReparent = false; |
1174 | break; | 1176 | break; |
1175 | } | 1177 | } |
1176 | par = par->parent(); | 1178 | par = par->parent(); |
1177 | } | 1179 | } |
1178 | if ( !allowReparent ) { | 1180 | if ( !allowReparent ) { |
1179 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); | 1181 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); |
1180 | pendingSubtodo = 0; | 1182 | pendingSubtodo = 0; |
1181 | } else { | 1183 | } else { |
1182 | Todo* newParent = todoItem->todo(); | 1184 | Todo* newParent = todoItem->todo(); |
1183 | Todo* newSub = pendingSubtodo->todo(); | 1185 | Todo* newSub = pendingSubtodo->todo(); |
1184 | pendingSubtodo = 0; | 1186 | pendingSubtodo = 0; |
1185 | emit reparentTodoSignal( newParent,newSub ); | 1187 | emit reparentTodoSignal( newParent,newSub ); |
1186 | return; | 1188 | return; |
1187 | } | 1189 | } |
1188 | } | 1190 | } |
1189 | 1191 | ||
1190 | } | 1192 | } |
1191 | 1193 | ||
1192 | void KOTodoView::setDocumentId( const QString &id ) | 1194 | void KOTodoView::setDocumentId( const QString &id ) |
1193 | { | 1195 | { |
1194 | 1196 | ||
1195 | mDocPrefs->setDoc( id ); | 1197 | mDocPrefs->setDoc( id ); |
1196 | } | 1198 | } |
1197 | 1199 | ||
1198 | void KOTodoView::itemStateChanged( QListViewItem *item ) | 1200 | void KOTodoView::itemStateChanged( QListViewItem *item ) |
1199 | { | 1201 | { |
1200 | if (!item) return; | 1202 | if (!item) return; |
1201 | 1203 | ||
1202 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1204 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1203 | 1205 | ||
1204 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; | 1206 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; |
1205 | 1207 | ||
1206 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); | 1208 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); |
1207 | } | 1209 | } |
1208 | 1210 | ||
1209 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const | 1211 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const |
1210 | { | 1212 | { |
1211 | mTodoListView->saveLayout(config,group); | 1213 | mTodoListView->saveLayout(config,group); |
1212 | } | 1214 | } |
1213 | 1215 | ||
1214 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) | 1216 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) |
1215 | { | 1217 | { |
1216 | mTodoListView->restoreLayout(config,group); | 1218 | mTodoListView->restoreLayout(config,group); |
1217 | } | 1219 | } |
1218 | 1220 | ||
1219 | void KOTodoView::processSelectionChange() | 1221 | void KOTodoView::processSelectionChange() |
1220 | { | 1222 | { |
1221 | // kdDebug() << "KOTodoView::processSelectionChange()" << endl; | 1223 | // kdDebug() << "KOTodoView::processSelectionChange()" << endl; |
1222 | 1224 | ||
1223 | KOTodoViewItem *item = | 1225 | KOTodoViewItem *item = |
1224 | static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); | 1226 | static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); |
1225 | 1227 | ||
1226 | if ( !item ) { | 1228 | if ( !item ) { |
1227 | emit incidenceSelected( 0 ); | 1229 | emit incidenceSelected( 0 ); |
1228 | } else { | 1230 | } else { |
1229 | emit incidenceSelected( item->todo() ); | 1231 | emit incidenceSelected( item->todo() ); |
1230 | } | 1232 | } |
1231 | } | 1233 | } |
1232 | 1234 | ||
1233 | void KOTodoView::modified(bool b) | 1235 | void KOTodoView::modified(bool b) |
1234 | { | 1236 | { |
1235 | emit isModified(b); | 1237 | emit isModified(b); |
1236 | } | 1238 | } |
1237 | void KOTodoView::setTodoModified( Todo* todo ) | 1239 | void KOTodoView::setTodoModified( Todo* todo ) |
1238 | { | 1240 | { |
1239 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); | 1241 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); |
1240 | } | 1242 | } |
1241 | void KOTodoView::clearSelection() | 1243 | void KOTodoView::clearSelection() |
1242 | { | 1244 | { |
1243 | mTodoListView->selectAll( false ); | 1245 | mTodoListView->selectAll( false ); |
1244 | } | 1246 | } |
1245 | void KOTodoView::setAllOpen() | 1247 | void KOTodoView::setAllOpen() |
1246 | { | 1248 | { |
1247 | if ( isFlatDisplay ) { | 1249 | if ( isFlatDisplay ) { |
1248 | isFlatDisplay = false; | 1250 | isFlatDisplay = false; |
1249 | mPopupMenu->setItemChecked( 8,false ); | 1251 | mPopupMenu->setItemChecked( 8,false ); |
1250 | updateView(); | 1252 | updateView(); |
1251 | } else { | 1253 | } else { |
1252 | storeCurrentItem(); | 1254 | storeCurrentItem(); |
1253 | } | 1255 | } |
1254 | setOpen(mTodoListView->firstChild(), true); | 1256 | setOpen(mTodoListView->firstChild(), true); |
1255 | resetCurrentItem(); | 1257 | resetCurrentItem(); |
1256 | } | 1258 | } |
1257 | void KOTodoView::setAllClose() | 1259 | void KOTodoView::setAllClose() |
1258 | { | 1260 | { |
1259 | if ( isFlatDisplay ) { | 1261 | if ( isFlatDisplay ) { |
1260 | isFlatDisplay = false; | 1262 | isFlatDisplay = false; |
1261 | mPopupMenu->setItemChecked( 8,false ); | 1263 | mPopupMenu->setItemChecked( 8,false ); |
1262 | updateView(); | 1264 | updateView(); |
1263 | } else { | 1265 | } else { |
1264 | storeCurrentItem(); | 1266 | storeCurrentItem(); |
1265 | } | 1267 | } |
1266 | setOpen(mTodoListView->firstChild(), false); | 1268 | setOpen(mTodoListView->firstChild(), false); |
1267 | resetCurrentItem(); | 1269 | resetCurrentItem(); |
1268 | } | 1270 | } |
1269 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) | 1271 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) |
1270 | { | 1272 | { |
1271 | 1273 | ||
1272 | while ( item ) { | 1274 | while ( item ) { |
1273 | setOpen( item->firstChild(), setOpenI ); | 1275 | setOpen( item->firstChild(), setOpenI ); |
1274 | item->setOpen( setOpenI ); | 1276 | item->setOpen( setOpenI ); |
1275 | item = item->nextSibling(); | 1277 | item = item->nextSibling(); |
1276 | } | 1278 | } |
1277 | } | 1279 | } |
1278 | 1280 | ||
1279 | void KOTodoView::displayAllFlat() | 1281 | void KOTodoView::displayAllFlat() |
1280 | { | 1282 | { |
1281 | pendingSubtodo = 0; | 1283 | pendingSubtodo = 0; |
1282 | if ( mBlockUpdate ) { | 1284 | if ( mBlockUpdate ) { |
1283 | return; | 1285 | return; |
1284 | } | 1286 | } |
1285 | mPopupMenu->setItemChecked( 8,true ); | 1287 | mPopupMenu->setItemChecked( 8,true ); |
1286 | isFlatDisplay = true; | 1288 | isFlatDisplay = true; |
1287 | QPtrList<Todo> todoList = calendar()->todos(); | 1289 | QPtrList<Todo> todoList = calendar()->todos(); |
1288 | mTodoMap.clear(); | 1290 | mTodoMap.clear(); |
1289 | mTodoListView->clear(); | 1291 | mTodoListView->clear(); |
1290 | Todo *todo; | 1292 | Todo *todo; |
1291 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 1293 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
1292 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 1294 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
1293 | mTodoMap.insert(todo,todoItem); | 1295 | mTodoMap.insert(todo,todoItem); |
1294 | } | 1296 | } |
1295 | mTodoListView->setFocus(); | 1297 | mTodoListView->setFocus(); |
1296 | processSelectionChange(); | 1298 | processSelectionChange(); |
1297 | } | 1299 | } |
1298 | 1300 | ||
1299 | void KOTodoView::setAllFlat() | 1301 | void KOTodoView::setAllFlat() |
1300 | { | 1302 | { |
1301 | if ( isFlatDisplay ) { | 1303 | if ( isFlatDisplay ) { |
1302 | isFlatDisplay = false; | 1304 | isFlatDisplay = false; |
1303 | mPopupMenu->setItemChecked( 8,false ); | 1305 | mPopupMenu->setItemChecked( 8,false ); |
1304 | updateView(); | 1306 | updateView(); |
1305 | return; | 1307 | return; |
1306 | } | 1308 | } |
1307 | storeCurrentItem(); | 1309 | storeCurrentItem(); |
1308 | displayAllFlat(); | 1310 | displayAllFlat(); |
1309 | resetCurrentItem(); | 1311 | resetCurrentItem(); |
1310 | } | 1312 | } |
1311 | 1313 | ||
1312 | void KOTodoView::purgeCompleted() | 1314 | void KOTodoView::purgeCompleted() |
1313 | { | 1315 | { |
1314 | emit purgeCompletedSignal(); | 1316 | emit purgeCompletedSignal(); |
1315 | 1317 | ||
1316 | } | 1318 | } |
1317 | void KOTodoView::toggleQuickTodo() | 1319 | void KOTodoView::toggleQuickTodo() |
1318 | { | 1320 | { |
1319 | if ( mQuickAdd->isVisible() ) { | 1321 | if ( mQuickAdd->isVisible() ) { |
1320 | mQuickAdd->hide(); | 1322 | mQuickAdd->hide(); |
1321 | KOPrefs::instance()->mEnableQuickTodo = false; | 1323 | KOPrefs::instance()->mEnableQuickTodo = false; |
1322 | } | 1324 | } |
1323 | else { | 1325 | else { |
1324 | mQuickAdd->show(); | 1326 | mQuickAdd->show(); |
1325 | KOPrefs::instance()->mEnableQuickTodo = true; | 1327 | KOPrefs::instance()->mEnableQuickTodo = true; |
1326 | } | 1328 | } |
1327 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 1329 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
1328 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 1330 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
1329 | } | 1331 | } |
1330 | 1332 | ||
1331 | void KOTodoView::toggleRunning() | 1333 | void KOTodoView::toggleRunning() |
1332 | { | 1334 | { |
1333 | KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; | 1335 | KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; |
1334 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 1336 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
1335 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 1337 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
1336 | updateView(); | 1338 | updateView(); |
1337 | } | 1339 | } |
1338 | 1340 | ||
1339 | void KOTodoView::toggleCompleted() | 1341 | void KOTodoView::toggleCompleted() |
1340 | { | 1342 | { |
1341 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; | 1343 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; |
1342 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 1344 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
1343 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 1345 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
1344 | updateView(); | 1346 | updateView(); |
1345 | } | 1347 | } |
1346 | 1348 | ||
1347 | void KOTodoView::addQuickTodo() | 1349 | void KOTodoView::addQuickTodo() |
1348 | { | 1350 | { |
1349 | Todo *todo = new Todo(); | 1351 | Todo *todo = new Todo(); |
1350 | todo->setSummary(mQuickAdd->text()); | 1352 | todo->setSummary(mQuickAdd->text()); |
1351 | todo->setOrganizer(KOPrefs::instance()->email()); | 1353 | todo->setOrganizer(KOPrefs::instance()->email()); |
1352 | CalFilter * cf = mCalendar->filter(); | 1354 | CalFilter * cf = mCalendar->filter(); |
1353 | if ( cf ) { | 1355 | if ( cf ) { |
1354 | if ( cf->isEnabled()&& cf->showCategories()) { | 1356 | if ( cf->isEnabled()&& cf->showCategories()) { |
1355 | todo->setCategories(cf->categoryList()); | 1357 | todo->setCategories(cf->categoryList()); |
1356 | } | 1358 | } |
1357 | if ( cf->isEnabled() ) | 1359 | if ( cf->isEnabled() ) |
1358 | todo->setSecrecy( cf->getSecrecy()); | 1360 | todo->setSecrecy( cf->getSecrecy()); |
1359 | } | 1361 | } |
1360 | mCalendar->addTodo(todo); | 1362 | mCalendar->addTodo(todo); |
1361 | mQuickAdd->setText(""); | 1363 | mQuickAdd->setText(""); |
1362 | todoModified (todo, KOGlobals::EVENTADDED ); | 1364 | todoModified (todo, KOGlobals::EVENTADDED ); |
1363 | updateView(); | 1365 | updateView(); |
1364 | } | 1366 | } |
1365 | 1367 | ||
1366 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) | 1368 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) |
1367 | { | 1369 | { |
1368 | // e->ignore(); | 1370 | // e->ignore(); |
1369 | //return; | 1371 | //return; |
1370 | //qDebug("KOTodoView::keyPressEvent "); | 1372 | //qDebug("KOTodoView::keyPressEvent "); |
1371 | switch ( e->key() ) { | 1373 | switch ( e->key() ) { |
1372 | case Qt::Key_Down: | 1374 | case Qt::Key_Down: |
1373 | case Qt::Key_Up: | 1375 | case Qt::Key_Up: |
1374 | QWidget::keyPressEvent ( e ); | 1376 | QWidget::keyPressEvent ( e ); |
1375 | break; | 1377 | break; |
1376 | 1378 | ||
1377 | case Qt::Key_Q: | 1379 | case Qt::Key_Q: |
1378 | toggleQuickTodo(); | 1380 | toggleQuickTodo(); |
1379 | break; | 1381 | break; |
1380 | case Qt::Key_U: | 1382 | case Qt::Key_U: |
1381 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { | 1383 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { |
1382 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1384 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1383 | unparentTodo(); | 1385 | unparentTodo(); |
1384 | e->accept(); | 1386 | e->accept(); |
1385 | } else | 1387 | } else |
1386 | e->ignore(); | 1388 | e->ignore(); |
1387 | break; | 1389 | break; |
1388 | case Qt::Key_S: | 1390 | case Qt::Key_S: |
1389 | if ( e->state() == Qt::ControlButton ) { | 1391 | if ( e->state() == Qt::ControlButton ) { |
1390 | e->ignore(); | 1392 | e->ignore(); |
1391 | break; | 1393 | break; |
1392 | } | 1394 | } |
1393 | if ( e->state() == Qt::ShiftButton ) { | 1395 | if ( e->state() == Qt::ShiftButton ) { |
1394 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1396 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1395 | reparentTodo(); | 1397 | reparentTodo(); |
1396 | e->accept(); | 1398 | e->accept(); |
1397 | } else | 1399 | } else |
1398 | e->ignore(); | 1400 | e->ignore(); |
1399 | break; | 1401 | break; |
1400 | case Qt::Key_P: | 1402 | case Qt::Key_P: |
1401 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { | 1403 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { |
1402 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1404 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1403 | if ( pendingSubtodo ) | 1405 | if ( pendingSubtodo ) |
1404 | itemClicked(mActiveItem); | 1406 | itemClicked(mActiveItem); |
1405 | e->accept(); | 1407 | e->accept(); |
1406 | } else | 1408 | } else |
1407 | e->ignore(); | 1409 | e->ignore(); |
1408 | break; | 1410 | break; |
1409 | case Qt::Key_Escape: | 1411 | case Qt::Key_Escape: |
1410 | if ( pendingSubtodo ) { | 1412 | if ( pendingSubtodo ) { |
1411 | itemClicked(0); | 1413 | itemClicked(0); |
1412 | e->accept(); | 1414 | e->accept(); |
1413 | } else | 1415 | } else |
1414 | e->ignore(); | 1416 | e->ignore(); |
1415 | break; | 1417 | break; |
1416 | default: | 1418 | default: |
1417 | e->ignore(); | 1419 | e->ignore(); |
1418 | } | 1420 | } |
1419 | 1421 | ||
1420 | if ( true ) { | 1422 | if ( true ) { |
1421 | if ( e->key() == Qt::Key_I ) { | 1423 | if ( e->key() == Qt::Key_I ) { |
1422 | KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); | 1424 | KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); |
1423 | if ( cn ) { | 1425 | if ( cn ) { |
1424 | mActiveItem = cn; | 1426 | mActiveItem = cn; |
1425 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 1427 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
1426 | if ( ci ){ | 1428 | if ( ci ){ |
1427 | showTodo(); | 1429 | showTodo(); |
1428 | cn = (KOTodoViewItem*)cn->itemBelow(); | 1430 | cn = (KOTodoViewItem*)cn->itemBelow(); |
1429 | if ( cn ) { | 1431 | if ( cn ) { |
1430 | mTodoListView->setCurrentItem ( cn ); | 1432 | mTodoListView->setCurrentItem ( cn ); |
1431 | mTodoListView->ensureItemVisible ( cn ); | 1433 | mTodoListView->ensureItemVisible ( cn ); |
1432 | } | 1434 | } |
1433 | 1435 | ||
1434 | } | 1436 | } |
1435 | } | 1437 | } |
1436 | e->accept(); | 1438 | e->accept(); |
1437 | 1439 | ||
1438 | } | 1440 | } |
1439 | 1441 | ||
1440 | } | 1442 | } |
1441 | 1443 | ||
1442 | } | 1444 | } |
1443 | void KOTodoView::updateTodo( Todo * t, int type ) | 1445 | void KOTodoView::updateTodo( Todo * t, int type ) |
1444 | { | 1446 | { |
1445 | if ( mBlockUpdate) | 1447 | if ( mBlockUpdate) |
1446 | return; | 1448 | return; |
1447 | 1449 | ||
1448 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 1450 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
1449 | itemIterator = mTodoMap.find(t); | 1451 | itemIterator = mTodoMap.find(t); |
1450 | if (itemIterator != mTodoMap.end()) { | 1452 | if (itemIterator != mTodoMap.end()) { |
1451 | (*itemIterator)->construct(); | 1453 | (*itemIterator)->construct(); |
1452 | } else { | 1454 | } else { |
1453 | if ( type == KOGlobals::EVENTADDED ) { | 1455 | if ( type == KOGlobals::EVENTADDED ) { |
1454 | insertTodoItem( t ); | 1456 | insertTodoItem( t ); |
1455 | } | 1457 | } |
1456 | } | 1458 | } |
1457 | 1459 | ||
1458 | } | 1460 | } |
1459 | 1461 | ||
1460 | void KOTodoView::todoModified(Todo * t , int p ) | 1462 | void KOTodoView::todoModified(Todo * t , int p ) |
1461 | { | 1463 | { |
1462 | mBlockUpdate = true; | 1464 | mBlockUpdate = true; |
1463 | emit todoModifiedSignal ( t, p ); | 1465 | emit todoModifiedSignal ( t, p ); |
1464 | mBlockUpdate = false; | 1466 | mBlockUpdate = false; |
1465 | } | 1467 | } |
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 8cb6b83..f987b63 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp | |||
@@ -1,522 +1,522 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <klocale.h> | 20 | #include <klocale.h> |
21 | #include <kdebug.h> | 21 | #include <kdebug.h> |
22 | #include <qapp.h> | 22 | #include <qapp.h> |
23 | #include <kglobal.h> | 23 | #include <kglobal.h> |
24 | 24 | ||
25 | #include <kiconloader.h> | 25 | #include <kiconloader.h> |
26 | #include "kotodoviewitem.h" | 26 | #include "kotodoviewitem.h" |
27 | #include "kotodoview.h" | 27 | #include "kotodoview.h" |
28 | #include "koprefs.h" | 28 | #include "koprefs.h" |
29 | 29 | ||
30 | KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo) | 30 | KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo) |
31 | : QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) | 31 | : QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) |
32 | { | 32 | { |
33 | construct(); | 33 | construct(); |
34 | } | 34 | } |
35 | 35 | ||
36 | KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo ) | 36 | KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo ) |
37 | : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) | 37 | : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) |
38 | { | 38 | { |
39 | construct(); | 39 | construct(); |
40 | } | 40 | } |
41 | 41 | ||
42 | QString KOTodoViewItem::key(int column,bool) const | 42 | QString KOTodoViewItem::key(int column,bool) const |
43 | { | 43 | { |
44 | QMap<int,QString>::ConstIterator it = mKeyMap.find(column); | 44 | QMap<int,QString>::ConstIterator it = mKeyMap.find(column); |
45 | if (it == mKeyMap.end()) { | 45 | if (it == mKeyMap.end()) { |
46 | return text(column).lower(); | 46 | return text(column).lower(); |
47 | } else { | 47 | } else { |
48 | return *it; | 48 | return *it; |
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | void KOTodoViewItem:: setup() | 52 | void KOTodoViewItem:: setup() |
53 | { | 53 | { |
54 | 54 | ||
55 | int h = 20; | 55 | int h = 20; |
56 | if ( listView () ) { | 56 | if ( listView () ) { |
57 | QFontMetrics fm ( listView ()->font () ); | 57 | QFontMetrics fm ( listView ()->font () ); |
58 | h = fm.height(); | 58 | h = fm.height(); |
59 | } | 59 | } |
60 | setHeight( h ); | 60 | setHeight( h ); |
61 | 61 | ||
62 | } | 62 | } |
63 | void KOTodoViewItem::setSortKey(int column,const QString &key) | 63 | void KOTodoViewItem::setSortKey(int column,const QString &key) |
64 | { | 64 | { |
65 | mKeyMap.insert(column,key); | 65 | mKeyMap.insert(column,key); |
66 | } | 66 | } |
67 | 67 | ||
68 | #if QT_VERSION >= 0x030000 | 68 | #if QT_VERSION >= 0x030000 |
69 | void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w, | 69 | void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w, |
70 | int y,int h) | 70 | int y,int h) |
71 | { | 71 | { |
72 | QListViewItem::paintBranches(p,cg,w,y,h); | 72 | QListViewItem::paintBranches(p,cg,w,y,h); |
73 | } | 73 | } |
74 | #else | 74 | #else |
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | void KOTodoViewItem::construct() | 77 | void KOTodoViewItem::construct() |
78 | { | 78 | { |
79 | // qDebug("KOTodoViewItem::construct() "); | 79 | // qDebug("KOTodoViewItem::construct() "); |
80 | m_init = true; | 80 | m_init = true; |
81 | QString keyd = "=="; | 81 | QString keyd = "=="; |
82 | QString keyt = "=="; | 82 | QString keyt = "=="; |
83 | QString skeyd = "=="; | 83 | QString skeyd = "=="; |
84 | QString skeyt = "=="; | 84 | QString skeyt = "=="; |
85 | 85 | ||
86 | setOn(mTodo->isCompleted()); | 86 | setOn(mTodo->isCompleted()); |
87 | setText(0,mTodo->summary()); | 87 | setText(0,mTodo->summary()); |
88 | setText(1,QString::number(mTodo->priority())); | 88 | setText(1,QString::number(mTodo->priority())); |
89 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); | 89 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); |
90 | if (mTodo->percentComplete()<100) { | 90 | if (mTodo->percentComplete()<100) { |
91 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 91 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
92 | else setSortKey(2,QString::number(mTodo->percentComplete())); | 92 | else setSortKey(2,QString::number(mTodo->percentComplete())); |
93 | } | 93 | } |
94 | else { | 94 | else { |
95 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 95 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
96 | else setSortKey(2,QString::number(99)); | 96 | else setSortKey(2,QString::number(99)); |
97 | } | 97 | } |
98 | if (mTodo->hasDueDate()) { | 98 | if (mTodo->hasDueDate()) { |
99 | setText(3, mTodo->dtDueDateStr()); | 99 | setText(3, mTodo->dtDueDateStr()); |
100 | QDate d = mTodo->dtDue().date(); | 100 | QDate d = mTodo->dtDue().date(); |
101 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 101 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
102 | // setSortKey(3,keyd); | 102 | // setSortKey(3,keyd); |
103 | if (mTodo->doesFloat()) { | 103 | if (mTodo->doesFloat()) { |
104 | setText(4,""); | 104 | setText(4,""); |
105 | } | 105 | } |
106 | else { | 106 | else { |
107 | setText(4,mTodo->dtDueTimeStr()); | 107 | setText(4,mTodo->dtDueTimeStr()); |
108 | QTime t = mTodo->dtDue().time(); | 108 | QTime t = mTodo->dtDue().time(); |
109 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); | 109 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); |
110 | //setSortKey(4,keyt); | 110 | //setSortKey(4,keyt); |
111 | } | 111 | } |
112 | } else { | 112 | } else { |
113 | setText(3,""); | 113 | setText(3,""); |
114 | setText(4,""); | 114 | setText(4,""); |
115 | } | 115 | } |
116 | setSortKey(3,keyd); | 116 | setSortKey(3,keyd); |
117 | setSortKey(4,keyt); | 117 | setSortKey(4,keyt); |
118 | 118 | ||
119 | if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt); | 119 | if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt); |
120 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); | 120 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); |
121 | 121 | ||
122 | 122 | ||
123 | 123 | ||
124 | keyd = ""; | 124 | keyd = ""; |
125 | keyt = ""; | 125 | keyt = ""; |
126 | 126 | ||
127 | if (mTodo->isRunning() ) { | 127 | if (mTodo->isRunning() ) { |
128 | QDate d = mTodo->runStart().date(); | 128 | QDate d = mTodo->runStart().date(); |
129 | QTime t = mTodo->runStart().time(); | 129 | QTime t = mTodo->runStart().time(); |
130 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); | 130 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); |
131 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 131 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
132 | keyd = KGlobal::locale()->formatDate( d , true); | 132 | keyd = KGlobal::locale()->formatDate( d , true); |
133 | keyt = KGlobal::locale()->formatTime( t ); | 133 | keyt = KGlobal::locale()->formatTime( t ); |
134 | 134 | ||
135 | } else { | 135 | } else { |
136 | 136 | ||
137 | if (mTodo->hasStartDate()) { | 137 | if (mTodo->hasStartDate()) { |
138 | keyd = mTodo->dtStartDateStr(); | 138 | keyd = mTodo->dtStartDateStr(); |
139 | QDate d = mTodo->dtStart().date(); | 139 | QDate d = mTodo->dtStart().date(); |
140 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 140 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
141 | 141 | ||
142 | if ( !mTodo->doesFloat()) { | 142 | if ( !mTodo->doesFloat()) { |
143 | keyt = mTodo->dtStartTimeStr(); | 143 | keyt = mTodo->dtStartTimeStr(); |
144 | QTime t = mTodo->dtStart().time(); | 144 | QTime t = mTodo->dtStart().time(); |
145 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); | 145 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); |
146 | 146 | ||
147 | } | 147 | } |
148 | 148 | ||
149 | } | 149 | } |
150 | } | 150 | } |
151 | setText(5,keyd); | 151 | setText(5,keyd); |
152 | setText(6,keyt); | 152 | setText(6,keyt); |
153 | setSortKey(5,skeyd); | 153 | setSortKey(5,skeyd); |
154 | setSortKey(6,skeyt); | 154 | setSortKey(6,skeyt); |
155 | 155 | ||
156 | setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No")); | 156 | setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No")); |
157 | setText(8,mTodo->categoriesStr()); | 157 | setText(8,mTodo->categoriesStr()); |
158 | 158 | ||
159 | #if 0 | 159 | #if 0 |
160 | // Find sort id in description. It's the text behind the last '#' character | 160 | // Find sort id in description. It's the text behind the last '#' character |
161 | // found in the description. White spaces are removed from beginning and end | 161 | // found in the description. White spaces are removed from beginning and end |
162 | // of sort id. | 162 | // of sort id. |
163 | int pos = mTodo->description().findRev('#'); | 163 | int pos = mTodo->description().findRev('#'); |
164 | if (pos < 0) { | 164 | if (pos < 0) { |
165 | setText(6,""); | 165 | setText(6,""); |
166 | } else { | 166 | } else { |
167 | QString str = mTodo->description().mid(pos+1); | 167 | QString str = mTodo->description().mid(pos+1); |
168 | str.stripWhiteSpace(); | 168 | str.stripWhiteSpace(); |
169 | setText(6,str); | 169 | setText(6,str); |
170 | } | 170 | } |
171 | #endif | 171 | #endif |
172 | 172 | ||
173 | m_known = false; | 173 | m_known = false; |
174 | m_init = false; | 174 | m_init = false; |
175 | 175 | ||
176 | setMyPixmap(); | 176 | setMyPixmap(); |
177 | 177 | ||
178 | } | 178 | } |
179 | void KOTodoViewItem::setMyPixmap() | 179 | void KOTodoViewItem::setMyPixmap() |
180 | { | 180 | { |
181 | int size = 5; | 181 | int size = 5; |
182 | QPixmap pixi = QPixmap( 1, 1 ); | 182 | QPixmap pixi = QPixmap( 1, 1 ); |
183 | // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) { | 183 | // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) { |
184 | // pixi = SmallIcon("redcross16"); | 184 | // pixi = SmallIcon("redcross16"); |
185 | // } else { | 185 | // } else { |
186 | QPainter p; | 186 | QPainter p; |
187 | 187 | ||
188 | int pixSize = 0; | 188 | int pixSize = 0; |
189 | QPixmap pPix = QPixmap( size, size ); | 189 | QPixmap pPix = QPixmap( size, size ); |
190 | if ( mTodo->description().length() > 0 ) { | 190 | if ( mTodo->description().length() > 0 ) { |
191 | pixi.resize(size, pixSize+size); | 191 | pixi.resize(size, pixSize+size); |
192 | pPix.fill( Qt::darkGreen ); | 192 | pPix.fill( Qt::darkGreen ); |
193 | p.begin( &pixi ); | 193 | p.begin( &pixi ); |
194 | p. drawPixmap ( 0, pixSize, pPix); | 194 | p. drawPixmap ( 0, pixSize, pPix); |
195 | p.end(); | 195 | p.end(); |
196 | pixSize += size; | 196 | pixSize += size; |
197 | } | 197 | } |
198 | if ( mTodo->isAlarmEnabled() ) { | 198 | if ( mTodo->isAlarmEnabled() && mTodo->alarmEnabled()) { |
199 | pixi.resize(size, pixSize+size); | 199 | pixi.resize(size, pixSize+size); |
200 | pPix.fill( Qt::red ); | 200 | pPix.fill( Qt::red ); |
201 | p.begin( &pixi ); | 201 | p.begin( &pixi ); |
202 | p. drawPixmap ( 0, pixSize, pPix); | 202 | p. drawPixmap ( 0, pixSize, pPix); |
203 | p.end(); | 203 | p.end(); |
204 | pixSize += size; | 204 | pixSize += size; |
205 | } | 205 | } |
206 | if ( mTodo->doesRecur() ) { | 206 | if ( mTodo->doesRecur() ) { |
207 | pixi.resize(size, pixSize+size); | 207 | pixi.resize(size, pixSize+size); |
208 | pPix.fill( Qt::blue ); | 208 | pPix.fill( Qt::blue ); |
209 | p.begin( &pixi ); | 209 | p.begin( &pixi ); |
210 | p. drawPixmap ( 0, pixSize, pPix); | 210 | p. drawPixmap ( 0, pixSize, pPix); |
211 | p.end(); | 211 | p.end(); |
212 | pixSize += size; | 212 | pixSize += size; |
213 | } | 213 | } |
214 | // } | 214 | // } |
215 | if ( pixi.width() > 1 ) { | 215 | if ( pixi.width() > 1 ) { |
216 | setPixmap ( 0,pixi ) ; | 216 | setPixmap ( 0,pixi ) ; |
217 | } else { | 217 | } else { |
218 | setPixmap ( 0,QPixmap() ) ; | 218 | setPixmap ( 0,QPixmap() ) ; |
219 | } | 219 | } |
220 | } | 220 | } |
221 | void KOTodoViewItem::stateChange(bool state) | 221 | void KOTodoViewItem::stateChange(bool state) |
222 | { | 222 | { |
223 | // qDebug("KOTodoViewItem::stateChange %d ", state); | 223 | // qDebug("KOTodoViewItem::stateChange %d ", state); |
224 | // do not change setting on startup | 224 | // do not change setting on startup |
225 | if ( m_init ) return; | 225 | if ( m_init ) return; |
226 | if (isOn()!=state) { | 226 | if (isOn()!=state) { |
227 | setOn(state); | 227 | setOn(state); |
228 | //qDebug("SETON "); | 228 | //qDebug("SETON "); |
229 | return; | 229 | return; |
230 | } | 230 | } |
231 | if ( mTodo->isCompleted() == state ) { | 231 | if ( mTodo->isCompleted() == state ) { |
232 | //qDebug("STATECHANGE:nothing to do "); | 232 | //qDebug("STATECHANGE:nothing to do "); |
233 | return; | 233 | return; |
234 | } | 234 | } |
235 | QString keyd = "=="; | 235 | QString keyd = "=="; |
236 | QString keyt = "=="; | 236 | QString keyt = "=="; |
237 | //qDebug("KOTodoViewItem::stateChange %s ", text(0).latin1()); | 237 | //qDebug("KOTodoViewItem::stateChange %s ", text(0).latin1()); |
238 | if ( mTodo->doesRecur() ){ | 238 | if ( mTodo->doesRecur() ){ |
239 | QDateTime start = mTodo->dtStart(); | 239 | QDateTime start = mTodo->dtStart(); |
240 | mTodo->setCompleted(state); | 240 | mTodo->setCompleted(state); |
241 | if ( start != mTodo->dtStart() ) { | 241 | if ( start != mTodo->dtStart() ) { |
242 | if ( state && !mTodo->isCompleted() ) { | 242 | if ( state && !mTodo->isCompleted() ) { |
243 | setOn( false ); | 243 | setOn( false ); |
244 | state = false; | 244 | state = false; |
245 | } | 245 | } |
246 | } | 246 | } |
247 | } else | 247 | } else |
248 | mTodo->setCompleted(state); | 248 | mTodo->setCompleted(state); |
249 | 249 | ||
250 | if (state) mTodo->setCompleted(QDateTime::currentDateTime()); | 250 | if (state) mTodo->setCompleted(QDateTime::currentDateTime()); |
251 | 251 | ||
252 | if (mTodo->hasDueDate()) { | 252 | if (mTodo->hasDueDate()) { |
253 | setText(3, mTodo->dtDueDateStr()); | 253 | setText(3, mTodo->dtDueDateStr()); |
254 | QDate d = mTodo->dtDue().date(); | 254 | QDate d = mTodo->dtDue().date(); |
255 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 255 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
256 | setSortKey(3,keyd); | 256 | setSortKey(3,keyd); |
257 | if (mTodo->doesFloat()) { | 257 | if (mTodo->doesFloat()) { |
258 | setText(4,""); | 258 | setText(4,""); |
259 | } | 259 | } |
260 | else { | 260 | else { |
261 | setText(4,mTodo->dtDueTimeStr()); | 261 | setText(4,mTodo->dtDueTimeStr()); |
262 | QTime t = mTodo->dtDue().time(); | 262 | QTime t = mTodo->dtDue().time(); |
263 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); | 263 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); |
264 | setSortKey(4,keyt); | 264 | setSortKey(4,keyt); |
265 | } | 265 | } |
266 | } | 266 | } |
267 | if (mTodo->hasStartDate()) { | 267 | if (mTodo->hasStartDate()) { |
268 | QString skeyt = "=="; | 268 | QString skeyt = "=="; |
269 | QString skeyd = "=="; | 269 | QString skeyd = "=="; |
270 | setText(5, mTodo->dtStartDateStr()); | 270 | setText(5, mTodo->dtStartDateStr()); |
271 | QDate d = mTodo->dtStart().date(); | 271 | QDate d = mTodo->dtStart().date(); |
272 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 272 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
273 | 273 | ||
274 | if (mTodo->doesFloat()) { | 274 | if (mTodo->doesFloat()) { |
275 | setText(6,""); | 275 | setText(6,""); |
276 | } | 276 | } |
277 | else { | 277 | else { |
278 | setText(6,mTodo->dtStartTimeStr()); | 278 | setText(6,mTodo->dtStartTimeStr()); |
279 | QTime t = mTodo->dtStart().time(); | 279 | QTime t = mTodo->dtStart().time(); |
280 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); | 280 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); |
281 | 281 | ||
282 | } | 282 | } |
283 | setSortKey(5,skeyd); | 283 | setSortKey(5,skeyd); |
284 | setSortKey(6,skeyt); | 284 | setSortKey(6,skeyt); |
285 | } | 285 | } |
286 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); | 286 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); |
287 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); | 287 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); |
288 | 288 | ||
289 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); | 289 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); |
290 | if (mTodo->percentComplete()<100) { | 290 | if (mTodo->percentComplete()<100) { |
291 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 291 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
292 | else setSortKey(2,QString::number(mTodo->percentComplete())); | 292 | else setSortKey(2,QString::number(mTodo->percentComplete())); |
293 | } | 293 | } |
294 | else { | 294 | else { |
295 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 295 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
296 | else setSortKey(2,QString::number(99)); | 296 | else setSortKey(2,QString::number(99)); |
297 | } | 297 | } |
298 | if ( state ) { | 298 | if ( state ) { |
299 | QListViewItem * myChild = firstChild(); | 299 | QListViewItem * myChild = firstChild(); |
300 | KOTodoViewItem *item; | 300 | KOTodoViewItem *item; |
301 | while( myChild ) { | 301 | while( myChild ) { |
302 | //qDebug("stateCH "); | 302 | //qDebug("stateCH "); |
303 | item = static_cast<KOTodoViewItem*>(myChild); | 303 | item = static_cast<KOTodoViewItem*>(myChild); |
304 | item->stateChange(state); | 304 | item->stateChange(state); |
305 | myChild = myChild->nextSibling(); | 305 | myChild = myChild->nextSibling(); |
306 | } | 306 | } |
307 | } else { | 307 | } else { |
308 | QListViewItem * myChild = parent(); | 308 | QListViewItem * myChild = parent(); |
309 | if ( myChild ) | 309 | if ( myChild ) |
310 | (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); | 310 | (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); |
311 | } | 311 | } |
312 | mTodoView->modified(true); | 312 | mTodoView->modified(true); |
313 | setMyPixmap(); | 313 | setMyPixmap(); |
314 | mTodoView->setTodoModified( mTodo ); | 314 | mTodoView->setTodoModified( mTodo ); |
315 | } | 315 | } |
316 | 316 | ||
317 | bool KOTodoViewItem::isAlternate() | 317 | bool KOTodoViewItem::isAlternate() |
318 | { | 318 | { |
319 | 319 | ||
320 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); | 320 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); |
321 | if (lv && lv->alternateBackground().isValid()) | 321 | if (lv && lv->alternateBackground().isValid()) |
322 | { | 322 | { |
323 | KOTodoViewItem *above = 0; | 323 | KOTodoViewItem *above = 0; |
324 | above = static_cast<KOTodoViewItem *>(itemAbove()); | 324 | above = static_cast<KOTodoViewItem *>(itemAbove()); |
325 | m_known = above ? above->m_known : true; | 325 | m_known = above ? above->m_known : true; |
326 | if (m_known) | 326 | if (m_known) |
327 | { | 327 | { |
328 | m_odd = above ? !above->m_odd : false; | 328 | m_odd = above ? !above->m_odd : false; |
329 | } | 329 | } |
330 | else | 330 | else |
331 | { | 331 | { |
332 | KOTodoViewItem *item; | 332 | KOTodoViewItem *item; |
333 | bool previous = true; | 333 | bool previous = true; |
334 | if (QListViewItem::parent()) | 334 | if (QListViewItem::parent()) |
335 | { | 335 | { |
336 | item = static_cast<KOTodoViewItem *>(QListViewItem::parent()); | 336 | item = static_cast<KOTodoViewItem *>(QListViewItem::parent()); |
337 | if (item) | 337 | if (item) |
338 | previous = item->m_odd; | 338 | previous = item->m_odd; |
339 | item = static_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); | 339 | item = static_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); |
340 | } | 340 | } |
341 | else | 341 | else |
342 | { | 342 | { |
343 | item = static_cast<KOTodoViewItem *>(lv->firstChild()); | 343 | item = static_cast<KOTodoViewItem *>(lv->firstChild()); |
344 | } | 344 | } |
345 | 345 | ||
346 | while(item) | 346 | while(item) |
347 | { | 347 | { |
348 | item->m_odd = previous = !previous; | 348 | item->m_odd = previous = !previous; |
349 | item->m_known = true; | 349 | item->m_known = true; |
350 | item = static_cast<KOTodoViewItem *>(item->nextSibling()); | 350 | item = static_cast<KOTodoViewItem *>(item->nextSibling()); |
351 | } | 351 | } |
352 | } | 352 | } |
353 | return m_odd; | 353 | return m_odd; |
354 | } | 354 | } |
355 | return false; | 355 | return false; |
356 | } | 356 | } |
357 | 357 | ||
358 | void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) | 358 | void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) |
359 | { | 359 | { |
360 | QColorGroup _cg = cg; | 360 | QColorGroup _cg = cg; |
361 | QColorGroup::ColorRole role; | 361 | QColorGroup::ColorRole role; |
362 | if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) | 362 | if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) |
363 | role = QColorGroup::Text; | 363 | role = QColorGroup::Text; |
364 | else | 364 | else |
365 | role = QColorGroup::Base; | 365 | role = QColorGroup::Base; |
366 | //#ifndef KORG_NOLVALTERNATION | 366 | //#ifndef KORG_NOLVALTERNATION |
367 | if (isAlternate()) | 367 | if (isAlternate()) |
368 | _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); | 368 | _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); |
369 | bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; | 369 | bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; |
370 | QColor colorToSet; | 370 | QColor colorToSet; |
371 | if ( setColor ) { | 371 | if ( setColor ) { |
372 | QStringList categories = mTodo->categories(); | 372 | QStringList categories = mTodo->categories(); |
373 | QString cat = categories.first(); | 373 | QString cat = categories.first(); |
374 | if ( !cat.isEmpty()) { | 374 | if ( !cat.isEmpty()) { |
375 | colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); | 375 | colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); |
376 | } else | 376 | } else |
377 | setColor = false; | 377 | setColor = false; |
378 | } | 378 | } |
379 | bool openMode = !isOpen(); | 379 | bool openMode = !isOpen(); |
380 | // maybe we are in flat-display-mode | 380 | // maybe we are in flat-display-mode |
381 | if ( !firstChild() ) | 381 | if ( !firstChild() ) |
382 | openMode = false; | 382 | openMode = false; |
383 | bool colorRunning = mTodo->isRunning(); | 383 | bool colorRunning = mTodo->isRunning(); |
384 | if ( ! colorRunning && openMode ) | 384 | if ( ! colorRunning && openMode ) |
385 | colorRunning = mTodo->hasRunningSub(); | 385 | colorRunning = mTodo->hasRunningSub(); |
386 | if ( colorRunning ) { | 386 | if ( colorRunning ) { |
387 | setColor = true; | 387 | setColor = true; |
388 | colorToSet = KOPrefs::instance()->mTodoRunColor; | 388 | colorToSet = KOPrefs::instance()->mTodoRunColor; |
389 | } else { | 389 | } else { |
390 | int odue = mTodo->hasDueSubTodo( openMode ); | 390 | int odue = mTodo->hasDueSubTodo( openMode ); |
391 | if (odue == 2) { | 391 | if (odue == 2) { |
392 | colorToSet = KOPrefs::instance()->mTodoOverdueColor; | 392 | colorToSet = KOPrefs::instance()->mTodoOverdueColor; |
393 | setColor = true; | 393 | setColor = true; |
394 | } else if ( odue == 1 ) { | 394 | } else if ( odue == 1 ) { |
395 | colorToSet = KOPrefs::instance()->mTodoDueTodayColor; | 395 | colorToSet = KOPrefs::instance()->mTodoDueTodayColor; |
396 | setColor = true; | 396 | setColor = true; |
397 | } | 397 | } |
398 | } | 398 | } |
399 | 399 | ||
400 | 400 | ||
401 | if ( setColor ) { | 401 | if ( setColor ) { |
402 | _cg.setColor(role,colorToSet ); | 402 | _cg.setColor(role,colorToSet ); |
403 | if ( role == QColorGroup::Base) { | 403 | if ( role == QColorGroup::Base) { |
404 | int rgb = colorToSet.red(); | 404 | int rgb = colorToSet.red(); |
405 | rgb += colorToSet.blue()/2; | 405 | rgb += colorToSet.blue()/2; |
406 | rgb += colorToSet.green(); | 406 | rgb += colorToSet.green(); |
407 | if ( rgb < 200 ) | 407 | if ( rgb < 200 ) |
408 | _cg.setColor(QColorGroup::Text,Qt::white ); | 408 | _cg.setColor(QColorGroup::Text,Qt::white ); |
409 | } | 409 | } |
410 | } | 410 | } |
411 | //#endif | 411 | //#endif |
412 | if ( column > 0 ){ | 412 | if ( column > 0 ){ |
413 | if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { | 413 | if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { |
414 | p->save(); | 414 | p->save(); |
415 | int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); | 415 | int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); |
416 | 416 | ||
417 | p->fillRect( 0, 0, width, height(), _cg.base() ); // background | 417 | p->fillRect( 0, 0, width, height(), _cg.base() ); // background |
418 | // p->setPen(Qt::black ); //border | 418 | // p->setPen(Qt::black ); //border |
419 | // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling | 419 | // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling |
420 | QColor fc = KOPrefs::instance()->mHighlightColor; | 420 | QColor fc = KOPrefs::instance()->mHighlightColor; |
421 | if ( mTodo->percentComplete() == 100 ) | 421 | if ( mTodo->percentComplete() == 100 ) |
422 | fc = darkGreen; | 422 | fc = darkGreen; |
423 | p->drawRect( 2, 2, width-4, height()-4); | 423 | p->drawRect( 2, 2, width-4, height()-4); |
424 | p->fillRect( 3, 3, progress, height()-6, | 424 | p->fillRect( 3, 3, progress, height()-6, |
425 | fc ); | 425 | fc ); |
426 | p->restore(); | 426 | p->restore(); |
427 | } else { | 427 | } else { |
428 | QCheckListItem::paintCell(p, _cg, column, width, alignment); | 428 | QCheckListItem::paintCell(p, _cg, column, width, alignment); |
429 | } | 429 | } |
430 | return; | 430 | return; |
431 | } | 431 | } |
432 | 432 | ||
433 | int align = alignment; | 433 | int align = alignment; |
434 | 434 | ||
435 | if ( !p ) | 435 | if ( !p ) |
436 | return; | 436 | return; |
437 | 437 | ||
438 | p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) ); | 438 | p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) ); |
439 | 439 | ||
440 | QListView *lv = listView(); | 440 | QListView *lv = listView(); |
441 | if ( !lv ) | 441 | if ( !lv ) |
442 | return; | 442 | return; |
443 | int marg = 2;//lv->itemMargin(); | 443 | int marg = 2;//lv->itemMargin(); |
444 | int r = 0; | 444 | int r = 0; |
445 | QCheckListItem::Type myType = QCheckListItem::CheckBox; | 445 | QCheckListItem::Type myType = QCheckListItem::CheckBox; |
446 | int BoxSize = 20; | 446 | int BoxSize = 20; |
447 | int boxOffset = 2; | 447 | int boxOffset = 2; |
448 | int xOffset = 2; | 448 | int xOffset = 2; |
449 | if (qApp->desktop()->width() < 300 ) { | 449 | if (qApp->desktop()->width() < 300 ) { |
450 | BoxSize = 14; | 450 | BoxSize = 14; |
451 | boxOffset = -1; | 451 | boxOffset = -1; |
452 | xOffset = 1; | 452 | xOffset = 1; |
453 | // marg = 0; | 453 | // marg = 0; |
454 | } | 454 | } |
455 | if ( height() < BoxSize ) { | 455 | if ( height() < BoxSize ) { |
456 | boxOffset = boxOffset - ((BoxSize - height())/2) ; | 456 | boxOffset = boxOffset - ((BoxSize - height())/2) ; |
457 | // qDebug("boxOffset %d height %d", boxOffset, height() ); | 457 | // qDebug("boxOffset %d height %d", boxOffset, height() ); |
458 | BoxSize = height(); | 458 | BoxSize = height(); |
459 | 459 | ||
460 | } | 460 | } |
461 | //bool winStyle = lv->style() == WindowsStyle; | 461 | //bool winStyle = lv->style() == WindowsStyle; |
462 | 462 | ||
463 | int lineStart = 5; | 463 | int lineStart = 5; |
464 | if ( myType == Controller ) { | 464 | if ( myType == Controller ) { |
465 | if ( !pixmap( 0 ) ) | 465 | if ( !pixmap( 0 ) ) |
466 | r += BoxSize + 4; | 466 | r += BoxSize + 4; |
467 | } else { | 467 | } else { |
468 | ASSERT( lv ); //### | 468 | ASSERT( lv ); //### |
469 | //QFontMetrics fm( lv->font() ); | 469 | //QFontMetrics fm( lv->font() ); |
470 | //int d = fm.height(); | 470 | //int d = fm.height(); |
471 | int x = 0; | 471 | int x = 0; |
472 | int y = (height() - BoxSize) / 2; | 472 | int y = (height() - BoxSize) / 2; |
473 | //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) ); | 473 | //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) ); |
474 | if ( myType == CheckBox ) { | 474 | if ( myType == CheckBox ) { |
475 | if ( isEnabled() ) | 475 | if ( isEnabled() ) |
476 | p->setPen( QPen( _cg.text(), 1 ) ); | 476 | p->setPen( QPen( _cg.text(), 1 ) ); |
477 | else | 477 | else |
478 | p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) ); | 478 | p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) ); |
479 | p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 ); | 479 | p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 ); |
480 | lineStart = x+marg; | 480 | lineStart = x+marg; |
481 | ///////////////////// | 481 | ///////////////////// |
482 | x++; | 482 | x++; |
483 | y++; | 483 | y++; |
484 | if ( isOn() ) { | 484 | if ( isOn() ) { |
485 | QPointArray a( 7*2 ); | 485 | QPointArray a( 7*2 ); |
486 | int i, xx, yy; | 486 | int i, xx, yy; |
487 | xx = x+xOffset+marg+(boxOffset/2); | 487 | xx = x+xOffset+marg+(boxOffset/2); |
488 | yy = y+5+boxOffset; | 488 | yy = y+5+boxOffset; |
489 | for ( i=0; i<3; i++ ) { | 489 | for ( i=0; i<3; i++ ) { |
490 | a.setPoint( 2*i, xx, yy ); | 490 | a.setPoint( 2*i, xx, yy ); |
491 | a.setPoint( 2*i+1, xx, yy+2 ); | 491 | a.setPoint( 2*i+1, xx, yy+2 ); |
492 | // qDebug(" "); | 492 | // qDebug(" "); |
493 | xx++; yy++; | 493 | xx++; yy++; |
494 | } | 494 | } |
495 | yy -= 2; | 495 | yy -= 2; |
496 | for ( i=3; i<7; i++ ) { | 496 | for ( i=3; i<7; i++ ) { |
497 | a.setPoint( 2*i, xx, yy ); | 497 | a.setPoint( 2*i, xx, yy ); |
498 | a.setPoint( 2*i+1, xx, yy+2 ); | 498 | a.setPoint( 2*i+1, xx, yy+2 ); |
499 | xx++; yy--; | 499 | xx++; yy--; |
500 | } | 500 | } |
501 | p->setPen( darkGreen ); | 501 | p->setPen( darkGreen ); |
502 | p->drawLineSegments( a ); | 502 | p->drawLineSegments( a ); |
503 | } | 503 | } |
504 | //////////////////////// | 504 | //////////////////////// |
505 | } | 505 | } |
506 | r += BoxSize + 4; | 506 | r += BoxSize + 4; |
507 | } | 507 | } |
508 | 508 | ||
509 | p->translate( r, 0 ); | 509 | p->translate( r, 0 ); |
510 | p->setPen( QPen( _cg.text() ) ); | 510 | p->setPen( QPen( _cg.text() ) ); |
511 | QListViewItem::paintCell( p, _cg, column, width - r, align ); | 511 | QListViewItem::paintCell( p, _cg, column, width - r, align ); |
512 | if ( mTodo->cancelled () ) { | 512 | if ( mTodo->cancelled () ) { |
513 | p->setPen( black ); | 513 | p->setPen( black ); |
514 | QRect br = p->boundingRect( 1,1,1,1,0,mTodo->summary() ); | 514 | QRect br = p->boundingRect( 1,1,1,1,0,mTodo->summary() ); |
515 | int wid = br.width() +lineStart; | 515 | int wid = br.width() +lineStart; |
516 | if ( wid > width-3 ) | 516 | if ( wid > width-3 ) |
517 | wid = width-3; | 517 | wid = width-3; |
518 | p->drawLine( lineStart, height()/2+1, wid, height()/2+1 ); | 518 | p->drawLine( lineStart, height()/2+1, wid, height()/2+1 ); |
519 | 519 | ||
520 | } | 520 | } |
521 | 521 | ||
522 | } | 522 | } |
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index e8574a0..221debc 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp | |||
@@ -1,789 +1,789 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <qlayout.h> | 20 | #include <qlayout.h> |
21 | #include <qtextbrowser.h> | 21 | #include <qtextbrowser.h> |
22 | #include <qtextcodec.h> | 22 | #include <qtextcodec.h> |
23 | #include <qfileinfo.h> | 23 | #include <qfileinfo.h> |
24 | #include <qlabel.h> | 24 | #include <qlabel.h> |
25 | 25 | ||
26 | #include <qapplication.h> | 26 | #include <qapplication.h> |
27 | #ifdef DESKTOP_VERSION | 27 | #ifdef DESKTOP_VERSION |
28 | #include <qpaintdevicemetrics.h> | 28 | #include <qpaintdevicemetrics.h> |
29 | #endif | 29 | #endif |
30 | #include <kglobal.h> | 30 | #include <kglobal.h> |
31 | #include <klocale.h> | 31 | #include <klocale.h> |
32 | #include <kdebug.h> | 32 | #include <kdebug.h> |
33 | #include <kiconloader.h> | 33 | #include <kiconloader.h> |
34 | #include <kmessagebox.h> | 34 | #include <kmessagebox.h> |
35 | 35 | ||
36 | #include <libkcal/calendar.h> | 36 | #include <libkcal/calendar.h> |
37 | 37 | ||
38 | #ifndef KORG_NOPRINTER | 38 | #ifndef KORG_NOPRINTER |
39 | #include "calprinter.h" | 39 | #include "calprinter.h" |
40 | #endif | 40 | #endif |
41 | #include "koglobals.h" | 41 | #include "koglobals.h" |
42 | #include "koprefs.h" | 42 | #include "koprefs.h" |
43 | #include "koeventviewerdialog.h" | 43 | #include "koeventviewerdialog.h" |
44 | #include "koeventviewer.h" | 44 | #include "koeventviewer.h" |
45 | #include <qstylesheet.h> | 45 | #include <qstylesheet.h> |
46 | #include "kowhatsnextview.h" | 46 | #include "kowhatsnextview.h" |
47 | using namespace KOrg; | 47 | using namespace KOrg; |
48 | 48 | ||
49 | void WhatsNextTextBrowser::setSource(const QString& n) | 49 | void WhatsNextTextBrowser::setSource(const QString& n) |
50 | { | 50 | { |
51 | 51 | ||
52 | if (n.startsWith("event:")) { | 52 | if (n.startsWith("event:")) { |
53 | emit showIncidence(n); | 53 | emit showIncidence(n); |
54 | return; | 54 | return; |
55 | } else if (n.startsWith("todo:")) { | 55 | } else if (n.startsWith("todo:")) { |
56 | emit showIncidence(n); | 56 | emit showIncidence(n); |
57 | return; | 57 | return; |
58 | } else { | 58 | } else { |
59 | QTextBrowser::setSource(n); | 59 | QTextBrowser::setSource(n); |
60 | } | 60 | } |
61 | } | 61 | } |
62 | void WhatsNextTextBrowser::printMe() | 62 | void WhatsNextTextBrowser::printMe() |
63 | { | 63 | { |
64 | #ifdef DESKTOP_VERSION | 64 | #ifdef DESKTOP_VERSION |
65 | KOPrintPrefs pp ( this ); | 65 | KOPrintPrefs pp ( this ); |
66 | if (!pp.exec() ) | 66 | if (!pp.exec() ) |
67 | return; | 67 | return; |
68 | int scaleval = pp.printMode() ; | 68 | int scaleval = pp.printMode() ; |
69 | 69 | ||
70 | QPrinter printer; | 70 | QPrinter printer; |
71 | if (!printer.setup() ) | 71 | if (!printer.setup() ) |
72 | return; | 72 | return; |
73 | QPainter p; | 73 | QPainter p; |
74 | p.begin ( &printer ); | 74 | p.begin ( &printer ); |
75 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); | 75 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); |
76 | float dx, dy; | 76 | float dx, dy; |
77 | int wid = (m.width() * 9)/10; | 77 | int wid = (m.width() * 9)/10; |
78 | dx = (float) wid/(float)contentsWidth (); | 78 | dx = (float) wid/(float)contentsWidth (); |
79 | dy = (float)(m.height()) / (float)contentsHeight (); | 79 | dy = (float)(m.height()) / (float)contentsHeight (); |
80 | float scale; | 80 | float scale; |
81 | // scale to fit the width or height of the paper | 81 | // scale to fit the width or height of the paper |
82 | if ( dx < dy ) | 82 | if ( dx < dy ) |
83 | scale = dx; | 83 | scale = dx; |
84 | else | 84 | else |
85 | scale = dy; | 85 | scale = dy; |
86 | p.translate( m.width()/10,0 ); | 86 | p.translate( m.width()/10,0 ); |
87 | if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { | 87 | if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { |
88 | p.scale( scale, scale ); | 88 | p.scale( scale, scale ); |
89 | } | 89 | } |
90 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); | 90 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); |
91 | p.end(); | 91 | p.end(); |
92 | #endif | 92 | #endif |
93 | } | 93 | } |
94 | 94 | ||
95 | KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, | 95 | KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, |
96 | const char *name) | 96 | const char *name) |
97 | : KOrg::BaseView(calendar, parent, name) | 97 | : KOrg::BaseView(calendar, parent, name) |
98 | { | 98 | { |
99 | // mDateLabel = | 99 | // mDateLabel = |
100 | // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); | 100 | // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); |
101 | // mDateLabel->setMargin(2); | 101 | // mDateLabel->setMargin(2); |
102 | // mDateLabel->setAlignment(AlignCenter); | 102 | // mDateLabel->setAlignment(AlignCenter); |
103 | setFont( KOPrefs::instance()->mWhatsNextFont ); | 103 | setFont( KOPrefs::instance()->mWhatsNextFont ); |
104 | mView = new WhatsNextTextBrowser(this); | 104 | mView = new WhatsNextTextBrowser(this); |
105 | connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); | 105 | connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); |
106 | QStyleSheet* stsh = mView->styleSheet(); | 106 | QStyleSheet* stsh = mView->styleSheet(); |
107 | QStyleSheetItem * style ; | 107 | QStyleSheetItem * style ; |
108 | style = stsh->item ("h2" ); | 108 | style = stsh->item ("h2" ); |
109 | if ( style ) { | 109 | if ( style ) { |
110 | style->setMargin(QStyleSheetItem::MarginAll,0); | 110 | style->setMargin(QStyleSheetItem::MarginAll,0); |
111 | } | 111 | } |
112 | style = stsh->item ("h3" ); | 112 | style = stsh->item ("h3" ); |
113 | if ( style ) { | 113 | if ( style ) { |
114 | style->setMargin(QStyleSheetItem::MarginAll,0); | 114 | style->setMargin(QStyleSheetItem::MarginAll,0); |
115 | } | 115 | } |
116 | mEventViewer = 0; | 116 | mEventViewer = 0; |
117 | 117 | ||
118 | QBoxLayout *topLayout = new QVBoxLayout(this); | 118 | QBoxLayout *topLayout = new QVBoxLayout(this); |
119 | // topLayout->addWidget(mDateLabel); | 119 | // topLayout->addWidget(mDateLabel); |
120 | topLayout->addWidget(mView); | 120 | topLayout->addWidget(mView); |
121 | mTimer = new QTimer( this ); | 121 | mTimer = new QTimer( this ); |
122 | connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); | 122 | connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); |
123 | 123 | ||
124 | connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); | 124 | connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); |
125 | connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); | 125 | connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); |
126 | } | 126 | } |
127 | 127 | ||
128 | KOWhatsNextView::~KOWhatsNextView() | 128 | KOWhatsNextView::~KOWhatsNextView() |
129 | { | 129 | { |
130 | } | 130 | } |
131 | 131 | ||
132 | int KOWhatsNextView::maxDatesHint() | 132 | int KOWhatsNextView::maxDatesHint() |
133 | { | 133 | { |
134 | return 0; | 134 | return 0; |
135 | } | 135 | } |
136 | 136 | ||
137 | int KOWhatsNextView::currentDateCount() | 137 | int KOWhatsNextView::currentDateCount() |
138 | { | 138 | { |
139 | return 0; | 139 | return 0; |
140 | } | 140 | } |
141 | 141 | ||
142 | void KOWhatsNextView::clearList() | 142 | void KOWhatsNextView::clearList() |
143 | { | 143 | { |
144 | mTimer->stop(); | 144 | mTimer->stop(); |
145 | mView->setText(" "); | 145 | mView->setText(" "); |
146 | } | 146 | } |
147 | QPtrList<Incidence> KOWhatsNextView::selectedIncidences() | 147 | QPtrList<Incidence> KOWhatsNextView::selectedIncidences() |
148 | { | 148 | { |
149 | QPtrList<Incidence> eventList; | 149 | QPtrList<Incidence> eventList; |
150 | 150 | ||
151 | return eventList; | 151 | return eventList; |
152 | } | 152 | } |
153 | 153 | ||
154 | void KOWhatsNextView::printMe() | 154 | void KOWhatsNextView::printMe() |
155 | { | 155 | { |
156 | #ifdef DESKTOP_VERSION | 156 | #ifdef DESKTOP_VERSION |
157 | mView->printMe(); | 157 | mView->printMe(); |
158 | #endif | 158 | #endif |
159 | } | 159 | } |
160 | void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 160 | void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
161 | const QDate &td) | 161 | const QDate &td) |
162 | { | 162 | { |
163 | #ifndef KORG_NOPRINTER | 163 | #ifndef KORG_NOPRINTER |
164 | calPrinter->preview(CalPrinter::Day, fd, td); | 164 | calPrinter->preview(CalPrinter::Day, fd, td); |
165 | #endif | 165 | #endif |
166 | } | 166 | } |
167 | void KOWhatsNextView::updateConfig() | 167 | void KOWhatsNextView::updateConfig() |
168 | { | 168 | { |
169 | setFont( KOPrefs::instance()->mWhatsNextFont ); | 169 | setFont( KOPrefs::instance()->mWhatsNextFont ); |
170 | updateView(); | 170 | updateView(); |
171 | 171 | ||
172 | } | 172 | } |
173 | void KOWhatsNextView::showEvent ( QShowEvent * e ) | 173 | void KOWhatsNextView::showEvent ( QShowEvent * e ) |
174 | { | 174 | { |
175 | //qDebug("KOWhatsNextView::showEvent "); | 175 | //qDebug("KOWhatsNextView::showEvent "); |
176 | restartTimer(); | 176 | restartTimer(); |
177 | QWidget::showEvent ( e ); | 177 | QWidget::showEvent ( e ); |
178 | } | 178 | } |
179 | void KOWhatsNextView::hideEvent ( QHideEvent * e) | 179 | void KOWhatsNextView::hideEvent ( QHideEvent * e) |
180 | { | 180 | { |
181 | //qDebug(" KOWhatsNextView::hideEvent"); | 181 | //qDebug(" KOWhatsNextView::hideEvent"); |
182 | mTimer->stop(); | 182 | mTimer->stop(); |
183 | QWidget::hideEvent ( e ); | 183 | QWidget::hideEvent ( e ); |
184 | } | 184 | } |
185 | void KOWhatsNextView::restartTimer() | 185 | void KOWhatsNextView::restartTimer() |
186 | { | 186 | { |
187 | //qDebug("KOWhatsNextView::restartTimer() "); | 187 | //qDebug("KOWhatsNextView::restartTimer() "); |
188 | mTimer->start( 300000 ); | 188 | mTimer->start( 300000 ); |
189 | //mTimer->start( 5000 ); | 189 | //mTimer->start( 5000 ); |
190 | } | 190 | } |
191 | void KOWhatsNextView::updateView() | 191 | void KOWhatsNextView::updateView() |
192 | { | 192 | { |
193 | //qDebug("KOWhatsNextView::updateView() "); | 193 | //qDebug("KOWhatsNextView::updateView() "); |
194 | if ( mTimer->isActive() ) | 194 | if ( mTimer->isActive() ) |
195 | restartTimer(); | 195 | restartTimer(); |
196 | mCurrentMaxPrio = 5; | 196 | mCurrentMaxPrio = 5; |
197 | //qDebug("KOWhatsNextView::updateView() "); | 197 | //qDebug("KOWhatsNextView::updateView() "); |
198 | // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); | 198 | // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); |
199 | KIconLoader kil("korganizer"); | 199 | KIconLoader kil("korganizer"); |
200 | QString ipath;// = new QString(); | 200 | QString ipath;// = new QString(); |
201 | // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); | 201 | // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); |
202 | //<big><big><strong>" + date + "</strong></big></big>\n"; | 202 | //<big><big><strong>" + date + "</strong></big></big>\n"; |
203 | mText = "<table width=\"100%\">\n"; | 203 | mText = "<table width=\"100%\">\n"; |
204 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; | 204 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; |
205 | #ifdef DESKTOP_VERSION | 205 | #ifdef DESKTOP_VERSION |
206 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; | 206 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; |
207 | #else | 207 | #else |
208 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; | 208 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; |
209 | #endif | 209 | #endif |
210 | // mText += "<img src=\""; | 210 | // mText += "<img src=\""; |
211 | // mText += ipath; | 211 | // mText += ipath; |
212 | // mText += "\">"; | 212 | // mText += "\">"; |
213 | mEventDate = QDate::currentDate(); | 213 | mEventDate = QDate::currentDate(); |
214 | #ifdef DESKTOP_VERSION | 214 | #ifdef DESKTOP_VERSION |
215 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>"; | 215 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>"; |
216 | #else | 216 | #else |
217 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>"; | 217 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>"; |
218 | #endif | 218 | #endif |
219 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; | 219 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; |
220 | int iii; | 220 | int iii; |
221 | mTodos.clear(); | 221 | mTodos.clear(); |
222 | QPtrList<Event> events; | 222 | QPtrList<Event> events; |
223 | QPtrList<Todo> todos = calendar()->todos(); | 223 | QPtrList<Todo> todos = calendar()->todos(); |
224 | Todo * todo; | 224 | Todo * todo; |
225 | //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; | 225 | //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; |
226 | int daysToShow = KOPrefs::instance()->mWhatsNextDays ; | 226 | int daysToShow = KOPrefs::instance()->mWhatsNextDays ; |
227 | bool itemAdded = false; | 227 | bool itemAdded = false; |
228 | for ( iii = 0; iii < daysToShow; ++iii ) { | 228 | for ( iii = 0; iii < daysToShow; ++iii ) { |
229 | QString date; | 229 | QString date; |
230 | itemAdded = false; | 230 | itemAdded = false; |
231 | events = calendar()->events( mEventDate, true ); | 231 | events = calendar()->events( mEventDate, true ); |
232 | 232 | ||
233 | if ( iii == 0 ) { // today !!! | 233 | if ( iii == 0 ) { // today !!! |
234 | todo = todos.first(); | 234 | todo = todos.first(); |
235 | while(todo) { | 235 | while(todo) { |
236 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { | 236 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { |
237 | if ( ! itemAdded ) { | 237 | if ( ! itemAdded ) { |
238 | appendDay ( iii, mEventDate ); | 238 | appendDay ( iii, mEventDate ); |
239 | //itemAdded = true; | 239 | //itemAdded = true; |
240 | 240 | ||
241 | } //bool reply=false, bool notRed = true, bool appendTable = false); | 241 | } //bool reply=false, bool notRed = true, bool appendTable = false); |
242 | appendEvent(todo, false, false, !itemAdded ); | 242 | appendEvent(todo, false, false, !itemAdded ); |
243 | itemAdded = true; | 243 | itemAdded = true; |
244 | } | 244 | } |
245 | todo = todos.next(); | 245 | todo = todos.next(); |
246 | } | 246 | } |
247 | } | 247 | } |
248 | 248 | ||
249 | 249 | ||
250 | if (events.count() > 0) { | 250 | if (events.count() > 0) { |
251 | // mText += "<p></p>"; | 251 | // mText += "<p></p>"; |
252 | // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 252 | // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
253 | // mText += "<h2>"; | 253 | // mText += "<h2>"; |
254 | //mText += " <img src=\""; | 254 | //mText += " <img src=\""; |
255 | //mText += ipath; | 255 | //mText += ipath; |
256 | //mText += "\">"; | 256 | //mText += "\">"; |
257 | if ( ! itemAdded ) { | 257 | if ( ! itemAdded ) { |
258 | appendDay ( iii, mEventDate ); | 258 | appendDay ( iii, mEventDate ); |
259 | 259 | ||
260 | } | 260 | } |
261 | // for first day (iii == 0) | 261 | // for first day (iii == 0) |
262 | // we may have syncevents, or events in the past, which maybe should not be diaplayed | 262 | // we may have syncevents, or events in the past, which maybe should not be diaplayed |
263 | // for that reason we cannot append <table> in appendDay () for iii == 0 | 263 | // for that reason we cannot append <table> in appendDay () for iii == 0 |
264 | // we must append it in the first successful call of appendEvent() | 264 | // we must append it in the first successful call of appendEvent() |
265 | Event *ev = events.first(); | 265 | Event *ev = events.first(); |
266 | while(ev) { | 266 | while(ev) { |
267 | //qDebug("+++++event append %s", ev->summary().latin1()); | 267 | //qDebug("+++++event append %s", ev->summary().latin1()); |
268 | if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { | 268 | if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { |
269 | if ( appendEvent(ev, false , iii!= 0,!itemAdded ) ) | 269 | if ( appendEvent(ev, false , iii!= 0,!itemAdded ) ) |
270 | itemAdded = true; | 270 | itemAdded = true; |
271 | } | 271 | } |
272 | ev = events.next(); | 272 | ev = events.next(); |
273 | } | 273 | } |
274 | 274 | ||
275 | //mText += "</table>\n"; | 275 | //mText += "</table>\n"; |
276 | } | 276 | } |
277 | 277 | ||
278 | todo = todos.first(); | 278 | todo = todos.first(); |
279 | while(todo) { | 279 | while(todo) { |
280 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) { | 280 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) { |
281 | if ( ! itemAdded ) { | 281 | if ( ! itemAdded ) { |
282 | appendDay ( iii, mEventDate ); | 282 | appendDay ( iii, mEventDate ); |
283 | //itemAdded = true; | 283 | //itemAdded = true; |
284 | } | 284 | } |
285 | appendEvent(todo, false , iii!= 0,!itemAdded); | 285 | appendEvent(todo, false , iii!= 0,!itemAdded); |
286 | itemAdded = true; | 286 | itemAdded = true; |
287 | } | 287 | } |
288 | todo = todos.next(); | 288 | todo = todos.next(); |
289 | } | 289 | } |
290 | if ( !itemAdded && iii == 0 ) { | 290 | if ( !itemAdded && iii == 0 ) { |
291 | // appendDay ( iii, mEventDate ); | 291 | // appendDay ( iii, mEventDate ); |
292 | //mText += "<table>"; | 292 | //mText += "<table>"; |
293 | // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n"; | 293 | // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n"; |
294 | mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do.") +"</em></font></h3>\n"; | 294 | mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do.") +"</em></font></h3>\n"; |
295 | //mText +="</table>"; | 295 | //mText +="</table>"; |
296 | } | 296 | } |
297 | if ( itemAdded ) | 297 | if ( itemAdded ) |
298 | mText += "</table>\n"; | 298 | mText += "</table>\n"; |
299 | mEventDate = mEventDate.addDays( 1 ); | 299 | mEventDate = mEventDate.addDays( 1 ); |
300 | } | 300 | } |
301 | 301 | ||
302 | int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; | 302 | int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; |
303 | if (todos.count() > 0 && topmostPrios > 0 ) { | 303 | if (todos.count() > 0 && topmostPrios > 0 ) { |
304 | // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 304 | // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
305 | // mText += "<h2>"; | 305 | // mText += "<h2>"; |
306 | //<img src=\""; | 306 | //<img src=\""; |
307 | // mText += ipath; | 307 | // mText += ipath; |
308 | // mText += "\">"; | 308 | // mText += "\">"; |
309 | // mText += i18n("Overdue To-Do:") + "</h2>\n"; | 309 | // mText += i18n("Overdue To-Do:") + "</h2>\n"; |
310 | 310 | ||
311 | //mText += "<ul>\n"; | 311 | //mText += "<ul>\n"; |
312 | bool gotone = false; | 312 | bool gotone = false; |
313 | int priority = 1; | 313 | int priority = 1; |
314 | int priosFound = 0; | 314 | int priosFound = 0; |
315 | #ifdef DESKTOP_VERSION | 315 | #ifdef DESKTOP_VERSION |
316 | mText +="<p></p>"; | 316 | mText +="<p></p>"; |
317 | #endif | 317 | #endif |
318 | 318 | ||
319 | mText +="<h2><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></h2>\n"; | 319 | mText +="<h2><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></h2>\n"; |
320 | mText += "<ul>\n"; | 320 | mText += "<ul>\n"; |
321 | while (!gotone && priority<6) { | 321 | while (!gotone && priority<6) { |
322 | todo = todos.first(); | 322 | todo = todos.first(); |
323 | while(todo) { | 323 | while(todo) { |
324 | if (!todo->isCompleted() && (todo->priority() == priority) ) { | 324 | if (!todo->isCompleted() && (todo->priority() == priority) ) { |
325 | mCurrentMaxPrio = priority - priosFound + topmostPrios -1; | 325 | mCurrentMaxPrio = priority - priosFound + topmostPrios -1; |
326 | if ( appendTodo(todo) ) | 326 | if ( appendTodo(todo) ) |
327 | gotone = true; | 327 | gotone = true; |
328 | } | 328 | } |
329 | todo = todos.next(); | 329 | todo = todos.next(); |
330 | } | 330 | } |
331 | if ( gotone ) { | 331 | if ( gotone ) { |
332 | gotone = false; | 332 | gotone = false; |
333 | ++priosFound; | 333 | ++priosFound; |
334 | if ( priosFound == topmostPrios ) | 334 | if ( priosFound == topmostPrios ) |
335 | break; | 335 | break; |
336 | } | 336 | } |
337 | priority++; | 337 | priority++; |
338 | // kdDebug() << "adding the todos..." << endl; | 338 | // kdDebug() << "adding the todos..." << endl; |
339 | } | 339 | } |
340 | mText += "</ul>\n"; | 340 | mText += "</ul>\n"; |
341 | } | 341 | } |
342 | 342 | ||
343 | int replys = 0; | 343 | int replys = 0; |
344 | events = calendar()->events(QDate::currentDate(), QDate(2975,12,6)); | 344 | events = calendar()->events(QDate::currentDate(), QDate(2975,12,6)); |
345 | if (events.count() > 0) { | 345 | if (events.count() > 0) { |
346 | Event *ev = events.first(); | 346 | Event *ev = events.first(); |
347 | while(ev) { | 347 | while(ev) { |
348 | Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 348 | Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
349 | if (me!=0) { | 349 | if (me!=0) { |
350 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { | 350 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { |
351 | if (replys == 0) { | 351 | if (replys == 0) { |
352 | mText += "<p></p>"; | 352 | mText += "<p></p>"; |
353 | // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 353 | // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
354 | //mText += "<h2>"; | 354 | //mText += "<h2>"; |
355 | //<img src=\""; | 355 | //<img src=\""; |
356 | // mText += ipath; | 356 | // mText += ipath; |
357 | // mText += "\">"; | 357 | // mText += "\">"; |
358 | //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n"; | 358 | //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n"; |
359 | mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n"; | 359 | mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n"; |
360 | mText += "<table>\n"; | 360 | mText += "<table>\n"; |
361 | } | 361 | } |
362 | replys++; | 362 | replys++; |
363 | appendEvent(ev,true); | 363 | appendEvent(ev,true); |
364 | } | 364 | } |
365 | } | 365 | } |
366 | ev = events.next(); | 366 | ev = events.next(); |
367 | } | 367 | } |
368 | } | 368 | } |
369 | todos = calendar()->todos(); | 369 | todos = calendar()->todos(); |
370 | if (todos.count() > 0) { | 370 | if (todos.count() > 0) { |
371 | Todo *to = todos.first(); | 371 | Todo *to = todos.first(); |
372 | while(to) { | 372 | while(to) { |
373 | if ( !to->isCompleted() ){ | 373 | if ( !to->isCompleted() ){ |
374 | Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 374 | Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
375 | if (me!=0) { | 375 | if (me!=0) { |
376 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { | 376 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { |
377 | if (replys == 0) { | 377 | if (replys == 0) { |
378 | mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n"; | 378 | mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n"; |
379 | mText += "<table>\n"; | 379 | mText += "<table>\n"; |
380 | } | 380 | } |
381 | replys++; | 381 | replys++; |
382 | appendEvent(to, true); | 382 | appendEvent(to, true); |
383 | } | 383 | } |
384 | } | 384 | } |
385 | } | 385 | } |
386 | to = todos.next(); | 386 | to = todos.next(); |
387 | } | 387 | } |
388 | } | 388 | } |
389 | if (replys > 0 ) mText += "</table>\n"; | 389 | if (replys > 0 ) mText += "</table>\n"; |
390 | 390 | ||
391 | 391 | ||
392 | mText += "</td></tr>\n</table>\n"; | 392 | mText += "</td></tr>\n</table>\n"; |
393 | 393 | ||
394 | mView->setText(mText); | 394 | mView->setText(mText); |
395 | mView->setFocus(); | 395 | mView->setFocus(); |
396 | 396 | ||
397 | // QPixmap bPix = SmallIcon( "back" ); | 397 | // QPixmap bPix = SmallIcon( "back" ); |
398 | // qDebug("xxxxxxxxxxxxxxxxxxxxx "); | 398 | // qDebug("xxxxxxxxxxxxxxxxxxxxx "); |
399 | // QWidget* test = new QWidget(); | 399 | // QWidget* test = new QWidget(); |
400 | // test->setBackgroundMode(FixedPixmap ); | 400 | // test->setBackgroundMode(FixedPixmap ); |
401 | // test->setBackgroundPixmap ( bPix ); | 401 | // test->setBackgroundPixmap ( bPix ); |
402 | // test->resize( 300, 400 ); | 402 | // test->resize( 300, 400 ); |
403 | // test->show(); | 403 | // test->show(); |
404 | // mView->setBackgroundMode(FixedPixmap ); | 404 | // mView->setBackgroundMode(FixedPixmap ); |
405 | // mView->setBackgroundPixmap ( bPix ); | 405 | // mView->setBackgroundPixmap ( bPix ); |
406 | // qDebug("%s ",mText.latin1()); | 406 | // qDebug("%s ",mText.latin1()); |
407 | } | 407 | } |
408 | 408 | ||
409 | void KOWhatsNextView::appendDay( int i, QDate eventDate ) | 409 | void KOWhatsNextView::appendDay( int i, QDate eventDate ) |
410 | { | 410 | { |
411 | QString date; | 411 | QString date; |
412 | QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); | 412 | QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); |
413 | if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { | 413 | if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { |
414 | if ( i == 0 ) { | 414 | if ( i == 0 ) { |
415 | //mText += "<table>\n"; | 415 | //mText += "<table>\n"; |
416 | return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; | 416 | return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; |
417 | } | 417 | } |
418 | else if ( i == 1 ) | 418 | else if ( i == 1 ) |
419 | date = "<em><font color=\"#000080\">" + day + "</font></em>" ; | 419 | date = "<em><font color=\"#000080\">" + day + "</font></em>" ; |
420 | else date = "<em><font color=\"#000080\">" + day + "</font></em>"; | 420 | else date = "<em><font color=\"#000080\">" + day + "</font></em>"; |
421 | mText += "<h2>" + date + "</h2>\n"; | 421 | mText += "<h2>" + date + "</h2>\n"; |
422 | //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; | 422 | //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; |
423 | mText += "<table>\n"; | 423 | mText += "<table>\n"; |
424 | 424 | ||
425 | 425 | ||
426 | 426 | ||
427 | } else { | 427 | } else { |
428 | if ( i == 0 ) { | 428 | if ( i == 0 ) { |
429 | //mText += "<table>\n"; | 429 | //mText += "<table>\n"; |
430 | return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; | 430 | return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; |
431 | } | 431 | } |
432 | 432 | ||
433 | #ifdef DESKTOP_VERSION | 433 | #ifdef DESKTOP_VERSION |
434 | else if ( i == 1 ) { | 434 | else if ( i == 1 ) { |
435 | date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; | 435 | date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; |
436 | } | 436 | } |
437 | else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>"; | 437 | else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>"; |
438 | #else | 438 | #else |
439 | else if ( i == 1 ) { | 439 | else if ( i == 1 ) { |
440 | date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; | 440 | date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; |
441 | } | 441 | } |
442 | else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>"; | 442 | else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>"; |
443 | 443 | ||
444 | #endif | 444 | #endif |
445 | mText += "<h2>" + date + "</h2>\n"; | 445 | mText += "<h2>" + date + "</h2>\n"; |
446 | //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; | 446 | //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; |
447 | mText += "<table>\n"; | 447 | mText += "<table>\n"; |
448 | } | 448 | } |
449 | } | 449 | } |
450 | 450 | ||
451 | 451 | ||
452 | void KOWhatsNextView::showDates(const QDate &, const QDate &) | 452 | void KOWhatsNextView::showDates(const QDate &, const QDate &) |
453 | { | 453 | { |
454 | updateView(); | 454 | updateView(); |
455 | } | 455 | } |
456 | 456 | ||
457 | void KOWhatsNextView::showEvents(QPtrList<Event>) | 457 | void KOWhatsNextView::showEvents(QPtrList<Event>) |
458 | { | 458 | { |
459 | } | 459 | } |
460 | 460 | ||
461 | void KOWhatsNextView::changeEventDisplay(Event *, int action) | 461 | void KOWhatsNextView::changeEventDisplay(Event *, int action) |
462 | { | 462 | { |
463 | switch(action) { | 463 | switch(action) { |
464 | case KOGlobals::EVENTADDED: | 464 | case KOGlobals::EVENTADDED: |
465 | updateView(); | 465 | updateView(); |
466 | break; | 466 | break; |
467 | case KOGlobals::EVENTEDITED: | 467 | case KOGlobals::EVENTEDITED: |
468 | updateView(); | 468 | updateView(); |
469 | break; | 469 | break; |
470 | case KOGlobals::EVENTDELETED: | 470 | case KOGlobals::EVENTDELETED: |
471 | updateView(); | 471 | updateView(); |
472 | break; | 472 | break; |
473 | default: | 473 | default: |
474 | updateView(); | 474 | updateView(); |
475 | kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; | 475 | kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; |
476 | } | 476 | } |
477 | } | 477 | } |
478 | 478 | ||
479 | bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable ) | 479 | bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable ) |
480 | { | 480 | { |
481 | if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) | 481 | if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) |
482 | return false; | 482 | return false; |
483 | QDateTime cdt = QDateTime::currentDateTime(); | 483 | QDateTime cdt = QDateTime::currentDateTime(); |
484 | QDateTime noc; | 484 | QDateTime noc; |
485 | QString tempText; | 485 | QString tempText; |
486 | if ( appendTable && !notRed ) { | 486 | if ( appendTable && !notRed ) { |
487 | tempText = "<table>"; | 487 | tempText = "<table>"; |
488 | } | 488 | } |
489 | bool ok = true; | 489 | bool ok = true; |
490 | if ( reply ) { | 490 | if ( reply ) { |
491 | noc = ev->getNextOccurence( cdt, &ok ); | 491 | noc = ev->getNextOccurence( cdt, &ok ); |
492 | if (! ok && ev->typeID() == eventID) | 492 | if (! ok && ev->typeID() == eventID) |
493 | return false; | 493 | return false; |
494 | } | 494 | } |
495 | bool bDay = false; | 495 | bool bDay = false; |
496 | if ( ev->isBirthday() || ev->isAnniversary() ) | 496 | if ( ev->isBirthday() || ev->isAnniversary() ) |
497 | bDay = true; | 497 | bDay = true; |
498 | tempText += "<tr><td><b>"; | 498 | tempText += "<tr><td><b>"; |
499 | if (ev->typeID() == eventID ) { | 499 | if (ev->typeID() == eventID ) { |
500 | if (reply) { | 500 | if (reply) { |
501 | if (!ev->doesFloat()) | 501 | if (!ev->doesFloat()) |
502 | tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; | 502 | tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; |
503 | else | 503 | else |
504 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 504 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
505 | 505 | ||
506 | } else { | 506 | } else { |
507 | if (!ev->doesFloat()) { | 507 | if (!ev->doesFloat()) { |
508 | Event *event = static_cast<Event *>(ev); | 508 | Event *event = static_cast<Event *>(ev); |
509 | QDateTime st,end; | 509 | QDateTime st,end; |
510 | if ( event->recurrence()->doesRecur() ) { | 510 | if ( event->recurrence()->doesRecur() ) { |
511 | QDate recDate= mEventDate; | 511 | QDate recDate= mEventDate; |
512 | int days = event->dtStart().date().daysTo (event->dtEnd().date() ); | 512 | int days = event->dtStart().date().daysTo (event->dtEnd().date() ); |
513 | while ( ! event->recursOn( recDate ) ) { | 513 | while ( ! event->recursOn( recDate ) ) { |
514 | recDate = recDate.addDays( -1 ); | 514 | recDate = recDate.addDays( -1 ); |
515 | 515 | ||
516 | } | 516 | } |
517 | st = QDateTime ( recDate, event->dtStart().time() ); | 517 | st = QDateTime ( recDate, event->dtStart().time() ); |
518 | end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); | 518 | end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); |
519 | } | 519 | } |
520 | else { | 520 | else { |
521 | st = event->dtStart(); | 521 | st = event->dtStart(); |
522 | end = event->dtEnd(); | 522 | end = event->dtEnd(); |
523 | } | 523 | } |
524 | 524 | ||
525 | 525 | ||
526 | QString dateText; | 526 | QString dateText; |
527 | // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); | 527 | // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); |
528 | if ( st.date() < mEventDate ) | 528 | if ( st.date() < mEventDate ) |
529 | dateText = "++:++-"; | 529 | dateText = "++:++-"; |
530 | else | 530 | else |
531 | dateText = event->dtStartTimeStr() + "-"; | 531 | dateText = event->dtStartTimeStr() + "-"; |
532 | if ( end.date() > mEventDate ) | 532 | if ( end.date() > mEventDate ) |
533 | dateText += "++:++"; | 533 | dateText += "++:++"; |
534 | else | 534 | else |
535 | dateText += event->dtEndTimeStr(); | 535 | dateText += event->dtEndTimeStr(); |
536 | if ( notRed ) | 536 | if ( notRed ) |
537 | tempText += dateText; | 537 | tempText += dateText; |
538 | else { | 538 | else { |
539 | if ( end < cdt ) { | 539 | if ( end < cdt ) { |
540 | if ( !KOPrefs::instance()->mWNViewShowsPast ) | 540 | if ( !KOPrefs::instance()->mWNViewShowsPast ) |
541 | return false; | 541 | return false; |
542 | tempText += "<font color=\"#F00000\">" + dateText + "</font>"; | 542 | tempText += "<font color=\"#F00000\">" + dateText + "</font>"; |
543 | } | 543 | } |
544 | else if ( st < cdt ) | 544 | else if ( st < cdt ) |
545 | tempText += "<font color=\"#008000\">" + dateText + "</font>"; | 545 | tempText += "<font color=\"#008000\">" + dateText + "</font>"; |
546 | else | 546 | else |
547 | tempText += dateText; | 547 | tempText += dateText; |
548 | 548 | ||
549 | } | 549 | } |
550 | 550 | ||
551 | } else { | 551 | } else { |
552 | if ( bDay ) { | 552 | if ( bDay ) { |
553 | 553 | ||
554 | if ( ev->isBirthday()) | 554 | if ( ev->isBirthday()) |
555 | tempText += "<font color=\"#00B000\">" + i18n("Birthday") +":</font>"; | 555 | tempText += "<font color=\"#00B000\">" + i18n("Birthday") +":</font>"; |
556 | else | 556 | else |
557 | tempText += "<font color=\"#00B0000\">" + i18n("Anniversary")+":</font>"; | 557 | tempText += "<font color=\"#00B0000\">" + i18n("Anniversary")+":</font>"; |
558 | } else { | 558 | } else { |
559 | tempText += i18n("Allday:"); | 559 | tempText += i18n("Allday:"); |
560 | } | 560 | } |
561 | 561 | ||
562 | } | 562 | } |
563 | } | 563 | } |
564 | } else { | 564 | } else { |
565 | mTodos.append( ev ); | 565 | mTodos.append( ev ); |
566 | tempText += i18n("ToDo:"); | 566 | tempText += i18n("ToDo:"); |
567 | if (reply) { | 567 | if (reply) { |
568 | tempText += " "; | 568 | tempText += " "; |
569 | if ( noc != cdt ) { | 569 | if ( noc != cdt ) { |
570 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 570 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
571 | } | 571 | } |
572 | } else { | 572 | } else { |
573 | if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { | 573 | if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { |
574 | // tempText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 574 | // tempText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
575 | QString dfs = KGlobal::locale()->dateFormatShort(); | 575 | QString dfs = KGlobal::locale()->dateFormatShort(); |
576 | KGlobal::locale()->setDateFormatShort("%d.%b"); | 576 | KGlobal::locale()->setDateFormatShort("%d.%b"); |
577 | tempText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; | 577 | tempText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; |
578 | KGlobal::locale()->setDateFormatShort(dfs); | 578 | KGlobal::locale()->setDateFormatShort(dfs); |
579 | } else { | 579 | } else { |
580 | if (!ev->doesFloat() ) | 580 | if (!ev->doesFloat() ) |
581 | if( ( (Todo*)ev)->dtDue() < cdt ) { | 581 | if( ( (Todo*)ev)->dtDue() < cdt ) { |
582 | tempText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; | 582 | tempText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; |
583 | 583 | ||
584 | 584 | ||
585 | } else | 585 | } else |
586 | tempText +=((Todo*)ev)->dtDueTimeStr(); | 586 | tempText +=((Todo*)ev)->dtDueTimeStr(); |
587 | mTodos.append( ev ); | 587 | mTodos.append( ev ); |
588 | } | 588 | } |
589 | } | 589 | } |
590 | } | 590 | } |
591 | tempText += "</b></td><td>"; | 591 | tempText += "</b></td><td>"; |
592 | bool needClose = false; | 592 | bool needClose = false; |
593 | if ( ev->cancelled() ) { | 593 | if ( ev->cancelled() ) { |
594 | tempText += "<font color=\"#F00000\">[c"; | 594 | tempText += "<font color=\"#F00000\">[c"; |
595 | needClose =true; | 595 | needClose =true; |
596 | 596 | ||
597 | } | 597 | } |
598 | if ( ev->isAlarmEnabled() ) { | 598 | if ( ev->isAlarmEnabled() && ev->alarmEnabled()) { |
599 | if ( !needClose) | 599 | if ( !needClose) |
600 | tempText +="["; | 600 | tempText +="["; |
601 | tempText += "a"; | 601 | tempText += "a"; |
602 | needClose =true; | 602 | needClose =true; |
603 | 603 | ||
604 | } | 604 | } |
605 | if ( ev->description().length() > 0 ) { | 605 | if ( ev->description().length() > 0 ) { |
606 | if ( !needClose) | 606 | if ( !needClose) |
607 | tempText +="["; | 607 | tempText +="["; |
608 | tempText += "i"; | 608 | tempText += "i"; |
609 | needClose =true; | 609 | needClose =true; |
610 | } | 610 | } |
611 | if ( ev->recurrence()->doesRecur() ) { | 611 | if ( ev->recurrence()->doesRecur() ) { |
612 | if ( !needClose) | 612 | if ( !needClose) |
613 | tempText +="["; | 613 | tempText +="["; |
614 | tempText += "r"; | 614 | tempText += "r"; |
615 | needClose =true; | 615 | needClose =true; |
616 | } | 616 | } |
617 | if ( needClose ) { | 617 | if ( needClose ) { |
618 | tempText += "] "; | 618 | tempText += "] "; |
619 | } | 619 | } |
620 | if ( ev->cancelled() ) | 620 | if ( ev->cancelled() ) |
621 | tempText += "</font>"; | 621 | tempText += "</font>"; |
622 | tempText += "<a "; | 622 | tempText += "<a "; |
623 | if (ev->typeID() == eventID ) tempText += "href=\"event:"; | 623 | if (ev->typeID() == eventID ) tempText += "href=\"event:"; |
624 | if (ev->typeID() == todoID ) tempText += "href=\"todo:"; | 624 | if (ev->typeID() == todoID ) tempText += "href=\"todo:"; |
625 | tempText += ev->uid() + "\">"; | 625 | tempText += ev->uid() + "\">"; |
626 | if ( ev->summary().length() > 0 ) | 626 | if ( ev->summary().length() > 0 ) |
627 | tempText += ev->summary(); | 627 | tempText += ev->summary(); |
628 | else | 628 | else |
629 | tempText += i18n("-no summary-"); | 629 | tempText += i18n("-no summary-"); |
630 | if ( bDay ) { | 630 | if ( bDay ) { |
631 | noc = ev->getNextOccurence( cdt.addDays(-1), &ok ); | 631 | noc = ev->getNextOccurence( cdt.addDays(-1), &ok ); |
632 | if ( ok ) { | 632 | if ( ok ) { |
633 | int years = 0; | 633 | int years = 0; |
634 | if ( ev->typeID() == todoID ) { | 634 | if ( ev->typeID() == todoID ) { |
635 | years = noc.date().year() -((Todo*)ev)->dtDue().date().year(); | 635 | years = noc.date().year() -((Todo*)ev)->dtDue().date().year(); |
636 | } else | 636 | } else |
637 | years = noc.date().year() - ev->dtStart().date().year(); | 637 | years = noc.date().year() - ev->dtStart().date().year(); |
638 | tempText += i18n(" (%1 y.)"). arg( years ); | 638 | tempText += i18n(" (%1 y.)"). arg( years ); |
639 | } | 639 | } |
640 | } | 640 | } |
641 | 641 | ||
642 | tempText += "</a>"; | 642 | tempText += "</a>"; |
643 | if ( KOPrefs::instance()->mWNViewShowLocation ) | 643 | if ( KOPrefs::instance()->mWNViewShowLocation ) |
644 | if ( !ev->location().isEmpty() ) | 644 | if ( !ev->location().isEmpty() ) |
645 | tempText += " ("+ev->location() +")"; | 645 | tempText += " ("+ev->location() +")"; |
646 | if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) | 646 | if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) |
647 | tempText += " ["+ev->relatedTo()->summary() +"]"; | 647 | tempText += " ["+ev->relatedTo()->summary() +"]"; |
648 | tempText += "</td></tr>\n"; | 648 | tempText += "</td></tr>\n"; |
649 | mText += tempText; | 649 | mText += tempText; |
650 | return true; | 650 | return true; |
651 | } | 651 | } |
652 | 652 | ||
653 | bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) | 653 | bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) |
654 | { | 654 | { |
655 | if ( mTodos.find( ev ) != mTodos.end() ) return false; | 655 | if ( mTodos.find( ev ) != mTodos.end() ) return false; |
656 | 656 | ||
657 | mTodos.append( ev ); | 657 | mTodos.append( ev ); |
658 | if ( !isSub ) | 658 | if ( !isSub ) |
659 | mText += "<p>"; | 659 | mText += "<p>"; |
660 | else | 660 | else |
661 | mText += "<li>"; | 661 | mText += "<li>"; |
662 | mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; | 662 | mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; |
663 | 663 | ||
664 | 664 | ||
665 | mText += ind; | 665 | mText += ind; |
666 | bool needClose = false; | 666 | bool needClose = false; |
667 | if ( ev->cancelled() ) { | 667 | if ( ev->cancelled() ) { |
668 | mText += "<font color=\"#F00000\">[c"; | 668 | mText += "<font color=\"#F00000\">[c"; |
669 | needClose =true; | 669 | needClose =true; |
670 | 670 | ||
671 | } | 671 | } |
672 | if ( ev->isAlarmEnabled() ) { | 672 | if ( ev->isAlarmEnabled() && ev->alarmEnabled() ) { |
673 | if ( !needClose) | 673 | if ( !needClose) |
674 | mText +="["; | 674 | mText +="["; |
675 | mText += "a"; | 675 | mText += "a"; |
676 | needClose =true; | 676 | needClose =true; |
677 | 677 | ||
678 | } | 678 | } |
679 | 679 | ||
680 | if ( ev->description().length() > 0 ) { | 680 | if ( ev->description().length() > 0 ) { |
681 | if ( !needClose) | 681 | if ( !needClose) |
682 | mText +="["; | 682 | mText +="["; |
683 | mText += "i"; | 683 | mText += "i"; |
684 | needClose =true; | 684 | needClose =true; |
685 | } | 685 | } |
686 | if ( ev->doesRecur() ) { | 686 | if ( ev->doesRecur() ) { |
687 | if ( !needClose) | 687 | if ( !needClose) |
688 | mText +="["; | 688 | mText +="["; |
689 | mText += "r"; | 689 | mText += "r"; |
690 | needClose =true; | 690 | needClose =true; |
691 | } | 691 | } |
692 | // if ( ev->recurrence()->doesRecur() ) { | 692 | // if ( ev->recurrence()->doesRecur() ) { |
693 | // if ( !needClose) | 693 | // if ( !needClose) |
694 | // mText +="("; | 694 | // mText +="("; |
695 | // mText += "r"; | 695 | // mText += "r"; |
696 | // needClose =true; | 696 | // needClose =true; |
697 | // } | 697 | // } |
698 | if ( needClose ) | 698 | if ( needClose ) |
699 | mText += "] "; | 699 | mText += "] "; |
700 | if ( ev->cancelled() ) | 700 | if ( ev->cancelled() ) |
701 | mText += "</font>"; | 701 | mText += "</font>"; |
702 | mText += "<a href=\"todo:" + ev->uid() + "\">"; | 702 | mText += "<a href=\"todo:" + ev->uid() + "\">"; |
703 | if ( ev->summary().length() > 0 ) | 703 | if ( ev->summary().length() > 0 ) |
704 | mText += ev->summary(); | 704 | mText += ev->summary(); |
705 | else | 705 | else |
706 | mText += i18n("-no summary-"); | 706 | mText += i18n("-no summary-"); |
707 | mText += "</a>"; | 707 | mText += "</a>"; |
708 | if ( ((Todo*)ev)->hasDueDate () ) { | 708 | if ( ((Todo*)ev)->hasDueDate () ) { |
709 | QString year = ""; | 709 | QString year = ""; |
710 | int ye = ((Todo*)ev)->dtDue().date().year(); | 710 | int ye = ((Todo*)ev)->dtDue().date().year(); |
711 | if ( QDateTime::currentDateTime().date().year() != ye ) | 711 | if ( QDateTime::currentDateTime().date().year() != ye ) |
712 | year = QString::number( ye ); | 712 | year = QString::number( ye ); |
713 | QString dfs = KGlobal::locale()->dateFormatShort(); | 713 | QString dfs = KGlobal::locale()->dateFormatShort(); |
714 | KGlobal::locale()->setDateFormatShort("%d.%b"); | 714 | KGlobal::locale()->setDateFormatShort("%d.%b"); |
715 | mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>"; | 715 | mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>"; |
716 | KGlobal::locale()->setDateFormatShort(dfs); | 716 | KGlobal::locale()->setDateFormatShort(dfs); |
717 | } | 717 | } |
718 | if ( KOPrefs::instance()->mWNViewShowLocation ) | 718 | if ( KOPrefs::instance()->mWNViewShowLocation ) |
719 | if ( !ev->location().isEmpty() ) | 719 | if ( !ev->location().isEmpty() ) |
720 | mText += " ("+ev->location() +")"; | 720 | mText += " ("+ev->location() +")"; |
721 | if ( !isSub ) { | 721 | if ( !isSub ) { |
722 | if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) | 722 | if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) |
723 | mText += " ["+ev->relatedTo()->summary() +"]"; | 723 | mText += " ["+ev->relatedTo()->summary() +"]"; |
724 | mText += "</p>\n"; | 724 | mText += "</p>\n"; |
725 | } | 725 | } |
726 | else { | 726 | else { |
727 | ind += "-"; | 727 | ind += "-"; |
728 | mText += "</li>\n"; | 728 | mText += "</li>\n"; |
729 | } | 729 | } |
730 | QPtrList<Incidence> Relations = ev->relations(); | 730 | QPtrList<Incidence> Relations = ev->relations(); |
731 | Incidence *to; | 731 | Incidence *to; |
732 | for (to=Relations.first();to;to=Relations.next()) { | 732 | for (to=Relations.first();to;to=Relations.next()) { |
733 | if (!((Todo*)to)->isCompleted() && ((Todo*)to)->priority() <= mCurrentMaxPrio ) | 733 | if (!((Todo*)to)->isCompleted() && ((Todo*)to)->priority() <= mCurrentMaxPrio ) |
734 | appendTodo( to, ind , true ); | 734 | appendTodo( to, ind , true ); |
735 | } | 735 | } |
736 | 736 | ||
737 | return true; | 737 | return true; |
738 | } | 738 | } |
739 | 739 | ||
740 | /* | 740 | /* |
741 | void KOWhatsNextView::createEventViewer() | 741 | void KOWhatsNextView::createEventViewer() |
742 | { | 742 | { |
743 | if (!mEventViewer) { | 743 | if (!mEventViewer) { |
744 | 744 | ||
745 | mEventViewer = new KOEventViewerDialog(this); | 745 | mEventViewer = new KOEventViewerDialog(this); |
746 | } | 746 | } |
747 | } | 747 | } |
748 | */ | 748 | */ |
749 | void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) | 749 | void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) |
750 | { | 750 | { |
751 | mEventViewer = v; | 751 | mEventViewer = v; |
752 | } | 752 | } |
753 | 753 | ||
754 | // TODO: Create this function in CalendarView and remove it from here | 754 | // TODO: Create this function in CalendarView and remove it from here |
755 | void KOWhatsNextView::showIncidence(const QString &uid) | 755 | void KOWhatsNextView::showIncidence(const QString &uid) |
756 | { | 756 | { |
757 | 757 | ||
758 | if ( !mEventViewer ) { | 758 | if ( !mEventViewer ) { |
759 | qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set "); | 759 | qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set "); |
760 | return; | 760 | return; |
761 | } | 761 | } |
762 | //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl; | 762 | //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl; |
763 | //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1()); | 763 | //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1()); |
764 | if (uid.startsWith("event:")) { | 764 | if (uid.startsWith("event:")) { |
765 | #ifdef DESKTOP_VERSION | 765 | #ifdef DESKTOP_VERSION |
766 | Event *event = calendar()->event(uid.mid(8)); | 766 | Event *event = calendar()->event(uid.mid(8)); |
767 | #else | 767 | #else |
768 | Event *event = calendar()->event(uid.mid(6)); | 768 | Event *event = calendar()->event(uid.mid(6)); |
769 | #endif | 769 | #endif |
770 | //qDebug("event %d uid %s ", event, uid.mid(6).latin1()); | 770 | //qDebug("event %d uid %s ", event, uid.mid(6).latin1()); |
771 | if (!event) return; | 771 | if (!event) return; |
772 | //createEventViewer(); | 772 | //createEventViewer(); |
773 | mEventViewer->setEvent(event); | 773 | mEventViewer->setEvent(event); |
774 | } else if (uid.startsWith("todo:")) { | 774 | } else if (uid.startsWith("todo:")) { |
775 | #ifdef DESKTOP_VERSION | 775 | #ifdef DESKTOP_VERSION |
776 | Todo *todo = calendar()->todo(uid.mid(7)); | 776 | Todo *todo = calendar()->todo(uid.mid(7)); |
777 | #else | 777 | #else |
778 | Todo *todo = calendar()->todo(uid.mid(5)); | 778 | Todo *todo = calendar()->todo(uid.mid(5)); |
779 | #endif | 779 | #endif |
780 | if (!todo) return; | 780 | if (!todo) return; |
781 | //createEventViewer(); | 781 | //createEventViewer(); |
782 | mEventViewer->setTodo(todo); | 782 | mEventViewer->setTodo(todo); |
783 | } else { | 783 | } else { |
784 | return; | 784 | return; |
785 | 785 | ||
786 | } | 786 | } |
787 | mEventViewer->showMe(); | 787 | mEventViewer->showMe(); |
788 | mEventViewer->raise(); | 788 | mEventViewer->raise(); |
789 | } | 789 | } |
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp index 0afa0a7..79e0464 100644 --- a/libkcal/alarm.cpp +++ b/libkcal/alarm.cpp | |||
@@ -1,481 +1,483 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 1998 Preston Brown | 3 | Copyright (c) 1998 Preston Brown |
4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <kdebug.h> | 22 | #include <kdebug.h> |
23 | #include <klocale.h> | 23 | #include <klocale.h> |
24 | 24 | ||
25 | #include "incidence.h" | 25 | #include "incidence.h" |
26 | #include "todo.h" | 26 | #include "todo.h" |
27 | 27 | ||
28 | #include "alarm.h" | 28 | #include "alarm.h" |
29 | 29 | ||
30 | using namespace KCal; | 30 | using namespace KCal; |
31 | #include <qwidget.h> | 31 | #include <qwidget.h> |
32 | Alarm::Alarm(Incidence *parent) | 32 | Alarm::Alarm(Incidence *parent) |
33 | : mParent(parent), | 33 | : mParent(parent), |
34 | mType(Audio), | 34 | mType(Audio), |
35 | mDescription(""), // to make operator==() not fail | 35 | mDescription(""), // to make operator==() not fail |
36 | mFile(""), // to make operator==() not fail | 36 | mFile(""), // to make operator==() not fail |
37 | mMailSubject(""), // to make operator==() not fail | 37 | mMailSubject(""), // to make operator==() not fail |
38 | mAlarmSnoozeTime(5), | 38 | mAlarmSnoozeTime(5), |
39 | mAlarmRepeatCount(0), | 39 | mAlarmRepeatCount(0), |
40 | mEndOffset(false), | 40 | mEndOffset(false), |
41 | mHasTime(false), | 41 | mHasTime(false), |
42 | mAlarmEnabled(false) | 42 | mAlarmEnabled(false) |
43 | { | 43 | { |
44 | 44 | ||
45 | } | 45 | } |
46 | 46 | ||
47 | Alarm::~Alarm() | 47 | Alarm::~Alarm() |
48 | { | 48 | { |
49 | } | 49 | } |
50 | 50 | ||
51 | bool Alarm::operator==( const Alarm& rhs ) const | 51 | bool Alarm::operator==( const Alarm& rhs ) const |
52 | { | 52 | { |
53 | 53 | ||
54 | if ( mType != rhs.mType || | 54 | if ( mType != rhs.mType || |
55 | mAlarmSnoozeTime != rhs.mAlarmSnoozeTime || | 55 | mAlarmSnoozeTime != rhs.mAlarmSnoozeTime || |
56 | mAlarmRepeatCount != rhs.mAlarmRepeatCount || | 56 | mAlarmRepeatCount != rhs.mAlarmRepeatCount || |
57 | mAlarmEnabled != rhs.mAlarmEnabled || | 57 | mAlarmEnabled != rhs.mAlarmEnabled || |
58 | mHasTime != rhs.mHasTime) | 58 | mHasTime != rhs.mHasTime) |
59 | return false; | 59 | return false; |
60 | 60 | ||
61 | #if 0 | 61 | #if 0 |
62 | if ( mType != rhs.mType ) { | 62 | if ( mType != rhs.mType ) { |
63 | 63 | ||
64 | qDebug("aaa1 "); | 64 | qDebug("aaa1 "); |
65 | return false; | 65 | return false; |
66 | } | 66 | } |
67 | 67 | ||
68 | if ( mAlarmSnoozeTime != rhs.mAlarmSnoozeTime ) { | 68 | if ( mAlarmSnoozeTime != rhs.mAlarmSnoozeTime ) { |
69 | 69 | ||
70 | qDebug("aaa2 "); | 70 | qDebug("aaa2 "); |
71 | return false; | 71 | return false; |
72 | } | 72 | } |
73 | 73 | ||
74 | 74 | ||
75 | if ( mAlarmRepeatCount != rhs.mAlarmRepeatCount ) { | 75 | if ( mAlarmRepeatCount != rhs.mAlarmRepeatCount ) { |
76 | 76 | ||
77 | qDebug("aaa3 "); | 77 | qDebug("aaa3 "); |
78 | return false; | 78 | return false; |
79 | } | 79 | } |
80 | 80 | ||
81 | if ( mAlarmEnabled != rhs.mAlarmEnabled ) { | 81 | if ( mAlarmEnabled != rhs.mAlarmEnabled ) { |
82 | 82 | ||
83 | qDebug("aaa4 "); | 83 | qDebug("aaa4 "); |
84 | return false; | 84 | return false; |
85 | } | 85 | } |
86 | 86 | ||
87 | if ( mHasTime != rhs.mHasTime ) { | 87 | if ( mHasTime != rhs.mHasTime ) { |
88 | 88 | ||
89 | qDebug("aaa5 "); | 89 | qDebug("aaa5 "); |
90 | return false; | 90 | return false; |
91 | } | 91 | } |
92 | #endif | 92 | #endif |
93 | 93 | ||
94 | 94 | ||
95 | if (mHasTime) { | 95 | if (mHasTime) { |
96 | if (mAlarmTime != rhs.mAlarmTime) | 96 | if (mAlarmTime != rhs.mAlarmTime) |
97 | return false; | 97 | return false; |
98 | } else { | 98 | } else { |
99 | if (mOffset != rhs.mOffset || | 99 | if (mOffset != rhs.mOffset || |
100 | mEndOffset != rhs.mEndOffset) | 100 | mEndOffset != rhs.mEndOffset) |
101 | return false; | 101 | return false; |
102 | } | 102 | } |
103 | switch (mType) { | 103 | switch (mType) { |
104 | case Display: | 104 | case Display: |
105 | return mDescription == rhs.mDescription; | 105 | return mDescription == rhs.mDescription; |
106 | 106 | ||
107 | case Email: | 107 | case Email: |
108 | return mDescription == rhs.mDescription && | 108 | return mDescription == rhs.mDescription && |
109 | mMailAttachFiles == rhs.mMailAttachFiles && | 109 | mMailAttachFiles == rhs.mMailAttachFiles && |
110 | mMailAddresses == rhs.mMailAddresses && | 110 | mMailAddresses == rhs.mMailAddresses && |
111 | mMailSubject == rhs.mMailSubject; | 111 | mMailSubject == rhs.mMailSubject; |
112 | 112 | ||
113 | case Procedure: | 113 | case Procedure: |
114 | return mFile == rhs.mFile && | 114 | return mFile == rhs.mFile && |
115 | mDescription == rhs.mDescription; | 115 | mDescription == rhs.mDescription; |
116 | 116 | ||
117 | case Audio: | 117 | case Audio: |
118 | return mFile == rhs.mFile; | 118 | return mFile == rhs.mFile; |
119 | 119 | ||
120 | case Invalid: | 120 | case Invalid: |
121 | break; | 121 | break; |
122 | } | 122 | } |
123 | return false; | 123 | return false; |
124 | } | 124 | } |
125 | 125 | ||
126 | void Alarm::setType(Alarm::Type type) | 126 | void Alarm::setType(Alarm::Type type) |
127 | { | 127 | { |
128 | if (type == mType) | 128 | if (type == mType) |
129 | return; | 129 | return; |
130 | 130 | ||
131 | switch (type) { | 131 | switch (type) { |
132 | case Display: | 132 | case Display: |
133 | mDescription = ""; | 133 | mDescription = ""; |
134 | break; | 134 | break; |
135 | case Procedure: | 135 | case Procedure: |
136 | mFile = mDescription = ""; | 136 | mFile = mDescription = ""; |
137 | break; | 137 | break; |
138 | case Audio: | 138 | case Audio: |
139 | mFile = ""; | 139 | mFile = ""; |
140 | break; | 140 | break; |
141 | case Email: | 141 | case Email: |
142 | mMailSubject = mDescription = ""; | 142 | mMailSubject = mDescription = ""; |
143 | mMailAddresses.clear(); | 143 | mMailAddresses.clear(); |
144 | mMailAttachFiles.clear(); | 144 | mMailAttachFiles.clear(); |
145 | break; | 145 | break; |
146 | case Invalid: | 146 | case Invalid: |
147 | break; | 147 | break; |
148 | default: | 148 | default: |
149 | return; | 149 | return; |
150 | } | 150 | } |
151 | mType = type; | 151 | mType = type; |
152 | mParent->updated(); | 152 | mParent->updated(); |
153 | } | 153 | } |
154 | 154 | ||
155 | Alarm::Type Alarm::type() const | 155 | Alarm::Type Alarm::type() const |
156 | { | 156 | { |
157 | return mType; | 157 | return mType; |
158 | } | 158 | } |
159 | 159 | ||
160 | void Alarm::setAudioAlarm(const QString &audioFile) | 160 | void Alarm::setAudioAlarm(const QString &audioFile) |
161 | { | 161 | { |
162 | mType = Audio; | 162 | mType = Audio; |
163 | mFile = audioFile; | 163 | mFile = audioFile; |
164 | mParent->updated(); | 164 | mParent->updated(); |
165 | } | 165 | } |
166 | 166 | ||
167 | void Alarm::setAudioFile(const QString &audioFile) | 167 | void Alarm::setAudioFile(const QString &audioFile) |
168 | { | 168 | { |
169 | if (mType == Audio) { | 169 | if (mType == Audio) { |
170 | mFile = audioFile; | 170 | mFile = audioFile; |
171 | mParent->updated(); | 171 | mParent->updated(); |
172 | } | 172 | } |
173 | } | 173 | } |
174 | 174 | ||
175 | QString Alarm::audioFile() const | 175 | QString Alarm::audioFile() const |
176 | { | 176 | { |
177 | return (mType == Audio) ? mFile : QString::null; | 177 | return (mType == Audio) ? mFile : QString::null; |
178 | } | 178 | } |
179 | 179 | ||
180 | void Alarm::setProcedureAlarm(const QString &programFile, const QString &arguments) | 180 | void Alarm::setProcedureAlarm(const QString &programFile, const QString &arguments) |
181 | { | 181 | { |
182 | mType = Procedure; | 182 | mType = Procedure; |
183 | mFile = programFile; | 183 | mFile = programFile; |
184 | mDescription = arguments; | 184 | mDescription = arguments; |
185 | mParent->updated(); | 185 | mParent->updated(); |
186 | } | 186 | } |
187 | 187 | ||
188 | void Alarm::setProgramFile(const QString &programFile) | 188 | void Alarm::setProgramFile(const QString &programFile) |
189 | { | 189 | { |
190 | if (mType == Procedure) { | 190 | if (mType == Procedure) { |
191 | mFile = programFile; | 191 | mFile = programFile; |
192 | mParent->updated(); | 192 | mParent->updated(); |
193 | } | 193 | } |
194 | } | 194 | } |
195 | 195 | ||
196 | QString Alarm::programFile() const | 196 | QString Alarm::programFile() const |
197 | { | 197 | { |
198 | return (mType == Procedure) ? mFile : QString::null; | 198 | return (mType == Procedure) ? mFile : QString::null; |
199 | } | 199 | } |
200 | 200 | ||
201 | void Alarm::setProgramArguments(const QString &arguments) | 201 | void Alarm::setProgramArguments(const QString &arguments) |
202 | { | 202 | { |
203 | if (mType == Procedure) { | 203 | if (mType == Procedure) { |
204 | mDescription = arguments; | 204 | mDescription = arguments; |
205 | mParent->updated(); | 205 | mParent->updated(); |
206 | } | 206 | } |
207 | } | 207 | } |
208 | 208 | ||
209 | QString Alarm::programArguments() const | 209 | QString Alarm::programArguments() const |
210 | { | 210 | { |
211 | return (mType == Procedure) ? mDescription : QString::null; | 211 | return (mType == Procedure) ? mDescription : QString::null; |
212 | } | 212 | } |
213 | 213 | ||
214 | void Alarm::setEmailAlarm(const QString &subject, const QString &text, | 214 | void Alarm::setEmailAlarm(const QString &subject, const QString &text, |
215 | const QValueList<Person> &addressees, const QStringList &attachments) | 215 | const QValueList<Person> &addressees, const QStringList &attachments) |
216 | { | 216 | { |
217 | mType = Email; | 217 | mType = Email; |
218 | mMailSubject = subject; | 218 | mMailSubject = subject; |
219 | mDescription = text; | 219 | mDescription = text; |
220 | mMailAddresses = addressees; | 220 | mMailAddresses = addressees; |
221 | mMailAttachFiles = attachments; | 221 | mMailAttachFiles = attachments; |
222 | mParent->updated(); | 222 | mParent->updated(); |
223 | } | 223 | } |
224 | 224 | ||
225 | void Alarm::setMailAddress(const Person &mailAddress) | 225 | void Alarm::setMailAddress(const Person &mailAddress) |
226 | { | 226 | { |
227 | if (mType == Email) { | 227 | if (mType == Email) { |
228 | mMailAddresses.clear(); | 228 | mMailAddresses.clear(); |
229 | mMailAddresses += mailAddress; | 229 | mMailAddresses += mailAddress; |
230 | mParent->updated(); | 230 | mParent->updated(); |
231 | } | 231 | } |
232 | } | 232 | } |
233 | 233 | ||
234 | void Alarm::setMailAddresses(const QValueList<Person> &mailAddresses) | 234 | void Alarm::setMailAddresses(const QValueList<Person> &mailAddresses) |
235 | { | 235 | { |
236 | if (mType == Email) { | 236 | if (mType == Email) { |
237 | mMailAddresses = mailAddresses; | 237 | mMailAddresses = mailAddresses; |
238 | mParent->updated(); | 238 | mParent->updated(); |
239 | } | 239 | } |
240 | } | 240 | } |
241 | 241 | ||
242 | void Alarm::addMailAddress(const Person &mailAddress) | 242 | void Alarm::addMailAddress(const Person &mailAddress) |
243 | { | 243 | { |
244 | if (mType == Email) { | 244 | if (mType == Email) { |
245 | mMailAddresses += mailAddress; | 245 | mMailAddresses += mailAddress; |
246 | mParent->updated(); | 246 | mParent->updated(); |
247 | } | 247 | } |
248 | } | 248 | } |
249 | 249 | ||
250 | QValueList<Person> Alarm::mailAddresses() const | 250 | QValueList<Person> Alarm::mailAddresses() const |
251 | { | 251 | { |
252 | return (mType == Email) ? mMailAddresses : QValueList<Person>(); | 252 | return (mType == Email) ? mMailAddresses : QValueList<Person>(); |
253 | } | 253 | } |
254 | 254 | ||
255 | void Alarm::setMailSubject(const QString &mailAlarmSubject) | 255 | void Alarm::setMailSubject(const QString &mailAlarmSubject) |
256 | { | 256 | { |
257 | if (mType == Email) { | 257 | if (mType == Email) { |
258 | mMailSubject = mailAlarmSubject; | 258 | mMailSubject = mailAlarmSubject; |
259 | mParent->updated(); | 259 | mParent->updated(); |
260 | } | 260 | } |
261 | } | 261 | } |
262 | 262 | ||
263 | QString Alarm::mailSubject() const | 263 | QString Alarm::mailSubject() const |
264 | { | 264 | { |
265 | return (mType == Email) ? mMailSubject : QString::null; | 265 | return (mType == Email) ? mMailSubject : QString::null; |
266 | } | 266 | } |
267 | 267 | ||
268 | void Alarm::setMailAttachment(const QString &mailAttachFile) | 268 | void Alarm::setMailAttachment(const QString &mailAttachFile) |
269 | { | 269 | { |
270 | if (mType == Email) { | 270 | if (mType == Email) { |
271 | mMailAttachFiles.clear(); | 271 | mMailAttachFiles.clear(); |
272 | mMailAttachFiles += mailAttachFile; | 272 | mMailAttachFiles += mailAttachFile; |
273 | mParent->updated(); | 273 | mParent->updated(); |
274 | } | 274 | } |
275 | } | 275 | } |
276 | 276 | ||
277 | void Alarm::setMailAttachments(const QStringList &mailAttachFiles) | 277 | void Alarm::setMailAttachments(const QStringList &mailAttachFiles) |
278 | { | 278 | { |
279 | if (mType == Email) { | 279 | if (mType == Email) { |
280 | mMailAttachFiles = mailAttachFiles; | 280 | mMailAttachFiles = mailAttachFiles; |
281 | mParent->updated(); | 281 | mParent->updated(); |
282 | } | 282 | } |
283 | } | 283 | } |
284 | 284 | ||
285 | void Alarm::addMailAttachment(const QString &mailAttachFile) | 285 | void Alarm::addMailAttachment(const QString &mailAttachFile) |
286 | { | 286 | { |
287 | if (mType == Email) { | 287 | if (mType == Email) { |
288 | mMailAttachFiles += mailAttachFile; | 288 | mMailAttachFiles += mailAttachFile; |
289 | mParent->updated(); | 289 | mParent->updated(); |
290 | } | 290 | } |
291 | } | 291 | } |
292 | 292 | ||
293 | QStringList Alarm::mailAttachments() const | 293 | QStringList Alarm::mailAttachments() const |
294 | { | 294 | { |
295 | return (mType == Email) ? mMailAttachFiles : QStringList(); | 295 | return (mType == Email) ? mMailAttachFiles : QStringList(); |
296 | } | 296 | } |
297 | 297 | ||
298 | void Alarm::setMailText(const QString &text) | 298 | void Alarm::setMailText(const QString &text) |
299 | { | 299 | { |
300 | if (mType == Email) { | 300 | if (mType == Email) { |
301 | mDescription = text; | 301 | mDescription = text; |
302 | mParent->updated(); | 302 | mParent->updated(); |
303 | } | 303 | } |
304 | } | 304 | } |
305 | 305 | ||
306 | QString Alarm::mailText() const | 306 | QString Alarm::mailText() const |
307 | { | 307 | { |
308 | return (mType == Email) ? mDescription : QString::null; | 308 | return (mType == Email) ? mDescription : QString::null; |
309 | } | 309 | } |
310 | 310 | ||
311 | void Alarm::setDisplayAlarm(const QString &text) | 311 | void Alarm::setDisplayAlarm(const QString &text) |
312 | { | 312 | { |
313 | mType = Display; | 313 | mType = Display; |
314 | mDescription = text; | 314 | mDescription = text; |
315 | mParent->updated(); | 315 | mParent->updated(); |
316 | } | 316 | } |
317 | 317 | ||
318 | void Alarm::setText(const QString &text) | 318 | void Alarm::setText(const QString &text) |
319 | { | 319 | { |
320 | if (mType == Display) { | 320 | if (mType == Display) { |
321 | mDescription = text; | 321 | mDescription = text; |
322 | mParent->updated(); | 322 | mParent->updated(); |
323 | } | 323 | } |
324 | } | 324 | } |
325 | 325 | ||
326 | QString Alarm::text() const | 326 | QString Alarm::text() const |
327 | { | 327 | { |
328 | return (mType == Display) ? mDescription : QString::null; | 328 | return (mType == Display) ? mDescription : QString::null; |
329 | } | 329 | } |
330 | 330 | ||
331 | void Alarm::setTime(const QDateTime &alarmTime) | 331 | void Alarm::setTime(const QDateTime &alarmTime) |
332 | { | 332 | { |
333 | mAlarmTime = alarmTime; | 333 | mAlarmTime = alarmTime; |
334 | mHasTime = true; | 334 | mHasTime = true; |
335 | 335 | ||
336 | mParent->updated(); | 336 | mParent->updated(); |
337 | } | 337 | } |
338 | int Alarm::offset() | 338 | int Alarm::offset() |
339 | { | 339 | { |
340 | if ( hasTime() ) { | 340 | if ( hasTime() ) { |
341 | if (mParent->typeID() == todoID ) { | 341 | if (mParent->typeID() == todoID ) { |
342 | Todo *t = static_cast<Todo*>(mParent); | 342 | Todo *t = static_cast<Todo*>(mParent); |
343 | return t->dtDue().secsTo( mAlarmTime ) ; | 343 | return t->dtDue().secsTo( mAlarmTime ) ; |
344 | } else | 344 | } else |
345 | return mParent->dtStart().secsTo( mAlarmTime ) ; | 345 | return mParent->dtStart().secsTo( mAlarmTime ) ; |
346 | } | 346 | } |
347 | else | 347 | else |
348 | { | 348 | { |
349 | return mOffset.asSeconds(); | 349 | return mOffset.asSeconds(); |
350 | } | 350 | } |
351 | 351 | ||
352 | } | 352 | } |
353 | QString Alarm::offsetText() | 353 | QString Alarm::offsetText() |
354 | { | 354 | { |
355 | int min = -offset()/60; | 355 | int min = -offset()/60; |
356 | int hours = min /60; | 356 | int hours = min /60; |
357 | min = min % 60; | 357 | min = min % 60; |
358 | int days = hours /24; | 358 | int days = hours /24; |
359 | hours = hours % 24; | 359 | hours = hours % 24; |
360 | QString message; | 360 | QString message; |
361 | //qDebug("%d %d %d ", days, hours, min ); | 361 | //qDebug("%d %d %d ", days, hours, min ); |
362 | if ( days > 0 ) | 362 | if ( days > 0 ) |
363 | message += i18n("%1d").arg( days ); | 363 | message += i18n("%1d").arg( days ); |
364 | if ( hours > 0 ) { | 364 | if ( hours > 0 ) { |
365 | if ( !message.isEmpty() ) message += "/"; | 365 | if ( !message.isEmpty() ) message += "/"; |
366 | message += i18n("%1h").arg( hours ); | 366 | message += i18n("%1h").arg( hours ); |
367 | } | 367 | } |
368 | if ( min > 0 ) { | 368 | if ( min > 0 ) { |
369 | if ( !message.isEmpty() ) message += "/"; | 369 | if ( !message.isEmpty() ) message += "/"; |
370 | message += i18n("%1min").arg( min ); | 370 | message += i18n("%1min").arg( min ); |
371 | } | 371 | } |
372 | if ( message.isEmpty() ) | 372 | if ( message.isEmpty() ) |
373 | message = i18n("%1min").arg( 0 ); | 373 | message = i18n("%1min").arg( 0 ); |
374 | if ( !mParent->alarmEnabled() ) | ||
375 | return "!"+message + i18n("(disabled)"); | ||
374 | return message; | 376 | return message; |
375 | } | 377 | } |
376 | 378 | ||
377 | 379 | ||
378 | QDateTime Alarm::time() const | 380 | QDateTime Alarm::time() const |
379 | { | 381 | { |
380 | if ( hasTime() ) | 382 | if ( hasTime() ) |
381 | return mAlarmTime; | 383 | return mAlarmTime; |
382 | else | 384 | else |
383 | { | 385 | { |
384 | if (mParent->typeID() == todoID ) { | 386 | if (mParent->typeID() == todoID ) { |
385 | Todo *t = static_cast<Todo*>(mParent); | 387 | Todo *t = static_cast<Todo*>(mParent); |
386 | return mOffset.end( t->dtDue() ); | 388 | return mOffset.end( t->dtDue() ); |
387 | } else if (mEndOffset) { | 389 | } else if (mEndOffset) { |
388 | return mOffset.end( mParent->dtEnd() ); | 390 | return mOffset.end( mParent->dtEnd() ); |
389 | } else { | 391 | } else { |
390 | return mOffset.end( mParent->dtStart() ); | 392 | return mOffset.end( mParent->dtStart() ); |
391 | } | 393 | } |
392 | } | 394 | } |
393 | } | 395 | } |
394 | 396 | ||
395 | bool Alarm::hasTime() const | 397 | bool Alarm::hasTime() const |
396 | { | 398 | { |
397 | return mHasTime; | 399 | return mHasTime; |
398 | } | 400 | } |
399 | 401 | ||
400 | void Alarm::setSnoozeTime(int alarmSnoozeTime) | 402 | void Alarm::setSnoozeTime(int alarmSnoozeTime) |
401 | { | 403 | { |
402 | mAlarmSnoozeTime = alarmSnoozeTime; | 404 | mAlarmSnoozeTime = alarmSnoozeTime; |
403 | mParent->updated(); | 405 | mParent->updated(); |
404 | } | 406 | } |
405 | 407 | ||
406 | int Alarm::snoozeTime() const | 408 | int Alarm::snoozeTime() const |
407 | { | 409 | { |
408 | return mAlarmSnoozeTime; | 410 | return mAlarmSnoozeTime; |
409 | } | 411 | } |
410 | 412 | ||
411 | void Alarm::setRepeatCount(int alarmRepeatCount) | 413 | void Alarm::setRepeatCount(int alarmRepeatCount) |
412 | { | 414 | { |
413 | kdDebug(5800) << "Alarm::setRepeatCount(): " << alarmRepeatCount << endl; | 415 | kdDebug(5800) << "Alarm::setRepeatCount(): " << alarmRepeatCount << endl; |
414 | 416 | ||
415 | mAlarmRepeatCount = alarmRepeatCount; | 417 | mAlarmRepeatCount = alarmRepeatCount; |
416 | mParent->updated(); | 418 | mParent->updated(); |
417 | } | 419 | } |
418 | 420 | ||
419 | int Alarm::repeatCount() const | 421 | int Alarm::repeatCount() const |
420 | { | 422 | { |
421 | kdDebug(5800) << "Alarm::repeatCount(): " << mAlarmRepeatCount << endl; | 423 | kdDebug(5800) << "Alarm::repeatCount(): " << mAlarmRepeatCount << endl; |
422 | return mAlarmRepeatCount; | 424 | return mAlarmRepeatCount; |
423 | } | 425 | } |
424 | 426 | ||
425 | void Alarm::toggleAlarm() | 427 | void Alarm::toggleAlarm() |
426 | { | 428 | { |
427 | mAlarmEnabled = !mAlarmEnabled; | 429 | mAlarmEnabled = !mAlarmEnabled; |
428 | mParent->updated(); | 430 | mParent->updated(); |
429 | } | 431 | } |
430 | 432 | ||
431 | void Alarm::setEnabled(bool enable) | 433 | void Alarm::setEnabled(bool enable) |
432 | { | 434 | { |
433 | mAlarmEnabled = enable; | 435 | mAlarmEnabled = enable; |
434 | mParent->updated(); | 436 | mParent->updated(); |
435 | } | 437 | } |
436 | 438 | ||
437 | bool Alarm::enabled() const | 439 | bool Alarm::enabled() const |
438 | { | 440 | { |
439 | return mAlarmEnabled; | 441 | return mAlarmEnabled; |
440 | } | 442 | } |
441 | 443 | ||
442 | void Alarm::setStartOffset( const Duration &offset ) | 444 | void Alarm::setStartOffset( const Duration &offset ) |
443 | { | 445 | { |
444 | mOffset = offset; | 446 | mOffset = offset; |
445 | mEndOffset = false; | 447 | mEndOffset = false; |
446 | mHasTime = false; | 448 | mHasTime = false; |
447 | mParent->updated(); | 449 | mParent->updated(); |
448 | } | 450 | } |
449 | 451 | ||
450 | Duration Alarm::startOffset() const | 452 | Duration Alarm::startOffset() const |
451 | { | 453 | { |
452 | return (mHasTime || mEndOffset) ? 0 : mOffset; | 454 | return (mHasTime || mEndOffset) ? 0 : mOffset; |
453 | } | 455 | } |
454 | 456 | ||
455 | bool Alarm::hasStartOffset() const | 457 | bool Alarm::hasStartOffset() const |
456 | { | 458 | { |
457 | return !mHasTime && !mEndOffset; | 459 | return !mHasTime && !mEndOffset; |
458 | } | 460 | } |
459 | 461 | ||
460 | bool Alarm::hasEndOffset() const | 462 | bool Alarm::hasEndOffset() const |
461 | { | 463 | { |
462 | return !mHasTime && mEndOffset; | 464 | return !mHasTime && mEndOffset; |
463 | } | 465 | } |
464 | 466 | ||
465 | void Alarm::setEndOffset( const Duration &offset ) | 467 | void Alarm::setEndOffset( const Duration &offset ) |
466 | { | 468 | { |
467 | mOffset = offset; | 469 | mOffset = offset; |
468 | mEndOffset = true; | 470 | mEndOffset = true; |
469 | mHasTime = false; | 471 | mHasTime = false; |
470 | mParent->updated(); | 472 | mParent->updated(); |
471 | } | 473 | } |
472 | 474 | ||
473 | Duration Alarm::endOffset() const | 475 | Duration Alarm::endOffset() const |
474 | { | 476 | { |
475 | return (mHasTime || !mEndOffset) ? 0 : mOffset; | 477 | return (mHasTime || !mEndOffset) ? 0 : mOffset; |
476 | } | 478 | } |
477 | 479 | ||
478 | void Alarm::setParent( Incidence *parent ) | 480 | void Alarm::setParent( Incidence *parent ) |
479 | { | 481 | { |
480 | mParent = parent; | 482 | mParent = parent; |
481 | } | 483 | } |
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp index 5092d1a..a662eeb 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp | |||
@@ -1,488 +1,488 @@ | |||
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) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <stdlib.h> | 22 | #include <stdlib.h> |
23 | #include <time.h> | 23 | #include <time.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 "exceptions.h" | 29 | #include "exceptions.h" |
30 | #include "calfilter.h" | 30 | #include "calfilter.h" |
31 | 31 | ||
32 | #include "calendar.h" | 32 | #include "calendar.h" |
33 | #include "syncdefines.h" | 33 | #include "syncdefines.h" |
34 | 34 | ||
35 | using namespace KCal; | 35 | using namespace KCal; |
36 | 36 | ||
37 | Calendar::Calendar() | 37 | Calendar::Calendar() |
38 | { | 38 | { |
39 | 39 | ||
40 | init(); | 40 | init(); |
41 | setTimeZoneId( " 00:00 Europe/London(UTC)" ); | 41 | setTimeZoneId( " 00:00 Europe/London(UTC)" ); |
42 | } | 42 | } |
43 | 43 | ||
44 | Calendar::Calendar( const QString &timeZoneId ) | 44 | Calendar::Calendar( const QString &timeZoneId ) |
45 | { | 45 | { |
46 | 46 | ||
47 | init(); | 47 | init(); |
48 | setTimeZoneId(timeZoneId); | 48 | setTimeZoneId(timeZoneId); |
49 | } | 49 | } |
50 | 50 | ||
51 | void Calendar::init() | 51 | void Calendar::init() |
52 | { | 52 | { |
53 | mObserver = 0; | 53 | mObserver = 0; |
54 | mNewObserver = false; | 54 | mNewObserver = false; |
55 | mUndoIncidence = 0; | 55 | mUndoIncidence = 0; |
56 | mDeleteIncidencesOnClose = true; | 56 | mDeleteIncidencesOnClose = true; |
57 | mModified = false; | 57 | mModified = false; |
58 | mDefaultCalendar = 1; | 58 | mDefaultCalendar = 1; |
59 | // Setup default filter, which does nothing | 59 | // Setup default filter, which does nothing |
60 | mDefaultFilter = new CalFilter; | 60 | mDefaultFilter = new CalFilter; |
61 | mFilter = mDefaultFilter; | 61 | mFilter = mDefaultFilter; |
62 | mFilter->setEnabled(false); | 62 | mFilter->setEnabled(false); |
63 | 63 | ||
64 | // initialize random numbers. This is a hack, and not | 64 | // initialize random numbers. This is a hack, and not |
65 | // even that good of one at that. | 65 | // even that good of one at that. |
66 | // srandom(time(0)); | 66 | // srandom(time(0)); |
67 | 67 | ||
68 | // user information... | 68 | // user information... |
69 | setOwner(i18n("Unknown Name")); | 69 | setOwner(i18n("Unknown Name")); |
70 | setEmail(i18n("unknown@nowhere")); | 70 | setEmail(i18n("unknown@nowhere")); |
71 | 71 | ||
72 | #if 0 | 72 | #if 0 |
73 | tmpStr = KOPrefs::instance()->mTimeZone; | 73 | tmpStr = KOPrefs::instance()->mTimeZone; |
74 | // kdDebug(5800) << "Calendar::Calendar(): TimeZone: " << tmpStr << endl; | 74 | // kdDebug(5800) << "Calendar::Calendar(): TimeZone: " << tmpStr << endl; |
75 | int dstSetting = KOPrefs::instance()->mDaylightSavings; | 75 | int dstSetting = KOPrefs::instance()->mDaylightSavings; |
76 | extern long int timezone; | 76 | extern long int timezone; |
77 | struct tm *now; | 77 | struct tm *now; |
78 | time_t curtime; | 78 | time_t curtime; |
79 | curtime = time(0); | 79 | curtime = time(0); |
80 | now = localtime(&curtime); | 80 | now = localtime(&curtime); |
81 | int hourOff = - ((timezone / 60) / 60); | 81 | int hourOff = - ((timezone / 60) / 60); |
82 | if (now->tm_isdst) | 82 | if (now->tm_isdst) |
83 | hourOff += 1; | 83 | hourOff += 1; |
84 | QString tzStr; | 84 | QString tzStr; |
85 | tzStr.sprintf("%.2d%.2d", | 85 | tzStr.sprintf("%.2d%.2d", |
86 | hourOff, | 86 | hourOff, |
87 | abs((timezone / 60) % 60)); | 87 | abs((timezone / 60) % 60)); |
88 | 88 | ||
89 | // if no time zone was in the config file, write what we just discovered. | 89 | // if no time zone was in the config file, write what we just discovered. |
90 | if (tmpStr.isEmpty()) { | 90 | if (tmpStr.isEmpty()) { |
91 | // KOPrefs::instance()->mTimeZone = tzStr; | 91 | // KOPrefs::instance()->mTimeZone = tzStr; |
92 | } else { | 92 | } else { |
93 | tzStr = tmpStr; | 93 | tzStr = tmpStr; |
94 | } | 94 | } |
95 | 95 | ||
96 | // if daylight savings has changed since last load time, we need | 96 | // if daylight savings has changed since last load time, we need |
97 | // to rewrite these settings to the config file. | 97 | // to rewrite these settings to the config file. |
98 | if ((now->tm_isdst && !dstSetting) || | 98 | if ((now->tm_isdst && !dstSetting) || |
99 | (!now->tm_isdst && dstSetting)) { | 99 | (!now->tm_isdst && dstSetting)) { |
100 | KOPrefs::instance()->mTimeZone = tzStr; | 100 | KOPrefs::instance()->mTimeZone = tzStr; |
101 | KOPrefs::instance()->mDaylightSavings = now->tm_isdst; | 101 | KOPrefs::instance()->mDaylightSavings = now->tm_isdst; |
102 | } | 102 | } |
103 | 103 | ||
104 | setTimeZone(tzStr); | 104 | setTimeZone(tzStr); |
105 | #endif | 105 | #endif |
106 | 106 | ||
107 | // KOPrefs::instance()->writeConfig(); | 107 | // KOPrefs::instance()->writeConfig(); |
108 | } | 108 | } |
109 | 109 | ||
110 | Calendar::~Calendar() | 110 | Calendar::~Calendar() |
111 | { | 111 | { |
112 | delete mDefaultFilter; | 112 | delete mDefaultFilter; |
113 | if ( mUndoIncidence ) | 113 | if ( mUndoIncidence ) |
114 | delete mUndoIncidence; | 114 | delete mUndoIncidence; |
115 | } | 115 | } |
116 | void Calendar::setDontDeleteIncidencesOnClose () | 116 | void Calendar::setDontDeleteIncidencesOnClose () |
117 | { | 117 | { |
118 | mDeleteIncidencesOnClose = false; | 118 | mDeleteIncidencesOnClose = false; |
119 | } | 119 | } |
120 | void Calendar::setDefaultCalendar( int d ) | 120 | void Calendar::setDefaultCalendar( int d ) |
121 | { | 121 | { |
122 | mDefaultCalendar = d; | 122 | mDefaultCalendar = d; |
123 | } | 123 | } |
124 | int Calendar::defaultCalendar() | 124 | int Calendar::defaultCalendar() |
125 | { | 125 | { |
126 | return mDefaultCalendar; | 126 | return mDefaultCalendar; |
127 | } | 127 | } |
128 | const QString &Calendar::getOwner() const | 128 | const QString &Calendar::getOwner() const |
129 | { | 129 | { |
130 | return mOwner; | 130 | return mOwner; |
131 | } | 131 | } |
132 | 132 | ||
133 | bool Calendar::undoDeleteIncidence() | 133 | bool Calendar::undoDeleteIncidence() |
134 | { | 134 | { |
135 | if (!mUndoIncidence) | 135 | if (!mUndoIncidence) |
136 | return false; | 136 | return false; |
137 | addIncidence(mUndoIncidence); | 137 | addIncidence(mUndoIncidence); |
138 | mUndoIncidence = 0; | 138 | mUndoIncidence = 0; |
139 | return true; | 139 | return true; |
140 | } | 140 | } |
141 | void Calendar::setOwner(const QString &os) | 141 | void Calendar::setOwner(const QString &os) |
142 | { | 142 | { |
143 | int i; | 143 | int i; |
144 | mOwner = os; | 144 | mOwner = os; |
145 | i = mOwner.find(','); | 145 | i = mOwner.find(','); |
146 | if (i != -1) | 146 | if (i != -1) |
147 | mOwner = mOwner.left(i); | 147 | mOwner = mOwner.left(i); |
148 | 148 | ||
149 | setModified( true ); | 149 | setModified( true ); |
150 | } | 150 | } |
151 | 151 | ||
152 | void Calendar::setTimeZone(const QString & tz) | 152 | void Calendar::setTimeZone(const QString & tz) |
153 | { | 153 | { |
154 | bool neg = FALSE; | 154 | bool neg = FALSE; |
155 | int hours, minutes; | 155 | int hours, minutes; |
156 | QString tmpStr(tz); | 156 | QString tmpStr(tz); |
157 | 157 | ||
158 | if (tmpStr.left(1) == "-") | 158 | if (tmpStr.left(1) == "-") |
159 | neg = TRUE; | 159 | neg = TRUE; |
160 | if (tmpStr.left(1) == "-" || tmpStr.left(1) == "+") | 160 | if (tmpStr.left(1) == "-" || tmpStr.left(1) == "+") |
161 | tmpStr.remove(0, 1); | 161 | tmpStr.remove(0, 1); |
162 | hours = tmpStr.left(2).toInt(); | 162 | hours = tmpStr.left(2).toInt(); |
163 | if (tmpStr.length() > 2) | 163 | if (tmpStr.length() > 2) |
164 | minutes = tmpStr.right(2).toInt(); | 164 | minutes = tmpStr.right(2).toInt(); |
165 | else | 165 | else |
166 | minutes = 0; | 166 | minutes = 0; |
167 | mTimeZone = (60*hours+minutes); | 167 | mTimeZone = (60*hours+minutes); |
168 | if (neg) | 168 | if (neg) |
169 | mTimeZone = -mTimeZone; | 169 | mTimeZone = -mTimeZone; |
170 | mLocalTime = false; | 170 | mLocalTime = false; |
171 | 171 | ||
172 | setModified( true ); | 172 | setModified( true ); |
173 | } | 173 | } |
174 | 174 | ||
175 | QString Calendar::getTimeZoneStr() const | 175 | QString Calendar::getTimeZoneStr() const |
176 | { | 176 | { |
177 | if (mLocalTime) | 177 | if (mLocalTime) |
178 | return ""; | 178 | return ""; |
179 | QString tmpStr; | 179 | QString tmpStr; |
180 | int hours = abs(mTimeZone / 60); | 180 | int hours = abs(mTimeZone / 60); |
181 | int minutes = abs(mTimeZone % 60); | 181 | int minutes = abs(mTimeZone % 60); |
182 | bool neg = mTimeZone < 0; | 182 | bool neg = mTimeZone < 0; |
183 | 183 | ||
184 | tmpStr.sprintf("%c%.2d%.2d", | 184 | tmpStr.sprintf("%c%.2d%.2d", |
185 | (neg ? '-' : '+'), | 185 | (neg ? '-' : '+'), |
186 | hours, minutes); | 186 | hours, minutes); |
187 | return tmpStr; | 187 | return tmpStr; |
188 | } | 188 | } |
189 | 189 | ||
190 | void Calendar::setTimeZone(int tz) | 190 | void Calendar::setTimeZone(int tz) |
191 | { | 191 | { |
192 | mTimeZone = tz; | 192 | mTimeZone = tz; |
193 | mLocalTime = false; | 193 | mLocalTime = false; |
194 | 194 | ||
195 | setModified( true ); | 195 | setModified( true ); |
196 | } | 196 | } |
197 | 197 | ||
198 | int Calendar::getTimeZone() const | 198 | int Calendar::getTimeZone() const |
199 | { | 199 | { |
200 | return mTimeZone; | 200 | return mTimeZone; |
201 | } | 201 | } |
202 | 202 | ||
203 | void Calendar::setTimeZoneId(const QString &id) | 203 | void Calendar::setTimeZoneId(const QString &id) |
204 | { | 204 | { |
205 | mTimeZoneId = id; | 205 | mTimeZoneId = id; |
206 | mLocalTime = false; | 206 | mLocalTime = false; |
207 | mTimeZone = KGlobal::locale()->timezoneOffset(mTimeZoneId); | 207 | mTimeZone = KGlobal::locale()->timezoneOffset(mTimeZoneId); |
208 | if ( mTimeZone > 1000) | 208 | if ( mTimeZone > 1000) |
209 | setLocalTime(); | 209 | setLocalTime(); |
210 | //qDebug("Calendar::setTimeZoneOffset %s %d ",mTimeZoneId.latin1(), mTimeZone); | 210 | //qDebug("Calendar::setTimeZoneOffset %s %d ",mTimeZoneId.latin1(), mTimeZone); |
211 | setModified( true ); | 211 | setModified( true ); |
212 | } | 212 | } |
213 | 213 | ||
214 | QString Calendar::timeZoneId() const | 214 | QString Calendar::timeZoneId() const |
215 | { | 215 | { |
216 | return mTimeZoneId; | 216 | return mTimeZoneId; |
217 | } | 217 | } |
218 | 218 | ||
219 | void Calendar::setLocalTime() | 219 | void Calendar::setLocalTime() |
220 | { | 220 | { |
221 | //qDebug("Calendar::setLocalTime() "); | 221 | //qDebug("Calendar::setLocalTime() "); |
222 | mLocalTime = true; | 222 | mLocalTime = true; |
223 | mTimeZone = 0; | 223 | mTimeZone = 0; |
224 | mTimeZoneId = ""; | 224 | mTimeZoneId = ""; |
225 | 225 | ||
226 | setModified( true ); | 226 | setModified( true ); |
227 | } | 227 | } |
228 | 228 | ||
229 | bool Calendar::isLocalTime() const | 229 | bool Calendar::isLocalTime() const |
230 | { | 230 | { |
231 | return mLocalTime; | 231 | return mLocalTime; |
232 | } | 232 | } |
233 | 233 | ||
234 | const QString &Calendar::getEmail() | 234 | const QString &Calendar::getEmail() |
235 | { | 235 | { |
236 | return mOwnerEmail; | 236 | return mOwnerEmail; |
237 | } | 237 | } |
238 | 238 | ||
239 | void Calendar::setEmail(const QString &e) | 239 | void Calendar::setEmail(const QString &e) |
240 | { | 240 | { |
241 | mOwnerEmail = e; | 241 | mOwnerEmail = e; |
242 | 242 | ||
243 | setModified( true ); | 243 | setModified( true ); |
244 | } | 244 | } |
245 | 245 | ||
246 | void Calendar::setFilter(CalFilter *filter) | 246 | void Calendar::setFilter(CalFilter *filter) |
247 | { | 247 | { |
248 | mFilter = filter; | 248 | mFilter = filter; |
249 | } | 249 | } |
250 | 250 | ||
251 | CalFilter *Calendar::filter() | 251 | CalFilter *Calendar::filter() |
252 | { | 252 | { |
253 | return mFilter; | 253 | return mFilter; |
254 | } | 254 | } |
255 | 255 | ||
256 | QPtrList<Incidence> Calendar::incidences() | 256 | QPtrList<Incidence> Calendar::incidences() |
257 | { | 257 | { |
258 | QPtrList<Incidence> incidences; | 258 | QPtrList<Incidence> incidences; |
259 | 259 | ||
260 | Incidence *i; | 260 | Incidence *i; |
261 | 261 | ||
262 | QPtrList<Event> e = events(); | 262 | QPtrList<Event> e = events(); |
263 | for( i = e.first(); i; i = e.next() ) incidences.append( i ); | 263 | for( i = e.first(); i; i = e.next() ) incidences.append( i ); |
264 | 264 | ||
265 | QPtrList<Todo> t = todos(); | 265 | QPtrList<Todo> t = todos(); |
266 | for( i = t.first(); i; i = t.next() ) incidences.append( i ); | 266 | for( i = t.first(); i; i = t.next() ) incidences.append( i ); |
267 | 267 | ||
268 | QPtrList<Journal> j = journals(); | 268 | QPtrList<Journal> j = journals(); |
269 | for( i = j.first(); i; i = j.next() ) incidences.append( i ); | 269 | for( i = j.first(); i; i = j.next() ) incidences.append( i ); |
270 | 270 | ||
271 | return incidences; | 271 | return incidences; |
272 | } | 272 | } |
273 | 273 | ||
274 | void Calendar::resetPilotStat(int id ) | 274 | void Calendar::resetPilotStat(int id ) |
275 | { | 275 | { |
276 | QPtrList<Incidence> incidences; | 276 | QPtrList<Incidence> incidences; |
277 | 277 | ||
278 | Incidence *i; | 278 | Incidence *i; |
279 | 279 | ||
280 | QPtrList<Event> e = rawEvents(); | 280 | QPtrList<Event> e = rawEvents(); |
281 | for( i = e.first(); i; i = e.next() ) i->setPilotId( id ); | 281 | for( i = e.first(); i; i = e.next() ) i->setPilotId( id ); |
282 | 282 | ||
283 | QPtrList<Todo> t = rawTodos(); | 283 | QPtrList<Todo> t = rawTodos(); |
284 | for( i = t.first(); i; i = t.next() ) i->setPilotId( id ); | 284 | for( i = t.first(); i; i = t.next() ) i->setPilotId( id ); |
285 | 285 | ||
286 | QPtrList<Journal> j = journals(); | 286 | QPtrList<Journal> j = journals(); |
287 | for( i = j.first(); i; i = j.next() ) i->setPilotId( id ); | 287 | for( i = j.first(); i; i = j.next() ) i->setPilotId( id ); |
288 | } | 288 | } |
289 | void Calendar::resetTempSyncStat() | 289 | void Calendar::resetTempSyncStat() |
290 | { | 290 | { |
291 | QPtrList<Incidence> incidences; | 291 | QPtrList<Incidence> incidences; |
292 | 292 | ||
293 | Incidence *i; | 293 | Incidence *i; |
294 | 294 | ||
295 | QPtrList<Event> e = rawEvents(); | 295 | QPtrList<Event> e = rawEvents(); |
296 | for( i = e.first(); i; i = e.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 296 | for( i = e.first(); i; i = e.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
297 | 297 | ||
298 | QPtrList<Todo> t = rawTodos(); | 298 | QPtrList<Todo> t = rawTodos(); |
299 | for( i = t.first(); i; i = t.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 299 | for( i = t.first(); i; i = t.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
300 | 300 | ||
301 | QPtrList<Journal> j = journals(); | 301 | QPtrList<Journal> j = journals(); |
302 | for( i = j.first(); i; i = j.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 302 | for( i = j.first(); i; i = j.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
303 | } | 303 | } |
304 | QPtrList<Incidence> Calendar::rawIncidences() | 304 | QPtrList<Incidence> Calendar::rawIncidences() |
305 | { | 305 | { |
306 | QPtrList<Incidence> incidences; | 306 | QPtrList<Incidence> incidences; |
307 | 307 | ||
308 | Incidence *i; | 308 | Incidence *i; |
309 | 309 | ||
310 | QPtrList<Event> e = rawEvents(); | 310 | QPtrList<Event> e = rawEvents(); |
311 | for( i = e.first(); i; i = e.next() ) incidences.append( i ); | 311 | for( i = e.first(); i; i = e.next() ) incidences.append( i ); |
312 | 312 | ||
313 | QPtrList<Todo> t = rawTodos(); | 313 | QPtrList<Todo> t = rawTodos(); |
314 | for( i = t.first(); i; i = t.next() ) incidences.append( i ); | 314 | for( i = t.first(); i; i = t.next() ) incidences.append( i ); |
315 | 315 | ||
316 | QPtrList<Journal> j = journals(); | 316 | QPtrList<Journal> j = journals(); |
317 | for( i = j.first(); i; i = j.next() ) incidences.append( i ); | 317 | for( i = j.first(); i; i = j.next() ) incidences.append( i ); |
318 | 318 | ||
319 | return incidences; | 319 | return incidences; |
320 | } | 320 | } |
321 | 321 | ||
322 | QPtrList<Event> Calendar::events( const QDate &date, bool sorted ) | 322 | QPtrList<Event> Calendar::events( const QDate &date, bool sorted ) |
323 | { | 323 | { |
324 | QPtrList<Event> el = rawEventsForDate(date,sorted); | 324 | QPtrList<Event> el = rawEventsForDate(date,sorted); |
325 | mFilter->apply(&el); | 325 | mFilter->apply(&el); |
326 | return el; | 326 | return el; |
327 | } | 327 | } |
328 | 328 | ||
329 | QPtrList<Event> Calendar::events( const QDateTime &qdt ) | 329 | QPtrList<Event> Calendar::events( const QDateTime &qdt ) |
330 | { | 330 | { |
331 | QPtrList<Event> el = rawEventsForDate(qdt); | 331 | QPtrList<Event> el = rawEventsForDate(qdt); |
332 | mFilter->apply(&el); | 332 | mFilter->apply(&el); |
333 | return el; | 333 | return el; |
334 | } | 334 | } |
335 | 335 | ||
336 | QPtrList<Event> Calendar::events( const QDate &start, const QDate &end, | 336 | QPtrList<Event> Calendar::events( const QDate &start, const QDate &end, |
337 | bool inclusive) | 337 | bool inclusive) |
338 | { | 338 | { |
339 | QPtrList<Event> el = rawEvents(start,end,inclusive); | 339 | QPtrList<Event> el = rawEvents(start,end,inclusive); |
340 | mFilter->apply(&el); | 340 | mFilter->apply(&el); |
341 | return el; | 341 | return el; |
342 | } | 342 | } |
343 | 343 | ||
344 | QPtrList<Event> Calendar::events() | 344 | QPtrList<Event> Calendar::events() |
345 | { | 345 | { |
346 | QPtrList<Event> el = rawEvents(); | 346 | QPtrList<Event> el = rawEvents(); |
347 | mFilter->apply(&el); | 347 | mFilter->apply(&el); |
348 | return el; | 348 | return el; |
349 | } | 349 | } |
350 | void Calendar::addIncidenceBranch(Incidence *i) | 350 | void Calendar::addIncidenceBranch(Incidence *i) |
351 | { | 351 | { |
352 | addIncidence( i ); | 352 | addIncidence( i ); |
353 | Incidence * inc; | 353 | Incidence * inc; |
354 | QPtrList<Incidence> Relations = i->relations(); | 354 | QPtrList<Incidence> Relations = i->relations(); |
355 | for (inc=Relations.first();inc;inc=Relations.next()) { | 355 | for (inc=Relations.first();inc;inc=Relations.next()) { |
356 | addIncidenceBranch( inc ); | 356 | addIncidenceBranch( inc ); |
357 | } | 357 | } |
358 | } | 358 | } |
359 | 359 | ||
360 | bool Calendar::addIncidence(Incidence *i) | 360 | bool Calendar::addIncidence(Incidence *i) |
361 | { | 361 | { |
362 | Incidence::AddVisitor<Calendar> v(this); | 362 | Incidence::AddVisitor<Calendar> v(this); |
363 | i->setCalID( mDefaultCalendar ); | 363 | i->setCalID( mDefaultCalendar ); |
364 | i->setCalEnabled( true ); | 364 | i->setCalEnabled( true ); |
365 | return i->accept(v); | 365 | return i->accept(v); |
366 | } | 366 | } |
367 | void Calendar::deleteIncidence(Incidence *in) | 367 | void Calendar::deleteIncidence(Incidence *in) |
368 | { | 368 | { |
369 | if ( in->typeID() == eventID ) | 369 | if ( in->typeID() == eventID ) |
370 | deleteEvent( (Event*) in ); | 370 | deleteEvent( (Event*) in ); |
371 | else if ( in->typeID() == todoID ) | 371 | else if ( in->typeID() == todoID ) |
372 | deleteTodo( (Todo*) in); | 372 | deleteTodo( (Todo*) in); |
373 | else if ( in->typeID() == journalID ) | 373 | else if ( in->typeID() == journalID ) |
374 | deleteJournal( (Journal*) in ); | 374 | deleteJournal( (Journal*) in ); |
375 | } | 375 | } |
376 | 376 | ||
377 | Incidence* Calendar::incidence( const QString& uid ) | 377 | Incidence* Calendar::incidence( const QString& uid ) |
378 | { | 378 | { |
379 | Incidence* i; | 379 | Incidence* i; |
380 | 380 | ||
381 | if( (i = todo( uid )) != 0 ) | 381 | if( (i = todo( uid )) != 0 ) |
382 | return i; | 382 | return i; |
383 | if( (i = event( uid )) != 0 ) | 383 | if( (i = event( uid )) != 0 ) |
384 | return i; | 384 | return i; |
385 | if( (i = journal( uid )) != 0 ) | 385 | if( (i = journal( uid )) != 0 ) |
386 | return i; | 386 | return i; |
387 | 387 | ||
388 | return 0; | 388 | return 0; |
389 | } | 389 | } |
390 | 390 | ||
391 | QPtrList<Todo> Calendar::todos() | 391 | QPtrList<Todo> Calendar::todos() |
392 | { | 392 | { |
393 | QPtrList<Todo> tl = rawTodos(); | 393 | QPtrList<Todo> tl = rawTodos(); |
394 | mFilter->apply( &tl ); | 394 | mFilter->apply( &tl ); |
395 | return tl; | 395 | return tl; |
396 | } | 396 | } |
397 | 397 | ||
398 | // When this is called, the todo have already been added to the calendar. | 398 | // When this is called, the todo have already been added to the calendar. |
399 | // This method is only about linking related todos | 399 | // This method is only about linking related todos |
400 | void Calendar::setupRelations( Incidence *incidence ) | 400 | void Calendar::setupRelations( Incidence *incidence ) |
401 | { | 401 | { |
402 | QString uid = incidence->uid(); | 402 | QString uid = incidence->uid(); |
403 | //qDebug("Calendar::setupRelations "); | 403 | //qDebug("Calendar::setupRelations "); |
404 | // First, go over the list of orphans and see if this is their parent | 404 | // First, go over the list of orphans and see if this is their parent |
405 | while( Incidence* i = mOrphans[ uid ] ) { | 405 | while( Incidence* i = mOrphans[ uid ] ) { |
406 | mOrphans.remove( uid ); | 406 | mOrphans.remove( uid ); |
407 | i->setRelatedTo( incidence ); | 407 | i->setRelatedTo( incidence ); |
408 | incidence->addRelation( i ); | 408 | incidence->addRelation( i ); |
409 | mOrphanUids.remove( i->uid() ); | 409 | mOrphanUids.remove( i->uid() ); |
410 | } | 410 | } |
411 | 411 | ||
412 | // Now see about this incidences parent | 412 | // Now see about this incidences parent |
413 | if( !incidence->relatedTo() && !incidence->relatedToUid().isEmpty() ) { | 413 | if( !incidence->relatedTo() && !incidence->relatedToUid().isEmpty() ) { |
414 | // This incidence has a uid it is related to, but is not registered to it yet | 414 | // This incidence has a uid it is related to, but is not registered to it yet |
415 | // Try to find it | 415 | // Try to find it |
416 | Incidence* parent = this->incidence( incidence->relatedToUid() ); | 416 | Incidence* parent = this->incidence( incidence->relatedToUid() ); |
417 | if( parent ) { | 417 | if( parent ) { |
418 | // Found it | 418 | // Found it |
419 | incidence->setRelatedTo( parent ); | 419 | incidence->setRelatedTo( parent ); |
420 | parent->addRelation( incidence ); | 420 | parent->addRelation( incidence ); |
421 | } else { | 421 | } else { |
422 | // Not found, put this in the mOrphans list | 422 | // Not found, put this in the mOrphans list |
423 | mOrphans.insert( incidence->relatedToUid(), incidence ); | 423 | mOrphans.insert( incidence->relatedToUid(), incidence ); |
424 | mOrphanUids.insert( incidence->uid(), incidence ); | 424 | mOrphanUids.insert( incidence->uid(), incidence ); |
425 | } | 425 | } |
426 | } | 426 | } |
427 | } | 427 | } |
428 | 428 | ||
429 | // If a task with subtasks is deleted, move it's subtasks to the orphans list | 429 | // If a task with subtasks is deleted, move it's subtasks to the orphans list |
430 | void Calendar::removeRelations( Incidence *incidence ) | 430 | void Calendar::removeRelations( Incidence *incidence ) |
431 | { | 431 | { |
432 | // qDebug("Calendar::removeRelations "); | 432 | // qDebug("Calendar::removeRelations "); |
433 | QString uid = incidence->uid(); | 433 | QString uid = incidence->uid(); |
434 | 434 | ||
435 | QPtrList<Incidence> relations = incidence->relations(); | 435 | QPtrList<Incidence> relations = incidence->relations(); |
436 | for( Incidence* i = relations.first(); i; i = relations.next() ) | 436 | for( Incidence* i = relations.first(); i; i = relations.next() ) |
437 | if( !mOrphanUids.find( i->uid() ) ) { | 437 | if( !mOrphanUids.find( i->uid() ) ) { |
438 | mOrphans.insert( uid, i ); | 438 | mOrphans.insert( uid, i ); |
439 | mOrphanUids.insert( i->uid(), i ); | 439 | mOrphanUids.insert( i->uid(), i ); |
440 | i->setRelatedTo( 0 ); | 440 | i->setRelatedTo( 0 ); |
441 | i->setRelatedToUid( uid ); | 441 | i->setRelatedToUid( uid ); |
442 | } | 442 | } |
443 | 443 | ||
444 | // If this incidence is related to something else, tell that about it | 444 | // If this incidence is related to something else, tell that about it |
445 | if( incidence->relatedTo() ) | 445 | if( incidence->relatedTo() ) |
446 | incidence->relatedTo()->removeRelation( incidence ); | 446 | incidence->relatedTo()->removeRelation( incidence ); |
447 | 447 | ||
448 | // Remove this one from the orphans list | 448 | // Remove this one from the orphans list |
449 | if( mOrphanUids.remove( uid ) ) | 449 | if( mOrphanUids.remove( uid ) ) |
450 | // This incidence is located in the orphans list - it should be removed | 450 | // This incidence is located in the orphans list - it should be removed |
451 | if( !( incidence->relatedTo() != 0 && mOrphans.remove( incidence->relatedTo()->uid() ) ) ) { | 451 | if( !( incidence->relatedTo() != 0 && mOrphans.remove( incidence->relatedTo()->uid() ) ) ) { |
452 | // Removing wasn't that easy | 452 | // Removing wasn't that easy |
453 | for( QDictIterator<Incidence> it( mOrphans ); it.current(); ++it ) { | 453 | for( QDictIterator<Incidence> it( mOrphans ); it.current(); ++it ) { |
454 | if( it.current()->uid() == uid ) { | 454 | if( it.current()->uid() == uid ) { |
455 | mOrphans.remove( it.currentKey() ); | 455 | mOrphans.remove( it.currentKey() ); |
456 | break; | 456 | break; |
457 | } | 457 | } |
458 | } | 458 | } |
459 | } | 459 | } |
460 | } | 460 | } |
461 | 461 | ||
462 | void Calendar::registerObserver( Observer *observer ) | 462 | void Calendar::registerObserver( Observer *observer ) |
463 | { | 463 | { |
464 | mObserver = observer; | 464 | mObserver = observer; |
465 | mNewObserver = true; | 465 | mNewObserver = true; |
466 | } | 466 | } |
467 | 467 | ||
468 | void Calendar::setModified( bool modified ) | 468 | void Calendar::setModified( bool modified ) |
469 | { | 469 | { |
470 | if ( mObserver ) mObserver->calendarModified( modified, this ); | 470 | if ( mObserver ) mObserver->calendarModified( modified, this ); |
471 | if ( modified != mModified || mNewObserver ) { | 471 | if ( modified != mModified || mNewObserver ) { |
472 | mNewObserver = false; | 472 | mNewObserver = false; |
473 | // if ( mObserver ) mObserver->calendarModified( modified, this ); | 473 | // if ( mObserver ) mObserver->calendarModified( modified, this ); |
474 | mModified = modified; | 474 | mModified = modified; |
475 | } | 475 | } |
476 | } | 476 | } |
477 | 477 | ||
478 | void Calendar::setLoadedProductId( const QString &id ) | 478 | void Calendar::setLoadedProductId( const QString &id ) |
479 | { | 479 | { |
480 | mLoadedProductId = id; | 480 | mLoadedProductId = id; |
481 | } | 481 | } |
482 | 482 | ||
483 | QString Calendar::loadedProductId() | 483 | QString Calendar::loadedProductId() |
484 | { | 484 | { |
485 | return mLoadedProductId; | 485 | return mLoadedProductId; |
486 | } | 486 | } |
487 | 487 | ||
488 | //#include "calendar.moc" | 488 | //#include "calendar.moc" |
diff --git a/libkcal/calendar.h b/libkcal/calendar.h index 73f82bb..2243e28 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h | |||
@@ -1,373 +1,374 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 1998 Preston Brown | 3 | Copyright (c) 1998 Preston Brown |
4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #ifndef CALENDAR_H | 22 | #ifndef CALENDAR_H |
23 | #define CALENDAR_H | 23 | #define CALENDAR_H |
24 | 24 | ||
25 | #include <qobject.h> | 25 | #include <qobject.h> |
26 | #include <qstring.h> | 26 | #include <qstring.h> |
27 | #include <qdatetime.h> | 27 | #include <qdatetime.h> |
28 | #include <qptrlist.h> | 28 | #include <qptrlist.h> |
29 | #include <qdict.h> | 29 | #include <qdict.h> |
30 | 30 | ||
31 | #include "customproperties.h" | 31 | #include "customproperties.h" |
32 | #include "event.h" | 32 | #include "event.h" |
33 | #include "todo.h" | 33 | #include "todo.h" |
34 | #include "journal.h" | 34 | #include "journal.h" |
35 | #include "calfilter.h" | 35 | #include "calfilter.h" |
36 | 36 | ||
37 | //#define _TIME_ZONE "-0500" /* hardcoded, overridden in config file. */ | 37 | //#define _TIME_ZONE "-0500" /* hardcoded, overridden in config file. */ |
38 | 38 | ||
39 | class KConfig; | 39 | class KConfig; |
40 | 40 | ||
41 | namespace KCal { | 41 | namespace KCal { |
42 | 42 | ||
43 | 43 | ||
44 | /** | 44 | /** |
45 | This is the main "calendar" object class for KOrganizer. It holds | 45 | This is the main "calendar" object class for KOrganizer. It holds |
46 | information like all appointments/events, user information, etc. etc. | 46 | information like all appointments/events, user information, etc. etc. |
47 | one calendar is associated with each CalendarView (@see calendarview.h). | 47 | one calendar is associated with each CalendarView (@see calendarview.h). |
48 | This is an abstract base class defining the interface to a calendar. It is | 48 | This is an abstract base class defining the interface to a calendar. It is |
49 | implemented by subclasses like @see CalendarLocal, which use different | 49 | implemented by subclasses like @see CalendarLocal, which use different |
50 | methods to store and access the data. | 50 | methods to store and access the data. |
51 | 51 | ||
52 | Ownership of events etc. is handled by the following policy: As soon as an | 52 | Ownership of events etc. is handled by the following policy: As soon as an |
53 | event (or any other subclass of IncidenceBase) object is added to the | 53 | event (or any other subclass of IncidenceBase) object is added to the |
54 | Calendar by addEvent() it is owned by the Calendar object. The Calendar takes | 54 | Calendar by addEvent() it is owned by the Calendar object. The Calendar takes |
55 | care of deleting it. All Events returned by the query functions are returned | 55 | care of deleting it. All Events returned by the query functions are returned |
56 | as pointers, that means all changes to the returned events are immediately | 56 | as pointers, that means all changes to the returned events are immediately |
57 | visible in the Calendar. You shouldn't delete any Event object you get from | 57 | visible in the Calendar. You shouldn't delete any Event object you get from |
58 | Calendar. | 58 | Calendar. |
59 | */ | 59 | */ |
60 | class Calendar : public QObject, public CustomProperties, | 60 | class Calendar : public QObject, public CustomProperties, |
61 | public IncidenceBase::Observer | 61 | public IncidenceBase::Observer |
62 | { | 62 | { |
63 | Q_OBJECT | 63 | Q_OBJECT |
64 | public: | 64 | public: |
65 | Calendar(); | 65 | Calendar(); |
66 | Calendar(const QString &timeZoneId); | 66 | Calendar(const QString &timeZoneId); |
67 | virtual ~Calendar(); | 67 | virtual ~Calendar(); |
68 | Incidence * undoIncidence() { return mUndoIncidence; }; | 68 | Incidence * undoIncidence() { return mUndoIncidence; }; |
69 | bool undoDeleteIncidence(); | 69 | bool undoDeleteIncidence(); |
70 | void deleteIncidence(Incidence *in); | 70 | void deleteIncidence(Incidence *in); |
71 | void resetTempSyncStat(); | 71 | void resetTempSyncStat(); |
72 | void resetPilotStat(int id); | 72 | void resetPilotStat(int id); |
73 | /** | 73 | /** |
74 | Clears out the current calendar, freeing all used memory etc. | 74 | Clears out the current calendar, freeing all used memory etc. |
75 | */ | 75 | */ |
76 | virtual void close() = 0; | 76 | virtual void close() = 0; |
77 | virtual void addCalendar( Calendar* ) = 0; | 77 | virtual void addCalendar( Calendar* ) = 0; |
78 | virtual bool addCalendarFile( QString name, int id ) = 0; | 78 | virtual bool addCalendarFile( QString name, int id ) = 0; |
79 | 79 | ||
80 | /** | 80 | /** |
81 | Sync changes in memory to persistant storage. | 81 | Sync changes in memory to persistant storage. |
82 | */ | 82 | */ |
83 | virtual void save() = 0; | 83 | virtual void save() = 0; |
84 | virtual QPtrList<Event> getExternLastSyncEvents() = 0; | 84 | virtual QPtrList<Event> getExternLastSyncEvents() = 0; |
85 | virtual void removeSyncInfo( QString syncProfile) = 0; | 85 | virtual void removeSyncInfo( QString syncProfile) = 0; |
86 | virtual bool isSaving() { return false; } | 86 | virtual bool isSaving() { return false; } |
87 | 87 | ||
88 | /** | 88 | /** |
89 | Return the owner of the calendar's full name. | 89 | Return the owner of the calendar's full name. |
90 | */ | 90 | */ |
91 | const QString &getOwner() const; | 91 | const QString &getOwner() const; |
92 | /** | 92 | /** |
93 | Set the owner of the calendar. Should be owner's full name. | 93 | Set the owner of the calendar. Should be owner's full name. |
94 | */ | 94 | */ |
95 | void setOwner( const QString &os ); | 95 | void setOwner( const QString &os ); |
96 | /** | 96 | /** |
97 | Return the email address of the calendar owner. | 97 | Return the email address of the calendar owner. |
98 | */ | 98 | */ |
99 | const QString &getEmail(); | 99 | const QString &getEmail(); |
100 | /** | 100 | /** |
101 | Set the email address of the calendar owner. | 101 | Set the email address of the calendar owner. |
102 | */ | 102 | */ |
103 | void setEmail( const QString & ); | 103 | void setEmail( const QString & ); |
104 | 104 | ||
105 | /** | 105 | /** |
106 | Set time zone from a timezone string (e.g. -2:00) | 106 | Set time zone from a timezone string (e.g. -2:00) |
107 | */ | 107 | */ |
108 | void setTimeZone( const QString &tz ); | 108 | void setTimeZone( const QString &tz ); |
109 | /** | 109 | /** |
110 | Set time zone from a minutes value (e.g. -60) | 110 | Set time zone from a minutes value (e.g. -60) |
111 | */ | 111 | */ |
112 | void setTimeZone( int tz ); | 112 | void setTimeZone( int tz ); |
113 | /** | 113 | /** |
114 | Return time zone as offest in minutes. | 114 | Return time zone as offest in minutes. |
115 | */ | 115 | */ |
116 | int getTimeZone() const; | 116 | int getTimeZone() const; |
117 | /** | 117 | /** |
118 | Compute an ISO 8601 format string from the time zone. | 118 | Compute an ISO 8601 format string from the time zone. |
119 | */ | 119 | */ |
120 | QString getTimeZoneStr() const; | 120 | QString getTimeZoneStr() const; |
121 | /** | 121 | /** |
122 | Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal | 122 | Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal |
123 | values). | 123 | values). |
124 | */ | 124 | */ |
125 | void setTimeZoneId( const QString & ); | 125 | void setTimeZoneId( const QString & ); |
126 | /** | 126 | /** |
127 | Return time zone id. | 127 | Return time zone id. |
128 | */ | 128 | */ |
129 | QString timeZoneId() const; | 129 | QString timeZoneId() const; |
130 | /** | 130 | /** |
131 | Use local time, not UTC or a time zone. | 131 | Use local time, not UTC or a time zone. |
132 | */ | 132 | */ |
133 | void setLocalTime(); | 133 | void setLocalTime(); |
134 | /** | 134 | /** |
135 | Return whether local time is being used. | 135 | Return whether local time is being used. |
136 | */ | 136 | */ |
137 | bool isLocalTime() const; | 137 | bool isLocalTime() const; |
138 | 138 | ||
139 | /** | 139 | /** |
140 | Add an incidence to calendar. | 140 | Add an incidence to calendar. |
141 | 141 | ||
142 | @return true on success, false on error. | 142 | @return true on success, false on error. |
143 | */ | 143 | */ |
144 | virtual bool addIncidence( Incidence * ); | 144 | virtual bool addIncidence( Incidence * ); |
145 | 145 | ||
146 | // Adds an incidence and all relatedto incidences to the cal | 146 | // Adds an incidence and all relatedto incidences to the cal |
147 | void addIncidenceBranch( Incidence * ); | 147 | void addIncidenceBranch( Incidence * ); |
148 | /** | 148 | /** |
149 | Return filtered list of all incidences of this calendar. | 149 | Return filtered list of all incidences of this calendar. |
150 | */ | 150 | */ |
151 | virtual QPtrList<Incidence> incidences(); | 151 | virtual QPtrList<Incidence> incidences(); |
152 | 152 | ||
153 | /** | 153 | /** |
154 | Return unfiltered list of all incidences of this calendar. | 154 | Return unfiltered list of all incidences of this calendar. |
155 | */ | 155 | */ |
156 | virtual QPtrList<Incidence> rawIncidences(); | 156 | virtual QPtrList<Incidence> rawIncidences(); |
157 | 157 | ||
158 | /** | 158 | /** |
159 | Adds a Event to this calendar object. | 159 | Adds a Event to this calendar object. |
160 | @param anEvent a pointer to the event to add | 160 | @param anEvent a pointer to the event to add |
161 | 161 | ||
162 | @return true on success, false on error. | 162 | @return true on success, false on error. |
163 | */ | 163 | */ |
164 | virtual bool addEventNoDup( Event *event ) = 0; | 164 | virtual bool addEventNoDup( Event *event ) = 0; |
165 | virtual bool addAnniversaryNoDup( Event *event ) = 0; | 165 | virtual bool addAnniversaryNoDup( Event *event ) = 0; |
166 | virtual bool addEvent( Event *anEvent ) = 0; | 166 | virtual bool addEvent( Event *anEvent ) = 0; |
167 | /** | 167 | /** |
168 | Delete event from calendar. | 168 | Delete event from calendar. |
169 | */ | 169 | */ |
170 | virtual void deleteEvent( Event * ) = 0; | 170 | virtual void deleteEvent( Event * ) = 0; |
171 | /** | 171 | /** |
172 | Retrieves an event on the basis of the unique string ID. | 172 | Retrieves an event on the basis of the unique string ID. |
173 | */ | 173 | */ |
174 | virtual Event *event( const QString &UniqueStr ) = 0; | 174 | virtual Event *event( const QString &UniqueStr ) = 0; |
175 | virtual Event *event( QString, QString ) = 0; | 175 | virtual Event *event( QString, QString ) = 0; |
176 | /** | 176 | /** |
177 | Builds and then returns a list of all events that match for the | 177 | Builds and then returns a list of all events that match for the |
178 | date specified. useful for dayView, etc. etc. | 178 | date specified. useful for dayView, etc. etc. |
179 | The calendar filter is applied. | 179 | The calendar filter is applied. |
180 | */ | 180 | */ |
181 | QPtrList<Event> events( const QDate &date, bool sorted = false); | 181 | QPtrList<Event> events( const QDate &date, bool sorted = false); |
182 | /** | 182 | /** |
183 | Get events, which occur on the given date. | 183 | Get events, which occur on the given date. |
184 | The calendar filter is applied. | 184 | The calendar filter is applied. |
185 | */ | 185 | */ |
186 | QPtrList<Event> events( const QDateTime &qdt ); | 186 | QPtrList<Event> events( const QDateTime &qdt ); |
187 | /** | 187 | /** |
188 | Get events in a range of dates. If inclusive is set to true, only events | 188 | Get events in a range of dates. If inclusive is set to true, only events |
189 | are returned, which are completely included in the range. | 189 | are returned, which are completely included in the range. |
190 | The calendar filter is applied. | 190 | The calendar filter is applied. |
191 | */ | 191 | */ |
192 | QPtrList<Event> events( const QDate &start, const QDate &end, | 192 | QPtrList<Event> events( const QDate &start, const QDate &end, |
193 | bool inclusive = false); | 193 | bool inclusive = false); |
194 | /** | 194 | /** |
195 | Return filtered list of all events in calendar. | 195 | Return filtered list of all events in calendar. |
196 | */ | 196 | */ |
197 | virtual QPtrList<Event> events(); | 197 | virtual QPtrList<Event> events(); |
198 | /** | 198 | /** |
199 | Return unfiltered list of all events in calendar. | 199 | Return unfiltered list of all events in calendar. |
200 | */ | 200 | */ |
201 | virtual QPtrList<Event> rawEvents() = 0; | 201 | virtual QPtrList<Event> rawEvents() = 0; |
202 | 202 | ||
203 | /** | 203 | /** |
204 | Add a todo to the todolist. | 204 | Add a todo to the todolist. |
205 | 205 | ||
206 | @return true on success, false on error. | 206 | @return true on success, false on error. |
207 | */ | 207 | */ |
208 | virtual bool addTodo( Todo *todo ) = 0; | 208 | virtual bool addTodo( Todo *todo ) = 0; |
209 | virtual bool addTodoNoDup( Todo *todo ) = 0; | 209 | virtual bool addTodoNoDup( Todo *todo ) = 0; |
210 | /** | 210 | /** |
211 | Remove a todo from the todolist. | 211 | Remove a todo from the todolist. |
212 | */ | 212 | */ |
213 | virtual void deleteTodo( Todo * ) = 0; | 213 | virtual void deleteTodo( Todo * ) = 0; |
214 | virtual void deleteJournal( Journal * ) = 0; | 214 | virtual void deleteJournal( Journal * ) = 0; |
215 | /** | 215 | /** |
216 | Return filterd list of todos. | 216 | Return filterd list of todos. |
217 | */ | 217 | */ |
218 | virtual QPtrList<Todo> todos(); | 218 | virtual QPtrList<Todo> todos(); |
219 | /** | 219 | /** |
220 | Searches todolist for an event with this unique string identifier, | 220 | Searches todolist for an event with this unique string identifier, |
221 | returns a pointer or null. | 221 | returns a pointer or null. |
222 | */ | 222 | */ |
223 | virtual Todo *todo( const QString &uid ) = 0; | 223 | virtual Todo *todo( const QString &uid ) = 0; |
224 | virtual Todo *todo( QString, QString ) = 0; | 224 | virtual Todo *todo( QString, QString ) = 0; |
225 | /** | 225 | /** |
226 | Returns list of todos due on the specified date. | 226 | Returns list of todos due on the specified date. |
227 | */ | 227 | */ |
228 | virtual QPtrList<Todo> todos( const QDate &date ) = 0; | 228 | virtual QPtrList<Todo> todos( const QDate &date ) = 0; |
229 | /** | 229 | /** |
230 | Return unfiltered list of todos. | 230 | Return unfiltered list of todos. |
231 | */ | 231 | */ |
232 | virtual QPtrList<Todo> rawTodos() = 0; | 232 | virtual QPtrList<Todo> rawTodos() = 0; |
233 | 233 | ||
234 | /** | 234 | /** |
235 | Add a Journal entry to calendar. | 235 | Add a Journal entry to calendar. |
236 | 236 | ||
237 | @return true on success, false on error. | 237 | @return true on success, false on error. |
238 | */ | 238 | */ |
239 | virtual bool addJournal( Journal * ) = 0; | 239 | virtual bool addJournal( Journal * ) = 0; |
240 | /** | 240 | /** |
241 | Return Journal for given date. | 241 | Return Journal for given date. |
242 | */ | 242 | */ |
243 | virtual Journal *journal( const QDate & ) = 0; | 243 | virtual Journal *journal( const QDate & ) = 0; |
244 | /** | 244 | /** |
245 | Return Journal with given UID. | 245 | Return Journal with given UID. |
246 | */ | 246 | */ |
247 | virtual Journal *journal( const QString &UID ) = 0; | 247 | virtual Journal *journal( const QString &UID ) = 0; |
248 | /** | 248 | /** |
249 | Return list of all Journal entries. | 249 | Return list of all Journal entries. |
250 | */ | 250 | */ |
251 | virtual QPtrList<Journal> journals() = 0; | 251 | virtual QPtrList<Journal> journals() = 0; |
252 | 252 | ||
253 | /** | 253 | /** |
254 | Searches all incidence types for an incidence with this unique | 254 | Searches all incidence types for an incidence with this unique |
255 | string identifier, returns a pointer or null. | 255 | string identifier, returns a pointer or null. |
256 | */ | 256 | */ |
257 | Incidence* incidence( const QString&UID ); | 257 | Incidence* incidence( const QString&UID ); |
258 | 258 | ||
259 | /** | 259 | /** |
260 | Setup relations for an incidence. | 260 | Setup relations for an incidence. |
261 | */ | 261 | */ |
262 | virtual void setupRelations( Incidence * ); | 262 | virtual void setupRelations( Incidence * ); |
263 | /** | 263 | /** |
264 | Remove all relations to an incidence | 264 | Remove all relations to an incidence |
265 | */ | 265 | */ |
266 | virtual void removeRelations( Incidence * ); | 266 | virtual void removeRelations( Incidence * ); |
267 | 267 | ||
268 | /** | 268 | /** |
269 | Set calendar filter, which filters events for the events() functions. | 269 | Set calendar filter, which filters events for the events() functions. |
270 | The Filter object is owned by the caller. | 270 | The Filter object is owned by the caller. |
271 | */ | 271 | */ |
272 | void setFilter( CalFilter * ); | 272 | void setFilter( CalFilter * ); |
273 | /** | 273 | /** |
274 | Return calendar filter. | 274 | Return calendar filter. |
275 | */ | 275 | */ |
276 | CalFilter *filter(); | 276 | CalFilter *filter(); |
277 | virtual QDateTime nextAlarm( int daysTo ) = 0; | 277 | virtual QDateTime nextAlarm( int daysTo ) = 0; |
278 | virtual QString nextSummary( ) const = 0; | 278 | virtual QString nextSummary( ) const = 0; |
279 | virtual void reInitAlarmSettings() = 0; | 279 | virtual void reInitAlarmSettings() = 0; |
280 | virtual QDateTime nextAlarmEventDateTime() const = 0; | 280 | virtual QDateTime nextAlarmEventDateTime() const = 0; |
281 | virtual void checkAlarmForIncidence( Incidence *, bool ) = 0; | 281 | virtual void checkAlarmForIncidence( Incidence *, bool ) = 0; |
282 | /** | 282 | /** |
283 | Return all alarms, which ocur in the given time interval. | 283 | Return all alarms, which ocur in the given time interval. |
284 | */ | 284 | */ |
285 | virtual Alarm::List alarms( const QDateTime &from, | 285 | virtual Alarm::List alarms( const QDateTime &from, |
286 | const QDateTime &to ) = 0; | 286 | const QDateTime &to ) = 0; |
287 | 287 | ||
288 | class Observer { | 288 | class Observer { |
289 | public: | 289 | public: |
290 | virtual void calendarModified( bool, Calendar * ) = 0; | 290 | virtual void calendarModified( bool, Calendar * ) = 0; |
291 | }; | 291 | }; |
292 | 292 | ||
293 | void registerObserver( Observer * ); | 293 | void registerObserver( Observer * ); |
294 | 294 | ||
295 | void setModified( bool ); | 295 | void setModified( bool ); |
296 | 296 | ||
297 | /** | 297 | /** |
298 | Set product id returned by loadedProductId(). This function is only | 298 | Set product id returned by loadedProductId(). This function is only |
299 | useful for the calendar loading code. | 299 | useful for the calendar loading code. |
300 | */ | 300 | */ |
301 | void setLoadedProductId( const QString & ); | 301 | void setLoadedProductId( const QString & ); |
302 | /** | 302 | /** |
303 | Return product id taken from file that has been loaded. Returns | 303 | Return product id taken from file that has been loaded. Returns |
304 | QString::null, if no calendar has been loaded. | 304 | QString::null, if no calendar has been loaded. |
305 | */ | 305 | */ |
306 | QString loadedProductId(); | 306 | QString loadedProductId(); |
307 | int defaultCalendar(); | 307 | int defaultCalendar(); |
308 | void setDontDeleteIncidencesOnClose (); | 308 | void setDontDeleteIncidencesOnClose (); |
309 | public slots: | 309 | public slots: |
310 | void setDefaultCalendar( int ); | 310 | void setDefaultCalendar( int ); |
311 | virtual void setCalendarEnabled( int id, bool enable ) = 0; | 311 | virtual void setCalendarEnabled( int id, bool enable ) = 0; |
312 | virtual void setAlarmEnabled( int id, bool enable ) = 0; | 312 | virtual void setAlarmEnabled( int id, bool enable ) = 0; |
313 | virtual void setReadOnly( int id, bool enable ) = 0; | 313 | virtual void setReadOnly( int id, bool enable ) = 0; |
314 | virtual void setDefaultCalendarEnabledOnly() = 0; | 314 | virtual void setDefaultCalendarEnabledOnly() = 0; |
315 | virtual void setCalendarRemove( int id ) = 0; | ||
315 | signals: | 316 | signals: |
316 | void calendarChanged(); | 317 | void calendarChanged(); |
317 | void calendarSaved(); | 318 | void calendarSaved(); |
318 | void calendarLoaded(); | 319 | void calendarLoaded(); |
319 | void addAlarm(const QDateTime &qdt, const QString ¬i ); | 320 | void addAlarm(const QDateTime &qdt, const QString ¬i ); |
320 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); | 321 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); |
321 | 322 | ||
322 | protected: | 323 | protected: |
323 | /** | 324 | /** |
324 | Get unfiltered events, which occur on the given date. | 325 | Get unfiltered events, which occur on the given date. |
325 | */ | 326 | */ |
326 | virtual QPtrList<Event> rawEventsForDate( const QDateTime &qdt ) = 0; | 327 | virtual QPtrList<Event> rawEventsForDate( const QDateTime &qdt ) = 0; |
327 | /** | 328 | /** |
328 | Get unfiltered events, which occur on the given date. | 329 | Get unfiltered events, which occur on the given date. |
329 | */ | 330 | */ |
330 | virtual QPtrList<Event> rawEventsForDate( const QDate &date, | 331 | virtual QPtrList<Event> rawEventsForDate( const QDate &date, |
331 | bool sorted = false ) = 0; | 332 | bool sorted = false ) = 0; |
332 | /** | 333 | /** |
333 | Get events in a range of dates. If inclusive is set to true, only events | 334 | Get events in a range of dates. If inclusive is set to true, only events |
334 | are returned, which are completely included in the range. | 335 | are returned, which are completely included in the range. |
335 | */ | 336 | */ |
336 | virtual QPtrList<Event> rawEvents( const QDate &start, const QDate &end, | 337 | virtual QPtrList<Event> rawEvents( const QDate &start, const QDate &end, |
337 | bool inclusive = false ) = 0; | 338 | bool inclusive = false ) = 0; |
338 | 339 | ||
339 | Incidence *mNextAlarmIncidence; | 340 | Incidence *mNextAlarmIncidence; |
340 | Incidence *mUndoIncidence; | 341 | Incidence *mUndoIncidence; |
341 | int mDefaultCalendar; | 342 | int mDefaultCalendar; |
342 | bool mDeleteIncidencesOnClose; | 343 | bool mDeleteIncidencesOnClose; |
343 | 344 | ||
344 | private: | 345 | private: |
345 | void init(); | 346 | void init(); |
346 | 347 | ||
347 | QString mOwner; // who the calendar belongs to | 348 | QString mOwner; // who the calendar belongs to |
348 | QString mOwnerEmail; // email address of the owner | 349 | QString mOwnerEmail; // email address of the owner |
349 | int mTimeZone; // timezone OFFSET from GMT (MINUTES) | 350 | int mTimeZone; // timezone OFFSET from GMT (MINUTES) |
350 | bool mLocalTime; // use local time, not UTC or a time zone | 351 | bool mLocalTime; // use local time, not UTC or a time zone |
351 | 352 | ||
352 | 353 | ||
353 | CalFilter *mFilter; | 354 | CalFilter *mFilter; |
354 | CalFilter *mDefaultFilter; | 355 | CalFilter *mDefaultFilter; |
355 | 356 | ||
356 | 357 | ||
357 | QString mTimeZoneId; | 358 | QString mTimeZoneId; |
358 | 359 | ||
359 | Observer *mObserver; | 360 | Observer *mObserver; |
360 | bool mNewObserver; | 361 | bool mNewObserver; |
361 | 362 | ||
362 | bool mModified; | 363 | bool mModified; |
363 | 364 | ||
364 | QString mLoadedProductId; | 365 | QString mLoadedProductId; |
365 | 366 | ||
366 | // This list is used to put together related todos | 367 | // This list is used to put together related todos |
367 | QDict<Incidence> mOrphans; | 368 | QDict<Incidence> mOrphans; |
368 | QDict<Incidence> mOrphanUids; | 369 | QDict<Incidence> mOrphanUids; |
369 | }; | 370 | }; |
370 | 371 | ||
371 | } | 372 | } |
372 | 373 | ||
373 | #endif | 374 | #endif |
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index e48122a..749d9f6 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -1,834 +1,890 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | 3 | ||
4 | Copyright (c) 1998 Preston Brown | 4 | Copyright (c) 1998 Preston Brown |
5 | Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org> | 5 | Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org> |
6 | 6 | ||
7 | This library is free software; you can redistribute it and/or | 7 | This library is free software; you can redistribute it and/or |
8 | modify it under the terms of the GNU Library General Public | 8 | modify it under the terms of the GNU Library General Public |
9 | License as published by the Free Software Foundation; either | 9 | License as published by the Free Software Foundation; either |
10 | version 2 of the License, or (at your option) any later version. | 10 | version 2 of the License, or (at your option) any later version. |
11 | 11 | ||
12 | This library is distributed in the hope that it will be useful, | 12 | This library is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | Library General Public License for more details. | 15 | Library General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU Library General Public License | 17 | You should have received a copy of the GNU Library General Public License |
18 | along with this library; see the file COPYING.LIB. If not, write to | 18 | along with this library; see the file COPYING.LIB. If not, write to |
19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
20 | Boston, MA 02111-1307, USA. | 20 | Boston, MA 02111-1307, USA. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <qdatetime.h> | 23 | #include <qdatetime.h> |
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | #include <qptrlist.h> | 25 | #include <qptrlist.h> |
26 | 26 | ||
27 | #include <kdebug.h> | 27 | #include <kdebug.h> |
28 | #include <kconfig.h> | 28 | #include <kconfig.h> |
29 | #include <kglobal.h> | 29 | #include <kglobal.h> |
30 | #include <klocale.h> | 30 | #include <klocale.h> |
31 | 31 | ||
32 | #include "vcaldrag.h" | 32 | #include "vcaldrag.h" |
33 | #include "vcalformat.h" | 33 | #include "vcalformat.h" |
34 | #include "icalformat.h" | 34 | #include "icalformat.h" |
35 | #include "exceptions.h" | 35 | #include "exceptions.h" |
36 | #include "incidence.h" | 36 | #include "incidence.h" |
37 | #include "journal.h" | 37 | #include "journal.h" |
38 | #include "filestorage.h" | 38 | #include "filestorage.h" |
39 | #include "calfilter.h" | 39 | #include "calfilter.h" |
40 | 40 | ||
41 | #include "calendarlocal.h" | 41 | #include "calendarlocal.h" |
42 | 42 | ||
43 | // #ifndef DESKTOP_VERSION | 43 | // #ifndef DESKTOP_VERSION |
44 | // #include <qtopia/alarmserver.h> | 44 | // #include <qtopia/alarmserver.h> |
45 | // #endif | 45 | // #endif |
46 | using namespace KCal; | 46 | using namespace KCal; |
47 | 47 | ||
48 | CalendarLocal::CalendarLocal() | 48 | CalendarLocal::CalendarLocal() |
49 | : Calendar() | 49 | : Calendar() |
50 | { | 50 | { |
51 | init(); | 51 | init(); |
52 | } | 52 | } |
53 | 53 | ||
54 | CalendarLocal::CalendarLocal(const QString &timeZoneId) | 54 | CalendarLocal::CalendarLocal(const QString &timeZoneId) |
55 | : Calendar(timeZoneId) | 55 | : Calendar(timeZoneId) |
56 | { | 56 | { |
57 | init(); | 57 | init(); |
58 | } | 58 | } |
59 | 59 | ||
60 | void CalendarLocal::init() | 60 | void CalendarLocal::init() |
61 | { | 61 | { |
62 | mNextAlarmIncidence = 0; | 62 | mNextAlarmIncidence = 0; |
63 | } | 63 | } |
64 | 64 | ||
65 | 65 | ||
66 | CalendarLocal::~CalendarLocal() | 66 | CalendarLocal::~CalendarLocal() |
67 | { | 67 | { |
68 | if ( mDeleteIncidencesOnClose ) | 68 | if ( mDeleteIncidencesOnClose ) |
69 | close(); | 69 | close(); |
70 | } | 70 | } |
71 | bool CalendarLocal::addCalendarFile( QString name, int id ) | 71 | bool CalendarLocal::addCalendarFile( QString name, int id ) |
72 | { | 72 | { |
73 | CalendarLocal calendar( timeZoneId() ); | 73 | CalendarLocal calendar( timeZoneId() ); |
74 | calendar.setDefaultCalendar( id ); | 74 | calendar.setDefaultCalendar( id ); |
75 | if ( calendar.load( name ) ) { | 75 | if ( calendar.load( name ) ) { |
76 | addCalendar( &calendar ); | 76 | addCalendar( &calendar ); |
77 | return true; | 77 | return true; |
78 | } | 78 | } |
79 | return false; | 79 | return false; |
80 | } | 80 | } |
81 | void CalendarLocal::addCalendar( Calendar* cal ) | 81 | void CalendarLocal::addCalendar( Calendar* cal ) |
82 | { | 82 | { |
83 | cal->setDontDeleteIncidencesOnClose(); | 83 | cal->setDontDeleteIncidencesOnClose(); |
84 | { | 84 | { |
85 | QPtrList<Event> EventList = cal->rawEvents(); | 85 | QPtrList<Event> EventList = cal->rawEvents(); |
86 | Event * ev = EventList.first(); | 86 | Event * ev = EventList.first(); |
87 | while ( ev ) { | 87 | while ( ev ) { |
88 | ev->unRegisterObserver( cal ); | ||
89 | ev->registerObserver( this ); | ||
88 | mEventList.append( ev ); | 90 | mEventList.append( ev ); |
89 | ev = EventList.next(); | 91 | ev = EventList.next(); |
90 | } | 92 | } |
91 | } | 93 | } |
92 | { | 94 | { |
95 | |||
93 | QPtrList<Todo> TodoList = cal->rawTodos(); | 96 | QPtrList<Todo> TodoList = cal->rawTodos(); |
94 | Todo * ev = TodoList.first(); | 97 | Todo * ev = TodoList.first(); |
95 | while ( ev ) { | 98 | while ( ev ) { |
99 | QString rel = ev->relatedToUid(); | ||
100 | if ( !rel.isEmpty() ){ | ||
101 | ev->setRelatedTo ( 0 ); | ||
102 | ev->setRelatedToUid( rel ); | ||
103 | } | ||
104 | ev = TodoList.next(); | ||
105 | } | ||
106 | //TodoList = cal->rawTodos(); | ||
107 | ev = TodoList.first(); | ||
108 | while ( ev ) { | ||
109 | ev->unRegisterObserver( cal ); | ||
110 | ev->registerObserver( this ); | ||
96 | mTodoList.append( ev ); | 111 | mTodoList.append( ev ); |
112 | setupRelations( ev ); | ||
97 | ev = TodoList.next(); | 113 | ev = TodoList.next(); |
98 | } | 114 | } |
99 | } | 115 | } |
100 | { | 116 | { |
101 | QPtrList<Journal> JournalList = cal->journals(); | 117 | QPtrList<Journal> JournalList = cal->journals(); |
102 | Journal * ev = JournalList.first(); | 118 | Journal * ev = JournalList.first(); |
103 | while ( ev ) { | 119 | while ( ev ) { |
120 | ev->unRegisterObserver( cal ); | ||
121 | ev->registerObserver( this ); | ||
104 | mJournalList.append( ev ); | 122 | mJournalList.append( ev ); |
105 | ev = JournalList.next(); | 123 | ev = JournalList.next(); |
106 | } | 124 | } |
107 | } | 125 | } |
126 | setModified( true ); | ||
108 | } | 127 | } |
109 | bool CalendarLocal::load( const QString &fileName ) | 128 | bool CalendarLocal::load( const QString &fileName ) |
110 | { | 129 | { |
111 | FileStorage storage( this, fileName ); | 130 | FileStorage storage( this, fileName ); |
112 | return storage.load(); | 131 | return storage.load(); |
113 | } | 132 | } |
114 | 133 | ||
115 | bool CalendarLocal::save( const QString &fileName, CalFormat *format ) | 134 | bool CalendarLocal::save( const QString &fileName, CalFormat *format ) |
116 | { | 135 | { |
117 | FileStorage storage( this, fileName, format ); | 136 | FileStorage storage( this, fileName, format ); |
118 | return storage.save(); | 137 | return storage.save(); |
119 | } | 138 | } |
120 | 139 | ||
121 | void CalendarLocal::close() | 140 | void CalendarLocal::close() |
122 | { | 141 | { |
123 | 142 | ||
124 | Todo * i; | 143 | Todo * i; |
125 | for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false); | 144 | for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false); |
126 | 145 | ||
127 | mEventList.setAutoDelete( true ); | 146 | mEventList.setAutoDelete( true ); |
128 | mTodoList.setAutoDelete( true ); | 147 | mTodoList.setAutoDelete( true ); |
129 | mJournalList.setAutoDelete( false ); | 148 | mJournalList.setAutoDelete( false ); |
130 | 149 | ||
131 | mEventList.clear(); | 150 | mEventList.clear(); |
132 | mTodoList.clear(); | 151 | mTodoList.clear(); |
133 | mJournalList.clear(); | 152 | mJournalList.clear(); |
134 | 153 | ||
135 | mEventList.setAutoDelete( false ); | 154 | mEventList.setAutoDelete( false ); |
136 | mTodoList.setAutoDelete( false ); | 155 | mTodoList.setAutoDelete( false ); |
137 | mJournalList.setAutoDelete( false ); | 156 | mJournalList.setAutoDelete( false ); |
138 | 157 | ||
139 | setModified( false ); | 158 | setModified( false ); |
140 | } | 159 | } |
141 | 160 | ||
142 | bool CalendarLocal::addAnniversaryNoDup( Event *event ) | 161 | bool CalendarLocal::addAnniversaryNoDup( Event *event ) |
143 | { | 162 | { |
144 | QString cat; | 163 | QString cat; |
145 | bool isBirthday = true; | 164 | bool isBirthday = true; |
146 | if( event->categoriesStr() == i18n( "Anniversary" ) ) { | 165 | if( event->categoriesStr() == i18n( "Anniversary" ) ) { |
147 | isBirthday = false; | 166 | isBirthday = false; |
148 | cat = i18n( "Anniversary" ); | 167 | cat = i18n( "Anniversary" ); |
149 | } else if( event->categoriesStr() == i18n( "Birthday" ) ) { | 168 | } else if( event->categoriesStr() == i18n( "Birthday" ) ) { |
150 | isBirthday = true; | 169 | isBirthday = true; |
151 | cat = i18n( "Birthday" ); | 170 | cat = i18n( "Birthday" ); |
152 | } else { | 171 | } else { |
153 | qDebug("addAnniversaryNoDup called without fitting category! "); | 172 | qDebug("addAnniversaryNoDup called without fitting category! "); |
154 | return false; | 173 | return false; |
155 | } | 174 | } |
156 | Event * eve; | 175 | Event * eve; |
157 | for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { | 176 | for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { |
158 | if ( !(eve->categories().contains( cat ) )) | 177 | if ( !(eve->categories().contains( cat ) )) |
159 | continue; | 178 | continue; |
160 | // now we have an event with fitting category | 179 | // now we have an event with fitting category |
161 | if ( eve->dtStart().date() != event->dtStart().date() ) | 180 | if ( eve->dtStart().date() != event->dtStart().date() ) |
162 | continue; | 181 | continue; |
163 | // now we have an event with fitting category+date | 182 | // now we have an event with fitting category+date |
164 | if ( eve->summary() != event->summary() ) | 183 | if ( eve->summary() != event->summary() ) |
165 | continue; | 184 | continue; |
166 | // now we have an event with fitting category+date+summary | 185 | // now we have an event with fitting category+date+summary |
167 | return false; | 186 | return false; |
168 | } | 187 | } |
169 | return addEvent( event ); | 188 | return addEvent( event ); |
170 | 189 | ||
171 | } | 190 | } |
172 | bool CalendarLocal::addEventNoDup( Event *event ) | 191 | bool CalendarLocal::addEventNoDup( Event *event ) |
173 | { | 192 | { |
174 | Event * eve; | 193 | Event * eve; |
175 | for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { | 194 | for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { |
176 | if ( *eve == *event ) { | 195 | if ( *eve == *event ) { |
177 | //qDebug("CalendarLocal::Duplicate event found! Not inserted! "); | 196 | //qDebug("CalendarLocal::Duplicate event found! Not inserted! "); |
178 | return false; | 197 | return false; |
179 | } | 198 | } |
180 | } | 199 | } |
181 | return addEvent( event ); | 200 | return addEvent( event ); |
182 | } | 201 | } |
183 | 202 | ||
184 | bool CalendarLocal::addEvent( Event *event ) | 203 | bool CalendarLocal::addEvent( Event *event ) |
185 | { | 204 | { |
186 | insertEvent( event ); | 205 | insertEvent( event ); |
187 | 206 | ||
188 | event->registerObserver( this ); | 207 | event->registerObserver( this ); |
189 | 208 | ||
190 | setModified( true ); | 209 | setModified( true ); |
191 | event->setCalID( mDefaultCalendar ); | 210 | event->setCalID( mDefaultCalendar ); |
192 | event->setCalEnabled( true ); | 211 | event->setCalEnabled( true ); |
193 | 212 | ||
194 | return true; | 213 | return true; |
195 | } | 214 | } |
196 | 215 | ||
197 | void CalendarLocal::deleteEvent( Event *event ) | 216 | void CalendarLocal::deleteEvent( Event *event ) |
198 | { | 217 | { |
199 | if ( mUndoIncidence ) delete mUndoIncidence; | 218 | if ( mUndoIncidence ) delete mUndoIncidence; |
200 | mUndoIncidence = event->clone(); | 219 | mUndoIncidence = event->clone(); |
201 | if ( mEventList.removeRef( event ) ) { | 220 | if ( mEventList.removeRef( event ) ) { |
202 | setModified( true ); | 221 | setModified( true ); |
203 | } | 222 | } |
204 | } | 223 | } |
205 | 224 | ||
206 | 225 | ||
207 | Event *CalendarLocal::event( const QString &uid ) | 226 | Event *CalendarLocal::event( const QString &uid ) |
208 | { | 227 | { |
209 | 228 | ||
210 | Event *event; | 229 | Event *event; |
211 | 230 | ||
212 | for ( event = mEventList.first(); event; event = mEventList.next() ) { | 231 | for ( event = mEventList.first(); event; event = mEventList.next() ) { |
213 | if ( event->uid() == uid && event->calEnabled() ) { | 232 | if ( event->uid() == uid && event->calEnabled() ) { |
214 | return event; | 233 | return event; |
215 | } | 234 | } |
216 | } | 235 | } |
217 | 236 | ||
218 | return 0; | 237 | return 0; |
219 | } | 238 | } |
220 | bool CalendarLocal::addTodoNoDup( Todo *todo ) | 239 | bool CalendarLocal::addTodoNoDup( Todo *todo ) |
221 | { | 240 | { |
222 | Todo * eve; | 241 | Todo * eve; |
223 | for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) { | 242 | for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) { |
224 | if ( *eve == *todo ) { | 243 | if ( *eve == *todo ) { |
225 | //qDebug("duplicate todo found! not inserted! "); | 244 | //qDebug("duplicate todo found! not inserted! "); |
226 | return false; | 245 | return false; |
227 | } | 246 | } |
228 | } | 247 | } |
229 | return addTodo( todo ); | 248 | return addTodo( todo ); |
230 | } | 249 | } |
231 | bool CalendarLocal::addTodo( Todo *todo ) | 250 | bool CalendarLocal::addTodo( Todo *todo ) |
232 | { | 251 | { |
233 | mTodoList.append( todo ); | 252 | mTodoList.append( todo ); |
234 | 253 | ||
235 | todo->registerObserver( this ); | 254 | todo->registerObserver( this ); |
236 | 255 | ||
237 | // Set up subtask relations | 256 | // Set up subtask relations |
238 | setupRelations( todo ); | 257 | setupRelations( todo ); |
239 | 258 | ||
240 | setModified( true ); | 259 | setModified( true ); |
241 | todo->setCalID( mDefaultCalendar ); | 260 | todo->setCalID( mDefaultCalendar ); |
242 | todo->setCalEnabled( true ); | 261 | todo->setCalEnabled( true ); |
243 | return true; | 262 | return true; |
244 | } | 263 | } |
245 | 264 | ||
246 | void CalendarLocal::deleteTodo( Todo *todo ) | 265 | void CalendarLocal::deleteTodo( Todo *todo ) |
247 | { | 266 | { |
248 | // Handle orphaned children | 267 | // Handle orphaned children |
249 | if ( mUndoIncidence ) delete mUndoIncidence; | 268 | if ( mUndoIncidence ) delete mUndoIncidence; |
250 | removeRelations( todo ); | 269 | removeRelations( todo ); |
251 | mUndoIncidence = todo->clone(); | 270 | mUndoIncidence = todo->clone(); |
252 | 271 | ||
253 | if ( mTodoList.removeRef( todo ) ) { | 272 | if ( mTodoList.removeRef( todo ) ) { |
254 | setModified( true ); | 273 | setModified( true ); |
255 | } | 274 | } |
256 | } | 275 | } |
257 | 276 | ||
258 | QPtrList<Todo> CalendarLocal::rawTodos() | 277 | QPtrList<Todo> CalendarLocal::rawTodos() |
259 | { | 278 | { |
260 | QPtrList<Todo> el; | 279 | QPtrList<Todo> el; |
261 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | 280 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) |
262 | if ( it->calEnabled() ) el.append( it ); | 281 | if ( it->calEnabled() ) el.append( it ); |
263 | return el; | 282 | return el; |
264 | } | 283 | } |
265 | Todo *CalendarLocal::todo( QString syncProf, QString id ) | 284 | Todo *CalendarLocal::todo( QString syncProf, QString id ) |
266 | { | 285 | { |
267 | Todo *todo; | 286 | Todo *todo; |
268 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 287 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
269 | if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo; | 288 | if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo; |
270 | } | 289 | } |
271 | 290 | ||
272 | return 0; | 291 | return 0; |
273 | } | 292 | } |
274 | void CalendarLocal::removeSyncInfo( QString syncProfile) | 293 | void CalendarLocal::removeSyncInfo( QString syncProfile) |
275 | { | 294 | { |
276 | QPtrList<Incidence> all = rawIncidences() ; | 295 | QPtrList<Incidence> all = rawIncidences() ; |
277 | Incidence *inc; | 296 | Incidence *inc; |
278 | for ( inc = all.first(); inc; inc = all.next() ) { | 297 | for ( inc = all.first(); inc; inc = all.next() ) { |
279 | inc->removeID( syncProfile ); | 298 | inc->removeID( syncProfile ); |
280 | } | 299 | } |
281 | if ( syncProfile.isEmpty() ) { | 300 | if ( syncProfile.isEmpty() ) { |
282 | QPtrList<Event> el; | 301 | QPtrList<Event> el; |
283 | Event *todo; | 302 | Event *todo; |
284 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | 303 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { |
285 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) | 304 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) |
286 | el.append( todo ); | 305 | el.append( todo ); |
287 | } | 306 | } |
288 | for ( todo = el.first(); todo; todo = el.next() ) { | 307 | for ( todo = el.first(); todo; todo = el.next() ) { |
289 | deleteIncidence ( todo ); | 308 | deleteIncidence ( todo ); |
290 | } | 309 | } |
291 | } else { | 310 | } else { |
292 | Event *lse = event( "last-syncEvent-"+ syncProfile); | 311 | Event *lse = event( "last-syncEvent-"+ syncProfile); |
293 | if ( lse ) | 312 | if ( lse ) |
294 | deleteIncidence ( lse ); | 313 | deleteIncidence ( lse ); |
295 | } | 314 | } |
296 | } | 315 | } |
297 | QPtrList<Event> CalendarLocal::getExternLastSyncEvents() | 316 | QPtrList<Event> CalendarLocal::getExternLastSyncEvents() |
298 | { | 317 | { |
299 | QPtrList<Event> el; | 318 | QPtrList<Event> el; |
300 | Event *todo; | 319 | Event *todo; |
301 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | 320 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { |
302 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) | 321 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) |
303 | if ( todo->summary().left(3) == "E: " ) | 322 | if ( todo->summary().left(3) == "E: " ) |
304 | el.append( todo ); | 323 | el.append( todo ); |
305 | } | 324 | } |
306 | 325 | ||
307 | return el; | 326 | return el; |
308 | 327 | ||
309 | } | 328 | } |
310 | Event *CalendarLocal::event( QString syncProf, QString id ) | 329 | Event *CalendarLocal::event( QString syncProf, QString id ) |
311 | { | 330 | { |
312 | Event *todo; | 331 | Event *todo; |
313 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | 332 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { |
314 | if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo; | 333 | if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo; |
315 | } | 334 | } |
316 | 335 | ||
317 | return 0; | 336 | return 0; |
318 | } | 337 | } |
319 | Todo *CalendarLocal::todo( const QString &uid ) | 338 | Todo *CalendarLocal::todo( const QString &uid ) |
320 | { | 339 | { |
321 | Todo *todo; | 340 | Todo *todo; |
322 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 341 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
323 | if ( todo->calEnabled() && todo->uid() == uid ) return todo; | 342 | if ( todo->calEnabled() && todo->uid() == uid ) return todo; |
324 | } | 343 | } |
325 | 344 | ||
326 | return 0; | 345 | return 0; |
327 | } | 346 | } |
328 | QString CalendarLocal::nextSummary() const | 347 | QString CalendarLocal::nextSummary() const |
329 | { | 348 | { |
330 | return mNextSummary; | 349 | return mNextSummary; |
331 | } | 350 | } |
332 | QDateTime CalendarLocal::nextAlarmEventDateTime() const | 351 | QDateTime CalendarLocal::nextAlarmEventDateTime() const |
333 | { | 352 | { |
334 | return mNextAlarmEventDateTime; | 353 | return mNextAlarmEventDateTime; |
335 | } | 354 | } |
336 | void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted) | 355 | void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted) |
337 | { | 356 | { |
338 | //mNextAlarmIncidence | 357 | //mNextAlarmIncidence |
339 | //mNextAlarmDateTime | 358 | //mNextAlarmDateTime |
340 | //return mNextSummary; | 359 | //return mNextSummary; |
341 | //return mNextAlarmEventDateTime; | 360 | //return mNextAlarmEventDateTime; |
342 | bool newNextAlarm = false; | 361 | bool newNextAlarm = false; |
343 | bool computeNextAlarm = false; | 362 | bool computeNextAlarm = false; |
344 | bool ok; | 363 | bool ok; |
345 | int offset; | 364 | int offset; |
346 | QDateTime nextA; | 365 | QDateTime nextA; |
347 | // QString nextSum; | 366 | // QString nextSum; |
348 | //QDateTime nextEvent; | 367 | //QDateTime nextEvent; |
349 | if ( mNextAlarmIncidence == 0 || incidence == 0 ) { | 368 | if ( mNextAlarmIncidence == 0 || incidence == 0 ) { |
350 | computeNextAlarm = true; | 369 | computeNextAlarm = true; |
351 | } else { | 370 | } else { |
352 | if ( ! deleted ) { | 371 | if ( ! deleted ) { |
353 | nextA = incidence->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; | 372 | nextA = incidence->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; |
354 | if ( ok ) { | 373 | if ( ok ) { |
355 | if ( nextA < mNextAlarmDateTime ) { | 374 | if ( nextA < mNextAlarmDateTime ) { |
356 | deRegisterAlarm(); | 375 | deRegisterAlarm(); |
357 | mNextAlarmDateTime = nextA; | 376 | mNextAlarmDateTime = nextA; |
358 | mNextSummary = incidence->summary(); | 377 | mNextSummary = incidence->summary(); |
359 | mNextAlarmEventDateTime = nextA.addSecs(offset ) ; | 378 | mNextAlarmEventDateTime = nextA.addSecs(offset ) ; |
360 | mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); | 379 | mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); |
361 | newNextAlarm = true; | 380 | newNextAlarm = true; |
362 | mNextAlarmIncidence = incidence; | 381 | mNextAlarmIncidence = incidence; |
363 | } else { | 382 | } else { |
364 | if ( incidence == mNextAlarmIncidence ) { | 383 | if ( incidence == mNextAlarmIncidence ) { |
365 | computeNextAlarm = true; | 384 | computeNextAlarm = true; |
366 | } | 385 | } |
367 | } | 386 | } |
368 | } else { | 387 | } else { |
369 | if ( mNextAlarmIncidence == incidence ) { | 388 | if ( mNextAlarmIncidence == incidence ) { |
370 | computeNextAlarm = true; | 389 | computeNextAlarm = true; |
371 | } | 390 | } |
372 | } | 391 | } |
373 | } else { // deleted | 392 | } else { // deleted |
374 | if ( incidence == mNextAlarmIncidence ) { | 393 | if ( incidence == mNextAlarmIncidence ) { |
375 | computeNextAlarm = true; | 394 | computeNextAlarm = true; |
376 | } | 395 | } |
377 | } | 396 | } |
378 | } | 397 | } |
379 | if ( computeNextAlarm ) { | 398 | if ( computeNextAlarm ) { |
380 | deRegisterAlarm(); | 399 | deRegisterAlarm(); |
381 | nextA = nextAlarm( 1000 ); | 400 | nextA = nextAlarm( 1000 ); |
382 | if (! mNextAlarmIncidence ) { | 401 | if (! mNextAlarmIncidence ) { |
383 | return; | 402 | return; |
384 | } | 403 | } |
385 | newNextAlarm = true; | 404 | newNextAlarm = true; |
386 | } | 405 | } |
387 | if ( newNextAlarm ) | 406 | if ( newNextAlarm ) |
388 | registerAlarm(); | 407 | registerAlarm(); |
389 | } | 408 | } |
390 | QString CalendarLocal:: getAlarmNotification() | 409 | QString CalendarLocal:: getAlarmNotification() |
391 | { | 410 | { |
392 | QString ret; | 411 | QString ret; |
393 | // this should not happen | 412 | // this should not happen |
394 | if (! mNextAlarmIncidence ) | 413 | if (! mNextAlarmIncidence ) |
395 | return "cal_alarm"+ mNextSummary.left( 25 )+"\n"+mNextAlarmEventDateTimeString; | 414 | return "cal_alarm"+ mNextSummary.left( 25 )+"\n"+mNextAlarmEventDateTimeString; |
396 | Alarm* alarm = mNextAlarmIncidence->alarms().first(); | 415 | Alarm* alarm = mNextAlarmIncidence->alarms().first(); |
397 | if ( alarm->type() == Alarm::Procedure ) { | 416 | if ( alarm->type() == Alarm::Procedure ) { |
398 | ret = "proc_alarm" + alarm->programFile()+"+++"; | 417 | ret = "proc_alarm" + alarm->programFile()+"+++"; |
399 | } else { | 418 | } else { |
400 | ret = "audio_alarm" +alarm->audioFile() +"+++"; | 419 | ret = "audio_alarm" +alarm->audioFile() +"+++"; |
401 | } | 420 | } |
402 | ret += "cal_alarm"+ mNextSummary.left( 25 ); | 421 | ret += "cal_alarm"+ mNextSummary.left( 25 ); |
403 | if ( mNextSummary.length() > 25 ) | 422 | if ( mNextSummary.length() > 25 ) |
404 | ret += "\n" + mNextSummary.mid(25, 25 ); | 423 | ret += "\n" + mNextSummary.mid(25, 25 ); |
405 | ret+= "\n"+mNextAlarmEventDateTimeString; | 424 | ret+= "\n"+mNextAlarmEventDateTimeString; |
406 | return ret; | 425 | return ret; |
407 | } | 426 | } |
408 | void CalendarLocal::registerAlarm() | 427 | void CalendarLocal::registerAlarm() |
409 | { | 428 | { |
410 | mLastAlarmNotificationString = getAlarmNotification(); | 429 | mLastAlarmNotificationString = getAlarmNotification(); |
411 | // qDebug("++ register Alarm %s %s",mNextAlarmDateTime.toString().latin1(), mLastAlarmNotificationString.latin1() ); | 430 | // qDebug("++ register Alarm %s %s",mNextAlarmDateTime.toString().latin1(), mLastAlarmNotificationString.latin1() ); |
412 | emit addAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString ); | 431 | emit addAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString ); |
413 | // #ifndef DESKTOP_VERSION | 432 | // #ifndef DESKTOP_VERSION |
414 | // AlarmServer::addAlarm ( mNextAlarmDateTime,"koalarm", mLastAlarmNotificationString.latin1() ); | 433 | // AlarmServer::addAlarm ( mNextAlarmDateTime,"koalarm", mLastAlarmNotificationString.latin1() ); |
415 | // #endif | 434 | // #endif |
416 | } | 435 | } |
417 | void CalendarLocal::deRegisterAlarm() | 436 | void CalendarLocal::deRegisterAlarm() |
418 | { | 437 | { |
419 | if ( mLastAlarmNotificationString.isNull() ) | 438 | if ( mLastAlarmNotificationString.isNull() ) |
420 | return; | 439 | return; |
421 | //qDebug("-- deregister Alarm %s ", mLastAlarmNotificationString.latin1() ); | 440 | //qDebug("-- deregister Alarm %s ", mLastAlarmNotificationString.latin1() ); |
422 | 441 | ||
423 | emit removeAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString ); | 442 | emit removeAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString ); |
424 | mNextAlarmEventDateTime = QDateTime(); | 443 | mNextAlarmEventDateTime = QDateTime(); |
425 | // #ifndef DESKTOP_VERSION | 444 | // #ifndef DESKTOP_VERSION |
426 | // AlarmServer::deleteAlarm (mNextAlarmDateTime ,"koalarm" ,mLastAlarmNotificationString.latin1() ); | 445 | // AlarmServer::deleteAlarm (mNextAlarmDateTime ,"koalarm" ,mLastAlarmNotificationString.latin1() ); |
427 | // #endif | 446 | // #endif |
428 | } | 447 | } |
429 | 448 | ||
430 | QPtrList<Todo> CalendarLocal::todos( const QDate &date ) | 449 | QPtrList<Todo> CalendarLocal::todos( const QDate &date ) |
431 | { | 450 | { |
432 | QPtrList<Todo> todos; | 451 | QPtrList<Todo> todos; |
433 | 452 | ||
434 | Todo *todo; | 453 | Todo *todo; |
435 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 454 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
436 | if ( !todo->calEnabled() ) continue; | 455 | if ( !todo->calEnabled() ) continue; |
437 | if ( todo->hasDueDate() && todo->dtDue().date() == date ) { | 456 | if ( todo->hasDueDate() && todo->dtDue().date() == date ) { |
438 | todos.append( todo ); | 457 | todos.append( todo ); |
439 | } | 458 | } |
440 | } | 459 | } |
441 | 460 | ||
442 | filter()->apply( &todos ); | 461 | filter()->apply( &todos ); |
443 | return todos; | 462 | return todos; |
444 | } | 463 | } |
445 | void CalendarLocal::reInitAlarmSettings() | 464 | void CalendarLocal::reInitAlarmSettings() |
446 | { | 465 | { |
447 | if ( !mNextAlarmIncidence ) { | 466 | if ( !mNextAlarmIncidence ) { |
448 | nextAlarm( 1000 ); | 467 | nextAlarm( 1000 ); |
449 | } | 468 | } |
450 | deRegisterAlarm(); | 469 | deRegisterAlarm(); |
451 | mNextAlarmIncidence = 0; | 470 | mNextAlarmIncidence = 0; |
452 | checkAlarmForIncidence( 0, false ); | 471 | checkAlarmForIncidence( 0, false ); |
453 | 472 | ||
454 | } | 473 | } |
455 | 474 | ||
456 | 475 | ||
457 | 476 | ||
458 | QDateTime CalendarLocal::nextAlarm( int daysTo ) | 477 | QDateTime CalendarLocal::nextAlarm( int daysTo ) |
459 | { | 478 | { |
460 | QDateTime nextA = QDateTime::currentDateTime().addDays( daysTo ); | 479 | QDateTime nextA = QDateTime::currentDateTime().addDays( daysTo ); |
461 | QDateTime start = QDateTime::currentDateTime().addSecs( 30 ); | 480 | QDateTime start = QDateTime::currentDateTime().addSecs( 30 ); |
462 | QDateTime next; | 481 | QDateTime next; |
463 | Event *e; | 482 | Event *e; |
464 | bool ok; | 483 | bool ok; |
465 | bool found = false; | 484 | bool found = false; |
466 | int offset; | 485 | int offset; |
467 | mNextAlarmIncidence = 0; | 486 | mNextAlarmIncidence = 0; |
468 | for( e = mEventList.first(); e; e = mEventList.next() ) { | 487 | for( e = mEventList.first(); e; e = mEventList.next() ) { |
469 | if ( !e->calEnabled() ) continue; | 488 | if ( !e->calEnabled() ) continue; |
470 | next = e->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; | 489 | next = e->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; |
471 | if ( ok ) { | 490 | if ( ok ) { |
472 | if ( next < nextA ) { | 491 | if ( next < nextA ) { |
473 | nextA = next; | 492 | nextA = next; |
474 | found = true; | 493 | found = true; |
475 | mNextSummary = e->summary(); | 494 | mNextSummary = e->summary(); |
476 | mNextAlarmEventDateTime = next.addSecs(offset ) ; | 495 | mNextAlarmEventDateTime = next.addSecs(offset ) ; |
477 | mNextAlarmIncidence = (Incidence *) e; | 496 | mNextAlarmIncidence = (Incidence *) e; |
478 | } | 497 | } |
479 | } | 498 | } |
480 | } | 499 | } |
481 | Todo *t; | 500 | Todo *t; |
482 | for( t = mTodoList.first(); t; t = mTodoList.next() ) { | 501 | for( t = mTodoList.first(); t; t = mTodoList.next() ) { |
483 | if ( !t->calEnabled() ) continue; | 502 | if ( !t->calEnabled() ) continue; |
484 | next = t->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; | 503 | next = t->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; |
485 | if ( ok ) { | 504 | if ( ok ) { |
486 | if ( next < nextA ) { | 505 | if ( next < nextA ) { |
487 | nextA = next; | 506 | nextA = next; |
488 | found = true; | 507 | found = true; |
489 | mNextSummary = t->summary(); | 508 | mNextSummary = t->summary(); |
490 | mNextAlarmEventDateTime = next.addSecs(offset ); | 509 | mNextAlarmEventDateTime = next.addSecs(offset ); |
491 | mNextAlarmIncidence = (Incidence *) t; | 510 | mNextAlarmIncidence = (Incidence *) t; |
492 | } | 511 | } |
493 | } | 512 | } |
494 | } | 513 | } |
495 | if ( mNextAlarmIncidence ) { | 514 | if ( mNextAlarmIncidence ) { |
496 | mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); | 515 | mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); |
497 | mNextAlarmDateTime = nextA; | 516 | mNextAlarmDateTime = nextA; |
498 | } | 517 | } |
499 | return nextA; | 518 | return nextA; |
500 | } | 519 | } |
501 | Alarm::List CalendarLocal::alarmsTo( const QDateTime &to ) | 520 | Alarm::List CalendarLocal::alarmsTo( const QDateTime &to ) |
502 | { | 521 | { |
503 | return alarms( QDateTime( QDate( 1900, 1, 1 ) ), to ); | 522 | return alarms( QDateTime( QDate( 1900, 1, 1 ) ), to ); |
504 | } | 523 | } |
505 | 524 | ||
506 | Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to ) | 525 | Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to ) |
507 | { | 526 | { |
508 | 527 | ||
509 | Alarm::List alarms; | 528 | Alarm::List alarms; |
510 | 529 | ||
511 | Event *e; | 530 | Event *e; |
512 | 531 | ||
513 | for( e = mEventList.first(); e; e = mEventList.next() ) { | 532 | for( e = mEventList.first(); e; e = mEventList.next() ) { |
514 | if ( !e->calEnabled() ) continue; | 533 | if ( !e->calEnabled() ) continue; |
515 | if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to ); | 534 | if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to ); |
516 | else appendAlarms( alarms, e, from, to ); | 535 | else appendAlarms( alarms, e, from, to ); |
517 | } | 536 | } |
518 | 537 | ||
519 | Todo *t; | 538 | Todo *t; |
520 | for( t = mTodoList.first(); t; t = mTodoList.next() ) { | 539 | for( t = mTodoList.first(); t; t = mTodoList.next() ) { |
521 | if ( !t->calEnabled() ) continue; | 540 | if ( !t->calEnabled() ) continue; |
522 | appendAlarms( alarms, t, from, to ); | 541 | appendAlarms( alarms, t, from, to ); |
523 | } | 542 | } |
524 | 543 | ||
525 | return alarms; | 544 | return alarms; |
526 | } | 545 | } |
527 | 546 | ||
528 | void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence, | 547 | void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence, |
529 | const QDateTime &from, const QDateTime &to ) | 548 | const QDateTime &from, const QDateTime &to ) |
530 | { | 549 | { |
531 | QPtrList<Alarm> alarmList = incidence->alarms(); | 550 | QPtrList<Alarm> alarmList = incidence->alarms(); |
532 | Alarm *alarm; | 551 | Alarm *alarm; |
533 | for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { | 552 | for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { |
534 | // kdDebug(5800) << "CalendarLocal::appendAlarms() '" << alarm->text() | 553 | // kdDebug(5800) << "CalendarLocal::appendAlarms() '" << alarm->text() |
535 | // << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl; | 554 | // << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl; |
536 | if ( alarm->enabled() ) { | 555 | if ( alarm->enabled() ) { |
537 | if ( alarm->time() >= from && alarm->time() <= to ) { | 556 | if ( alarm->time() >= from && alarm->time() <= to ) { |
538 | alarms.append( alarm ); | 557 | alarms.append( alarm ); |
539 | } | 558 | } |
540 | } | 559 | } |
541 | } | 560 | } |
542 | } | 561 | } |
543 | 562 | ||
544 | void CalendarLocal::appendRecurringAlarms( Alarm::List &alarms, | 563 | void CalendarLocal::appendRecurringAlarms( Alarm::List &alarms, |
545 | Incidence *incidence, | 564 | Incidence *incidence, |
546 | const QDateTime &from, | 565 | const QDateTime &from, |
547 | const QDateTime &to ) | 566 | const QDateTime &to ) |
548 | { | 567 | { |
549 | 568 | ||
550 | QPtrList<Alarm> alarmList = incidence->alarms(); | 569 | QPtrList<Alarm> alarmList = incidence->alarms(); |
551 | Alarm *alarm; | 570 | Alarm *alarm; |
552 | QDateTime qdt; | 571 | QDateTime qdt; |
553 | for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { | 572 | for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { |
554 | if (incidence->recursOn(from.date())) { | 573 | if (incidence->recursOn(from.date())) { |
555 | qdt.setTime(alarm->time().time()); | 574 | qdt.setTime(alarm->time().time()); |
556 | qdt.setDate(from.date()); | 575 | qdt.setDate(from.date()); |
557 | } | 576 | } |
558 | else qdt = alarm->time(); | 577 | else qdt = alarm->time(); |
559 | // qDebug("1 %s %s %s", qdt.toString().latin1(), from.toString().latin1(), to.toString().latin1()); | 578 | // qDebug("1 %s %s %s", qdt.toString().latin1(), from.toString().latin1(), to.toString().latin1()); |
560 | if ( alarm->enabled() ) { | 579 | if ( alarm->enabled() ) { |
561 | if ( qdt >= from && qdt <= to ) { | 580 | if ( qdt >= from && qdt <= to ) { |
562 | alarms.append( alarm ); | 581 | alarms.append( alarm ); |
563 | } | 582 | } |
564 | } | 583 | } |
565 | } | 584 | } |
566 | } | 585 | } |
567 | 586 | ||
568 | 587 | ||
569 | /****************************** PROTECTED METHODS ****************************/ | 588 | /****************************** PROTECTED METHODS ****************************/ |
570 | 589 | ||
571 | // after changes are made to an event, this should be called. | 590 | // after changes are made to an event, this should be called. |
572 | void CalendarLocal::update( IncidenceBase *incidence ) | 591 | void CalendarLocal::update( IncidenceBase *incidence ) |
573 | { | 592 | { |
574 | incidence->setSyncStatus( Event::SYNCMOD ); | 593 | incidence->setSyncStatus( Event::SYNCMOD ); |
575 | incidence->setLastModified( QDateTime::currentDateTime() ); | 594 | incidence->setLastModified( QDateTime::currentDateTime() ); |
576 | // we should probably update the revision number here, | 595 | // we should probably update the revision number here, |
577 | // or internally in the Event itself when certain things change. | 596 | // or internally in the Event itself when certain things change. |
578 | // need to verify with ical documentation. | 597 | // need to verify with ical documentation. |
579 | 598 | ||
580 | setModified( true ); | 599 | setModified( true ); |
581 | } | 600 | } |
582 | 601 | ||
583 | void CalendarLocal::insertEvent( Event *event ) | 602 | void CalendarLocal::insertEvent( Event *event ) |
584 | { | 603 | { |
585 | if ( mEventList.findRef( event ) < 0 ) mEventList.append( event ); | 604 | if ( mEventList.findRef( event ) < 0 ) mEventList.append( event ); |
586 | } | 605 | } |
587 | 606 | ||
588 | 607 | ||
589 | QPtrList<Event> CalendarLocal::rawEventsForDate( const QDate &qd, bool sorted ) | 608 | QPtrList<Event> CalendarLocal::rawEventsForDate( const QDate &qd, bool sorted ) |
590 | { | 609 | { |
591 | QPtrList<Event> eventList; | 610 | QPtrList<Event> eventList; |
592 | 611 | ||
593 | Event *event; | 612 | Event *event; |
594 | for( event = mEventList.first(); event; event = mEventList.next() ) { | 613 | for( event = mEventList.first(); event; event = mEventList.next() ) { |
595 | if ( !event->calEnabled() ) continue; | 614 | if ( !event->calEnabled() ) continue; |
596 | if ( event->doesRecur() ) { | 615 | if ( event->doesRecur() ) { |
597 | if ( event->isMultiDay() ) { | 616 | if ( event->isMultiDay() ) { |
598 | int extraDays = event->dtStart().date().daysTo( event->dtEnd().date() ); | 617 | int extraDays = event->dtStart().date().daysTo( event->dtEnd().date() ); |
599 | int i; | 618 | int i; |
600 | for ( i = 0; i <= extraDays; i++ ) { | 619 | for ( i = 0; i <= extraDays; i++ ) { |
601 | if ( event->recursOn( qd.addDays( -i ) ) ) { | 620 | if ( event->recursOn( qd.addDays( -i ) ) ) { |
602 | eventList.append( event ); | 621 | eventList.append( event ); |
603 | break; | 622 | break; |
604 | } | 623 | } |
605 | } | 624 | } |
606 | } else { | 625 | } else { |
607 | if ( event->recursOn( qd ) ) | 626 | if ( event->recursOn( qd ) ) |
608 | eventList.append( event ); | 627 | eventList.append( event ); |
609 | } | 628 | } |
610 | } else { | 629 | } else { |
611 | if ( event->dtStart().date() <= qd && event->dtEnd().date() >= qd ) { | 630 | if ( event->dtStart().date() <= qd && event->dtEnd().date() >= qd ) { |
612 | eventList.append( event ); | 631 | eventList.append( event ); |
613 | } | 632 | } |
614 | } | 633 | } |
615 | } | 634 | } |
616 | 635 | ||
617 | if ( !sorted ) { | 636 | if ( !sorted ) { |
618 | return eventList; | 637 | return eventList; |
619 | } | 638 | } |
620 | 639 | ||
621 | // kdDebug(5800) << "Sorting events for date\n" << endl; | 640 | // kdDebug(5800) << "Sorting events for date\n" << endl; |
622 | // now, we have to sort it based on dtStart.time() | 641 | // now, we have to sort it based on dtStart.time() |
623 | QPtrList<Event> eventListSorted; | 642 | QPtrList<Event> eventListSorted; |
624 | Event *sortEvent; | 643 | Event *sortEvent; |
625 | for ( event = eventList.first(); event; event = eventList.next() ) { | 644 | for ( event = eventList.first(); event; event = eventList.next() ) { |
626 | sortEvent = eventListSorted.first(); | 645 | sortEvent = eventListSorted.first(); |
627 | int i = 0; | 646 | int i = 0; |
628 | while ( sortEvent && event->dtStart().time()>=sortEvent->dtStart().time() ) | 647 | while ( sortEvent && event->dtStart().time()>=sortEvent->dtStart().time() ) |
629 | { | 648 | { |
630 | i++; | 649 | i++; |
631 | sortEvent = eventListSorted.next(); | 650 | sortEvent = eventListSorted.next(); |
632 | } | 651 | } |
633 | eventListSorted.insert( i, event ); | 652 | eventListSorted.insert( i, event ); |
634 | } | 653 | } |
635 | return eventListSorted; | 654 | return eventListSorted; |
636 | } | 655 | } |
637 | 656 | ||
638 | 657 | ||
639 | QPtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end, | 658 | QPtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end, |
640 | bool inclusive ) | 659 | bool inclusive ) |
641 | { | 660 | { |
642 | Event *event = 0; | 661 | Event *event = 0; |
643 | 662 | ||
644 | QPtrList<Event> eventList; | 663 | QPtrList<Event> eventList; |
645 | 664 | ||
646 | // Get non-recurring events | 665 | // Get non-recurring events |
647 | for( event = mEventList.first(); event; event = mEventList.next() ) { | 666 | for( event = mEventList.first(); event; event = mEventList.next() ) { |
648 | if ( !event->calEnabled() ) continue; | 667 | if ( !event->calEnabled() ) continue; |
649 | if ( event->doesRecur() ) { | 668 | if ( event->doesRecur() ) { |
650 | QDate rStart = event->dtStart().date(); | 669 | QDate rStart = event->dtStart().date(); |
651 | bool found = false; | 670 | bool found = false; |
652 | if ( inclusive ) { | 671 | if ( inclusive ) { |
653 | if ( rStart >= start && rStart <= end ) { | 672 | if ( rStart >= start && rStart <= end ) { |
654 | // Start date of event is in range. Now check for end date. | 673 | // Start date of event is in range. Now check for end date. |
655 | // if duration is negative, event recurs forever, so do not include it. | 674 | // if duration is negative, event recurs forever, so do not include it. |
656 | if ( event->recurrence()->duration() == 0 ) { // End date set | 675 | if ( event->recurrence()->duration() == 0 ) { // End date set |
657 | QDate rEnd = event->recurrence()->endDate(); | 676 | QDate rEnd = event->recurrence()->endDate(); |
658 | if ( rEnd >= start && rEnd <= end ) { // End date within range | 677 | if ( rEnd >= start && rEnd <= end ) { // End date within range |
659 | found = true; | 678 | found = true; |
660 | } | 679 | } |
661 | } else if ( event->recurrence()->duration() > 0 ) { // Duration set | 680 | } else if ( event->recurrence()->duration() > 0 ) { // Duration set |
662 | // TODO: Calculate end date from duration. Should be done in Event | 681 | // TODO: Calculate end date from duration. Should be done in Event |
663 | // For now exclude all events with a duration. | 682 | // For now exclude all events with a duration. |
664 | } | 683 | } |
665 | } | 684 | } |
666 | } else { | 685 | } else { |
667 | bool founOne; | 686 | bool founOne; |
668 | QDate next = event->getNextOccurence( start, &founOne ).date(); | 687 | QDate next = event->getNextOccurence( start, &founOne ).date(); |
669 | if ( founOne ) { | 688 | if ( founOne ) { |
670 | if ( next <= end ) { | 689 | if ( next <= end ) { |
671 | found = true; | 690 | found = true; |
672 | } | 691 | } |
673 | } | 692 | } |
674 | 693 | ||
675 | /* | 694 | /* |
676 | // crap !!! | 695 | // crap !!! |
677 | if ( rStart <= end ) { // Start date not after range | 696 | if ( rStart <= end ) { // Start date not after range |
678 | if ( rStart >= start ) { // Start date within range | 697 | if ( rStart >= start ) { // Start date within range |
679 | found = true; | 698 | found = true; |
680 | } else if ( event->recurrence()->duration() == -1 ) { // Recurs forever | 699 | } else if ( event->recurrence()->duration() == -1 ) { // Recurs forever |
681 | found = true; | 700 | found = true; |
682 | } else if ( event->recurrence()->duration() == 0 ) { // End date set | 701 | } else if ( event->recurrence()->duration() == 0 ) { // End date set |
683 | QDate rEnd = event->recurrence()->endDate(); | 702 | QDate rEnd = event->recurrence()->endDate(); |
684 | if ( rEnd >= start && rEnd <= end ) { // End date within range | 703 | if ( rEnd >= start && rEnd <= end ) { // End date within range |
685 | found = true; | 704 | found = true; |
686 | } | 705 | } |
687 | } else { // Duration set | 706 | } else { // Duration set |
688 | // TODO: Calculate end date from duration. Should be done in Event | 707 | // TODO: Calculate end date from duration. Should be done in Event |
689 | // For now include all events with a duration. | 708 | // For now include all events with a duration. |
690 | found = true; | 709 | found = true; |
691 | } | 710 | } |
692 | } | 711 | } |
693 | */ | 712 | */ |
694 | 713 | ||
695 | } | 714 | } |
696 | 715 | ||
697 | if ( found ) eventList.append( event ); | 716 | if ( found ) eventList.append( event ); |
698 | } else { | 717 | } else { |
699 | QDate s = event->dtStart().date(); | 718 | QDate s = event->dtStart().date(); |
700 | QDate e = event->dtEnd().date(); | 719 | QDate e = event->dtEnd().date(); |
701 | 720 | ||
702 | if ( inclusive ) { | 721 | if ( inclusive ) { |
703 | if ( s >= start && e <= end ) { | 722 | if ( s >= start && e <= end ) { |
704 | eventList.append( event ); | 723 | eventList.append( event ); |
705 | } | 724 | } |
706 | } else { | 725 | } else { |
707 | if ( ( s >= start && s <= end ) || ( e >= start && e <= end ) ) { | 726 | if ( ( s >= start && s <= end ) || ( e >= start && e <= end ) ) { |
708 | eventList.append( event ); | 727 | eventList.append( event ); |
709 | } | 728 | } |
710 | } | 729 | } |
711 | } | 730 | } |
712 | } | 731 | } |
713 | 732 | ||
714 | return eventList; | 733 | return eventList; |
715 | } | 734 | } |
716 | 735 | ||
717 | QPtrList<Event> CalendarLocal::rawEventsForDate( const QDateTime &qdt ) | 736 | QPtrList<Event> CalendarLocal::rawEventsForDate( const QDateTime &qdt ) |
718 | { | 737 | { |
719 | return rawEventsForDate( qdt.date() ); | 738 | return rawEventsForDate( qdt.date() ); |
720 | } | 739 | } |
721 | 740 | ||
722 | QPtrList<Event> CalendarLocal::rawEvents() | 741 | QPtrList<Event> CalendarLocal::rawEvents() |
723 | { | 742 | { |
724 | QPtrList<Event> el; | 743 | QPtrList<Event> el; |
725 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | 744 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) |
726 | if ( it->calEnabled() ) el.append( it ); | 745 | if ( it->calEnabled() ) el.append( it ); |
727 | return el; | 746 | return el; |
728 | } | 747 | } |
729 | 748 | ||
730 | bool CalendarLocal::addJournal(Journal *journal) | 749 | bool CalendarLocal::addJournal(Journal *journal) |
731 | { | 750 | { |
732 | if ( journal->dtStart().isValid()) | 751 | if ( journal->dtStart().isValid()) |
733 | kdDebug(5800) << "Adding Journal on " << journal->dtStart().toString() << endl; | 752 | kdDebug(5800) << "Adding Journal on " << journal->dtStart().toString() << endl; |
734 | else | 753 | else |
735 | kdDebug(5800) << "Adding Journal without a DTSTART" << endl; | 754 | kdDebug(5800) << "Adding Journal without a DTSTART" << endl; |
736 | 755 | ||
737 | mJournalList.append(journal); | 756 | mJournalList.append(journal); |
738 | 757 | ||
739 | journal->registerObserver( this ); | 758 | journal->registerObserver( this ); |
740 | 759 | ||
741 | setModified( true ); | 760 | setModified( true ); |
742 | journal->setCalID( mDefaultCalendar ); | 761 | journal->setCalID( mDefaultCalendar ); |
743 | journal->setCalEnabled( true ); | 762 | journal->setCalEnabled( true ); |
744 | return true; | 763 | return true; |
745 | } | 764 | } |
746 | 765 | ||
747 | void CalendarLocal::deleteJournal( Journal *journal ) | 766 | void CalendarLocal::deleteJournal( Journal *journal ) |
748 | { | 767 | { |
749 | if ( mUndoIncidence ) delete mUndoIncidence; | 768 | if ( mUndoIncidence ) delete mUndoIncidence; |
750 | mUndoIncidence = journal->clone(); | 769 | mUndoIncidence = journal->clone(); |
751 | mUndoIncidence->setSummary( mUndoIncidence->description().left(25)); | 770 | mUndoIncidence->setSummary( mUndoIncidence->description().left(25)); |
752 | if ( mJournalList.removeRef(journal) ) { | 771 | if ( mJournalList.removeRef(journal) ) { |
753 | setModified( true ); | 772 | setModified( true ); |
754 | } | 773 | } |
755 | } | 774 | } |
756 | 775 | ||
757 | Journal *CalendarLocal::journal( const QDate &date ) | 776 | Journal *CalendarLocal::journal( const QDate &date ) |
758 | { | 777 | { |
759 | // kdDebug(5800) << "CalendarLocal::journal() " << date.toString() << endl; | 778 | // kdDebug(5800) << "CalendarLocal::journal() " << date.toString() << endl; |
760 | 779 | ||
761 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 780 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
762 | if ( it->calEnabled() && it->dtStart().date() == date ) | 781 | if ( it->calEnabled() && it->dtStart().date() == date ) |
763 | return it; | 782 | return it; |
764 | 783 | ||
765 | return 0; | 784 | return 0; |
766 | } | 785 | } |
767 | 786 | ||
768 | Journal *CalendarLocal::journal( const QString &uid ) | 787 | Journal *CalendarLocal::journal( const QString &uid ) |
769 | { | 788 | { |
770 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 789 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
771 | if ( it->calEnabled() && it->uid() == uid ) | 790 | if ( it->calEnabled() && it->uid() == uid ) |
772 | return it; | 791 | return it; |
773 | 792 | ||
774 | return 0; | 793 | return 0; |
775 | } | 794 | } |
776 | 795 | ||
777 | QPtrList<Journal> CalendarLocal::journals() | 796 | QPtrList<Journal> CalendarLocal::journals() |
778 | { | 797 | { |
779 | QPtrList<Journal> el; | 798 | QPtrList<Journal> el; |
780 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 799 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
781 | if ( it->calEnabled() ) el.append( it ); | 800 | if ( it->calEnabled() ) el.append( it ); |
782 | return el; | 801 | return el; |
783 | } | 802 | } |
803 | void CalendarLocal::setCalendarRemove( int id ) | ||
804 | { | ||
805 | |||
806 | { | ||
807 | QPtrList<Event> EventList = mEventList; | ||
808 | Event * ev = EventList.first(); | ||
809 | while ( ev ) { | ||
810 | if ( ev->calID() == id ) | ||
811 | deleteEvent( ev ); | ||
812 | ev = EventList.next(); | ||
813 | } | ||
814 | } | ||
815 | { | ||
816 | |||
817 | QPtrList<Todo> TodoList = mTodoList; | ||
818 | Todo * ev = TodoList.first(); | ||
819 | while ( ev ) { | ||
820 | if ( ev->calID() == id ) | ||
821 | deleteTodo( ev ); | ||
822 | ev = TodoList.next(); | ||
823 | } | ||
824 | } | ||
825 | { | ||
826 | QPtrList<Journal> JournalList = mJournalList; | ||
827 | Journal * ev = JournalList.first(); | ||
828 | while ( ev ) { | ||
829 | if ( ev->calID() == id ) | ||
830 | deleteJournal( ev ); | ||
831 | ev = JournalList.next(); | ||
832 | } | ||
833 | } | ||
834 | |||
835 | if ( mUndoIncidence ) delete mUndoIncidence; | ||
836 | mUndoIncidence = 0; | ||
837 | |||
838 | } | ||
784 | 839 | ||
785 | void CalendarLocal::setCalendarEnabled( int id, bool enable ) | 840 | void CalendarLocal::setCalendarEnabled( int id, bool enable ) |
786 | { | 841 | { |
787 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 842 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
788 | if ( it->calID() == id ) it->setCalEnabled( enable ); | 843 | if ( it->calID() == id ) it->setCalEnabled( enable ); |
789 | 844 | ||
790 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | 845 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) |
791 | if ( it->calID() == id ) it->setCalEnabled( enable ); | 846 | if ( it->calID() == id ) it->setCalEnabled( enable ); |
792 | 847 | ||
793 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | 848 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) |
794 | if ( it->calID() == id ) it->setCalEnabled( enable ); | 849 | if ( it->calID() == id ) it->setCalEnabled( enable ); |
795 | 850 | ||
796 | } | 851 | } |
797 | 852 | ||
798 | void CalendarLocal::setReadOnly( int id, bool enable ) | 853 | void CalendarLocal::setReadOnly( int id, bool enable ) |
799 | { | 854 | { |
800 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 855 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
801 | if ( it->calID() == id ) it->setReadOnly( enable ); | 856 | if ( it->calID() == id ) it->setReadOnly( enable ); |
802 | 857 | ||
803 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | 858 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) |
804 | if ( it->calID() == id ) it->setReadOnly( enable ); | 859 | if ( it->calID() == id ) it->setReadOnly( enable ); |
805 | 860 | ||
806 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | 861 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) |
807 | if ( it->calID() == id ) it->setReadOnly( enable ); | 862 | if ( it->calID() == id ) it->setReadOnly( enable ); |
808 | 863 | ||
809 | } | 864 | } |
810 | 865 | ||
811 | void CalendarLocal::setAlarmEnabled( int id, bool enable ) | 866 | void CalendarLocal::setAlarmEnabled( int id, bool enable ) |
812 | { | 867 | { |
813 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 868 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
814 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); | 869 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); |
815 | 870 | ||
816 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | 871 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) |
817 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); | 872 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); |
818 | 873 | ||
819 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | 874 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) |
820 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); | 875 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); |
876 | reInitAlarmSettings(); | ||
821 | 877 | ||
822 | } | 878 | } |
823 | void CalendarLocal::setDefaultCalendarEnabledOnly() | 879 | void CalendarLocal::setDefaultCalendarEnabledOnly() |
824 | { | 880 | { |
825 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 881 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
826 | it->setCalEnabled( it->calID() == mDefaultCalendar ); | 882 | it->setCalEnabled( it->calID() == mDefaultCalendar ); |
827 | 883 | ||
828 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | 884 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) |
829 | it->setCalEnabled( it->calID() == mDefaultCalendar); | 885 | it->setCalEnabled( it->calID() == mDefaultCalendar); |
830 | 886 | ||
831 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | 887 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) |
832 | it->setCalEnabled( it->calID() == mDefaultCalendar); | 888 | it->setCalEnabled( it->calID() == mDefaultCalendar); |
833 | 889 | ||
834 | } | 890 | } |
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index 65f6aa7..5bbe55f 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h | |||
@@ -1,223 +1,224 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | 3 | ||
4 | Copyright (c) 1998 Preston Brown | 4 | Copyright (c) 1998 Preston Brown |
5 | Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org> | 5 | Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org> |
6 | 6 | ||
7 | This library is free software; you can redistribute it and/or | 7 | This library is free software; you can redistribute it and/or |
8 | modify it under the terms of the GNU Library General Public | 8 | modify it under the terms of the GNU Library General Public |
9 | License as published by the Free Software Foundation; either | 9 | License as published by the Free Software Foundation; either |
10 | version 2 of the License, or (at your option) any later version. | 10 | version 2 of the License, or (at your option) any later version. |
11 | 11 | ||
12 | This library is distributed in the hope that it will be useful, | 12 | This library is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | Library General Public License for more details. | 15 | Library General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU Library General Public License | 17 | You should have received a copy of the GNU Library General Public License |
18 | along with this library; see the file COPYING.LIB. If not, write to | 18 | along with this library; see the file COPYING.LIB. If not, write to |
19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
20 | Boston, MA 02111-1307, USA. | 20 | Boston, MA 02111-1307, USA. |
21 | */ | 21 | */ |
22 | #ifndef KCAL_CALENDARLOCAL_H | 22 | #ifndef KCAL_CALENDARLOCAL_H |
23 | #define KCAL_CALENDARLOCAL_H | 23 | #define KCAL_CALENDARLOCAL_H |
24 | 24 | ||
25 | #include "calendar.h" | 25 | #include "calendar.h" |
26 | 26 | ||
27 | namespace KCal { | 27 | namespace KCal { |
28 | 28 | ||
29 | class CalFormat; | 29 | class CalFormat; |
30 | 30 | ||
31 | /** | 31 | /** |
32 | This class provides a calendar stored as a local file. | 32 | This class provides a calendar stored as a local file. |
33 | */ | 33 | */ |
34 | class CalendarLocal : public Calendar | 34 | class CalendarLocal : public Calendar |
35 | { | 35 | { |
36 | public: | 36 | public: |
37 | /** | 37 | /** |
38 | Constructs a new calendar, with variables initialized to sane values. | 38 | Constructs a new calendar, with variables initialized to sane values. |
39 | */ | 39 | */ |
40 | CalendarLocal(); | 40 | CalendarLocal(); |
41 | /** | 41 | /** |
42 | Constructs a new calendar, with variables initialized to sane values. | 42 | Constructs a new calendar, with variables initialized to sane values. |
43 | */ | 43 | */ |
44 | CalendarLocal( const QString &timeZoneId ); | 44 | CalendarLocal( const QString &timeZoneId ); |
45 | ~CalendarLocal(); | 45 | ~CalendarLocal(); |
46 | void addCalendar( Calendar* ); | 46 | void addCalendar( Calendar* ); |
47 | bool addCalendarFile( QString name, int id ); | 47 | bool addCalendarFile( QString name, int id ); |
48 | /** | 48 | /** |
49 | Loads a calendar on disk in vCalendar or iCalendar format into the current | 49 | Loads a calendar on disk in vCalendar or iCalendar format into the current |
50 | calendar. Any information already present is lost. | 50 | calendar. Any information already present is lost. |
51 | @return true, if successfull, false on error. | 51 | @return true, if successfull, false on error. |
52 | @param fileName the name of the calendar on disk. | 52 | @param fileName the name of the calendar on disk. |
53 | */ | 53 | */ |
54 | bool load( const QString &fileName ); | 54 | bool load( const QString &fileName ); |
55 | /** | 55 | /** |
56 | Writes out the calendar to disk in the specified \a format. | 56 | Writes out the calendar to disk in the specified \a format. |
57 | CalendarLocal takes ownership of the CalFormat object. | 57 | CalendarLocal takes ownership of the CalFormat object. |
58 | @return true, if successfull, false on error. | 58 | @return true, if successfull, false on error. |
59 | @param fileName the name of the file | 59 | @param fileName the name of the file |
60 | */ | 60 | */ |
61 | bool save( const QString &fileName, CalFormat *format = 0 ); | 61 | bool save( const QString &fileName, CalFormat *format = 0 ); |
62 | 62 | ||
63 | /** | 63 | /** |
64 | Clears out the current calendar, freeing all used memory etc. etc. | 64 | Clears out the current calendar, freeing all used memory etc. etc. |
65 | */ | 65 | */ |
66 | void close(); | 66 | void close(); |
67 | 67 | ||
68 | void save() {} | 68 | void save() {} |
69 | 69 | ||
70 | /** | 70 | /** |
71 | Add Event to calendar. | 71 | Add Event to calendar. |
72 | */ | 72 | */ |
73 | void removeSyncInfo( QString syncProfile); | 73 | void removeSyncInfo( QString syncProfile); |
74 | bool addAnniversaryNoDup( Event *event ); | 74 | bool addAnniversaryNoDup( Event *event ); |
75 | bool addEventNoDup( Event *event ); | 75 | bool addEventNoDup( Event *event ); |
76 | bool addEvent( Event *event ); | 76 | bool addEvent( Event *event ); |
77 | /** | 77 | /** |
78 | Deletes an event from this calendar. | 78 | Deletes an event from this calendar. |
79 | */ | 79 | */ |
80 | void deleteEvent( Event *event ); | 80 | void deleteEvent( Event *event ); |
81 | 81 | ||
82 | /** | 82 | /** |
83 | Retrieves an event on the basis of the unique string ID. | 83 | Retrieves an event on the basis of the unique string ID. |
84 | */ | 84 | */ |
85 | Event *event( const QString &uid ); | 85 | Event *event( const QString &uid ); |
86 | /** | 86 | /** |
87 | Return unfiltered list of all events in calendar. | 87 | Return unfiltered list of all events in calendar. |
88 | */ | 88 | */ |
89 | QPtrList<Event> rawEvents(); | 89 | QPtrList<Event> rawEvents(); |
90 | QPtrList<Event> getExternLastSyncEvents(); | 90 | QPtrList<Event> getExternLastSyncEvents(); |
91 | /** | 91 | /** |
92 | Add a todo to the todolist. | 92 | Add a todo to the todolist. |
93 | */ | 93 | */ |
94 | bool addTodo( Todo *todo ); | 94 | bool addTodo( Todo *todo ); |
95 | bool addTodoNoDup( Todo *todo ); | 95 | bool addTodoNoDup( Todo *todo ); |
96 | /** | 96 | /** |
97 | Remove a todo from the todolist. | 97 | Remove a todo from the todolist. |
98 | */ | 98 | */ |
99 | void deleteTodo( Todo * ); | 99 | void deleteTodo( Todo * ); |
100 | /** | 100 | /** |
101 | Searches todolist for an event with this unique string identifier, | 101 | Searches todolist for an event with this unique string identifier, |
102 | returns a pointer or null. | 102 | returns a pointer or null. |
103 | */ | 103 | */ |
104 | Todo *todo( const QString &uid ); | 104 | Todo *todo( const QString &uid ); |
105 | /** | 105 | /** |
106 | Return list of all todos. | 106 | Return list of all todos. |
107 | */ | 107 | */ |
108 | QPtrList<Todo> rawTodos(); | 108 | QPtrList<Todo> rawTodos(); |
109 | /** | 109 | /** |
110 | Returns list of todos due on the specified date. | 110 | Returns list of todos due on the specified date. |
111 | */ | 111 | */ |
112 | QPtrList<Todo> todos( const QDate &date ); | 112 | QPtrList<Todo> todos( const QDate &date ); |
113 | /** | 113 | /** |
114 | Return list of all todos. | 114 | Return list of all todos. |
115 | 115 | ||
116 | Workaround because compiler does not recognize function of base class. | 116 | Workaround because compiler does not recognize function of base class. |
117 | */ | 117 | */ |
118 | QPtrList<Todo> todos() { return Calendar::todos(); } | 118 | QPtrList<Todo> todos() { return Calendar::todos(); } |
119 | 119 | ||
120 | /** | 120 | /** |
121 | Add a Journal entry to calendar. | 121 | Add a Journal entry to calendar. |
122 | */ | 122 | */ |
123 | bool addJournal( Journal * ); | 123 | bool addJournal( Journal * ); |
124 | /** | 124 | /** |
125 | Remove a Journal from the calendar. | 125 | Remove a Journal from the calendar. |
126 | */ | 126 | */ |
127 | void deleteJournal( Journal * ); | 127 | void deleteJournal( Journal * ); |
128 | /** | 128 | /** |
129 | Return Journal for given date. | 129 | Return Journal for given date. |
130 | */ | 130 | */ |
131 | Journal *journal( const QDate & ); | 131 | Journal *journal( const QDate & ); |
132 | /** | 132 | /** |
133 | Return Journal with given UID. | 133 | Return Journal with given UID. |
134 | */ | 134 | */ |
135 | Journal *journal( const QString &uid ); | 135 | Journal *journal( const QString &uid ); |
136 | /** | 136 | /** |
137 | Return list of all Journals stored in calendar. | 137 | Return list of all Journals stored in calendar. |
138 | */ | 138 | */ |
139 | QPtrList<Journal> journals(); | 139 | QPtrList<Journal> journals(); |
140 | 140 | ||
141 | /** | 141 | /** |
142 | Return all alarms, which ocur in the given time interval. | 142 | Return all alarms, which ocur in the given time interval. |
143 | */ | 143 | */ |
144 | Alarm::List alarms( const QDateTime &from, const QDateTime &to ); | 144 | Alarm::List alarms( const QDateTime &from, const QDateTime &to ); |
145 | 145 | ||
146 | /** | 146 | /** |
147 | Return all alarms, which ocur before given date. | 147 | Return all alarms, which ocur before given date. |
148 | */ | 148 | */ |
149 | Alarm::List alarmsTo( const QDateTime &to ); | 149 | Alarm::List alarmsTo( const QDateTime &to ); |
150 | 150 | ||
151 | QDateTime nextAlarm( int daysTo ) ; | 151 | QDateTime nextAlarm( int daysTo ) ; |
152 | QDateTime nextAlarmEventDateTime() const; | 152 | QDateTime nextAlarmEventDateTime() const; |
153 | void checkAlarmForIncidence( Incidence *, bool deleted ) ; | 153 | void checkAlarmForIncidence( Incidence *, bool deleted ) ; |
154 | void registerAlarm(); | 154 | void registerAlarm(); |
155 | void deRegisterAlarm(); | 155 | void deRegisterAlarm(); |
156 | QString getAlarmNotification(); | 156 | QString getAlarmNotification(); |
157 | QString nextSummary() const ; | 157 | QString nextSummary() const ; |
158 | /** | 158 | /** |
159 | This method should be called whenever a Event is modified directly | 159 | This method should be called whenever a Event is modified directly |
160 | via it's pointer. It makes sure that the calendar is internally | 160 | via it's pointer. It makes sure that the calendar is internally |
161 | consistent. | 161 | consistent. |
162 | */ | 162 | */ |
163 | void update( IncidenceBase *incidence ); | 163 | void update( IncidenceBase *incidence ); |
164 | 164 | ||
165 | /** | 165 | /** |
166 | Builds and then returns a list of all events that match for the | 166 | Builds and then returns a list of all events that match for the |
167 | date specified. useful for dayView, etc. etc. | 167 | date specified. useful for dayView, etc. etc. |
168 | */ | 168 | */ |
169 | QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false ); | 169 | QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false ); |
170 | /** | 170 | /** |
171 | Get unfiltered events for date \a qdt. | 171 | Get unfiltered events for date \a qdt. |
172 | */ | 172 | */ |
173 | QPtrList<Event> rawEventsForDate( const QDateTime &qdt ); | 173 | QPtrList<Event> rawEventsForDate( const QDateTime &qdt ); |
174 | /** | 174 | /** |
175 | Get unfiltered events in a range of dates. If inclusive is set to true, | 175 | Get unfiltered events in a range of dates. If inclusive is set to true, |
176 | only events are returned, which are completely included in the range. | 176 | only events are returned, which are completely included in the range. |
177 | */ | 177 | */ |
178 | QPtrList<Event> rawEvents( const QDate &start, const QDate &end, | 178 | QPtrList<Event> rawEvents( const QDate &start, const QDate &end, |
179 | bool inclusive = false ); | 179 | bool inclusive = false ); |
180 | Todo *todo( QString, QString ); | 180 | Todo *todo( QString, QString ); |
181 | Event *event( QString, QString ); | 181 | Event *event( QString, QString ); |
182 | 182 | ||
183 | public slots: | 183 | public slots: |
184 | void setCalendarEnabled( int id, bool enable ); | 184 | void setCalendarEnabled( int id, bool enable ); |
185 | void setAlarmEnabled( int id, bool enable ); | 185 | void setAlarmEnabled( int id, bool enable ); |
186 | void setReadOnly( int id, bool enable ); | 186 | void setReadOnly( int id, bool enable ); |
187 | void setDefaultCalendarEnabledOnly(); | 187 | void setDefaultCalendarEnabledOnly(); |
188 | void setCalendarRemove( int id ); | ||
188 | 189 | ||
189 | protected: | 190 | protected: |
190 | 191 | ||
191 | // Event* mNextAlarmEvent; | 192 | // Event* mNextAlarmEvent; |
192 | QString mNextSummary; | 193 | QString mNextSummary; |
193 | QString mNextAlarmEventDateTimeString; | 194 | QString mNextAlarmEventDateTimeString; |
194 | QString mLastAlarmNotificationString; | 195 | QString mLastAlarmNotificationString; |
195 | QDateTime mNextAlarmEventDateTime; | 196 | QDateTime mNextAlarmEventDateTime; |
196 | QDateTime mNextAlarmDateTime; | 197 | QDateTime mNextAlarmDateTime; |
197 | void reInitAlarmSettings(); | 198 | void reInitAlarmSettings(); |
198 | 199 | ||
199 | /** Notification function of IncidenceBase::Observer. */ | 200 | /** Notification function of IncidenceBase::Observer. */ |
200 | void incidenceUpdated( IncidenceBase *i ) { update( i ); } | 201 | void incidenceUpdated( IncidenceBase *i ) { update( i ); } |
201 | 202 | ||
202 | /** inserts an event into its "proper place" in the calendar. */ | 203 | /** inserts an event into its "proper place" in the calendar. */ |
203 | void insertEvent( Event *event ); | 204 | void insertEvent( Event *event ); |
204 | 205 | ||
205 | /** Append alarms of incidence in interval to list of alarms. */ | 206 | /** Append alarms of incidence in interval to list of alarms. */ |
206 | void appendAlarms( Alarm::List &alarms, Incidence *incidence, | 207 | void appendAlarms( Alarm::List &alarms, Incidence *incidence, |
207 | const QDateTime &from, const QDateTime &to ); | 208 | const QDateTime &from, const QDateTime &to ); |
208 | 209 | ||
209 | /** Append alarms of recurring events in interval to list of alarms. */ | 210 | /** Append alarms of recurring events in interval to list of alarms. */ |
210 | void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence, | 211 | void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence, |
211 | const QDateTime &from, const QDateTime &to ); | 212 | const QDateTime &from, const QDateTime &to ); |
212 | 213 | ||
213 | private: | 214 | private: |
214 | void init(); | 215 | void init(); |
215 | 216 | ||
216 | QPtrList<Event> mEventList; | 217 | QPtrList<Event> mEventList; |
217 | QPtrList<Todo> mTodoList; | 218 | QPtrList<Todo> mTodoList; |
218 | QPtrList<Journal> mJournalList; | 219 | QPtrList<Journal> mJournalList; |
219 | }; | 220 | }; |
220 | 221 | ||
221 | } | 222 | } |
222 | 223 | ||
223 | #endif | 224 | #endif |