-rw-r--r-- | bin/kdepim/WhatsNew.txt | 2 | ||||
-rw-r--r-- | libkcal/icalformatimpl.cpp | 31 | ||||
-rw-r--r-- | libkcal/incidencebase.cpp | 11 |
3 files changed, 27 insertions, 17 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 06aa5f6..01d9e27 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,781 +1,783 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | ********** VERSION 2.0.8 ************ | 3 | ********** VERSION 2.0.8 ************ |
4 | 4 | ||
5 | Fixed a problem in dependency info in the ipk files for the Zaurus. | 5 | Fixed a problem in dependency info in the ipk files for the Zaurus. |
6 | 6 | ||
7 | Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar. | 7 | Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar. |
8 | 8 | ||
9 | Added a "go today" button to the datepicker. | 9 | Added a "go today" button to the datepicker. |
10 | 10 | ||
11 | Added "created" and "last modified" to event/todo viewer (and What'sThis viewer) | 11 | Added "created" and "last modified" to event/todo viewer (and What'sThis viewer) |
12 | and made it configureable to show these values. | 12 | and made it configureable to show these values. |
13 | 13 | ||
14 | Fixed a problem for events (from external iCal files) that do have a duration but no end date. | ||
15 | |||
14 | 16 | ||
15 | ********** VERSION 2.0.7 ************ | 17 | ********** VERSION 2.0.7 ************ |
16 | 18 | ||
17 | Added global application font settings | 19 | Added global application font settings |
18 | (for all KDE-Pim/Pi apps) to the general settings. | 20 | (for all KDE-Pim/Pi apps) to the general settings. |
19 | 21 | ||
20 | Fixed a problem in OM/Pi when trying to login to some IMAP servers | 22 | Fixed a problem in OM/Pi when trying to login to some IMAP servers |
21 | (like the IMAP server of Apple: mail.mac.com ) | 23 | (like the IMAP server of Apple: mail.mac.com ) |
22 | 24 | ||
23 | Added recurring todos to KO/Pi. | 25 | Added recurring todos to KO/Pi. |
24 | 26 | ||
25 | 27 | ||
26 | ********** VERSION 2.0.6 ************ | 28 | ********** VERSION 2.0.6 ************ |
27 | 29 | ||
28 | Some bugfixes in the pi-sync mode. | 30 | Some bugfixes in the pi-sync mode. |
29 | Added German translation for pi-sync mode. | 31 | Added German translation for pi-sync mode. |
30 | 32 | ||
31 | KO/Pi: | 33 | KO/Pi: |
32 | Made the todolist using alternate background. | 34 | Made the todolist using alternate background. |
33 | 35 | ||
34 | Other minor fixes in KO/Pi. | 36 | Other minor fixes in KO/Pi. |
35 | 37 | ||
36 | 38 | ||
37 | ********** VERSION 2.0.5 ************ | 39 | ********** VERSION 2.0.5 ************ |
38 | 40 | ||
39 | Bugfixes in KO/Pi. | 41 | Bugfixes in KO/Pi. |
40 | 42 | ||
41 | ********** VERSION 2.0.4 ************ | 43 | ********** VERSION 2.0.4 ************ |
42 | 44 | ||
43 | KO/Pi: | 45 | KO/Pi: |
44 | Fixed problem loading translations for summary/location edit boxes in event/todo editor. | 46 | Fixed problem loading translations for summary/location edit boxes in event/todo editor. |
45 | 47 | ||
46 | Added a general "select week number" to the toolbar. | 48 | Added a general "select week number" to the toolbar. |
47 | 49 | ||
48 | Fixed some small problem of the new features introduced in version 2.0.3. | 50 | Fixed some small problem of the new features introduced in version 2.0.3. |
49 | 51 | ||
50 | Made it possible to specify one specific category as category color, | 52 | Made it possible to specify one specific category as category color, |
51 | if more than one categories are selected. | 53 | if more than one categories are selected. |
52 | 54 | ||
53 | Fixed a bug in saving colors for categories with non-ascii characters. | 55 | Fixed a bug in saving colors for categories with non-ascii characters. |
54 | (Like, e.g. German Umlauts). | 56 | (Like, e.g. German Umlauts). |
55 | Propably you have to set your colors again for those categories. | 57 | Propably you have to set your colors again for those categories. |
56 | 58 | ||
57 | 59 | ||
58 | ********** VERSION 2.0.3 ************ | 60 | ********** VERSION 2.0.3 ************ |
59 | 61 | ||
60 | KO/Pi: | 62 | KO/Pi: |
61 | Added feature for changing alarm settings for many items at once: | 63 | Added feature for changing alarm settings for many items at once: |
62 | Open list view (or search dialog), select the desired items and choose in | 64 | Open list view (or search dialog), select the desired items and choose in |
63 | the popup menu: Set alarm for selected... | 65 | the popup menu: Set alarm for selected... |
64 | 66 | ||
65 | Added to the event/todo viewer the option to send an email to | 67 | Added to the event/todo viewer the option to send an email to |
66 | all attendees or all selected (with RSVP) attendees. | 68 | all attendees or all selected (with RSVP) attendees. |
67 | 69 | ||
68 | Made the week-month mode changing in month view faster. | 70 | Made the week-month mode changing in month view faster. |
69 | 71 | ||
70 | Made month view better useable with keyboard. | 72 | Made month view better useable with keyboard. |
71 | Now TAB key jumps to next cell with an event/todo. | 73 | Now TAB key jumps to next cell with an event/todo. |
72 | Scroll in cell with coursor keys, scroll in time (next week) with | 74 | Scroll in cell with coursor keys, scroll in time (next week) with |
73 | Shift/Control + coursorkeys. | 75 | Shift/Control + coursorkeys. |
74 | 76 | ||
75 | Fixed bug that the todo view flat mode was reset after first view update. | 77 | Fixed bug that the todo view flat mode was reset after first view update. |
76 | 78 | ||
77 | If a todo is displayed closed in the todo view, | 79 | If a todo is displayed closed in the todo view, |
78 | it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties. | 80 | it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties. |
79 | 81 | ||
80 | Added info about the numbers of years to the caption (title) information about a birthday event. | 82 | Added info about the numbers of years to the caption (title) information about a birthday event. |
81 | 83 | ||
82 | Made completion date in todo editor editable. | 84 | Made completion date in todo editor editable. |
83 | 85 | ||
84 | Added possibility to save/load templates for journals. | 86 | Added possibility to save/load templates for journals. |
85 | (Which is just a simple "save text to file" or "insert text from file". | 87 | (Which is just a simple "save text to file" or "insert text from file". |
86 | 88 | ||
87 | ********** VERSION 2.0.2 ************ | 89 | ********** VERSION 2.0.2 ************ |
88 | 90 | ||
89 | KO/Pi: | 91 | KO/Pi: |
90 | Fixed the layout problem of the day label buttons | 92 | Fixed the layout problem of the day label buttons |
91 | of the agenda view introduced in version 2.0.1. | 93 | of the agenda view introduced in version 2.0.1. |
92 | 94 | ||
93 | Added WhatsThis support for the todo view and the list view. | 95 | Added WhatsThis support for the todo view and the list view. |
94 | 96 | ||
95 | Added a quite useful feature to the montview. | 97 | Added a quite useful feature to the montview. |
96 | Just click on the week numbers on the left. | 98 | Just click on the week numbers on the left. |
97 | And in the top right corner of month view/agenda view | 99 | And in the top right corner of month view/agenda view |
98 | there is now a "week number quick selector". | 100 | there is now a "week number quick selector". |
99 | (Click on the black triangle). | 101 | (Click on the black triangle). |
100 | 102 | ||
101 | Made the quite difficult timezone change in KO/Pi easy. | 103 | Made the quite difficult timezone change in KO/Pi easy. |
102 | 104 | ||
103 | OM/Pi: | 105 | OM/Pi: |
104 | Fixed too small icons on desktop. | 106 | Fixed too small icons on desktop. |
105 | Fixed non visible icons in mainwindow on Z with fastload enabled. | 107 | Fixed non visible icons in mainwindow on Z with fastload enabled. |
106 | Added signature file setting to smtp account config. | 108 | Added signature file setting to smtp account config. |
107 | And the signature can be edited and saved in the edit mail dialog. | 109 | And the signature can be edited and saved in the edit mail dialog. |
108 | That does mean: | 110 | That does mean: |
109 | Simply edit the signature for the selected smtp account in the | 111 | Simply edit the signature for the selected smtp account in the |
110 | edit new mail dialog and press the "save signature" button there. | 112 | edit new mail dialog and press the "save signature" button there. |
111 | Then the signature is saved to the file specified in the smtp account settings. | 113 | Then the signature is saved to the file specified in the smtp account settings. |
112 | If there is no file specified, it is saved automatically to the file | 114 | If there is no file specified, it is saved automatically to the file |
113 | kdepim/apps/kopiemail/<accountname>.sig. | 115 | kdepim/apps/kopiemail/<accountname>.sig. |
114 | 116 | ||
115 | 117 | ||
116 | 118 | ||
117 | ********** VERSION 2.0.1 ************ | 119 | ********** VERSION 2.0.1 ************ |
118 | 120 | ||
119 | Oooops ... I forgot to test on the Zaurus 5500 ... | 121 | Oooops ... I forgot to test on the Zaurus 5500 ... |
120 | 122 | ||
121 | Fixed many problems of new (english) strings (and german translations) | 123 | Fixed many problems of new (english) strings (and german translations) |
122 | introduced in the latest versions, where the text was not fitting on the | 124 | introduced in the latest versions, where the text was not fitting on the |
123 | 240x320 display of the Zaurus 5500. | 125 | 240x320 display of the Zaurus 5500. |
124 | 126 | ||
125 | KO/Pi: | 127 | KO/Pi: |
126 | Added a popup menu ( press pen and hold to get popup ) to the agenda view | 128 | Added a popup menu ( press pen and hold to get popup ) to the agenda view |
127 | with many useful items (add event/todo, show next week, two weeks, month, journal). | 129 | with many useful items (add event/todo, show next week, two weeks, month, journal). |
128 | 130 | ||
129 | Added items to the todolist popup menu for: | 131 | Added items to the todolist popup menu for: |
130 | Display all opened, all closed or all todos flat. | 132 | Display all opened, all closed or all todos flat. |
131 | The "flat" view makes is possible to sort all todos after ,e.g., prio or date. | 133 | The "flat" view makes is possible to sort all todos after ,e.g., prio or date. |
132 | Made the reparenting of todos on the desktop possible via Drag&Drop. | 134 | Made the reparenting of todos on the desktop possible via Drag&Drop. |
133 | Fixed several bugs in setting the completed datetime for todos. | 135 | Fixed several bugs in setting the completed datetime for todos. |
134 | Added info about completed datetime of todos to the todo viewer. | 136 | Added info about completed datetime of todos to the todo viewer. |
135 | Now displaying a completed todo (with completed datetime set) in the agenda view | 137 | Now displaying a completed todo (with completed datetime set) in the agenda view |
136 | at the time of the completion. Such that now it is possible to see in the agenda view | 138 | at the time of the completion. Such that now it is possible to see in the agenda view |
137 | when what todo was completed. | 139 | when what todo was completed. |
138 | Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. | 140 | Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. |
139 | Now the behaviour is: | 141 | Now the behaviour is: |
140 | Setting a parent to complete sets all (sub)childs to complete. | 142 | Setting a parent to complete sets all (sub)childs to complete. |
141 | Setting a parent to uncomplete does not change the childs. | 143 | Setting a parent to uncomplete does not change the childs. |
142 | Setting a child to uncomplete sets all parent to uncomplete. | 144 | Setting a child to uncomplete sets all parent to uncomplete. |
143 | Setting a child to complete does not change the parents. | 145 | Setting a child to complete does not change the parents. |
144 | 146 | ||
145 | Smart updating and double buffering of the daymatrix. | 147 | Smart updating and double buffering of the daymatrix. |
146 | Showing holidays in the day matrix. | 148 | Showing holidays in the day matrix. |
147 | Many other small performance updates. | 149 | Many other small performance updates. |
148 | 150 | ||
149 | Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode. | 151 | Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode. |
150 | 152 | ||
151 | Now the translation file usertranslation.txt is supposed to be in utf8 format. | 153 | Now the translation file usertranslation.txt is supposed to be in utf8 format. |
152 | If you want to translate a language from western europe, just change the germantranslation.txt file. Please read the updated Usertranslation HowTo in KO/Pi Help menu. | 154 | If you want to translate a language from western europe, just change the germantranslation.txt file. Please read the updated Usertranslation HowTo in KO/Pi Help menu. |
153 | 155 | ||
154 | 156 | ||
155 | ********** VERSION 2.0.0 ************ | 157 | ********** VERSION 2.0.0 ************ |
156 | 158 | ||
157 | Stable release 2.0.0! | 159 | Stable release 2.0.0! |
158 | 160 | ||
159 | KO/Pi: | 161 | KO/Pi: |
160 | Fixed problem in edit dialog recreation at startup. | 162 | Fixed problem in edit dialog recreation at startup. |
161 | Made "toggle view*" menu items enabled context sensitive. | 163 | Made "toggle view*" menu items enabled context sensitive. |
162 | Changed agenda size menu to items 1-10. | 164 | Changed agenda size menu to items 1-10. |
163 | Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down. | 165 | Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down. |
164 | Usebility enhancements in the KO/Pi menus. | 166 | Usebility enhancements in the KO/Pi menus. |
165 | Birthday import now adds year to summary. | 167 | Birthday import now adds year to summary. |
166 | What's Next view shows age in years for birthday. | 168 | What's Next view shows age in years for birthday. |
167 | 169 | ||
168 | OM/Pi: | 170 | OM/Pi: |
169 | Added three info lines to display subject, from and to of selected mails. | 171 | Added three info lines to display subject, from and to of selected mails. |
170 | 172 | ||
171 | KA/Pi: | 173 | KA/Pi: |
172 | Fixed jump bar behaviour on Zaurus. | 174 | Fixed jump bar behaviour on Zaurus. |
173 | Now KA/Pi search field supports searching for a range of starting characters. | 175 | Now KA/Pi search field supports searching for a range of starting characters. |
174 | E.g. to search for all contact beginning with b to n, type | 176 | E.g. to search for all contact beginning with b to n, type |
175 | b-n | 177 | b-n |
176 | in the search field. | 178 | in the search field. |
177 | 179 | ||
178 | ********** VERSION 1.9.20 ************ | 180 | ********** VERSION 1.9.20 ************ |
179 | 181 | ||
180 | KO/Pi: | 182 | KO/Pi: |
181 | Added for the "dislplay one day" agenda mode | 183 | Added for the "dislplay one day" agenda mode |
182 | info in the caption and in the day lables: | 184 | info in the caption and in the day lables: |
183 | Now it is displayed, if the selected day is from "day before yesterday" | 185 | Now it is displayed, if the selected day is from "day before yesterday" |
184 | to "day after tomorrow". | 186 | to "day after tomorrow". |
185 | Made it possible to delete a Todo, which has sub-todos. | 187 | Made it possible to delete a Todo, which has sub-todos. |
186 | Fixed two small problems in the todo view. | 188 | Fixed two small problems in the todo view. |
187 | Added missing German translation for filter edit and print dialog. | 189 | Added missing German translation for filter edit and print dialog. |
188 | Made search dialog closeable by cancel key. | 190 | Made search dialog closeable by cancel key. |
189 | 191 | ||
190 | Made it possible to select in the date picker the (ligt grey ) | 192 | Made it possible to select in the date picker the (ligt grey ) |
191 | dates of the prev./next month with the mouse. | 193 | dates of the prev./next month with the mouse. |
192 | 194 | ||
193 | OM/Pi: | 195 | OM/Pi: |
194 | "Delete mail" icon in main window now deletes all selected mails. | 196 | "Delete mail" icon in main window now deletes all selected mails. |
195 | Fixed the problem, that the state flag of imap mails was ignored. | 197 | Fixed the problem, that the state flag of imap mails was ignored. |
196 | Now mails with "FLAG_SEEN" on the imap server get no icon in the list view | 198 | Now mails with "FLAG_SEEN" on the imap server get no icon in the list view |
197 | to indecate that they are already seen. | 199 | to indecate that they are already seen. |
198 | Fixed the problem that the body of some mails was not displayed in the | 200 | Fixed the problem that the body of some mails was not displayed in the |
199 | mail viewer when fetching them from the imap server directly to read them. | 201 | mail viewer when fetching them from the imap server directly to read them. |
200 | Made it (configurable) possible to show the "To:" field in the list view. | 202 | Made it (configurable) possible to show the "To:" field in the list view. |
201 | Added to the mail viewer the option "View Source" to make it possible to see the raw mail data. | 203 | Added to the mail viewer the option "View Source" to make it possible to see the raw mail data. |
202 | Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the | 204 | Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the |
203 | local storage folder (specified in account settings) of the account of the mail. | 205 | local storage folder (specified in account settings) of the account of the mail. |
204 | Removed some memory leaks in OM/Pi. | 206 | Removed some memory leaks in OM/Pi. |
205 | 207 | ||
206 | 208 | ||
207 | ********** VERSION 1.9.19 ************ | 209 | ********** VERSION 1.9.19 ************ |
208 | 210 | ||
209 | Added a lot of missing translations to KA/Pi, | 211 | Added a lot of missing translations to KA/Pi, |
210 | Added some missing translations to KO/Pi and OM/Pi. | 212 | Added some missing translations to KO/Pi and OM/Pi. |
211 | 213 | ||
212 | Fixed some minor problems in KA/Pi + KO/Pi. | 214 | Fixed some minor problems in KA/Pi + KO/Pi. |
213 | 215 | ||
214 | Fixed a crash when closing PwM/Pi. | 216 | Fixed a crash when closing PwM/Pi. |
215 | Added German translation for PwM/Pi. | 217 | Added German translation for PwM/Pi. |
216 | 218 | ||
217 | Made view change and Month View update faster in KO/Pi. | 219 | Made view change and Month View update faster in KO/Pi. |
218 | 220 | ||
219 | 221 | ||
220 | ********** VERSION 1.9.18 ************ | 222 | ********** VERSION 1.9.18 ************ |
221 | 223 | ||
222 | FYI: The VERSION 1.9.17 was a testing release only. | 224 | FYI: The VERSION 1.9.17 was a testing release only. |
223 | Please read the changelog of VERSION 1.9.17 as well. | 225 | Please read the changelog of VERSION 1.9.17 as well. |
224 | 226 | ||
225 | Cleaned up the syncing config dialog. | 227 | Cleaned up the syncing config dialog. |
226 | Added sync config options for date range for events. | 228 | Added sync config options for date range for events. |
227 | Added sync config options for filters on incoming data. | 229 | Added sync config options for filters on incoming data. |
228 | Added sync config options for filters on outgoing data. | 230 | Added sync config options for filters on outgoing data. |
229 | Please read the updated SyncHowTo about the new filter settings. | 231 | Please read the updated SyncHowTo about the new filter settings. |
230 | These filter settings make it now possible to sync with shared | 232 | These filter settings make it now possible to sync with shared |
231 | calendars without writing back private or confidential data | 233 | calendars without writing back private or confidential data |
232 | (via the outgoing filters). | 234 | (via the outgoing filters). |
233 | To sync only with particular parts of a shared calendar, | 235 | To sync only with particular parts of a shared calendar, |
234 | the incoming filter settings can be used. | 236 | the incoming filter settings can be used. |
235 | An example can be found in the SyncHowTo. | 237 | An example can be found in the SyncHowTo. |
236 | Same for shared addressbooks. | 238 | Same for shared addressbooks. |
237 | 239 | ||
238 | Added a setting for the global kdepim data storage. | 240 | Added a setting for the global kdepim data storage. |
239 | Usually the data is stored in (yourhomedir/kdepim). | 241 | Usually the data is stored in (yourhomedir/kdepim). |
240 | Now you can set in the Global config dialog TAB, subTAB "Data storage path" | 242 | Now you can set in the Global config dialog TAB, subTAB "Data storage path" |
241 | a directory where all the kdepim data is stored. | 243 | a directory where all the kdepim data is stored. |
242 | That makes it easy to save all kdepim data on a SD card on the Z, for example. | 244 | That makes it easy to save all kdepim data on a SD card on the Z, for example. |
243 | 245 | ||
244 | KO/Pi: | 246 | KO/Pi: |
245 | The timeedit input has a pulldown list for times. | 247 | The timeedit input has a pulldown list for times. |
246 | If opened, this pulldown list should now has the right time highlighted. | 248 | If opened, this pulldown list should now has the right time highlighted. |
247 | Added the possibility to exclude events/todos/journals in a filter. | 249 | Added the possibility to exclude events/todos/journals in a filter. |
248 | You should exclude journals, if you do not want them to sync with a public calendar. | 250 | You should exclude journals, if you do not want them to sync with a public calendar. |
249 | 251 | ||
250 | KA/Pi: | 252 | KA/Pi: |
251 | Added the possibility to in/exclude public/private/confidential contacts to a filter. | 253 | Added the possibility to in/exclude public/private/confidential contacts to a filter. |
252 | If you have already defined filterrules in KA/Pi you have to adjust them all by setting the "include public/private/confidential" property manually. Sorry for that ... | 254 | If you have already defined filterrules in KA/Pi you have to adjust them all by setting the "include public/private/confidential" property manually. Sorry for that ... |
253 | Added printing of card view and details view on desktop. | 255 | Added printing of card view and details view on desktop. |
254 | Printing of list view is not working... | 256 | Printing of list view is not working... |
255 | Added button for removing pictures in contact editor. | 257 | Added button for removing pictures in contact editor. |
256 | Parsing data fix of KA/Pi version 1.9.17. | 258 | Parsing data fix of KA/Pi version 1.9.17. |
257 | Fixed the "parse name automatically" problem of KA/Pi version 1.9.17. | 259 | Fixed the "parse name automatically" problem of KA/Pi version 1.9.17. |
258 | Fixed some syncing merging problems. | 260 | Fixed some syncing merging problems. |
259 | 261 | ||
260 | 262 | ||
261 | ********** VERSION 1.9.17 ************ | 263 | ********** VERSION 1.9.17 ************ |
262 | 264 | ||
263 | KO/Pi: | 265 | KO/Pi: |
264 | Fixed that tooltips were not updated after moving an item in agenda view. | 266 | Fixed that tooltips were not updated after moving an item in agenda view. |
265 | Fixed a bug in sorting start date for recurring events in list view. | 267 | Fixed a bug in sorting start date for recurring events in list view. |
266 | Changed the left button in todo viewer from "Agenda" to "Set completed". | 268 | Changed the left button in todo viewer from "Agenda" to "Set completed". |
267 | This makes it possible to change a todo in the What's Next View quickly to the completed state without leaving the What's Next View. | 269 | This makes it possible to change a todo in the What's Next View quickly to the completed state without leaving the What's Next View. |
268 | Added more info in the todo viewer: Startdate, parent/sub todos. | 270 | Added more info in the todo viewer: Startdate, parent/sub todos. |
269 | 271 | ||
270 | 272 | ||
271 | KA/Pi: | 273 | KA/Pi: |
272 | All fields search does now actually search all the (possible) fields, | 274 | All fields search does now actually search all the (possible) fields, |
273 | not only those listed in the contact list. | 275 | not only those listed in the contact list. |
274 | Made is possible to inline a picture in a vcard on the Z. | 276 | Made is possible to inline a picture in a vcard on the Z. |
275 | This was only possible on the desktop, now is it possible on the Z as well. | 277 | This was only possible on the desktop, now is it possible on the Z as well. |
276 | Fixed of missing save settings after filter configuration. | 278 | Fixed of missing save settings after filter configuration. |
277 | Made saving of addressbook much faster. | 279 | Made saving of addressbook much faster. |
278 | Fixed extension widget layout problem. | 280 | Fixed extension widget layout problem. |
279 | Fixed saving of default formatted name settings. | 281 | Fixed saving of default formatted name settings. |
280 | Fixed formatted name handling in edit dialog. | 282 | Fixed formatted name handling in edit dialog. |
281 | Added an option for changing formatted names of many contacts | 283 | Added an option for changing formatted names of many contacts |
282 | (menu: File - Change - Set formatted name). | 284 | (menu: File - Change - Set formatted name). |
283 | 285 | ||
284 | QWhatsThis was not working on the Z ( only black rectangle was shown). | 286 | QWhatsThis was not working on the Z ( only black rectangle was shown). |
285 | This is Fixed. | 287 | This is Fixed. |
286 | 288 | ||
287 | KDE-Sync: | 289 | KDE-Sync: |
288 | Now readonly KDE resources are synced as well. | 290 | Now readonly KDE resources are synced as well. |
289 | (They are not changed in KDE itself, of course). | 291 | (They are not changed in KDE itself, of course). |
290 | 292 | ||
291 | 293 | ||
292 | 294 | ||
293 | ********** VERSION 1.9.16 ************ | 295 | ********** VERSION 1.9.16 ************ |
294 | 296 | ||
295 | KO/Pi: | 297 | KO/Pi: |
296 | Fixed search dialog size on Z 6000 (480x640 display). | 298 | Fixed search dialog size on Z 6000 (480x640 display). |
297 | Added setting to hide/show time in agenda items. | 299 | Added setting to hide/show time in agenda items. |
298 | Added setting to hide not running todos in todo view. | 300 | Added setting to hide not running todos in todo view. |
299 | Added columns for start date/time in todo view. | 301 | Added columns for start date/time in todo view. |
300 | Replaced the solid half-hour lines in agenda view by dot lines. | 302 | Replaced the solid half-hour lines in agenda view by dot lines. |
301 | Added possibility of printing the What's Next View on the desktop | 303 | Added possibility of printing the What's Next View on the desktop |
302 | (i.e. Windows and Linux). | 304 | (i.e. Windows and Linux). |
303 | Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. | 305 | Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. |
304 | Added tooltips in month view.(Tooltips only available on desktop) | 306 | Added tooltips in month view.(Tooltips only available on desktop) |
305 | 307 | ||
306 | Fixed a strange problem in KO/Pi alarm applet. | 308 | Fixed a strange problem in KO/Pi alarm applet. |
307 | Did not find the actual problem, | 309 | Did not find the actual problem, |
308 | such that now Qtopia reboots again if deinstalling the alarm applet. | 310 | such that now Qtopia reboots again if deinstalling the alarm applet. |
309 | But the alarm applet should work again. | 311 | But the alarm applet should work again. |
310 | 312 | ||
311 | KA/Pi: | 313 | KA/Pi: |
312 | Fixed the problem, that internal pictures were not saved. | 314 | Fixed the problem, that internal pictures were not saved. |
313 | 315 | ||
314 | Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. | 316 | Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. |
315 | 317 | ||
316 | Fixed some minor problems. (Like word wrap in help text windows). | 318 | Fixed some minor problems. (Like word wrap in help text windows). |
317 | 319 | ||
318 | Fixed a compiling problem in microkde/kresources. | 320 | Fixed a compiling problem in microkde/kresources. |
319 | 321 | ||
320 | KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. | 322 | KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. |
321 | This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) | 323 | This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) |
322 | such that now syncing KO/Pi with Sharp DTM should work on the | 324 | such that now syncing KO/Pi with Sharp DTM should work on the |
323 | Zaurus C 3000 model. | 325 | Zaurus C 3000 model. |
324 | 326 | ||
325 | ********** VERSION 1.9.15 ************ | 327 | ********** VERSION 1.9.15 ************ |
326 | 328 | ||
327 | Usebilty enhancements in KO/Pi: | 329 | Usebilty enhancements in KO/Pi: |
328 | When clicking on the date in a month view cell, the day view is shown. | 330 | When clicking on the date in a month view cell, the day view is shown. |
329 | Old behaviour was, that the "new event" dialog popped up. | 331 | Old behaviour was, that the "new event" dialog popped up. |
330 | 332 | ||
331 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). | 333 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). |
332 | That means, you can restore the latest | 334 | That means, you can restore the latest |
333 | event/todo/journal you have deleted. | 335 | event/todo/journal you have deleted. |
334 | A journal is deleted, if you clear all the text of the journal. | 336 | A journal is deleted, if you clear all the text of the journal. |
335 | 337 | ||
336 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. | 338 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. |
337 | 339 | ||
338 | KA/Pi starting in 480x640 resolution: | 340 | KA/Pi starting in 480x640 resolution: |
339 | Hide the filter action in toolbar | 341 | Hide the filter action in toolbar |
340 | and added icons for undo/delete/redo in toolbar. | 342 | and added icons for undo/delete/redo in toolbar. |
341 | 343 | ||
342 | Change in OM/Pi ViewMail dialog: | 344 | Change in OM/Pi ViewMail dialog: |
343 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. | 345 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. |
344 | But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). | 346 | But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). |
345 | 347 | ||
346 | Fixed a crash when deleting mail-accounts in OM/Pi. | 348 | Fixed a crash when deleting mail-accounts in OM/Pi. |
347 | 349 | ||
348 | 350 | ||
349 | ********** VERSION 1.9.14 ************ | 351 | ********** VERSION 1.9.14 ************ |
350 | 352 | ||
351 | Fixed some problems with the dialog sizes when switching | 353 | Fixed some problems with the dialog sizes when switching |
352 | portrait/landscape mode on 640x480 PDA display. | 354 | portrait/landscape mode on 640x480 PDA display. |
353 | 355 | ||
354 | Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. | 356 | Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. |
355 | 357 | ||
356 | Fixed an ugly bug in KOpieMail: | 358 | Fixed an ugly bug in KOpieMail: |
357 | KOpieMail was not able to write files (mails) to MSDOS file system, | 359 | KOpieMail was not able to write files (mails) to MSDOS file system, |
358 | like on an usual preformatted SD card. That should work now. | 360 | like on an usual preformatted SD card. That should work now. |
359 | To save your mail data on the Sd card do the following: | 361 | To save your mail data on the Sd card do the following: |
360 | Create a dir on the SD card: | 362 | Create a dir on the SD card: |
361 | mkdir /mnt/card/localmail | 363 | mkdir /mnt/card/localmail |
362 | Go to your home dir: | 364 | Go to your home dir: |
363 | cd | 365 | cd |
364 | Go to kopiemail data storage dir: | 366 | Go to kopiemail data storage dir: |
365 | cd kdepim/apps/kopiemail | 367 | cd kdepim/apps/kopiemail |
366 | Create a symlink to the SD card: | 368 | Create a symlink to the SD card: |
367 | ls -s /mnt/card/localmail | 369 | ls -s /mnt/card/localmail |
368 | Now KOpieMail will store all mails on the SD card. | 370 | Now KOpieMail will store all mails on the SD card. |
369 | 371 | ||
370 | KO/Pi Monthview: | 372 | KO/Pi Monthview: |
371 | Now "Go to Today" selects the current month from day 1-end, | 373 | Now "Go to Today" selects the current month from day 1-end, |
372 | not the current date + some days. | 374 | not the current date + some days. |
373 | I.e. "Go to Today" shows now always | 375 | I.e. "Go to Today" shows now always |
374 | the current month with first day of month in the first row. | 376 | the current month with first day of month in the first row. |
375 | 377 | ||
376 | Added missing German translation. | 378 | Added missing German translation. |
377 | 379 | ||
378 | Fixed icons of executeable on Wintendo. | 380 | Fixed icons of executeable on Wintendo. |
379 | 381 | ||
380 | Added a "Show next Mail" button to the OM/Pi | 382 | Added a "Show next Mail" button to the OM/Pi |
381 | mail viewer such that the mail below the current mail | 383 | mail viewer such that the mail below the current mail |
382 | in the mail list view of the current folder | 384 | in the mail list view of the current folder |
383 | can be read with a single click. | 385 | can be read with a single click. |
384 | 386 | ||
385 | 387 | ||
386 | ********** VERSION 1.9.13 ************ | 388 | ********** VERSION 1.9.13 ************ |
387 | 389 | ||
388 | Fixed nasty PwM/Pi file reading bug, when | 390 | Fixed nasty PwM/Pi file reading bug, when |
389 | the used hash algo of file is different then the global | 391 | the used hash algo of file is different then the global |
390 | hash algo. | 392 | hash algo. |
391 | 393 | ||
392 | Added KA/Pi support for opie mailit mailapplication. | 394 | Added KA/Pi support for opie mailit mailapplication. |
393 | 395 | ||
394 | Fixed some bugs in OM/Pi. | 396 | Fixed some bugs in OM/Pi. |
395 | Now character conversion tables are available for the Zaurus | 397 | Now character conversion tables are available for the Zaurus |
396 | to make OM/Pi working properly. | 398 | to make OM/Pi working properly. |
397 | To get the character conversion in OM/Pi working, please download | 399 | To get the character conversion in OM/Pi working, please download |
398 | at the sourceforge project site the package | 400 | at the sourceforge project site the package |
399 | sr-character-conversion_SharpROM_arm.ipk.zip | 401 | sr-character-conversion_SharpROM_arm.ipk.zip |
400 | (or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) | 402 | (or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) |
401 | from the section "general files for KDE/Pim" | 403 | from the section "general files for KDE/Pim" |
402 | Instructions how to install this package are in a ReadMe in this file. | 404 | Instructions how to install this package are in a ReadMe in this file. |
403 | 405 | ||
404 | 406 | ||
405 | Fixed the orientation change problem in KA/Pi when switching | 407 | Fixed the orientation change problem in KA/Pi when switching |
406 | portrait/landscape mode. | 408 | portrait/landscape mode. |
407 | 409 | ||
408 | French translation available for KA/Pi and OM/Pi. | 410 | French translation available for KA/Pi and OM/Pi. |
409 | 411 | ||
410 | Fixed some problems with categories in KO/Pi in DTM sync. | 412 | Fixed some problems with categories in KO/Pi in DTM sync. |
411 | 413 | ||
412 | Added selection dialog for export to phone in KA/Pi. | 414 | Added selection dialog for export to phone in KA/Pi. |
413 | 415 | ||
414 | If in KO/Pi is an attendee selected to add to a meeting and this | 416 | If in KO/Pi is an attendee selected to add to a meeting and this |
415 | attendee is already in the list of attendees, this person is not added | 417 | attendee is already in the list of attendees, this person is not added |
416 | again. | 418 | again. |
417 | 419 | ||
418 | Some menu cleanup in KA/Pi. | 420 | Some menu cleanup in KA/Pi. |
419 | 421 | ||
420 | ********** VERSION 1.9.12 ************ | 422 | ********** VERSION 1.9.12 ************ |
421 | 423 | ||
422 | Fix for the bug in KO/Pi What's Next view of version 1.9.11. | 424 | Fix for the bug in KO/Pi What's Next view of version 1.9.11. |
423 | 425 | ||
424 | Bugfix: Licence file is now shown again. | 426 | Bugfix: Licence file is now shown again. |
425 | 427 | ||
426 | OM/Pi now supports Unicode (utf8 charset). | 428 | OM/Pi now supports Unicode (utf8 charset). |
427 | Fixed some bugs in OM/Pi. | 429 | Fixed some bugs in OM/Pi. |
428 | 430 | ||
429 | KA/Pi has more German translation. | 431 | KA/Pi has more German translation. |
430 | 432 | ||
431 | 433 | ||
432 | ********** VERSION 1.9.11 ************ | 434 | ********** VERSION 1.9.11 ************ |
433 | 435 | ||
434 | Fixed several problems in PWM/Pi, like | 436 | Fixed several problems in PWM/Pi, like |
435 | asking the user, if unsaved changed are pending | 437 | asking the user, if unsaved changed are pending |
436 | when closing the app. | 438 | when closing the app. |
437 | And PwM/Pi handles now different texts for the | 439 | And PwM/Pi handles now different texts for the |
438 | fields Description, Username, Password, configurable per category. | 440 | fields Description, Username, Password, configurable per category. |
439 | 441 | ||
440 | Fixed a crash in KO/Pi , when importing/loading vcs files | 442 | Fixed a crash in KO/Pi , when importing/loading vcs files |
441 | which have an entry with an attendee with state: | 443 | which have an entry with an attendee with state: |
442 | NEEDS ACTION | 444 | NEEDS ACTION |
443 | 445 | ||
444 | Fixed some problems in the German translation of OM/Pi, | 446 | Fixed some problems in the German translation of OM/Pi, |
445 | which makes some dialogs not fitting on the screen | 447 | which makes some dialogs not fitting on the screen |
446 | of the Z 5500. | 448 | of the Z 5500. |
447 | 449 | ||
448 | Fixed Qtopia crash, when disabling/deinstalling | 450 | Fixed Qtopia crash, when disabling/deinstalling |
449 | KO/Pi alarm applet. | 451 | KO/Pi alarm applet. |
450 | 452 | ||
451 | Implemented direct KDE<->KA/Pi sync for KA/Pi running | 453 | Implemented direct KDE<->KA/Pi sync for KA/Pi running |
452 | on Linux desktop. | 454 | on Linux desktop. |
453 | 455 | ||
454 | Added feature "remove sync info" to sync menu. | 456 | Added feature "remove sync info" to sync menu. |
455 | 457 | ||
456 | Tweaked the KO/Pi What's next view a bit, added | 458 | Tweaked the KO/Pi What's next view a bit, added |
457 | setting to hide events that are done. | 459 | setting to hide events that are done. |
458 | 460 | ||
459 | Disabled "beam receive enabled" on startup to | 461 | Disabled "beam receive enabled" on startup to |
460 | avoid problems if Fastload is enabled. | 462 | avoid problems if Fastload is enabled. |
461 | Please set "beam receive enabled", | 463 | Please set "beam receive enabled", |
462 | if you want to receive data via IR. | 464 | if you want to receive data via IR. |
463 | 465 | ||
464 | Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running | 466 | Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running |
465 | on Linux desktop. | 467 | on Linux desktop. |
466 | 468 | ||
467 | Made in KA/Pi scrolling possible, if details view is selected. | 469 | Made in KA/Pi scrolling possible, if details view is selected. |
468 | (The keyboard focus is set automatically to the search line) | 470 | (The keyboard focus is set automatically to the search line) |
469 | 471 | ||
470 | Fixed a bug in DMT sync, that a new entry in DTM was added | 472 | Fixed a bug in DMT sync, that a new entry in DTM was added |
471 | on every sync to Kx/Pi. | 473 | on every sync to Kx/Pi. |
472 | 474 | ||
473 | Fixed missing writing of KA/Pi categories to DMT entries when syncing. | 475 | Fixed missing writing of KA/Pi categories to DMT entries when syncing. |
474 | 476 | ||
475 | Fixed a bug in DMT sync with todos created in KO/Pi containing | 477 | Fixed a bug in DMT sync with todos created in KO/Pi containing |
476 | non-latin1 characters. | 478 | non-latin1 characters. |
477 | 479 | ||
478 | Rearranged package contents of Sharp-ipks and made all | 480 | Rearranged package contents of Sharp-ipks and made all |
479 | packages installable on SD again. | 481 | packages installable on SD again. |
480 | 482 | ||
481 | Fixed the writing of addressbook data in DTM sync. | 483 | Fixed the writing of addressbook data in DTM sync. |
482 | Empty fields in KA/Pi were not removed. | 484 | Empty fields in KA/Pi were not removed. |
483 | 485 | ||
484 | Added better category handling in KA/Pi: | 486 | Added better category handling in KA/Pi: |
485 | Added item | 487 | Added item |
486 | Edit Categories and | 488 | Edit Categories and |
487 | Manage new categories | 489 | Manage new categories |
488 | to the settings menu. | 490 | to the settings menu. |
489 | Possible to configure a view to display categories. | 491 | Possible to configure a view to display categories. |
490 | 492 | ||
491 | Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. | 493 | Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. |
492 | 494 | ||
493 | Fixed displaying of "free" days and time in KO Monthview and Agendaview. | 495 | Fixed displaying of "free" days and time in KO Monthview and Agendaview. |
494 | 496 | ||
495 | ... and many other bugfixes. | 497 | ... and many other bugfixes. |
496 | 498 | ||
497 | ********** VERSION 1.9.10 ************ | 499 | ********** VERSION 1.9.10 ************ |
498 | 500 | ||
499 | Many internal small bugfixes. | 501 | Many internal small bugfixes. |
500 | And fix of the "big" bug in KO/Pi, | 502 | And fix of the "big" bug in KO/Pi, |
501 | that after Syncing the appointments had an offset by several hours. | 503 | that after Syncing the appointments had an offset by several hours. |
502 | That was a problem with the internal timezone setting, | 504 | That was a problem with the internal timezone setting, |
503 | introduced by the changed timezone configuration settings. | 505 | introduced by the changed timezone configuration settings. |
504 | 506 | ||
505 | German translation for OM/Pi is now available. | 507 | German translation for OM/Pi is now available. |
506 | 508 | ||
507 | 509 | ||
508 | ********** VERSION 1.9.9 ************ | 510 | ********** VERSION 1.9.9 ************ |
509 | 511 | ||
510 | KDE-Pim/Pi has a new Member! | 512 | KDE-Pim/Pi has a new Member! |
511 | It is called PWM/Pi (Passwordmanager/platform-independent) | 513 | It is called PWM/Pi (Passwordmanager/platform-independent) |
512 | and it is available for the Zaurus. | 514 | and it is available for the Zaurus. |
513 | It is planned, that it will be available later for Windows. | 515 | It is planned, that it will be available later for Windows. |
514 | (And for Linux, of course). | 516 | (And for Linux, of course). |
515 | It is a port of the Passwordmanager of KDE. | 517 | It is a port of the Passwordmanager of KDE. |
516 | It will need the MicroKDElibs to run. | 518 | It will need the MicroKDElibs to run. |
517 | 519 | ||
518 | Made loading of addressbooks in KA/Pi up to 7 times faster! | 520 | Made loading of addressbooks in KA/Pi up to 7 times faster! |
519 | The bigger your addressbook file, the more starting speed | 521 | The bigger your addressbook file, the more starting speed |
520 | will you gain. (relatively) | 522 | will you gain. (relatively) |
521 | 523 | ||
522 | The Qtopia addressbook connector is now platform independend | 524 | The Qtopia addressbook connector is now platform independend |
523 | as well and should work on any platform for importing/exporting | 525 | as well and should work on any platform for importing/exporting |
524 | Qtopia and Opie XML files. | 526 | Qtopia and Opie XML files. |
525 | 527 | ||
526 | Added a +30min feature to the timezone settings to make | 528 | Added a +30min feature to the timezone settings to make |
527 | KDE-Pim/Pi useable in Australia and other parts on the | 529 | KDE-Pim/Pi useable in Australia and other parts on the |
528 | world with strange timezones ;-) | 530 | world with strange timezones ;-) |
529 | 531 | ||
530 | German "Umlaute" should now be sorted correctly on the Z in KA/Pi. | 532 | German "Umlaute" should now be sorted correctly on the Z in KA/Pi. |
531 | 533 | ||
532 | It is now possible to disable the | 534 | It is now possible to disable the |
533 | "receive data via infrared" feature, such that syncing with | 535 | "receive data via infrared" feature, such that syncing with |
534 | Outlook is now possible again with Kx/Pi runing. | 536 | Outlook is now possible again with Kx/Pi runing. |
535 | Please disable it, before syncing Sharp DTM with Outlook. | 537 | Please disable it, before syncing Sharp DTM with Outlook. |
536 | For your convenience, the "receive data via infrared" feature | 538 | For your convenience, the "receive data via infrared" feature |
537 | is disabled automatically, if you sync Kx/Pi with DTM. | 539 | is disabled automatically, if you sync Kx/Pi with DTM. |
538 | You have to enable it again manually after syncing. | 540 | You have to enable it again manually after syncing. |
539 | Enabling this feature makes it impossible to start the | 541 | Enabling this feature makes it impossible to start the |
540 | Sharp DTM apps. If this feature is enabled, you will only get the | 542 | Sharp DTM apps. If this feature is enabled, you will only get the |
541 | alarm notification from KO/Pi and not from the Sharp calendar. | 543 | alarm notification from KO/Pi and not from the Sharp calendar. |
542 | This is very useful if you sync KO/Pi with Sharp DTM, | 544 | This is very useful if you sync KO/Pi with Sharp DTM, |
543 | because after syncing you usually would get notified about | 545 | because after syncing you usually would get notified about |
544 | an alarm by KO/Pi and the Sharp Calendar. | 546 | an alarm by KO/Pi and the Sharp Calendar. |
545 | 547 | ||
546 | Together with the Linux desktop version of KO/Pi | 548 | Together with the Linux desktop version of KO/Pi |
547 | it is now possible to sync KO/Pi on the Zaurus | 549 | it is now possible to sync KO/Pi on the Zaurus |
548 | with the complete KDE-desktop (3.3 or later) | 550 | with the complete KDE-desktop (3.3 or later) |
549 | calendar data easily. | 551 | calendar data easily. |
550 | That makes it possible to sync the Z with one | 552 | That makes it possible to sync the Z with one |
551 | click of a mouse with the KDE-Desktop. | 553 | click of a mouse with the KDE-Desktop. |
552 | This feature it available for all Zaurus platforms KO/Pi | 554 | This feature it available for all Zaurus platforms KO/Pi |
553 | is running on. | 555 | is running on. |
554 | The only thing needed is a running KO/Pi on Linux and | 556 | The only thing needed is a running KO/Pi on Linux and |
555 | a compiled version of the small | 557 | a compiled version of the small |
556 | KDE-Pim/Pi<->KDE-Desktop access command line program, | 558 | KDE-Pim/Pi<->KDE-Desktop access command line program, |
557 | which is in the KDE-Pim/Pi sources available. | 559 | which is in the KDE-Pim/Pi sources available. |
558 | 560 | ||
559 | The "KDE-desktop" syncing feature for KA/Pi will follow | 561 | The "KDE-desktop" syncing feature for KA/Pi will follow |
560 | in the next releases. | 562 | in the next releases. |
561 | 563 | ||
562 | Fixed the vcard export bug, which had the version 1.9.8. | 564 | Fixed the vcard export bug, which had the version 1.9.8. |
563 | 565 | ||
564 | Added missing GERMAN translation to KO/Pi. | 566 | Added missing GERMAN translation to KO/Pi. |
565 | Hi PsionX, could you add the missing french translation?Thx! | 567 | Hi PsionX, could you add the missing french translation?Thx! |
566 | 568 | ||
567 | Translation files for KA/Pi are available as well. | 569 | Translation files for KA/Pi are available as well. |
568 | GERMAN translation will be available in the next release. | 570 | GERMAN translation will be available in the next release. |
569 | PsionX ( yres, you again ;-) ), could you start translating | 571 | PsionX ( yres, you again ;-) ), could you start translating |
570 | KA/Pi? Thx! | 572 | KA/Pi? Thx! |
571 | 573 | ||
572 | You can download the version 1.9.9 at | 574 | You can download the version 1.9.9 at |
573 | 575 | ||
574 | http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 | 576 | http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 |
575 | 577 | ||
576 | Note: | 578 | Note: |
577 | To run the mail program OM/Pi you need libopenssl. | 579 | To run the mail program OM/Pi you need libopenssl. |
578 | A link to a download loaction is available at | 580 | A link to a download loaction is available at |
579 | ZSI at www.killefiz.de | 581 | ZSI at www.killefiz.de |
580 | 582 | ||
581 | 583 | ||
582 | ********** VERSION 1.9.8 ************ | 584 | ********** VERSION 1.9.8 ************ |
583 | 585 | ||
584 | Fixed character decoding in OM/Pi. | 586 | Fixed character decoding in OM/Pi. |
585 | (e.g. German "Umlaute" were not displayed properly.) | 587 | (e.g. German "Umlaute" were not displayed properly.) |
586 | 588 | ||
587 | Made is possible to reparent todos in KO/Pi. | 589 | Made is possible to reparent todos in KO/Pi. |
588 | Use contextmenu or keys (look at Help-Keys + Colors) for that. | 590 | Use contextmenu or keys (look at Help-Keys + Colors) for that. |
589 | 591 | ||
590 | Added the missing Sync-Howto and WhatsNew to the packages. | 592 | Added the missing Sync-Howto and WhatsNew to the packages. |
591 | 593 | ||
592 | KO/Pi on Linux desktop can now sync with KDE desktop. | 594 | KO/Pi on Linux desktop can now sync with KDE desktop. |
593 | That means: When using KO/Pi on Linux desktop for syncing with | 595 | That means: When using KO/Pi on Linux desktop for syncing with |
594 | KDE desktop and the Zaurus, the Zaurus can be synced now | 596 | KDE desktop and the Zaurus, the Zaurus can be synced now |
595 | with all KDE-Calendar resources, not only with one local file. | 597 | with all KDE-Calendar resources, not only with one local file. |
596 | (That makes it possible to sync the Zaurus with the | 598 | (That makes it possible to sync the Zaurus with the |
597 | calendar data on a Kolab server) | 599 | calendar data on a Kolab server) |
598 | 600 | ||
599 | KA/Pi syncing with KDE desktop will be available in the next version. | 601 | KA/Pi syncing with KDE desktop will be available in the next version. |
600 | 602 | ||
601 | 603 | ||
602 | ********** VERSION 1.9.7 ************ | 604 | ********** VERSION 1.9.7 ************ |
603 | 605 | ||
604 | KO/Pi - KA/Pi on Windows: | 606 | KO/Pi - KA/Pi on Windows: |
605 | Now a directory can be defined by the user, where the | 607 | Now a directory can be defined by the user, where the |
606 | application/config data should be saved. | 608 | application/config data should be saved. |
607 | Define your desired path in the evironment variable | 609 | Define your desired path in the evironment variable |
608 | MICROKDEHOME | 610 | MICROKDEHOME |
609 | before starting KO/Pi or KA/Pi. | 611 | before starting KO/Pi or KA/Pi. |
610 | 612 | ||
611 | An easy Kx/Pi to Kx/Pi syncing is now possible | 613 | An easy Kx/Pi to Kx/Pi syncing is now possible |
612 | (it is called Pi-Sync) via network. | 614 | (it is called Pi-Sync) via network. |
613 | Please look at the Sync Howto. | 615 | Please look at the Sync Howto. |
614 | 616 | ||
615 | Exporting of calendar data and contacts to mobile phones is now possible. | 617 | Exporting of calendar data and contacts to mobile phones is now possible. |
616 | The SyncHowto is updated with information howto | 618 | The SyncHowto is updated with information howto |
617 | access/sync mobile phones. | 619 | access/sync mobile phones. |
618 | Please look at the Sync Howto. | 620 | Please look at the Sync Howto. |
619 | 621 | ||
620 | Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly. | 622 | Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly. |
621 | Please disable Fastload for the original contact/calendar applications | 623 | Please disable Fastload for the original contact/calendar applications |
622 | and close them. | 624 | and close them. |
623 | KO/Pi and KA/Pi must be running in order to receive the data. | 625 | KO/Pi and KA/Pi must be running in order to receive the data. |
624 | (KO/Pi and KA/Pi are always running if Fastload for them is enabled!) | 626 | (KO/Pi and KA/Pi are always running if Fastload for them is enabled!) |
625 | 627 | ||
626 | In the KA/Pi details view are now the preferred tel. numbers displayed on top | 628 | In the KA/Pi details view are now the preferred tel. numbers displayed on top |
627 | of the other data ( emails/tel.numbers/addresses) | 629 | of the other data ( emails/tel.numbers/addresses) |
628 | 630 | ||
629 | Fixed some syncing problems in KA/Pi. | 631 | Fixed some syncing problems in KA/Pi. |
630 | 632 | ||
631 | Added font settings for the KA/Pi details view. | 633 | Added font settings for the KA/Pi details view. |
632 | Added fields "children's name" and "gender" to KA/Pi. | 634 | Added fields "children's name" and "gender" to KA/Pi. |
633 | 635 | ||
634 | Made searching in KA/Pi better: | 636 | Made searching in KA/Pi better: |
635 | Now the first item in a view is selected after a search automatically and | 637 | Now the first item in a view is selected after a search automatically and |
636 | the views can be scrolled up/down when the search input field has the keyboard focus. | 638 | the views can be scrolled up/down when the search input field has the keyboard focus. |
637 | 639 | ||
638 | And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi. | 640 | And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi. |
639 | 641 | ||
640 | 642 | ||
641 | ********** VERSION 1.9.6 ************ | 643 | ********** VERSION 1.9.6 ************ |
642 | 644 | ||
643 | Changes in the external application communication on the Zaurus | 645 | Changes in the external application communication on the Zaurus |
644 | in order to use less RAM when the apps are running. | 646 | in order to use less RAM when the apps are running. |
645 | First syncing of addressbooks (KA/Pi) is possible. | 647 | First syncing of addressbooks (KA/Pi) is possible. |
646 | 648 | ||
647 | 649 | ||
648 | ********** VERSION 1.9.5a ************ | 650 | ********** VERSION 1.9.5a ************ |
649 | 651 | ||
650 | Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5. | 652 | Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5. |
651 | Fixed some small bugs. | 653 | Fixed some small bugs. |
652 | KA/Pi shows now the birthday in summary view. | 654 | KA/Pi shows now the birthday in summary view. |
653 | Now OM/Pi and KA/Pi are using the date format defined in KO/Pi | 655 | Now OM/Pi and KA/Pi are using the date format defined in KO/Pi |
654 | for displaying dates. | 656 | for displaying dates. |
655 | 657 | ||
656 | 658 | ||
657 | ********** VERSION 1.9.5 ************ | 659 | ********** VERSION 1.9.5 ************ |
658 | 660 | ||
659 | There is still no Addressbook syncing! | 661 | There is still no Addressbook syncing! |
660 | 662 | ||
661 | New in 1.9.5: | 663 | New in 1.9.5: |
662 | 664 | ||
663 | Many bugfixes. | 665 | Many bugfixes. |
664 | Better searching in KA/Pi. | 666 | Better searching in KA/Pi. |
665 | You can configure in KA/Pi if you want to search only after | 667 | You can configure in KA/Pi if you want to search only after |
666 | <return> key pressed. | 668 | <return> key pressed. |
667 | 669 | ||
668 | Better mail downloading in OM/Pi. | 670 | Better mail downloading in OM/Pi. |
669 | 671 | ||
670 | First experimental alpha version of sync of KO/Pi with mobile phones. | 672 | First experimental alpha version of sync of KO/Pi with mobile phones. |
671 | See gammu documentation for supported phones. | 673 | See gammu documentation for supported phones. |
672 | You need to install the package kammu_1.9.5_arm.ipk for sync of KO/Pi with mobile phones. kammu_1.9.5_arm.ipk needs libbluetooth and libsdp. | 674 | You need to install the package kammu_1.9.5_arm.ipk for sync of KO/Pi with mobile phones. kammu_1.9.5_arm.ipk needs libbluetooth and libsdp. |
673 | Quick hint how to use: | 675 | Quick hint how to use: |
674 | NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL! | 676 | NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL! |
675 | Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp. | 677 | Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp. |
676 | Create syncprofile - mobile device | 678 | Create syncprofile - mobile device |
677 | Remove entry for model. (Leave empty ). | 679 | Remove entry for model. (Leave empty ). |
678 | Enable infrared on Zaurus and your Phone. | 680 | Enable infrared on Zaurus and your Phone. |
679 | Sync. | 681 | Sync. |
680 | To get a more detailed log, start kopi from konsole. | 682 | To get a more detailed log, start kopi from konsole. |
681 | 683 | ||
682 | ********** VERSION 1.9.4 ************ | 684 | ********** VERSION 1.9.4 ************ |
683 | 685 | ||
684 | This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. | 686 | This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. |
685 | 687 | ||
686 | WARNING: | 688 | WARNING: |
687 | PLEASE BACKUP ALL YOUR DATA! | 689 | PLEASE BACKUP ALL YOUR DATA! |
688 | We have changed a lot and maybe there are some unknown problems. | 690 | We have changed a lot and maybe there are some unknown problems. |
689 | 691 | ||
690 | SYNC HANDLING HAS CHANGED! | 692 | SYNC HANDLING HAS CHANGED! |
691 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. | 693 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. |
692 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). | 694 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). |
693 | 695 | ||
694 | You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs. | 696 | You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs. |
695 | If you get the error: "Install only possible in main memory", just try it again to install it on SD card. That worked for me. And it was reported that rebooting Qtopia did help in this case as well. | 697 | If you get the error: "Install only possible in main memory", just try it again to install it on SD card. That worked for me. And it was reported that rebooting Qtopia did help in this case as well. |
696 | 698 | ||
697 | As programs are available: | 699 | As programs are available: |
698 | KO/Pi (korganizer ipk) - a calendar program. | 700 | KO/Pi (korganizer ipk) - a calendar program. |
699 | KA/Pi (kaddressbook ipk ) - an addressbook | 701 | KA/Pi (kaddressbook ipk ) - an addressbook |
700 | OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support. | 702 | OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support. |
701 | 703 | ||
702 | An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode. | 704 | An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode. |
703 | (If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia) | 705 | (If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia) |
704 | 706 | ||
705 | All the applications are installed in a "Pim" TAB. | 707 | All the applications are installed in a "Pim" TAB. |
706 | If this TAB is new on your system, you can get an icon in this TAB by installing pim_TAB_icon_1.9.4_arm.ipk | 708 | If this TAB is new on your system, you can get an icon in this TAB by installing pim_TAB_icon_1.9.4_arm.ipk |
707 | 709 | ||
708 | All the application are integrated. | 710 | All the application are integrated. |
709 | Such that you can choose in KO/Pi the attendees of a meeting from the addresses in KA/Pi. When you click in KA/Pi on the email address, OM/Pi is started to write the mail. | 711 | Such that you can choose in KO/Pi the attendees of a meeting from the addresses in KA/Pi. When you click in KA/Pi on the email address, OM/Pi is started to write the mail. |
710 | 712 | ||
711 | HINT: | 713 | HINT: |
712 | If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number. | 714 | If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number. |
713 | 715 | ||
714 | What's new? | 716 | What's new? |
715 | 717 | ||
716 | SYNC HANDLING HAS CHANGED! | 718 | SYNC HANDLING HAS CHANGED! |
717 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. | 719 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. |
718 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). | 720 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). |
719 | 721 | ||
720 | New in OM/Pi: | 722 | New in OM/Pi: |
721 | When copying(i.e. downloading mails) , you can specify, that only mails of a given size should be downloaded. Added mail copy possibility for selected mails. | 723 | When copying(i.e. downloading mails) , you can specify, that only mails of a given size should be downloaded. Added mail copy possibility for selected mails. |
722 | 724 | ||
723 | New in KO/Pi: | 725 | New in KO/Pi: |
724 | French is now available for KO/Pi. | 726 | French is now available for KO/Pi. |
725 | Choose menu:Actions - Configure:TAB locale | 727 | Choose menu:Actions - Configure:TAB locale |
726 | Syncing has changed. | 728 | Syncing has changed. |
727 | Phone sync available soon. | 729 | Phone sync available soon. |
728 | Not much changes, I cannot remember them ... | 730 | Not much changes, I cannot remember them ... |
729 | 731 | ||
730 | New in KA/Pi: | 732 | New in KA/Pi: |
731 | Beaming possible. | 733 | Beaming possible. |
732 | Sharp DTM readonly access possible( create a new DTM resource ); | 734 | Sharp DTM readonly access possible( create a new DTM resource ); |
733 | Better searching possible. | 735 | Better searching possible. |
734 | Search is performed only after pressing the return key. | 736 | Search is performed only after pressing the return key. |
735 | Use wildcard * to specify parts of a name. | 737 | Use wildcard * to specify parts of a name. |
736 | 738 | ||
737 | Better name/email selection dialog (called from KO/Pi or OM/Pi). In this dialog, now searching is possible. Like in KA/Pi, use return key and wildcard * . | 739 | Better name/email selection dialog (called from KO/Pi or OM/Pi). In this dialog, now searching is possible. Like in KA/Pi, use return key and wildcard * . |
738 | 740 | ||
739 | A big improvement is the new management of the contact access. | 741 | A big improvement is the new management of the contact access. |
740 | In version 1.9.3, every application was using their own addressbook access data. | 742 | In version 1.9.3, every application was using their own addressbook access data. |
741 | That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi. | 743 | That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi. |
742 | That was wasting of memory, if you had several hundreds of contacts. | 744 | That was wasting of memory, if you had several hundreds of contacts. |
743 | 745 | ||
744 | Now only KA/Pi accesses the addressbook. | 746 | Now only KA/Pi accesses the addressbook. |
745 | If KO/Pi or OM/Pi want to get some name/email data, they request KA/Pi to open the name/email selection dialog and send it back to them. | 747 | If KO/Pi or OM/Pi want to get some name/email data, they request KA/Pi to open the name/email selection dialog and send it back to them. |
746 | If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly. | 748 | If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly. |
747 | That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first. | 749 | That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first. |
748 | 750 | ||
749 | New in the KO/Pi alarm applet: | 751 | New in the KO/Pi alarm applet: |
750 | Configure your own timer popup menu! | 752 | Configure your own timer popup menu! |
751 | (Text and minutes for timer countdown) | 753 | (Text and minutes for timer countdown) |
752 | Just edit the file | 754 | Just edit the file |
753 | (yourhomedir)/.kopialarmtimerrc | 755 | (yourhomedir)/.kopialarmtimerrc |
754 | and start/stop a timer to get a new menu with the data of this file. | 756 | and start/stop a timer to get a new menu with the data of this file. |
755 | 757 | ||
756 | ********** VERSION 1.9.3 ************ | 758 | ********** VERSION 1.9.3 ************ |
757 | 1) | 759 | 1) |
758 | Now KO/Pi on Windows imports directly the calendar data of | 760 | Now KO/Pi on Windows imports directly the calendar data of |
759 | an installed Outlook. Should work with OL version >= 2000. | 761 | an installed Outlook. Should work with OL version >= 2000. |
760 | 762 | ||
761 | ********** VERSION 1.9.2 ************ | 763 | ********** VERSION 1.9.2 ************ |
762 | 1) | 764 | 1) |
763 | KDE-Pim/Pi has got a new member: | 765 | KDE-Pim/Pi has got a new member: |
764 | KmicroMail (KM/Pi) is a mail program, | 766 | KmicroMail (KM/Pi) is a mail program, |
765 | which can handle IMAP and POP mail access. | 767 | which can handle IMAP and POP mail access. |
766 | It is based on Opie-Mail v3. | 768 | It is based on Opie-Mail v3. |
767 | All dependencies to the Opie libraries ar removed, | 769 | All dependencies to the Opie libraries ar removed, |
768 | such that no additional Opie lib is needed. | 770 | such that no additional Opie lib is needed. |
769 | It is already integrated in KO/Pi and KA/Pi. | 771 | It is already integrated in KO/Pi and KA/Pi. |
770 | It it now available for the Zaurus,probably it | 772 | It it now available for the Zaurus,probably it |
771 | will be available for other platforms later. | 773 | will be available for other platforms later. |
772 | Hint: | 774 | Hint: |
773 | Create your own contact (name + email) | 775 | Create your own contact (name + email) |
774 | in KA/Pi, select this contact and choose menu: | 776 | in KA/Pi, select this contact and choose menu: |
775 | Settings - Set Who Am I. | 777 | Settings - Set Who Am I. |
776 | Now the settings of this contact are used as | 778 | Now the settings of this contact are used as |
777 | the sender data in KM/Pi. | 779 | the sender data in KM/Pi. |
778 | 2) | 780 | 2) |
779 | KDE-Pim/Pi is split up in five different | 781 | KDE-Pim/Pi is split up in five different |
780 | packages now precompiled for Sharp Zaurus: | 782 | packages now precompiled for Sharp Zaurus: |
781 | --kmicrokdelibs_1.9.2_arm.ipk | 783 | --kmicrokdelibs_1.9.2_arm.ipk |
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index 2e38ae3..eae41aa 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp | |||
@@ -1,2164 +1,2165 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <qdatetime.h> | 21 | #include <qdatetime.h> |
22 | #include <qstring.h> | 22 | #include <qstring.h> |
23 | #include <qptrlist.h> | 23 | #include <qptrlist.h> |
24 | #include <qfile.h> | 24 | #include <qfile.h> |
25 | 25 | ||
26 | #include <kdebug.h> | 26 | #include <kdebug.h> |
27 | #include <klocale.h> | 27 | #include <klocale.h> |
28 | #include <kglobal.h> | 28 | #include <kglobal.h> |
29 | 29 | ||
30 | extern "C" { | 30 | extern "C" { |
31 | #include <ical.h> | 31 | #include <ical.h> |
32 | #include <icalss.h> | 32 | #include <icalss.h> |
33 | #include <icalparser.h> | 33 | #include <icalparser.h> |
34 | #include <icalrestriction.h> | 34 | #include <icalrestriction.h> |
35 | } | 35 | } |
36 | 36 | ||
37 | #include "calendar.h" | 37 | #include "calendar.h" |
38 | #include "journal.h" | 38 | #include "journal.h" |
39 | #include "icalformat.h" | 39 | #include "icalformat.h" |
40 | #include "icalformatimpl.h" | 40 | #include "icalformatimpl.h" |
41 | #include "compat.h" | 41 | #include "compat.h" |
42 | 42 | ||
43 | #define _ICAL_VERSION "2.0" | 43 | #define _ICAL_VERSION "2.0" |
44 | 44 | ||
45 | using namespace KCal; | 45 | using namespace KCal; |
46 | 46 | ||
47 | const int gSecondsPerMinute = 60; | 47 | const int gSecondsPerMinute = 60; |
48 | const int gSecondsPerHour = gSecondsPerMinute * 60; | 48 | const int gSecondsPerHour = gSecondsPerMinute * 60; |
49 | const int gSecondsPerDay = gSecondsPerHour * 24; | 49 | const int gSecondsPerDay = gSecondsPerHour * 24; |
50 | const int gSecondsPerWeek = gSecondsPerDay * 7; | 50 | const int gSecondsPerWeek = gSecondsPerDay * 7; |
51 | 51 | ||
52 | ICalFormatImpl::ICalFormatImpl( ICalFormat *parent ) : | 52 | ICalFormatImpl::ICalFormatImpl( ICalFormat *parent ) : |
53 | mParent( parent ), mCalendarVersion( 0 ) | 53 | mParent( parent ), mCalendarVersion( 0 ) |
54 | { | 54 | { |
55 | mCompat = new Compat; | 55 | mCompat = new Compat; |
56 | } | 56 | } |
57 | 57 | ||
58 | ICalFormatImpl::~ICalFormatImpl() | 58 | ICalFormatImpl::~ICalFormatImpl() |
59 | { | 59 | { |
60 | delete mCompat; | 60 | delete mCompat; |
61 | } | 61 | } |
62 | 62 | ||
63 | class ToStringVisitor : public Incidence::Visitor | 63 | class ToStringVisitor : public Incidence::Visitor |
64 | { | 64 | { |
65 | public: | 65 | public: |
66 | ToStringVisitor( ICalFormatImpl *impl ) : mImpl( impl ), mComponent( 0 ) {} | 66 | ToStringVisitor( ICalFormatImpl *impl ) : mImpl( impl ), mComponent( 0 ) {} |
67 | 67 | ||
68 | bool visit( Event *e ) { mComponent = mImpl->writeEvent( e ); return true; } | 68 | bool visit( Event *e ) { mComponent = mImpl->writeEvent( e ); return true; } |
69 | bool visit( Todo *e ) { mComponent = mImpl->writeTodo( e ); return true; } | 69 | bool visit( Todo *e ) { mComponent = mImpl->writeTodo( e ); return true; } |
70 | bool visit( Journal *e ) { mComponent = mImpl->writeJournal( e ); return true; } | 70 | bool visit( Journal *e ) { mComponent = mImpl->writeJournal( e ); return true; } |
71 | 71 | ||
72 | icalcomponent *component() { return mComponent; } | 72 | icalcomponent *component() { return mComponent; } |
73 | 73 | ||
74 | private: | 74 | private: |
75 | ICalFormatImpl *mImpl; | 75 | ICalFormatImpl *mImpl; |
76 | icalcomponent *mComponent; | 76 | icalcomponent *mComponent; |
77 | }; | 77 | }; |
78 | 78 | ||
79 | icalcomponent *ICalFormatImpl::writeIncidence(Incidence *incidence) | 79 | icalcomponent *ICalFormatImpl::writeIncidence(Incidence *incidence) |
80 | { | 80 | { |
81 | ToStringVisitor v( this ); | 81 | ToStringVisitor v( this ); |
82 | incidence->accept(v); | 82 | incidence->accept(v); |
83 | return v.component(); | 83 | return v.component(); |
84 | } | 84 | } |
85 | 85 | ||
86 | icalcomponent *ICalFormatImpl::writeTodo(Todo *todo) | 86 | icalcomponent *ICalFormatImpl::writeTodo(Todo *todo) |
87 | { | 87 | { |
88 | QString tmpStr; | 88 | QString tmpStr; |
89 | QStringList tmpStrList; | 89 | QStringList tmpStrList; |
90 | 90 | ||
91 | icalcomponent *vtodo = icalcomponent_new(ICAL_VTODO_COMPONENT); | 91 | icalcomponent *vtodo = icalcomponent_new(ICAL_VTODO_COMPONENT); |
92 | 92 | ||
93 | writeIncidence(vtodo,todo); | 93 | writeIncidence(vtodo,todo); |
94 | 94 | ||
95 | // due date | 95 | // due date |
96 | if (todo->hasDueDate()) { | 96 | if (todo->hasDueDate()) { |
97 | icaltimetype due; | 97 | icaltimetype due; |
98 | if (todo->doesFloat()) { | 98 | if (todo->doesFloat()) { |
99 | due = writeICalDate(todo->dtDue().date()); | 99 | due = writeICalDate(todo->dtDue().date()); |
100 | } else { | 100 | } else { |
101 | due = writeICalDateTime(todo->dtDue()); | 101 | due = writeICalDateTime(todo->dtDue()); |
102 | } | 102 | } |
103 | icalcomponent_add_property(vtodo,icalproperty_new_due(due)); | 103 | icalcomponent_add_property(vtodo,icalproperty_new_due(due)); |
104 | } | 104 | } |
105 | 105 | ||
106 | // start time | 106 | // start time |
107 | if (todo->hasStartDate()) { | 107 | if (todo->hasStartDate()) { |
108 | icaltimetype start; | 108 | icaltimetype start; |
109 | if (todo->doesFloat()) { | 109 | if (todo->doesFloat()) { |
110 | // kdDebug(5800) << "§§ Incidence " << todo->summary() << " floats." << endl; | 110 | // kdDebug(5800) << "§§ Incidence " << todo->summary() << " floats." << endl; |
111 | start = writeICalDate(todo->dtStart().date()); | 111 | start = writeICalDate(todo->dtStart().date()); |
112 | } else { | 112 | } else { |
113 | // kdDebug(5800) << "§§ incidence " << todo->summary() << " has time." << endl; | 113 | // kdDebug(5800) << "§§ incidence " << todo->summary() << " has time." << endl; |
114 | start = writeICalDateTime(todo->dtStart()); | 114 | start = writeICalDateTime(todo->dtStart()); |
115 | } | 115 | } |
116 | icalcomponent_add_property(vtodo,icalproperty_new_dtstart(start)); | 116 | icalcomponent_add_property(vtodo,icalproperty_new_dtstart(start)); |
117 | } | 117 | } |
118 | 118 | ||
119 | // completion date | 119 | // completion date |
120 | if (todo->isCompleted()) { | 120 | if (todo->isCompleted()) { |
121 | if (!todo->hasCompletedDate()) { | 121 | if (!todo->hasCompletedDate()) { |
122 | // If todo was created by KOrganizer <2.2 it has no correct completion | 122 | // If todo was created by KOrganizer <2.2 it has no correct completion |
123 | // date. Set it to now. | 123 | // date. Set it to now. |
124 | todo->setCompleted(QDateTime::currentDateTime()); | 124 | todo->setCompleted(QDateTime::currentDateTime()); |
125 | } | 125 | } |
126 | icaltimetype completed = writeICalDateTime(todo->completed()); | 126 | icaltimetype completed = writeICalDateTime(todo->completed()); |
127 | icalcomponent_add_property(vtodo,icalproperty_new_completed(completed)); | 127 | icalcomponent_add_property(vtodo,icalproperty_new_completed(completed)); |
128 | } | 128 | } |
129 | 129 | ||
130 | icalcomponent_add_property(vtodo, | 130 | icalcomponent_add_property(vtodo, |
131 | icalproperty_new_percentcomplete(todo->percentComplete())); | 131 | icalproperty_new_percentcomplete(todo->percentComplete())); |
132 | 132 | ||
133 | return vtodo; | 133 | return vtodo; |
134 | } | 134 | } |
135 | 135 | ||
136 | icalcomponent *ICalFormatImpl::writeEvent(Event *event) | 136 | icalcomponent *ICalFormatImpl::writeEvent(Event *event) |
137 | { | 137 | { |
138 | kdDebug(5800) << "Write Event '" << event->summary() << "' (" << event->uid() | 138 | kdDebug(5800) << "Write Event '" << event->summary() << "' (" << event->uid() |
139 | << ")" << endl; | 139 | << ")" << endl; |
140 | 140 | ||
141 | QString tmpStr; | 141 | QString tmpStr; |
142 | QStringList tmpStrList; | 142 | QStringList tmpStrList; |
143 | 143 | ||
144 | icalcomponent *vevent = icalcomponent_new(ICAL_VEVENT_COMPONENT); | 144 | icalcomponent *vevent = icalcomponent_new(ICAL_VEVENT_COMPONENT); |
145 | 145 | ||
146 | writeIncidence(vevent,event); | 146 | writeIncidence(vevent,event); |
147 | 147 | ||
148 | // start time | 148 | // start time |
149 | icaltimetype start; | 149 | icaltimetype start; |
150 | if (event->doesFloat()) { | 150 | if (event->doesFloat()) { |
151 | // kdDebug(5800) << "§§ Incidence " << event->summary() << " floats." << endl; | 151 | // kdDebug(5800) << "§§ Incidence " << event->summary() << " floats." << endl; |
152 | start = writeICalDate(event->dtStart().date()); | 152 | start = writeICalDate(event->dtStart().date()); |
153 | } else { | 153 | } else { |
154 | // kdDebug(5800) << "§§ incidence " << event->summary() << " has time." << endl; | 154 | // kdDebug(5800) << "§§ incidence " << event->summary() << " has time." << endl; |
155 | start = writeICalDateTime(event->dtStart()); | 155 | start = writeICalDateTime(event->dtStart()); |
156 | } | 156 | } |
157 | icalcomponent_add_property(vevent,icalproperty_new_dtstart(start)); | 157 | icalcomponent_add_property(vevent,icalproperty_new_dtstart(start)); |
158 | 158 | ||
159 | if (event->hasEndDate()) { | 159 | if (event->hasEndDate()) { |
160 | // end time | 160 | // end time |
161 | icaltimetype end; | 161 | icaltimetype end; |
162 | if (event->doesFloat()) { | 162 | if (event->doesFloat()) { |
163 | // kdDebug(5800) << "§§ Event " << event->summary() << " floats." << endl; | 163 | // kdDebug(5800) << "§§ Event " << event->summary() << " floats." << endl; |
164 | // +1 day because end date is non-inclusive. | 164 | // +1 day because end date is non-inclusive. |
165 | end = writeICalDate( event->dtEnd().date().addDays( 1 ) ); | 165 | end = writeICalDate( event->dtEnd().date().addDays( 1 ) ); |
166 | } else { | 166 | } else { |
167 | // kdDebug(5800) << "§§ Event " << event->summary() << " has time." << endl; | 167 | // kdDebug(5800) << "§§ Event " << event->summary() << " has time." << endl; |
168 | end = writeICalDateTime(event->dtEnd()); | 168 | end = writeICalDateTime(event->dtEnd()); |
169 | } | 169 | } |
170 | icalcomponent_add_property(vevent,icalproperty_new_dtend(end)); | 170 | icalcomponent_add_property(vevent,icalproperty_new_dtend(end)); |
171 | } | 171 | } |
172 | 172 | ||
173 | // TODO: attachments, resources | 173 | // TODO: attachments, resources |
174 | #if 0 | 174 | #if 0 |
175 | // attachments | 175 | // attachments |
176 | tmpStrList = anEvent->attachments(); | 176 | tmpStrList = anEvent->attachments(); |
177 | for ( QStringList::Iterator it = tmpStrList.begin(); | 177 | for ( QStringList::Iterator it = tmpStrList.begin(); |
178 | it != tmpStrList.end(); | 178 | it != tmpStrList.end(); |
179 | ++it ) | 179 | ++it ) |
180 | addPropValue(vevent, VCAttachProp, (*it).utf8()); | 180 | addPropValue(vevent, VCAttachProp, (*it).utf8()); |
181 | 181 | ||
182 | // resources | 182 | // resources |
183 | tmpStrList = anEvent->resources(); | 183 | tmpStrList = anEvent->resources(); |
184 | tmpStr = tmpStrList.join(";"); | 184 | tmpStr = tmpStrList.join(";"); |
185 | if (!tmpStr.isEmpty()) | 185 | if (!tmpStr.isEmpty()) |
186 | addPropValue(vevent, VCResourcesProp, tmpStr.utf8()); | 186 | addPropValue(vevent, VCResourcesProp, tmpStr.utf8()); |
187 | 187 | ||
188 | #endif | 188 | #endif |
189 | 189 | ||
190 | // Transparency | 190 | // Transparency |
191 | switch( event->transparency() ) { | 191 | switch( event->transparency() ) { |
192 | case Event::Transparent: | 192 | case Event::Transparent: |
193 | icalcomponent_add_property(vevent, icalproperty_new_transp(ICAL_TRANSP_TRANSPARENT)); | 193 | icalcomponent_add_property(vevent, icalproperty_new_transp(ICAL_TRANSP_TRANSPARENT)); |
194 | break; | 194 | break; |
195 | case Event::Opaque: | 195 | case Event::Opaque: |
196 | icalcomponent_add_property(vevent, icalproperty_new_transp(ICAL_TRANSP_OPAQUE)); | 196 | icalcomponent_add_property(vevent, icalproperty_new_transp(ICAL_TRANSP_OPAQUE)); |
197 | break; | 197 | break; |
198 | } | 198 | } |
199 | 199 | ||
200 | return vevent; | 200 | return vevent; |
201 | } | 201 | } |
202 | 202 | ||
203 | icalcomponent *ICalFormatImpl::writeFreeBusy(FreeBusy *freebusy, | 203 | icalcomponent *ICalFormatImpl::writeFreeBusy(FreeBusy *freebusy, |
204 | Scheduler::Method method) | 204 | Scheduler::Method method) |
205 | { | 205 | { |
206 | 206 | ||
207 | 207 | ||
208 | icalcomponent *vfreebusy = icalcomponent_new(ICAL_VFREEBUSY_COMPONENT); | 208 | icalcomponent *vfreebusy = icalcomponent_new(ICAL_VFREEBUSY_COMPONENT); |
209 | 209 | ||
210 | writeIncidenceBase(vfreebusy,freebusy); | 210 | writeIncidenceBase(vfreebusy,freebusy); |
211 | 211 | ||
212 | icalcomponent_add_property(vfreebusy, icalproperty_new_dtstart( | 212 | icalcomponent_add_property(vfreebusy, icalproperty_new_dtstart( |
213 | writeICalDateTime(freebusy->dtStart()))); | 213 | writeICalDateTime(freebusy->dtStart()))); |
214 | 214 | ||
215 | icalcomponent_add_property(vfreebusy, icalproperty_new_dtend( | 215 | icalcomponent_add_property(vfreebusy, icalproperty_new_dtend( |
216 | writeICalDateTime(freebusy->dtEnd()))); | 216 | writeICalDateTime(freebusy->dtEnd()))); |
217 | 217 | ||
218 | if (method == Scheduler::Request) { | 218 | if (method == Scheduler::Request) { |
219 | icalcomponent_add_property(vfreebusy,icalproperty_new_uid( | 219 | icalcomponent_add_property(vfreebusy,icalproperty_new_uid( |
220 | freebusy->uid().utf8())); | 220 | freebusy->uid().utf8())); |
221 | } | 221 | } |
222 | 222 | ||
223 | //Loops through all the periods in the freebusy object | 223 | //Loops through all the periods in the freebusy object |
224 | QValueList<Period> list = freebusy->busyPeriods(); | 224 | QValueList<Period> list = freebusy->busyPeriods(); |
225 | QValueList<Period>::Iterator it; | 225 | QValueList<Period>::Iterator it; |
226 | icalperiodtype period; | 226 | icalperiodtype period; |
227 | for (it = list.begin(); it!= list.end(); ++it) { | 227 | for (it = list.begin(); it!= list.end(); ++it) { |
228 | period.start = writeICalDateTime((*it).start()); | 228 | period.start = writeICalDateTime((*it).start()); |
229 | period.end = writeICalDateTime((*it).end()); | 229 | period.end = writeICalDateTime((*it).end()); |
230 | icalcomponent_add_property(vfreebusy, icalproperty_new_freebusy(period) ); | 230 | icalcomponent_add_property(vfreebusy, icalproperty_new_freebusy(period) ); |
231 | } | 231 | } |
232 | 232 | ||
233 | return vfreebusy; | 233 | return vfreebusy; |
234 | } | 234 | } |
235 | 235 | ||
236 | icalcomponent *ICalFormatImpl::writeJournal(Journal *journal) | 236 | icalcomponent *ICalFormatImpl::writeJournal(Journal *journal) |
237 | { | 237 | { |
238 | icalcomponent *vjournal = icalcomponent_new(ICAL_VJOURNAL_COMPONENT); | 238 | icalcomponent *vjournal = icalcomponent_new(ICAL_VJOURNAL_COMPONENT); |
239 | 239 | ||
240 | writeIncidence(vjournal,journal); | 240 | writeIncidence(vjournal,journal); |
241 | 241 | ||
242 | // start time | 242 | // start time |
243 | if (journal->dtStart().isValid()) { | 243 | if (journal->dtStart().isValid()) { |
244 | icaltimetype start; | 244 | icaltimetype start; |
245 | if (journal->doesFloat()) { | 245 | if (journal->doesFloat()) { |
246 | // kdDebug(5800) << "§§ Incidence " << event->summary() << " floats." << endl; | 246 | // kdDebug(5800) << "§§ Incidence " << event->summary() << " floats." << endl; |
247 | start = writeICalDate(journal->dtStart().date()); | 247 | start = writeICalDate(journal->dtStart().date()); |
248 | } else { | 248 | } else { |
249 | // kdDebug(5800) << "§§ incidence " << event->summary() << " has time." << endl; | 249 | // kdDebug(5800) << "§§ incidence " << event->summary() << " has time." << endl; |
250 | start = writeICalDateTime(journal->dtStart()); | 250 | start = writeICalDateTime(journal->dtStart()); |
251 | } | 251 | } |
252 | icalcomponent_add_property(vjournal,icalproperty_new_dtstart(start)); | 252 | icalcomponent_add_property(vjournal,icalproperty_new_dtstart(start)); |
253 | } | 253 | } |
254 | 254 | ||
255 | return vjournal; | 255 | return vjournal; |
256 | } | 256 | } |
257 | 257 | ||
258 | void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) | 258 | void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) |
259 | { | 259 | { |
260 | // pilot sync stuff | 260 | // pilot sync stuff |
261 | // TODO: move this application-specific code to kpilot | 261 | // TODO: move this application-specific code to kpilot |
262 | if (incidence->pilotId()) { | 262 | if (incidence->pilotId()) { |
263 | incidence->setNonKDECustomProperty("X-PILOTID", QString::number(incidence->pilotId())); | 263 | incidence->setNonKDECustomProperty("X-PILOTID", QString::number(incidence->pilotId())); |
264 | incidence->setNonKDECustomProperty("X-PILOTSTAT", QString::number(incidence->syncStatus())); | 264 | incidence->setNonKDECustomProperty("X-PILOTSTAT", QString::number(incidence->syncStatus())); |
265 | } | 265 | } |
266 | if ( !incidence->IDStr().isEmpty()) { | 266 | if ( !incidence->IDStr().isEmpty()) { |
267 | incidence->setNonKDECustomProperty("X-KOPIEXTID",incidence->IDStr() ); | 267 | incidence->setNonKDECustomProperty("X-KOPIEXTID",incidence->IDStr() ); |
268 | } | 268 | } |
269 | 269 | ||
270 | 270 | ||
271 | writeIncidenceBase(parent,incidence); | 271 | writeIncidenceBase(parent,incidence); |
272 | if (incidence->cancelled()) { | 272 | if (incidence->cancelled()) { |
273 | icalcomponent_add_property(parent,icalproperty_new_status(ICAL_STATUS_CANCELLED)); | 273 | icalcomponent_add_property(parent,icalproperty_new_status(ICAL_STATUS_CANCELLED)); |
274 | } | 274 | } |
275 | 275 | ||
276 | // creation date | 276 | // creation date |
277 | icalcomponent_add_property(parent,icalproperty_new_created( | 277 | icalcomponent_add_property(parent,icalproperty_new_created( |
278 | writeICalDateTime(incidence->created()))); | 278 | writeICalDateTime(incidence->created()))); |
279 | 279 | ||
280 | // unique id | 280 | // unique id |
281 | icalcomponent_add_property(parent,icalproperty_new_uid( | 281 | icalcomponent_add_property(parent,icalproperty_new_uid( |
282 | incidence->uid().utf8())); | 282 | incidence->uid().utf8())); |
283 | 283 | ||
284 | // revision | 284 | // revision |
285 | icalcomponent_add_property(parent,icalproperty_new_sequence( | 285 | icalcomponent_add_property(parent,icalproperty_new_sequence( |
286 | incidence->revision())); | 286 | incidence->revision())); |
287 | 287 | ||
288 | // last modification date | 288 | // last modification date |
289 | icalcomponent_add_property(parent,icalproperty_new_lastmodified( | 289 | icalcomponent_add_property(parent,icalproperty_new_lastmodified( |
290 | writeICalDateTime(incidence->lastModified()))); | 290 | writeICalDateTime(incidence->lastModified()))); |
291 | 291 | ||
292 | // description | 292 | // description |
293 | if (!incidence->description().isEmpty()) { | 293 | if (!incidence->description().isEmpty()) { |
294 | icalcomponent_add_property(parent,icalproperty_new_description( | 294 | icalcomponent_add_property(parent,icalproperty_new_description( |
295 | incidence->description().utf8())); | 295 | incidence->description().utf8())); |
296 | } | 296 | } |
297 | 297 | ||
298 | // summary | 298 | // summary |
299 | if (!incidence->summary().isEmpty()) { | 299 | if (!incidence->summary().isEmpty()) { |
300 | icalcomponent_add_property(parent,icalproperty_new_summary( | 300 | icalcomponent_add_property(parent,icalproperty_new_summary( |
301 | incidence->summary().utf8())); | 301 | incidence->summary().utf8())); |
302 | } | 302 | } |
303 | 303 | ||
304 | // location | 304 | // location |
305 | if (!incidence->location().isEmpty()) { | 305 | if (!incidence->location().isEmpty()) { |
306 | icalcomponent_add_property(parent,icalproperty_new_location( | 306 | icalcomponent_add_property(parent,icalproperty_new_location( |
307 | incidence->location().utf8())); | 307 | incidence->location().utf8())); |
308 | } | 308 | } |
309 | 309 | ||
310 | // TODO: | 310 | // TODO: |
311 | // status | 311 | // status |
312 | // addPropValue(parent, VCStatusProp, incidence->getStatusStr().utf8()); | 312 | // addPropValue(parent, VCStatusProp, incidence->getStatusStr().utf8()); |
313 | 313 | ||
314 | // secrecy | 314 | // secrecy |
315 | enum icalproperty_class classInt; | 315 | enum icalproperty_class classInt; |
316 | switch (incidence->secrecy()) { | 316 | switch (incidence->secrecy()) { |
317 | case Incidence::SecrecyPublic: | 317 | case Incidence::SecrecyPublic: |
318 | classInt = ICAL_CLASS_PUBLIC; | 318 | classInt = ICAL_CLASS_PUBLIC; |
319 | break; | 319 | break; |
320 | case Incidence::SecrecyConfidential: | 320 | case Incidence::SecrecyConfidential: |
321 | classInt = ICAL_CLASS_CONFIDENTIAL; | 321 | classInt = ICAL_CLASS_CONFIDENTIAL; |
322 | break; | 322 | break; |
323 | case Incidence::SecrecyPrivate: | 323 | case Incidence::SecrecyPrivate: |
324 | classInt =ICAL_CLASS_PRIVATE ; | 324 | classInt =ICAL_CLASS_PRIVATE ; |
325 | default: | 325 | default: |
326 | classInt =ICAL_CLASS_PRIVATE ; | 326 | classInt =ICAL_CLASS_PRIVATE ; |
327 | break; | 327 | break; |
328 | } | 328 | } |
329 | icalcomponent_add_property(parent,icalproperty_new_class(classInt)); | 329 | icalcomponent_add_property(parent,icalproperty_new_class(classInt)); |
330 | 330 | ||
331 | // priority | 331 | // priority |
332 | icalcomponent_add_property(parent,icalproperty_new_priority( | 332 | icalcomponent_add_property(parent,icalproperty_new_priority( |
333 | incidence->priority())); | 333 | incidence->priority())); |
334 | 334 | ||
335 | // categories | 335 | // categories |
336 | QStringList categories = incidence->categories(); | 336 | QStringList categories = incidence->categories(); |
337 | QStringList::Iterator it; | 337 | QStringList::Iterator it; |
338 | for(it = categories.begin(); it != categories.end(); ++it ) { | 338 | for(it = categories.begin(); it != categories.end(); ++it ) { |
339 | icalcomponent_add_property(parent,icalproperty_new_categories((*it).utf8())); | 339 | icalcomponent_add_property(parent,icalproperty_new_categories((*it).utf8())); |
340 | } | 340 | } |
341 | // TODO: Ensure correct concatenation of categories properties. | 341 | // TODO: Ensure correct concatenation of categories properties. |
342 | 342 | ||
343 | /* | 343 | /* |
344 | // categories | 344 | // categories |
345 | tmpStrList = incidence->getCategories(); | 345 | tmpStrList = incidence->getCategories(); |
346 | tmpStr = ""; | 346 | tmpStr = ""; |
347 | QString catStr; | 347 | QString catStr; |
348 | for ( QStringList::Iterator it = tmpStrList.begin(); | 348 | for ( QStringList::Iterator it = tmpStrList.begin(); |
349 | it != tmpStrList.end(); | 349 | it != tmpStrList.end(); |
350 | ++it ) { | 350 | ++it ) { |
351 | catStr = *it; | 351 | catStr = *it; |
352 | if (catStr[0] == ' ') | 352 | if (catStr[0] == ' ') |
353 | tmpStr += catStr.mid(1); | 353 | tmpStr += catStr.mid(1); |
354 | else | 354 | else |
355 | tmpStr += catStr; | 355 | tmpStr += catStr; |
356 | // this must be a ';' character as the vCalendar specification requires! | 356 | // this must be a ';' character as the vCalendar specification requires! |
357 | // vcc.y has been hacked to translate the ';' to a ',' when the vcal is | 357 | // vcc.y has been hacked to translate the ';' to a ',' when the vcal is |
358 | // read in. | 358 | // read in. |
359 | tmpStr += ";"; | 359 | tmpStr += ";"; |
360 | } | 360 | } |
361 | if (!tmpStr.isEmpty()) { | 361 | if (!tmpStr.isEmpty()) { |
362 | tmpStr.truncate(tmpStr.length()-1); | 362 | tmpStr.truncate(tmpStr.length()-1); |
363 | icalcomponent_add_property(parent,icalproperty_new_categories( | 363 | icalcomponent_add_property(parent,icalproperty_new_categories( |
364 | writeText(incidence->getCategories().join(";")))); | 364 | writeText(incidence->getCategories().join(";")))); |
365 | } | 365 | } |
366 | */ | 366 | */ |
367 | 367 | ||
368 | // related event | 368 | // related event |
369 | if (incidence->relatedTo()) { | 369 | if (incidence->relatedTo()) { |
370 | icalcomponent_add_property(parent,icalproperty_new_relatedto( | 370 | icalcomponent_add_property(parent,icalproperty_new_relatedto( |
371 | incidence->relatedTo()->uid().utf8())); | 371 | incidence->relatedTo()->uid().utf8())); |
372 | } | 372 | } |
373 | 373 | ||
374 | // recurrence rule stuff | 374 | // recurrence rule stuff |
375 | Recurrence *recur = incidence->recurrence(); | 375 | Recurrence *recur = incidence->recurrence(); |
376 | if (recur->doesRecur()) { | 376 | if (recur->doesRecur()) { |
377 | 377 | ||
378 | icalcomponent_add_property(parent,writeRecurrenceRule(recur)); | 378 | icalcomponent_add_property(parent,writeRecurrenceRule(recur)); |
379 | } | 379 | } |
380 | 380 | ||
381 | // recurrence excpetion dates | 381 | // recurrence excpetion dates |
382 | DateList dateList = incidence->exDates(); | 382 | DateList dateList = incidence->exDates(); |
383 | DateList::ConstIterator exIt; | 383 | DateList::ConstIterator exIt; |
384 | for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) { | 384 | for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) { |
385 | icalcomponent_add_property(parent,icalproperty_new_exdate( | 385 | icalcomponent_add_property(parent,icalproperty_new_exdate( |
386 | writeICalDate(*exIt))); | 386 | writeICalDate(*exIt))); |
387 | } | 387 | } |
388 | 388 | ||
389 | // attachments | 389 | // attachments |
390 | QPtrList<Attachment> attachments = incidence->attachments(); | 390 | QPtrList<Attachment> attachments = incidence->attachments(); |
391 | for (Attachment *at = attachments.first(); at; at = attachments.next()) | 391 | for (Attachment *at = attachments.first(); at; at = attachments.next()) |
392 | icalcomponent_add_property(parent,writeAttachment(at)); | 392 | icalcomponent_add_property(parent,writeAttachment(at)); |
393 | 393 | ||
394 | // alarms | 394 | // alarms |
395 | QPtrList<Alarm> alarms = incidence->alarms(); | 395 | QPtrList<Alarm> alarms = incidence->alarms(); |
396 | Alarm* alarm; | 396 | Alarm* alarm; |
397 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { | 397 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { |
398 | if (alarm->enabled()) { | 398 | if (alarm->enabled()) { |
399 | kdDebug(5800) << "Write alarm for " << incidence->summary() << endl; | 399 | kdDebug(5800) << "Write alarm for " << incidence->summary() << endl; |
400 | icalcomponent_add_component(parent,writeAlarm(alarm)); | 400 | icalcomponent_add_component(parent,writeAlarm(alarm)); |
401 | } | 401 | } |
402 | } | 402 | } |
403 | if( incidence->hasRecurrenceID() ) { | 403 | if( incidence->hasRecurrenceID() ) { |
404 | icalcomponent_add_property(parent, | 404 | icalcomponent_add_property(parent, |
405 | icalproperty_new_recurrenceid( writeICalDateTime( incidence->recurrenceID()))); | 405 | icalproperty_new_recurrenceid( writeICalDateTime( incidence->recurrenceID()))); |
406 | } | 406 | } |
407 | // duration | 407 | // duration |
408 | 408 | ||
409 | // turned off as it always is set to PTS0 (and must not occur together with DTEND | 409 | // turned off as it always is set to PTS0 (and must not occur together with DTEND |
410 | 410 | ||
411 | // if (incidence->hasDuration()) { | 411 | if (incidence->hasDuration()) { |
412 | // icaldurationtype duration; | 412 | icaldurationtype duration; |
413 | // duration = writeICalDuration(incidence->duration()); | 413 | duration = writeICalDuration(incidence->duration()); |
414 | // icalcomponent_add_property(parent,icalproperty_new_duration(duration)); | 414 | icalcomponent_add_property(parent,icalproperty_new_duration(duration)); |
415 | // } | 415 | } |
416 | } | 416 | } |
417 | 417 | ||
418 | void ICalFormatImpl::writeIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) | 418 | void ICalFormatImpl::writeIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) |
419 | { | 419 | { |
420 | icalcomponent_add_property(parent,icalproperty_new_dtstamp( | 420 | icalcomponent_add_property(parent,icalproperty_new_dtstamp( |
421 | writeICalDateTime(QDateTime::currentDateTime()))); | 421 | writeICalDateTime(QDateTime::currentDateTime()))); |
422 | 422 | ||
423 | // organizer stuff | 423 | // organizer stuff |
424 | icalcomponent_add_property(parent,icalproperty_new_organizer( | 424 | icalcomponent_add_property(parent,icalproperty_new_organizer( |
425 | ("MAILTO:" + incidenceBase->organizer()).utf8())); | 425 | ("MAILTO:" + incidenceBase->organizer()).utf8())); |
426 | 426 | ||
427 | // attendees | 427 | // attendees |
428 | if (incidenceBase->attendeeCount() != 0) { | 428 | if (incidenceBase->attendeeCount() != 0) { |
429 | QPtrList<Attendee> al = incidenceBase->attendees(); | 429 | QPtrList<Attendee> al = incidenceBase->attendees(); |
430 | QPtrListIterator<Attendee> ai(al); | 430 | QPtrListIterator<Attendee> ai(al); |
431 | for (; ai.current(); ++ai) { | 431 | for (; ai.current(); ++ai) { |
432 | icalcomponent_add_property(parent,writeAttendee(ai.current())); | 432 | icalcomponent_add_property(parent,writeAttendee(ai.current())); |
433 | } | 433 | } |
434 | } | 434 | } |
435 | 435 | ||
436 | // custom properties | 436 | // custom properties |
437 | writeCustomProperties(parent, incidenceBase); | 437 | writeCustomProperties(parent, incidenceBase); |
438 | } | 438 | } |
439 | 439 | ||
440 | void ICalFormatImpl::writeCustomProperties(icalcomponent *parent,CustomProperties *properties) | 440 | void ICalFormatImpl::writeCustomProperties(icalcomponent *parent,CustomProperties *properties) |
441 | { | 441 | { |
442 | QMap<QCString, QString> custom = properties->customProperties(); | 442 | QMap<QCString, QString> custom = properties->customProperties(); |
443 | for (QMap<QCString, QString>::Iterator c = custom.begin(); c != custom.end(); ++c) { | 443 | for (QMap<QCString, QString>::Iterator c = custom.begin(); c != custom.end(); ++c) { |
444 | icalproperty *p = icalproperty_new_x(c.data().utf8()); | 444 | icalproperty *p = icalproperty_new_x(c.data().utf8()); |
445 | icalproperty_set_x_name(p,c.key()); | 445 | icalproperty_set_x_name(p,c.key()); |
446 | icalcomponent_add_property(parent,p); | 446 | icalcomponent_add_property(parent,p); |
447 | } | 447 | } |
448 | } | 448 | } |
449 | 449 | ||
450 | icalproperty *ICalFormatImpl::writeAttendee(Attendee *attendee) | 450 | icalproperty *ICalFormatImpl::writeAttendee(Attendee *attendee) |
451 | { | 451 | { |
452 | icalproperty *p = icalproperty_new_attendee("mailto:" + attendee->email().utf8()); | 452 | icalproperty *p = icalproperty_new_attendee("mailto:" + attendee->email().utf8()); |
453 | 453 | ||
454 | if (!attendee->name().isEmpty()) { | 454 | if (!attendee->name().isEmpty()) { |
455 | icalproperty_add_parameter(p,icalparameter_new_cn(attendee->name().utf8())); | 455 | icalproperty_add_parameter(p,icalparameter_new_cn(attendee->name().utf8())); |
456 | } | 456 | } |
457 | 457 | ||
458 | 458 | ||
459 | icalproperty_add_parameter(p,icalparameter_new_rsvp( | 459 | icalproperty_add_parameter(p,icalparameter_new_rsvp( |
460 | attendee->RSVP() ? ICAL_RSVP_TRUE : ICAL_RSVP_FALSE )); | 460 | attendee->RSVP() ? ICAL_RSVP_TRUE : ICAL_RSVP_FALSE )); |
461 | 461 | ||
462 | icalparameter_partstat status = ICAL_PARTSTAT_NEEDSACTION; | 462 | icalparameter_partstat status = ICAL_PARTSTAT_NEEDSACTION; |
463 | switch (attendee->status()) { | 463 | switch (attendee->status()) { |
464 | default: | 464 | default: |
465 | case Attendee::NeedsAction: | 465 | case Attendee::NeedsAction: |
466 | status = ICAL_PARTSTAT_NEEDSACTION; | 466 | status = ICAL_PARTSTAT_NEEDSACTION; |
467 | break; | 467 | break; |
468 | case Attendee::Accepted: | 468 | case Attendee::Accepted: |
469 | status = ICAL_PARTSTAT_ACCEPTED; | 469 | status = ICAL_PARTSTAT_ACCEPTED; |
470 | break; | 470 | break; |
471 | case Attendee::Declined: | 471 | case Attendee::Declined: |
472 | status = ICAL_PARTSTAT_DECLINED; | 472 | status = ICAL_PARTSTAT_DECLINED; |
473 | break; | 473 | break; |
474 | case Attendee::Tentative: | 474 | case Attendee::Tentative: |
475 | status = ICAL_PARTSTAT_TENTATIVE; | 475 | status = ICAL_PARTSTAT_TENTATIVE; |
476 | break; | 476 | break; |
477 | case Attendee::Delegated: | 477 | case Attendee::Delegated: |
478 | status = ICAL_PARTSTAT_DELEGATED; | 478 | status = ICAL_PARTSTAT_DELEGATED; |
479 | break; | 479 | break; |
480 | case Attendee::Completed: | 480 | case Attendee::Completed: |
481 | status = ICAL_PARTSTAT_COMPLETED; | 481 | status = ICAL_PARTSTAT_COMPLETED; |
482 | break; | 482 | break; |
483 | case Attendee::InProcess: | 483 | case Attendee::InProcess: |
484 | status = ICAL_PARTSTAT_INPROCESS; | 484 | status = ICAL_PARTSTAT_INPROCESS; |
485 | break; | 485 | break; |
486 | } | 486 | } |
487 | icalproperty_add_parameter(p,icalparameter_new_partstat(status)); | 487 | icalproperty_add_parameter(p,icalparameter_new_partstat(status)); |
488 | 488 | ||
489 | icalparameter_role role = ICAL_ROLE_REQPARTICIPANT; | 489 | icalparameter_role role = ICAL_ROLE_REQPARTICIPANT; |
490 | switch (attendee->role()) { | 490 | switch (attendee->role()) { |
491 | case Attendee::Chair: | 491 | case Attendee::Chair: |
492 | role = ICAL_ROLE_CHAIR; | 492 | role = ICAL_ROLE_CHAIR; |
493 | break; | 493 | break; |
494 | default: | 494 | default: |
495 | case Attendee::ReqParticipant: | 495 | case Attendee::ReqParticipant: |
496 | role = ICAL_ROLE_REQPARTICIPANT; | 496 | role = ICAL_ROLE_REQPARTICIPANT; |
497 | break; | 497 | break; |
498 | case Attendee::OptParticipant: | 498 | case Attendee::OptParticipant: |
499 | role = ICAL_ROLE_OPTPARTICIPANT; | 499 | role = ICAL_ROLE_OPTPARTICIPANT; |
500 | break; | 500 | break; |
501 | case Attendee::NonParticipant: | 501 | case Attendee::NonParticipant: |
502 | role = ICAL_ROLE_NONPARTICIPANT; | 502 | role = ICAL_ROLE_NONPARTICIPANT; |
503 | break; | 503 | break; |
504 | } | 504 | } |
505 | icalproperty_add_parameter(p,icalparameter_new_role(role)); | 505 | icalproperty_add_parameter(p,icalparameter_new_role(role)); |
506 | 506 | ||
507 | if (!attendee->uid().isEmpty()) { | 507 | if (!attendee->uid().isEmpty()) { |
508 | icalparameter* icalparameter_uid = icalparameter_new_x(attendee->uid().utf8()); | 508 | icalparameter* icalparameter_uid = icalparameter_new_x(attendee->uid().utf8()); |
509 | icalparameter_set_xname(icalparameter_uid,"X-UID"); | 509 | icalparameter_set_xname(icalparameter_uid,"X-UID"); |
510 | icalproperty_add_parameter(p,icalparameter_uid); | 510 | icalproperty_add_parameter(p,icalparameter_uid); |
511 | } | 511 | } |
512 | 512 | ||
513 | return p; | 513 | return p; |
514 | } | 514 | } |
515 | 515 | ||
516 | icalproperty *ICalFormatImpl::writeAttachment(Attachment *att) | 516 | icalproperty *ICalFormatImpl::writeAttachment(Attachment *att) |
517 | { | 517 | { |
518 | #if 0 | 518 | #if 0 |
519 | icalattachtype* attach = icalattachtype_new(); | 519 | icalattachtype* attach = icalattachtype_new(); |
520 | if (att->isURI()) | 520 | if (att->isURI()) |
521 | icalattachtype_set_url(attach, att->uri().utf8().data()); | 521 | icalattachtype_set_url(attach, att->uri().utf8().data()); |
522 | else | 522 | else |
523 | icalattachtype_set_base64(attach, att->data(), 0); | 523 | icalattachtype_set_base64(attach, att->data(), 0); |
524 | #endif | 524 | #endif |
525 | icalattach *attach; | 525 | icalattach *attach; |
526 | if (att->isURI()) | 526 | if (att->isURI()) |
527 | attach = icalattach_new_from_url( att->uri().utf8().data()); | 527 | attach = icalattach_new_from_url( att->uri().utf8().data()); |
528 | else | 528 | else |
529 | attach = icalattach_new_from_data ( (unsigned char *)att->data(), 0, 0); | 529 | attach = icalattach_new_from_data ( (unsigned char *)att->data(), 0, 0); |
530 | icalproperty *p = icalproperty_new_attach(attach); | 530 | icalproperty *p = icalproperty_new_attach(attach); |
531 | if (!att->mimeType().isEmpty()) | 531 | if (!att->mimeType().isEmpty()) |
532 | icalproperty_add_parameter(p,icalparameter_new_fmttype(att->mimeType().utf8().data())); | 532 | icalproperty_add_parameter(p,icalparameter_new_fmttype(att->mimeType().utf8().data())); |
533 | 533 | ||
534 | if (att->isBinary()) { | 534 | if (att->isBinary()) { |
535 | icalproperty_add_parameter(p,icalparameter_new_value(ICAL_VALUE_BINARY)); | 535 | icalproperty_add_parameter(p,icalparameter_new_value(ICAL_VALUE_BINARY)); |
536 | icalproperty_add_parameter(p,icalparameter_new_encoding(ICAL_ENCODING_BASE64)); | 536 | icalproperty_add_parameter(p,icalparameter_new_encoding(ICAL_ENCODING_BASE64)); |
537 | } | 537 | } |
538 | return p; | 538 | return p; |
539 | } | 539 | } |
540 | 540 | ||
541 | icalproperty *ICalFormatImpl::writeRecurrenceRule(Recurrence *recur) | 541 | icalproperty *ICalFormatImpl::writeRecurrenceRule(Recurrence *recur) |
542 | { | 542 | { |
543 | // kdDebug(5800) << "ICalFormatImpl::writeRecurrenceRule()" << endl; | 543 | // kdDebug(5800) << "ICalFormatImpl::writeRecurrenceRule()" << endl; |
544 | 544 | ||
545 | icalrecurrencetype r; | 545 | icalrecurrencetype r; |
546 | 546 | ||
547 | icalrecurrencetype_clear(&r); | 547 | icalrecurrencetype_clear(&r); |
548 | 548 | ||
549 | int index = 0; | 549 | int index = 0; |
550 | int index2 = 0; | 550 | int index2 = 0; |
551 | 551 | ||
552 | QPtrList<Recurrence::rMonthPos> tmpPositions; | 552 | QPtrList<Recurrence::rMonthPos> tmpPositions; |
553 | QPtrList<int> tmpDays; | 553 | QPtrList<int> tmpDays; |
554 | int *tmpDay; | 554 | int *tmpDay; |
555 | Recurrence::rMonthPos *tmpPos; | 555 | Recurrence::rMonthPos *tmpPos; |
556 | bool datetime = false; | 556 | bool datetime = false; |
557 | int day; | 557 | int day; |
558 | int i; | 558 | int i; |
559 | 559 | ||
560 | switch(recur->doesRecur()) { | 560 | switch(recur->doesRecur()) { |
561 | case Recurrence::rMinutely: | 561 | case Recurrence::rMinutely: |
562 | r.freq = ICAL_MINUTELY_RECURRENCE; | 562 | r.freq = ICAL_MINUTELY_RECURRENCE; |
563 | datetime = true; | 563 | datetime = true; |
564 | break; | 564 | break; |
565 | case Recurrence::rHourly: | 565 | case Recurrence::rHourly: |
566 | r.freq = ICAL_HOURLY_RECURRENCE; | 566 | r.freq = ICAL_HOURLY_RECURRENCE; |
567 | datetime = true; | 567 | datetime = true; |
568 | break; | 568 | break; |
569 | case Recurrence::rDaily: | 569 | case Recurrence::rDaily: |
570 | r.freq = ICAL_DAILY_RECURRENCE; | 570 | r.freq = ICAL_DAILY_RECURRENCE; |
571 | break; | 571 | break; |
572 | case Recurrence::rWeekly: | 572 | case Recurrence::rWeekly: |
573 | r.freq = ICAL_WEEKLY_RECURRENCE; | 573 | r.freq = ICAL_WEEKLY_RECURRENCE; |
574 | r.week_start = static_cast<icalrecurrencetype_weekday>(recur->weekStart()%7 + 1); | 574 | r.week_start = static_cast<icalrecurrencetype_weekday>(recur->weekStart()%7 + 1); |
575 | for (i = 0; i < 7; i++) { | 575 | for (i = 0; i < 7; i++) { |
576 | if (recur->days().testBit(i)) { | 576 | if (recur->days().testBit(i)) { |
577 | day = (i + 1)%7 + 1; // convert from Monday=0 to Sunday=1 | 577 | day = (i + 1)%7 + 1; // convert from Monday=0 to Sunday=1 |
578 | r.by_day[index++] = icalrecurrencetype_day_day_of_week(day); | 578 | r.by_day[index++] = icalrecurrencetype_day_day_of_week(day); |
579 | } | 579 | } |
580 | } | 580 | } |
581 | // r.by_day[index] = ICAL_RECURRENCE_ARRAY_MAX; | 581 | // r.by_day[index] = ICAL_RECURRENCE_ARRAY_MAX; |
582 | break; | 582 | break; |
583 | case Recurrence::rMonthlyPos: | 583 | case Recurrence::rMonthlyPos: |
584 | r.freq = ICAL_MONTHLY_RECURRENCE; | 584 | r.freq = ICAL_MONTHLY_RECURRENCE; |
585 | 585 | ||
586 | tmpPositions = recur->monthPositions(); | 586 | tmpPositions = recur->monthPositions(); |
587 | for (tmpPos = tmpPositions.first(); | 587 | for (tmpPos = tmpPositions.first(); |
588 | tmpPos; | 588 | tmpPos; |
589 | tmpPos = tmpPositions.next()) { | 589 | tmpPos = tmpPositions.next()) { |
590 | for (i = 0; i < 7; i++) { | 590 | for (i = 0; i < 7; i++) { |
591 | if (tmpPos->rDays.testBit(i)) { | 591 | if (tmpPos->rDays.testBit(i)) { |
592 | day = (i + 1)%7 + 1; // convert from Monday=0 to Sunday=1 | 592 | day = (i + 1)%7 + 1; // convert from Monday=0 to Sunday=1 |
593 | day += tmpPos->rPos*8; | 593 | day += tmpPos->rPos*8; |
594 | if (tmpPos->negative) day = -day; | 594 | if (tmpPos->negative) day = -day; |
595 | r.by_day[index++] = day; | 595 | r.by_day[index++] = day; |
596 | } | 596 | } |
597 | } | 597 | } |
598 | } | 598 | } |
599 | // r.by_day[index] = ICAL_RECURRENCE_ARRAY_MAX; | 599 | // r.by_day[index] = ICAL_RECURRENCE_ARRAY_MAX; |
600 | break; | 600 | break; |
601 | case Recurrence::rMonthlyDay: | 601 | case Recurrence::rMonthlyDay: |
602 | r.freq = ICAL_MONTHLY_RECURRENCE; | 602 | r.freq = ICAL_MONTHLY_RECURRENCE; |
603 | 603 | ||
604 | tmpDays = recur->monthDays(); | 604 | tmpDays = recur->monthDays(); |
605 | for (tmpDay = tmpDays.first(); | 605 | for (tmpDay = tmpDays.first(); |
606 | tmpDay; | 606 | tmpDay; |
607 | tmpDay = tmpDays.next()) { | 607 | tmpDay = tmpDays.next()) { |
608 | r.by_month_day[index++] = icalrecurrencetype_day_position(*tmpDay*8);//*tmpDay); | 608 | r.by_month_day[index++] = icalrecurrencetype_day_position(*tmpDay*8);//*tmpDay); |
609 | } | 609 | } |
610 | // r.by_day[index] = ICAL_RECURRENCE_ARRAY_MAX; | 610 | // r.by_day[index] = ICAL_RECURRENCE_ARRAY_MAX; |
611 | break; | 611 | break; |
612 | case Recurrence::rYearlyMonth: | 612 | case Recurrence::rYearlyMonth: |
613 | case Recurrence::rYearlyPos: | 613 | case Recurrence::rYearlyPos: |
614 | r.freq = ICAL_YEARLY_RECURRENCE; | 614 | r.freq = ICAL_YEARLY_RECURRENCE; |
615 | 615 | ||
616 | tmpDays = recur->yearNums(); | 616 | tmpDays = recur->yearNums(); |
617 | for (tmpDay = tmpDays.first(); | 617 | for (tmpDay = tmpDays.first(); |
618 | tmpDay; | 618 | tmpDay; |
619 | tmpDay = tmpDays.next()) { | 619 | tmpDay = tmpDays.next()) { |
620 | r.by_month[index++] = *tmpDay; | 620 | r.by_month[index++] = *tmpDay; |
621 | } | 621 | } |
622 | // r.by_set_pos[index] = ICAL_RECURRENCE_ARRAY_MAX; | 622 | // r.by_set_pos[index] = ICAL_RECURRENCE_ARRAY_MAX; |
623 | if (recur->doesRecur() == Recurrence::rYearlyPos) { | 623 | if (recur->doesRecur() == Recurrence::rYearlyPos) { |
624 | tmpPositions = recur->monthPositions(); | 624 | tmpPositions = recur->monthPositions(); |
625 | for (tmpPos = tmpPositions.first(); | 625 | for (tmpPos = tmpPositions.first(); |
626 | tmpPos; | 626 | tmpPos; |
627 | tmpPos = tmpPositions.next()) { | 627 | tmpPos = tmpPositions.next()) { |
628 | for (i = 0; i < 7; i++) { | 628 | for (i = 0; i < 7; i++) { |
629 | if (tmpPos->rDays.testBit(i)) { | 629 | if (tmpPos->rDays.testBit(i)) { |
630 | day = (i + 1)%7 + 1; // convert from Monday=0 to Sunday=1 | 630 | day = (i + 1)%7 + 1; // convert from Monday=0 to Sunday=1 |
631 | day += tmpPos->rPos*8; | 631 | day += tmpPos->rPos*8; |
632 | if (tmpPos->negative) day = -day; | 632 | if (tmpPos->negative) day = -day; |
633 | r.by_day[index2++] = day; | 633 | r.by_day[index2++] = day; |
634 | } | 634 | } |
635 | } | 635 | } |
636 | } | 636 | } |
637 | // r.by_day[index2] = ICAL_RECURRENCE_ARRAY_MAX; | 637 | // r.by_day[index2] = ICAL_RECURRENCE_ARRAY_MAX; |
638 | } | 638 | } |
639 | break; | 639 | break; |
640 | case Recurrence::rYearlyDay: | 640 | case Recurrence::rYearlyDay: |
641 | r.freq = ICAL_YEARLY_RECURRENCE; | 641 | r.freq = ICAL_YEARLY_RECURRENCE; |
642 | 642 | ||
643 | tmpDays = recur->yearNums(); | 643 | tmpDays = recur->yearNums(); |
644 | for (tmpDay = tmpDays.first(); | 644 | for (tmpDay = tmpDays.first(); |
645 | tmpDay; | 645 | tmpDay; |
646 | tmpDay = tmpDays.next()) { | 646 | tmpDay = tmpDays.next()) { |
647 | r.by_year_day[index++] = *tmpDay; | 647 | r.by_year_day[index++] = *tmpDay; |
648 | } | 648 | } |
649 | // r.by_year_day[index] = ICAL_RECURRENCE_ARRAY_MAX; | 649 | // r.by_year_day[index] = ICAL_RECURRENCE_ARRAY_MAX; |
650 | break; | 650 | break; |
651 | default: | 651 | default: |
652 | r.freq = ICAL_NO_RECURRENCE; | 652 | r.freq = ICAL_NO_RECURRENCE; |
653 | kdDebug(5800) << "ICalFormatImpl::writeRecurrence(): no recurrence" << endl; | 653 | kdDebug(5800) << "ICalFormatImpl::writeRecurrence(): no recurrence" << endl; |
654 | break; | 654 | break; |
655 | } | 655 | } |
656 | 656 | ||
657 | r.interval = recur->frequency(); | 657 | r.interval = recur->frequency(); |
658 | 658 | ||
659 | if (recur->duration() > 0) { | 659 | if (recur->duration() > 0) { |
660 | r.count = recur->duration(); | 660 | r.count = recur->duration(); |
661 | } else if (recur->duration() == -1) { | 661 | } else if (recur->duration() == -1) { |
662 | r.count = 0; | 662 | r.count = 0; |
663 | } else { | 663 | } else { |
664 | if (datetime) | 664 | if (datetime) |
665 | r.until = writeICalDateTime(recur->endDateTime()); | 665 | r.until = writeICalDateTime(recur->endDateTime()); |
666 | else | 666 | else |
667 | r.until = writeICalDate(recur->endDate()); | 667 | r.until = writeICalDate(recur->endDate()); |
668 | } | 668 | } |
669 | 669 | ||
670 | // Debug output | 670 | // Debug output |
671 | #if 0 | 671 | #if 0 |
672 | const char *str = icalrecurrencetype_as_string(&r); | 672 | const char *str = icalrecurrencetype_as_string(&r); |
673 | if (str) { | 673 | if (str) { |
674 | kdDebug(5800) << " String: " << str << endl; | 674 | kdDebug(5800) << " String: " << str << endl; |
675 | } else { | 675 | } else { |
676 | kdDebug(5800) << " No String" << endl; | 676 | kdDebug(5800) << " No String" << endl; |
677 | } | 677 | } |
678 | #endif | 678 | #endif |
679 | 679 | ||
680 | return icalproperty_new_rrule(r); | 680 | return icalproperty_new_rrule(r); |
681 | } | 681 | } |
682 | 682 | ||
683 | icalcomponent *ICalFormatImpl::writeAlarm(Alarm *alarm) | 683 | icalcomponent *ICalFormatImpl::writeAlarm(Alarm *alarm) |
684 | { | 684 | { |
685 | icalcomponent *a = icalcomponent_new(ICAL_VALARM_COMPONENT); | 685 | icalcomponent *a = icalcomponent_new(ICAL_VALARM_COMPONENT); |
686 | 686 | ||
687 | icalproperty_action action; | 687 | icalproperty_action action; |
688 | icalattach *attach = 0; | 688 | icalattach *attach = 0; |
689 | 689 | ||
690 | switch (alarm->type()) { | 690 | switch (alarm->type()) { |
691 | case Alarm::Procedure: | 691 | case Alarm::Procedure: |
692 | action = ICAL_ACTION_PROCEDURE; | 692 | action = ICAL_ACTION_PROCEDURE; |
693 | attach = icalattach_new_from_url( QFile::encodeName(alarm->programFile()).data() ); | 693 | attach = icalattach_new_from_url( QFile::encodeName(alarm->programFile()).data() ); |
694 | icalcomponent_add_property(a,icalproperty_new_attach(attach)); | 694 | icalcomponent_add_property(a,icalproperty_new_attach(attach)); |
695 | if (!alarm->programArguments().isEmpty()) { | 695 | if (!alarm->programArguments().isEmpty()) { |
696 | icalcomponent_add_property(a,icalproperty_new_description(alarm->programArguments().utf8())); | 696 | icalcomponent_add_property(a,icalproperty_new_description(alarm->programArguments().utf8())); |
697 | } | 697 | } |
698 | break; | 698 | break; |
699 | case Alarm::Audio: | 699 | case Alarm::Audio: |
700 | action = ICAL_ACTION_AUDIO; | 700 | action = ICAL_ACTION_AUDIO; |
701 | if (!alarm->audioFile().isEmpty()) { | 701 | if (!alarm->audioFile().isEmpty()) { |
702 | attach = icalattach_new_from_url(QFile::encodeName( alarm->audioFile() ).data()); | 702 | attach = icalattach_new_from_url(QFile::encodeName( alarm->audioFile() ).data()); |
703 | icalcomponent_add_property(a,icalproperty_new_attach(attach)); | 703 | icalcomponent_add_property(a,icalproperty_new_attach(attach)); |
704 | } | 704 | } |
705 | break; | 705 | break; |
706 | case Alarm::Email: { | 706 | case Alarm::Email: { |
707 | action = ICAL_ACTION_EMAIL; | 707 | action = ICAL_ACTION_EMAIL; |
708 | QValueList<Person> addresses = alarm->mailAddresses(); | 708 | QValueList<Person> addresses = alarm->mailAddresses(); |
709 | for (QValueList<Person>::Iterator ad = addresses.begin(); ad != addresses.end(); ++ad) { | 709 | for (QValueList<Person>::Iterator ad = addresses.begin(); ad != addresses.end(); ++ad) { |
710 | icalproperty *p = icalproperty_new_attendee("MAILTO:" + (*ad).email().utf8()); | 710 | icalproperty *p = icalproperty_new_attendee("MAILTO:" + (*ad).email().utf8()); |
711 | if (!(*ad).name().isEmpty()) { | 711 | if (!(*ad).name().isEmpty()) { |
712 | icalproperty_add_parameter(p,icalparameter_new_cn((*ad).name().utf8())); | 712 | icalproperty_add_parameter(p,icalparameter_new_cn((*ad).name().utf8())); |
713 | } | 713 | } |
714 | icalcomponent_add_property(a,p); | 714 | icalcomponent_add_property(a,p); |
715 | } | 715 | } |
716 | icalcomponent_add_property(a,icalproperty_new_summary(alarm->mailSubject().utf8())); | 716 | icalcomponent_add_property(a,icalproperty_new_summary(alarm->mailSubject().utf8())); |
717 | icalcomponent_add_property(a,icalproperty_new_description(alarm->text().utf8())); | 717 | icalcomponent_add_property(a,icalproperty_new_description(alarm->text().utf8())); |
718 | QStringList attachments = alarm->mailAttachments(); | 718 | QStringList attachments = alarm->mailAttachments(); |
719 | if (attachments.count() > 0) { | 719 | if (attachments.count() > 0) { |
720 | for (QStringList::Iterator at = attachments.begin(); at != attachments.end(); ++at) { | 720 | for (QStringList::Iterator at = attachments.begin(); at != attachments.end(); ++at) { |
721 | attach = icalattach_new_from_url(QFile::encodeName( *at ).data()); | 721 | attach = icalattach_new_from_url(QFile::encodeName( *at ).data()); |
722 | icalcomponent_add_property(a,icalproperty_new_attach(attach)); | 722 | icalcomponent_add_property(a,icalproperty_new_attach(attach)); |
723 | } | 723 | } |
724 | } | 724 | } |
725 | break; | 725 | break; |
726 | } | 726 | } |
727 | case Alarm::Display: | 727 | case Alarm::Display: |
728 | action = ICAL_ACTION_DISPLAY; | 728 | action = ICAL_ACTION_DISPLAY; |
729 | icalcomponent_add_property(a,icalproperty_new_description(alarm->text().utf8())); | 729 | icalcomponent_add_property(a,icalproperty_new_description(alarm->text().utf8())); |
730 | break; | 730 | break; |
731 | case Alarm::Invalid: | 731 | case Alarm::Invalid: |
732 | default: | 732 | default: |
733 | kdDebug(5800) << "Unknown type of alarm" << endl; | 733 | kdDebug(5800) << "Unknown type of alarm" << endl; |
734 | action = ICAL_ACTION_NONE; | 734 | action = ICAL_ACTION_NONE; |
735 | break; | 735 | break; |
736 | } | 736 | } |
737 | icalcomponent_add_property(a,icalproperty_new_action(action)); | 737 | icalcomponent_add_property(a,icalproperty_new_action(action)); |
738 | 738 | ||
739 | // Trigger time | 739 | // Trigger time |
740 | icaltriggertype trigger; | 740 | icaltriggertype trigger; |
741 | if ( alarm->hasTime() ) { | 741 | if ( alarm->hasTime() ) { |
742 | trigger.time = writeICalDateTime(alarm->time()); | 742 | trigger.time = writeICalDateTime(alarm->time()); |
743 | trigger.duration = icaldurationtype_null_duration(); | 743 | trigger.duration = icaldurationtype_null_duration(); |
744 | } else { | 744 | } else { |
745 | trigger.time = icaltime_null_time(); | 745 | trigger.time = icaltime_null_time(); |
746 | Duration offset; | 746 | Duration offset; |
747 | if ( alarm->hasStartOffset() ) | 747 | if ( alarm->hasStartOffset() ) |
748 | offset = alarm->startOffset(); | 748 | offset = alarm->startOffset(); |
749 | else | 749 | else |
750 | offset = alarm->endOffset(); | 750 | offset = alarm->endOffset(); |
751 | trigger.duration = icaldurationtype_from_int( offset.asSeconds() ); | 751 | trigger.duration = icaldurationtype_from_int( offset.asSeconds() ); |
752 | } | 752 | } |
753 | icalproperty *p = icalproperty_new_trigger(trigger); | 753 | icalproperty *p = icalproperty_new_trigger(trigger); |
754 | if ( alarm->hasEndOffset() ) | 754 | if ( alarm->hasEndOffset() ) |
755 | icalproperty_add_parameter(p,icalparameter_new_related(ICAL_RELATED_END)); | 755 | icalproperty_add_parameter(p,icalparameter_new_related(ICAL_RELATED_END)); |
756 | icalcomponent_add_property(a,p); | 756 | icalcomponent_add_property(a,p); |
757 | 757 | ||
758 | // Repeat count and duration | 758 | // Repeat count and duration |
759 | if (alarm->repeatCount()) { | 759 | if (alarm->repeatCount()) { |
760 | icalcomponent_add_property(a,icalproperty_new_repeat(alarm->repeatCount())); | 760 | icalcomponent_add_property(a,icalproperty_new_repeat(alarm->repeatCount())); |
761 | icalcomponent_add_property(a,icalproperty_new_duration( | 761 | icalcomponent_add_property(a,icalproperty_new_duration( |
762 | icaldurationtype_from_int(alarm->snoozeTime()*60))); | 762 | icaldurationtype_from_int(alarm->snoozeTime()*60))); |
763 | } | 763 | } |
764 | 764 | ||
765 | // Custom properties | 765 | // Custom properties |
766 | QMap<QCString, QString> custom = alarm->customProperties(); | 766 | QMap<QCString, QString> custom = alarm->customProperties(); |
767 | for (QMap<QCString, QString>::Iterator c = custom.begin(); c != custom.end(); ++c) { | 767 | for (QMap<QCString, QString>::Iterator c = custom.begin(); c != custom.end(); ++c) { |
768 | icalproperty *p = icalproperty_new_x(c.data().utf8()); | 768 | icalproperty *p = icalproperty_new_x(c.data().utf8()); |
769 | icalproperty_set_x_name(p,c.key()); | 769 | icalproperty_set_x_name(p,c.key()); |
770 | icalcomponent_add_property(a,p); | 770 | icalcomponent_add_property(a,p); |
771 | } | 771 | } |
772 | 772 | ||
773 | return a; | 773 | return a; |
774 | } | 774 | } |
775 | 775 | ||
776 | Todo *ICalFormatImpl::readTodo(icalcomponent *vtodo) | 776 | Todo *ICalFormatImpl::readTodo(icalcomponent *vtodo) |
777 | { | 777 | { |
778 | Todo *todo = new Todo; | 778 | Todo *todo = new Todo; |
779 | 779 | ||
780 | readIncidence(vtodo,todo); | 780 | readIncidence(vtodo,todo); |
781 | 781 | ||
782 | icalproperty *p = icalcomponent_get_first_property(vtodo,ICAL_ANY_PROPERTY); | 782 | icalproperty *p = icalcomponent_get_first_property(vtodo,ICAL_ANY_PROPERTY); |
783 | 783 | ||
784 | // int intvalue; | 784 | // int intvalue; |
785 | icaltimetype icaltime; | 785 | icaltimetype icaltime; |
786 | 786 | ||
787 | QStringList categories; | 787 | QStringList categories; |
788 | 788 | ||
789 | while (p) { | 789 | while (p) { |
790 | icalproperty_kind kind = icalproperty_isa(p); | 790 | icalproperty_kind kind = icalproperty_isa(p); |
791 | switch (kind) { | 791 | switch (kind) { |
792 | 792 | ||
793 | case ICAL_DUE_PROPERTY: // due date | 793 | case ICAL_DUE_PROPERTY: // due date |
794 | icaltime = icalproperty_get_due(p); | 794 | icaltime = icalproperty_get_due(p); |
795 | if (icaltime.is_date) { | 795 | if (icaltime.is_date) { |
796 | todo->setDtDue(QDateTime(readICalDate(icaltime),QTime(0,0,0))); | 796 | todo->setDtDue(QDateTime(readICalDate(icaltime),QTime(0,0,0))); |
797 | todo->setFloats(true); | 797 | todo->setFloats(true); |
798 | 798 | ||
799 | } else { | 799 | } else { |
800 | todo->setDtDue(readICalDateTime(icaltime)); | 800 | todo->setDtDue(readICalDateTime(icaltime)); |
801 | todo->setFloats(false); | 801 | todo->setFloats(false); |
802 | } | 802 | } |
803 | todo->setHasDueDate(true); | 803 | todo->setHasDueDate(true); |
804 | break; | 804 | break; |
805 | 805 | ||
806 | case ICAL_COMPLETED_PROPERTY: // completion date | 806 | case ICAL_COMPLETED_PROPERTY: // completion date |
807 | icaltime = icalproperty_get_completed(p); | 807 | icaltime = icalproperty_get_completed(p); |
808 | todo->setCompleted(readICalDateTime(icaltime)); | 808 | todo->setCompleted(readICalDateTime(icaltime)); |
809 | break; | 809 | break; |
810 | 810 | ||
811 | case ICAL_PERCENTCOMPLETE_PROPERTY: // Percent completed | 811 | case ICAL_PERCENTCOMPLETE_PROPERTY: // Percent completed |
812 | todo->setPercentComplete(icalproperty_get_percentcomplete(p)); | 812 | todo->setPercentComplete(icalproperty_get_percentcomplete(p)); |
813 | break; | 813 | break; |
814 | 814 | ||
815 | case ICAL_RELATEDTO_PROPERTY: // related todo (parent) | 815 | case ICAL_RELATEDTO_PROPERTY: // related todo (parent) |
816 | todo->setRelatedToUid(QString::fromUtf8(icalproperty_get_relatedto(p))); | 816 | todo->setRelatedToUid(QString::fromUtf8(icalproperty_get_relatedto(p))); |
817 | mTodosRelate.append(todo); | 817 | mTodosRelate.append(todo); |
818 | break; | 818 | break; |
819 | 819 | ||
820 | case ICAL_DTSTART_PROPERTY: | 820 | case ICAL_DTSTART_PROPERTY: |
821 | // Flag that todo has start date. Value is read in by readIncidence(). | 821 | // Flag that todo has start date. Value is read in by readIncidence(). |
822 | todo->setHasStartDate(true); | 822 | todo->setHasStartDate(true); |
823 | break; | 823 | break; |
824 | 824 | ||
825 | default: | 825 | default: |
826 | // kdDebug(5800) << "ICALFormat::readTodo(): Unknown property: " << kind | 826 | // kdDebug(5800) << "ICALFormat::readTodo(): Unknown property: " << kind |
827 | // << endl; | 827 | // << endl; |
828 | break; | 828 | break; |
829 | } | 829 | } |
830 | 830 | ||
831 | p = icalcomponent_get_next_property(vtodo,ICAL_ANY_PROPERTY); | 831 | p = icalcomponent_get_next_property(vtodo,ICAL_ANY_PROPERTY); |
832 | } | 832 | } |
833 | 833 | ||
834 | return todo; | 834 | return todo; |
835 | } | 835 | } |
836 | 836 | ||
837 | Event *ICalFormatImpl::readEvent(icalcomponent *vevent) | 837 | Event *ICalFormatImpl::readEvent(icalcomponent *vevent) |
838 | { | 838 | { |
839 | Event *event = new Event; | 839 | Event *event = new Event; |
840 | event->setFloats(false); | 840 | event->setFloats(false); |
841 | 841 | ||
842 | readIncidence(vevent,event); | 842 | readIncidence(vevent,event); |
843 | 843 | ||
844 | icalproperty *p = icalcomponent_get_first_property(vevent,ICAL_ANY_PROPERTY); | 844 | icalproperty *p = icalcomponent_get_first_property(vevent,ICAL_ANY_PROPERTY); |
845 | 845 | ||
846 | // int intvalue; | 846 | // int intvalue; |
847 | icaltimetype icaltime; | 847 | icaltimetype icaltime; |
848 | 848 | ||
849 | QStringList categories; | 849 | QStringList categories; |
850 | QString transparency; | 850 | QString transparency; |
851 | 851 | ||
852 | while (p) { | 852 | while (p) { |
853 | icalproperty_kind kind = icalproperty_isa(p); | 853 | icalproperty_kind kind = icalproperty_isa(p); |
854 | switch (kind) { | 854 | switch (kind) { |
855 | 855 | ||
856 | case ICAL_DTEND_PROPERTY: // start date and time | 856 | case ICAL_DTEND_PROPERTY: // start date and time |
857 | icaltime = icalproperty_get_dtend(p); | 857 | icaltime = icalproperty_get_dtend(p); |
858 | if (icaltime.is_date) { | 858 | if (icaltime.is_date) { |
859 | event->setFloats( true ); | 859 | event->setFloats( true ); |
860 | // End date is non-inclusive | 860 | // End date is non-inclusive |
861 | QDate endDate = readICalDate( icaltime ).addDays( -1 ); | 861 | QDate endDate = readICalDate( icaltime ).addDays( -1 ); |
862 | mCompat->fixFloatingEnd( endDate ); | 862 | mCompat->fixFloatingEnd( endDate ); |
863 | if ( endDate < event->dtStart().date() ) { | 863 | if ( endDate < event->dtStart().date() ) { |
864 | endDate = event->dtStart().date(); | 864 | endDate = event->dtStart().date(); |
865 | } | 865 | } |
866 | event->setDtEnd( QDateTime( endDate, QTime( 0, 0, 0 ) ) ); | 866 | event->setDtEnd( QDateTime( endDate, QTime( 0, 0, 0 ) ) ); |
867 | } else { | 867 | } else { |
868 | event->setDtEnd(readICalDateTime(icaltime)); | 868 | event->setDtEnd(readICalDateTime(icaltime)); |
869 | } | 869 | } |
870 | break; | 870 | break; |
871 | 871 | ||
872 | // TODO: | 872 | // TODO: |
873 | // at this point, there should be at least a start or end time. | 873 | // at this point, there should be at least a start or end time. |
874 | // fix up for events that take up no time but have a time associated | 874 | // fix up for events that take up no time but have a time associated |
875 | #if 0 | 875 | #if 0 |
876 | if (!(vo = isAPropertyOf(vevent, VCDTstartProp))) | 876 | if (!(vo = isAPropertyOf(vevent, VCDTstartProp))) |
877 | anEvent->setDtStart(anEvent->dtEnd()); | 877 | anEvent->setDtStart(anEvent->dtEnd()); |
878 | if (!(vo = isAPropertyOf(vevent, VCDTendProp))) | 878 | if (!(vo = isAPropertyOf(vevent, VCDTendProp))) |
879 | anEvent->setDtEnd(anEvent->dtStart()); | 879 | anEvent->setDtEnd(anEvent->dtStart()); |
880 | #endif | 880 | #endif |
881 | 881 | ||
882 | // TODO: exdates | 882 | // TODO: exdates |
883 | #if 0 | 883 | #if 0 |
884 | // recurrence exceptions | 884 | // recurrence exceptions |
885 | if ((vo = isAPropertyOf(vevent, VCExDateProp)) != 0) { | 885 | if ((vo = isAPropertyOf(vevent, VCExDateProp)) != 0) { |
886 | anEvent->setExDates(s = fakeCString(vObjectUStringZValue(vo))); | 886 | anEvent->setExDates(s = fakeCString(vObjectUStringZValue(vo))); |
887 | deleteStr(s); | 887 | deleteStr(s); |
888 | } | 888 | } |
889 | #endif | 889 | #endif |
890 | 890 | ||
891 | #if 0 | 891 | #if 0 |
892 | // secrecy | 892 | // secrecy |
893 | if ((vo = isAPropertyOf(vevent, VCClassProp)) != 0) { | 893 | if ((vo = isAPropertyOf(vevent, VCClassProp)) != 0) { |
894 | anEvent->setSecrecy(s = fakeCString(vObjectUStringZValue(vo))); | 894 | anEvent->setSecrecy(s = fakeCString(vObjectUStringZValue(vo))); |
895 | deleteStr(s); | 895 | deleteStr(s); |
896 | } | 896 | } |
897 | else | 897 | else |
898 | anEvent->setSecrecy("PUBLIC"); | 898 | anEvent->setSecrecy("PUBLIC"); |
899 | 899 | ||
900 | // attachments | 900 | // attachments |
901 | tmpStrList.clear(); | 901 | tmpStrList.clear(); |
902 | initPropIterator(&voi, vevent); | 902 | initPropIterator(&voi, vevent); |
903 | while (moreIteration(&voi)) { | 903 | while (moreIteration(&voi)) { |
904 | vo = nextVObject(&voi); | 904 | vo = nextVObject(&voi); |
905 | if (strcmp(vObjectName(vo), VCAttachProp) == 0) { | 905 | if (strcmp(vObjectName(vo), VCAttachProp) == 0) { |
906 | tmpStrList.append(s = fakeCString(vObjectUStringZValue(vo))); | 906 | tmpStrList.append(s = fakeCString(vObjectUStringZValue(vo))); |
907 | deleteStr(s); | 907 | deleteStr(s); |
908 | } | 908 | } |
909 | } | 909 | } |
910 | anEvent->setAttachments(tmpStrList); | 910 | anEvent->setAttachments(tmpStrList); |
911 | 911 | ||
912 | // resources | 912 | // resources |
913 | if ((vo = isAPropertyOf(vevent, VCResourcesProp)) != 0) { | 913 | if ((vo = isAPropertyOf(vevent, VCResourcesProp)) != 0) { |
914 | QString resources = (s = fakeCString(vObjectUStringZValue(vo))); | 914 | QString resources = (s = fakeCString(vObjectUStringZValue(vo))); |
915 | deleteStr(s); | 915 | deleteStr(s); |
916 | tmpStrList.clear(); | 916 | tmpStrList.clear(); |
917 | index1 = 0; | 917 | index1 = 0; |
918 | index2 = 0; | 918 | index2 = 0; |
919 | QString resource; | 919 | QString resource; |
920 | while ((index2 = resources.find(';', index1)) != -1) { | 920 | while ((index2 = resources.find(';', index1)) != -1) { |
921 | resource = resources.mid(index1, (index2 - index1)); | 921 | resource = resources.mid(index1, (index2 - index1)); |
922 | tmpStrList.append(resource); | 922 | tmpStrList.append(resource); |
923 | index1 = index2; | 923 | index1 = index2; |
924 | } | 924 | } |
925 | anEvent->setResources(tmpStrList); | 925 | anEvent->setResources(tmpStrList); |
926 | } | 926 | } |
927 | #endif | 927 | #endif |
928 | 928 | ||
929 | case ICAL_RELATEDTO_PROPERTY: // releated event (parent) | 929 | case ICAL_RELATEDTO_PROPERTY: // releated event (parent) |
930 | event->setRelatedToUid(QString::fromUtf8(icalproperty_get_relatedto(p))); | 930 | event->setRelatedToUid(QString::fromUtf8(icalproperty_get_relatedto(p))); |
931 | mEventsRelate.append(event); | 931 | mEventsRelate.append(event); |
932 | break; | 932 | break; |
933 | 933 | ||
934 | case ICAL_TRANSP_PROPERTY: // Transparency | 934 | case ICAL_TRANSP_PROPERTY: // Transparency |
935 | if(icalproperty_get_transp(p) == ICAL_TRANSP_TRANSPARENT ) | 935 | if(icalproperty_get_transp(p) == ICAL_TRANSP_TRANSPARENT ) |
936 | event->setTransparency( Event::Transparent ); | 936 | event->setTransparency( Event::Transparent ); |
937 | else | 937 | else |
938 | event->setTransparency( Event::Opaque ); | 938 | event->setTransparency( Event::Opaque ); |
939 | break; | 939 | break; |
940 | 940 | ||
941 | default: | 941 | default: |
942 | // kdDebug(5800) << "ICALFormat::readEvent(): Unknown property: " << kind | 942 | // kdDebug(5800) << "ICALFormat::readEvent(): Unknown property: " << kind |
943 | // << endl; | 943 | // << endl; |
944 | break; | 944 | break; |
945 | } | 945 | } |
946 | 946 | ||
947 | p = icalcomponent_get_next_property(vevent,ICAL_ANY_PROPERTY); | 947 | p = icalcomponent_get_next_property(vevent,ICAL_ANY_PROPERTY); |
948 | } | 948 | } |
949 | 949 | ||
950 | QString msade = event->nonKDECustomProperty("X-MICROSOFT-CDO-ALLDAYEVENT"); | 950 | QString msade = event->nonKDECustomProperty("X-MICROSOFT-CDO-ALLDAYEVENT"); |
951 | if (!msade.isNull()) { | 951 | if (!msade.isNull()) { |
952 | bool floats = (msade == QString::fromLatin1("TRUE")); | 952 | bool floats = (msade == QString::fromLatin1("TRUE")); |
953 | kdDebug(5800) << "ICALFormat::readEvent(): all day event: " << floats << endl; | 953 | kdDebug(5800) << "ICALFormat::readEvent(): all day event: " << floats << endl; |
954 | event->setFloats(floats); | 954 | event->setFloats(floats); |
955 | if (floats) { | 955 | if (floats) { |
956 | QDateTime endDate = event->dtEnd(); | 956 | QDateTime endDate = event->dtEnd(); |
957 | event->setDtEnd(endDate.addDays(-1)); | 957 | event->setDtEnd(endDate.addDays(-1)); |
958 | } | 958 | } |
959 | } | 959 | } |
960 | 960 | ||
961 | // some stupid vCal exporters ignore the standard and use Description | 961 | // some stupid vCal exporters ignore the standard and use Description |
962 | // instead of Summary for the default field. Correct for this. | 962 | // instead of Summary for the default field. Correct for this. |
963 | if (event->summary().isEmpty() && | 963 | if (event->summary().isEmpty() && |
964 | !(event->description().isEmpty())) { | 964 | !(event->description().isEmpty())) { |
965 | QString tmpStr = event->description().simplifyWhiteSpace(); | 965 | QString tmpStr = event->description().simplifyWhiteSpace(); |
966 | event->setDescription(""); | 966 | event->setDescription(""); |
967 | event->setSummary(tmpStr); | 967 | event->setSummary(tmpStr); |
968 | } | 968 | } |
969 | 969 | ||
970 | return event; | 970 | return event; |
971 | } | 971 | } |
972 | 972 | ||
973 | FreeBusy *ICalFormatImpl::readFreeBusy(icalcomponent *vfreebusy) | 973 | FreeBusy *ICalFormatImpl::readFreeBusy(icalcomponent *vfreebusy) |
974 | { | 974 | { |
975 | FreeBusy *freebusy = new FreeBusy; | 975 | FreeBusy *freebusy = new FreeBusy; |
976 | 976 | ||
977 | readIncidenceBase(vfreebusy,freebusy); | 977 | readIncidenceBase(vfreebusy,freebusy); |
978 | 978 | ||
979 | icalproperty *p = icalcomponent_get_first_property(vfreebusy,ICAL_ANY_PROPERTY); | 979 | icalproperty *p = icalcomponent_get_first_property(vfreebusy,ICAL_ANY_PROPERTY); |
980 | 980 | ||
981 | icaltimetype icaltime; | 981 | icaltimetype icaltime; |
982 | icalperiodtype icalperiod; | 982 | icalperiodtype icalperiod; |
983 | QDateTime period_start, period_end; | 983 | QDateTime period_start, period_end; |
984 | 984 | ||
985 | while (p) { | 985 | while (p) { |
986 | icalproperty_kind kind = icalproperty_isa(p); | 986 | icalproperty_kind kind = icalproperty_isa(p); |
987 | switch (kind) { | 987 | switch (kind) { |
988 | 988 | ||
989 | case ICAL_DTSTART_PROPERTY: // start date and time | 989 | case ICAL_DTSTART_PROPERTY: // start date and time |
990 | icaltime = icalproperty_get_dtstart(p); | 990 | icaltime = icalproperty_get_dtstart(p); |
991 | freebusy->setDtStart(readICalDateTime(icaltime)); | 991 | freebusy->setDtStart(readICalDateTime(icaltime)); |
992 | break; | 992 | break; |
993 | 993 | ||
994 | case ICAL_DTEND_PROPERTY: // start End Date and Time | 994 | case ICAL_DTEND_PROPERTY: // start End Date and Time |
995 | icaltime = icalproperty_get_dtend(p); | 995 | icaltime = icalproperty_get_dtend(p); |
996 | freebusy->setDtEnd(readICalDateTime(icaltime)); | 996 | freebusy->setDtEnd(readICalDateTime(icaltime)); |
997 | break; | 997 | break; |
998 | 998 | ||
999 | case ICAL_FREEBUSY_PROPERTY: //Any FreeBusy Times | 999 | case ICAL_FREEBUSY_PROPERTY: //Any FreeBusy Times |
1000 | icalperiod = icalproperty_get_freebusy(p); | 1000 | icalperiod = icalproperty_get_freebusy(p); |
1001 | period_start = readICalDateTime(icalperiod.start); | 1001 | period_start = readICalDateTime(icalperiod.start); |
1002 | period_end = readICalDateTime(icalperiod.end); | 1002 | period_end = readICalDateTime(icalperiod.end); |
1003 | freebusy->addPeriod(period_start, period_end); | 1003 | freebusy->addPeriod(period_start, period_end); |
1004 | break; | 1004 | break; |
1005 | 1005 | ||
1006 | default: | 1006 | default: |
1007 | kdDebug(5800) << "ICALFormat::readIncidence(): Unknown property: " << kind | 1007 | kdDebug(5800) << "ICALFormat::readIncidence(): Unknown property: " << kind |
1008 | << endl; | 1008 | << endl; |
1009 | break; | 1009 | break; |
1010 | } | 1010 | } |
1011 | p = icalcomponent_get_next_property(vfreebusy,ICAL_ANY_PROPERTY); | 1011 | p = icalcomponent_get_next_property(vfreebusy,ICAL_ANY_PROPERTY); |
1012 | } | 1012 | } |
1013 | 1013 | ||
1014 | return freebusy; | 1014 | return freebusy; |
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | Journal *ICalFormatImpl::readJournal(icalcomponent *vjournal) | 1017 | Journal *ICalFormatImpl::readJournal(icalcomponent *vjournal) |
1018 | { | 1018 | { |
1019 | Journal *journal = new Journal; | 1019 | Journal *journal = new Journal; |
1020 | 1020 | ||
1021 | readIncidence(vjournal,journal); | 1021 | readIncidence(vjournal,journal); |
1022 | 1022 | ||
1023 | return journal; | 1023 | return journal; |
1024 | } | 1024 | } |
1025 | 1025 | ||
1026 | Attendee *ICalFormatImpl::readAttendee(icalproperty *attendee) | 1026 | Attendee *ICalFormatImpl::readAttendee(icalproperty *attendee) |
1027 | { | 1027 | { |
1028 | icalparameter *p = 0; | 1028 | icalparameter *p = 0; |
1029 | 1029 | ||
1030 | QString email = QString::fromUtf8(icalproperty_get_attendee(attendee)); | 1030 | QString email = QString::fromUtf8(icalproperty_get_attendee(attendee)); |
1031 | 1031 | ||
1032 | QString name; | 1032 | QString name; |
1033 | QString uid = QString::null; | 1033 | QString uid = QString::null; |
1034 | p = icalproperty_get_first_parameter(attendee,ICAL_CN_PARAMETER); | 1034 | p = icalproperty_get_first_parameter(attendee,ICAL_CN_PARAMETER); |
1035 | if (p) { | 1035 | if (p) { |
1036 | name = QString::fromUtf8(icalparameter_get_cn(p)); | 1036 | name = QString::fromUtf8(icalparameter_get_cn(p)); |
1037 | } else { | 1037 | } else { |
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | bool rsvp=false; | 1040 | bool rsvp=false; |
1041 | p = icalproperty_get_first_parameter(attendee,ICAL_RSVP_PARAMETER); | 1041 | p = icalproperty_get_first_parameter(attendee,ICAL_RSVP_PARAMETER); |
1042 | if (p) { | 1042 | if (p) { |
1043 | icalparameter_rsvp rsvpParameter = icalparameter_get_rsvp(p); | 1043 | icalparameter_rsvp rsvpParameter = icalparameter_get_rsvp(p); |
1044 | if (rsvpParameter == ICAL_RSVP_TRUE) rsvp = true; | 1044 | if (rsvpParameter == ICAL_RSVP_TRUE) rsvp = true; |
1045 | } | 1045 | } |
1046 | 1046 | ||
1047 | Attendee::PartStat status = Attendee::NeedsAction; | 1047 | Attendee::PartStat status = Attendee::NeedsAction; |
1048 | p = icalproperty_get_first_parameter(attendee,ICAL_PARTSTAT_PARAMETER); | 1048 | p = icalproperty_get_first_parameter(attendee,ICAL_PARTSTAT_PARAMETER); |
1049 | if (p) { | 1049 | if (p) { |
1050 | icalparameter_partstat partStatParameter = icalparameter_get_partstat(p); | 1050 | icalparameter_partstat partStatParameter = icalparameter_get_partstat(p); |
1051 | switch(partStatParameter) { | 1051 | switch(partStatParameter) { |
1052 | default: | 1052 | default: |
1053 | case ICAL_PARTSTAT_NEEDSACTION: | 1053 | case ICAL_PARTSTAT_NEEDSACTION: |
1054 | status = Attendee::NeedsAction; | 1054 | status = Attendee::NeedsAction; |
1055 | break; | 1055 | break; |
1056 | case ICAL_PARTSTAT_ACCEPTED: | 1056 | case ICAL_PARTSTAT_ACCEPTED: |
1057 | status = Attendee::Accepted; | 1057 | status = Attendee::Accepted; |
1058 | break; | 1058 | break; |
1059 | case ICAL_PARTSTAT_DECLINED: | 1059 | case ICAL_PARTSTAT_DECLINED: |
1060 | status = Attendee::Declined; | 1060 | status = Attendee::Declined; |
1061 | break; | 1061 | break; |
1062 | case ICAL_PARTSTAT_TENTATIVE: | 1062 | case ICAL_PARTSTAT_TENTATIVE: |
1063 | status = Attendee::Tentative; | 1063 | status = Attendee::Tentative; |
1064 | break; | 1064 | break; |
1065 | case ICAL_PARTSTAT_DELEGATED: | 1065 | case ICAL_PARTSTAT_DELEGATED: |
1066 | status = Attendee::Delegated; | 1066 | status = Attendee::Delegated; |
1067 | break; | 1067 | break; |
1068 | case ICAL_PARTSTAT_COMPLETED: | 1068 | case ICAL_PARTSTAT_COMPLETED: |
1069 | status = Attendee::Completed; | 1069 | status = Attendee::Completed; |
1070 | break; | 1070 | break; |
1071 | case ICAL_PARTSTAT_INPROCESS: | 1071 | case ICAL_PARTSTAT_INPROCESS: |
1072 | status = Attendee::InProcess; | 1072 | status = Attendee::InProcess; |
1073 | break; | 1073 | break; |
1074 | } | 1074 | } |
1075 | } | 1075 | } |
1076 | 1076 | ||
1077 | Attendee::Role role = Attendee::ReqParticipant; | 1077 | Attendee::Role role = Attendee::ReqParticipant; |
1078 | p = icalproperty_get_first_parameter(attendee,ICAL_ROLE_PARAMETER); | 1078 | p = icalproperty_get_first_parameter(attendee,ICAL_ROLE_PARAMETER); |
1079 | if (p) { | 1079 | if (p) { |
1080 | icalparameter_role roleParameter = icalparameter_get_role(p); | 1080 | icalparameter_role roleParameter = icalparameter_get_role(p); |
1081 | switch(roleParameter) { | 1081 | switch(roleParameter) { |
1082 | case ICAL_ROLE_CHAIR: | 1082 | case ICAL_ROLE_CHAIR: |
1083 | role = Attendee::Chair; | 1083 | role = Attendee::Chair; |
1084 | break; | 1084 | break; |
1085 | default: | 1085 | default: |
1086 | case ICAL_ROLE_REQPARTICIPANT: | 1086 | case ICAL_ROLE_REQPARTICIPANT: |
1087 | role = Attendee::ReqParticipant; | 1087 | role = Attendee::ReqParticipant; |
1088 | break; | 1088 | break; |
1089 | case ICAL_ROLE_OPTPARTICIPANT: | 1089 | case ICAL_ROLE_OPTPARTICIPANT: |
1090 | role = Attendee::OptParticipant; | 1090 | role = Attendee::OptParticipant; |
1091 | break; | 1091 | break; |
1092 | case ICAL_ROLE_NONPARTICIPANT: | 1092 | case ICAL_ROLE_NONPARTICIPANT: |
1093 | role = Attendee::NonParticipant; | 1093 | role = Attendee::NonParticipant; |
1094 | break; | 1094 | break; |
1095 | } | 1095 | } |
1096 | } | 1096 | } |
1097 | 1097 | ||
1098 | p = icalproperty_get_first_parameter(attendee,ICAL_X_PARAMETER); | 1098 | p = icalproperty_get_first_parameter(attendee,ICAL_X_PARAMETER); |
1099 | uid = icalparameter_get_xvalue(p); | 1099 | uid = icalparameter_get_xvalue(p); |
1100 | // This should be added, but there seems to be a libical bug here. | 1100 | // This should be added, but there seems to be a libical bug here. |
1101 | /*while (p) { | 1101 | /*while (p) { |
1102 | // if (icalparameter_get_xname(p) == "X-UID") { | 1102 | // if (icalparameter_get_xname(p) == "X-UID") { |
1103 | uid = icalparameter_get_xvalue(p); | 1103 | uid = icalparameter_get_xvalue(p); |
1104 | p = icalproperty_get_next_parameter(attendee,ICAL_X_PARAMETER); | 1104 | p = icalproperty_get_next_parameter(attendee,ICAL_X_PARAMETER); |
1105 | } */ | 1105 | } */ |
1106 | 1106 | ||
1107 | return new Attendee( name, email, rsvp, status, role, uid ); | 1107 | return new Attendee( name, email, rsvp, status, role, uid ); |
1108 | } | 1108 | } |
1109 | 1109 | ||
1110 | Attachment *ICalFormatImpl::readAttachment(icalproperty *attach) | 1110 | Attachment *ICalFormatImpl::readAttachment(icalproperty *attach) |
1111 | { | 1111 | { |
1112 | icalattach *a = icalproperty_get_attach(attach); | 1112 | icalattach *a = icalproperty_get_attach(attach); |
1113 | icalparameter_value v = ICAL_VALUE_NONE; | 1113 | icalparameter_value v = ICAL_VALUE_NONE; |
1114 | icalparameter_encoding e = ICAL_ENCODING_NONE; | 1114 | icalparameter_encoding e = ICAL_ENCODING_NONE; |
1115 | 1115 | ||
1116 | Attachment *attachment = 0; | 1116 | Attachment *attachment = 0; |
1117 | /* | 1117 | /* |
1118 | icalparameter *vp = icalproperty_get_first_parameter(attach, ICAL_VALUE_PARAMETER); | 1118 | icalparameter *vp = icalproperty_get_first_parameter(attach, ICAL_VALUE_PARAMETER); |
1119 | if (vp) | 1119 | if (vp) |
1120 | v = icalparameter_get_value(vp); | 1120 | v = icalparameter_get_value(vp); |
1121 | 1121 | ||
1122 | icalparameter *ep = icalproperty_get_first_parameter(attach, ICAL_ENCODING_PARAMETER); | 1122 | icalparameter *ep = icalproperty_get_first_parameter(attach, ICAL_ENCODING_PARAMETER); |
1123 | if (ep) | 1123 | if (ep) |
1124 | e = icalparameter_get_encoding(ep); | 1124 | e = icalparameter_get_encoding(ep); |
1125 | */ | 1125 | */ |
1126 | int isurl = icalattach_get_is_url (a); | 1126 | int isurl = icalattach_get_is_url (a); |
1127 | if (isurl == 0) | 1127 | if (isurl == 0) |
1128 | attachment = new Attachment((const char*)icalattach_get_data(a)); | 1128 | attachment = new Attachment((const char*)icalattach_get_data(a)); |
1129 | else { | 1129 | else { |
1130 | attachment = new Attachment(QString(icalattach_get_url(a))); | 1130 | attachment = new Attachment(QString(icalattach_get_url(a))); |
1131 | } | 1131 | } |
1132 | 1132 | ||
1133 | icalparameter *p = icalproperty_get_first_parameter(attach, ICAL_FMTTYPE_PARAMETER); | 1133 | icalparameter *p = icalproperty_get_first_parameter(attach, ICAL_FMTTYPE_PARAMETER); |
1134 | if (p) | 1134 | if (p) |
1135 | attachment->setMimeType(QString(icalparameter_get_fmttype(p))); | 1135 | attachment->setMimeType(QString(icalparameter_get_fmttype(p))); |
1136 | 1136 | ||
1137 | return attachment; | 1137 | return attachment; |
1138 | } | 1138 | } |
1139 | #include <qtextcodec.h> | 1139 | #include <qtextcodec.h> |
1140 | void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence) | 1140 | void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence) |
1141 | { | 1141 | { |
1142 | readIncidenceBase(parent,incidence); | 1142 | readIncidenceBase(parent,incidence); |
1143 | 1143 | ||
1144 | icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY); | 1144 | icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY); |
1145 | bool readrec = false; | 1145 | bool readrec = false; |
1146 | const char *text; | 1146 | const char *text; |
1147 | int intvalue; | 1147 | int intvalue; |
1148 | icaltimetype icaltime; | 1148 | icaltimetype icaltime; |
1149 | icaldurationtype icalduration; | 1149 | icaldurationtype icalduration; |
1150 | struct icalrecurrencetype rectype; | 1150 | struct icalrecurrencetype rectype; |
1151 | QStringList categories; | 1151 | QStringList categories; |
1152 | 1152 | ||
1153 | while (p) { | 1153 | while (p) { |
1154 | icalproperty_kind kind = icalproperty_isa(p); | 1154 | icalproperty_kind kind = icalproperty_isa(p); |
1155 | switch (kind) { | 1155 | switch (kind) { |
1156 | 1156 | ||
1157 | case ICAL_CREATED_PROPERTY: | 1157 | case ICAL_CREATED_PROPERTY: |
1158 | icaltime = icalproperty_get_created(p); | 1158 | icaltime = icalproperty_get_created(p); |
1159 | incidence->setCreated(readICalDateTime(icaltime)); | 1159 | incidence->setCreated(readICalDateTime(icaltime)); |
1160 | break; | 1160 | break; |
1161 | 1161 | ||
1162 | case ICAL_SEQUENCE_PROPERTY: // sequence | 1162 | case ICAL_SEQUENCE_PROPERTY: // sequence |
1163 | intvalue = icalproperty_get_sequence(p); | 1163 | intvalue = icalproperty_get_sequence(p); |
1164 | incidence->setRevision(intvalue); | 1164 | incidence->setRevision(intvalue); |
1165 | break; | 1165 | break; |
1166 | 1166 | ||
1167 | case ICAL_LASTMODIFIED_PROPERTY: // last modification date | 1167 | case ICAL_LASTMODIFIED_PROPERTY: // last modification date |
1168 | icaltime = icalproperty_get_lastmodified(p); | 1168 | icaltime = icalproperty_get_lastmodified(p); |
1169 | incidence->setLastModified(readICalDateTime(icaltime)); | 1169 | incidence->setLastModified(readICalDateTime(icaltime)); |
1170 | break; | 1170 | break; |
1171 | 1171 | ||
1172 | case ICAL_DTSTART_PROPERTY: // start date and time | 1172 | case ICAL_DTSTART_PROPERTY: // start date and time |
1173 | icaltime = icalproperty_get_dtstart(p); | 1173 | icaltime = icalproperty_get_dtstart(p); |
1174 | if (icaltime.is_date) { | 1174 | if (icaltime.is_date) { |
1175 | incidence->setDtStart(QDateTime(readICalDate(icaltime),QTime(0,0,0))); | 1175 | incidence->setDtStart(QDateTime(readICalDate(icaltime),QTime(0,0,0))); |
1176 | incidence->setFloats(true); | 1176 | incidence->setFloats(true); |
1177 | } else { | 1177 | } else { |
1178 | incidence->setDtStart(readICalDateTime(icaltime)); | 1178 | incidence->setDtStart(readICalDateTime(icaltime)); |
1179 | } | 1179 | } |
1180 | break; | 1180 | break; |
1181 | 1181 | ||
1182 | case ICAL_DURATION_PROPERTY: // start date and time | 1182 | case ICAL_DURATION_PROPERTY: // start date and time |
1183 | icalduration = icalproperty_get_duration(p); | 1183 | icalduration = icalproperty_get_duration(p); |
1184 | incidence->setDuration(readICalDuration(icalduration)); | 1184 | incidence->setDuration(readICalDuration(icalduration)); |
1185 | break; | 1185 | break; |
1186 | 1186 | ||
1187 | case ICAL_DESCRIPTION_PROPERTY: // description | 1187 | case ICAL_DESCRIPTION_PROPERTY: // description |
1188 | text = icalproperty_get_description(p); | 1188 | text = icalproperty_get_description(p); |
1189 | incidence->setDescription(QString::fromUtf8(text)); | 1189 | incidence->setDescription(QString::fromUtf8(text)); |
1190 | break; | 1190 | break; |
1191 | 1191 | ||
1192 | case ICAL_SUMMARY_PROPERTY: // summary | 1192 | case ICAL_SUMMARY_PROPERTY: // summary |
1193 | { | 1193 | { |
1194 | text = icalproperty_get_summary(p); | 1194 | text = icalproperty_get_summary(p); |
1195 | incidence->setSummary(QString::fromUtf8(text)); | 1195 | incidence->setSummary(QString::fromUtf8(text)); |
1196 | } | 1196 | } |
1197 | break; | 1197 | break; |
1198 | case ICAL_STATUS_PROPERTY: // summary | 1198 | case ICAL_STATUS_PROPERTY: // summary |
1199 | { | 1199 | { |
1200 | if ( ICAL_STATUS_CANCELLED == icalproperty_get_status(p) ) | 1200 | if ( ICAL_STATUS_CANCELLED == icalproperty_get_status(p) ) |
1201 | incidence->setCancelled( true ); | 1201 | incidence->setCancelled( true ); |
1202 | } | 1202 | } |
1203 | break; | 1203 | break; |
1204 | 1204 | ||
1205 | case ICAL_LOCATION_PROPERTY: // location | 1205 | case ICAL_LOCATION_PROPERTY: // location |
1206 | text = icalproperty_get_location(p); | 1206 | text = icalproperty_get_location(p); |
1207 | incidence->setLocation(QString::fromUtf8(text)); | 1207 | incidence->setLocation(QString::fromUtf8(text)); |
1208 | break; | 1208 | break; |
1209 | 1209 | ||
1210 | case ICAL_RECURRENCEID_PROPERTY: | 1210 | case ICAL_RECURRENCEID_PROPERTY: |
1211 | icaltime = icalproperty_get_recurrenceid(p); | 1211 | icaltime = icalproperty_get_recurrenceid(p); |
1212 | incidence->setRecurrenceID( readICalDateTime(icaltime) ); | 1212 | incidence->setRecurrenceID( readICalDateTime(icaltime) ); |
1213 | //qDebug(" RecurrenceID %s",incidence->recurrenceID().toString().latin1() ); | 1213 | //qDebug(" RecurrenceID %s",incidence->recurrenceID().toString().latin1() ); |
1214 | break; | 1214 | break; |
1215 | #if 0 | 1215 | #if 0 |
1216 | // status | 1216 | // status |
1217 | if ((vo = isAPropertyOf(vincidence, VCStatusProp)) != 0) { | 1217 | if ((vo = isAPropertyOf(vincidence, VCStatusProp)) != 0) { |
1218 | incidence->setStatus(s = fakeCString(vObjectUStringZValue(vo))); | 1218 | incidence->setStatus(s = fakeCString(vObjectUStringZValue(vo))); |
1219 | deleteStr(s); | 1219 | deleteStr(s); |
1220 | } | 1220 | } |
1221 | else | 1221 | else |
1222 | incidence->setStatus("NEEDS ACTION"); | 1222 | incidence->setStatus("NEEDS ACTION"); |
1223 | #endif | 1223 | #endif |
1224 | 1224 | ||
1225 | case ICAL_PRIORITY_PROPERTY: // priority | 1225 | case ICAL_PRIORITY_PROPERTY: // priority |
1226 | intvalue = icalproperty_get_priority(p); | 1226 | intvalue = icalproperty_get_priority(p); |
1227 | incidence->setPriority(intvalue); | 1227 | incidence->setPriority(intvalue); |
1228 | break; | 1228 | break; |
1229 | 1229 | ||
1230 | case ICAL_CATEGORIES_PROPERTY: // categories | 1230 | case ICAL_CATEGORIES_PROPERTY: // categories |
1231 | text = icalproperty_get_categories(p); | 1231 | text = icalproperty_get_categories(p); |
1232 | categories.append(QString::fromUtf8(text)); | 1232 | categories.append(QString::fromUtf8(text)); |
1233 | break; | 1233 | break; |
1234 | //******************************************* | 1234 | //******************************************* |
1235 | case ICAL_RRULE_PROPERTY: | 1235 | case ICAL_RRULE_PROPERTY: |
1236 | // we do need (maybe )start datetime of incidence for recurrence | 1236 | // we do need (maybe )start datetime of incidence for recurrence |
1237 | // such that we can read recurrence only after we read incidence completely | 1237 | // such that we can read recurrence only after we read incidence completely |
1238 | readrec = true; | 1238 | readrec = true; |
1239 | rectype = icalproperty_get_rrule(p); | 1239 | rectype = icalproperty_get_rrule(p); |
1240 | break; | 1240 | break; |
1241 | 1241 | ||
1242 | case ICAL_EXDATE_PROPERTY: | 1242 | case ICAL_EXDATE_PROPERTY: |
1243 | icaltime = icalproperty_get_exdate(p); | 1243 | icaltime = icalproperty_get_exdate(p); |
1244 | incidence->addExDate(readICalDate(icaltime)); | 1244 | incidence->addExDate(readICalDate(icaltime)); |
1245 | break; | 1245 | break; |
1246 | 1246 | ||
1247 | case ICAL_CLASS_PROPERTY: { | 1247 | case ICAL_CLASS_PROPERTY: { |
1248 | int inttext = icalproperty_get_class(p); | 1248 | int inttext = icalproperty_get_class(p); |
1249 | if (inttext == ICAL_CLASS_PUBLIC ) { | 1249 | if (inttext == ICAL_CLASS_PUBLIC ) { |
1250 | incidence->setSecrecy(Incidence::SecrecyPublic); | 1250 | incidence->setSecrecy(Incidence::SecrecyPublic); |
1251 | } else if (inttext == ICAL_CLASS_CONFIDENTIAL ) { | 1251 | } else if (inttext == ICAL_CLASS_CONFIDENTIAL ) { |
1252 | incidence->setSecrecy(Incidence::SecrecyConfidential); | 1252 | incidence->setSecrecy(Incidence::SecrecyConfidential); |
1253 | } else { | 1253 | } else { |
1254 | incidence->setSecrecy(Incidence::SecrecyPrivate); | 1254 | incidence->setSecrecy(Incidence::SecrecyPrivate); |
1255 | } | 1255 | } |
1256 | } | 1256 | } |
1257 | break; | 1257 | break; |
1258 | 1258 | ||
1259 | case ICAL_ATTACH_PROPERTY: // attachments | 1259 | case ICAL_ATTACH_PROPERTY: // attachments |
1260 | incidence->addAttachment(readAttachment(p)); | 1260 | incidence->addAttachment(readAttachment(p)); |
1261 | break; | 1261 | break; |
1262 | 1262 | ||
1263 | default: | 1263 | default: |
1264 | // kdDebug(5800) << "ICALFormat::readIncidence(): Unknown property: " << kind | 1264 | // kdDebug(5800) << "ICALFormat::readIncidence(): Unknown property: " << kind |
1265 | // << endl; | 1265 | // << endl; |
1266 | break; | 1266 | break; |
1267 | } | 1267 | } |
1268 | 1268 | ||
1269 | p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY); | 1269 | p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY); |
1270 | } | 1270 | } |
1271 | if ( readrec ) { | 1271 | if ( readrec ) { |
1272 | readRecurrenceRule(rectype,incidence); | 1272 | readRecurrenceRule(rectype,incidence); |
1273 | } | 1273 | } |
1274 | // kpilot stuff | 1274 | // kpilot stuff |
1275 | // TODO: move this application-specific code to kpilot | 1275 | // TODO: move this application-specific code to kpilot |
1276 | QString kp = incidence->nonKDECustomProperty("X-PILOTID"); | 1276 | QString kp = incidence->nonKDECustomProperty("X-PILOTID"); |
1277 | if (!kp.isNull()) { | 1277 | if (!kp.isNull()) { |
1278 | incidence->setPilotId(kp.toInt()); | 1278 | incidence->setPilotId(kp.toInt()); |
1279 | } | 1279 | } |
1280 | kp = incidence->nonKDECustomProperty("X-PILOTSTAT"); | 1280 | kp = incidence->nonKDECustomProperty("X-PILOTSTAT"); |
1281 | if (!kp.isNull()) { | 1281 | if (!kp.isNull()) { |
1282 | incidence->setSyncStatus(kp.toInt()); | 1282 | incidence->setSyncStatus(kp.toInt()); |
1283 | } | 1283 | } |
1284 | 1284 | ||
1285 | 1285 | ||
1286 | kp = incidence->nonKDECustomProperty("X-KOPIEXTID"); | 1286 | kp = incidence->nonKDECustomProperty("X-KOPIEXTID"); |
1287 | if (!kp.isNull()) { | 1287 | if (!kp.isNull()) { |
1288 | incidence->setIDStr(kp); | 1288 | incidence->setIDStr(kp); |
1289 | } | 1289 | } |
1290 | 1290 | ||
1291 | // Cancel backwards compatibility mode for subsequent changes by the application | 1291 | // Cancel backwards compatibility mode for subsequent changes by the application |
1292 | incidence->recurrence()->setCompatVersion(); | 1292 | incidence->recurrence()->setCompatVersion(); |
1293 | 1293 | ||
1294 | // add categories | 1294 | // add categories |
1295 | incidence->setCategories(categories); | 1295 | incidence->setCategories(categories); |
1296 | 1296 | ||
1297 | // iterate through all alarms | 1297 | // iterate through all alarms |
1298 | for (icalcomponent *alarm = icalcomponent_get_first_component(parent,ICAL_VALARM_COMPONENT); | 1298 | for (icalcomponent *alarm = icalcomponent_get_first_component(parent,ICAL_VALARM_COMPONENT); |
1299 | alarm; | 1299 | alarm; |
1300 | alarm = icalcomponent_get_next_component(parent,ICAL_VALARM_COMPONENT)) { | 1300 | alarm = icalcomponent_get_next_component(parent,ICAL_VALARM_COMPONENT)) { |
1301 | readAlarm(alarm,incidence); | 1301 | readAlarm(alarm,incidence); |
1302 | } | 1302 | } |
1303 | } | 1303 | } |
1304 | 1304 | ||
1305 | void ICalFormatImpl::readIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) | 1305 | void ICalFormatImpl::readIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) |
1306 | { | 1306 | { |
1307 | icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY); | 1307 | icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY); |
1308 | 1308 | ||
1309 | while (p) { | 1309 | while (p) { |
1310 | icalproperty_kind kind = icalproperty_isa(p); | 1310 | icalproperty_kind kind = icalproperty_isa(p); |
1311 | switch (kind) { | 1311 | switch (kind) { |
1312 | 1312 | ||
1313 | case ICAL_UID_PROPERTY: // unique id | 1313 | case ICAL_UID_PROPERTY: // unique id |
1314 | incidenceBase->setUid(QString::fromUtf8(icalproperty_get_uid(p))); | 1314 | incidenceBase->setUid(QString::fromUtf8(icalproperty_get_uid(p))); |
1315 | break; | 1315 | break; |
1316 | 1316 | ||
1317 | case ICAL_ORGANIZER_PROPERTY: // organizer | 1317 | case ICAL_ORGANIZER_PROPERTY: // organizer |
1318 | incidenceBase->setOrganizer(QString::fromUtf8(icalproperty_get_organizer(p))); | 1318 | incidenceBase->setOrganizer(QString::fromUtf8(icalproperty_get_organizer(p))); |
1319 | break; | 1319 | break; |
1320 | 1320 | ||
1321 | case ICAL_ATTENDEE_PROPERTY: // attendee | 1321 | case ICAL_ATTENDEE_PROPERTY: // attendee |
1322 | incidenceBase->addAttendee(readAttendee(p)); | 1322 | incidenceBase->addAttendee(readAttendee(p)); |
1323 | break; | 1323 | break; |
1324 | 1324 | ||
1325 | default: | 1325 | default: |
1326 | break; | 1326 | break; |
1327 | } | 1327 | } |
1328 | 1328 | ||
1329 | p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY); | 1329 | p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY); |
1330 | } | 1330 | } |
1331 | 1331 | ||
1332 | // custom properties | 1332 | // custom properties |
1333 | readCustomProperties(parent, incidenceBase); | 1333 | readCustomProperties(parent, incidenceBase); |
1334 | } | 1334 | } |
1335 | 1335 | ||
1336 | void ICalFormatImpl::readCustomProperties(icalcomponent *parent,CustomProperties *properties) | 1336 | void ICalFormatImpl::readCustomProperties(icalcomponent *parent,CustomProperties *properties) |
1337 | { | 1337 | { |
1338 | QMap<QCString, QString> customProperties; | 1338 | QMap<QCString, QString> customProperties; |
1339 | 1339 | ||
1340 | icalproperty *p = icalcomponent_get_first_property(parent,ICAL_X_PROPERTY); | 1340 | icalproperty *p = icalcomponent_get_first_property(parent,ICAL_X_PROPERTY); |
1341 | 1341 | ||
1342 | while (p) { | 1342 | while (p) { |
1343 | QString value = QString::fromUtf8(icalproperty_get_x(p)); | 1343 | QString value = QString::fromUtf8(icalproperty_get_x(p)); |
1344 | customProperties[icalproperty_get_x_name(p)] = value; | 1344 | customProperties[icalproperty_get_x_name(p)] = value; |
1345 | //qDebug("ICalFormatImpl::readCustomProperties %s %s",value.latin1(), icalproperty_get_x_name(p) ); | 1345 | //qDebug("ICalFormatImpl::readCustomProperties %s %s",value.latin1(), icalproperty_get_x_name(p) ); |
1346 | 1346 | ||
1347 | p = icalcomponent_get_next_property(parent,ICAL_X_PROPERTY); | 1347 | p = icalcomponent_get_next_property(parent,ICAL_X_PROPERTY); |
1348 | } | 1348 | } |
1349 | 1349 | ||
1350 | properties->setCustomProperties(customProperties); | 1350 | properties->setCustomProperties(customProperties); |
1351 | } | 1351 | } |
1352 | 1352 | ||
1353 | void ICalFormatImpl::readRecurrenceRule(struct icalrecurrencetype rrule,Incidence *incidence) | 1353 | void ICalFormatImpl::readRecurrenceRule(struct icalrecurrencetype rrule,Incidence *incidence) |
1354 | { | 1354 | { |
1355 | // kdDebug(5800) << "Read recurrence for " << incidence->summary() << endl; | 1355 | // kdDebug(5800) << "Read recurrence for " << incidence->summary() << endl; |
1356 | 1356 | ||
1357 | Recurrence *recur = incidence->recurrence(); | 1357 | Recurrence *recur = incidence->recurrence(); |
1358 | recur->setCompatVersion(mCalendarVersion); | 1358 | recur->setCompatVersion(mCalendarVersion); |
1359 | recur->unsetRecurs(); | 1359 | recur->unsetRecurs(); |
1360 | 1360 | ||
1361 | struct icalrecurrencetype r = rrule; | 1361 | struct icalrecurrencetype r = rrule; |
1362 | 1362 | ||
1363 | dumpIcalRecurrence(r); | 1363 | dumpIcalRecurrence(r); |
1364 | readRecurrence( r, recur, incidence); | 1364 | readRecurrence( r, recur, incidence); |
1365 | } | 1365 | } |
1366 | 1366 | ||
1367 | void ICalFormatImpl::readRecurrence( const struct icalrecurrencetype &r, Recurrence* recur, Incidence *incidence) | 1367 | void ICalFormatImpl::readRecurrence( const struct icalrecurrencetype &r, Recurrence* recur, Incidence *incidence) |
1368 | { | 1368 | { |
1369 | int wkst; | 1369 | int wkst; |
1370 | int index = 0; | 1370 | int index = 0; |
1371 | short day = 0; | 1371 | short day = 0; |
1372 | QBitArray qba(7); | 1372 | QBitArray qba(7); |
1373 | int frequ = r.freq; | 1373 | int frequ = r.freq; |
1374 | int interv = r.interval; | 1374 | int interv = r.interval; |
1375 | // preprocessing for odd recurrence definitions | 1375 | // preprocessing for odd recurrence definitions |
1376 | 1376 | ||
1377 | if ( r.freq == ICAL_MONTHLY_RECURRENCE ) { | 1377 | if ( r.freq == ICAL_MONTHLY_RECURRENCE ) { |
1378 | if ( r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 1378 | if ( r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
1379 | interv = 12; | 1379 | interv = 12; |
1380 | } | 1380 | } |
1381 | } | 1381 | } |
1382 | if ( r.freq == ICAL_YEARLY_RECURRENCE ) { | 1382 | if ( r.freq == ICAL_YEARLY_RECURRENCE ) { |
1383 | if ( r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX && r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX ) { | 1383 | if ( r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX && r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX ) { |
1384 | frequ = ICAL_MONTHLY_RECURRENCE; | 1384 | frequ = ICAL_MONTHLY_RECURRENCE; |
1385 | interv = 12* r.interval; | 1385 | interv = 12* r.interval; |
1386 | } | 1386 | } |
1387 | } | 1387 | } |
1388 | 1388 | ||
1389 | switch (frequ) { | 1389 | switch (frequ) { |
1390 | case ICAL_MINUTELY_RECURRENCE: | 1390 | case ICAL_MINUTELY_RECURRENCE: |
1391 | if (!icaltime_is_null_time(r.until)) { | 1391 | if (!icaltime_is_null_time(r.until)) { |
1392 | recur->setMinutely(interv,readICalDateTime(r.until)); | 1392 | recur->setMinutely(interv,readICalDateTime(r.until)); |
1393 | } else { | 1393 | } else { |
1394 | if (r.count == 0) | 1394 | if (r.count == 0) |
1395 | recur->setMinutely(interv,-1); | 1395 | recur->setMinutely(interv,-1); |
1396 | else | 1396 | else |
1397 | recur->setMinutely(interv,r.count); | 1397 | recur->setMinutely(interv,r.count); |
1398 | } | 1398 | } |
1399 | break; | 1399 | break; |
1400 | case ICAL_HOURLY_RECURRENCE: | 1400 | case ICAL_HOURLY_RECURRENCE: |
1401 | if (!icaltime_is_null_time(r.until)) { | 1401 | if (!icaltime_is_null_time(r.until)) { |
1402 | recur->setHourly(interv,readICalDateTime(r.until)); | 1402 | recur->setHourly(interv,readICalDateTime(r.until)); |
1403 | } else { | 1403 | } else { |
1404 | if (r.count == 0) | 1404 | if (r.count == 0) |
1405 | recur->setHourly(interv,-1); | 1405 | recur->setHourly(interv,-1); |
1406 | else | 1406 | else |
1407 | recur->setHourly(interv,r.count); | 1407 | recur->setHourly(interv,r.count); |
1408 | } | 1408 | } |
1409 | break; | 1409 | break; |
1410 | case ICAL_DAILY_RECURRENCE: | 1410 | case ICAL_DAILY_RECURRENCE: |
1411 | if (!icaltime_is_null_time(r.until)) { | 1411 | if (!icaltime_is_null_time(r.until)) { |
1412 | recur->setDaily(interv,readICalDate(r.until)); | 1412 | recur->setDaily(interv,readICalDate(r.until)); |
1413 | } else { | 1413 | } else { |
1414 | if (r.count == 0) | 1414 | if (r.count == 0) |
1415 | recur->setDaily(interv,-1); | 1415 | recur->setDaily(interv,-1); |
1416 | else | 1416 | else |
1417 | recur->setDaily(interv,r.count); | 1417 | recur->setDaily(interv,r.count); |
1418 | } | 1418 | } |
1419 | break; | 1419 | break; |
1420 | case ICAL_WEEKLY_RECURRENCE: | 1420 | case ICAL_WEEKLY_RECURRENCE: |
1421 | // kdDebug(5800) << "WEEKLY_RECURRENCE" << endl; | 1421 | // kdDebug(5800) << "WEEKLY_RECURRENCE" << endl; |
1422 | wkst = (r.week_start + 5)%7 + 1; | 1422 | wkst = (r.week_start + 5)%7 + 1; |
1423 | if (!icaltime_is_null_time(r.until)) { | 1423 | if (!icaltime_is_null_time(r.until)) { |
1424 | recur->setWeekly(interv,qba,readICalDate(r.until),wkst); | 1424 | recur->setWeekly(interv,qba,readICalDate(r.until),wkst); |
1425 | } else { | 1425 | } else { |
1426 | if (r.count == 0) | 1426 | if (r.count == 0) |
1427 | recur->setWeekly(interv,qba,-1,wkst); | 1427 | recur->setWeekly(interv,qba,-1,wkst); |
1428 | else | 1428 | else |
1429 | recur->setWeekly(interv,qba,r.count,wkst); | 1429 | recur->setWeekly(interv,qba,r.count,wkst); |
1430 | } | 1430 | } |
1431 | if ( r.by_day[0] == ICAL_RECURRENCE_ARRAY_MAX) { | 1431 | if ( r.by_day[0] == ICAL_RECURRENCE_ARRAY_MAX) { |
1432 | int wday = incidence->dtStart().date().dayOfWeek ()-1; | 1432 | int wday = incidence->dtStart().date().dayOfWeek ()-1; |
1433 | //qDebug("weekly error found "); | 1433 | //qDebug("weekly error found "); |
1434 | qba.setBit(wday); | 1434 | qba.setBit(wday); |
1435 | } else { | 1435 | } else { |
1436 | while((day = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 1436 | while((day = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
1437 | // kdDebug(5800) << " " << day << endl; | 1437 | // kdDebug(5800) << " " << day << endl; |
1438 | qba.setBit((day+5)%7); // convert from Sunday=1 to Monday=0 | 1438 | qba.setBit((day+5)%7); // convert from Sunday=1 to Monday=0 |
1439 | } | 1439 | } |
1440 | } | 1440 | } |
1441 | break; | 1441 | break; |
1442 | case ICAL_MONTHLY_RECURRENCE: | 1442 | case ICAL_MONTHLY_RECURRENCE: |
1443 | 1443 | ||
1444 | if (r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 1444 | if (r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
1445 | if (!icaltime_is_null_time(r.until)) { | 1445 | if (!icaltime_is_null_time(r.until)) { |
1446 | recur->setMonthly(Recurrence::rMonthlyPos,interv, | 1446 | recur->setMonthly(Recurrence::rMonthlyPos,interv, |
1447 | readICalDate(r.until)); | 1447 | readICalDate(r.until)); |
1448 | } else { | 1448 | } else { |
1449 | if (r.count == 0) | 1449 | if (r.count == 0) |
1450 | recur->setMonthly(Recurrence::rMonthlyPos,interv,-1); | 1450 | recur->setMonthly(Recurrence::rMonthlyPos,interv,-1); |
1451 | else | 1451 | else |
1452 | recur->setMonthly(Recurrence::rMonthlyPos,interv,r.count); | 1452 | recur->setMonthly(Recurrence::rMonthlyPos,interv,r.count); |
1453 | } | 1453 | } |
1454 | bool useSetPos = false; | 1454 | bool useSetPos = false; |
1455 | short pos = 0; | 1455 | short pos = 0; |
1456 | while((day = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 1456 | while((day = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
1457 | // kdDebug(5800) << "----a " << index << ": " << day << endl; | 1457 | // kdDebug(5800) << "----a " << index << ": " << day << endl; |
1458 | pos = icalrecurrencetype_day_position(day); | 1458 | pos = icalrecurrencetype_day_position(day); |
1459 | if (pos) { | 1459 | if (pos) { |
1460 | day = icalrecurrencetype_day_day_of_week(day); | 1460 | day = icalrecurrencetype_day_day_of_week(day); |
1461 | QBitArray ba(7); // don't wipe qba | 1461 | QBitArray ba(7); // don't wipe qba |
1462 | ba.setBit((day+5)%7); // convert from Sunday=1 to Monday=0 | 1462 | ba.setBit((day+5)%7); // convert from Sunday=1 to Monday=0 |
1463 | recur->addMonthlyPos(pos,ba); | 1463 | recur->addMonthlyPos(pos,ba); |
1464 | } else { | 1464 | } else { |
1465 | qba.setBit((day+5)%7); // convert from Sunday=1 to Monday=0 | 1465 | qba.setBit((day+5)%7); // convert from Sunday=1 to Monday=0 |
1466 | useSetPos = true; | 1466 | useSetPos = true; |
1467 | } | 1467 | } |
1468 | } | 1468 | } |
1469 | if (useSetPos) { | 1469 | if (useSetPos) { |
1470 | if (r.by_set_pos[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 1470 | if (r.by_set_pos[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
1471 | recur->addMonthlyPos(r.by_set_pos[0],qba); | 1471 | recur->addMonthlyPos(r.by_set_pos[0],qba); |
1472 | } | 1472 | } |
1473 | } | 1473 | } |
1474 | } else if (r.by_month_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 1474 | } else if (r.by_month_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
1475 | if (!icaltime_is_null_time(r.until)) { | 1475 | if (!icaltime_is_null_time(r.until)) { |
1476 | recur->setMonthly(Recurrence::rMonthlyDay,interv, | 1476 | recur->setMonthly(Recurrence::rMonthlyDay,interv, |
1477 | readICalDate(r.until)); | 1477 | readICalDate(r.until)); |
1478 | } else { | 1478 | } else { |
1479 | if (r.count == 0) | 1479 | if (r.count == 0) |
1480 | recur->setMonthly(Recurrence::rMonthlyDay,interv,-1); | 1480 | recur->setMonthly(Recurrence::rMonthlyDay,interv,-1); |
1481 | else | 1481 | else |
1482 | recur->setMonthly(Recurrence::rMonthlyDay,interv,r.count); | 1482 | recur->setMonthly(Recurrence::rMonthlyDay,interv,r.count); |
1483 | } | 1483 | } |
1484 | while((day = r.by_month_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 1484 | while((day = r.by_month_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
1485 | // kdDebug(5800) << "----b " << day << endl; | 1485 | // kdDebug(5800) << "----b " << day << endl; |
1486 | recur->addMonthlyDay(day); | 1486 | recur->addMonthlyDay(day); |
1487 | } | 1487 | } |
1488 | } | 1488 | } |
1489 | break; | 1489 | break; |
1490 | case ICAL_YEARLY_RECURRENCE: | 1490 | case ICAL_YEARLY_RECURRENCE: |
1491 | if (r.by_year_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 1491 | if (r.by_year_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
1492 | //qDebug(" YEARLY DAY OF YEAR"); | 1492 | //qDebug(" YEARLY DAY OF YEAR"); |
1493 | if (!icaltime_is_null_time(r.until)) { | 1493 | if (!icaltime_is_null_time(r.until)) { |
1494 | recur->setYearly(Recurrence::rYearlyDay,interv, | 1494 | recur->setYearly(Recurrence::rYearlyDay,interv, |
1495 | readICalDate(r.until)); | 1495 | readICalDate(r.until)); |
1496 | } else { | 1496 | } else { |
1497 | if (r.count == 0) | 1497 | if (r.count == 0) |
1498 | recur->setYearly(Recurrence::rYearlyDay,interv,-1); | 1498 | recur->setYearly(Recurrence::rYearlyDay,interv,-1); |
1499 | else | 1499 | else |
1500 | recur->setYearly(Recurrence::rYearlyDay,interv,r.count); | 1500 | recur->setYearly(Recurrence::rYearlyDay,interv,r.count); |
1501 | } | 1501 | } |
1502 | while((day = r.by_year_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 1502 | while((day = r.by_year_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
1503 | recur->addYearlyNum(day); | 1503 | recur->addYearlyNum(day); |
1504 | } | 1504 | } |
1505 | } else if ( true /*r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX*/) { | 1505 | } else if ( true /*r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX*/) { |
1506 | if (r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 1506 | if (r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
1507 | qDebug("YEARLY POS NOT SUPPORTED BY GUI"); | 1507 | qDebug("YEARLY POS NOT SUPPORTED BY GUI"); |
1508 | if (!icaltime_is_null_time(r.until)) { | 1508 | if (!icaltime_is_null_time(r.until)) { |
1509 | recur->setYearly(Recurrence::rYearlyPos,interv, | 1509 | recur->setYearly(Recurrence::rYearlyPos,interv, |
1510 | readICalDate(r.until)); | 1510 | readICalDate(r.until)); |
1511 | } else { | 1511 | } else { |
1512 | if (r.count == 0) | 1512 | if (r.count == 0) |
1513 | recur->setYearly(Recurrence::rYearlyPos,interv,-1); | 1513 | recur->setYearly(Recurrence::rYearlyPos,interv,-1); |
1514 | else | 1514 | else |
1515 | recur->setYearly(Recurrence::rYearlyPos,interv,r.count); | 1515 | recur->setYearly(Recurrence::rYearlyPos,interv,r.count); |
1516 | } | 1516 | } |
1517 | bool useSetPos = false; | 1517 | bool useSetPos = false; |
1518 | short pos = 0; | 1518 | short pos = 0; |
1519 | while((day = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 1519 | while((day = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
1520 | // kdDebug(5800) << "----a " << index << ": " << day << endl; | 1520 | // kdDebug(5800) << "----a " << index << ": " << day << endl; |
1521 | pos = icalrecurrencetype_day_position(day); | 1521 | pos = icalrecurrencetype_day_position(day); |
1522 | if (pos) { | 1522 | if (pos) { |
1523 | day = icalrecurrencetype_day_day_of_week(day); | 1523 | day = icalrecurrencetype_day_day_of_week(day); |
1524 | QBitArray ba(7); // don't wipe qba | 1524 | QBitArray ba(7); // don't wipe qba |
1525 | ba.setBit((day+5)%7); // convert from Sunday=1 to Monday=0 | 1525 | ba.setBit((day+5)%7); // convert from Sunday=1 to Monday=0 |
1526 | recur->addYearlyMonthPos(pos,ba); | 1526 | recur->addYearlyMonthPos(pos,ba); |
1527 | } else { | 1527 | } else { |
1528 | qba.setBit((day+5)%7); // convert from Sunday=1 to Monday=0 | 1528 | qba.setBit((day+5)%7); // convert from Sunday=1 to Monday=0 |
1529 | useSetPos = true; | 1529 | useSetPos = true; |
1530 | } | 1530 | } |
1531 | } | 1531 | } |
1532 | if (useSetPos) { | 1532 | if (useSetPos) { |
1533 | if (r.by_set_pos[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 1533 | if (r.by_set_pos[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
1534 | recur->addYearlyMonthPos(r.by_set_pos[0],qba); | 1534 | recur->addYearlyMonthPos(r.by_set_pos[0],qba); |
1535 | } | 1535 | } |
1536 | } | 1536 | } |
1537 | } else { | 1537 | } else { |
1538 | //qDebug("YEARLY MONTH "); | 1538 | //qDebug("YEARLY MONTH "); |
1539 | if (!icaltime_is_null_time(r.until)) { | 1539 | if (!icaltime_is_null_time(r.until)) { |
1540 | recur->setYearly(Recurrence::rYearlyMonth,interv, | 1540 | recur->setYearly(Recurrence::rYearlyMonth,interv, |
1541 | readICalDate(r.until)); | 1541 | readICalDate(r.until)); |
1542 | } else { | 1542 | } else { |
1543 | if (r.count == 0) | 1543 | if (r.count == 0) |
1544 | recur->setYearly(Recurrence::rYearlyMonth,interv,-1); | 1544 | recur->setYearly(Recurrence::rYearlyMonth,interv,-1); |
1545 | else | 1545 | else |
1546 | recur->setYearly(Recurrence::rYearlyMonth,interv,r.count); | 1546 | recur->setYearly(Recurrence::rYearlyMonth,interv,r.count); |
1547 | } | 1547 | } |
1548 | if ( r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX ) { | 1548 | if ( r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX ) { |
1549 | index = 0; | 1549 | index = 0; |
1550 | while((day = r.by_month[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 1550 | while((day = r.by_month[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
1551 | recur->addYearlyNum(day); | 1551 | recur->addYearlyNum(day); |
1552 | } | 1552 | } |
1553 | } else { | 1553 | } else { |
1554 | recur->addYearlyNum(incidence->dtStart().date().month()); | 1554 | recur->addYearlyNum(incidence->dtStart().date().month()); |
1555 | } | 1555 | } |
1556 | } | 1556 | } |
1557 | 1557 | ||
1558 | } | 1558 | } |
1559 | break; | 1559 | break; |
1560 | default: | 1560 | default: |
1561 | ; | 1561 | ; |
1562 | break; | 1562 | break; |
1563 | } | 1563 | } |
1564 | } | 1564 | } |
1565 | 1565 | ||
1566 | void ICalFormatImpl::readAlarm(icalcomponent *alarm,Incidence *incidence) | 1566 | void ICalFormatImpl::readAlarm(icalcomponent *alarm,Incidence *incidence) |
1567 | { | 1567 | { |
1568 | //kdDebug(5800) << "Read alarm for " << incidence->summary() << endl; | 1568 | //kdDebug(5800) << "Read alarm for " << incidence->summary() << endl; |
1569 | 1569 | ||
1570 | Alarm* ialarm = incidence->newAlarm(); | 1570 | Alarm* ialarm = incidence->newAlarm(); |
1571 | ialarm->setRepeatCount(0); | 1571 | ialarm->setRepeatCount(0); |
1572 | ialarm->setEnabled(true); | 1572 | ialarm->setEnabled(true); |
1573 | 1573 | ||
1574 | // Determine the alarm's action type | 1574 | // Determine the alarm's action type |
1575 | icalproperty *p = icalcomponent_get_first_property(alarm,ICAL_ACTION_PROPERTY); | 1575 | icalproperty *p = icalcomponent_get_first_property(alarm,ICAL_ACTION_PROPERTY); |
1576 | if ( !p ) { | 1576 | if ( !p ) { |
1577 | return; | 1577 | return; |
1578 | } | 1578 | } |
1579 | 1579 | ||
1580 | icalproperty_action action = icalproperty_get_action(p); | 1580 | icalproperty_action action = icalproperty_get_action(p); |
1581 | Alarm::Type type = Alarm::Display; | 1581 | Alarm::Type type = Alarm::Display; |
1582 | switch ( action ) { | 1582 | switch ( action ) { |
1583 | case ICAL_ACTION_DISPLAY: type = Alarm::Display; break; | 1583 | case ICAL_ACTION_DISPLAY: type = Alarm::Display; break; |
1584 | case ICAL_ACTION_AUDIO: type = Alarm::Audio; break; | 1584 | case ICAL_ACTION_AUDIO: type = Alarm::Audio; break; |
1585 | case ICAL_ACTION_PROCEDURE: type = Alarm::Procedure; break; | 1585 | case ICAL_ACTION_PROCEDURE: type = Alarm::Procedure; break; |
1586 | case ICAL_ACTION_EMAIL: type = Alarm::Email; break; | 1586 | case ICAL_ACTION_EMAIL: type = Alarm::Email; break; |
1587 | default: | 1587 | default: |
1588 | ; | 1588 | ; |
1589 | return; | 1589 | return; |
1590 | } | 1590 | } |
1591 | ialarm->setType(type); | 1591 | ialarm->setType(type); |
1592 | 1592 | ||
1593 | p = icalcomponent_get_first_property(alarm,ICAL_ANY_PROPERTY); | 1593 | p = icalcomponent_get_first_property(alarm,ICAL_ANY_PROPERTY); |
1594 | while (p) { | 1594 | while (p) { |
1595 | icalproperty_kind kind = icalproperty_isa(p); | 1595 | icalproperty_kind kind = icalproperty_isa(p); |
1596 | 1596 | ||
1597 | switch (kind) { | 1597 | switch (kind) { |
1598 | case ICAL_TRIGGER_PROPERTY: { | 1598 | case ICAL_TRIGGER_PROPERTY: { |
1599 | icaltriggertype trigger = icalproperty_get_trigger(p); | 1599 | icaltriggertype trigger = icalproperty_get_trigger(p); |
1600 | if (icaltime_is_null_time(trigger.time)) { | 1600 | if (icaltime_is_null_time(trigger.time)) { |
1601 | if (icaldurationtype_is_null_duration(trigger.duration)) { | 1601 | if (icaldurationtype_is_null_duration(trigger.duration)) { |
1602 | kdDebug(5800) << "ICalFormatImpl::readAlarm(): Trigger has no time and no duration." << endl; | 1602 | kdDebug(5800) << "ICalFormatImpl::readAlarm(): Trigger has no time and no duration." << endl; |
1603 | } else { | 1603 | } else { |
1604 | Duration duration = icaldurationtype_as_int( trigger.duration ); | 1604 | Duration duration = icaldurationtype_as_int( trigger.duration ); |
1605 | icalparameter *param = icalproperty_get_first_parameter(p,ICAL_RELATED_PARAMETER); | 1605 | icalparameter *param = icalproperty_get_first_parameter(p,ICAL_RELATED_PARAMETER); |
1606 | if (param && icalparameter_get_related(param) == ICAL_RELATED_END) | 1606 | if (param && icalparameter_get_related(param) == ICAL_RELATED_END) |
1607 | ialarm->setEndOffset(duration); | 1607 | ialarm->setEndOffset(duration); |
1608 | else | 1608 | else |
1609 | ialarm->setStartOffset(duration); | 1609 | ialarm->setStartOffset(duration); |
1610 | } | 1610 | } |
1611 | } else { | 1611 | } else { |
1612 | ialarm->setTime(readICalDateTime(trigger.time)); | 1612 | ialarm->setTime(readICalDateTime(trigger.time)); |
1613 | } | 1613 | } |
1614 | break; | 1614 | break; |
1615 | } | 1615 | } |
1616 | case ICAL_DURATION_PROPERTY: { | 1616 | case ICAL_DURATION_PROPERTY: { |
1617 | icaldurationtype duration = icalproperty_get_duration(p); | 1617 | icaldurationtype duration = icalproperty_get_duration(p); |
1618 | ialarm->setSnoozeTime(icaldurationtype_as_int(duration)/60); | 1618 | ialarm->setSnoozeTime(icaldurationtype_as_int(duration)/60); |
1619 | break; | 1619 | break; |
1620 | } | 1620 | } |
1621 | case ICAL_REPEAT_PROPERTY: | 1621 | case ICAL_REPEAT_PROPERTY: |
1622 | ialarm->setRepeatCount(icalproperty_get_repeat(p)); | 1622 | ialarm->setRepeatCount(icalproperty_get_repeat(p)); |
1623 | break; | 1623 | break; |
1624 | 1624 | ||
1625 | // Only in DISPLAY and EMAIL and PROCEDURE alarms | 1625 | // Only in DISPLAY and EMAIL and PROCEDURE alarms |
1626 | case ICAL_DESCRIPTION_PROPERTY: { | 1626 | case ICAL_DESCRIPTION_PROPERTY: { |
1627 | QString description = QString::fromUtf8(icalproperty_get_description(p)); | 1627 | QString description = QString::fromUtf8(icalproperty_get_description(p)); |
1628 | switch ( action ) { | 1628 | switch ( action ) { |
1629 | case ICAL_ACTION_DISPLAY: | 1629 | case ICAL_ACTION_DISPLAY: |
1630 | ialarm->setText( description ); | 1630 | ialarm->setText( description ); |
1631 | break; | 1631 | break; |
1632 | case ICAL_ACTION_PROCEDURE: | 1632 | case ICAL_ACTION_PROCEDURE: |
1633 | ialarm->setProgramArguments( description ); | 1633 | ialarm->setProgramArguments( description ); |
1634 | break; | 1634 | break; |
1635 | case ICAL_ACTION_EMAIL: | 1635 | case ICAL_ACTION_EMAIL: |
1636 | ialarm->setMailText( description ); | 1636 | ialarm->setMailText( description ); |
1637 | break; | 1637 | break; |
1638 | default: | 1638 | default: |
1639 | break; | 1639 | break; |
1640 | } | 1640 | } |
1641 | break; | 1641 | break; |
1642 | } | 1642 | } |
1643 | // Only in EMAIL alarm | 1643 | // Only in EMAIL alarm |
1644 | case ICAL_SUMMARY_PROPERTY: | 1644 | case ICAL_SUMMARY_PROPERTY: |
1645 | ialarm->setMailSubject(QString::fromUtf8(icalproperty_get_summary(p))); | 1645 | ialarm->setMailSubject(QString::fromUtf8(icalproperty_get_summary(p))); |
1646 | break; | 1646 | break; |
1647 | 1647 | ||
1648 | // Only in EMAIL alarm | 1648 | // Only in EMAIL alarm |
1649 | case ICAL_ATTENDEE_PROPERTY: { | 1649 | case ICAL_ATTENDEE_PROPERTY: { |
1650 | QString email = QString::fromUtf8(icalproperty_get_attendee(p)); | 1650 | QString email = QString::fromUtf8(icalproperty_get_attendee(p)); |
1651 | QString name; | 1651 | QString name; |
1652 | icalparameter *param = icalproperty_get_first_parameter(p,ICAL_CN_PARAMETER); | 1652 | icalparameter *param = icalproperty_get_first_parameter(p,ICAL_CN_PARAMETER); |
1653 | if (param) { | 1653 | if (param) { |
1654 | name = QString::fromUtf8(icalparameter_get_cn(param)); | 1654 | name = QString::fromUtf8(icalparameter_get_cn(param)); |
1655 | } | 1655 | } |
1656 | ialarm->addMailAddress(Person(name, email)); | 1656 | ialarm->addMailAddress(Person(name, email)); |
1657 | break; | 1657 | break; |
1658 | } | 1658 | } |
1659 | // Only in AUDIO and EMAIL and PROCEDURE alarms | 1659 | // Only in AUDIO and EMAIL and PROCEDURE alarms |
1660 | case ICAL_ATTACH_PROPERTY: { | 1660 | case ICAL_ATTACH_PROPERTY: { |
1661 | icalattach *attach = icalproperty_get_attach(p); | 1661 | icalattach *attach = icalproperty_get_attach(p); |
1662 | QString url = QFile::decodeName(icalattach_get_url(attach)); | 1662 | QString url = QFile::decodeName(icalattach_get_url(attach)); |
1663 | switch ( action ) { | 1663 | switch ( action ) { |
1664 | case ICAL_ACTION_AUDIO: | 1664 | case ICAL_ACTION_AUDIO: |
1665 | ialarm->setAudioFile( url ); | 1665 | ialarm->setAudioFile( url ); |
1666 | break; | 1666 | break; |
1667 | case ICAL_ACTION_PROCEDURE: | 1667 | case ICAL_ACTION_PROCEDURE: |
1668 | ialarm->setProgramFile( url ); | 1668 | ialarm->setProgramFile( url ); |
1669 | break; | 1669 | break; |
1670 | case ICAL_ACTION_EMAIL: | 1670 | case ICAL_ACTION_EMAIL: |
1671 | ialarm->addMailAttachment( url ); | 1671 | ialarm->addMailAttachment( url ); |
1672 | break; | 1672 | break; |
1673 | default: | 1673 | default: |
1674 | break; | 1674 | break; |
1675 | } | 1675 | } |
1676 | break; | 1676 | break; |
1677 | } | 1677 | } |
1678 | default: | 1678 | default: |
1679 | break; | 1679 | break; |
1680 | } | 1680 | } |
1681 | 1681 | ||
1682 | p = icalcomponent_get_next_property(alarm,ICAL_ANY_PROPERTY); | 1682 | p = icalcomponent_get_next_property(alarm,ICAL_ANY_PROPERTY); |
1683 | } | 1683 | } |
1684 | 1684 | ||
1685 | // custom properties | 1685 | // custom properties |
1686 | readCustomProperties(alarm, ialarm); | 1686 | readCustomProperties(alarm, ialarm); |
1687 | 1687 | ||
1688 | // TODO: check for consistency of alarm properties | 1688 | // TODO: check for consistency of alarm properties |
1689 | } | 1689 | } |
1690 | 1690 | ||
1691 | icaltimetype ICalFormatImpl::writeICalDate(const QDate &date) | 1691 | icaltimetype ICalFormatImpl::writeICalDate(const QDate &date) |
1692 | { | 1692 | { |
1693 | icaltimetype t; | 1693 | icaltimetype t; |
1694 | 1694 | ||
1695 | t.year = date.year(); | 1695 | t.year = date.year(); |
1696 | t.month = date.month(); | 1696 | t.month = date.month(); |
1697 | t.day = date.day(); | 1697 | t.day = date.day(); |
1698 | 1698 | ||
1699 | t.hour = 0; | 1699 | t.hour = 0; |
1700 | t.minute = 0; | 1700 | t.minute = 0; |
1701 | t.second = 0; | 1701 | t.second = 0; |
1702 | 1702 | ||
1703 | t.is_date = 1; | 1703 | t.is_date = 1; |
1704 | 1704 | ||
1705 | t.is_utc = 0; | 1705 | t.is_utc = 0; |
1706 | 1706 | ||
1707 | t.zone = 0; | 1707 | t.zone = 0; |
1708 | 1708 | ||
1709 | return t; | 1709 | return t; |
1710 | } | 1710 | } |
1711 | 1711 | ||
1712 | icaltimetype ICalFormatImpl::writeICalDateTime(const QDateTime &dt ) | 1712 | icaltimetype ICalFormatImpl::writeICalDateTime(const QDateTime &dt ) |
1713 | { | 1713 | { |
1714 | icaltimetype t; | 1714 | icaltimetype t; |
1715 | t.is_date = 0; | 1715 | t.is_date = 0; |
1716 | t.zone = 0; | 1716 | t.zone = 0; |
1717 | QDateTime datetime; | 1717 | QDateTime datetime; |
1718 | if ( mParent->utc() ) { | 1718 | if ( mParent->utc() ) { |
1719 | int offset = KGlobal::locale()->localTimeOffset( dt ); | 1719 | int offset = KGlobal::locale()->localTimeOffset( dt ); |
1720 | datetime = dt.addSecs ( -offset*60); | 1720 | datetime = dt.addSecs ( -offset*60); |
1721 | t.is_utc = 1; | 1721 | t.is_utc = 1; |
1722 | } | 1722 | } |
1723 | else { | 1723 | else { |
1724 | datetime = dt; | 1724 | datetime = dt; |
1725 | t.is_utc = 0; | 1725 | t.is_utc = 0; |
1726 | 1726 | ||
1727 | } | 1727 | } |
1728 | t.year = datetime.date().year(); | 1728 | t.year = datetime.date().year(); |
1729 | t.month = datetime.date().month(); | 1729 | t.month = datetime.date().month(); |
1730 | t.day = datetime.date().day(); | 1730 | t.day = datetime.date().day(); |
1731 | 1731 | ||
1732 | t.hour = datetime.time().hour(); | 1732 | t.hour = datetime.time().hour(); |
1733 | t.minute = datetime.time().minute(); | 1733 | t.minute = datetime.time().minute(); |
1734 | t.second = datetime.time().second(); | 1734 | t.second = datetime.time().second(); |
1735 | 1735 | ||
1736 | //qDebug("*** time %s localtime %s ",dt .toString().latin1() ,datetime .toString().latin1() ); | 1736 | //qDebug("*** time %s localtime %s ",dt .toString().latin1() ,datetime .toString().latin1() ); |
1737 | 1737 | ||
1738 | // if ( mParent->utc() ) { | 1738 | // if ( mParent->utc() ) { |
1739 | // datetime = KGlobal::locale()->localTime( dt ); | 1739 | // datetime = KGlobal::locale()->localTime( dt ); |
1740 | // qDebug("*** time %s localtime %s ",dt .toString().latin1() ,datetime .toString().latin1() ); | 1740 | // qDebug("*** time %s localtime %s ",dt .toString().latin1() ,datetime .toString().latin1() ); |
1741 | // if (mParent->timeZoneId().isEmpty()) | 1741 | // if (mParent->timeZoneId().isEmpty()) |
1742 | // t = icaltime_as_utc(t, 0); | 1742 | // t = icaltime_as_utc(t, 0); |
1743 | // else | 1743 | // else |
1744 | // t = icaltime_as_utc(t,mParent->timeZoneId().local8Bit()); | 1744 | // t = icaltime_as_utc(t,mParent->timeZoneId().local8Bit()); |
1745 | // } | 1745 | // } |
1746 | 1746 | ||
1747 | return t; | 1747 | return t; |
1748 | } | 1748 | } |
1749 | 1749 | ||
1750 | QDateTime ICalFormatImpl::readICalDateTime(icaltimetype t) | 1750 | QDateTime ICalFormatImpl::readICalDateTime(icaltimetype t) |
1751 | { | 1751 | { |
1752 | QDateTime dt (QDate(t.year,t.month,t.day), | 1752 | QDateTime dt (QDate(t.year,t.month,t.day), |
1753 | QTime(t.hour,t.minute,t.second) ); | 1753 | QTime(t.hour,t.minute,t.second) ); |
1754 | 1754 | ||
1755 | if (t.is_utc) { | 1755 | if (t.is_utc) { |
1756 | int offset = KGlobal::locale()->localTimeOffset( dt ); | 1756 | int offset = KGlobal::locale()->localTimeOffset( dt ); |
1757 | dt = dt.addSecs ( offset*60); | 1757 | dt = dt.addSecs ( offset*60); |
1758 | } | 1758 | } |
1759 | 1759 | ||
1760 | return dt; | 1760 | return dt; |
1761 | } | 1761 | } |
1762 | 1762 | ||
1763 | QDate ICalFormatImpl::readICalDate(icaltimetype t) | 1763 | QDate ICalFormatImpl::readICalDate(icaltimetype t) |
1764 | { | 1764 | { |
1765 | return QDate(t.year,t.month,t.day); | 1765 | return QDate(t.year,t.month,t.day); |
1766 | } | 1766 | } |
1767 | 1767 | ||
1768 | icaldurationtype ICalFormatImpl::writeICalDuration(int seconds) | 1768 | icaldurationtype ICalFormatImpl::writeICalDuration(int seconds) |
1769 | { | 1769 | { |
1770 | icaldurationtype d; | 1770 | icaldurationtype d; |
1771 | 1771 | ||
1772 | d.weeks = seconds % gSecondsPerWeek; | 1772 | d.is_neg = (seconds<0)?1:0; |
1773 | seconds -= d.weeks * gSecondsPerWeek; | 1773 | if (seconds<0) seconds = -seconds; |
1774 | d.days = seconds % gSecondsPerDay; | 1774 | |
1775 | seconds -= d.days * gSecondsPerDay; | 1775 | d.weeks = seconds / gSecondsPerWeek; |
1776 | d.hours = seconds % gSecondsPerHour; | 1776 | seconds %= gSecondsPerWeek; |
1777 | seconds -= d.hours * gSecondsPerHour; | 1777 | d.days = seconds / gSecondsPerDay; |
1778 | d.minutes = seconds % gSecondsPerMinute; | 1778 | seconds %= gSecondsPerDay; |
1779 | seconds -= d.minutes * gSecondsPerMinute; | 1779 | d.hours = seconds / gSecondsPerHour; |
1780 | seconds %= gSecondsPerHour; | ||
1781 | d.minutes = seconds / gSecondsPerMinute; | ||
1782 | seconds %= gSecondsPerMinute; | ||
1780 | d.seconds = seconds; | 1783 | d.seconds = seconds; |
1781 | d.is_neg = 0; | ||
1782 | |||
1783 | return d; | 1784 | return d; |
1784 | } | 1785 | } |
1785 | 1786 | ||
1786 | int ICalFormatImpl::readICalDuration(icaldurationtype d) | 1787 | int ICalFormatImpl::readICalDuration(icaldurationtype d) |
1787 | { | 1788 | { |
1788 | int result = 0; | 1789 | int result = 0; |
1789 | 1790 | ||
1790 | result += d.weeks * gSecondsPerWeek; | 1791 | result += d.weeks * gSecondsPerWeek; |
1791 | result += d.days * gSecondsPerDay; | 1792 | result += d.days * gSecondsPerDay; |
1792 | result += d.hours * gSecondsPerHour; | 1793 | result += d.hours * gSecondsPerHour; |
1793 | result += d.minutes * gSecondsPerMinute; | 1794 | result += d.minutes * gSecondsPerMinute; |
1794 | result += d.seconds; | 1795 | result += d.seconds; |
1795 | 1796 | ||
1796 | if (d.is_neg) result *= -1; | 1797 | if (d.is_neg) result *= -1; |
1797 | 1798 | ||
1798 | return result; | 1799 | return result; |
1799 | } | 1800 | } |
1800 | 1801 | ||
1801 | icalcomponent *ICalFormatImpl::createCalendarComponent(Calendar *cal) | 1802 | icalcomponent *ICalFormatImpl::createCalendarComponent(Calendar *cal) |
1802 | { | 1803 | { |
1803 | icalcomponent *calendar; | 1804 | icalcomponent *calendar; |
1804 | 1805 | ||
1805 | // Root component | 1806 | // Root component |
1806 | calendar = icalcomponent_new(ICAL_VCALENDAR_COMPONENT); | 1807 | calendar = icalcomponent_new(ICAL_VCALENDAR_COMPONENT); |
1807 | 1808 | ||
1808 | icalproperty *p; | 1809 | icalproperty *p; |
1809 | 1810 | ||
1810 | // Product Identifier | 1811 | // Product Identifier |
1811 | p = icalproperty_new_prodid(CalFormat::productId().utf8()); | 1812 | p = icalproperty_new_prodid(CalFormat::productId().utf8()); |
1812 | icalcomponent_add_property(calendar,p); | 1813 | icalcomponent_add_property(calendar,p); |
1813 | 1814 | ||
1814 | // TODO: Add time zone | 1815 | // TODO: Add time zone |
1815 | 1816 | ||
1816 | // iCalendar version (2.0) | 1817 | // iCalendar version (2.0) |
1817 | p = icalproperty_new_version(const_cast<char *>(_ICAL_VERSION)); | 1818 | p = icalproperty_new_version(const_cast<char *>(_ICAL_VERSION)); |
1818 | icalcomponent_add_property(calendar,p); | 1819 | icalcomponent_add_property(calendar,p); |
1819 | 1820 | ||
1820 | // Custom properties | 1821 | // Custom properties |
1821 | if( cal != 0 ) | 1822 | if( cal != 0 ) |
1822 | writeCustomProperties(calendar, cal); | 1823 | writeCustomProperties(calendar, cal); |
1823 | 1824 | ||
1824 | return calendar; | 1825 | return calendar; |
1825 | } | 1826 | } |
1826 | 1827 | ||
1827 | 1828 | ||
1828 | 1829 | ||
1829 | // take a raw vcalendar (i.e. from a file on disk, clipboard, etc. etc. | 1830 | // take a raw vcalendar (i.e. from a file on disk, clipboard, etc. etc. |
1830 | // and break it down from its tree-like format into the dictionary format | 1831 | // and break it down from its tree-like format into the dictionary format |
1831 | // that is used internally in the ICalFormatImpl. | 1832 | // that is used internally in the ICalFormatImpl. |
1832 | bool ICalFormatImpl::populate( Calendar *cal, icalcomponent *calendar) | 1833 | bool ICalFormatImpl::populate( Calendar *cal, icalcomponent *calendar) |
1833 | { | 1834 | { |
1834 | // this function will populate the caldict dictionary and other event | 1835 | // this function will populate the caldict dictionary and other event |
1835 | // lists. It turns vevents into Events and then inserts them. | 1836 | // lists. It turns vevents into Events and then inserts them. |
1836 | 1837 | ||
1837 | if (!calendar) return false; | 1838 | if (!calendar) return false; |
1838 | 1839 | ||
1839 | // TODO: check for METHOD | 1840 | // TODO: check for METHOD |
1840 | #if 0 | 1841 | #if 0 |
1841 | if ((curVO = isAPropertyOf(vcal, ICMethodProp)) != 0) { | 1842 | if ((curVO = isAPropertyOf(vcal, ICMethodProp)) != 0) { |
1842 | char *methodType = 0; | 1843 | char *methodType = 0; |
1843 | methodType = fakeCString(vObjectUStringZValue(curVO)); | 1844 | methodType = fakeCString(vObjectUStringZValue(curVO)); |
1844 | if (mEnableDialogs) | 1845 | if (mEnableDialogs) |
1845 | KMessageBox::information(mTopWidget, | 1846 | KMessageBox::information(mTopWidget, |
1846 | i18n("This calendar is an iTIP transaction of type \"%1\".") | 1847 | i18n("This calendar is an iTIP transaction of type \"%1\".") |
1847 | .arg(methodType), | 1848 | .arg(methodType), |
1848 | i18n("%1: iTIP Transaction").arg(CalFormat::application())); | 1849 | i18n("%1: iTIP Transaction").arg(CalFormat::application())); |
1849 | delete methodType; | 1850 | delete methodType; |
1850 | } | 1851 | } |
1851 | #endif | 1852 | #endif |
1852 | 1853 | ||
1853 | icalproperty *p; | 1854 | icalproperty *p; |
1854 | 1855 | ||
1855 | p = icalcomponent_get_first_property(calendar,ICAL_PRODID_PROPERTY); | 1856 | p = icalcomponent_get_first_property(calendar,ICAL_PRODID_PROPERTY); |
1856 | if (!p) { | 1857 | if (!p) { |
1857 | // TODO: does no PRODID really matter? | 1858 | // TODO: does no PRODID really matter? |
1858 | // mParent->setException(new ErrorFormat(ErrorFormat::CalVersionUnknown)); | 1859 | // mParent->setException(new ErrorFormat(ErrorFormat::CalVersionUnknown)); |
1859 | // return false; | 1860 | // return false; |
1860 | mLoadedProductId = ""; | 1861 | mLoadedProductId = ""; |
1861 | mCalendarVersion = 0; | 1862 | mCalendarVersion = 0; |
1862 | } else { | 1863 | } else { |
1863 | mLoadedProductId = QString::fromUtf8(icalproperty_get_prodid(p)); | 1864 | mLoadedProductId = QString::fromUtf8(icalproperty_get_prodid(p)); |
1864 | mCalendarVersion = CalFormat::calendarVersion(mLoadedProductId); | 1865 | mCalendarVersion = CalFormat::calendarVersion(mLoadedProductId); |
1865 | 1866 | ||
1866 | delete mCompat; | 1867 | delete mCompat; |
1867 | mCompat = CompatFactory::createCompat( mLoadedProductId ); | 1868 | mCompat = CompatFactory::createCompat( mLoadedProductId ); |
1868 | } | 1869 | } |
1869 | 1870 | ||
1870 | // TODO: check for unknown PRODID | 1871 | // TODO: check for unknown PRODID |
1871 | #if 0 | 1872 | #if 0 |
1872 | if (!mCalendarVersion | 1873 | if (!mCalendarVersion |
1873 | && CalFormat::productId() != mLoadedProductId) { | 1874 | && CalFormat::productId() != mLoadedProductId) { |
1874 | // warn the user that we might have trouble reading non-known calendar. | 1875 | // warn the user that we might have trouble reading non-known calendar. |
1875 | if (mEnableDialogs) | 1876 | if (mEnableDialogs) |
1876 | KMessageBox::information(mTopWidget, | 1877 | KMessageBox::information(mTopWidget, |
1877 | i18n("This vCalendar file was not created by KOrganizer " | 1878 | i18n("This vCalendar file was not created by KOrganizer " |
1878 | "or any other product we support. Loading anyway..."), | 1879 | "or any other product we support. Loading anyway..."), |
1879 | i18n("%1: Unknown vCalendar Vendor").arg(CalFormat::application())); | 1880 | i18n("%1: Unknown vCalendar Vendor").arg(CalFormat::application())); |
1880 | } | 1881 | } |
1881 | #endif | 1882 | #endif |
1882 | 1883 | ||
1883 | p = icalcomponent_get_first_property(calendar,ICAL_VERSION_PROPERTY); | 1884 | p = icalcomponent_get_first_property(calendar,ICAL_VERSION_PROPERTY); |
1884 | if (!p) { | 1885 | if (!p) { |
1885 | mParent->setException(new ErrorFormat(ErrorFormat::CalVersionUnknown)); | 1886 | mParent->setException(new ErrorFormat(ErrorFormat::CalVersionUnknown)); |
1886 | return false; | 1887 | return false; |
1887 | } else { | 1888 | } else { |
1888 | const char *version = icalproperty_get_version(p); | 1889 | const char *version = icalproperty_get_version(p); |
1889 | 1890 | ||
1890 | if (strcmp(version,"1.0") == 0) { | 1891 | if (strcmp(version,"1.0") == 0) { |
1891 | mParent->setException(new ErrorFormat(ErrorFormat::CalVersion1, | 1892 | mParent->setException(new ErrorFormat(ErrorFormat::CalVersion1, |
1892 | i18n("Expected iCalendar format"))); | 1893 | i18n("Expected iCalendar format"))); |
1893 | return false; | 1894 | return false; |
1894 | } else if (strcmp(version,"2.0") != 0) { | 1895 | } else if (strcmp(version,"2.0") != 0) { |
1895 | mParent->setException(new ErrorFormat(ErrorFormat::CalVersionUnknown)); | 1896 | mParent->setException(new ErrorFormat(ErrorFormat::CalVersionUnknown)); |
1896 | return false; | 1897 | return false; |
1897 | } | 1898 | } |
1898 | } | 1899 | } |
1899 | 1900 | ||
1900 | 1901 | ||
1901 | // TODO: check for calendar format version | 1902 | // TODO: check for calendar format version |
1902 | #if 0 | 1903 | #if 0 |
1903 | // warn the user we might have trouble reading this unknown version. | 1904 | // warn the user we might have trouble reading this unknown version. |
1904 | if ((curVO = isAPropertyOf(vcal, VCVersionProp)) != 0) { | 1905 | if ((curVO = isAPropertyOf(vcal, VCVersionProp)) != 0) { |
1905 | char *s = fakeCString(vObjectUStringZValue(curVO)); | 1906 | char *s = fakeCString(vObjectUStringZValue(curVO)); |
1906 | if (strcmp(_VCAL_VERSION, s) != 0) | 1907 | if (strcmp(_VCAL_VERSION, s) != 0) |
1907 | if (mEnableDialogs) | 1908 | if (mEnableDialogs) |
1908 | KMessageBox::sorry(mTopWidget, | 1909 | KMessageBox::sorry(mTopWidget, |
1909 | i18n("This vCalendar file has version %1.\n" | 1910 | i18n("This vCalendar file has version %1.\n" |
1910 | "We only support %2.") | 1911 | "We only support %2.") |
1911 | .arg(s).arg(_VCAL_VERSION), | 1912 | .arg(s).arg(_VCAL_VERSION), |
1912 | i18n("%1: Unknown vCalendar Version").arg(CalFormat::application())); | 1913 | i18n("%1: Unknown vCalendar Version").arg(CalFormat::application())); |
1913 | deleteStr(s); | 1914 | deleteStr(s); |
1914 | } | 1915 | } |
1915 | #endif | 1916 | #endif |
1916 | 1917 | ||
1917 | // custom properties | 1918 | // custom properties |
1918 | readCustomProperties(calendar, cal); | 1919 | readCustomProperties(calendar, cal); |
1919 | 1920 | ||
1920 | // TODO: set time zone | 1921 | // TODO: set time zone |
1921 | #if 0 | 1922 | #if 0 |
1922 | // set the time zone | 1923 | // set the time zone |
1923 | if ((curVO = isAPropertyOf(vcal, VCTimeZoneProp)) != 0) { | 1924 | if ((curVO = isAPropertyOf(vcal, VCTimeZoneProp)) != 0) { |
1924 | char *s = fakeCString(vObjectUStringZValue(curVO)); | 1925 | char *s = fakeCString(vObjectUStringZValue(curVO)); |
1925 | cal->setTimeZone(s); | 1926 | cal->setTimeZone(s); |
1926 | deleteStr(s); | 1927 | deleteStr(s); |
1927 | } | 1928 | } |
1928 | #endif | 1929 | #endif |
1929 | 1930 | ||
1930 | // Store all events with a relatedTo property in a list for post-processing | 1931 | // Store all events with a relatedTo property in a list for post-processing |
1931 | mEventsRelate.clear(); | 1932 | mEventsRelate.clear(); |
1932 | mTodosRelate.clear(); | 1933 | mTodosRelate.clear(); |
1933 | // TODO: make sure that only actually added ecvens go to this lists. | 1934 | // TODO: make sure that only actually added ecvens go to this lists. |
1934 | 1935 | ||
1935 | icalcomponent *c; | 1936 | icalcomponent *c; |
1936 | 1937 | ||
1937 | // Iterate through all todos | 1938 | // Iterate through all todos |
1938 | c = icalcomponent_get_first_component(calendar,ICAL_VTODO_COMPONENT); | 1939 | c = icalcomponent_get_first_component(calendar,ICAL_VTODO_COMPONENT); |
1939 | while (c) { | 1940 | while (c) { |
1940 | // kdDebug(5800) << "----Todo found" << endl; | 1941 | // kdDebug(5800) << "----Todo found" << endl; |
1941 | Todo *todo = readTodo(c); | 1942 | Todo *todo = readTodo(c); |
1942 | if (!cal->todo(todo->uid())) cal->addTodo(todo); | 1943 | if (!cal->todo(todo->uid())) cal->addTodo(todo); |
1943 | c = icalcomponent_get_next_component(calendar,ICAL_VTODO_COMPONENT); | 1944 | c = icalcomponent_get_next_component(calendar,ICAL_VTODO_COMPONENT); |
1944 | } | 1945 | } |
1945 | 1946 | ||
1946 | // Iterate through all events | 1947 | // Iterate through all events |
1947 | c = icalcomponent_get_first_component(calendar,ICAL_VEVENT_COMPONENT); | 1948 | c = icalcomponent_get_first_component(calendar,ICAL_VEVENT_COMPONENT); |
1948 | while (c) { | 1949 | while (c) { |
1949 | // kdDebug(5800) << "----Event found" << endl; | 1950 | // kdDebug(5800) << "----Event found" << endl; |
1950 | Event *event = readEvent(c); | 1951 | Event *event = readEvent(c); |
1951 | if (!cal->event(event->uid())) cal->addEvent(event); | 1952 | if (!cal->event(event->uid())) cal->addEvent(event); |
1952 | c = icalcomponent_get_next_component(calendar,ICAL_VEVENT_COMPONENT); | 1953 | c = icalcomponent_get_next_component(calendar,ICAL_VEVENT_COMPONENT); |
1953 | } | 1954 | } |
1954 | 1955 | ||
1955 | // Iterate through all journals | 1956 | // Iterate through all journals |
1956 | c = icalcomponent_get_first_component(calendar,ICAL_VJOURNAL_COMPONENT); | 1957 | c = icalcomponent_get_first_component(calendar,ICAL_VJOURNAL_COMPONENT); |
1957 | while (c) { | 1958 | while (c) { |
1958 | // kdDebug(5800) << "----Journal found" << endl; | 1959 | // kdDebug(5800) << "----Journal found" << endl; |
1959 | Journal *journal = readJournal(c); | 1960 | Journal *journal = readJournal(c); |
1960 | if (!cal->journal(journal->uid())) cal->addJournal(journal); | 1961 | if (!cal->journal(journal->uid())) cal->addJournal(journal); |
1961 | c = icalcomponent_get_next_component(calendar,ICAL_VJOURNAL_COMPONENT); | 1962 | c = icalcomponent_get_next_component(calendar,ICAL_VJOURNAL_COMPONENT); |
1962 | } | 1963 | } |
1963 | 1964 | ||
1964 | #if 0 | 1965 | #if 0 |
1965 | initPropIterator(&i, vcal); | 1966 | initPropIterator(&i, vcal); |
1966 | 1967 | ||
1967 | // go through all the vobjects in the vcal | 1968 | // go through all the vobjects in the vcal |
1968 | while (moreIteration(&i)) { | 1969 | while (moreIteration(&i)) { |
1969 | curVO = nextVObject(&i); | 1970 | curVO = nextVObject(&i); |
1970 | 1971 | ||
1971 | /************************************************************************/ | 1972 | /************************************************************************/ |
1972 | 1973 | ||
1973 | // now, check to see that the object is an event or todo. | 1974 | // now, check to see that the object is an event or todo. |
1974 | if (strcmp(vObjectName(curVO), VCEventProp) == 0) { | 1975 | if (strcmp(vObjectName(curVO), VCEventProp) == 0) { |
1975 | 1976 | ||
1976 | if ((curVOProp = isAPropertyOf(curVO, KPilotStatusProp)) != 0) { | 1977 | if ((curVOProp = isAPropertyOf(curVO, KPilotStatusProp)) != 0) { |
1977 | char *s; | 1978 | char *s; |
1978 | s = fakeCString(vObjectUStringZValue(curVOProp)); | 1979 | s = fakeCString(vObjectUStringZValue(curVOProp)); |
1979 | // check to see if event was deleted by the kpilot conduit | 1980 | // check to see if event was deleted by the kpilot conduit |
1980 | if (atoi(s) == Event::SYNCDEL) { | 1981 | if (atoi(s) == Event::SYNCDEL) { |
1981 | deleteStr(s); | 1982 | deleteStr(s); |
1982 | goto SKIP; | 1983 | goto SKIP; |
1983 | } | 1984 | } |
1984 | deleteStr(s); | 1985 | deleteStr(s); |
1985 | } | 1986 | } |
1986 | 1987 | ||
1987 | // this code checks to see if we are trying to read in an event | 1988 | // this code checks to see if we are trying to read in an event |
1988 | // that we already find to be in the calendar. If we find this | 1989 | // that we already find to be in the calendar. If we find this |
1989 | // to be the case, we skip the event. | 1990 | // to be the case, we skip the event. |
1990 | if ((curVOProp = isAPropertyOf(curVO, VCUniqueStringProp)) != 0) { | 1991 | if ((curVOProp = isAPropertyOf(curVO, VCUniqueStringProp)) != 0) { |
1991 | char *s = fakeCString(vObjectUStringZValue(curVOProp)); | 1992 | char *s = fakeCString(vObjectUStringZValue(curVOProp)); |
1992 | QString tmpStr(s); | 1993 | QString tmpStr(s); |
1993 | deleteStr(s); | 1994 | deleteStr(s); |
1994 | 1995 | ||
1995 | if (cal->event(tmpStr)) { | 1996 | if (cal->event(tmpStr)) { |
1996 | goto SKIP; | 1997 | goto SKIP; |
1997 | } | 1998 | } |
1998 | if (cal->todo(tmpStr)) { | 1999 | if (cal->todo(tmpStr)) { |
1999 | goto SKIP; | 2000 | goto SKIP; |
2000 | } | 2001 | } |
2001 | } | 2002 | } |
2002 | 2003 | ||
2003 | if ((!(curVOProp = isAPropertyOf(curVO, VCDTstartProp))) && | 2004 | if ((!(curVOProp = isAPropertyOf(curVO, VCDTstartProp))) && |
2004 | (!(curVOProp = isAPropertyOf(curVO, VCDTendProp)))) { | 2005 | (!(curVOProp = isAPropertyOf(curVO, VCDTendProp)))) { |
2005 | kdDebug(5800) << "found a VEvent with no DTSTART and no DTEND! Skipping..." << endl; | 2006 | kdDebug(5800) << "found a VEvent with no DTSTART and no DTEND! Skipping..." << endl; |
2006 | goto SKIP; | 2007 | goto SKIP; |
2007 | } | 2008 | } |
2008 | 2009 | ||
2009 | anEvent = VEventToEvent(curVO); | 2010 | anEvent = VEventToEvent(curVO); |
2010 | // we now use addEvent instead of insertEvent so that the | 2011 | // we now use addEvent instead of insertEvent so that the |
2011 | // signal/slot get connected. | 2012 | // signal/slot get connected. |
2012 | if (anEvent) | 2013 | if (anEvent) |
2013 | cal->addEvent(anEvent); | 2014 | cal->addEvent(anEvent); |
2014 | else { | 2015 | else { |
2015 | // some sort of error must have occurred while in translation. | 2016 | // some sort of error must have occurred while in translation. |
2016 | goto SKIP; | 2017 | goto SKIP; |
2017 | } | 2018 | } |
2018 | } else if (strcmp(vObjectName(curVO), VCTodoProp) == 0) { | 2019 | } else if (strcmp(vObjectName(curVO), VCTodoProp) == 0) { |
2019 | anEvent = VTodoToEvent(curVO); | 2020 | anEvent = VTodoToEvent(curVO); |
2020 | cal->addTodo(anEvent); | 2021 | cal->addTodo(anEvent); |
2021 | } else if ((strcmp(vObjectName(curVO), VCVersionProp) == 0) || | 2022 | } else if ((strcmp(vObjectName(curVO), VCVersionProp) == 0) || |
2022 | (strcmp(vObjectName(curVO), VCProdIdProp) == 0) || | 2023 | (strcmp(vObjectName(curVO), VCProdIdProp) == 0) || |
2023 | (strcmp(vObjectName(curVO), VCTimeZoneProp) == 0)) { | 2024 | (strcmp(vObjectName(curVO), VCTimeZoneProp) == 0)) { |
2024 | // do nothing, we know these properties and we want to skip them. | 2025 | // do nothing, we know these properties and we want to skip them. |
2025 | // we have either already processed them or are ignoring them. | 2026 | // we have either already processed them or are ignoring them. |
2026 | ; | 2027 | ; |
2027 | } else { | 2028 | } else { |
2028 | ; | 2029 | ; |
2029 | } | 2030 | } |
2030 | SKIP: | 2031 | SKIP: |
2031 | ; | 2032 | ; |
2032 | } // while | 2033 | } // while |
2033 | #endif | 2034 | #endif |
2034 | 2035 | ||
2035 | // Post-Process list of events with relations, put Event objects in relation | 2036 | // Post-Process list of events with relations, put Event objects in relation |
2036 | Event *ev; | 2037 | Event *ev; |
2037 | for ( ev=mEventsRelate.first(); ev != 0; ev=mEventsRelate.next() ) { | 2038 | for ( ev=mEventsRelate.first(); ev != 0; ev=mEventsRelate.next() ) { |
2038 | ev->setRelatedTo(cal->event(ev->relatedToUid())); | 2039 | ev->setRelatedTo(cal->event(ev->relatedToUid())); |
2039 | } | 2040 | } |
2040 | Todo *todo; | 2041 | Todo *todo; |
2041 | for ( todo=mTodosRelate.first(); todo != 0; todo=mTodosRelate.next() ) { | 2042 | for ( todo=mTodosRelate.first(); todo != 0; todo=mTodosRelate.next() ) { |
2042 | todo->setRelatedTo(cal->todo(todo->relatedToUid())); | 2043 | todo->setRelatedTo(cal->todo(todo->relatedToUid())); |
2043 | } | 2044 | } |
2044 | 2045 | ||
2045 | return true; | 2046 | return true; |
2046 | } | 2047 | } |
2047 | 2048 | ||
2048 | QString ICalFormatImpl::extractErrorProperty(icalcomponent *c) | 2049 | QString ICalFormatImpl::extractErrorProperty(icalcomponent *c) |
2049 | { | 2050 | { |
2050 | // kdDebug(5800) << "ICalFormatImpl:extractErrorProperty: " | 2051 | // kdDebug(5800) << "ICalFormatImpl:extractErrorProperty: " |
2051 | // << icalcomponent_as_ical_string(c) << endl; | 2052 | // << icalcomponent_as_ical_string(c) << endl; |
2052 | 2053 | ||
2053 | QString errorMessage; | 2054 | QString errorMessage; |
2054 | 2055 | ||
2055 | icalproperty *error; | 2056 | icalproperty *error; |
2056 | error = icalcomponent_get_first_property(c,ICAL_XLICERROR_PROPERTY); | 2057 | error = icalcomponent_get_first_property(c,ICAL_XLICERROR_PROPERTY); |
2057 | while(error) { | 2058 | while(error) { |
2058 | errorMessage += icalproperty_get_xlicerror(error); | 2059 | errorMessage += icalproperty_get_xlicerror(error); |
2059 | errorMessage += "\n"; | 2060 | errorMessage += "\n"; |
2060 | error = icalcomponent_get_next_property(c,ICAL_XLICERROR_PROPERTY); | 2061 | error = icalcomponent_get_next_property(c,ICAL_XLICERROR_PROPERTY); |
2061 | } | 2062 | } |
2062 | 2063 | ||
2063 | // kdDebug(5800) << "ICalFormatImpl:extractErrorProperty: " << errorMessage << endl; | 2064 | // kdDebug(5800) << "ICalFormatImpl:extractErrorProperty: " << errorMessage << endl; |
2064 | 2065 | ||
2065 | return errorMessage; | 2066 | return errorMessage; |
2066 | } | 2067 | } |
2067 | 2068 | ||
2068 | void ICalFormatImpl::dumpIcalRecurrence(icalrecurrencetype r) | 2069 | void ICalFormatImpl::dumpIcalRecurrence(icalrecurrencetype r) |
2069 | { | 2070 | { |
2070 | int i; | 2071 | int i; |
2071 | 2072 | ||
2072 | 2073 | ||
2073 | if (r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 2074 | if (r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
2074 | int index = 0; | 2075 | int index = 0; |
2075 | QString out = " By Day: "; | 2076 | QString out = " By Day: "; |
2076 | while((i = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 2077 | while((i = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
2077 | out.append(QString::number(i) + " "); | 2078 | out.append(QString::number(i) + " "); |
2078 | } | 2079 | } |
2079 | } | 2080 | } |
2080 | if (r.by_month_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 2081 | if (r.by_month_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
2081 | int index = 0; | 2082 | int index = 0; |
2082 | QString out = " By Month Day: "; | 2083 | QString out = " By Month Day: "; |
2083 | while((i = r.by_month_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 2084 | while((i = r.by_month_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
2084 | out.append(QString::number(i) + " "); | 2085 | out.append(QString::number(i) + " "); |
2085 | } | 2086 | } |
2086 | } | 2087 | } |
2087 | if (r.by_year_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 2088 | if (r.by_year_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
2088 | int index = 0; | 2089 | int index = 0; |
2089 | QString out = " By Year Day: "; | 2090 | QString out = " By Year Day: "; |
2090 | while((i = r.by_year_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 2091 | while((i = r.by_year_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
2091 | out.append(QString::number(i) + " "); | 2092 | out.append(QString::number(i) + " "); |
2092 | } | 2093 | } |
2093 | } | 2094 | } |
2094 | if (r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 2095 | if (r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
2095 | int index = 0; | 2096 | int index = 0; |
2096 | QString out = " By Month: "; | 2097 | QString out = " By Month: "; |
2097 | while((i = r.by_month[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 2098 | while((i = r.by_month[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
2098 | out.append(QString::number(i) + " "); | 2099 | out.append(QString::number(i) + " "); |
2099 | } | 2100 | } |
2100 | } | 2101 | } |
2101 | if (r.by_set_pos[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 2102 | if (r.by_set_pos[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
2102 | int index = 0; | 2103 | int index = 0; |
2103 | QString out = " By Set Pos: "; | 2104 | QString out = " By Set Pos: "; |
2104 | while((i = r.by_set_pos[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 2105 | while((i = r.by_set_pos[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
2105 | out.append(QString::number(i) + " "); | 2106 | out.append(QString::number(i) + " "); |
2106 | } | 2107 | } |
2107 | } | 2108 | } |
2108 | } | 2109 | } |
2109 | 2110 | ||
2110 | icalcomponent *ICalFormatImpl::createScheduleComponent(IncidenceBase *incidence, | 2111 | icalcomponent *ICalFormatImpl::createScheduleComponent(IncidenceBase *incidence, |
2111 | Scheduler::Method method) | 2112 | Scheduler::Method method) |
2112 | { | 2113 | { |
2113 | icalcomponent *message = createCalendarComponent(); | 2114 | icalcomponent *message = createCalendarComponent(); |
2114 | 2115 | ||
2115 | icalproperty_method icalmethod = ICAL_METHOD_NONE; | 2116 | icalproperty_method icalmethod = ICAL_METHOD_NONE; |
2116 | 2117 | ||
2117 | switch (method) { | 2118 | switch (method) { |
2118 | case Scheduler::Publish: | 2119 | case Scheduler::Publish: |
2119 | icalmethod = ICAL_METHOD_PUBLISH; | 2120 | icalmethod = ICAL_METHOD_PUBLISH; |
2120 | break; | 2121 | break; |
2121 | case Scheduler::Request: | 2122 | case Scheduler::Request: |
2122 | icalmethod = ICAL_METHOD_REQUEST; | 2123 | icalmethod = ICAL_METHOD_REQUEST; |
2123 | break; | 2124 | break; |
2124 | case Scheduler::Refresh: | 2125 | case Scheduler::Refresh: |
2125 | icalmethod = ICAL_METHOD_REFRESH; | 2126 | icalmethod = ICAL_METHOD_REFRESH; |
2126 | break; | 2127 | break; |
2127 | case Scheduler::Cancel: | 2128 | case Scheduler::Cancel: |
2128 | icalmethod = ICAL_METHOD_CANCEL; | 2129 | icalmethod = ICAL_METHOD_CANCEL; |
2129 | break; | 2130 | break; |
2130 | case Scheduler::Add: | 2131 | case Scheduler::Add: |
2131 | icalmethod = ICAL_METHOD_ADD; | 2132 | icalmethod = ICAL_METHOD_ADD; |
2132 | break; | 2133 | break; |
2133 | case Scheduler::Reply: | 2134 | case Scheduler::Reply: |
2134 | icalmethod = ICAL_METHOD_REPLY; | 2135 | icalmethod = ICAL_METHOD_REPLY; |
2135 | break; | 2136 | break; |
2136 | case Scheduler::Counter: | 2137 | case Scheduler::Counter: |
2137 | icalmethod = ICAL_METHOD_COUNTER; | 2138 | icalmethod = ICAL_METHOD_COUNTER; |
2138 | break; | 2139 | break; |
2139 | case Scheduler::Declinecounter: | 2140 | case Scheduler::Declinecounter: |
2140 | icalmethod = ICAL_METHOD_DECLINECOUNTER; | 2141 | icalmethod = ICAL_METHOD_DECLINECOUNTER; |
2141 | break; | 2142 | break; |
2142 | default: | 2143 | default: |
2143 | 2144 | ||
2144 | return message; | 2145 | return message; |
2145 | } | 2146 | } |
2146 | 2147 | ||
2147 | icalcomponent_add_property(message,icalproperty_new_method(icalmethod)); | 2148 | icalcomponent_add_property(message,icalproperty_new_method(icalmethod)); |
2148 | 2149 | ||
2149 | // TODO: check, if dynamic cast is required | 2150 | // TODO: check, if dynamic cast is required |
2150 | if(incidence->type() == "Todo") { | 2151 | if(incidence->type() == "Todo") { |
2151 | Todo *todo = static_cast<Todo *>(incidence); | 2152 | Todo *todo = static_cast<Todo *>(incidence); |
2152 | icalcomponent_add_component(message,writeTodo(todo)); | 2153 | icalcomponent_add_component(message,writeTodo(todo)); |
2153 | } | 2154 | } |
2154 | if(incidence->type() == "Event") { | 2155 | if(incidence->type() == "Event") { |
2155 | Event *event = static_cast<Event *>(incidence); | 2156 | Event *event = static_cast<Event *>(incidence); |
2156 | icalcomponent_add_component(message,writeEvent(event)); | 2157 | icalcomponent_add_component(message,writeEvent(event)); |
2157 | } | 2158 | } |
2158 | if(incidence->type() == "FreeBusy") { | 2159 | if(incidence->type() == "FreeBusy") { |
2159 | FreeBusy *freebusy = static_cast<FreeBusy *>(incidence); | 2160 | FreeBusy *freebusy = static_cast<FreeBusy *>(incidence); |
2160 | icalcomponent_add_component(message,writeFreeBusy(freebusy, method)); | 2161 | icalcomponent_add_component(message,writeFreeBusy(freebusy, method)); |
2161 | } | 2162 | } |
2162 | 2163 | ||
2163 | return message; | 2164 | return message; |
2164 | } | 2165 | } |
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index 51f2e9d..1e99082 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp | |||
@@ -1,420 +1,427 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <kglobal.h> | 21 | #include <kglobal.h> |
22 | #include <klocale.h> | 22 | #include <klocale.h> |
23 | #include <kdebug.h> | 23 | #include <kdebug.h> |
24 | #include <kidmanager.h> | 24 | #include <kidmanager.h> |
25 | 25 | ||
26 | #include "calformat.h" | 26 | #include "calformat.h" |
27 | #include "syncdefines.h" | 27 | #include "syncdefines.h" |
28 | 28 | ||
29 | #include "incidencebase.h" | 29 | #include "incidencebase.h" |
30 | 30 | ||
31 | using namespace KCal; | 31 | using namespace KCal; |
32 | 32 | ||
33 | IncidenceBase::IncidenceBase() : | 33 | IncidenceBase::IncidenceBase() : |
34 | mReadOnly(false), mFloats(true), mDuration(0), mHasDuration(false), | 34 | mReadOnly(false), mFloats(true), mDuration(0), mHasDuration(false), |
35 | mPilotId(0), mSyncStatus(SYNCMOD) | 35 | mPilotId(0), mSyncStatus(SYNCMOD) |
36 | { | 36 | { |
37 | setUid(CalFormat::createUniqueId()); | 37 | setUid(CalFormat::createUniqueId()); |
38 | mOrganizer = ""; | 38 | mOrganizer = ""; |
39 | mFloats = false; | 39 | mFloats = false; |
40 | mDuration = 0; | 40 | mDuration = 0; |
41 | mHasDuration = false; | 41 | mHasDuration = false; |
42 | mPilotId = 0; | 42 | mPilotId = 0; |
43 | mExternalId = ":"; | 43 | mExternalId = ":"; |
44 | mTempSyncStat = SYNC_TEMPSTATE_INITIAL; | 44 | mTempSyncStat = SYNC_TEMPSTATE_INITIAL; |
45 | mSyncStatus = 0; | 45 | mSyncStatus = 0; |
46 | mAttendees.setAutoDelete( true ); | 46 | mAttendees.setAutoDelete( true ); |
47 | } | 47 | } |
48 | 48 | ||
49 | IncidenceBase::IncidenceBase(const IncidenceBase &i) : | 49 | IncidenceBase::IncidenceBase(const IncidenceBase &i) : |
50 | CustomProperties( i ) | 50 | CustomProperties( i ) |
51 | { | 51 | { |
52 | mReadOnly = i.mReadOnly; | 52 | mReadOnly = i.mReadOnly; |
53 | mDtStart = i.mDtStart; | 53 | mDtStart = i.mDtStart; |
54 | mDuration = i.mDuration; | 54 | mDuration = i.mDuration; |
55 | mHasDuration = i.mHasDuration; | 55 | mHasDuration = i.mHasDuration; |
56 | mOrganizer = i.mOrganizer; | 56 | mOrganizer = i.mOrganizer; |
57 | mUid = i.mUid; | 57 | mUid = i.mUid; |
58 | QPtrList<Attendee> attendees = i.attendees(); | 58 | QPtrList<Attendee> attendees = i.attendees(); |
59 | for( Attendee *a = attendees.first(); a; a = attendees.next() ) { | 59 | for( Attendee *a = attendees.first(); a; a = attendees.next() ) { |
60 | mAttendees.append( new Attendee( *a ) ); | 60 | mAttendees.append( new Attendee( *a ) ); |
61 | } | 61 | } |
62 | mFloats = i.mFloats; | 62 | mFloats = i.mFloats; |
63 | mLastModified = i.mLastModified; | 63 | mLastModified = i.mLastModified; |
64 | mPilotId = i.mPilotId; | 64 | mPilotId = i.mPilotId; |
65 | mTempSyncStat = i.mTempSyncStat; | 65 | mTempSyncStat = i.mTempSyncStat; |
66 | mSyncStatus = i.mSyncStatus; | 66 | mSyncStatus = i.mSyncStatus; |
67 | mExternalId = i.mExternalId; | 67 | mExternalId = i.mExternalId; |
68 | // The copied object is a new one, so it isn't observed by the observer | 68 | // The copied object is a new one, so it isn't observed by the observer |
69 | // of the original object. | 69 | // of the original object. |
70 | mObservers.clear(); | 70 | mObservers.clear(); |
71 | 71 | ||
72 | mAttendees.setAutoDelete( true ); | 72 | mAttendees.setAutoDelete( true ); |
73 | } | 73 | } |
74 | 74 | ||
75 | IncidenceBase::~IncidenceBase() | 75 | IncidenceBase::~IncidenceBase() |
76 | { | 76 | { |
77 | } | 77 | } |
78 | 78 | ||
79 | 79 | ||
80 | bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 ) | 80 | bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 ) |
81 | { | 81 | { |
82 | // do not compare mSyncStatus and mExternalId | 82 | // do not compare mSyncStatus and mExternalId |
83 | if( i1.attendees().count() != i2.attendees().count() ) { | 83 | if( i1.attendees().count() != i2.attendees().count() ) { |
84 | return false; // no need to check further | 84 | return false; // no need to check further |
85 | } | 85 | } |
86 | if ( i1.attendees().count() > 0 ) { | 86 | if ( i1.attendees().count() > 0 ) { |
87 | Attendee * a1 = i1.attendees().first(), *a2 =i2.attendees().first() ; | 87 | Attendee * a1 = i1.attendees().first(), *a2 =i2.attendees().first() ; |
88 | while ( a1 ) { | 88 | while ( a1 ) { |
89 | if ( !( (*a1) == (*a2)) ) | 89 | if ( !( (*a1) == (*a2)) ) |
90 | { | 90 | { |
91 | //qDebug("Attendee not equal "); | 91 | //qDebug("Attendee not equal "); |
92 | return false; | 92 | return false; |
93 | } | 93 | } |
94 | a1 = i1.attendees().next(); | 94 | a1 = i1.attendees().next(); |
95 | a2 = i2.attendees().next(); | 95 | a2 = i2.attendees().next(); |
96 | } | 96 | } |
97 | } | 97 | } |
98 | //if ( i1.dtStart() != i2.dtStart() ) | 98 | //if ( i1.dtStart() != i2.dtStart() ) |
99 | // return false; | 99 | // return false; |
100 | #if 0 | 100 | #if 0 |
101 | qDebug("1 %d ",i1.doesFloat() == i2.doesFloat() ); | 101 | qDebug("1 %d ",i1.doesFloat() == i2.doesFloat() ); |
102 | qDebug("1 %d ",i1.duration() == i2.duration() ); | 102 | qDebug("1 %d ",i1.duration() == i2.duration() ); |
103 | qDebug("3 %d ",i1.hasDuration() == i2.hasDuration() ); | 103 | qDebug("3 %d ",i1.hasDuration() == i2.hasDuration() ); |
104 | qDebug("1 %d ",i1.pilotId() == i2.pilotId() ); | 104 | qDebug("1 %d ",i1.pilotId() == i2.pilotId() ); |
105 | qDebug("1 %d %d %d",i1.syncStatus() == i2.syncStatus() , i1.syncStatus(),i2.syncStatus() ); | 105 | qDebug("1 %d %d %d",i1.syncStatus() == i2.syncStatus() , i1.syncStatus(),i2.syncStatus() ); |
106 | qDebug("6 %d ",i1.organizer() == i2.organizer() ); | 106 | qDebug("6 %d ",i1.organizer() == i2.organizer() ); |
107 | 107 | ||
108 | #endif | 108 | #endif |
109 | if ( i1.hasDuration() == i2.hasDuration() ) { | ||
110 | if ( i1.hasDuration() ) { | ||
111 | if ( i1.duration() != i2.duration() ) | ||
112 | return false; | ||
113 | } | ||
114 | } else { | ||
115 | return false; | ||
116 | } | ||
117 | |||
109 | return ( i1.organizer() == i2.organizer() && | 118 | return ( i1.organizer() == i2.organizer() && |
110 | // i1.uid() == i2.uid() && | 119 | // i1.uid() == i2.uid() && |
111 | // Don't compare lastModified, otherwise the operator is not | 120 | // Don't compare lastModified, otherwise the operator is not |
112 | // of much use. We are not comparing for identity, after all. | 121 | // of much use. We are not comparing for identity, after all. |
113 | i1.doesFloat() == i2.doesFloat() && | 122 | i1.doesFloat() == i2.doesFloat() && |
114 | i1.duration() == i2.duration() && | ||
115 | i1.hasDuration() == i2.hasDuration() && | ||
116 | i1.pilotId() == i2.pilotId() );// && i1.syncStatus() == i2.syncStatus() ); | 123 | i1.pilotId() == i2.pilotId() );// && i1.syncStatus() == i2.syncStatus() ); |
117 | // no need to compare mObserver | 124 | // no need to compare mObserver |
118 | } | 125 | } |
119 | 126 | ||
120 | 127 | ||
121 | QDateTime IncidenceBase::getEvenTime( QDateTime dt ) | 128 | QDateTime IncidenceBase::getEvenTime( QDateTime dt ) |
122 | { | 129 | { |
123 | QTime t = dt.time(); | 130 | QTime t = dt.time(); |
124 | dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); | 131 | dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); |
125 | return dt; | 132 | return dt; |
126 | } | 133 | } |
127 | 134 | ||
128 | 135 | ||
129 | void IncidenceBase::setUid(const QString &uid) | 136 | void IncidenceBase::setUid(const QString &uid) |
130 | { | 137 | { |
131 | mUid = uid; | 138 | mUid = uid; |
132 | updated(); | 139 | updated(); |
133 | } | 140 | } |
134 | 141 | ||
135 | QString IncidenceBase::uid() const | 142 | QString IncidenceBase::uid() const |
136 | { | 143 | { |
137 | return mUid; | 144 | return mUid; |
138 | } | 145 | } |
139 | 146 | ||
140 | void IncidenceBase::setLastModified(const QDateTime &lm) | 147 | void IncidenceBase::setLastModified(const QDateTime &lm) |
141 | { | 148 | { |
142 | // DON'T! updated() because we call this from | 149 | // DON'T! updated() because we call this from |
143 | // Calendar::updateEvent(). | 150 | // Calendar::updateEvent(). |
144 | mLastModified = getEvenTime(lm); | 151 | mLastModified = getEvenTime(lm); |
145 | //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); | 152 | //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); |
146 | } | 153 | } |
147 | 154 | ||
148 | QDateTime IncidenceBase::lastModified() const | 155 | QDateTime IncidenceBase::lastModified() const |
149 | { | 156 | { |
150 | return mLastModified; | 157 | return mLastModified; |
151 | } | 158 | } |
152 | 159 | ||
153 | void IncidenceBase::setOrganizer(const QString &o) | 160 | void IncidenceBase::setOrganizer(const QString &o) |
154 | { | 161 | { |
155 | // we don't check for readonly here, because it is | 162 | // we don't check for readonly here, because it is |
156 | // possible that by setting the organizer we are changing | 163 | // possible that by setting the organizer we are changing |
157 | // the event's readonly status... | 164 | // the event's readonly status... |
158 | mOrganizer = o; | 165 | mOrganizer = o; |
159 | if (mOrganizer.left(7).upper() == "MAILTO:") | 166 | if (mOrganizer.left(7).upper() == "MAILTO:") |
160 | mOrganizer = mOrganizer.remove(0,7); | 167 | mOrganizer = mOrganizer.remove(0,7); |
161 | 168 | ||
162 | updated(); | 169 | updated(); |
163 | } | 170 | } |
164 | 171 | ||
165 | QString IncidenceBase::organizer() const | 172 | QString IncidenceBase::organizer() const |
166 | { | 173 | { |
167 | return mOrganizer; | 174 | return mOrganizer; |
168 | } | 175 | } |
169 | 176 | ||
170 | void IncidenceBase::setReadOnly( bool readOnly ) | 177 | void IncidenceBase::setReadOnly( bool readOnly ) |
171 | { | 178 | { |
172 | mReadOnly = readOnly; | 179 | mReadOnly = readOnly; |
173 | } | 180 | } |
174 | 181 | ||
175 | void IncidenceBase::setDtStart(const QDateTime &dtStart) | 182 | void IncidenceBase::setDtStart(const QDateTime &dtStart) |
176 | { | 183 | { |
177 | // if (mReadOnly) return; | 184 | // if (mReadOnly) return; |
178 | mDtStart = getEvenTime(dtStart); | 185 | mDtStart = getEvenTime(dtStart); |
179 | updated(); | 186 | updated(); |
180 | } | 187 | } |
181 | 188 | ||
182 | 189 | ||
183 | QDateTime IncidenceBase::dtStart() const | 190 | QDateTime IncidenceBase::dtStart() const |
184 | { | 191 | { |
185 | return mDtStart; | 192 | return mDtStart; |
186 | } | 193 | } |
187 | 194 | ||
188 | QString IncidenceBase::dtStartTimeStr() const | 195 | QString IncidenceBase::dtStartTimeStr() const |
189 | { | 196 | { |
190 | return KGlobal::locale()->formatTime(dtStart().time()); | 197 | return KGlobal::locale()->formatTime(dtStart().time()); |
191 | } | 198 | } |
192 | 199 | ||
193 | QString IncidenceBase::dtStartDateStr(bool shortfmt) const | 200 | QString IncidenceBase::dtStartDateStr(bool shortfmt) const |
194 | { | 201 | { |
195 | return KGlobal::locale()->formatDate(dtStart().date(),shortfmt); | 202 | return KGlobal::locale()->formatDate(dtStart().date(),shortfmt); |
196 | } | 203 | } |
197 | 204 | ||
198 | QString IncidenceBase::dtStartStr(bool shortfmt) const | 205 | QString IncidenceBase::dtStartStr(bool shortfmt) const |
199 | { | 206 | { |
200 | return KGlobal::locale()->formatDateTime(dtStart(), shortfmt); | 207 | return KGlobal::locale()->formatDateTime(dtStart(), shortfmt); |
201 | } | 208 | } |
202 | 209 | ||
203 | 210 | ||
204 | bool IncidenceBase::doesFloat() const | 211 | bool IncidenceBase::doesFloat() const |
205 | { | 212 | { |
206 | return mFloats; | 213 | return mFloats; |
207 | } | 214 | } |
208 | 215 | ||
209 | void IncidenceBase::setFloats(bool f) | 216 | void IncidenceBase::setFloats(bool f) |
210 | { | 217 | { |
211 | if (mReadOnly) return; | 218 | if (mReadOnly) return; |
212 | mFloats = f; | 219 | mFloats = f; |
213 | updated(); | 220 | updated(); |
214 | } | 221 | } |
215 | 222 | ||
216 | 223 | ||
217 | bool IncidenceBase::addAttendee(Attendee *a, bool doupdate) | 224 | bool IncidenceBase::addAttendee(Attendee *a, bool doupdate) |
218 | { | 225 | { |
219 | if (mReadOnly) return false; | 226 | if (mReadOnly) return false; |
220 | if (a->name().left(7).upper() == "MAILTO:") | 227 | if (a->name().left(7).upper() == "MAILTO:") |
221 | a->setName(a->name().remove(0,7)); | 228 | a->setName(a->name().remove(0,7)); |
222 | 229 | ||
223 | QPtrListIterator<Attendee> qli(mAttendees); | 230 | QPtrListIterator<Attendee> qli(mAttendees); |
224 | 231 | ||
225 | qli.toFirst(); | 232 | qli.toFirst(); |
226 | while (qli) { | 233 | while (qli) { |
227 | if (*qli.current() == *a) | 234 | if (*qli.current() == *a) |
228 | return false; | 235 | return false; |
229 | ++qli; | 236 | ++qli; |
230 | } | 237 | } |
231 | mAttendees.append(a); | 238 | mAttendees.append(a); |
232 | if (doupdate) updated(); | 239 | if (doupdate) updated(); |
233 | return true; | 240 | return true; |
234 | } | 241 | } |
235 | 242 | ||
236 | #if 0 | 243 | #if 0 |
237 | void IncidenceBase::removeAttendee(Attendee *a) | 244 | void IncidenceBase::removeAttendee(Attendee *a) |
238 | { | 245 | { |
239 | if (mReadOnly) return; | 246 | if (mReadOnly) return; |
240 | mAttendees.removeRef(a); | 247 | mAttendees.removeRef(a); |
241 | updated(); | 248 | updated(); |
242 | } | 249 | } |
243 | 250 | ||
244 | void IncidenceBase::removeAttendee(const char *n) | 251 | void IncidenceBase::removeAttendee(const char *n) |
245 | { | 252 | { |
246 | Attendee *a; | 253 | Attendee *a; |
247 | 254 | ||
248 | if (mReadOnly) return; | 255 | if (mReadOnly) return; |
249 | for (a = mAttendees.first(); a; a = mAttendees.next()) | 256 | for (a = mAttendees.first(); a; a = mAttendees.next()) |
250 | if (a->getName() == n) { | 257 | if (a->getName() == n) { |
251 | mAttendees.remove(); | 258 | mAttendees.remove(); |
252 | break; | 259 | break; |
253 | } | 260 | } |
254 | } | 261 | } |
255 | #endif | 262 | #endif |
256 | 263 | ||
257 | void IncidenceBase::clearAttendees() | 264 | void IncidenceBase::clearAttendees() |
258 | { | 265 | { |
259 | if (mReadOnly) return; | 266 | if (mReadOnly) return; |
260 | mAttendees.clear(); | 267 | mAttendees.clear(); |
261 | } | 268 | } |
262 | 269 | ||
263 | #if 0 | 270 | #if 0 |
264 | Attendee *IncidenceBase::getAttendee(const char *n) const | 271 | Attendee *IncidenceBase::getAttendee(const char *n) const |
265 | { | 272 | { |
266 | QPtrListIterator<Attendee> qli(mAttendees); | 273 | QPtrListIterator<Attendee> qli(mAttendees); |
267 | 274 | ||
268 | qli.toFirst(); | 275 | qli.toFirst(); |
269 | while (qli) { | 276 | while (qli) { |
270 | if (qli.current()->getName() == n) | 277 | if (qli.current()->getName() == n) |
271 | return qli.current(); | 278 | return qli.current(); |
272 | ++qli; | 279 | ++qli; |
273 | } | 280 | } |
274 | return 0L; | 281 | return 0L; |
275 | } | 282 | } |
276 | #endif | 283 | #endif |
277 | 284 | ||
278 | Attendee *IncidenceBase::attendeeByMail(const QString &email) | 285 | Attendee *IncidenceBase::attendeeByMail(const QString &email) |
279 | { | 286 | { |
280 | QPtrListIterator<Attendee> qli(mAttendees); | 287 | QPtrListIterator<Attendee> qli(mAttendees); |
281 | 288 | ||
282 | qli.toFirst(); | 289 | qli.toFirst(); |
283 | while (qli) { | 290 | while (qli) { |
284 | if (qli.current()->email().lower() == email.lower()) | 291 | if (qli.current()->email().lower() == email.lower()) |
285 | return qli.current(); | 292 | return qli.current(); |
286 | ++qli; | 293 | ++qli; |
287 | } | 294 | } |
288 | return 0L; | 295 | return 0L; |
289 | } | 296 | } |
290 | 297 | ||
291 | Attendee *IncidenceBase::attendeeByMails(const QStringList &emails, const QString& email) | 298 | Attendee *IncidenceBase::attendeeByMails(const QStringList &emails, const QString& email) |
292 | { | 299 | { |
293 | QPtrListIterator<Attendee> qli(mAttendees); | 300 | QPtrListIterator<Attendee> qli(mAttendees); |
294 | 301 | ||
295 | QStringList mails = emails; | 302 | QStringList mails = emails; |
296 | if (!email.isEmpty()) { | 303 | if (!email.isEmpty()) { |
297 | mails.append(email); | 304 | mails.append(email); |
298 | } | 305 | } |
299 | qli.toFirst(); | 306 | qli.toFirst(); |
300 | while (qli) { | 307 | while (qli) { |
301 | for ( QStringList::Iterator it = mails.begin(); it != mails.end(); ++it ) { | 308 | for ( QStringList::Iterator it = mails.begin(); it != mails.end(); ++it ) { |
302 | if (qli.current()->email().lower() == (*it).lower()) | 309 | if (qli.current()->email().lower() == (*it).lower()) |
303 | return qli.current(); | 310 | return qli.current(); |
304 | } | 311 | } |
305 | 312 | ||
306 | ++qli; | 313 | ++qli; |
307 | } | 314 | } |
308 | return 0L; | 315 | return 0L; |
309 | } | 316 | } |
310 | 317 | ||
311 | void IncidenceBase::setDuration(int seconds) | 318 | void IncidenceBase::setDuration(int seconds) |
312 | { | 319 | { |
313 | mDuration = seconds; | 320 | mDuration = seconds; |
314 | setHasDuration(true); | 321 | setHasDuration(true); |
315 | } | 322 | } |
316 | 323 | ||
317 | int IncidenceBase::duration() const | 324 | int IncidenceBase::duration() const |
318 | { | 325 | { |
319 | return mDuration; | 326 | return mDuration; |
320 | } | 327 | } |
321 | 328 | ||
322 | void IncidenceBase::setHasDuration(bool b) | 329 | void IncidenceBase::setHasDuration(bool b) |
323 | { | 330 | { |
324 | mHasDuration = b; | 331 | mHasDuration = b; |
325 | } | 332 | } |
326 | 333 | ||
327 | bool IncidenceBase::hasDuration() const | 334 | bool IncidenceBase::hasDuration() const |
328 | { | 335 | { |
329 | return mHasDuration; | 336 | return mHasDuration; |
330 | } | 337 | } |
331 | 338 | ||
332 | void IncidenceBase::setSyncStatus(int stat) | 339 | void IncidenceBase::setSyncStatus(int stat) |
333 | { | 340 | { |
334 | if (mReadOnly) return; | 341 | if (mReadOnly) return; |
335 | mSyncStatus = stat; | 342 | mSyncStatus = stat; |
336 | } | 343 | } |
337 | 344 | ||
338 | int IncidenceBase::syncStatus() const | 345 | int IncidenceBase::syncStatus() const |
339 | { | 346 | { |
340 | return mSyncStatus; | 347 | return mSyncStatus; |
341 | } | 348 | } |
342 | 349 | ||
343 | void IncidenceBase::setPilotId( int id ) | 350 | void IncidenceBase::setPilotId( int id ) |
344 | { | 351 | { |
345 | if (mReadOnly) return; | 352 | if (mReadOnly) return; |
346 | mPilotId = id; | 353 | mPilotId = id; |
347 | } | 354 | } |
348 | 355 | ||
349 | int IncidenceBase::pilotId() const | 356 | int IncidenceBase::pilotId() const |
350 | { | 357 | { |
351 | return mPilotId; | 358 | return mPilotId; |
352 | } | 359 | } |
353 | 360 | ||
354 | int IncidenceBase::tempSyncStat() const | 361 | int IncidenceBase::tempSyncStat() const |
355 | { | 362 | { |
356 | return mTempSyncStat; | 363 | return mTempSyncStat; |
357 | } | 364 | } |
358 | void IncidenceBase::setTempSyncStat( int id ) | 365 | void IncidenceBase::setTempSyncStat( int id ) |
359 | { | 366 | { |
360 | if (mReadOnly) return; | 367 | if (mReadOnly) return; |
361 | mTempSyncStat = id; | 368 | mTempSyncStat = id; |
362 | } | 369 | } |
363 | 370 | ||
364 | void IncidenceBase::removeID(const QString &prof) | 371 | void IncidenceBase::removeID(const QString &prof) |
365 | { | 372 | { |
366 | if ( prof.isEmpty() ) | 373 | if ( prof.isEmpty() ) |
367 | mExternalId = ":"; | 374 | mExternalId = ":"; |
368 | else | 375 | else |
369 | mExternalId = KIdManager::removeId ( mExternalId, prof); | 376 | mExternalId = KIdManager::removeId ( mExternalId, prof); |
370 | 377 | ||
371 | } | 378 | } |
372 | void IncidenceBase::setID( const QString & prof , const QString & id ) | 379 | void IncidenceBase::setID( const QString & prof , const QString & id ) |
373 | { | 380 | { |
374 | mExternalId = KIdManager::setId ( mExternalId, prof, id ); | 381 | mExternalId = KIdManager::setId ( mExternalId, prof, id ); |
375 | } | 382 | } |
376 | QString IncidenceBase::getID( const QString & prof) | 383 | QString IncidenceBase::getID( const QString & prof) |
377 | { | 384 | { |
378 | return KIdManager::getId ( mExternalId, prof ); | 385 | return KIdManager::getId ( mExternalId, prof ); |
379 | } | 386 | } |
380 | 387 | ||
381 | // example :Sharp_DTM;22;23566:TP;-1;8654:TPP;18;0: | 388 | // example :Sharp_DTM;22;23566:TP;-1;8654:TPP;18;0: |
382 | // format name;III;JJJ: III >= 0, may be -1. JJJ always >= 0 | 389 | // format name;III;JJJ: III >= 0, may be -1. JJJ always >= 0 |
383 | void IncidenceBase::setCsum( const QString & prof , const QString & id ) | 390 | void IncidenceBase::setCsum( const QString & prof , const QString & id ) |
384 | { | 391 | { |
385 | mExternalId = KIdManager::setCsum ( mExternalId, prof, id ); | 392 | mExternalId = KIdManager::setCsum ( mExternalId, prof, id ); |
386 | } | 393 | } |
387 | QString IncidenceBase::getCsum( const QString & prof) | 394 | QString IncidenceBase::getCsum( const QString & prof) |
388 | { | 395 | { |
389 | return KIdManager::getCsum ( mExternalId, prof ); | 396 | return KIdManager::getCsum ( mExternalId, prof ); |
390 | } | 397 | } |
391 | 398 | ||
392 | void IncidenceBase::setIDStr( const QString & s ) | 399 | void IncidenceBase::setIDStr( const QString & s ) |
393 | { | 400 | { |
394 | if (mReadOnly) return; | 401 | if (mReadOnly) return; |
395 | mExternalId = s; | 402 | mExternalId = s; |
396 | } | 403 | } |
397 | 404 | ||
398 | QString IncidenceBase::IDStr() const | 405 | QString IncidenceBase::IDStr() const |
399 | { | 406 | { |
400 | return mExternalId ; | 407 | return mExternalId ; |
401 | } | 408 | } |
402 | void IncidenceBase::registerObserver( IncidenceBase::Observer *observer ) | 409 | void IncidenceBase::registerObserver( IncidenceBase::Observer *observer ) |
403 | { | 410 | { |
404 | if( !mObservers.contains(observer) ) mObservers.append( observer ); | 411 | if( !mObservers.contains(observer) ) mObservers.append( observer ); |
405 | } | 412 | } |
406 | 413 | ||
407 | void IncidenceBase::unRegisterObserver( IncidenceBase::Observer *observer ) | 414 | void IncidenceBase::unRegisterObserver( IncidenceBase::Observer *observer ) |
408 | { | 415 | { |
409 | mObservers.remove( observer ); | 416 | mObservers.remove( observer ); |
410 | } | 417 | } |
411 | 418 | ||
412 | void IncidenceBase::updated() | 419 | void IncidenceBase::updated() |
413 | { | 420 | { |
414 | QPtrListIterator<Observer> it(mObservers); | 421 | QPtrListIterator<Observer> it(mObservers); |
415 | while( it.current() ) { | 422 | while( it.current() ) { |
416 | Observer *o = it.current(); | 423 | Observer *o = it.current(); |
417 | ++it; | 424 | ++it; |
418 | o->incidenceUpdated( this ); | 425 | o->incidenceUpdated( this ); |
419 | } | 426 | } |
420 | } | 427 | } |