summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt5
-rw-r--r--korganizer/calendarview.cpp18
-rw-r--r--korganizer/calendarview.h2
-rw-r--r--korganizer/mainwindow.cpp19
-rw-r--r--korganizer/mainwindow.h1
5 files changed, 40 insertions, 5 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index ac70a55..3dbbbb6 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,872 +1,875 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 2.0.2 ************ 3********** VERSION 2.0.2 ************
4 4
5KO/Pi: 5KO/Pi:
6Fixed the layout problem of the day label buttons 6Fixed the layout problem of the day label buttons
7of the agenda view introduced in version 2.0.1. 7of the agenda view introduced in version 2.0.1.
8 8
9Added WhatsThis support for the todo view and the list view. 9Added WhatsThis support for the todo view and the list view.
10 10
11Added a quite useful feature to the montview. 11Added a quite useful feature to the montview.
12Just click on the week numbers on the left. 12Just click on the week numbers on the left.
13And on top of the week numbers there is now a "week view quick selector". 13And in the top right corner of month view/agenda view
14there is now a "week number quick selector".
14(Click on the black triangle). 15(Click on the black triangle).
15 16
17Made the quite difficult timezone change in KO/Pi easy.
18
16 19
17********** VERSION 2.0.1 ************ 20********** VERSION 2.0.1 ************
18 21
19Oooops ... I forgot to test on the Zaurus 5500 ... 22Oooops ... I forgot to test on the Zaurus 5500 ...
20 23
21Fixed many problems of new (english) strings (and german translations) 24Fixed many problems of new (english) strings (and german translations)
22introduced in the latest versions, where the text was not fitting on the 25introduced in the latest versions, where the text was not fitting on the
23240x320 display of the Zaurus 5500. 26240x320 display of the Zaurus 5500.
24 27
25KO/Pi: 28KO/Pi:
26Added a popup menu ( press pen and hold to get popup ) to the agenda view 29Added a popup menu ( press pen and hold to get popup ) to the agenda view
27with many useful items (add event/todo, show next week, two weeks, month, journal). 30with many useful items (add event/todo, show next week, two weeks, month, journal).
28 31
29Added items to the todolist popup menu for: 32Added items to the todolist popup menu for:
30Display all opened, all closed or all todos flat. 33Display all opened, all closed or all todos flat.
31The "flat" view makes is possible to sort all todos after ,e.g., prio or date. 34The "flat" view makes is possible to sort all todos after ,e.g., prio or date.
32Made the reparenting of todos on the desktop possible via Drag&Drop. 35Made the reparenting of todos on the desktop possible via Drag&Drop.
33Fixed several bugs in setting the completed datetime for todos. 36Fixed several bugs in setting the completed datetime for todos.
34Added info about completed datetime of todos to the todo viewer. 37Added info about completed datetime of todos to the todo viewer.
35Now displaying a completed todo (with completed datetime set) in the agenda view 38Now displaying a completed todo (with completed datetime set) in the agenda view
36at the time of the completion. Such that now it is possible to see in the agenda view 39at the time of the completion. Such that now it is possible to see in the agenda view
37when what todo was completed. 40when what todo was completed.
38Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. 41Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos.
39Now the behaviour is: 42Now the behaviour is:
40Setting a parent to complete sets all (sub)childs to complete. 43Setting a parent to complete sets all (sub)childs to complete.
41Setting a parent to uncomplete does not change the childs. 44Setting a parent to uncomplete does not change the childs.
42Setting a child to uncomplete sets all parent to uncomplete. 45Setting a child to uncomplete sets all parent to uncomplete.
43Setting a child to complete does not change the parents. 46Setting a child to complete does not change the parents.
44 47
45Smart updating and double buffering of the daymatrix. 48Smart updating and double buffering of the daymatrix.
46Showing holidays in the day matrix. 49Showing holidays in the day matrix.
47Many other small performance updates. 50Many other small performance updates.
48 51
49Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode. 52Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode.
50 53
51Now the translation file usertranslation.txt is supposed to be in utf8 format. 54Now the translation file usertranslation.txt is supposed to be in utf8 format.
52If 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. 55If 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.
53 56
54 57
55********** VERSION 2.0.0 ************ 58********** VERSION 2.0.0 ************
56 59
57Stable release 2.0.0! 60Stable release 2.0.0!
58 61
59KO/Pi: 62KO/Pi:
60Fixed problem in edit dialog recreation at startup. 63Fixed problem in edit dialog recreation at startup.
61Made "toggle view*" menu items enabled context sensitive. 64Made "toggle view*" menu items enabled context sensitive.
62Changed agenda size menu to items 1-10. 65Changed agenda size menu to items 1-10.
63Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down. 66Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down.
64Usebility enhancements in the KO/Pi menus. 67Usebility enhancements in the KO/Pi menus.
65Birthday import now adds year to summary. 68Birthday import now adds year to summary.
66What's Next view shows age in years for birthday. 69What's Next view shows age in years for birthday.
67 70
68OM/Pi: 71OM/Pi:
69Added three info lines to display subject, from and to of selected mails. 72Added three info lines to display subject, from and to of selected mails.
70 73
71KA/Pi: 74KA/Pi:
72Fixed jump bar behaviour on Zaurus. 75Fixed jump bar behaviour on Zaurus.
73Now KA/Pi search field supports searching for a range of starting characters. 76Now KA/Pi search field supports searching for a range of starting characters.
74E.g. to search for all contact beginning with b to n, type 77E.g. to search for all contact beginning with b to n, type
75b-n 78b-n
76in the search field. 79in the search field.
77 80
78********** VERSION 1.9.20 ************ 81********** VERSION 1.9.20 ************
79 82
80KO/Pi: 83KO/Pi:
81Added for the "dislplay one day" agenda mode 84Added for the "dislplay one day" agenda mode
82info in the caption and in the day lables: 85info in the caption and in the day lables:
83Now it is displayed, if the selected day is from "day before yesterday" 86Now it is displayed, if the selected day is from "day before yesterday"
84to "day after tomorrow". 87to "day after tomorrow".
85Made it possible to delete a Todo, which has sub-todos. 88Made it possible to delete a Todo, which has sub-todos.
86Fixed two small problems in the todo view. 89Fixed two small problems in the todo view.
87Added missing German translation for filter edit and print dialog. 90Added missing German translation for filter edit and print dialog.
88Made search dialog closeable by cancel key. 91Made search dialog closeable by cancel key.
89 92
90Made it possible to select in the date picker the (ligt grey ) 93Made it possible to select in the date picker the (ligt grey )
91dates of the prev./next month with the mouse. 94dates of the prev./next month with the mouse.
92 95
93OM/Pi: 96OM/Pi:
94"Delete mail" icon in main window now deletes all selected mails. 97"Delete mail" icon in main window now deletes all selected mails.
95Fixed the problem, that the state flag of imap mails was ignored. 98Fixed the problem, that the state flag of imap mails was ignored.
96Now mails with "FLAG_SEEN" on the imap server get no icon in the list view 99Now mails with "FLAG_SEEN" on the imap server get no icon in the list view
97to indecate that they are already seen. 100to indecate that they are already seen.
98Fixed the problem that the body of some mails was not displayed in the 101Fixed the problem that the body of some mails was not displayed in the
99mail viewer when fetching them from the imap server directly to read them. 102mail viewer when fetching them from the imap server directly to read them.
100Made it (configurable) possible to show the "To:" field in the list view. 103Made it (configurable) possible to show the "To:" field in the list view.
101Added to the mail viewer the option "View Source" to make it possible to see the raw mail data. 104Added to the mail viewer the option "View Source" to make it possible to see the raw mail data.
102Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the 105Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the
103local storage folder (specified in account settings) of the account of the mail. 106local storage folder (specified in account settings) of the account of the mail.
104Removed some memory leaks in OM/Pi. 107Removed some memory leaks in OM/Pi.
105 108
106 109
107********** VERSION 1.9.19 ************ 110********** VERSION 1.9.19 ************
108 111
109Added a lot of missing translations to KA/Pi, 112Added a lot of missing translations to KA/Pi,
110Added some missing translations to KO/Pi and OM/Pi. 113Added some missing translations to KO/Pi and OM/Pi.
111 114
112Fixed some minor problems in KA/Pi + KO/Pi. 115Fixed some minor problems in KA/Pi + KO/Pi.
113 116
114Fixed a crash when closing PwM/Pi. 117Fixed a crash when closing PwM/Pi.
115Added German translation for PwM/Pi. 118Added German translation for PwM/Pi.
116 119
117Made view change and Month View update faster in KO/Pi. 120Made view change and Month View update faster in KO/Pi.
118 121
119 122
120********** VERSION 1.9.18 ************ 123********** VERSION 1.9.18 ************
121 124
122FYI: The VERSION 1.9.17 was a testing release only. 125FYI: The VERSION 1.9.17 was a testing release only.
123Please read the changelog of VERSION 1.9.17 as well. 126Please read the changelog of VERSION 1.9.17 as well.
124 127
125Cleaned up the syncing config dialog. 128Cleaned up the syncing config dialog.
126Added sync config options for date range for events. 129Added sync config options for date range for events.
127Added sync config options for filters on incoming data. 130Added sync config options for filters on incoming data.
128Added sync config options for filters on outgoing data. 131Added sync config options for filters on outgoing data.
129Please read the updated SyncHowTo about the new filter settings. 132Please read the updated SyncHowTo about the new filter settings.
130These filter settings make it now possible to sync with shared 133These filter settings make it now possible to sync with shared
131calendars without writing back private or confidential data 134calendars without writing back private or confidential data
132(via the outgoing filters). 135(via the outgoing filters).
133To sync only with particular parts of a shared calendar, 136To sync only with particular parts of a shared calendar,
134the incoming filter settings can be used. 137the incoming filter settings can be used.
135An example can be found in the SyncHowTo. 138An example can be found in the SyncHowTo.
136Same for shared addressbooks. 139Same for shared addressbooks.
137 140
138Added a setting for the global kdepim data storage. 141Added a setting for the global kdepim data storage.
139Usually the data is stored in (yourhomedir/kdepim). 142Usually the data is stored in (yourhomedir/kdepim).
140Now you can set in the Global config dialog TAB, subTAB "Data storage path" 143Now you can set in the Global config dialog TAB, subTAB "Data storage path"
141a directory where all the kdepim data is stored. 144a directory where all the kdepim data is stored.
142That makes it easy to save all kdepim data on a SD card on the Z, for example. 145That makes it easy to save all kdepim data on a SD card on the Z, for example.
143 146
144KO/Pi: 147KO/Pi:
145The timeedit input has a pulldown list for times. 148The timeedit input has a pulldown list for times.
146If opened, this pulldown list should now has the right time highlighted. 149If opened, this pulldown list should now has the right time highlighted.
147Added the possibility to exclude events/todos/journals in a filter. 150Added the possibility to exclude events/todos/journals in a filter.
148You should exclude journals, if you do not want them to sync with a public calendar. 151You should exclude journals, if you do not want them to sync with a public calendar.
149 152
150KA/Pi: 153KA/Pi:
151Added the possibility to in/exclude public/private/confidential contacts to a filter. 154Added the possibility to in/exclude public/private/confidential contacts to a filter.
152If 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 ... 155If 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 ...
153Added printing of card view and details view on desktop. 156Added printing of card view and details view on desktop.
154Printing of list view is not working... 157Printing of list view is not working...
155Added button for removing pictures in contact editor. 158Added button for removing pictures in contact editor.
156Parsing data fix of KA/Pi version 1.9.17. 159Parsing data fix of KA/Pi version 1.9.17.
157Fixed the "parse name automatically" problem of KA/Pi version 1.9.17. 160Fixed the "parse name automatically" problem of KA/Pi version 1.9.17.
158Fixed some syncing merging problems. 161Fixed some syncing merging problems.
159 162
160 163
161********** VERSION 1.9.17 ************ 164********** VERSION 1.9.17 ************
162 165
163KO/Pi: 166KO/Pi:
164Fixed that tooltips were not updated after moving an item in agenda view. 167Fixed that tooltips were not updated after moving an item in agenda view.
165Fixed a bug in sorting start date for recurring events in list view. 168Fixed a bug in sorting start date for recurring events in list view.
166Changed the left button in todo viewer from "Agenda" to "Set completed". 169Changed the left button in todo viewer from "Agenda" to "Set completed".
167This 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. 170This 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.
168Added more info in the todo viewer: Startdate, parent/sub todos. 171Added more info in the todo viewer: Startdate, parent/sub todos.
169 172
170 173
171KA/Pi: 174KA/Pi:
172All fields search does now actually search all the (possible) fields, 175All fields search does now actually search all the (possible) fields,
173not only those listed in the contact list. 176not only those listed in the contact list.
174Made is possible to inline a picture in a vcard on the Z. 177Made is possible to inline a picture in a vcard on the Z.
175This was only possible on the desktop, now is it possible on the Z as well. 178This was only possible on the desktop, now is it possible on the Z as well.
176Fixed of missing save settings after filter configuration. 179Fixed of missing save settings after filter configuration.
177Made saving of addressbook much faster. 180Made saving of addressbook much faster.
178Fixed extension widget layout problem. 181Fixed extension widget layout problem.
179Fixed saving of default formatted name settings. 182Fixed saving of default formatted name settings.
180Fixed formatted name handling in edit dialog. 183Fixed formatted name handling in edit dialog.
181Added an option for changing formatted names of many contacts 184Added an option for changing formatted names of many contacts
182(menu: File - Change - Set formatted name). 185(menu: File - Change - Set formatted name).
183 186
184QWhatsThis was not working on the Z ( only black rectangle was shown). 187QWhatsThis was not working on the Z ( only black rectangle was shown).
185This is Fixed. 188This is Fixed.
186 189
187KDE-Sync: 190KDE-Sync:
188Now readonly KDE resources are synced as well. 191Now readonly KDE resources are synced as well.
189(They are not changed in KDE itself, of course). 192(They are not changed in KDE itself, of course).
190 193
191 194
192 195
193********** VERSION 1.9.16 ************ 196********** VERSION 1.9.16 ************
194 197
195KO/Pi: 198KO/Pi:
196Fixed search dialog size on Z 6000 (480x640 display). 199Fixed search dialog size on Z 6000 (480x640 display).
197Added setting to hide/show time in agenda items. 200Added setting to hide/show time in agenda items.
198Added setting to hide not running todos in todo view. 201Added setting to hide not running todos in todo view.
199Added columns for start date/time in todo view. 202Added columns for start date/time in todo view.
200Replaced the solid half-hour lines in agenda view by dot lines. 203Replaced the solid half-hour lines in agenda view by dot lines.
201Added possibility of printing the What's Next View on the desktop 204Added possibility of printing the What's Next View on the desktop
202(i.e. Windows and Linux). 205(i.e. Windows and Linux).
203Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. 206Fixed a crash in KO/Pi when starting KO/Pi with What's Next view.
204Added tooltips in month view.(Tooltips only available on desktop) 207Added tooltips in month view.(Tooltips only available on desktop)
205 208
206Fixed a strange problem in KO/Pi alarm applet. 209Fixed a strange problem in KO/Pi alarm applet.
207Did not find the actual problem, 210Did not find the actual problem,
208such that now Qtopia reboots again if deinstalling the alarm applet. 211such that now Qtopia reboots again if deinstalling the alarm applet.
209But the alarm applet should work again. 212But the alarm applet should work again.
210 213
211KA/Pi: 214KA/Pi:
212Fixed the problem, that internal pictures were not saved. 215Fixed the problem, that internal pictures were not saved.
213 216
214Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. 217Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes.
215 218
216Fixed some minor problems. (Like word wrap in help text windows). 219Fixed some minor problems. (Like word wrap in help text windows).
217 220
218Fixed a compiling problem in microkde/kresources. 221Fixed a compiling problem in microkde/kresources.
219 222
220KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. 223KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM.
221This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) 224This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9)
222such that now syncing KO/Pi with Sharp DTM should work on the 225such that now syncing KO/Pi with Sharp DTM should work on the
223Zaurus C 3000 model. 226Zaurus C 3000 model.
224 227
225********** VERSION 1.9.15 ************ 228********** VERSION 1.9.15 ************
226 229
227Usebilty enhancements in KO/Pi: 230Usebilty enhancements in KO/Pi:
228When clicking on the date in a month view cell, the day view is shown. 231When clicking on the date in a month view cell, the day view is shown.
229Old behaviour was, that the "new event" dialog popped up. 232Old behaviour was, that the "new event" dialog popped up.
230 233
231Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). 234Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu).
232That means, you can restore the latest 235That means, you can restore the latest
233event/todo/journal you have deleted. 236event/todo/journal you have deleted.
234A journal is deleted, if you clear all the text of the journal. 237A journal is deleted, if you clear all the text of the journal.
235 238
236Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. 239Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14.
237 240
238KA/Pi starting in 480x640 resolution: 241KA/Pi starting in 480x640 resolution:
239Hide the filter action in toolbar 242Hide the filter action in toolbar
240and added icons for undo/delete/redo in toolbar. 243and added icons for undo/delete/redo in toolbar.
241 244
242Change in OM/Pi ViewMail dialog: 245Change in OM/Pi ViewMail dialog:
243When clicking on the "delete" icon the mail is deleted after confirmation as usual. 246When clicking on the "delete" icon the mail is deleted after confirmation as usual.
244But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). 247But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any).
245 248
246Fixed a crash when deleting mail-accounts in OM/Pi. 249Fixed a crash when deleting mail-accounts in OM/Pi.
247 250
248 251
249********** VERSION 1.9.14 ************ 252********** VERSION 1.9.14 ************
250 253
251Fixed some problems with the dialog sizes when switching 254Fixed some problems with the dialog sizes when switching
252portrait/landscape mode on 640x480 PDA display. 255portrait/landscape mode on 640x480 PDA display.
253 256
254Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. 257Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi.
255 258
256Fixed an ugly bug in KOpieMail: 259Fixed an ugly bug in KOpieMail:
257KOpieMail was not able to write files (mails) to MSDOS file system, 260KOpieMail was not able to write files (mails) to MSDOS file system,
258like on an usual preformatted SD card. That should work now. 261like on an usual preformatted SD card. That should work now.
259To save your mail data on the Sd card do the following: 262To save your mail data on the Sd card do the following:
260Create a dir on the SD card: 263Create a dir on the SD card:
261mkdir /mnt/card/localmail 264mkdir /mnt/card/localmail
262Go to your home dir: 265Go to your home dir:
263cd 266cd
264Go to kopiemail data storage dir: 267Go to kopiemail data storage dir:
265cd kdepim/apps/kopiemail 268cd kdepim/apps/kopiemail
266Create a symlink to the SD card: 269Create a symlink to the SD card:
267ls -s /mnt/card/localmail 270ls -s /mnt/card/localmail
268Now KOpieMail will store all mails on the SD card. 271Now KOpieMail will store all mails on the SD card.
269 272
270KO/Pi Monthview: 273KO/Pi Monthview:
271Now "Go to Today" selects the current month from day 1-end, 274Now "Go to Today" selects the current month from day 1-end,
272not the current date + some days. 275not the current date + some days.
273I.e. "Go to Today" shows now always 276I.e. "Go to Today" shows now always
274the current month with first day of month in the first row. 277the current month with first day of month in the first row.
275 278
276Added missing German translation. 279Added missing German translation.
277 280
278Fixed icons of executeable on Wintendo. 281Fixed icons of executeable on Wintendo.
279 282
280Added a "Show next Mail" button to the OM/Pi 283Added a "Show next Mail" button to the OM/Pi
281mail viewer such that the mail below the current mail 284mail viewer such that the mail below the current mail
282in the mail list view of the current folder 285in the mail list view of the current folder
283can be read with a single click. 286can be read with a single click.
284 287
285 288
286********** VERSION 1.9.13 ************ 289********** VERSION 1.9.13 ************
287 290
288Fixed nasty PwM/Pi file reading bug, when 291Fixed nasty PwM/Pi file reading bug, when
289the used hash algo of file is different then the global 292the used hash algo of file is different then the global
290hash algo. 293hash algo.
291 294
292Added KA/Pi support for opie mailit mailapplication. 295Added KA/Pi support for opie mailit mailapplication.
293 296
294Fixed some bugs in OM/Pi. 297Fixed some bugs in OM/Pi.
295Now character conversion tables are available for the Zaurus 298Now character conversion tables are available for the Zaurus
296to make OM/Pi working properly. 299to make OM/Pi working properly.
297To get the character conversion in OM/Pi working, please download 300To get the character conversion in OM/Pi working, please download
298at the sourceforge project site the package 301at the sourceforge project site the package
299sr-character-conversion_SharpROM_arm.ipk.zip 302sr-character-conversion_SharpROM_arm.ipk.zip
300(or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) 303(or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms)
301from the section "general files for KDE/Pim" 304from the section "general files for KDE/Pim"
302Instructions how to install this package are in a ReadMe in this file. 305Instructions how to install this package are in a ReadMe in this file.
303 306
304 307
305Fixed the orientation change problem in KA/Pi when switching 308Fixed the orientation change problem in KA/Pi when switching
306portrait/landscape mode. 309portrait/landscape mode.
307 310
308French translation available for KA/Pi and OM/Pi. 311French translation available for KA/Pi and OM/Pi.
309 312
310Fixed some problems with categories in KO/Pi in DTM sync. 313Fixed some problems with categories in KO/Pi in DTM sync.
311 314
312Added selection dialog for export to phone in KA/Pi. 315Added selection dialog for export to phone in KA/Pi.
313 316
314If in KO/Pi is an attendee selected to add to a meeting and this 317If in KO/Pi is an attendee selected to add to a meeting and this
315attendee is already in the list of attendees, this person is not added 318attendee is already in the list of attendees, this person is not added
316again. 319again.
317 320
318Some menu cleanup in KA/Pi. 321Some menu cleanup in KA/Pi.
319 322
320********** VERSION 1.9.12 ************ 323********** VERSION 1.9.12 ************
321 324
322Fix for the bug in KO/Pi What's Next view of version 1.9.11. 325Fix for the bug in KO/Pi What's Next view of version 1.9.11.
323 326
324Bugfix: Licence file is now shown again. 327Bugfix: Licence file is now shown again.
325 328
326OM/Pi now supports Unicode (utf8 charset). 329OM/Pi now supports Unicode (utf8 charset).
327Fixed some bugs in OM/Pi. 330Fixed some bugs in OM/Pi.
328 331
329KA/Pi has more German translation. 332KA/Pi has more German translation.
330 333
331 334
332********** VERSION 1.9.11 ************ 335********** VERSION 1.9.11 ************
333 336
334Fixed several problems in PWM/Pi, like 337Fixed several problems in PWM/Pi, like
335asking the user, if unsaved changed are pending 338asking the user, if unsaved changed are pending
336when closing the app. 339when closing the app.
337And PwM/Pi handles now different texts for the 340And PwM/Pi handles now different texts for the
338fields Description, Username, Password, configurable per category. 341fields Description, Username, Password, configurable per category.
339 342
340Fixed a crash in KO/Pi , when importing/loading vcs files 343Fixed a crash in KO/Pi , when importing/loading vcs files
341which have an entry with an attendee with state: 344which have an entry with an attendee with state:
342NEEDS ACTION 345NEEDS ACTION
343 346
344Fixed some problems in the German translation of OM/Pi, 347Fixed some problems in the German translation of OM/Pi,
345which makes some dialogs not fitting on the screen 348which makes some dialogs not fitting on the screen
346of the Z 5500. 349of the Z 5500.
347 350
348Fixed Qtopia crash, when disabling/deinstalling 351Fixed Qtopia crash, when disabling/deinstalling
349KO/Pi alarm applet. 352KO/Pi alarm applet.
350 353
351Implemented direct KDE<->KA/Pi sync for KA/Pi running 354Implemented direct KDE<->KA/Pi sync for KA/Pi running
352on Linux desktop. 355on Linux desktop.
353 356
354Added feature "remove sync info" to sync menu. 357Added feature "remove sync info" to sync menu.
355 358
356Tweaked the KO/Pi What's next view a bit, added 359Tweaked the KO/Pi What's next view a bit, added
357setting to hide events that are done. 360setting to hide events that are done.
358 361
359Disabled "beam receive enabled" on startup to 362Disabled "beam receive enabled" on startup to
360avoid problems if Fastload is enabled. 363avoid problems if Fastload is enabled.
361Please set "beam receive enabled", 364Please set "beam receive enabled",
362if you want to receive data via IR. 365if you want to receive data via IR.
363 366
364Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running 367Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running
365on Linux desktop. 368on Linux desktop.
366 369
367Made in KA/Pi scrolling possible, if details view is selected. 370Made in KA/Pi scrolling possible, if details view is selected.
368(The keyboard focus is set automatically to the search line) 371(The keyboard focus is set automatically to the search line)
369 372
370Fixed a bug in DMT sync, that a new entry in DTM was added 373Fixed a bug in DMT sync, that a new entry in DTM was added
371on every sync to Kx/Pi. 374on every sync to Kx/Pi.
372 375
373Fixed missing writing of KA/Pi categories to DMT entries when syncing. 376Fixed missing writing of KA/Pi categories to DMT entries when syncing.
374 377
375Fixed a bug in DMT sync with todos created in KO/Pi containing 378Fixed a bug in DMT sync with todos created in KO/Pi containing
376non-latin1 characters. 379non-latin1 characters.
377 380
378Rearranged package contents of Sharp-ipks and made all 381Rearranged package contents of Sharp-ipks and made all
379packages installable on SD again. 382packages installable on SD again.
380 383
381Fixed the writing of addressbook data in DTM sync. 384Fixed the writing of addressbook data in DTM sync.
382Empty fields in KA/Pi were not removed. 385Empty fields in KA/Pi were not removed.
383 386
384Added better category handling in KA/Pi: 387Added better category handling in KA/Pi:
385Added item 388Added item
386Edit Categories and 389Edit Categories and
387Manage new categories 390Manage new categories
388to the settings menu. 391to the settings menu.
389Possible to configure a view to display categories. 392Possible to configure a view to display categories.
390 393
391Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. 394Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu.
392 395
393Fixed displaying of "free" days and time in KO Monthview and Agendaview. 396Fixed displaying of "free" days and time in KO Monthview and Agendaview.
394 397
395... and many other bugfixes. 398... and many other bugfixes.
396 399
397********** VERSION 1.9.10 ************ 400********** VERSION 1.9.10 ************
398 401
399Many internal small bugfixes. 402Many internal small bugfixes.
400And fix of the "big" bug in KO/Pi, 403And fix of the "big" bug in KO/Pi,
401that after Syncing the appointments had an offset by several hours. 404that after Syncing the appointments had an offset by several hours.
402That was a problem with the internal timezone setting, 405That was a problem with the internal timezone setting,
403introduced by the changed timezone configuration settings. 406introduced by the changed timezone configuration settings.
404 407
405German translation for OM/Pi is now available. 408German translation for OM/Pi is now available.
406 409
407 410
408********** VERSION 1.9.9 ************ 411********** VERSION 1.9.9 ************
409 412
410KDE-Pim/Pi has a new Member! 413KDE-Pim/Pi has a new Member!
411It is called PWM/Pi (Passwordmanager/platform-independent) 414It is called PWM/Pi (Passwordmanager/platform-independent)
412and it is available for the Zaurus. 415and it is available for the Zaurus.
413It is planned, that it will be available later for Windows. 416It is planned, that it will be available later for Windows.
414(And for Linux, of course). 417(And for Linux, of course).
415It is a port of the Passwordmanager of KDE. 418It is a port of the Passwordmanager of KDE.
416It will need the MicroKDElibs to run. 419It will need the MicroKDElibs to run.
417 420
418Made loading of addressbooks in KA/Pi up to 7 times faster! 421Made loading of addressbooks in KA/Pi up to 7 times faster!
419The bigger your addressbook file, the more starting speed 422The bigger your addressbook file, the more starting speed
420will you gain. (relatively) 423will you gain. (relatively)
421 424
422The Qtopia addressbook connector is now platform independend 425The Qtopia addressbook connector is now platform independend
423as well and should work on any platform for importing/exporting 426as well and should work on any platform for importing/exporting
424Qtopia and Opie XML files. 427Qtopia and Opie XML files.
425 428
426Added a +30min feature to the timezone settings to make 429Added a +30min feature to the timezone settings to make
427KDE-Pim/Pi useable in Australia and other parts on the 430KDE-Pim/Pi useable in Australia and other parts on the
428world with strange timezones ;-) 431world with strange timezones ;-)
429 432
430German "Umlaute" should now be sorted correctly on the Z in KA/Pi. 433German "Umlaute" should now be sorted correctly on the Z in KA/Pi.
431 434
432It is now possible to disable the 435It is now possible to disable the
433"receive data via infrared" feature, such that syncing with 436"receive data via infrared" feature, such that syncing with
434Outlook is now possible again with Kx/Pi runing. 437Outlook is now possible again with Kx/Pi runing.
435Please disable it, before syncing Sharp DTM with Outlook. 438Please disable it, before syncing Sharp DTM with Outlook.
436For your convenience, the "receive data via infrared" feature 439For your convenience, the "receive data via infrared" feature
437is disabled automatically, if you sync Kx/Pi with DTM. 440is disabled automatically, if you sync Kx/Pi with DTM.
438You have to enable it again manually after syncing. 441You have to enable it again manually after syncing.
439Enabling this feature makes it impossible to start the 442Enabling this feature makes it impossible to start the
440Sharp DTM apps. If this feature is enabled, you will only get the 443Sharp DTM apps. If this feature is enabled, you will only get the
441alarm notification from KO/Pi and not from the Sharp calendar. 444alarm notification from KO/Pi and not from the Sharp calendar.
442This is very useful if you sync KO/Pi with Sharp DTM, 445This is very useful if you sync KO/Pi with Sharp DTM,
443because after syncing you usually would get notified about 446because after syncing you usually would get notified about
444an alarm by KO/Pi and the Sharp Calendar. 447an alarm by KO/Pi and the Sharp Calendar.
445 448
446Together with the Linux desktop version of KO/Pi 449Together with the Linux desktop version of KO/Pi
447it is now possible to sync KO/Pi on the Zaurus 450it is now possible to sync KO/Pi on the Zaurus
448with the complete KDE-desktop (3.3 or later) 451with the complete KDE-desktop (3.3 or later)
449calendar data easily. 452calendar data easily.
450That makes it possible to sync the Z with one 453That makes it possible to sync the Z with one
451click of a mouse with the KDE-Desktop. 454click of a mouse with the KDE-Desktop.
452This feature it available for all Zaurus platforms KO/Pi 455This feature it available for all Zaurus platforms KO/Pi
453is running on. 456is running on.
454The only thing needed is a running KO/Pi on Linux and 457The only thing needed is a running KO/Pi on Linux and
455a compiled version of the small 458a compiled version of the small
456KDE-Pim/Pi<->KDE-Desktop access command line program, 459KDE-Pim/Pi<->KDE-Desktop access command line program,
457which is in the KDE-Pim/Pi sources available. 460which is in the KDE-Pim/Pi sources available.
458 461
459The "KDE-desktop" syncing feature for KA/Pi will follow 462The "KDE-desktop" syncing feature for KA/Pi will follow
460in the next releases. 463in the next releases.
461 464
462Fixed the vcard export bug, which had the version 1.9.8. 465Fixed the vcard export bug, which had the version 1.9.8.
463 466
464Added missing GERMAN translation to KO/Pi. 467Added missing GERMAN translation to KO/Pi.
465Hi PsionX, could you add the missing french translation?Thx! 468Hi PsionX, could you add the missing french translation?Thx!
466 469
467Translation files for KA/Pi are available as well. 470Translation files for KA/Pi are available as well.
468GERMAN translation will be available in the next release. 471GERMAN translation will be available in the next release.
469PsionX ( yres, you again ;-) ), could you start translating 472PsionX ( yres, you again ;-) ), could you start translating
470KA/Pi? Thx! 473KA/Pi? Thx!
471 474
472You can download the version 1.9.9 at 475You can download the version 1.9.9 at
473 476
474http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 477http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604
475 478
476Note: 479Note:
477To run the mail program OM/Pi you need libopenssl. 480To run the mail program OM/Pi you need libopenssl.
478A link to a download loaction is available at 481A link to a download loaction is available at
479ZSI at www.killefiz.de 482ZSI at www.killefiz.de
480 483
481 484
482********** VERSION 1.9.8 ************ 485********** VERSION 1.9.8 ************
483 486
484Fixed character decoding in OM/Pi. 487Fixed character decoding in OM/Pi.
485(e.g. German "Umlaute" were not displayed properly.) 488(e.g. German "Umlaute" were not displayed properly.)
486 489
487Made is possible to reparent todos in KO/Pi. 490Made is possible to reparent todos in KO/Pi.
488Use contextmenu or keys (look at Help-Keys + Colors) for that. 491Use contextmenu or keys (look at Help-Keys + Colors) for that.
489 492
490Added the missing Sync-Howto and WhatsNew to the packages. 493Added the missing Sync-Howto and WhatsNew to the packages.
491 494
492KO/Pi on Linux desktop can now sync with KDE desktop. 495KO/Pi on Linux desktop can now sync with KDE desktop.
493That means: When using KO/Pi on Linux desktop for syncing with 496That means: When using KO/Pi on Linux desktop for syncing with
494KDE desktop and the Zaurus, the Zaurus can be synced now 497KDE desktop and the Zaurus, the Zaurus can be synced now
495with all KDE-Calendar resources, not only with one local file. 498with all KDE-Calendar resources, not only with one local file.
496(That makes it possible to sync the Zaurus with the 499(That makes it possible to sync the Zaurus with the
497calendar data on a Kolab server) 500calendar data on a Kolab server)
498 501
499KA/Pi syncing with KDE desktop will be available in the next version. 502KA/Pi syncing with KDE desktop will be available in the next version.
500 503
501 504
502********** VERSION 1.9.7 ************ 505********** VERSION 1.9.7 ************
503 506
504KO/Pi - KA/Pi on Windows: 507KO/Pi - KA/Pi on Windows:
505Now a directory can be defined by the user, where the 508Now a directory can be defined by the user, where the
506application/config data should be saved. 509application/config data should be saved.
507 Define your desired path in the evironment variable 510 Define your desired path in the evironment variable
508 MICROKDEHOME 511 MICROKDEHOME
509 before starting KO/Pi or KA/Pi. 512 before starting KO/Pi or KA/Pi.
510 513
511An easy Kx/Pi to Kx/Pi syncing is now possible 514An easy Kx/Pi to Kx/Pi syncing is now possible
512(it is called Pi-Sync) via network. 515(it is called Pi-Sync) via network.
513Please look at the Sync Howto. 516Please look at the Sync Howto.
514 517
515Exporting of calendar data and contacts to mobile phones is now possible. 518Exporting of calendar data and contacts to mobile phones is now possible.
516The SyncHowto is updated with information howto 519The SyncHowto is updated with information howto
517access/sync mobile phones. 520access/sync mobile phones.
518Please look at the Sync Howto. 521Please look at the Sync Howto.
519 522
520Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly. 523Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly.
521Please disable Fastload for the original contact/calendar applications 524Please disable Fastload for the original contact/calendar applications
522and close them. 525and close them.
523KO/Pi and KA/Pi must be running in order to receive the data. 526KO/Pi and KA/Pi must be running in order to receive the data.
524(KO/Pi and KA/Pi are always running if Fastload for them is enabled!) 527(KO/Pi and KA/Pi are always running if Fastload for them is enabled!)
525 528
526In the KA/Pi details view are now the preferred tel. numbers displayed on top 529In the KA/Pi details view are now the preferred tel. numbers displayed on top
527of the other data ( emails/tel.numbers/addresses) 530of the other data ( emails/tel.numbers/addresses)
528 531
529Fixed some syncing problems in KA/Pi. 532Fixed some syncing problems in KA/Pi.
530 533
531Added font settings for the KA/Pi details view. 534Added font settings for the KA/Pi details view.
532Added fields "children's name" and "gender" to KA/Pi. 535Added fields "children's name" and "gender" to KA/Pi.
533 536
534Made searching in KA/Pi better: 537Made searching in KA/Pi better:
535Now the first item in a view is selected after a search automatically and 538Now the first item in a view is selected after a search automatically and
536the views can be scrolled up/down when the search input field has the keyboard focus. 539the views can be scrolled up/down when the search input field has the keyboard focus.
537 540
538And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi. 541And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi.
539 542
540 543
541********** VERSION 1.9.6 ************ 544********** VERSION 1.9.6 ************
542 545
543Changes in the external application communication on the Zaurus 546Changes in the external application communication on the Zaurus
544in order to use less RAM when the apps are running. 547in order to use less RAM when the apps are running.
545First syncing of addressbooks (KA/Pi) is possible. 548First syncing of addressbooks (KA/Pi) is possible.
546 549
547 550
548********** VERSION 1.9.5a ************ 551********** VERSION 1.9.5a ************
549 552
550Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5. 553Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5.
551Fixed some small bugs. 554Fixed some small bugs.
552KA/Pi shows now the birthday in summary view. 555KA/Pi shows now the birthday in summary view.
553Now OM/Pi and KA/Pi are using the date format defined in KO/Pi 556Now OM/Pi and KA/Pi are using the date format defined in KO/Pi
554for displaying dates. 557for displaying dates.
555 558
556 559
557********** VERSION 1.9.5 ************ 560********** VERSION 1.9.5 ************
558 561
559There is still no Addressbook syncing! 562There is still no Addressbook syncing!
560 563
561New in 1.9.5: 564New in 1.9.5:
562 565
563Many bugfixes. 566Many bugfixes.
564Better searching in KA/Pi. 567Better searching in KA/Pi.
565You can configure in KA/Pi if you want to search only after 568You can configure in KA/Pi if you want to search only after
566<return> key pressed. 569<return> key pressed.
567 570
568Better mail downloading in OM/Pi. 571Better mail downloading in OM/Pi.
569 572
570First experimental alpha version of sync of KO/Pi with mobile phones. 573First experimental alpha version of sync of KO/Pi with mobile phones.
571See gammu documentation for supported phones. 574See gammu documentation for supported phones.
572You 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. 575You 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.
573Quick hint how to use: 576Quick hint how to use:
574NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL! 577NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL!
575Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp. 578Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp.
576Create syncprofile - mobile device 579Create syncprofile - mobile device
577Remove entry for model. (Leave empty ). 580Remove entry for model. (Leave empty ).
578Enable infrared on Zaurus and your Phone. 581Enable infrared on Zaurus and your Phone.
579Sync. 582Sync.
580To get a more detailed log, start kopi from konsole. 583To get a more detailed log, start kopi from konsole.
581 584
582********** VERSION 1.9.4 ************ 585********** VERSION 1.9.4 ************
583 586
584This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. 587This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus.
585 588
586WARNING: 589WARNING:
587PLEASE BACKUP ALL YOUR DATA! 590PLEASE BACKUP ALL YOUR DATA!
588We have changed a lot and maybe there are some unknown problems. 591We have changed a lot and maybe there are some unknown problems.
589 592
590SYNC HANDLING HAS CHANGED! 593SYNC HANDLING HAS CHANGED!
591Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. 594Such that, if you sync now with an already synded device, you will duplicated entries after the first sync.
592(This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). 595(This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks).
593 596
594You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs. 597You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs.
595If 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. 598If 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.
596 599
597As programs are available: 600As programs are available:
598KO/Pi (korganizer ipk) - a calendar program. 601KO/Pi (korganizer ipk) - a calendar program.
599KA/Pi (kaddressbook ipk ) - an addressbook 602KA/Pi (kaddressbook ipk ) - an addressbook
600OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support. 603OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support.
601 604
602An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode. 605An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode.
603(If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia) 606(If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia)
604 607
605All the applications are installed in a "Pim" TAB. 608All the applications are installed in a "Pim" TAB.
606If 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 609If 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
607 610
608All the application are integrated. 611All the application are integrated.
609Such 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. 612Such 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.
610 613
611HINT: 614HINT:
612If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number. 615If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number.
613 616
614What's new? 617What's new?
615 618
616SYNC HANDLING HAS CHANGED! 619SYNC HANDLING HAS CHANGED!
617Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. 620Such that, if you sync now with an already synded device, you will duplicated entries after the first sync.
618(This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). 621(This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks).
619 622
620New in OM/Pi: 623New in OM/Pi:
621When 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. 624When 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.
622 625
623New in KO/Pi: 626New in KO/Pi:
624French is now available for KO/Pi. 627French is now available for KO/Pi.
625Choose menu:Actions - Configure:TAB locale 628Choose menu:Actions - Configure:TAB locale
626Syncing has changed. 629Syncing has changed.
627Phone sync available soon. 630Phone sync available soon.
628Not much changes, I cannot remember them ... 631Not much changes, I cannot remember them ...
629 632
630New in KA/Pi: 633New in KA/Pi:
631Beaming possible. 634Beaming possible.
632Sharp DTM readonly access possible( create a new DTM resource ); 635Sharp DTM readonly access possible( create a new DTM resource );
633Better searching possible. 636Better searching possible.
634Search is performed only after pressing the return key. 637Search is performed only after pressing the return key.
635Use wildcard * to specify parts of a name. 638Use wildcard * to specify parts of a name.
636 639
637Better 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 * . 640Better 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 * .
638 641
639A big improvement is the new management of the contact access. 642A big improvement is the new management of the contact access.
640In version 1.9.3, every application was using their own addressbook access data. 643In version 1.9.3, every application was using their own addressbook access data.
641That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi. 644That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi.
642That was wasting of memory, if you had several hundreds of contacts. 645That was wasting of memory, if you had several hundreds of contacts.
643 646
644Now only KA/Pi accesses the addressbook. 647Now only KA/Pi accesses the addressbook.
645If 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. 648If 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.
646If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly. 649If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly.
647That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first. 650That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first.
648 651
649New in the KO/Pi alarm applet: 652New in the KO/Pi alarm applet:
650Configure your own timer popup menu! 653Configure your own timer popup menu!
651(Text and minutes for timer countdown) 654(Text and minutes for timer countdown)
652Just edit the file 655Just edit the file
653(yourhomedir)/.kopialarmtimerrc 656(yourhomedir)/.kopialarmtimerrc
654and start/stop a timer to get a new menu with the data of this file. 657and start/stop a timer to get a new menu with the data of this file.
655 658
656********** VERSION 1.9.3 ************ 659********** VERSION 1.9.3 ************
6571) 6601)
658Now KO/Pi on Windows imports directly the calendar data of 661Now KO/Pi on Windows imports directly the calendar data of
659an installed Outlook. Should work with OL version >= 2000. 662an installed Outlook. Should work with OL version >= 2000.
660 663
661********** VERSION 1.9.2 ************ 664********** VERSION 1.9.2 ************
6621) 6651)
663KDE-Pim/Pi has got a new member: 666KDE-Pim/Pi has got a new member:
664KmicroMail (KM/Pi) is a mail program, 667KmicroMail (KM/Pi) is a mail program,
665which can handle IMAP and POP mail access. 668which can handle IMAP and POP mail access.
666It is based on Opie-Mail v3. 669It is based on Opie-Mail v3.
667All dependencies to the Opie libraries ar removed, 670All dependencies to the Opie libraries ar removed,
668such that no additional Opie lib is needed. 671such that no additional Opie lib is needed.
669It is already integrated in KO/Pi and KA/Pi. 672It is already integrated in KO/Pi and KA/Pi.
670It it now available for the Zaurus,probably it 673It it now available for the Zaurus,probably it
671will be available for other platforms later. 674will be available for other platforms later.
672Hint: 675Hint:
673Create your own contact (name + email) 676Create your own contact (name + email)
674in KA/Pi, select this contact and choose menu: 677in KA/Pi, select this contact and choose menu:
675Settings - Set Who Am I. 678Settings - Set Who Am I.
676Now the settings of this contact are used as 679Now the settings of this contact are used as
677the sender data in KM/Pi. 680the sender data in KM/Pi.
6782) 6812)
679KDE-Pim/Pi is split up in five different 682KDE-Pim/Pi is split up in five different
680packages now precompiled for Sharp Zaurus: 683packages now precompiled for Sharp Zaurus:
681--kmicrokdelibs_1.9.2_arm.ipk 684--kmicrokdelibs_1.9.2_arm.ipk
682The libs are needed for any 685The libs are needed for any
683of the following programs: 686of the following programs:
684--kaddressbook_1.9.2_arm.ipk 687--kaddressbook_1.9.2_arm.ipk
685--kmicromail_1.9.2_arm.ipk 688--kmicromail_1.9.2_arm.ipk
686--korganizer_1.9.2_arm.ipk 689--korganizer_1.9.2_arm.ipk
687Independ from that, there is the alarm applet 690Independ from that, there is the alarm applet
688available for KO/Pi, which also offers 691available for KO/Pi, which also offers
689quick access for a new mail or 692quick access for a new mail or
690showing the addressbook.: 693showing the addressbook.:
691--korganizer-alarm_1.9.2_arm.ipk 694--korganizer-alarm_1.9.2_arm.ipk
692Independend means, that the alarm applet 695Independend means, that the alarm applet
693does not need any of the libs or programs above to run. 696does not need any of the libs or programs above to run.
694But it would be quite useless without these programs. 697But it would be quite useless without these programs.
695NOTE: 698NOTE:
696If you get a 699If you get a
697"This application depends on other programs" 700"This application depends on other programs"
698during installation of 701during installation of
699--kmicrokdelibs_1.9.2_arm.ipk 702--kmicrokdelibs_1.9.2_arm.ipk
700you probably do not have to care about that. 703you probably do not have to care about that.
701kmicrokdelibs_1.9.2 will come with some 704kmicrokdelibs_1.9.2 will come with some
702resource plugins, which needs additional libraries. 705resource plugins, which needs additional libraries.
703(E.g. libopie1, if you want to use the 706(E.g. libopie1, if you want to use the
704opie resource connector in KA/Pi). 707opie resource connector in KA/Pi).
705If you do not have this libraries installed, 708If you do not have this libraries installed,
706you simply cannot use the resource. 709you simply cannot use the resource.
707To make it clear: 710To make it clear:
708If the libraries are missing, the applications 711If the libraries are missing, the applications
709using kmicrokdelibs will start, 712using kmicrokdelibs will start,
710because the resources are plugins. 713because the resources are plugins.
7113) 7143)
712KO/Pi and friends are now installable on SD-Card! 715KO/Pi and friends are now installable on SD-Card!
713It is recommended to install all libs and apps 716It is recommended to install all libs and apps
714on the SD card or all in the internal storage. 717on the SD card or all in the internal storage.
715There may be problems, if this is mixed. 718There may be problems, if this is mixed.
7164) 7194)
717Fixed two bugs in the alarm notification on Windows. 720Fixed two bugs in the alarm notification on Windows.
7185) 7215)
719Great improvement! 722Great improvement!
720KO/Pi uses now the latest version of libical. 723KO/Pi uses now the latest version of libical.
721Libical is the library which actually reads 724Libical is the library which actually reads
722the calendar files and extract the data from it. 725the calendar files and extract the data from it.
723With the old version, there were problems 726With the old version, there were problems
724(crashes or program hangs) when licical did read 727(crashes or program hangs) when licical did read
725files, which were not stored from KO/Pi. 728files, which were not stored from KO/Pi.
726I do not know, if the new libical works perfect, 729I do not know, if the new libical works perfect,
727but actually it works much better than 730but actually it works much better than
728the old version. 731the old version.
729There are no problems with compatibility with 732There are no problems with compatibility with
730old calendar files of KO/Pi, of course! 733old calendar files of KO/Pi, of course!
7316) 7346)
732New in KA/Pi: 735New in KA/Pi:
733Opie addressbook resource connector available! 736Opie addressbook resource connector available!
734You will need libopie1 and the opie addressbook, 737You will need libopie1 and the opie addressbook,
735of course. 738of course.
736With the Opie addressbook resource connector, 739With the Opie addressbook resource connector,
737you can access the Opie addressbook readonly in KA/Pi. 740you can access the Opie addressbook readonly in KA/Pi.
738If you want to edit or import the data into KA/Pi, 741If you want to edit or import the data into KA/Pi,
739do this: 742do this:
740a) Create an Opie resource. 743a) Create an Opie resource.
741 (Menu: Settings-Configure Resources). 744 (Menu: Settings-Configure Resources).
742After configuration and restarting KA/Pi you should see 745After configuration and restarting KA/Pi you should see
743the Opie contacts in KA/Pi. 746the Opie contacts in KA/Pi.
744b) Select some or all Opie contacts. 747b) Select some or all Opie contacts.
745(NOTE: +++++ 748(NOTE: +++++
746To know exactly, what contacts are Opie contacts, 749To know exactly, what contacts are Opie contacts,
747do this: Choose menu: 750do this: Choose menu:
748View-Modify View - TAB Fields. 751View-Modify View - TAB Fields.
749Select in the above list "Resource" and click 752Select in the above list "Resource" and click
750down arrow to add it to the "Selected fields". 753down arrow to add it to the "Selected fields".
751Click OK. 754Click OK.
752Now you have a new column "Resource" in your list, 755Now you have a new column "Resource" in your list,
753where you can see, what an Opie resource is. 756where you can see, what an Opie resource is.
754++++ NOTE end.) 757++++ NOTE end.)
755Ok, we do have now some Opie contacts seleted. 758Ok, we do have now some Opie contacts seleted.
756(Use SHIFT or CTRL key in order to multiple select). 759(Use SHIFT or CTRL key in order to multiple select).
757c) Choose menu: Edit-Copy. 760c) Choose menu: Edit-Copy.
758d) Choose menu: Edit-Paste. 761d) Choose menu: Edit-Paste.
759e) Select the resource, you want to add the contacts to. 762e) Select the resource, you want to add the contacts to.
760Congrats! Now you have read/write access to the copied 763Congrats! Now you have read/write access to the copied
761opie contacts as "real" KA/Pi contacts. 764opie contacts as "real" KA/Pi contacts.
762 765
763 766
764********** VERSION 1.9.1 ************ 767********** VERSION 1.9.1 ************
7651) 7681)
766 +++ IMPORTANT 1 +++ 769 +++ IMPORTANT 1 +++
767 770
768The storing place of the default calendar 771The storing place of the default calendar
769file has changed! 772file has changed!
770The default calendar file was 773The default calendar file was
771Applications/korganizer/mycalendar.ics 774Applications/korganizer/mycalendar.ics
772on Zaurus and 775on Zaurus and
773(yourHomeDir)/korganizer/mycalendar.ics 776(yourHomeDir)/korganizer/mycalendar.ics
774on Windows/Linux desktop. Now it is 777on Windows/Linux desktop. Now it is
775(yourHomeDir)/kdepim/korganizer/mycalendar.ics 778(yourHomeDir)/kdepim/korganizer/mycalendar.ics
776on Zaurus, Windows and Linux. 779on Zaurus, Windows and Linux.
777To load the old file, choose menu 780To load the old file, choose menu
778File-Load calendar backup. 781File-Load calendar backup.
779(It should be loaded automatically 782(It should be loaded automatically
780at startup with a warning message displayed). 783at startup with a warning message displayed).
781The place of the configuration file has changed too. 784The place of the configuration file has changed too.
782If you want to use your old KO/Pi config, 785If you want to use your old KO/Pi config,
783copy it to 786copy it to
784(yourHomeDir)/kdepim/config/korganizerrc 787(yourHomeDir)/kdepim/config/korganizerrc
785Please read VERSION 1.9.0 - topic 3) as well! 788Please read VERSION 1.9.0 - topic 3) as well!
786 789
787 +++ IMPORTANT 2 +++ 790 +++ IMPORTANT 2 +++
788 791
789Because of the new paths, you will need 792Because of the new paths, you will need
790a new version of the KO/Pi alarm applet 793a new version of the KO/Pi alarm applet
791for Zaurus. 794for Zaurus.
792Use version >= 1.9.1 795Use version >= 1.9.1
793 796
7942) 7972)
795Now the QWhat'sThis Icon works for items 798Now the QWhat'sThis Icon works for items
796in the month view as well. 799in the month view as well.
797(See VERSION 1.7.8 Topic 1) ). 800(See VERSION 1.7.8 Topic 1) ).
7983) 8013)
799You can import birtsdays/anniversaries 802You can import birtsdays/anniversaries
800from KA/Pi into KO/Pi. 803from KA/Pi into KO/Pi.
801Choose menu File-Import birthdays. 804Choose menu File-Import birthdays.
802If you import twice, already imported items 805If you import twice, already imported items
803will not be imported again, if they 806will not be imported again, if they
804have not been changed in KO/Pi. 807have not been changed in KO/Pi.
8054) 8084)
806When syncing with sharp DTM, now a progress 809When syncing with sharp DTM, now a progress
807is shown, when the data is written back. 810is shown, when the data is written back.
808If there is much data in KO/Pi and no data 811If there is much data in KO/Pi and no data
809in DTM, that can take a long time. 812in DTM, that can take a long time.
810(But only for the first time ). 813(But only for the first time ).
8115) 8145)
812In the search dialog, you can search 815In the search dialog, you can search
813now for the name/email of an attendee 816now for the name/email of an attendee
814of an event/todo. 817of an event/todo.
815To get more space for displaying 818To get more space for displaying
816search results, the buttons 819search results, the buttons
817for "search" and "close" on the 820for "search" and "close" on the
818bottom are removed in the PDA version. 821bottom are removed in the PDA version.
819You have to click OK in the top right 822You have to click OK in the top right
820corner to do a search. 823corner to do a search.
8216) 8246)
822Now it is possible to disable the displaying 825Now it is possible to disable the displaying
823of todo items in the Allday part of the Agenda. 826of todo items in the Allday part of the Agenda.
824Choose Menu Action-Configure, 827Choose Menu Action-Configure,
825TAB Todo View, checkbox 828TAB Todo View, checkbox
826"Allday Agenda view shows todos" 829"Allday Agenda view shows todos"
8277) 8307)
828If FastLoad is enabled, now the settings and the 831If FastLoad is enabled, now the settings and the
829calendar data are saved, when KO/Pi is closed. 832calendar data are saved, when KO/Pi is closed.
830(If no Fastload is enabled, KO/Pi saves 833(If no Fastload is enabled, KO/Pi saves
831the data as well, of course) 834the data as well, of course)
8328) 8358)
833The Agenda View has a minimize-splitter now, 836The Agenda View has a minimize-splitter now,
834such that the height of the allday part can be 837such that the height of the allday part can be
835changed quickly. 838changed quickly.
836 839
837********** VERSION 1.9.0 ************ 840********** VERSION 1.9.0 ************
8381) 8411)
839KO/Pi is now merged with the new microKDE from KA/Pi. 842KO/Pi is now merged with the new microKDE from KA/Pi.
840KO/Pi accesses now KA/Pi as the addressbook. 843KO/Pi accesses now KA/Pi as the addressbook.
841The other ddressbook-plugins are not working any longer. 844The other ddressbook-plugins are not working any longer.
842(It is planned, that later KA/Pi itself uses these plugins) 845(It is planned, that later KA/Pi itself uses these plugins)
843New versions of KO/Pi are only available 846New versions of KO/Pi are only available
844together with KA/Pi as the KDE-Pim/Pi package. 847together with KA/Pi as the KDE-Pim/Pi package.
8452) 8482)
846If you click on an attendee of a meeting in the 849If you click on an attendee of a meeting in the
847event viewer, a detailed summary of the 850event viewer, a detailed summary of the
848attendee is shown. 851attendee is shown.
8493) 8523)
850The place of the configuration file has changed. 853The place of the configuration file has changed.
851If you want to use your old KO/Pi config, copy 854If you want to use your old KO/Pi config, copy
852Applications/korganizer/config_korganizerrc 855Applications/korganizer/config_korganizerrc
853to 856to
854Applications/korganizer/config/korganizerrc 857Applications/korganizer/config/korganizerrc
855 858
856********** VERSION 1.7.8 ************ 859********** VERSION 1.7.8 ************
8571) 8601)
858Now the QWhat'sThis ist working. 861Now the QWhat'sThis ist working.
859Enable the QWhat'sThis icon in the toolbar. 862Enable the QWhat'sThis icon in the toolbar.
860(You have to restart to reload the changed toolbar config). 863(You have to restart to reload the changed toolbar config).
861Now click on the QWhat'sThis Icon 864Now click on the QWhat'sThis Icon
862in the top right corner of KO/Pi. 865in the top right corner of KO/Pi.
863Then click on an item in the Agenda View: 866Then click on an item in the Agenda View:
864You will get a detailed display of the items content. 867You will get a detailed display of the items content.
8652) 8682)
866Some other very minor changes. 869Some other very minor changes.
867But I have forgotten the details ... 870But I have forgotten the details ...
868For that reason I start this log here: 871For that reason I start this log here:
869To document my changes, when I am doing it. 872To document my changes, when I am doing it.
870 873
871********** VERSION 1.7.7 ************ 874********** VERSION 1.7.7 ************
872Stable Version of KO/Pi 875Stable Version of KO/Pi
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index e0380fa..77de94f 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1,3923 +1,3939 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Requires the Qt and KDE widget libraries, available at no cost at 4 Requires the Qt and KDE widget libraries, available at no cost at
5 http://www.troll.no and http://www.kde.org respectively 5 http://www.troll.no and http://www.kde.org respectively
6 6
7 Copyright (c) 1997, 1998, 1999 7 Copyright (c) 1997, 1998, 1999
8 Preston Brown (preston.brown@yale.edu) 8 Preston Brown (preston.brown@yale.edu)
9 Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl) 9 Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl)
10 Ian Dawes (iadawes@globalserve.net) 10 Ian Dawes (iadawes@globalserve.net)
11 Laszlo Boloni (boloni@cs.purdue.edu) 11 Laszlo Boloni (boloni@cs.purdue.edu)
12 12
13 Copyright (c) 2000, 2001, 2002 13 Copyright (c) 2000, 2001, 2002
14 Cornelius Schumacher <schumacher@kde.org> 14 Cornelius Schumacher <schumacher@kde.org>
15 15
16 This program is free software; you can redistribute it and/or modify 16 This program is free software; you can redistribute it and/or modify
17 it under the terms of the GNU General Public License as published by 17 it under the terms of the GNU General Public License as published by
18 the Free Software Foundation; either version 2 of the License, or 18 the Free Software Foundation; either version 2 of the License, or
19 (at your option) any later version. 19 (at your option) any later version.
20 20
21 This program is distributed in the hope that it will be useful, 21 This program is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of 22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
24 GNU General Public License for more details. 24 GNU General Public License for more details.
25 25
26 You should have received a copy of the GNU General Public License 26 You should have received a copy of the GNU General Public License
27 along with this program; if not, write to the Free Software 27 along with this program; if not, write to the Free Software
28 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 28 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29*/ 29*/
30 30
31#include <stdlib.h> 31#include <stdlib.h>
32 32
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qradiobutton.h> 34#include <qradiobutton.h>
35#include <qbuttongroup.h> 35#include <qbuttongroup.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qclipboard.h> 37#include <qclipboard.h>
38#include <qcursor.h> 38#include <qcursor.h>
39#include <qmessagebox.h> 39#include <qmessagebox.h>
40#include <qprogressbar.h> 40#include <qprogressbar.h>
41#include <qmultilineedit.h> 41#include <qmultilineedit.h>
42#include <qtimer.h> 42#include <qtimer.h>
43#include <qwidgetstack.h> 43#include <qwidgetstack.h>
44#include <qptrlist.h> 44#include <qptrlist.h>
45#include <qregexp.h> 45#include <qregexp.h>
46#include <qgroupbox.h> 46#include <qgroupbox.h>
47#include <qfile.h> 47#include <qfile.h>
48#include <qdir.h> 48#include <qdir.h>
49#ifndef KORG_NOSPLITTER 49#ifndef KORG_NOSPLITTER
50#include <qsplitter.h> 50#include <qsplitter.h>
51#endif 51#endif
52 52
53#include <kglobal.h> 53#include <kglobal.h>
54#include <kdebug.h> 54#include <kdebug.h>
55#include <kstandarddirs.h> 55#include <kstandarddirs.h>
56#include <kfiledialog.h> 56#include <kfiledialog.h>
57#include <kmessagebox.h> 57#include <kmessagebox.h>
58#include <knotifyclient.h> 58#include <knotifyclient.h>
59#include <kconfig.h> 59#include <kconfig.h>
60 60
61#include <libkdepim/ksyncprefsdialog.h> 61#include <libkdepim/ksyncprefsdialog.h>
62#include <krun.h> 62#include <krun.h>
63#include <kdirwatch.h> 63#include <kdirwatch.h>
64#include <libkdepim/kdatepicker.h> 64#include <libkdepim/kdatepicker.h>
65#include <libkdepim/ksyncprofile.h> 65#include <libkdepim/ksyncprofile.h>
66#include <libkdepim/kpimglobalprefs.h> 66#include <libkdepim/kpimglobalprefs.h>
67 67
68#include <libkcal/vcaldrag.h> 68#include <libkcal/vcaldrag.h>
69#include <libkcal/icaldrag.h> 69#include <libkcal/icaldrag.h>
70#include <libkcal/icalformat.h> 70#include <libkcal/icalformat.h>
71#include <libkcal/vcalformat.h> 71#include <libkcal/vcalformat.h>
72#include <libkcal/scheduler.h> 72#include <libkcal/scheduler.h>
73#include <libkcal/calendarlocal.h> 73#include <libkcal/calendarlocal.h>
74#include <libkcal/journal.h> 74#include <libkcal/journal.h>
75#include <libkcal/calfilter.h> 75#include <libkcal/calfilter.h>
76#include <libkcal/attendee.h> 76#include <libkcal/attendee.h>
77#include <libkcal/dndfactory.h> 77#include <libkcal/dndfactory.h>
78#include <libkcal/freebusy.h> 78#include <libkcal/freebusy.h>
79#include <libkcal/filestorage.h> 79#include <libkcal/filestorage.h>
80#include <libkcal/calendarresources.h> 80#include <libkcal/calendarresources.h>
81#include <libkcal/qtopiaformat.h> 81#include <libkcal/qtopiaformat.h>
82#include "../kalarmd/alarmdialog.h" 82#include "../kalarmd/alarmdialog.h"
83 83
84#ifndef DESKTOP_VERSION 84#ifndef DESKTOP_VERSION
85#include <libkcal/sharpformat.h> 85#include <libkcal/sharpformat.h>
86#include <externalapphandler.h> 86#include <externalapphandler.h>
87#endif 87#endif
88#include <libkcal/phoneformat.h> 88#include <libkcal/phoneformat.h>
89#ifndef KORG_NOMAIL 89#ifndef KORG_NOMAIL
90#include "komailclient.h" 90#include "komailclient.h"
91#endif 91#endif
92#ifndef KORG_NOPRINTER 92#ifndef KORG_NOPRINTER
93#include "calprinter.h" 93#include "calprinter.h"
94#endif 94#endif
95#ifndef KORG_NOPLUGINS 95#ifndef KORG_NOPLUGINS
96#include "kocore.h" 96#include "kocore.h"
97#endif 97#endif
98#include "koeventeditor.h" 98#include "koeventeditor.h"
99#include "kotodoeditor.h" 99#include "kotodoeditor.h"
100#include "koprefs.h" 100#include "koprefs.h"
101#include "koeventviewerdialog.h" 101#include "koeventviewerdialog.h"
102#include "publishdialog.h" 102#include "publishdialog.h"
103#include "kofilterview.h" 103#include "kofilterview.h"
104#include "koglobals.h" 104#include "koglobals.h"
105#include "koviewmanager.h" 105#include "koviewmanager.h"
106#include "koagendaview.h" 106#include "koagendaview.h"
107#include "kodialogmanager.h" 107#include "kodialogmanager.h"
108#include "outgoingdialog.h" 108#include "outgoingdialog.h"
109#include "incomingdialog.h" 109#include "incomingdialog.h"
110#include "statusdialog.h" 110#include "statusdialog.h"
111#include "kdatenavigator.h" 111#include "kdatenavigator.h"
112#include "kotodoview.h" 112#include "kotodoview.h"
113#include "datenavigator.h" 113#include "datenavigator.h"
114#include "resourceview.h" 114#include "resourceview.h"
115#include "navigatorbar.h" 115#include "navigatorbar.h"
116#include "searchdialog.h" 116#include "searchdialog.h"
117#include "mainwindow.h" 117#include "mainwindow.h"
118 118
119#include "calendarview.h" 119#include "calendarview.h"
120#ifndef DESKTOP_VERSION 120#ifndef DESKTOP_VERSION
121#include <qtopia/alarmserver.h> 121#include <qtopia/alarmserver.h>
122#endif 122#endif
123#ifndef _WIN32_ 123#ifndef _WIN32_
124#include <stdlib.h> 124#include <stdlib.h>
125#include <stdio.h> 125#include <stdio.h>
126#include <unistd.h> 126#include <unistd.h>
127#else 127#else
128#include <qprocess.h> 128#include <qprocess.h>
129#endif 129#endif
130 130
131#ifdef DESKTOP_VERSION 131#ifdef DESKTOP_VERSION
132#include <kabc/stdaddressbook.h> 132#include <kabc/stdaddressbook.h>
133#endif 133#endif
134using namespace KOrg; 134using namespace KOrg;
135using namespace KCal; 135using namespace KCal;
136extern int globalFlagBlockAgenda; 136extern int globalFlagBlockAgenda;
137extern int globalFlagBlockStartup; 137extern int globalFlagBlockStartup;
138 138
139 139
140 140
141class KOBeamPrefs : public QDialog 141class KOBeamPrefs : public QDialog
142{ 142{
143 public: 143 public:
144 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : 144 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
145 QDialog( parent, name, true ) 145 QDialog( parent, name, true )
146 { 146 {
147 setCaption( i18n("Beam Options") ); 147 setCaption( i18n("Beam Options") );
148 QVBoxLayout* lay = new QVBoxLayout( this ); 148 QVBoxLayout* lay = new QVBoxLayout( this );
149 lay->setSpacing( 3 ); 149 lay->setSpacing( 3 );
150 lay->setMargin( 3 ); 150 lay->setMargin( 3 );
151 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); 151 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
152 lay->addWidget( format ); 152 lay->addWidget( format );
153 format->setExclusive ( true ) ; 153 format->setExclusive ( true ) ;
154 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); 154 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
155 lay->addWidget( time ); time->setExclusive ( true ) ; 155 lay->addWidget( time ); time->setExclusive ( true ) ;
156 vcal = new QRadioButton(" vCalendar ", format ); 156 vcal = new QRadioButton(" vCalendar ", format );
157 ical = new QRadioButton(" iCalendar ", format ); 157 ical = new QRadioButton(" iCalendar ", format );
158 vcal->setChecked( true ); 158 vcal->setChecked( true );
159 tz = new QRadioButton(i18n(" With timezone "), time ); 159 tz = new QRadioButton(i18n(" With timezone "), time );
160 local = new QRadioButton(i18n(" Local time "), time ); 160 local = new QRadioButton(i18n(" Local time "), time );
161 tz->setChecked( true ); 161 tz->setChecked( true );
162 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); 162 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
163 lay->addWidget( ok ); 163 lay->addWidget( ok );
164 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 164 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
165 lay->addWidget( cancel ); 165 lay->addWidget( cancel );
166 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 166 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
167 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 167 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
168 resize( 200, 200 ); 168 resize( 200, 200 );
169 } 169 }
170 170
171 bool beamVcal() { return vcal->isChecked(); } 171 bool beamVcal() { return vcal->isChecked(); }
172 bool beamLocal() { return local->isChecked(); } 172 bool beamLocal() { return local->isChecked(); }
173private: 173private:
174 QRadioButton* vcal, *ical, *local, *tz; 174 QRadioButton* vcal, *ical, *local, *tz;
175}; 175};
176class KOCatPrefs : public QDialog 176class KOCatPrefs : public QDialog
177{ 177{
178 public: 178 public:
179 KOCatPrefs( QWidget *parent=0, const char *name=0 ) : 179 KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
180 QDialog( parent, name, true ) 180 QDialog( parent, name, true )
181 { 181 {
182 setCaption( i18n("Manage new Categories") ); 182 setCaption( i18n("Manage new Categories") );
183 QVBoxLayout* lay = new QVBoxLayout( this ); 183 QVBoxLayout* lay = new QVBoxLayout( this );
184 lay->setSpacing( 3 ); 184 lay->setSpacing( 3 );
185 lay->setMargin( 3 ); 185 lay->setMargin( 3 );
186 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); 186 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
187 lay->addWidget( lab ); 187 lay->addWidget( lab );
188 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 188 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
189 lay->addWidget( format ); 189 lay->addWidget( format );
190 format->setExclusive ( true ) ; 190 format->setExclusive ( true ) ;
191 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 191 addCatBut = new QRadioButton(i18n("Add to category list"), format );
192 new QRadioButton(i18n("Remove from Events/Todos"), format ); 192 new QRadioButton(i18n("Remove from Events/Todos"), format );
193 addCatBut->setChecked( true ); 193 addCatBut->setChecked( true );
194 QPushButton * ok = new QPushButton( i18n("OK"), this ); 194 QPushButton * ok = new QPushButton( i18n("OK"), this );
195 lay->addWidget( ok ); 195 lay->addWidget( ok );
196 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 196 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
197 lay->addWidget( cancel ); 197 lay->addWidget( cancel );
198 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 198 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
199 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 199 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
200 resize( 200, 200 ); 200 resize( 200, 200 );
201 } 201 }
202 202
203 bool addCat() { return addCatBut->isChecked(); } 203 bool addCat() { return addCatBut->isChecked(); }
204private: 204private:
205 QRadioButton* addCatBut; 205 QRadioButton* addCatBut;
206}; 206};
207 207
208 208
209 209
210CalendarView::CalendarView( CalendarResources *calendar, 210CalendarView::CalendarView( CalendarResources *calendar,
211 QWidget *parent, const char *name ) 211 QWidget *parent, const char *name )
212 : CalendarViewBase( parent, name ), 212 : CalendarViewBase( parent, name ),
213 mCalendar( calendar ), 213 mCalendar( calendar ),
214 mResourceManager( calendar->resourceManager() ) 214 mResourceManager( calendar->resourceManager() )
215{ 215{
216 216
217 mEventEditor = 0; 217 mEventEditor = 0;
218 mTodoEditor = 0; 218 mTodoEditor = 0;
219 219
220 init(); 220 init();
221} 221}
222 222
223CalendarView::CalendarView( Calendar *calendar, 223CalendarView::CalendarView( Calendar *calendar,
224 QWidget *parent, const char *name ) 224 QWidget *parent, const char *name )
225 : CalendarViewBase( parent, name ), 225 : CalendarViewBase( parent, name ),
226 mCalendar( calendar ), 226 mCalendar( calendar ),
227 mResourceManager( 0 ) 227 mResourceManager( 0 )
228{ 228{
229 229
230 mEventEditor = 0; 230 mEventEditor = 0;
231 mTodoEditor = 0; 231 mTodoEditor = 0;
232 init();} 232 init();}
233 233
234void CalendarView::init() 234void CalendarView::init()
235{ 235{
236 mBlockShowDates = false; 236 mBlockShowDates = false;
237 beamDialog = new KOBeamPrefs(); 237 beamDialog = new KOBeamPrefs();
238 mDatePickerMode = 0; 238 mDatePickerMode = 0;
239 mCurrentSyncDevice = ""; 239 mCurrentSyncDevice = "";
240 writeLocale(); 240 writeLocale();
241 mViewManager = new KOViewManager( this ); 241 mViewManager = new KOViewManager( this );
242 mDialogManager = new KODialogManager( this ); 242 mDialogManager = new KODialogManager( this );
243 mEventViewerDialog = 0; 243 mEventViewerDialog = 0;
244 mModified = false; 244 mModified = false;
245 mReadOnly = false; 245 mReadOnly = false;
246 mSelectedIncidence = 0; 246 mSelectedIncidence = 0;
247 mCalPrinter = 0; 247 mCalPrinter = 0;
248 mFilters.setAutoDelete(true); 248 mFilters.setAutoDelete(true);
249 249
250 mCalendar->registerObserver( this ); 250 mCalendar->registerObserver( this );
251 // TODO: Make sure that view is updated, when calendar is changed. 251 // TODO: Make sure that view is updated, when calendar is changed.
252 252
253 mStorage = new FileStorage( mCalendar ); 253 mStorage = new FileStorage( mCalendar );
254 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 254 mNavigator = new DateNavigator( this, "datevav", mViewManager );
255 255
256 QBoxLayout *topLayout = (QBoxLayout*)layout(); 256 QBoxLayout *topLayout = (QBoxLayout*)layout();
257#ifndef KORG_NOSPLITTER 257#ifndef KORG_NOSPLITTER
258 // create the main layout frames. 258 // create the main layout frames.
259 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 259 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
260 topLayout->addWidget(mPanner); 260 topLayout->addWidget(mPanner);
261 261
262 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 262 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
263 "CalendarView::LeftFrame"); 263 "CalendarView::LeftFrame");
264 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 264 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
265 265
266 mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, 266 mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE,
267 "CalendarView::DateNavigator", QDate::currentDate() ); 267 "CalendarView::DateNavigator", QDate::currentDate() );
268 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 268 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
269 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 269 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
270 mTodoList->setNavigator( mNavigator ); 270 mTodoList->setNavigator( mNavigator );
271 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 271 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
272 272
273#ifdef KORG_NORESOURCEVIEW 273#ifdef KORG_NORESOURCEVIEW
274 mResourceView = 0; 274 mResourceView = 0;
275#else 275#else
276 if ( mResourceManager ) { 276 if ( mResourceManager ) {
277 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 277 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
278 mResourceView->updateView(); 278 mResourceView->updateView();
279 connect( mResourceView, SIGNAL( resourcesChanged() ), 279 connect( mResourceView, SIGNAL( resourcesChanged() ),
280 SLOT( updateView() ) ); 280 SLOT( updateView() ) );
281 } else { 281 } else {
282 mResourceView = 0; 282 mResourceView = 0;
283 } 283 }
284#endif 284#endif
285 QWidget *rightBox = new QWidget( mPanner ); 285 QWidget *rightBox = new QWidget( mPanner );
286 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 286 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
287 287
288 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); 288 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" );
289 rightLayout->addWidget( mNavigatorBar ); 289 rightLayout->addWidget( mNavigatorBar );
290 290
291 mRightFrame = new QWidgetStack( rightBox ); 291 mRightFrame = new QWidgetStack( rightBox );
292 rightLayout->addWidget( mRightFrame, 1 ); 292 rightLayout->addWidget( mRightFrame, 1 );
293 293
294 mLeftFrame = mLeftSplitter; 294 mLeftFrame = mLeftSplitter;
295#else 295#else
296 QWidget *mainBox = new QWidget( this ); 296 QWidget *mainBox = new QWidget( this );
297 QWidget *leftFrame = new QWidget( mainBox ); 297 QWidget *leftFrame = new QWidget( mainBox );
298 298
299 QBoxLayout * mainBoxLayout; 299 QBoxLayout * mainBoxLayout;
300 QBoxLayout * leftFrameLayout; 300 QBoxLayout * leftFrameLayout;
301 if ( KOPrefs::instance()->mVerticalScreen ) { 301 if ( KOPrefs::instance()->mVerticalScreen ) {
302 mainBoxLayout = new QVBoxLayout(mainBox); 302 mainBoxLayout = new QVBoxLayout(mainBox);
303 leftFrameLayout = new QHBoxLayout(leftFrame ); 303 leftFrameLayout = new QHBoxLayout(leftFrame );
304 } else { 304 } else {
305 mainBoxLayout = new QHBoxLayout(mainBox); 305 mainBoxLayout = new QHBoxLayout(mainBox);
306 leftFrameLayout = new QVBoxLayout(leftFrame ); 306 leftFrameLayout = new QVBoxLayout(leftFrame );
307 } 307 }
308 topLayout->addWidget( mainBox ); 308 topLayout->addWidget( mainBox );
309 mainBoxLayout->addWidget (leftFrame); 309 mainBoxLayout->addWidget (leftFrame);
310 mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, 310 mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE,
311 "CalendarView::DateNavigator", QDate::currentDate()); 311 "CalendarView::DateNavigator", QDate::currentDate());
312 // mDateNavigator->blockSignals( true ); 312 // mDateNavigator->blockSignals( true );
313 leftFrameLayout->addWidget( mDateNavigator ); 313 leftFrameLayout->addWidget( mDateNavigator );
314 mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); 314 mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView");
315 mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); 315 mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall");
316 mTodoList->setNavigator( mNavigator ); 316 mTodoList->setNavigator( mNavigator );
317 317
318 if ( QApplication::desktop()->width() < 480 ) { 318 if ( QApplication::desktop()->width() < 480 ) {
319 leftFrameLayout->addWidget(mFilterView); 319 leftFrameLayout->addWidget(mFilterView);
320 leftFrameLayout->addWidget(mTodoList, 2 ); 320 leftFrameLayout->addWidget(mTodoList, 2 );
321 321
322 } else { 322 } else {
323 leftFrameLayout->addWidget(mTodoList,2 ); 323 leftFrameLayout->addWidget(mTodoList,2 );
324 leftFrameLayout->addWidget(mFilterView ); 324 leftFrameLayout->addWidget(mFilterView );
325 } 325 }
326 mFilterView->hide(); 326 mFilterView->hide();
327 QWidget *rightBox = new QWidget( mainBox ); 327 QWidget *rightBox = new QWidget( mainBox );
328 mainBoxLayout->addWidget ( rightBox, 10 ); 328 mainBoxLayout->addWidget ( rightBox, 10 );
329 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 329 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
330 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); 330 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" );
331 mRightFrame = new QWidgetStack( rightBox ); 331 mRightFrame = new QWidgetStack( rightBox );
332 rightLayout->addWidget( mNavigatorBar ); 332 rightLayout->addWidget( mNavigatorBar );
333 rightLayout->addWidget( mRightFrame, 10 ); 333 rightLayout->addWidget( mRightFrame, 10 );
334 334
335 mLeftFrame = leftFrame; 335 mLeftFrame = leftFrame;
336 if ( KOPrefs::instance()->mVerticalScreen ) { 336 if ( KOPrefs::instance()->mVerticalScreen ) {
337 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 337 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
338 leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 338 leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
339 } else { 339 } else {
340 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 340 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
341 leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 341 leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
342 } 342 }
343 if ( !KOPrefs::instance()->mShowDateNavigator) 343 if ( !KOPrefs::instance()->mShowDateNavigator)
344 mDateNavigator->hide(); 344 mDateNavigator->hide();
345 //qDebug("Calendarview Size %d %d ", width(), height()); 345 //qDebug("Calendarview Size %d %d ", width(), height());
346#endif 346#endif
347 347
348 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 348 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
349 SLOT( showDates( const KCal::DateList & ) ) ); 349 SLOT( showDates( const KCal::DateList & ) ) );
350 350
351 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 351 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
352 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 352 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
353 connect( mNavigatorBar, SIGNAL( goPrevYear() ), 353 connect( mNavigatorBar, SIGNAL( goPrevYear() ),
354 mNavigator, SLOT( selectPreviousYear() ) ); 354 mNavigator, SLOT( selectPreviousYear() ) );
355 connect( mNavigatorBar, SIGNAL( goNextYear() ), 355 connect( mNavigatorBar, SIGNAL( goNextYear() ),
356 mNavigator, SLOT( selectNextYear() ) ); 356 mNavigator, SLOT( selectNextYear() ) );
357 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), 357 connect( mNavigatorBar, SIGNAL( goPrevMonth() ),
358 mNavigator, SLOT( selectPreviousMonth() ) ); 358 mNavigator, SLOT( selectPreviousMonth() ) );
359 connect( mNavigatorBar, SIGNAL( goNextMonth() ), 359 connect( mNavigatorBar, SIGNAL( goNextMonth() ),
360 mNavigator, SLOT( selectNextMonth() ) ); 360 mNavigator, SLOT( selectNextMonth() ) );
361 connect( mNavigatorBar, SIGNAL( selectWeek( int ) ), 361 connect( mNavigatorBar, SIGNAL( selectWeek( int ) ),
362 mNavigator, SLOT( selectWeek( int ) ) ); 362 mNavigator, SLOT( selectWeek( int ) ) );
363 363
364 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 364 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
365 mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); 365 mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) );
366 366
367 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 367 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
368 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 368 mNavigator, SLOT( selectWeek( const QDate & ) ) );
369 369
370 connect( mDateNavigator, SIGNAL( goPrevYear() ), 370 connect( mDateNavigator, SIGNAL( goPrevYear() ),
371 mNavigator, SLOT( selectPreviousYear() ) ); 371 mNavigator, SLOT( selectPreviousYear() ) );
372 connect( mDateNavigator, SIGNAL( goNextYear() ), 372 connect( mDateNavigator, SIGNAL( goNextYear() ),
373 mNavigator, SLOT( selectNextYear() ) ); 373 mNavigator, SLOT( selectNextYear() ) );
374 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 374 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
375 mNavigator, SLOT( selectPreviousMonth() ) ); 375 mNavigator, SLOT( selectPreviousMonth() ) );
376 connect( mDateNavigator, SIGNAL( goNextMonth() ), 376 connect( mDateNavigator, SIGNAL( goNextMonth() ),
377 mNavigator, SLOT( selectNextMonth() ) ); 377 mNavigator, SLOT( selectNextMonth() ) );
378 378
379 connect( mDateNavigator, SIGNAL( goPrevious() ), 379 connect( mDateNavigator, SIGNAL( goPrevious() ),
380 mNavigator, SLOT( selectPrevious() ) ); 380 mNavigator, SLOT( selectPrevious() ) );
381 connect( mDateNavigator, SIGNAL( goNext() ), 381 connect( mDateNavigator, SIGNAL( goNext() ),
382 mNavigator, SLOT( selectNext() ) ); 382 mNavigator, SLOT( selectNext() ) );
383 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 383 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
384 mNavigator, SLOT( slotMonthSelect( int ) ) ); 384 mNavigator, SLOT( slotMonthSelect( int ) ) );
385 connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), 385 connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ),
386 mNavigator, SLOT( slotMonthSelect( int ) ) ); 386 mNavigator, SLOT( slotMonthSelect( int ) ) );
387 387
388 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 388 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
389 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 389 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
390 390
391 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), 391 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ),
392 SLOT( eventAdded( Event *) ) ); 392 SLOT( eventAdded( Event *) ) );
393 393
394 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 394 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
395 395
396 connect( this, SIGNAL( configChanged() ), 396 connect( this, SIGNAL( configChanged() ),
397 mDateNavigator, SLOT( updateConfig() ) ); 397 mDateNavigator, SLOT( updateConfig() ) );
398 398
399 connect( mTodoList, SIGNAL( newTodoSignal() ), 399 connect( mTodoList, SIGNAL( newTodoSignal() ),
400 SLOT( newTodo() ) ); 400 SLOT( newTodo() ) );
401 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 401 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
402 SLOT( newSubTodo( Todo * ) ) ); 402 SLOT( newSubTodo( Todo * ) ) );
403 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 403 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
404 SLOT( editTodo( Todo * ) ) ); 404 SLOT( editTodo( Todo * ) ) );
405 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 405 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
406 SLOT( showTodo( Todo *) ) ); 406 SLOT( showTodo( Todo *) ) );
407 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 407 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
408 SLOT( deleteTodo( Todo *) ) ); 408 SLOT( deleteTodo( Todo *) ) );
409 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 409 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
410 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 410 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
411 SLOT( purgeCompleted() ) ); 411 SLOT( purgeCompleted() ) );
412 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 412 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
413 SIGNAL( todoModified( Todo *, int ) ) ); 413 SIGNAL( todoModified( Todo *, int ) ) );
414 414
415 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 415 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
416 this, SLOT ( cloneIncidence( Incidence * ) ) ); 416 this, SLOT ( cloneIncidence( Incidence * ) ) );
417 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 417 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
418 this, SLOT (cancelIncidence( Incidence * ) ) ); 418 this, SLOT (cancelIncidence( Incidence * ) ) );
419 419
420 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 420 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
421 this, SLOT ( moveIncidence( Incidence * ) ) ); 421 this, SLOT ( moveIncidence( Incidence * ) ) );
422 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 422 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
423 this, SLOT ( beamIncidence( Incidence * ) ) ); 423 this, SLOT ( beamIncidence( Incidence * ) ) );
424 424
425 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 425 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
426 this, SLOT ( todo_unsub( Todo * ) ) ); 426 this, SLOT ( todo_unsub( Todo * ) ) );
427 427
428 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 428 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
429 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 429 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
430 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 430 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
431 SLOT( updateTodo( Todo *, int ) ) ); 431 SLOT( updateTodo( Todo *, int ) ) );
432 connect( this, SIGNAL( todoModified( Todo *, int )), this, 432 connect( this, SIGNAL( todoModified( Todo *, int )), this,
433 SLOT( changeTodoDisplay( Todo *, int ) ) ); 433 SLOT( changeTodoDisplay( Todo *, int ) ) );
434 434
435 435
436 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 436 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
437 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 437 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
438 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 438 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
439 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 439 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
440 440
441 441
442 442
443 443
444 444
445 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 445 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
446 SLOT(checkClipboard())); 446 SLOT(checkClipboard()));
447 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 447 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
448 SLOT( processTodoListSelection( Incidence * ) ) ); 448 SLOT( processTodoListSelection( Incidence * ) ) );
449 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 449 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
450 450
451 // kdDebug() << "CalendarView::CalendarView() done" << endl; 451 // kdDebug() << "CalendarView::CalendarView() done" << endl;
452 452
453 mDateFrame = new QVBox(0,0,WType_Popup); 453 mDateFrame = new QVBox(0,0,WType_Popup);
454 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 454 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
455 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 455 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
456 mDateFrame->setLineWidth(3); 456 mDateFrame->setLineWidth(3);
457 mDateFrame->hide(); 457 mDateFrame->hide();
458 mDateFrame->setCaption( i18n( "Pick a date to display")); 458 mDateFrame->setCaption( i18n( "Pick a date to display"));
459 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 459 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
460 460
461 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 461 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
462 462
463 mEventEditor = mDialogManager->getEventEditor(); 463 mEventEditor = mDialogManager->getEventEditor();
464 mTodoEditor = mDialogManager->getTodoEditor(); 464 mTodoEditor = mDialogManager->getTodoEditor();
465 465
466 mFlagEditDescription = false; 466 mFlagEditDescription = false;
467 467
468 mSuspendTimer = new QTimer( this ); 468 mSuspendTimer = new QTimer( this );
469 mAlarmTimer = new QTimer( this ); 469 mAlarmTimer = new QTimer( this );
470 mRecheckAlarmTimer = new QTimer( this ); 470 mRecheckAlarmTimer = new QTimer( this );
471 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 471 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
472 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 472 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
473 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 473 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
474 mAlarmDialog = new AlarmDialog( this ); 474 mAlarmDialog = new AlarmDialog( this );
475 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 475 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
476 mAlarmDialog->setServerNotification( false ); 476 mAlarmDialog->setServerNotification( false );
477 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 477 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
478 478
479 479
480#ifndef DESKTOP_VERSION 480#ifndef DESKTOP_VERSION
481//US listen for arriving address resultsets 481//US listen for arriving address resultsets
482 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 482 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
483 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 483 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
484#endif 484#endif
485 485
486} 486}
487 487
488 488
489CalendarView::~CalendarView() 489CalendarView::~CalendarView()
490{ 490{
491 // kdDebug() << "~CalendarView()" << endl; 491 // kdDebug() << "~CalendarView()" << endl;
492 //qDebug("CalendarView::~CalendarView() "); 492 //qDebug("CalendarView::~CalendarView() ");
493 delete mDialogManager; 493 delete mDialogManager;
494 delete mViewManager; 494 delete mViewManager;
495 delete mStorage; 495 delete mStorage;
496 delete mDateFrame ; 496 delete mDateFrame ;
497 delete beamDialog; 497 delete beamDialog;
498 //kdDebug() << "~CalendarView() done" << endl; 498 //kdDebug() << "~CalendarView() done" << endl;
499} 499}
500 500
501void CalendarView::showDay( QDate d ) 501void CalendarView::showDay( QDate d )
502{ 502{
503 dateNavigator()->blockSignals( true ); 503 dateNavigator()->blockSignals( true );
504 dateNavigator()->selectDate( d ); 504 dateNavigator()->selectDate( d );
505 dateNavigator()->blockSignals( false ); 505 dateNavigator()->blockSignals( false );
506 mViewManager->showDayView(); 506 mViewManager->showDayView();
507 //dateNavigator()->selectDate( d ); 507 //dateNavigator()->selectDate( d );
508} 508}
509void CalendarView::timerAlarm() 509void CalendarView::timerAlarm()
510{ 510{
511 //qDebug("CalendarView::timerAlarm() "); 511 //qDebug("CalendarView::timerAlarm() ");
512 computeAlarm(mAlarmNotification ); 512 computeAlarm(mAlarmNotification );
513} 513}
514 514
515void CalendarView::suspendAlarm() 515void CalendarView::suspendAlarm()
516{ 516{
517 //qDebug(" CalendarView::suspendAlarm() "); 517 //qDebug(" CalendarView::suspendAlarm() ");
518 computeAlarm(mSuspendAlarmNotification ); 518 computeAlarm(mSuspendAlarmNotification );
519 519
520} 520}
521 521
522void CalendarView::startAlarm( QString mess , QString filename) 522void CalendarView::startAlarm( QString mess , QString filename)
523{ 523{
524 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 524 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
525 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 525 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
526 526
527} 527}
528 528
529void CalendarView::checkNextTimerAlarm() 529void CalendarView::checkNextTimerAlarm()
530{ 530{
531 mCalendar->checkAlarmForIncidence( 0, true ); 531 mCalendar->checkAlarmForIncidence( 0, true );
532} 532}
533 533
534void CalendarView::computeAlarm( QString msg ) 534void CalendarView::computeAlarm( QString msg )
535{ 535{
536 536
537 QString mess = msg; 537 QString mess = msg;
538 QString mAlarmMessage = mess.mid( 9 ); 538 QString mAlarmMessage = mess.mid( 9 );
539 QString filename = MainWindow::resourcePath(); 539 QString filename = MainWindow::resourcePath();
540 filename += "koalarm.wav"; 540 filename += "koalarm.wav";
541 QString tempfilename; 541 QString tempfilename;
542 if ( mess.left( 13 ) == "suspend_alarm") { 542 if ( mess.left( 13 ) == "suspend_alarm") {
543 bool error = false; 543 bool error = false;
544 int len = mess.mid( 13 ).find("+++"); 544 int len = mess.mid( 13 ).find("+++");
545 if ( len < 2 ) 545 if ( len < 2 )
546 error = true; 546 error = true;
547 else { 547 else {
548 tempfilename = mess.mid( 13, len ); 548 tempfilename = mess.mid( 13, len );
549 if ( !QFile::exists( tempfilename ) ) 549 if ( !QFile::exists( tempfilename ) )
550 error = true; 550 error = true;
551 } 551 }
552 if ( ! error ) { 552 if ( ! error ) {
553 filename = tempfilename; 553 filename = tempfilename;
554 } 554 }
555 mAlarmMessage = mess.mid( 13+len+3 ); 555 mAlarmMessage = mess.mid( 13+len+3 );
556 //qDebug("suspend file %s ",tempfilename.latin1() ); 556 //qDebug("suspend file %s ",tempfilename.latin1() );
557 startAlarm( mAlarmMessage, filename); 557 startAlarm( mAlarmMessage, filename);
558 return; 558 return;
559 } 559 }
560 if ( mess.left( 11 ) == "timer_alarm") { 560 if ( mess.left( 11 ) == "timer_alarm") {
561 //mTimerTime = 0; 561 //mTimerTime = 0;
562 startAlarm( mess.mid( 11 ), filename ); 562 startAlarm( mess.mid( 11 ), filename );
563 return; 563 return;
564 } 564 }
565 if ( mess.left( 10 ) == "proc_alarm") { 565 if ( mess.left( 10 ) == "proc_alarm") {
566 bool error = false; 566 bool error = false;
567 int len = mess.mid( 10 ).find("+++"); 567 int len = mess.mid( 10 ).find("+++");
568 if ( len < 2 ) 568 if ( len < 2 )
569 error = true; 569 error = true;
570 else { 570 else {
571 tempfilename = mess.mid( 10, len ); 571 tempfilename = mess.mid( 10, len );
572 if ( !QFile::exists( tempfilename ) ) 572 if ( !QFile::exists( tempfilename ) )
573 error = true; 573 error = true;
574 } 574 }
575 if ( error ) { 575 if ( error ) {
576 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 576 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
577 mAlarmMessage += mess.mid( 10+len+3+9 ); 577 mAlarmMessage += mess.mid( 10+len+3+9 );
578 } else { 578 } else {
579 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 579 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
580 //qDebug("-----system command %s ",tempfilename.latin1() ); 580 //qDebug("-----system command %s ",tempfilename.latin1() );
581#ifndef _WIN32_ 581#ifndef _WIN32_
582 if ( vfork () == 0 ) { 582 if ( vfork () == 0 ) {
583 execl ( tempfilename.latin1(), 0 ); 583 execl ( tempfilename.latin1(), 0 );
584 return; 584 return;
585 } 585 }
586#else 586#else
587 QProcess* p = new QProcess(); 587 QProcess* p = new QProcess();
588 p->addArgument( tempfilename.latin1() ); 588 p->addArgument( tempfilename.latin1() );
589 p->start(); 589 p->start();
590 return; 590 return;
591#endif 591#endif
592 592
593 return; 593 return;
594 } 594 }
595 595
596 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 596 //qDebug("+++++++system command %s ",tempfilename.latin1() );
597 } 597 }
598 if ( mess.left( 11 ) == "audio_alarm") { 598 if ( mess.left( 11 ) == "audio_alarm") {
599 bool error = false; 599 bool error = false;
600 int len = mess.mid( 11 ).find("+++"); 600 int len = mess.mid( 11 ).find("+++");
601 if ( len < 2 ) 601 if ( len < 2 )
602 error = true; 602 error = true;
603 else { 603 else {
604 tempfilename = mess.mid( 11, len ); 604 tempfilename = mess.mid( 11, len );
605 if ( !QFile::exists( tempfilename ) ) 605 if ( !QFile::exists( tempfilename ) )
606 error = true; 606 error = true;
607 } 607 }
608 if ( ! error ) { 608 if ( ! error ) {
609 filename = tempfilename; 609 filename = tempfilename;
610 } 610 }
611 mAlarmMessage = mess.mid( 11+len+3+9 ); 611 mAlarmMessage = mess.mid( 11+len+3+9 );
612 //qDebug("audio file command %s ",tempfilename.latin1() ); 612 //qDebug("audio file command %s ",tempfilename.latin1() );
613 } 613 }
614 if ( mess.left( 9 ) == "cal_alarm") { 614 if ( mess.left( 9 ) == "cal_alarm") {
615 mAlarmMessage = mess.mid( 9 ) ; 615 mAlarmMessage = mess.mid( 9 ) ;
616 } 616 }
617 617
618 startAlarm( mAlarmMessage, filename ); 618 startAlarm( mAlarmMessage, filename );
619 619
620 620
621} 621}
622 622
623void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti ) 623void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
624{ 624{
625 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 625 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
626 626
627 mSuspendAlarmNotification = noti; 627 mSuspendAlarmNotification = noti;
628 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 628 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
629 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 629 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
630 mSuspendTimer->start( ms , true ); 630 mSuspendTimer->start( ms , true );
631 631
632} 632}
633 633
634void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 634void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
635{ 635{
636 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 636 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
637 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 637 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
638#ifndef DESKTOP_VERSION 638#ifndef DESKTOP_VERSION
639 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); 639 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() );
640#endif 640#endif
641 return; 641 return;
642 } 642 }
643 int maxSec; 643 int maxSec;
644 //maxSec = 5; //testing only 644 //maxSec = 5; //testing only
645 maxSec = 86400+3600; // one day+1hour 645 maxSec = 86400+3600; // one day+1hour
646 mAlarmNotification = noti; 646 mAlarmNotification = noti;
647 int sec = QDateTime::currentDateTime().secsTo( qdt ); 647 int sec = QDateTime::currentDateTime().secsTo( qdt );
648 if ( sec > maxSec ) { 648 if ( sec > maxSec ) {
649 mRecheckAlarmTimer->start( maxSec * 1000 ); 649 mRecheckAlarmTimer->start( maxSec * 1000 );
650 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 650 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
651 return; 651 return;
652 } else { 652 } else {
653 mRecheckAlarmTimer->stop(); 653 mRecheckAlarmTimer->stop();
654 } 654 }
655 //qDebug("Alarm timer started with secs: %d ", sec); 655 //qDebug("Alarm timer started with secs: %d ", sec);
656 mAlarmTimer->start( sec *1000 , true ); 656 mAlarmTimer->start( sec *1000 , true );
657 657
658} 658}
659// called by mRecheckAlarmTimer to get next alarm 659// called by mRecheckAlarmTimer to get next alarm
660// we need this, because a QTimer has only a max range of 25 days 660// we need this, because a QTimer has only a max range of 25 days
661void CalendarView::recheckTimerAlarm() 661void CalendarView::recheckTimerAlarm()
662{ 662{
663 mAlarmTimer->stop(); 663 mAlarmTimer->stop();
664 mRecheckAlarmTimer->stop(); 664 mRecheckAlarmTimer->stop();
665 mCalendar->checkAlarmForIncidence( 0, true ); 665 mCalendar->checkAlarmForIncidence( 0, true );
666} 666}
667void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti ) 667void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
668{ 668{
669 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 669 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
670 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 670 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
671#ifndef DESKTOP_VERSION 671#ifndef DESKTOP_VERSION
672 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); 672 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() );
673#endif 673#endif
674 return; 674 return;
675 } 675 }
676 mAlarmTimer->stop(); 676 mAlarmTimer->stop();
677} 677}
678void CalendarView::selectWeekNum ( int num ) 678void CalendarView::selectWeekNum ( int num )
679{ 679{
680 dateNavigator()->blockSignals( true ); 680 dateNavigator()->blockSignals( true );
681 dateNavigator()->selectWeek( num ); 681 dateNavigator()->selectWeek( num );
682 dateNavigator()->blockSignals( false ); 682 dateNavigator()->blockSignals( false );
683 mViewManager->showWeekView(); 683 mViewManager->showWeekView();
684} 684}
685KOViewManager *CalendarView::viewManager() 685KOViewManager *CalendarView::viewManager()
686{ 686{
687 return mViewManager; 687 return mViewManager;
688} 688}
689 689
690KODialogManager *CalendarView::dialogManager() 690KODialogManager *CalendarView::dialogManager()
691{ 691{
692 return mDialogManager; 692 return mDialogManager;
693} 693}
694 694
695QDate CalendarView::startDate() 695QDate CalendarView::startDate()
696{ 696{
697 DateList dates = mNavigator->selectedDates(); 697 DateList dates = mNavigator->selectedDates();
698 698
699 return dates.first(); 699 return dates.first();
700} 700}
701 701
702QDate CalendarView::endDate() 702QDate CalendarView::endDate()
703{ 703{
704 DateList dates = mNavigator->selectedDates(); 704 DateList dates = mNavigator->selectedDates();
705 705
706 return dates.last(); 706 return dates.last();
707} 707}
708 708
709 709
710void CalendarView::createPrinter() 710void CalendarView::createPrinter()
711{ 711{
712#ifndef KORG_NOPRINTER 712#ifndef KORG_NOPRINTER
713 if (!mCalPrinter) { 713 if (!mCalPrinter) {
714 mCalPrinter = new CalPrinter(this, mCalendar); 714 mCalPrinter = new CalPrinter(this, mCalendar);
715 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); 715 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig()));
716 } 716 }
717#endif 717#endif
718} 718}
719 719
720 720
721//KOPrefs::instance()->mWriteBackFile 721//KOPrefs::instance()->mWriteBackFile
722//KOPrefs::instance()->mWriteBackExistingOnly 722//KOPrefs::instance()->mWriteBackExistingOnly
723 723
724// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 724// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
725// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 725// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
726// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 726// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
727// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 727// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
728// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 728// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
729// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 729// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
730 730
731int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) 731int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full )
732{ 732{
733 733
734 // 0 equal 734 // 0 equal
735 // 1 take local 735 // 1 take local
736 // 2 take remote 736 // 2 take remote
737 // 3 cancel 737 // 3 cancel
738 QDateTime lastSync = mLastCalendarSync; 738 QDateTime lastSync = mLastCalendarSync;
739 QDateTime localMod = local->lastModified(); 739 QDateTime localMod = local->lastModified();
740 QDateTime remoteMod = remote->lastModified(); 740 QDateTime remoteMod = remote->lastModified();
741 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 741 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
742 bool remCh, locCh; 742 bool remCh, locCh;
743 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 743 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
744 //if ( remCh ) 744 //if ( remCh )
745 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 745 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
746 locCh = ( localMod > mLastCalendarSync ); 746 locCh = ( localMod > mLastCalendarSync );
747 if ( !remCh && ! locCh ) { 747 if ( !remCh && ! locCh ) {
748 //qDebug("both not changed "); 748 //qDebug("both not changed ");
749 lastSync = localMod.addDays(1); 749 lastSync = localMod.addDays(1);
750 if ( mode <= SYNC_PREF_ASK ) 750 if ( mode <= SYNC_PREF_ASK )
751 return 0; 751 return 0;
752 } else { 752 } else {
753 if ( locCh ) { 753 if ( locCh ) {
754 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); 754 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1());
755 lastSync = localMod.addDays( -1 ); 755 lastSync = localMod.addDays( -1 );
756 if ( !remCh ) 756 if ( !remCh )
757 remoteMod = ( lastSync.addDays( -1 ) ); 757 remoteMod = ( lastSync.addDays( -1 ) );
758 } else { 758 } else {
759 //qDebug(" not loc changed "); 759 //qDebug(" not loc changed ");
760 lastSync = localMod.addDays( 1 ); 760 lastSync = localMod.addDays( 1 );
761 if ( remCh ) 761 if ( remCh )
762 remoteMod =( lastSync.addDays( 1 ) ); 762 remoteMod =( lastSync.addDays( 1 ) );
763 763
764 } 764 }
765 } 765 }
766 full = true; 766 full = true;
767 if ( mode < SYNC_PREF_ASK ) 767 if ( mode < SYNC_PREF_ASK )
768 mode = SYNC_PREF_ASK; 768 mode = SYNC_PREF_ASK;
769 } else { 769 } else {
770 if ( localMod == remoteMod ) 770 if ( localMod == remoteMod )
771 // if ( local->revision() == remote->revision() ) 771 // if ( local->revision() == remote->revision() )
772 return 0; 772 return 0;
773 773
774 } 774 }
775 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 775 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
776 776
777 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); 777 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision());
778 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); 778 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() );
779 //full = true; //debug only 779 //full = true; //debug only
780 if ( full ) { 780 if ( full ) {
781 bool equ = false; 781 bool equ = false;
782 if ( local->type() == "Event" ) { 782 if ( local->type() == "Event" ) {
783 equ = (*((Event*) local) == *((Event*) remote)); 783 equ = (*((Event*) local) == *((Event*) remote));
784 } 784 }
785 else if ( local->type() =="Todo" ) 785 else if ( local->type() =="Todo" )
786 equ = (*((Todo*) local) == (*(Todo*) remote)); 786 equ = (*((Todo*) local) == (*(Todo*) remote));
787 else if ( local->type() =="Journal" ) 787 else if ( local->type() =="Journal" )
788 equ = (*((Journal*) local) == *((Journal*) remote)); 788 equ = (*((Journal*) local) == *((Journal*) remote));
789 if ( equ ) { 789 if ( equ ) {
790 //qDebug("equal "); 790 //qDebug("equal ");
791 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 791 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
792 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 792 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
793 } 793 }
794 if ( mode < SYNC_PREF_FORCE_LOCAL ) 794 if ( mode < SYNC_PREF_FORCE_LOCAL )
795 return 0; 795 return 0;
796 796
797 }//else //debug only 797 }//else //debug only
798 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 798 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
799 } 799 }
800 int result; 800 int result;
801 bool localIsNew; 801 bool localIsNew;
802 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); 802 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() );
803 803
804 if ( full && mode < SYNC_PREF_NEWEST ) 804 if ( full && mode < SYNC_PREF_NEWEST )
805 mode = SYNC_PREF_ASK; 805 mode = SYNC_PREF_ASK;
806 806
807 switch( mode ) { 807 switch( mode ) {
808 case SYNC_PREF_LOCAL: 808 case SYNC_PREF_LOCAL:
809 if ( lastSync > remoteMod ) 809 if ( lastSync > remoteMod )
810 return 1; 810 return 1;
811 if ( lastSync > localMod ) 811 if ( lastSync > localMod )
812 return 2; 812 return 2;
813 return 1; 813 return 1;
814 break; 814 break;
815 case SYNC_PREF_REMOTE: 815 case SYNC_PREF_REMOTE:
816 if ( lastSync > remoteMod ) 816 if ( lastSync > remoteMod )
817 return 1; 817 return 1;
818 if ( lastSync > localMod ) 818 if ( lastSync > localMod )
819 return 2; 819 return 2;
820 return 2; 820 return 2;
821 break; 821 break;
822 case SYNC_PREF_NEWEST: 822 case SYNC_PREF_NEWEST:
823 if ( localMod > remoteMod ) 823 if ( localMod > remoteMod )
824 return 1; 824 return 1;
825 else 825 else
826 return 2; 826 return 2;
827 break; 827 break;
828 case SYNC_PREF_ASK: 828 case SYNC_PREF_ASK:
829 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 829 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
830 if ( lastSync > remoteMod ) 830 if ( lastSync > remoteMod )
831 return 1; 831 return 1;
832 if ( lastSync > localMod ) 832 if ( lastSync > localMod )
833 return 2; 833 return 2;
834 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 834 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
835 localIsNew = localMod >= remoteMod; 835 localIsNew = localMod >= remoteMod;
836 if ( localIsNew ) 836 if ( localIsNew )
837 getEventViewerDialog()->setColorMode( 1 ); 837 getEventViewerDialog()->setColorMode( 1 );
838 else 838 else
839 getEventViewerDialog()->setColorMode( 2 ); 839 getEventViewerDialog()->setColorMode( 2 );
840 getEventViewerDialog()->setIncidence(local); 840 getEventViewerDialog()->setIncidence(local);
841 if ( localIsNew ) 841 if ( localIsNew )
842 getEventViewerDialog()->setColorMode( 2 ); 842 getEventViewerDialog()->setColorMode( 2 );
843 else 843 else
844 getEventViewerDialog()->setColorMode( 1 ); 844 getEventViewerDialog()->setColorMode( 1 );
845 getEventViewerDialog()->addIncidence(remote); 845 getEventViewerDialog()->addIncidence(remote);
846 getEventViewerDialog()->setColorMode( 0 ); 846 getEventViewerDialog()->setColorMode( 0 );
847 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); 847 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() );
848 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); 848 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!"));
849 getEventViewerDialog()->showMe(); 849 getEventViewerDialog()->showMe();
850 result = getEventViewerDialog()->executeS( localIsNew ); 850 result = getEventViewerDialog()->executeS( localIsNew );
851 return result; 851 return result;
852 852
853 break; 853 break;
854 case SYNC_PREF_FORCE_LOCAL: 854 case SYNC_PREF_FORCE_LOCAL:
855 return 1; 855 return 1;
856 break; 856 break;
857 case SYNC_PREF_FORCE_REMOTE: 857 case SYNC_PREF_FORCE_REMOTE:
858 return 2; 858 return 2;
859 break; 859 break;
860 860
861 default: 861 default:
862 // SYNC_PREF_TAKE_BOTH not implemented 862 // SYNC_PREF_TAKE_BOTH not implemented
863 break; 863 break;
864 } 864 }
865 return 0; 865 return 0;
866} 866}
867Event* CalendarView::getLastSyncEvent() 867Event* CalendarView::getLastSyncEvent()
868{ 868{
869 Event* lse; 869 Event* lse;
870 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 870 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
871 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); 871 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice );
872 if (!lse) { 872 if (!lse) {
873 lse = new Event(); 873 lse = new Event();
874 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); 874 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice );
875 QString sum = ""; 875 QString sum = "";
876 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) 876 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
877 sum = "E: "; 877 sum = "E: ";
878 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); 878 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
879 lse->setDtStart( mLastCalendarSync ); 879 lse->setDtStart( mLastCalendarSync );
880 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 880 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
881 lse->setCategories( i18n("SyncEvent") ); 881 lse->setCategories( i18n("SyncEvent") );
882 lse->setReadOnly( true ); 882 lse->setReadOnly( true );
883 mCalendar->addEvent( lse ); 883 mCalendar->addEvent( lse );
884 } 884 }
885 885
886 return lse; 886 return lse;
887 887
888} 888}
889 889
890// we check, if the to delete event has a id for a profile 890// we check, if the to delete event has a id for a profile
891// if yes, we set this id in the profile to delete 891// if yes, we set this id in the profile to delete
892void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) 892void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete )
893{ 893{
894 if ( lastSync.count() == 0 ) { 894 if ( lastSync.count() == 0 ) {
895 //qDebug(" lastSync.count() == 0"); 895 //qDebug(" lastSync.count() == 0");
896 return; 896 return;
897 } 897 }
898 if ( toDelete->type() == "Journal" ) 898 if ( toDelete->type() == "Journal" )
899 return; 899 return;
900 900
901 Event* eve = lastSync.first(); 901 Event* eve = lastSync.first();
902 902
903 while ( eve ) { 903 while ( eve ) {
904 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name 904 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
905 if ( !id.isEmpty() ) { 905 if ( !id.isEmpty() ) {
906 QString des = eve->description(); 906 QString des = eve->description();
907 QString pref = "e"; 907 QString pref = "e";
908 if ( toDelete->type() == "Todo" ) 908 if ( toDelete->type() == "Todo" )
909 pref = "t"; 909 pref = "t";
910 des += pref+ id + ","; 910 des += pref+ id + ",";
911 eve->setReadOnly( false ); 911 eve->setReadOnly( false );
912 eve->setDescription( des ); 912 eve->setDescription( des );
913 //qDebug("setdes %s ", des.latin1()); 913 //qDebug("setdes %s ", des.latin1());
914 eve->setReadOnly( true ); 914 eve->setReadOnly( true );
915 } 915 }
916 eve = lastSync.next(); 916 eve = lastSync.next();
917 } 917 }
918 918
919} 919}
920void CalendarView::checkExternalId( Incidence * inc ) 920void CalendarView::checkExternalId( Incidence * inc )
921{ 921{
922 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; 922 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ;
923 checkExternSyncEvent( lastSync, inc ); 923 checkExternSyncEvent( lastSync, inc );
924 924
925} 925}
926bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) 926bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
927{ 927{
928 bool syncOK = true; 928 bool syncOK = true;
929 int addedEvent = 0; 929 int addedEvent = 0;
930 int addedEventR = 0; 930 int addedEventR = 0;
931 int deletedEventR = 0; 931 int deletedEventR = 0;
932 int deletedEventL = 0; 932 int deletedEventL = 0;
933 int changedLocal = 0; 933 int changedLocal = 0;
934 int changedRemote = 0; 934 int changedRemote = 0;
935 int filteredIN = 0; 935 int filteredIN = 0;
936 int filteredOUT = 0; 936 int filteredOUT = 0;
937 //QPtrList<Event> el = local->rawEvents(); 937 //QPtrList<Event> el = local->rawEvents();
938 Event* eventR; 938 Event* eventR;
939 QString uid; 939 QString uid;
940 int take; 940 int take;
941 Event* eventL; 941 Event* eventL;
942 Event* eventRSync; 942 Event* eventRSync;
943 Event* eventLSync; 943 Event* eventLSync;
944 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); 944 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
945 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); 945 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
946 bool fullDateRange = false; 946 bool fullDateRange = false;
947 local->resetTempSyncStat(); 947 local->resetTempSyncStat();
948 mLastCalendarSync = QDateTime::currentDateTime(); 948 mLastCalendarSync = QDateTime::currentDateTime();
949 if ( mSyncManager->syncWithDesktop() ) { 949 if ( mSyncManager->syncWithDesktop() ) {
950 remote->resetPilotStat(1); 950 remote->resetPilotStat(1);
951 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 951 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
952 mLastCalendarSync = KSyncManager::mRequestedSyncEvent; 952 mLastCalendarSync = KSyncManager::mRequestedSyncEvent;
953 qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); 953 qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() );
954 } else { 954 } else {
955 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); 955 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime ");
956 } 956 }
957 } 957 }
958 QDateTime modifiedCalendar = mLastCalendarSync; 958 QDateTime modifiedCalendar = mLastCalendarSync;
959 eventLSync = getLastSyncEvent(); 959 eventLSync = getLastSyncEvent();
960 eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); 960 eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
961 if ( eventR ) { 961 if ( eventR ) {
962 eventRSync = (Event*) eventR->clone(); 962 eventRSync = (Event*) eventR->clone();
963 remote->deleteEvent(eventR ); 963 remote->deleteEvent(eventR );
964 964
965 } else { 965 } else {
966 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { 966 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) {
967 eventRSync = (Event*)eventLSync->clone(); 967 eventRSync = (Event*)eventLSync->clone();
968 } else { 968 } else {
969 fullDateRange = true; 969 fullDateRange = true;
970 eventRSync = new Event(); 970 eventRSync = new Event();
971 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); 971 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
972 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); 972 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName );
973 eventRSync->setDtStart( mLastCalendarSync ); 973 eventRSync->setDtStart( mLastCalendarSync );
974 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 974 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
975 eventRSync->setCategories( i18n("SyncEvent") ); 975 eventRSync->setCategories( i18n("SyncEvent") );
976 } 976 }
977 } 977 }
978 if ( eventLSync->dtStart() == mLastCalendarSync ) 978 if ( eventLSync->dtStart() == mLastCalendarSync )
979 fullDateRange = true; 979 fullDateRange = true;
980 980
981 if ( ! fullDateRange ) { 981 if ( ! fullDateRange ) {
982 if ( eventLSync->dtStart() != eventRSync->dtStart() ) { 982 if ( eventLSync->dtStart() != eventRSync->dtStart() ) {
983 983
984 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); 984 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() );
985 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); 985 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec());
986 fullDateRange = true; 986 fullDateRange = true;
987 } 987 }
988 } 988 }
989 if ( mSyncManager->syncWithDesktop() ) { 989 if ( mSyncManager->syncWithDesktop() ) {
990 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); 990 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync );
991 } 991 }
992 if ( fullDateRange ) 992 if ( fullDateRange )
993 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); 993 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
994 else 994 else
995 mLastCalendarSync = eventLSync->dtStart(); 995 mLastCalendarSync = eventLSync->dtStart();
996 // for resyncing if own file has changed 996 // for resyncing if own file has changed
997 if ( mCurrentSyncDevice == "deleteaftersync" ) { 997 if ( mCurrentSyncDevice == "deleteaftersync" ) {
998 mLastCalendarSync = loadedFileVersion; 998 mLastCalendarSync = loadedFileVersion;
999 //qDebug("setting mLastCalendarSync "); 999 //qDebug("setting mLastCalendarSync ");
1000 } 1000 }
1001 //qDebug("*************************** "); 1001 //qDebug("*************************** ");
1002 qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); 1002 qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange);
1003 QPtrList<Incidence> er = remote->rawIncidences(); 1003 QPtrList<Incidence> er = remote->rawIncidences();
1004 Incidence* inR = er.first(); 1004 Incidence* inR = er.first();
1005 Incidence* inL; 1005 Incidence* inL;
1006 QProgressBar bar( er.count(),0 ); 1006 QProgressBar bar( er.count(),0 );
1007 bar.setCaption (i18n("Syncing - close to abort!") ); 1007 bar.setCaption (i18n("Syncing - close to abort!") );
1008 1008
1009 // ************** setting up filter ************* 1009 // ************** setting up filter *************
1010 CalFilter *filterIN = 0; 1010 CalFilter *filterIN = 0;
1011 CalFilter *filterOUT = 0; 1011 CalFilter *filterOUT = 0;
1012 CalFilter *filter = mFilters.first(); 1012 CalFilter *filter = mFilters.first();
1013 while(filter) { 1013 while(filter) {
1014 if ( filter->name() == mSyncManager->mFilterInCal ) 1014 if ( filter->name() == mSyncManager->mFilterInCal )
1015 filterIN = filter; 1015 filterIN = filter;
1016 if ( filter->name() == mSyncManager->mFilterOutCal ) 1016 if ( filter->name() == mSyncManager->mFilterOutCal )
1017 filterOUT = filter; 1017 filterOUT = filter;
1018 filter = mFilters.next(); 1018 filter = mFilters.next();
1019 } 1019 }
1020 int w = 300; 1020 int w = 300;
1021 if ( QApplication::desktop()->width() < 320 ) 1021 if ( QApplication::desktop()->width() < 320 )
1022 w = 220; 1022 w = 220;
1023 int h = bar.sizeHint().height() ; 1023 int h = bar.sizeHint().height() ;
1024 int dw = QApplication::desktop()->width(); 1024 int dw = QApplication::desktop()->width();
1025 int dh = QApplication::desktop()->height(); 1025 int dh = QApplication::desktop()->height();
1026 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1026 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1027 bar.show(); 1027 bar.show();
1028 int modulo = (er.count()/10)+1; 1028 int modulo = (er.count()/10)+1;
1029 int incCounter = 0; 1029 int incCounter = 0;
1030 while ( inR ) { 1030 while ( inR ) {
1031 if ( ! bar.isVisible() ) 1031 if ( ! bar.isVisible() )
1032 return false; 1032 return false;
1033 if ( incCounter % modulo == 0 ) 1033 if ( incCounter % modulo == 0 )
1034 bar.setProgress( incCounter ); 1034 bar.setProgress( incCounter );
1035 ++incCounter; 1035 ++incCounter;
1036 uid = inR->uid(); 1036 uid = inR->uid();
1037 bool skipIncidence = false; 1037 bool skipIncidence = false;
1038 if ( uid.left(15) == QString("last-syncEvent-") ) 1038 if ( uid.left(15) == QString("last-syncEvent-") )
1039 skipIncidence = true; 1039 skipIncidence = true;
1040 QString idS; 1040 QString idS;
1041 qApp->processEvents(); 1041 qApp->processEvents();
1042 if ( !skipIncidence ) { 1042 if ( !skipIncidence ) {
1043 inL = local->incidence( uid ); 1043 inL = local->incidence( uid );
1044 if ( inL ) { // maybe conflict - same uid in both calendars 1044 if ( inL ) { // maybe conflict - same uid in both calendars
1045 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { 1045 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) {
1046 //qDebug("take %d %s ", take, inL->summary().latin1()); 1046 //qDebug("take %d %s ", take, inL->summary().latin1());
1047 if ( take == 3 ) 1047 if ( take == 3 )
1048 return false; 1048 return false;
1049 if ( take == 1 ) {// take local ********************** 1049 if ( take == 1 ) {// take local **********************
1050 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 1050 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
1051 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1051 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1052 else 1052 else
1053 idS = inR->IDStr(); 1053 idS = inR->IDStr();
1054 remote->deleteIncidence( inR ); 1054 remote->deleteIncidence( inR );
1055 inR = inL->clone(); 1055 inR = inL->clone();
1056 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1056 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1057 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) 1057 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL )
1058 inR->setIDStr( idS ); 1058 inR->setIDStr( idS );
1059 remote->addIncidence( inR ); 1059 remote->addIncidence( inR );
1060 if ( mSyncManager->syncWithDesktop() ) 1060 if ( mSyncManager->syncWithDesktop() )
1061 inR->setPilotId( 2 ); 1061 inR->setPilotId( 2 );
1062 ++changedRemote; 1062 ++changedRemote;
1063 } else {// take remote ********************** 1063 } else {// take remote **********************
1064 idS = inL->IDStr(); 1064 idS = inL->IDStr();
1065 int pid = inL->pilotId(); 1065 int pid = inL->pilotId();
1066 local->deleteIncidence( inL ); 1066 local->deleteIncidence( inL );
1067 inL = inR->clone(); 1067 inL = inR->clone();
1068 if ( mSyncManager->syncWithDesktop() ) 1068 if ( mSyncManager->syncWithDesktop() )
1069 inL->setPilotId( pid ); 1069 inL->setPilotId( pid );
1070 inL->setIDStr( idS ); 1070 inL->setIDStr( idS );
1071 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1071 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1072 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1072 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1073 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1073 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1074 } 1074 }
1075 local->addIncidence( inL ); 1075 local->addIncidence( inL );
1076 ++changedLocal; 1076 ++changedLocal;
1077 } 1077 }
1078 } 1078 }
1079 } else { // no conflict ********** add or delete remote 1079 } else { // no conflict ********** add or delete remote
1080 if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ 1080 if ( !filterIN || filterIN->filterCalendarItem( inR ) ){
1081 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1081 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1082 QString des = eventLSync->description(); 1082 QString des = eventLSync->description();
1083 QString pref = "e"; 1083 QString pref = "e";
1084 if ( inR->type() == "Todo" ) 1084 if ( inR->type() == "Todo" )
1085 pref = "t"; 1085 pref = "t";
1086 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 1086 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
1087 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 1087 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
1088 //remote->deleteIncidence( inR ); 1088 //remote->deleteIncidence( inR );
1089 ++deletedEventR; 1089 ++deletedEventR;
1090 } else { 1090 } else {
1091 inR->setLastModified( modifiedCalendar ); 1091 inR->setLastModified( modifiedCalendar );
1092 inL = inR->clone(); 1092 inL = inR->clone();
1093 inL->setIDStr( ":" ); 1093 inL->setIDStr( ":" );
1094 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1094 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1095 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1095 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1096 local->addIncidence( inL ); 1096 local->addIncidence( inL );
1097 ++addedEvent; 1097 ++addedEvent;
1098 1098
1099 } 1099 }
1100 } else { 1100 } else {
1101 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { 1101 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
1102 inR->setLastModified( modifiedCalendar ); 1102 inR->setLastModified( modifiedCalendar );
1103 inL = inR->clone(); 1103 inL = inR->clone();
1104 inL->setIDStr( ":" ); 1104 inL->setIDStr( ":" );
1105 local->addIncidence( inL ); 1105 local->addIncidence( inL );
1106 ++addedEvent; 1106 ++addedEvent;
1107 1107
1108 } else { 1108 } else {
1109 checkExternSyncEvent(eventRSyncSharp, inR); 1109 checkExternSyncEvent(eventRSyncSharp, inR);
1110 remote->deleteIncidence( inR ); 1110 remote->deleteIncidence( inR );
1111 ++deletedEventR; 1111 ++deletedEventR;
1112 } 1112 }
1113 } 1113 }
1114 } else { 1114 } else {
1115 ++filteredIN; 1115 ++filteredIN;
1116 } 1116 }
1117 } 1117 }
1118 } 1118 }
1119 inR = er.next(); 1119 inR = er.next();
1120 } 1120 }
1121 QPtrList<Incidence> el = local->rawIncidences(); 1121 QPtrList<Incidence> el = local->rawIncidences();
1122 inL = el.first(); 1122 inL = el.first();
1123 modulo = (el.count()/10)+1; 1123 modulo = (el.count()/10)+1;
1124 bar.setCaption (i18n("Add / remove events") ); 1124 bar.setCaption (i18n("Add / remove events") );
1125 bar.setTotalSteps ( el.count() ) ; 1125 bar.setTotalSteps ( el.count() ) ;
1126 bar.show(); 1126 bar.show();
1127 incCounter = 0; 1127 incCounter = 0;
1128 1128
1129 while ( inL ) { 1129 while ( inL ) {
1130 1130
1131 qApp->processEvents(); 1131 qApp->processEvents();
1132 if ( ! bar.isVisible() ) 1132 if ( ! bar.isVisible() )
1133 return false; 1133 return false;
1134 if ( incCounter % modulo == 0 ) 1134 if ( incCounter % modulo == 0 )
1135 bar.setProgress( incCounter ); 1135 bar.setProgress( incCounter );
1136 ++incCounter; 1136 ++incCounter;
1137 uid = inL->uid(); 1137 uid = inL->uid();
1138 bool skipIncidence = false; 1138 bool skipIncidence = false;
1139 if ( uid.left(15) == QString("last-syncEvent-") ) 1139 if ( uid.left(15) == QString("last-syncEvent-") )
1140 skipIncidence = true; 1140 skipIncidence = true;
1141 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) 1141 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
1142 skipIncidence = true; 1142 skipIncidence = true;
1143 if ( !skipIncidence ) { 1143 if ( !skipIncidence ) {
1144 inR = remote->incidence( uid ); 1144 inR = remote->incidence( uid );
1145 if ( ! inR ) { 1145 if ( ! inR ) {
1146 if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ 1146 if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){
1147 // no conflict ********** add or delete local 1147 // no conflict ********** add or delete local
1148 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1148 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1149 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 1149 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
1150 checkExternSyncEvent(eventLSyncSharp, inL); 1150 checkExternSyncEvent(eventLSyncSharp, inL);
1151 local->deleteIncidence( inL ); 1151 local->deleteIncidence( inL );
1152 ++deletedEventL; 1152 ++deletedEventL;
1153 } else { 1153 } else {
1154 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1154 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1155 inL->removeID(mCurrentSyncDevice ); 1155 inL->removeID(mCurrentSyncDevice );
1156 ++addedEventR; 1156 ++addedEventR;
1157 //qDebug("remote added Incidence %s ", inL->summary().latin1()); 1157 //qDebug("remote added Incidence %s ", inL->summary().latin1());
1158 inL->setLastModified( modifiedCalendar ); 1158 inL->setLastModified( modifiedCalendar );
1159 inR = inL->clone(); 1159 inR = inL->clone();
1160 inR->setIDStr( ":" ); 1160 inR->setIDStr( ":" );
1161 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1161 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1162 remote->addIncidence( inR ); 1162 remote->addIncidence( inR );
1163 } 1163 }
1164 } 1164 }
1165 } else { 1165 } else {
1166 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { 1166 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
1167 checkExternSyncEvent(eventLSyncSharp, inL); 1167 checkExternSyncEvent(eventLSyncSharp, inL);
1168 local->deleteIncidence( inL ); 1168 local->deleteIncidence( inL );
1169 ++deletedEventL; 1169 ++deletedEventL;
1170 } else { 1170 } else {
1171 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1171 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1172 ++addedEventR; 1172 ++addedEventR;
1173 inL->setLastModified( modifiedCalendar ); 1173 inL->setLastModified( modifiedCalendar );
1174 inR = inL->clone(); 1174 inR = inL->clone();
1175 inR->setIDStr( ":" ); 1175 inR->setIDStr( ":" );
1176 remote->addIncidence( inR ); 1176 remote->addIncidence( inR );
1177 } 1177 }
1178 } 1178 }
1179 } 1179 }
1180 } else { 1180 } else {
1181 ++filteredOUT; 1181 ++filteredOUT;
1182 } 1182 }
1183 } 1183 }
1184 } 1184 }
1185 inL = el.next(); 1185 inL = el.next();
1186 } 1186 }
1187 int delFut = 0; 1187 int delFut = 0;
1188 int remRem = 0; 1188 int remRem = 0;
1189 if ( mSyncManager->mWriteBackInFuture ) { 1189 if ( mSyncManager->mWriteBackInFuture ) {
1190 er = remote->rawIncidences(); 1190 er = remote->rawIncidences();
1191 remRem = er.count(); 1191 remRem = er.count();
1192 inR = er.first(); 1192 inR = er.first();
1193 QDateTime dt; 1193 QDateTime dt;
1194 QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); 1194 QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) );
1195 QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); 1195 QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 );
1196 while ( inR ) { 1196 while ( inR ) {
1197 if ( inR->type() == "Todo" ) { 1197 if ( inR->type() == "Todo" ) {
1198 Todo * t = (Todo*)inR; 1198 Todo * t = (Todo*)inR;
1199 if ( t->hasDueDate() ) 1199 if ( t->hasDueDate() )
1200 dt = t->dtDue(); 1200 dt = t->dtDue();
1201 else 1201 else
1202 dt = cur.addSecs( 62 ); 1202 dt = cur.addSecs( 62 );
1203 } 1203 }
1204 else if (inR->type() == "Event" ) { 1204 else if (inR->type() == "Event" ) {
1205 bool ok; 1205 bool ok;
1206 dt = inR->getNextOccurence( cur, &ok ); 1206 dt = inR->getNextOccurence( cur, &ok );
1207 if ( !ok ) 1207 if ( !ok )
1208 dt = cur.addSecs( -62 ); 1208 dt = cur.addSecs( -62 );
1209 } 1209 }
1210 else 1210 else
1211 dt = inR->dtStart(); 1211 dt = inR->dtStart();
1212 if ( dt < cur || dt > end ) { 1212 if ( dt < cur || dt > end ) {
1213 remote->deleteIncidence( inR ); 1213 remote->deleteIncidence( inR );
1214 ++delFut; 1214 ++delFut;
1215 } 1215 }
1216 inR = er.next(); 1216 inR = er.next();
1217 } 1217 }
1218 } 1218 }
1219 bar.hide(); 1219 bar.hide();
1220 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1220 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1221 eventLSync->setReadOnly( false ); 1221 eventLSync->setReadOnly( false );
1222 eventLSync->setDtStart( mLastCalendarSync ); 1222 eventLSync->setDtStart( mLastCalendarSync );
1223 eventRSync->setDtStart( mLastCalendarSync ); 1223 eventRSync->setDtStart( mLastCalendarSync );
1224 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1224 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1225 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1225 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1226 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1226 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1227 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1227 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1228 eventLSync->setReadOnly( true ); 1228 eventLSync->setReadOnly( true );
1229 qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL ); 1229 qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL );
1230 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... 1230 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal...
1231 remote->addEvent( eventRSync ); 1231 remote->addEvent( eventRSync );
1232 else 1232 else
1233 delete eventRSync; 1233 delete eventRSync;
1234 qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() ); 1234 qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() );
1235 QString mes; 1235 QString mes;
1236 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT ); 1236 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT );
1237 QString delmess; 1237 QString delmess;
1238 if ( delFut ) { 1238 if ( delFut ) {
1239 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut); 1239 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut);
1240 mes += delmess; 1240 mes += delmess;
1241 } 1241 }
1242 mes = i18n("Local calendar changed!\n") +mes; 1242 mes = i18n("Local calendar changed!\n") +mes;
1243 mCalendar->checkAlarmForIncidence( 0, true ); 1243 mCalendar->checkAlarmForIncidence( 0, true );
1244 qDebug( mes ); 1244 qDebug( mes );
1245 if ( mSyncManager->mShowSyncSummary ) { 1245 if ( mSyncManager->mShowSyncSummary ) {
1246 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, 1246 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
1247 i18n("KO/Pi Synchronization"),i18n("Write back"))) { 1247 i18n("KO/Pi Synchronization"),i18n("Write back"))) {
1248 qDebug("KO: WB cancelled "); 1248 qDebug("KO: WB cancelled ");
1249 return false; 1249 return false;
1250 } 1250 }
1251 } 1251 }
1252 return syncOK; 1252 return syncOK;
1253} 1253}
1254 1254
1255void CalendarView::setSyncDevice( QString s ) 1255void CalendarView::setSyncDevice( QString s )
1256{ 1256{
1257 mCurrentSyncDevice= s; 1257 mCurrentSyncDevice= s;
1258} 1258}
1259void CalendarView::setSyncName( QString s ) 1259void CalendarView::setSyncName( QString s )
1260{ 1260{
1261 mCurrentSyncName= s; 1261 mCurrentSyncName= s;
1262} 1262}
1263bool CalendarView::syncCalendar(QString filename, int mode) 1263bool CalendarView::syncCalendar(QString filename, int mode)
1264{ 1264{
1265 //qDebug("syncCalendar %s ", filename.latin1()); 1265 //qDebug("syncCalendar %s ", filename.latin1());
1266 mGlobalSyncMode = SYNC_MODE_NORMAL; 1266 mGlobalSyncMode = SYNC_MODE_NORMAL;
1267 CalendarLocal* calendar = new CalendarLocal(); 1267 CalendarLocal* calendar = new CalendarLocal();
1268 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1268 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1269 FileStorage* storage = new FileStorage( calendar ); 1269 FileStorage* storage = new FileStorage( calendar );
1270 bool syncOK = false; 1270 bool syncOK = false;
1271 storage->setFileName( filename ); 1271 storage->setFileName( filename );
1272 // qDebug("loading ... "); 1272 // qDebug("loading ... ");
1273 if ( storage->load() ) { 1273 if ( storage->load() ) {
1274 getEventViewerDialog()->setSyncMode( true ); 1274 getEventViewerDialog()->setSyncMode( true );
1275 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1275 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1276 getEventViewerDialog()->setSyncMode( false ); 1276 getEventViewerDialog()->setSyncMode( false );
1277 if ( syncOK ) { 1277 if ( syncOK ) {
1278 if ( mSyncManager->mWriteBackFile ) 1278 if ( mSyncManager->mWriteBackFile )
1279 { 1279 {
1280 storage->setSaveFormat( new ICalFormat() ); 1280 storage->setSaveFormat( new ICalFormat() );
1281 storage->save(); 1281 storage->save();
1282 } 1282 }
1283 } 1283 }
1284 setModified( true ); 1284 setModified( true );
1285 } 1285 }
1286 delete storage; 1286 delete storage;
1287 delete calendar; 1287 delete calendar;
1288 if ( syncOK ) 1288 if ( syncOK )
1289 updateView(); 1289 updateView();
1290 return syncOK; 1290 return syncOK;
1291} 1291}
1292 1292
1293void CalendarView::syncExternal( int mode ) 1293void CalendarView::syncExternal( int mode )
1294{ 1294{
1295 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1295 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1296 1296
1297 qApp->processEvents(); 1297 qApp->processEvents();
1298 CalendarLocal* calendar = new CalendarLocal(); 1298 CalendarLocal* calendar = new CalendarLocal();
1299 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1299 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1300 bool syncOK = false; 1300 bool syncOK = false;
1301 bool loadSuccess = false; 1301 bool loadSuccess = false;
1302 PhoneFormat* phoneFormat = 0; 1302 PhoneFormat* phoneFormat = 0;
1303 emit tempDisableBR(true); 1303 emit tempDisableBR(true);
1304#ifndef DESKTOP_VERSION 1304#ifndef DESKTOP_VERSION
1305 SharpFormat* sharpFormat = 0; 1305 SharpFormat* sharpFormat = 0;
1306 if ( mode == 0 ) { // sharp 1306 if ( mode == 0 ) { // sharp
1307 sharpFormat = new SharpFormat () ; 1307 sharpFormat = new SharpFormat () ;
1308 loadSuccess = sharpFormat->load( calendar, mCalendar ); 1308 loadSuccess = sharpFormat->load( calendar, mCalendar );
1309 1309
1310 } else 1310 } else
1311#endif 1311#endif
1312 if ( mode == 1 ) { // phone 1312 if ( mode == 1 ) { // phone
1313 phoneFormat = new PhoneFormat (mCurrentSyncDevice, 1313 phoneFormat = new PhoneFormat (mCurrentSyncDevice,
1314 mSyncManager->mPhoneDevice, 1314 mSyncManager->mPhoneDevice,
1315 mSyncManager->mPhoneConnection, 1315 mSyncManager->mPhoneConnection,
1316 mSyncManager->mPhoneModel); 1316 mSyncManager->mPhoneModel);
1317 loadSuccess = phoneFormat->load( calendar,mCalendar); 1317 loadSuccess = phoneFormat->load( calendar,mCalendar);
1318 1318
1319 } else { 1319 } else {
1320 emit tempDisableBR(false); 1320 emit tempDisableBR(false);
1321 return; 1321 return;
1322 } 1322 }
1323 if ( loadSuccess ) { 1323 if ( loadSuccess ) {
1324 getEventViewerDialog()->setSyncMode( true ); 1324 getEventViewerDialog()->setSyncMode( true );
1325 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1325 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1326 getEventViewerDialog()->setSyncMode( false ); 1326 getEventViewerDialog()->setSyncMode( false );
1327 qApp->processEvents(); 1327 qApp->processEvents();
1328 if ( syncOK ) { 1328 if ( syncOK ) {
1329 if ( mSyncManager->mWriteBackFile ) 1329 if ( mSyncManager->mWriteBackFile )
1330 { 1330 {
1331 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1331 QPtrList<Incidence> iL = mCalendar->rawIncidences();
1332 Incidence* inc = iL.first(); 1332 Incidence* inc = iL.first();
1333 if ( phoneFormat ) { 1333 if ( phoneFormat ) {
1334 while ( inc ) { 1334 while ( inc ) {
1335 inc->removeID(mCurrentSyncDevice); 1335 inc->removeID(mCurrentSyncDevice);
1336 inc = iL.next(); 1336 inc = iL.next();
1337 } 1337 }
1338 } 1338 }
1339#ifndef DESKTOP_VERSION 1339#ifndef DESKTOP_VERSION
1340 if ( sharpFormat ) 1340 if ( sharpFormat )
1341 sharpFormat->save(calendar); 1341 sharpFormat->save(calendar);
1342#endif 1342#endif
1343 if ( phoneFormat ) 1343 if ( phoneFormat )
1344 phoneFormat->save(calendar); 1344 phoneFormat->save(calendar);
1345 iL = calendar->rawIncidences(); 1345 iL = calendar->rawIncidences();
1346 inc = iL.first(); 1346 inc = iL.first();
1347 Incidence* loc; 1347 Incidence* loc;
1348 while ( inc ) { 1348 while ( inc ) {
1349 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 1349 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
1350 loc = mCalendar->incidence(inc->uid() ); 1350 loc = mCalendar->incidence(inc->uid() );
1351 if ( loc ) { 1351 if ( loc ) {
1352 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); 1352 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
1353 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); 1353 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
1354 } 1354 }
1355 } 1355 }
1356 inc = iL.next(); 1356 inc = iL.next();
1357 } 1357 }
1358 Incidence* lse = getLastSyncEvent(); 1358 Incidence* lse = getLastSyncEvent();
1359 if ( lse ) { 1359 if ( lse ) {
1360 lse->setReadOnly( false ); 1360 lse->setReadOnly( false );
1361 lse->setDescription( "" ); 1361 lse->setDescription( "" );
1362 lse->setReadOnly( true ); 1362 lse->setReadOnly( true );
1363 } 1363 }
1364 } 1364 }
1365 } else { 1365 } else {
1366 topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); 1366 topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") );
1367 } 1367 }
1368 setModified( true ); 1368 setModified( true );
1369 } else { 1369 } else {
1370 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; 1370 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
1371 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), 1371 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
1372 question, i18n("Ok")) ; 1372 question, i18n("Ok")) ;
1373 1373
1374 } 1374 }
1375 delete calendar; 1375 delete calendar;
1376 updateView(); 1376 updateView();
1377 emit tempDisableBR(false); 1377 emit tempDisableBR(false);
1378 return ;//syncOK; 1378 return ;//syncOK;
1379 1379
1380} 1380}
1381 1381
1382bool CalendarView::importBday() 1382bool CalendarView::importBday()
1383{ 1383{
1384#ifndef KORG_NOKABC 1384#ifndef KORG_NOKABC
1385 1385
1386#ifdef DESKTOP_VERSION 1386#ifdef DESKTOP_VERSION
1387 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 1387 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
1388 KABC::AddressBook::Iterator it; 1388 KABC::AddressBook::Iterator it;
1389 int count = 0; 1389 int count = 0;
1390 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1390 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1391 ++count; 1391 ++count;
1392 } 1392 }
1393 QProgressBar bar(count,0 ); 1393 QProgressBar bar(count,0 );
1394 int w = 300; 1394 int w = 300;
1395 if ( QApplication::desktop()->width() < 320 ) 1395 if ( QApplication::desktop()->width() < 320 )
1396 w = 220; 1396 w = 220;
1397 int h = bar.sizeHint().height() ; 1397 int h = bar.sizeHint().height() ;
1398 int dw = QApplication::desktop()->width(); 1398 int dw = QApplication::desktop()->width();
1399 int dh = QApplication::desktop()->height(); 1399 int dh = QApplication::desktop()->height();
1400 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1400 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1401 bar.show(); 1401 bar.show();
1402 bar.setCaption (i18n("Reading addressbook - close to abort!") ); 1402 bar.setCaption (i18n("Reading addressbook - close to abort!") );
1403 qApp->processEvents(); 1403 qApp->processEvents();
1404 count = 0; 1404 count = 0;
1405 int addCount = 0; 1405 int addCount = 0;
1406 KCal::Attendee* a = 0; 1406 KCal::Attendee* a = 0;
1407 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1407 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1408 if ( ! bar.isVisible() ) 1408 if ( ! bar.isVisible() )
1409 return false; 1409 return false;
1410 bar.setProgress( count++ ); 1410 bar.setProgress( count++ );
1411 qApp->processEvents(); 1411 qApp->processEvents();
1412 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); 1412 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() );
1413 if ( (*it).birthday().date().isValid() ){ 1413 if ( (*it).birthday().date().isValid() ){
1414 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1414 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1415 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) 1415 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) )
1416 ++addCount; 1416 ++addCount;
1417 } 1417 }
1418 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); 1418 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d");
1419 if ( anni.isValid() ){ 1419 if ( anni.isValid() ){
1420 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1420 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1421 if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) 1421 if ( addAnniversary( anni, (*it).assembledName(), a, false ) )
1422 ++addCount; 1422 ++addCount;
1423 } 1423 }
1424 } 1424 }
1425 updateView(); 1425 updateView();
1426 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1426 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1427#else //DESKTOP_VERSION 1427#else //DESKTOP_VERSION
1428 1428
1429 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 1429 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
1430 // the result should now arrive through method insertBirthdays 1430 // the result should now arrive through method insertBirthdays
1431 1431
1432#endif //DESKTOP_VERSION 1432#endif //DESKTOP_VERSION
1433 1433
1434#endif //KORG_NOKABC 1434#endif //KORG_NOKABC
1435 1435
1436 1436
1437 return true; 1437 return true;
1438} 1438}
1439 1439
1440// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI 1440// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI
1441void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, 1441void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList,
1442 const QStringList& anniversaryList, const QStringList& realNameList, 1442 const QStringList& anniversaryList, const QStringList& realNameList,
1443 const QStringList& emailList, const QStringList& assembledNameList, 1443 const QStringList& emailList, const QStringList& assembledNameList,
1444 const QStringList& uidList) 1444 const QStringList& uidList)
1445{ 1445{
1446 //qDebug("KO::CalendarView::insertBirthdays"); 1446 //qDebug("KO::CalendarView::insertBirthdays");
1447 if (uid == this->name()) 1447 if (uid == this->name())
1448 { 1448 {
1449 int count = birthdayList.count(); 1449 int count = birthdayList.count();
1450 int addCount = 0; 1450 int addCount = 0;
1451 KCal::Attendee* a = 0; 1451 KCal::Attendee* a = 0;
1452 1452
1453 //qDebug("CalView 1 %i", count); 1453 //qDebug("CalView 1 %i", count);
1454 1454
1455 QProgressBar bar(count,0 ); 1455 QProgressBar bar(count,0 );
1456 int w = 300; 1456 int w = 300;
1457 if ( QApplication::desktop()->width() < 320 ) 1457 if ( QApplication::desktop()->width() < 320 )
1458 w = 220; 1458 w = 220;
1459 int h = bar.sizeHint().height() ; 1459 int h = bar.sizeHint().height() ;
1460 int dw = QApplication::desktop()->width(); 1460 int dw = QApplication::desktop()->width();
1461 int dh = QApplication::desktop()->height(); 1461 int dh = QApplication::desktop()->height();
1462 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1462 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1463 bar.show(); 1463 bar.show();
1464 bar.setCaption (i18n("inserting birthdays - close to abort!") ); 1464 bar.setCaption (i18n("inserting birthdays - close to abort!") );
1465 qApp->processEvents(); 1465 qApp->processEvents();
1466 1466
1467 QDate birthday; 1467 QDate birthday;
1468 QDate anniversary; 1468 QDate anniversary;
1469 QString realName; 1469 QString realName;
1470 QString email; 1470 QString email;
1471 QString assembledName; 1471 QString assembledName;
1472 QString uid; 1472 QString uid;
1473 bool ok = true; 1473 bool ok = true;
1474 for ( int i = 0; i < count; i++) 1474 for ( int i = 0; i < count; i++)
1475 { 1475 {
1476 if ( ! bar.isVisible() ) 1476 if ( ! bar.isVisible() )
1477 return; 1477 return;
1478 bar.setProgress( i ); 1478 bar.setProgress( i );
1479 qApp->processEvents(); 1479 qApp->processEvents();
1480 1480
1481 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); 1481 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok);
1482 if (!ok) { 1482 if (!ok) {
1483 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); 1483 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1());
1484 } 1484 }
1485 1485
1486 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); 1486 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok);
1487 if (!ok) { 1487 if (!ok) {
1488 ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); 1488 ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1());
1489 } 1489 }
1490 realName = realNameList[i]; 1490 realName = realNameList[i];
1491 email = emailList[i]; 1491 email = emailList[i];
1492 assembledName = assembledNameList[i]; 1492 assembledName = assembledNameList[i];
1493 uid = uidList[i]; 1493 uid = uidList[i];
1494 //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); 1494 //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() );
1495 1495
1496 if ( birthday.isValid() ){ 1496 if ( birthday.isValid() ){
1497 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, 1497 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1498 KCal::Attendee::ReqParticipant,uid) ; 1498 KCal::Attendee::ReqParticipant,uid) ;
1499 if ( addAnniversary( birthday, assembledName, a, true ) ) 1499 if ( addAnniversary( birthday, assembledName, a, true ) )
1500 ++addCount; 1500 ++addCount;
1501 } 1501 }
1502 1502
1503 if ( anniversary.isValid() ){ 1503 if ( anniversary.isValid() ){
1504 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, 1504 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1505 KCal::Attendee::ReqParticipant,uid) ; 1505 KCal::Attendee::ReqParticipant,uid) ;
1506 if ( addAnniversary( anniversary, assembledName, a, false ) ) 1506 if ( addAnniversary( anniversary, assembledName, a, false ) )
1507 ++addCount; 1507 ++addCount;
1508 } 1508 }
1509 } 1509 }
1510 1510
1511 updateView(); 1511 updateView();
1512 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1512 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1513 1513
1514 } 1514 }
1515 1515
1516} 1516}
1517 1517
1518 1518
1519 1519
1520bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) 1520bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday)
1521{ 1521{
1522 //qDebug("addAnni "); 1522 //qDebug("addAnni ");
1523 Event * ev = new Event(); 1523 Event * ev = new Event();
1524 ev->setOrganizer(KOPrefs::instance()->email()); 1524 ev->setOrganizer(KOPrefs::instance()->email());
1525 if ( a ) { 1525 if ( a ) {
1526 ev->addAttendee( a ); 1526 ev->addAttendee( a );
1527 } 1527 }
1528 QString kind; 1528 QString kind;
1529 if ( birthday ) { 1529 if ( birthday ) {
1530 kind = i18n( "Birthday" ); 1530 kind = i18n( "Birthday" );
1531 ev->setSummary( name + " (" + QString::number(date.year()) +")"); 1531 ev->setSummary( name + " (" + QString::number(date.year()) +")");
1532 } 1532 }
1533 else { 1533 else {
1534 kind = i18n( "Anniversary" ); 1534 kind = i18n( "Anniversary" );
1535 ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); 1535 ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind );
1536 } 1536 }
1537 ev->setCategories( kind ); 1537 ev->setCategories( kind );
1538 ev->setDtStart( QDateTime(date) ); 1538 ev->setDtStart( QDateTime(date) );
1539 ev->setDtEnd( QDateTime(date) ); 1539 ev->setDtEnd( QDateTime(date) );
1540 ev->setFloats( true ); 1540 ev->setFloats( true );
1541 Recurrence * rec = ev->recurrence(); 1541 Recurrence * rec = ev->recurrence();
1542 rec->setYearly(Recurrence::rYearlyMonth,1,-1); 1542 rec->setYearly(Recurrence::rYearlyMonth,1,-1);
1543 rec->addYearlyNum( date.month() ); 1543 rec->addYearlyNum( date.month() );
1544 if ( !mCalendar->addAnniversaryNoDup( ev ) ) { 1544 if ( !mCalendar->addAnniversaryNoDup( ev ) ) {
1545 delete ev; 1545 delete ev;
1546 return false; 1546 return false;
1547 } 1547 }
1548 return true; 1548 return true;
1549 1549
1550} 1550}
1551bool CalendarView::importQtopia( const QString &categories, 1551bool CalendarView::importQtopia( const QString &categories,
1552 const QString &datebook, 1552 const QString &datebook,
1553 const QString &todolist ) 1553 const QString &todolist )
1554{ 1554{
1555 1555
1556 QtopiaFormat qtopiaFormat; 1556 QtopiaFormat qtopiaFormat;
1557 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1557 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1558 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); 1558 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories );
1559 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); 1559 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook );
1560 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); 1560 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist );
1561 1561
1562 updateView(); 1562 updateView();
1563 return true; 1563 return true;
1564 1564
1565#if 0 1565#if 0
1566 mGlobalSyncMode = SYNC_MODE_QTOPIA; 1566 mGlobalSyncMode = SYNC_MODE_QTOPIA;
1567 mCurrentSyncDevice = "qtopia-XML"; 1567 mCurrentSyncDevice = "qtopia-XML";
1568 if ( mSyncManager->mAskForPreferences ) 1568 if ( mSyncManager->mAskForPreferences )
1569 edit_sync_options(); 1569 edit_sync_options();
1570 qApp->processEvents(); 1570 qApp->processEvents();
1571 CalendarLocal* calendar = new CalendarLocal(); 1571 CalendarLocal* calendar = new CalendarLocal();
1572 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1572 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1573 bool syncOK = false; 1573 bool syncOK = false;
1574 QtopiaFormat qtopiaFormat; 1574 QtopiaFormat qtopiaFormat;
1575 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1575 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1576 bool loadOk = true; 1576 bool loadOk = true;
1577 if ( !categories.isEmpty() ) 1577 if ( !categories.isEmpty() )
1578 loadOk = qtopiaFormat.load( calendar, categories ); 1578 loadOk = qtopiaFormat.load( calendar, categories );
1579 if ( loadOk && !datebook.isEmpty() ) 1579 if ( loadOk && !datebook.isEmpty() )
1580 loadOk = qtopiaFormat.load( calendar, datebook ); 1580 loadOk = qtopiaFormat.load( calendar, datebook );
1581 if ( loadOk && !todolist.isEmpty() ) 1581 if ( loadOk && !todolist.isEmpty() )
1582 loadOk = qtopiaFormat.load( calendar, todolist ); 1582 loadOk = qtopiaFormat.load( calendar, todolist );
1583 1583
1584 if ( loadOk ) { 1584 if ( loadOk ) {
1585 getEventViewerDialog()->setSyncMode( true ); 1585 getEventViewerDialog()->setSyncMode( true );
1586 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1586 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1587 getEventViewerDialog()->setSyncMode( false ); 1587 getEventViewerDialog()->setSyncMode( false );
1588 qApp->processEvents(); 1588 qApp->processEvents();
1589 if ( syncOK ) { 1589 if ( syncOK ) {
1590 if ( mSyncManager->mWriteBackFile ) 1590 if ( mSyncManager->mWriteBackFile )
1591 { 1591 {
1592 // write back XML file 1592 // write back XML file
1593 1593
1594 } 1594 }
1595 setModified( true ); 1595 setModified( true );
1596 } 1596 }
1597 } else { 1597 } else {
1598 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; 1598 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ;
1599 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), 1599 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"),
1600 question, i18n("Ok")) ; 1600 question, i18n("Ok")) ;
1601 } 1601 }
1602 delete calendar; 1602 delete calendar;
1603 updateView(); 1603 updateView();
1604 return syncOK; 1604 return syncOK;
1605 1605
1606 1606
1607#endif 1607#endif
1608 1608
1609} 1609}
1610 1610
1611void CalendarView::setSyncEventsReadOnly() 1611void CalendarView::setSyncEventsReadOnly()
1612{ 1612{
1613 Event * ev; 1613 Event * ev;
1614 QPtrList<Event> eL = mCalendar->rawEvents(); 1614 QPtrList<Event> eL = mCalendar->rawEvents();
1615 ev = eL.first(); 1615 ev = eL.first();
1616 while ( ev ) { 1616 while ( ev ) {
1617 if ( ev->uid().left(15) == QString("last-syncEvent-") ) 1617 if ( ev->uid().left(15) == QString("last-syncEvent-") )
1618 ev->setReadOnly( true ); 1618 ev->setReadOnly( true );
1619 ev = eL.next(); 1619 ev = eL.next();
1620 } 1620 }
1621} 1621}
1622bool CalendarView::openCalendar(QString filename, bool merge) 1622bool CalendarView::openCalendar(QString filename, bool merge)
1623{ 1623{
1624 1624
1625 if (filename.isEmpty()) { 1625 if (filename.isEmpty()) {
1626 return false; 1626 return false;
1627 } 1627 }
1628 1628
1629 if (!QFile::exists(filename)) { 1629 if (!QFile::exists(filename)) {
1630 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); 1630 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename));
1631 return false; 1631 return false;
1632 } 1632 }
1633 1633
1634 globalFlagBlockAgenda = 1; 1634 globalFlagBlockAgenda = 1;
1635 if (!merge) mCalendar->close(); 1635 if (!merge) mCalendar->close();
1636 1636
1637 mStorage->setFileName( filename ); 1637 mStorage->setFileName( filename );
1638 1638
1639 if ( mStorage->load() ) { 1639 if ( mStorage->load() ) {
1640 if ( merge ) ;//setModified( true ); 1640 if ( merge ) ;//setModified( true );
1641 else { 1641 else {
1642 //setModified( true ); 1642 //setModified( true );
1643 mViewManager->setDocumentId( filename ); 1643 mViewManager->setDocumentId( filename );
1644 mDialogManager->setDocumentId( filename ); 1644 mDialogManager->setDocumentId( filename );
1645 mTodoList->setDocumentId( filename ); 1645 mTodoList->setDocumentId( filename );
1646 } 1646 }
1647 globalFlagBlockAgenda = 2; 1647 globalFlagBlockAgenda = 2;
1648 // if ( getLastSyncEvent() ) 1648 // if ( getLastSyncEvent() )
1649 // getLastSyncEvent()->setReadOnly( true ); 1649 // getLastSyncEvent()->setReadOnly( true );
1650 mCalendar->reInitAlarmSettings(); 1650 mCalendar->reInitAlarmSettings();
1651 setSyncEventsReadOnly(); 1651 setSyncEventsReadOnly();
1652 updateUnmanagedViews(); 1652 updateUnmanagedViews();
1653 updateView(); 1653 updateView();
1654 if ( filename != MainWindow::defaultFileName() ) { 1654 if ( filename != MainWindow::defaultFileName() ) {
1655 saveCalendar( MainWindow::defaultFileName() ); 1655 saveCalendar( MainWindow::defaultFileName() );
1656 } else { 1656 } else {
1657 QFileInfo finf ( MainWindow::defaultFileName()); 1657 QFileInfo finf ( MainWindow::defaultFileName());
1658 if ( finf.exists() ) { 1658 if ( finf.exists() ) {
1659 setLoadedFileVersion( finf.lastModified () ); 1659 setLoadedFileVersion( finf.lastModified () );
1660 } 1660 }
1661 } 1661 }
1662 return true; 1662 return true;
1663 } else { 1663 } else {
1664 // while failing to load, the calendar object could 1664 // while failing to load, the calendar object could
1665 // have become partially populated. Clear it out. 1665 // have become partially populated. Clear it out.
1666 if ( !merge ) { 1666 if ( !merge ) {
1667 mCalendar->close(); 1667 mCalendar->close();
1668 mViewManager->setDocumentId( filename ); 1668 mViewManager->setDocumentId( filename );
1669 mDialogManager->setDocumentId( filename ); 1669 mDialogManager->setDocumentId( filename );
1670 mTodoList->setDocumentId( filename ); 1670 mTodoList->setDocumentId( filename );
1671 } 1671 }
1672 1672
1673 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); 1673 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename));
1674 1674
1675 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); 1675 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) );
1676 globalFlagBlockAgenda = 2; 1676 globalFlagBlockAgenda = 2;
1677 mCalendar->reInitAlarmSettings(); 1677 mCalendar->reInitAlarmSettings();
1678 setSyncEventsReadOnly(); 1678 setSyncEventsReadOnly();
1679 updateUnmanagedViews(); 1679 updateUnmanagedViews();
1680 updateView(); 1680 updateView();
1681 } 1681 }
1682 return false; 1682 return false;
1683} 1683}
1684void CalendarView::showOpenError() 1684void CalendarView::showOpenError()
1685{ 1685{
1686 KMessageBox::error(this,i18n("Couldn't load calendar\n.")); 1686 KMessageBox::error(this,i18n("Couldn't load calendar\n."));
1687} 1687}
1688void CalendarView::setLoadedFileVersion(QDateTime dt) 1688void CalendarView::setLoadedFileVersion(QDateTime dt)
1689{ 1689{
1690 loadedFileVersion = dt; 1690 loadedFileVersion = dt;
1691} 1691}
1692bool CalendarView::checkFileChanged(QString fn) 1692bool CalendarView::checkFileChanged(QString fn)
1693{ 1693{
1694 QFileInfo finf ( fn ); 1694 QFileInfo finf ( fn );
1695 if ( !finf.exists() ) 1695 if ( !finf.exists() )
1696 return true; 1696 return true;
1697 QDateTime dt = finf.lastModified (); 1697 QDateTime dt = finf.lastModified ();
1698 if ( dt <= loadedFileVersion ) 1698 if ( dt <= loadedFileVersion )
1699 return false; 1699 return false;
1700 return true; 1700 return true;
1701 1701
1702} 1702}
1703void CalendarView::watchSavedFile() 1703void CalendarView::watchSavedFile()
1704{ 1704{
1705 QFileInfo finf ( MainWindow::defaultFileName()); 1705 QFileInfo finf ( MainWindow::defaultFileName());
1706 if ( !finf.exists() ) 1706 if ( !finf.exists() )
1707 return; 1707 return;
1708 QDateTime dt = finf.lastModified (); 1708 QDateTime dt = finf.lastModified ();
1709 if ( dt < loadedFileVersion ) { 1709 if ( dt < loadedFileVersion ) {
1710 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); 1710 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1());
1711 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); 1711 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) );
1712 return; 1712 return;
1713 } 1713 }
1714 loadedFileVersion = dt; 1714 loadedFileVersion = dt;
1715} 1715}
1716 1716
1717bool CalendarView::checkFileVersion(QString fn) 1717bool CalendarView::checkFileVersion(QString fn)
1718{ 1718{
1719 QFileInfo finf ( fn ); 1719 QFileInfo finf ( fn );
1720 if ( !finf.exists() ) 1720 if ( !finf.exists() )
1721 return true; 1721 return true;
1722 QDateTime dt = finf.lastModified (); 1722 QDateTime dt = finf.lastModified ();
1723 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); 1723 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1());
1724 //qDebug("file on disk version %s",dt.toString().latin1()); 1724 //qDebug("file on disk version %s",dt.toString().latin1());
1725 if ( dt <= loadedFileVersion ) 1725 if ( dt <= loadedFileVersion )
1726 return true; 1726 return true;
1727 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , 1727 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) ,
1728 i18n("KO/Pi Warning"),i18n("Overwrite"), 1728 i18n("KO/Pi Warning"),i18n("Overwrite"),
1729 i18n("Sync+save")); 1729 i18n("Sync+save"));
1730 1730
1731 if ( km == KMessageBox::Cancel ) 1731 if ( km == KMessageBox::Cancel )
1732 return false; 1732 return false;
1733 if ( km == KMessageBox::Yes ) 1733 if ( km == KMessageBox::Yes )
1734 return true; 1734 return true;
1735 1735
1736 setSyncDevice("deleteaftersync" ); 1736 setSyncDevice("deleteaftersync" );
1737 mSyncManager->mAskForPreferences = true; 1737 mSyncManager->mAskForPreferences = true;
1738 mSyncManager->mSyncAlgoPrefs = 3; 1738 mSyncManager->mSyncAlgoPrefs = 3;
1739 mSyncManager->mWriteBackFile = false; 1739 mSyncManager->mWriteBackFile = false;
1740 mSyncManager->mWriteBackExistingOnly = false; 1740 mSyncManager->mWriteBackExistingOnly = false;
1741 mSyncManager->mShowSyncSummary = false; 1741 mSyncManager->mShowSyncSummary = false;
1742 syncCalendar( fn, 3 ); 1742 syncCalendar( fn, 3 );
1743 Event * e = getLastSyncEvent(); 1743 Event * e = getLastSyncEvent();
1744 mCalendar->deleteEvent ( e ); 1744 mCalendar->deleteEvent ( e );
1745 updateView(); 1745 updateView();
1746 return true; 1746 return true;
1747} 1747}
1748 1748
1749bool CalendarView::saveCalendar( QString filename ) 1749bool CalendarView::saveCalendar( QString filename )
1750{ 1750{
1751 1751
1752 // Store back all unsaved data into calendar object 1752 // Store back all unsaved data into calendar object
1753 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); 1753 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() );
1754 if ( mViewManager->currentView() ) 1754 if ( mViewManager->currentView() )
1755 mViewManager->currentView()->flushView(); 1755 mViewManager->currentView()->flushView();
1756 1756
1757 1757
1758 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); 1758 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2);
1759 mStorage->setSaveFormat( new ICalFormat() ); 1759 mStorage->setSaveFormat( new ICalFormat() );
1760 mStorage->setFileName( filename ); 1760 mStorage->setFileName( filename );
1761 bool success; 1761 bool success;
1762 success = mStorage->save(); 1762 success = mStorage->save();
1763 if ( !success ) { 1763 if ( !success ) {
1764 return false; 1764 return false;
1765 } 1765 }
1766 if ( filename == MainWindow::defaultFileName() ) { 1766 if ( filename == MainWindow::defaultFileName() ) {
1767 setLoadedFileVersion( lfv ); 1767 setLoadedFileVersion( lfv );
1768 watchSavedFile(); 1768 watchSavedFile();
1769 } 1769 }
1770 return true; 1770 return true;
1771} 1771}
1772 1772
1773void CalendarView::closeCalendar() 1773void CalendarView::closeCalendar()
1774{ 1774{
1775 1775
1776 // child windows no longer valid 1776 // child windows no longer valid
1777 emit closingDown(); 1777 emit closingDown();
1778 1778
1779 mCalendar->close(); 1779 mCalendar->close();
1780 setModified(false); 1780 setModified(false);
1781 updateView(); 1781 updateView();
1782} 1782}
1783 1783
1784void CalendarView::archiveCalendar() 1784void CalendarView::archiveCalendar()
1785{ 1785{
1786 mDialogManager->showArchiveDialog(); 1786 mDialogManager->showArchiveDialog();
1787} 1787}
1788 1788
1789 1789
1790void CalendarView::readSettings() 1790void CalendarView::readSettings()
1791{ 1791{
1792 1792
1793 1793
1794 // mViewManager->showAgendaView(); 1794 // mViewManager->showAgendaView();
1795 QString str; 1795 QString str;
1796 //qDebug("CalendarView::readSettings() "); 1796 //qDebug("CalendarView::readSettings() ");
1797 // read settings from the KConfig, supplying reasonable 1797 // read settings from the KConfig, supplying reasonable
1798 // defaults where none are to be found 1798 // defaults where none are to be found
1799 KConfig *config = KOGlobals::config(); 1799 KConfig *config = KOGlobals::config();
1800#ifndef KORG_NOSPLITTER 1800#ifndef KORG_NOSPLITTER
1801 config->setGroup("KOrganizer Geometry"); 1801 config->setGroup("KOrganizer Geometry");
1802 1802
1803 QValueList<int> sizes = config->readIntListEntry("Separator1"); 1803 QValueList<int> sizes = config->readIntListEntry("Separator1");
1804 if (sizes.count() != 2) { 1804 if (sizes.count() != 2) {
1805 sizes << mDateNavigator->minimumSizeHint().width(); 1805 sizes << mDateNavigator->minimumSizeHint().width();
1806 sizes << 300; 1806 sizes << 300;
1807 } 1807 }
1808 mPanner->setSizes(sizes); 1808 mPanner->setSizes(sizes);
1809 1809
1810 sizes = config->readIntListEntry("Separator2"); 1810 sizes = config->readIntListEntry("Separator2");
1811 if ( ( mResourceView && sizes.count() == 4 ) || 1811 if ( ( mResourceView && sizes.count() == 4 ) ||
1812 ( !mResourceView && sizes.count() == 3 ) ) { 1812 ( !mResourceView && sizes.count() == 3 ) ) {
1813 mLeftSplitter->setSizes(sizes); 1813 mLeftSplitter->setSizes(sizes);
1814 } 1814 }
1815#endif 1815#endif
1816 globalFlagBlockAgenda = 1; 1816 globalFlagBlockAgenda = 1;
1817 mViewManager->showAgendaView(); 1817 mViewManager->showAgendaView();
1818 //mViewManager->readSettings( config ); 1818 //mViewManager->readSettings( config );
1819 mTodoList->restoreLayout(config,QString("Todo Layout")); 1819 mTodoList->restoreLayout(config,QString("Todo Layout"));
1820 readFilterSettings(config); 1820 readFilterSettings(config);
1821 config->setGroup( "Views" ); 1821 config->setGroup( "Views" );
1822 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 1822 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
1823 if ( dateCount == 5 ) mNavigator->selectWorkWeek(); 1823 if ( dateCount == 5 ) mNavigator->selectWorkWeek();
1824 else if ( dateCount == 7 ) mNavigator->selectWeek(); 1824 else if ( dateCount == 7 ) mNavigator->selectWeek();
1825 else mNavigator->selectDates( dateCount ); 1825 else mNavigator->selectDates( dateCount );
1826 // mViewManager->readSettings( config ); 1826 // mViewManager->readSettings( config );
1827 updateConfig(); 1827 updateConfig();
1828 globalFlagBlockAgenda = 2; 1828 globalFlagBlockAgenda = 2;
1829 mViewManager->readSettings( config ); 1829 mViewManager->readSettings( config );
1830#ifdef DESKTOP_VERSION 1830#ifdef DESKTOP_VERSION
1831 config->setGroup("WidgetLayout"); 1831 config->setGroup("WidgetLayout");
1832 QStringList list; 1832 QStringList list;
1833 list = config->readListEntry("MainLayout"); 1833 list = config->readListEntry("MainLayout");
1834 int x,y,w,h; 1834 int x,y,w,h;
1835 if ( ! list.isEmpty() ) { 1835 if ( ! list.isEmpty() ) {
1836 x = list[0].toInt(); 1836 x = list[0].toInt();
1837 y = list[1].toInt(); 1837 y = list[1].toInt();
1838 w = list[2].toInt(); 1838 w = list[2].toInt();
1839 h = list[3].toInt(); 1839 h = list[3].toInt();
1840 topLevelWidget()->setGeometry(x,y,w,h); 1840 topLevelWidget()->setGeometry(x,y,w,h);
1841 1841
1842 } else { 1842 } else {
1843 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 1843 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
1844 } 1844 }
1845 list = config->readListEntry("EditEventLayout"); 1845 list = config->readListEntry("EditEventLayout");
1846 if ( ! list.isEmpty() ) { 1846 if ( ! list.isEmpty() ) {
1847 x = list[0].toInt(); 1847 x = list[0].toInt();
1848 y = list[1].toInt(); 1848 y = list[1].toInt();
1849 w = list[2].toInt(); 1849 w = list[2].toInt();
1850 h = list[3].toInt(); 1850 h = list[3].toInt();
1851 mEventEditor->setGeometry(x,y,w,h); 1851 mEventEditor->setGeometry(x,y,w,h);
1852 1852
1853 } 1853 }
1854 list = config->readListEntry("EditTodoLayout"); 1854 list = config->readListEntry("EditTodoLayout");
1855 if ( ! list.isEmpty() ) { 1855 if ( ! list.isEmpty() ) {
1856 x = list[0].toInt(); 1856 x = list[0].toInt();
1857 y = list[1].toInt(); 1857 y = list[1].toInt();
1858 w = list[2].toInt(); 1858 w = list[2].toInt();
1859 h = list[3].toInt(); 1859 h = list[3].toInt();
1860 mTodoEditor->setGeometry(x,y,w,h); 1860 mTodoEditor->setGeometry(x,y,w,h);
1861 1861
1862 } 1862 }
1863 list = config->readListEntry("ViewerLayout"); 1863 list = config->readListEntry("ViewerLayout");
1864 if ( ! list.isEmpty() ) { 1864 if ( ! list.isEmpty() ) {
1865 x = list[0].toInt(); 1865 x = list[0].toInt();
1866 y = list[1].toInt(); 1866 y = list[1].toInt();
1867 w = list[2].toInt(); 1867 w = list[2].toInt();
1868 h = list[3].toInt(); 1868 h = list[3].toInt();
1869 getEventViewerDialog()->setGeometry(x,y,w,h); 1869 getEventViewerDialog()->setGeometry(x,y,w,h);
1870 } 1870 }
1871#endif 1871#endif
1872 1872
1873} 1873}
1874 1874
1875 1875
1876void CalendarView::writeSettings() 1876void CalendarView::writeSettings()
1877{ 1877{
1878 // kdDebug() << "CalendarView::writeSettings" << endl; 1878 // kdDebug() << "CalendarView::writeSettings" << endl;
1879 1879
1880 KConfig *config = KOGlobals::config(); 1880 KConfig *config = KOGlobals::config();
1881 1881
1882#ifndef KORG_NOSPLITTER 1882#ifndef KORG_NOSPLITTER
1883 config->setGroup("KOrganizer Geometry"); 1883 config->setGroup("KOrganizer Geometry");
1884 1884
1885 QValueList<int> list = mPanner->sizes(); 1885 QValueList<int> list = mPanner->sizes();
1886 config->writeEntry("Separator1",list); 1886 config->writeEntry("Separator1",list);
1887 1887
1888 list = mLeftSplitter->sizes(); 1888 list = mLeftSplitter->sizes();
1889 config->writeEntry("Separator2",list); 1889 config->writeEntry("Separator2",list);
1890#endif 1890#endif
1891 1891
1892 mViewManager->writeSettings( config ); 1892 mViewManager->writeSettings( config );
1893 mTodoList->saveLayout(config,QString("Todo Layout")); 1893 mTodoList->saveLayout(config,QString("Todo Layout"));
1894 mDialogManager->writeSettings( config ); 1894 mDialogManager->writeSettings( config );
1895 //KOPrefs::instance()->usrWriteConfig(); 1895 //KOPrefs::instance()->usrWriteConfig();
1896 KOPrefs::instance()->writeConfig(); 1896 KOPrefs::instance()->writeConfig();
1897 1897
1898 writeFilterSettings(config); 1898 writeFilterSettings(config);
1899 1899
1900 config->setGroup( "Views" ); 1900 config->setGroup( "Views" );
1901 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); 1901 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
1902 1902
1903#ifdef DESKTOP_VERSION 1903#ifdef DESKTOP_VERSION
1904 config->setGroup("WidgetLayout"); 1904 config->setGroup("WidgetLayout");
1905 QStringList list ;//= config->readListEntry("MainLayout"); 1905 QStringList list ;//= config->readListEntry("MainLayout");
1906 int x,y,w,h; 1906 int x,y,w,h;
1907 QWidget* wid; 1907 QWidget* wid;
1908 wid = topLevelWidget(); 1908 wid = topLevelWidget();
1909 x = wid->geometry().x(); 1909 x = wid->geometry().x();
1910 y = wid->geometry().y(); 1910 y = wid->geometry().y();
1911 w = wid->width(); 1911 w = wid->width();
1912 h = wid->height(); 1912 h = wid->height();
1913 list.clear(); 1913 list.clear();
1914 list << QString::number( x ); 1914 list << QString::number( x );
1915 list << QString::number( y ); 1915 list << QString::number( y );
1916 list << QString::number( w ); 1916 list << QString::number( w );
1917 list << QString::number( h ); 1917 list << QString::number( h );
1918 config->writeEntry("MainLayout",list ); 1918 config->writeEntry("MainLayout",list );
1919 1919
1920 wid = mEventEditor; 1920 wid = mEventEditor;
1921 x = wid->geometry().x(); 1921 x = wid->geometry().x();
1922 y = wid->geometry().y(); 1922 y = wid->geometry().y();
1923 w = wid->width(); 1923 w = wid->width();
1924 h = wid->height(); 1924 h = wid->height();
1925 list.clear(); 1925 list.clear();
1926 list << QString::number( x ); 1926 list << QString::number( x );
1927 list << QString::number( y ); 1927 list << QString::number( y );
1928 list << QString::number( w ); 1928 list << QString::number( w );
1929 list << QString::number( h ); 1929 list << QString::number( h );
1930 config->writeEntry("EditEventLayout",list ); 1930 config->writeEntry("EditEventLayout",list );
1931 1931
1932 wid = mTodoEditor; 1932 wid = mTodoEditor;
1933 x = wid->geometry().x(); 1933 x = wid->geometry().x();
1934 y = wid->geometry().y(); 1934 y = wid->geometry().y();
1935 w = wid->width(); 1935 w = wid->width();
1936 h = wid->height(); 1936 h = wid->height();
1937 list.clear(); 1937 list.clear();
1938 list << QString::number( x ); 1938 list << QString::number( x );
1939 list << QString::number( y ); 1939 list << QString::number( y );
1940 list << QString::number( w ); 1940 list << QString::number( w );
1941 list << QString::number( h ); 1941 list << QString::number( h );
1942 config->writeEntry("EditTodoLayout",list ); 1942 config->writeEntry("EditTodoLayout",list );
1943 wid = getEventViewerDialog(); 1943 wid = getEventViewerDialog();
1944 x = wid->geometry().x(); 1944 x = wid->geometry().x();
1945 y = wid->geometry().y(); 1945 y = wid->geometry().y();
1946 w = wid->width(); 1946 w = wid->width();
1947 h = wid->height(); 1947 h = wid->height();
1948 list.clear(); 1948 list.clear();
1949 list << QString::number( x ); 1949 list << QString::number( x );
1950 list << QString::number( y ); 1950 list << QString::number( y );
1951 list << QString::number( w ); 1951 list << QString::number( w );
1952 list << QString::number( h ); 1952 list << QString::number( h );
1953 config->writeEntry("ViewerLayout",list ); 1953 config->writeEntry("ViewerLayout",list );
1954 wid = mDialogManager->getSearchDialog(); 1954 wid = mDialogManager->getSearchDialog();
1955 if ( wid ) { 1955 if ( wid ) {
1956 x = wid->geometry().x(); 1956 x = wid->geometry().x();
1957 y = wid->geometry().y(); 1957 y = wid->geometry().y();
1958 w = wid->width(); 1958 w = wid->width();
1959 h = wid->height(); 1959 h = wid->height();
1960 list.clear(); 1960 list.clear();
1961 list << QString::number( x ); 1961 list << QString::number( x );
1962 list << QString::number( y ); 1962 list << QString::number( y );
1963 list << QString::number( w ); 1963 list << QString::number( w );
1964 list << QString::number( h ); 1964 list << QString::number( h );
1965 config->writeEntry("SearchLayout",list ); 1965 config->writeEntry("SearchLayout",list );
1966 } 1966 }
1967#endif 1967#endif
1968 1968
1969 1969
1970 config->sync(); 1970 config->sync();
1971} 1971}
1972 1972
1973void CalendarView::readFilterSettings(KConfig *config) 1973void CalendarView::readFilterSettings(KConfig *config)
1974{ 1974{
1975 // kdDebug() << "CalendarView::readFilterSettings()" << endl; 1975 // kdDebug() << "CalendarView::readFilterSettings()" << endl;
1976 1976
1977 mFilters.clear(); 1977 mFilters.clear();
1978 1978
1979 config->setGroup("General"); 1979 config->setGroup("General");
1980 QStringList filterList = config->readListEntry("CalendarFilters"); 1980 QStringList filterList = config->readListEntry("CalendarFilters");
1981 1981
1982 QStringList::ConstIterator it = filterList.begin(); 1982 QStringList::ConstIterator it = filterList.begin();
1983 QStringList::ConstIterator end = filterList.end(); 1983 QStringList::ConstIterator end = filterList.end();
1984 while(it != end) { 1984 while(it != end) {
1985 // kdDebug() << " filter: " << (*it) << endl; 1985 // kdDebug() << " filter: " << (*it) << endl;
1986 1986
1987 CalFilter *filter; 1987 CalFilter *filter;
1988 filter = new CalFilter(*it); 1988 filter = new CalFilter(*it);
1989 config->setGroup("Filter_" + (*it)); 1989 config->setGroup("Filter_" + (*it));
1990 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); 1990 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) );
1991 filter->setCriteria(config->readNumEntry("Criteria",0)); 1991 filter->setCriteria(config->readNumEntry("Criteria",0));
1992 filter->setCategoryList(config->readListEntry("CategoryList")); 1992 filter->setCategoryList(config->readListEntry("CategoryList"));
1993 mFilters.append(filter); 1993 mFilters.append(filter);
1994 1994
1995 ++it; 1995 ++it;
1996 } 1996 }
1997 1997
1998 if (mFilters.count() == 0) { 1998 if (mFilters.count() == 0) {
1999 CalFilter *filter = new CalFilter(i18n("Default")); 1999 CalFilter *filter = new CalFilter(i18n("Default"));
2000 mFilters.append(filter); 2000 mFilters.append(filter);
2001 } 2001 }
2002 mFilterView->updateFilters(); 2002 mFilterView->updateFilters();
2003 config->setGroup("FilterView"); 2003 config->setGroup("FilterView");
2004 2004
2005 mFilterView->blockSignals(true); 2005 mFilterView->blockSignals(true);
2006 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); 2006 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled"));
2007 mFilterView->setSelectedFilter(config->readEntry("Current Filter")); 2007 mFilterView->setSelectedFilter(config->readEntry("Current Filter"));
2008 mFilterView->blockSignals(false); 2008 mFilterView->blockSignals(false);
2009 // We do it manually to avoid it being done twice by the above calls 2009 // We do it manually to avoid it being done twice by the above calls
2010 updateFilter(); 2010 updateFilter();
2011} 2011}
2012 2012
2013void CalendarView::writeFilterSettings(KConfig *config) 2013void CalendarView::writeFilterSettings(KConfig *config)
2014{ 2014{
2015 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 2015 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
2016 2016
2017 QStringList filterList; 2017 QStringList filterList;
2018 2018
2019 CalFilter *filter = mFilters.first(); 2019 CalFilter *filter = mFilters.first();
2020 while(filter) { 2020 while(filter) {
2021 // kdDebug() << " fn: " << filter->name() << endl; 2021 // kdDebug() << " fn: " << filter->name() << endl;
2022 filterList << filter->name(); 2022 filterList << filter->name();
2023 config->setGroup("Filter_" + filter->name()); 2023 config->setGroup("Filter_" + filter->name());
2024 config->writeEntry("Criteria",filter->criteria()); 2024 config->writeEntry("Criteria",filter->criteria());
2025 config->writeEntry("CategoryList",filter->categoryList()); 2025 config->writeEntry("CategoryList",filter->categoryList());
2026 filter = mFilters.next(); 2026 filter = mFilters.next();
2027 } 2027 }
2028 config->setGroup("General"); 2028 config->setGroup("General");
2029 config->writeEntry("CalendarFilters",filterList); 2029 config->writeEntry("CalendarFilters",filterList);
2030 2030
2031 config->setGroup("FilterView"); 2031 config->setGroup("FilterView");
2032 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 2032 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
2033 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 2033 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
2034} 2034}
2035 2035
2036 2036
2037void CalendarView::goToday() 2037void CalendarView::goToday()
2038{ 2038{
2039 if ( mViewManager->currentView()->isMonthView() ) 2039 if ( mViewManager->currentView()->isMonthView() )
2040 mNavigator->selectTodayMonth(); 2040 mNavigator->selectTodayMonth();
2041 else 2041 else
2042 mNavigator->selectToday(); 2042 mNavigator->selectToday();
2043} 2043}
2044 2044
2045void CalendarView::goNext() 2045void CalendarView::goNext()
2046{ 2046{
2047 mNavigator->selectNext(); 2047 mNavigator->selectNext();
2048} 2048}
2049 2049
2050void CalendarView::goPrevious() 2050void CalendarView::goPrevious()
2051{ 2051{
2052 mNavigator->selectPrevious(); 2052 mNavigator->selectPrevious();
2053} 2053}
2054void CalendarView::goNextMonth() 2054void CalendarView::goNextMonth()
2055{ 2055{
2056 mNavigator->selectNextMonth(); 2056 mNavigator->selectNextMonth();
2057} 2057}
2058 2058
2059void CalendarView::goPreviousMonth() 2059void CalendarView::goPreviousMonth()
2060{ 2060{
2061 mNavigator->selectPreviousMonth(); 2061 mNavigator->selectPreviousMonth();
2062} 2062}
2063void CalendarView::writeLocale() 2063void CalendarView::writeLocale()
2064{ 2064{
2065 //KPimGlobalPrefs::instance()->setGlobalConfig(); 2065 //KPimGlobalPrefs::instance()->setGlobalConfig();
2066#if 0 2066#if 0
2067 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); 2067 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
2068 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); 2068 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
2069 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); 2069 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
2070 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); 2070 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
2071 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 2071 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
2072 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 2072 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
2073 dummy = KOPrefs::instance()->mUserDateFormatShort; 2073 dummy = KOPrefs::instance()->mUserDateFormatShort;
2074 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 2074 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
2075 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 2075 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
2076 KOPrefs::instance()->mDaylightsavingStart, 2076 KOPrefs::instance()->mDaylightsavingStart,
2077 KOPrefs::instance()->mDaylightsavingEnd ); 2077 KOPrefs::instance()->mDaylightsavingEnd );
2078 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); 2078 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId );
2079#endif 2079#endif
2080} 2080}
2081void CalendarView::updateConfig() 2081void CalendarView::updateConfig()
2082{ 2082{
2083 writeLocale(); 2083 writeLocale();
2084 if ( KOPrefs::instance()->mUseAppColors ) 2084 if ( KOPrefs::instance()->mUseAppColors )
2085 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2085 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2086 emit configChanged(); 2086 emit configChanged();
2087 mTodoList->updateConfig(); 2087 mTodoList->updateConfig();
2088 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2088 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2089 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2089 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2090 // To make the "fill window" configurations work 2090 // To make the "fill window" configurations work
2091 //mViewManager->raiseCurrentView(); 2091 //mViewManager->raiseCurrentView();
2092} 2092}
2093 2093
2094 2094
2095void CalendarView::eventChanged(Event *event) 2095void CalendarView::eventChanged(Event *event)
2096{ 2096{
2097 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2097 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2098 //updateUnmanagedViews(); 2098 //updateUnmanagedViews();
2099} 2099}
2100 2100
2101void CalendarView::eventAdded(Event *event) 2101void CalendarView::eventAdded(Event *event)
2102{ 2102{
2103 changeEventDisplay(event,KOGlobals::EVENTADDED); 2103 changeEventDisplay(event,KOGlobals::EVENTADDED);
2104} 2104}
2105 2105
2106void CalendarView::eventToBeDeleted(Event *) 2106void CalendarView::eventToBeDeleted(Event *)
2107{ 2107{
2108 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2108 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2109} 2109}
2110 2110
2111void CalendarView::eventDeleted() 2111void CalendarView::eventDeleted()
2112{ 2112{
2113 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2113 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2114} 2114}
2115void CalendarView::changeTodoDisplay(Todo *which, int action) 2115void CalendarView::changeTodoDisplay(Todo *which, int action)
2116{ 2116{
2117 changeIncidenceDisplay((Incidence *)which, action); 2117 changeIncidenceDisplay((Incidence *)which, action);
2118 mDateNavigator->updateView(); //LR 2118 mDateNavigator->updateView(); //LR
2119 //mDialogManager->updateSearchDialog(); 2119 //mDialogManager->updateSearchDialog();
2120 2120
2121 if (which) { 2121 if (which) {
2122 mViewManager->updateWNview(); 2122 mViewManager->updateWNview();
2123 //mTodoList->updateView(); 2123 //mTodoList->updateView();
2124 } 2124 }
2125 2125
2126} 2126}
2127 2127
2128void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2128void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2129{ 2129{
2130 updateUnmanagedViews(); 2130 updateUnmanagedViews();
2131 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2131 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2132 if ( action == KOGlobals::EVENTDELETED ) { //delete 2132 if ( action == KOGlobals::EVENTDELETED ) { //delete
2133 mCalendar->checkAlarmForIncidence( 0, true ); 2133 mCalendar->checkAlarmForIncidence( 0, true );
2134 if ( mEventViewerDialog ) 2134 if ( mEventViewerDialog )
2135 mEventViewerDialog->hide(); 2135 mEventViewerDialog->hide();
2136 } 2136 }
2137 else 2137 else
2138 mCalendar->checkAlarmForIncidence( which , false ); 2138 mCalendar->checkAlarmForIncidence( which , false );
2139} 2139}
2140 2140
2141// most of the changeEventDisplays() right now just call the view's 2141// most of the changeEventDisplays() right now just call the view's
2142// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2142// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2143void CalendarView::changeEventDisplay(Event *which, int action) 2143void CalendarView::changeEventDisplay(Event *which, int action)
2144{ 2144{
2145 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2145 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2146 changeIncidenceDisplay((Incidence *)which, action); 2146 changeIncidenceDisplay((Incidence *)which, action);
2147 mDateNavigator->updateView(); 2147 mDateNavigator->updateView();
2148 //mDialogManager->updateSearchDialog(); 2148 //mDialogManager->updateSearchDialog();
2149 2149
2150 if (which) { 2150 if (which) {
2151 // If there is an event view visible update the display 2151 // If there is an event view visible update the display
2152 mViewManager->currentView()->changeEventDisplay(which,action); 2152 mViewManager->currentView()->changeEventDisplay(which,action);
2153 // TODO: check, if update needed 2153 // TODO: check, if update needed
2154 // if (which->getTodoStatus()) { 2154 // if (which->getTodoStatus()) {
2155 mTodoList->updateView(); 2155 mTodoList->updateView();
2156 // } 2156 // }
2157 } else { 2157 } else {
2158 mViewManager->currentView()->updateView(); 2158 mViewManager->currentView()->updateView();
2159 } 2159 }
2160} 2160}
2161 2161
2162 2162
2163void CalendarView::updateTodoViews() 2163void CalendarView::updateTodoViews()
2164{ 2164{
2165 mTodoList->updateView(); 2165 mTodoList->updateView();
2166 mViewManager->currentView()->updateView(); 2166 mViewManager->currentView()->updateView();
2167 2167
2168} 2168}
2169 2169
2170 2170
2171void CalendarView::updateView(const QDate &start, const QDate &end) 2171void CalendarView::updateView(const QDate &start, const QDate &end)
2172{ 2172{
2173 mTodoList->updateView(); 2173 mTodoList->updateView();
2174 mViewManager->updateView(start, end); 2174 mViewManager->updateView(start, end);
2175 //mDateNavigator->updateView(); 2175 //mDateNavigator->updateView();
2176} 2176}
2177 2177
2178void CalendarView::updateView() 2178void CalendarView::updateView()
2179{ 2179{
2180 DateList tmpList = mNavigator->selectedDates(); 2180 DateList tmpList = mNavigator->selectedDates();
2181 2181
2182 if ( KOPrefs::instance()->mHideNonStartedTodos ) 2182 if ( KOPrefs::instance()->mHideNonStartedTodos )
2183 mTodoList->updateView(); 2183 mTodoList->updateView();
2184 // We assume that the navigator only selects consecutive days. 2184 // We assume that the navigator only selects consecutive days.
2185 updateView( tmpList.first(), tmpList.last() ); 2185 updateView( tmpList.first(), tmpList.last() );
2186} 2186}
2187 2187
2188void CalendarView::updateUnmanagedViews() 2188void CalendarView::updateUnmanagedViews()
2189{ 2189{
2190 mDateNavigator->updateDayMatrix(); 2190 mDateNavigator->updateDayMatrix();
2191} 2191}
2192 2192
2193int CalendarView::msgItemDelete(const QString name) 2193int CalendarView::msgItemDelete(const QString name)
2194{ 2194{
2195 return KMessageBox::warningContinueCancel(this,name +"\n\n"+ 2195 return KMessageBox::warningContinueCancel(this,name +"\n\n"+
2196 i18n("This item will be\npermanently deleted."), 2196 i18n("This item will be\npermanently deleted."),
2197 i18n("KO/Pi Confirmation"),i18n("Delete")); 2197 i18n("KO/Pi Confirmation"),i18n("Delete"));
2198} 2198}
2199 2199
2200 2200
2201void CalendarView::edit_cut() 2201void CalendarView::edit_cut()
2202{ 2202{
2203 Event *anEvent=0; 2203 Event *anEvent=0;
2204 2204
2205 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2205 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2206 2206
2207 if (mViewManager->currentView()->isEventView()) { 2207 if (mViewManager->currentView()->isEventView()) {
2208 if ( incidence && incidence->type() == "Event" ) { 2208 if ( incidence && incidence->type() == "Event" ) {
2209 anEvent = static_cast<Event *>(incidence); 2209 anEvent = static_cast<Event *>(incidence);
2210 } 2210 }
2211 } 2211 }
2212 2212
2213 if (!anEvent) { 2213 if (!anEvent) {
2214 KNotifyClient::beep(); 2214 KNotifyClient::beep();
2215 return; 2215 return;
2216 } 2216 }
2217 DndFactory factory( mCalendar ); 2217 DndFactory factory( mCalendar );
2218 factory.cutIncidence(anEvent); 2218 factory.cutIncidence(anEvent);
2219 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2219 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2220} 2220}
2221 2221
2222void CalendarView::edit_copy() 2222void CalendarView::edit_copy()
2223{ 2223{
2224 Event *anEvent=0; 2224 Event *anEvent=0;
2225 2225
2226 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2226 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2227 2227
2228 if (mViewManager->currentView()->isEventView()) { 2228 if (mViewManager->currentView()->isEventView()) {
2229 if ( incidence && incidence->type() == "Event" ) { 2229 if ( incidence && incidence->type() == "Event" ) {
2230 anEvent = static_cast<Event *>(incidence); 2230 anEvent = static_cast<Event *>(incidence);
2231 } 2231 }
2232 } 2232 }
2233 2233
2234 if (!anEvent) { 2234 if (!anEvent) {
2235 KNotifyClient::beep(); 2235 KNotifyClient::beep();
2236 return; 2236 return;
2237 } 2237 }
2238 DndFactory factory( mCalendar ); 2238 DndFactory factory( mCalendar );
2239 factory.copyIncidence(anEvent); 2239 factory.copyIncidence(anEvent);
2240} 2240}
2241 2241
2242void CalendarView::edit_paste() 2242void CalendarView::edit_paste()
2243{ 2243{
2244 QDate date = mNavigator->selectedDates().first(); 2244 QDate date = mNavigator->selectedDates().first();
2245 2245
2246 DndFactory factory( mCalendar ); 2246 DndFactory factory( mCalendar );
2247 Event *pastedEvent = (Event *)factory.pasteIncidence( date ); 2247 Event *pastedEvent = (Event *)factory.pasteIncidence( date );
2248 2248
2249 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2249 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2250} 2250}
2251 2251
2252void CalendarView::edit_options() 2252void CalendarView::edit_options()
2253{ 2253{
2254 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId;
2255 emit save();
2256 emit saveStopTimer();
2254 mDialogManager->showOptionsDialog(); 2257 mDialogManager->showOptionsDialog();
2255 //writeSettings(); 2258 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) {
2259 emit saveStopTimer();
2260 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"),
2261 i18n("Timezone settings"),i18n("Reload"))) {
2262 qDebug("KO: TZ reload cancelled ");
2263 return;
2264 }
2265 qDebug("KO: Timezone change ");
2266 openCalendar( MainWindow::defaultFileName() );
2267 setModified(true);
2268 }
2269 else
2270 qDebug("KO: No tz change ");
2271
2256} 2272}
2257 2273
2258 2274
2259void CalendarView::slotSelectPickerDate( QDate d) 2275void CalendarView::slotSelectPickerDate( QDate d)
2260{ 2276{
2261 mDateFrame->hide(); 2277 mDateFrame->hide();
2262 if ( mDatePickerMode == 1 ) { 2278 if ( mDatePickerMode == 1 ) {
2263 mNavigator->slotDaySelect( d ); 2279 mNavigator->slotDaySelect( d );
2264 } else if ( mDatePickerMode == 2 ) { 2280 } else if ( mDatePickerMode == 2 ) {
2265 if ( mMoveIncidence->type() == "Todo" ) { 2281 if ( mMoveIncidence->type() == "Todo" ) {
2266 Todo * to = (Todo *) mMoveIncidence; 2282 Todo * to = (Todo *) mMoveIncidence;
2267 QTime tim; 2283 QTime tim;
2268 if ( to->hasDueDate() ) 2284 if ( to->hasDueDate() )
2269 tim = to->dtDue().time(); 2285 tim = to->dtDue().time();
2270 else { 2286 else {
2271 tim = QTime ( 0,0,0 ); 2287 tim = QTime ( 0,0,0 );
2272 to->setFloats( true ); 2288 to->setFloats( true );
2273 to->setHasDueDate( true ); 2289 to->setHasDueDate( true );
2274 } 2290 }
2275 QDateTime dt ( d,tim ); 2291 QDateTime dt ( d,tim );
2276 to->setDtDue( dt ); 2292 to->setDtDue( dt );
2277 todoChanged( to ); 2293 todoChanged( to );
2278 } else { 2294 } else {
2279 if ( mMoveIncidence->doesRecur() ) { 2295 if ( mMoveIncidence->doesRecur() ) {
2280#if 0 2296#if 0
2281 // PENDING implement this 2297 // PENDING implement this
2282 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); 2298 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate );
2283 mCalendar()->addIncidence( newInc ); 2299 mCalendar()->addIncidence( newInc );
2284 if ( mMoveIncidence->type() == "Todo" ) 2300 if ( mMoveIncidence->type() == "Todo" )
2285 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); 2301 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
2286 else 2302 else
2287 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); 2303 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED);
2288 mMoveIncidence = newInc; 2304 mMoveIncidence = newInc;
2289 2305
2290#endif 2306#endif
2291 } 2307 }
2292 QTime tim = mMoveIncidence->dtStart().time(); 2308 QTime tim = mMoveIncidence->dtStart().time();
2293 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2309 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2294 QDateTime dt ( d,tim ); 2310 QDateTime dt ( d,tim );
2295 mMoveIncidence->setDtStart( dt ); 2311 mMoveIncidence->setDtStart( dt );
2296 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2312 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2297 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2313 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2298 } 2314 }
2299 2315
2300 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2316 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2301 } 2317 }
2302} 2318}
2303 2319
2304void CalendarView::removeCategories() 2320void CalendarView::removeCategories()
2305{ 2321{
2306 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2322 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2307 QStringList catList = KOPrefs::instance()->mCustomCategories; 2323 QStringList catList = KOPrefs::instance()->mCustomCategories;
2308 QStringList catIncList; 2324 QStringList catIncList;
2309 QStringList newCatList; 2325 QStringList newCatList;
2310 Incidence* inc = incList.first(); 2326 Incidence* inc = incList.first();
2311 int i; 2327 int i;
2312 int count = 0; 2328 int count = 0;
2313 while ( inc ) { 2329 while ( inc ) {
2314 newCatList.clear(); 2330 newCatList.clear();
2315 catIncList = inc->categories() ; 2331 catIncList = inc->categories() ;
2316 for( i = 0; i< catIncList.count(); ++i ) { 2332 for( i = 0; i< catIncList.count(); ++i ) {
2317 if ( catList.contains (catIncList[i])) 2333 if ( catList.contains (catIncList[i]))
2318 newCatList.append( catIncList[i] ); 2334 newCatList.append( catIncList[i] );
2319 } 2335 }
2320 newCatList.sort(); 2336 newCatList.sort();
2321 inc->setCategories( newCatList.join(",") ); 2337 inc->setCategories( newCatList.join(",") );
2322 inc = incList.next(); 2338 inc = incList.next();
2323 } 2339 }
2324} 2340}
2325 2341
2326int CalendarView::addCategories() 2342int CalendarView::addCategories()
2327{ 2343{
2328 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2344 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2329 QStringList catList = KOPrefs::instance()->mCustomCategories; 2345 QStringList catList = KOPrefs::instance()->mCustomCategories;
2330 QStringList catIncList; 2346 QStringList catIncList;
2331 Incidence* inc = incList.first(); 2347 Incidence* inc = incList.first();
2332 int i; 2348 int i;
2333 int count = 0; 2349 int count = 0;
2334 while ( inc ) { 2350 while ( inc ) {
2335 catIncList = inc->categories() ; 2351 catIncList = inc->categories() ;
2336 for( i = 0; i< catIncList.count(); ++i ) { 2352 for( i = 0; i< catIncList.count(); ++i ) {
2337 if ( !catList.contains (catIncList[i])) { 2353 if ( !catList.contains (catIncList[i])) {
2338 catList.append( catIncList[i] ); 2354 catList.append( catIncList[i] );
2339 //qDebug("add cat %s ", catIncList[i].latin1()); 2355 //qDebug("add cat %s ", catIncList[i].latin1());
2340 ++count; 2356 ++count;
2341 } 2357 }
2342 } 2358 }
2343 inc = incList.next(); 2359 inc = incList.next();
2344 } 2360 }
2345 catList.sort(); 2361 catList.sort();
2346 KOPrefs::instance()->mCustomCategories = catList; 2362 KOPrefs::instance()->mCustomCategories = catList;
2347 return count; 2363 return count;
2348} 2364}
2349 2365
2350void CalendarView::manageCategories() 2366void CalendarView::manageCategories()
2351{ 2367{
2352 KOCatPrefs* cp = new KOCatPrefs(); 2368 KOCatPrefs* cp = new KOCatPrefs();
2353 cp->show(); 2369 cp->show();
2354 int w =cp->sizeHint().width() ; 2370 int w =cp->sizeHint().width() ;
2355 int h = cp->sizeHint().height() ; 2371 int h = cp->sizeHint().height() ;
2356 int dw = QApplication::desktop()->width(); 2372 int dw = QApplication::desktop()->width();
2357 int dh = QApplication::desktop()->height(); 2373 int dh = QApplication::desktop()->height();
2358 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2374 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2359 if ( !cp->exec() ) { 2375 if ( !cp->exec() ) {
2360 delete cp; 2376 delete cp;
2361 return; 2377 return;
2362 } 2378 }
2363 int count = 0; 2379 int count = 0;
2364 if ( cp->addCat() ) { 2380 if ( cp->addCat() ) {
2365 count = addCategories(); 2381 count = addCategories();
2366 if ( count ) { 2382 if ( count ) {
2367 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2383 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2368 writeSettings(); 2384 writeSettings();
2369 } else 2385 } else
2370 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); 2386 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! "));
2371 } else { 2387 } else {
2372 removeCategories(); 2388 removeCategories();
2373 updateView(); 2389 updateView();
2374 } 2390 }
2375 delete cp; 2391 delete cp;
2376} 2392}
2377 2393
2378void CalendarView::beamIncidence(Incidence * Inc) 2394void CalendarView::beamIncidence(Incidence * Inc)
2379{ 2395{
2380 QPtrList<Incidence> delSel ; 2396 QPtrList<Incidence> delSel ;
2381 delSel.append(Inc); 2397 delSel.append(Inc);
2382 beamIncidenceList( delSel ); 2398 beamIncidenceList( delSel );
2383} 2399}
2384void CalendarView::beamCalendar() 2400void CalendarView::beamCalendar()
2385{ 2401{
2386 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2402 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2387 //qDebug("beamCalendar() "); 2403 //qDebug("beamCalendar() ");
2388 beamIncidenceList( delSel ); 2404 beamIncidenceList( delSel );
2389} 2405}
2390void CalendarView::beamFilteredCalendar() 2406void CalendarView::beamFilteredCalendar()
2391{ 2407{
2392 QPtrList<Incidence> delSel = mCalendar->incidences(); 2408 QPtrList<Incidence> delSel = mCalendar->incidences();
2393 //qDebug("beamFilteredCalendar() "); 2409 //qDebug("beamFilteredCalendar() ");
2394 beamIncidenceList( delSel ); 2410 beamIncidenceList( delSel );
2395} 2411}
2396void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2412void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2397{ 2413{
2398 if ( beamDialog->exec () == QDialog::Rejected ) 2414 if ( beamDialog->exec () == QDialog::Rejected )
2399 return; 2415 return;
2400#ifdef DESKTOP_VERSION 2416#ifdef DESKTOP_VERSION
2401 QString fn = locateLocal( "tmp", "kopibeamfile" ); 2417 QString fn = locateLocal( "tmp", "kopibeamfile" );
2402#else 2418#else
2403 QString fn = "/tmp/kopibeamfile"; 2419 QString fn = "/tmp/kopibeamfile";
2404#endif 2420#endif
2405 QString mes; 2421 QString mes;
2406 bool createbup = true; 2422 bool createbup = true;
2407 if ( createbup ) { 2423 if ( createbup ) {
2408 QString description = "\n"; 2424 QString description = "\n";
2409 CalendarLocal* cal = new CalendarLocal(); 2425 CalendarLocal* cal = new CalendarLocal();
2410 if ( beamDialog->beamLocal() ) 2426 if ( beamDialog->beamLocal() )
2411 cal->setLocalTime(); 2427 cal->setLocalTime();
2412 else 2428 else
2413 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2429 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2414 Incidence *incidence = delSel.first(); 2430 Incidence *incidence = delSel.first();
2415 bool addText = false; 2431 bool addText = false;
2416 if ( delSel.count() < 10 ) 2432 if ( delSel.count() < 10 )
2417 addText = true; 2433 addText = true;
2418 else { 2434 else {
2419 description.sprintf(i18n(" %d items?"),delSel.count() ); 2435 description.sprintf(i18n(" %d items?"),delSel.count() );
2420 } 2436 }
2421 while ( incidence ) { 2437 while ( incidence ) {
2422 Incidence *in = incidence->clone(); 2438 Incidence *in = incidence->clone();
2423 if ( ! in->summary().isEmpty() ) { 2439 if ( ! in->summary().isEmpty() ) {
2424 in->setDescription(""); 2440 in->setDescription("");
2425 } else { 2441 } else {
2426 in->setSummary( in->description().left(20)); 2442 in->setSummary( in->description().left(20));
2427 in->setDescription(""); 2443 in->setDescription("");
2428 } 2444 }
2429 if ( addText ) 2445 if ( addText )
2430 description += in->summary() + "\n"; 2446 description += in->summary() + "\n";
2431 cal->addIncidence( in ); 2447 cal->addIncidence( in );
2432 incidence = delSel.next(); 2448 incidence = delSel.next();
2433 } 2449 }
2434 if ( beamDialog->beamVcal() ) { 2450 if ( beamDialog->beamVcal() ) {
2435 fn += ".vcs"; 2451 fn += ".vcs";
2436 FileStorage storage( cal, fn, new VCalFormat ); 2452 FileStorage storage( cal, fn, new VCalFormat );
2437 storage.save(); 2453 storage.save();
2438 } else { 2454 } else {
2439 fn += ".ics"; 2455 fn += ".ics";
2440 FileStorage storage( cal, fn, new ICalFormat( ) ); 2456 FileStorage storage( cal, fn, new ICalFormat( ) );
2441 storage.save(); 2457 storage.save();
2442 } 2458 }
2443 delete cal; 2459 delete cal;
2444 mes = i18n("KO/Pi: Ready for beaming"); 2460 mes = i18n("KO/Pi: Ready for beaming");
2445 topLevelWidget()->setCaption(mes); 2461 topLevelWidget()->setCaption(mes);
2446 KApplication::convert2latin1( fn ); 2462 KApplication::convert2latin1( fn );
2447#ifndef DESKTOP_VERSION 2463#ifndef DESKTOP_VERSION
2448 Ir *ir = new Ir( this ); 2464 Ir *ir = new Ir( this );
2449 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2465 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2450 ir->send( fn, description, "text/x-vCalendar" ); 2466 ir->send( fn, description, "text/x-vCalendar" );
2451#endif 2467#endif
2452 } 2468 }
2453} 2469}
2454void CalendarView::beamDone( Ir *ir ) 2470void CalendarView::beamDone( Ir *ir )
2455{ 2471{
2456#ifndef DESKTOP_VERSION 2472#ifndef DESKTOP_VERSION
2457 delete ir; 2473 delete ir;
2458#endif 2474#endif
2459 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); 2475 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
2460 topLevelWidget()->raise(); 2476 topLevelWidget()->raise();
2461} 2477}
2462 2478
2463void CalendarView::moveIncidence(Incidence * inc ) 2479void CalendarView::moveIncidence(Incidence * inc )
2464{ 2480{
2465 if ( !inc ) return; 2481 if ( !inc ) return;
2466 // qDebug("showDatePickerForIncidence( ) "); 2482 // qDebug("showDatePickerForIncidence( ) ");
2467 if ( mDateFrame->isVisible() ) 2483 if ( mDateFrame->isVisible() )
2468 mDateFrame->hide(); 2484 mDateFrame->hide();
2469 else { 2485 else {
2470 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; 2486 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ;
2471 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; 2487 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ;
2472 int dw = QApplication::desktop()->width(); 2488 int dw = QApplication::desktop()->width();
2473 int dh = QApplication::desktop()->height(); 2489 int dh = QApplication::desktop()->height();
2474 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2490 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2475 mDateFrame->show(); 2491 mDateFrame->show();
2476 } 2492 }
2477 mDatePickerMode = 2; 2493 mDatePickerMode = 2;
2478 mMoveIncidence = inc ; 2494 mMoveIncidence = inc ;
2479 QDate da; 2495 QDate da;
2480 if ( mMoveIncidence->type() == "Todo" ) { 2496 if ( mMoveIncidence->type() == "Todo" ) {
2481 Todo * to = (Todo *) mMoveIncidence; 2497 Todo * to = (Todo *) mMoveIncidence;
2482 if ( to->hasDueDate() ) 2498 if ( to->hasDueDate() )
2483 da = to->dtDue().date(); 2499 da = to->dtDue().date();
2484 else 2500 else
2485 da = QDate::currentDate(); 2501 da = QDate::currentDate();
2486 } else { 2502 } else {
2487 da = mMoveIncidence->dtStart().date(); 2503 da = mMoveIncidence->dtStart().date();
2488 } 2504 }
2489 //PENDING set date for recurring incidence to date of recurrence 2505 //PENDING set date for recurring incidence to date of recurrence
2490 //mMoveIncidenceOldDate; 2506 //mMoveIncidenceOldDate;
2491 mDatePicker->setDate( da ); 2507 mDatePicker->setDate( da );
2492} 2508}
2493void CalendarView::showDatePicker( ) 2509void CalendarView::showDatePicker( )
2494{ 2510{
2495 //qDebug("CalendarView::showDatePicker( ) "); 2511 //qDebug("CalendarView::showDatePicker( ) ");
2496 if ( mDateFrame->isVisible() ) 2512 if ( mDateFrame->isVisible() )
2497 mDateFrame->hide(); 2513 mDateFrame->hide();
2498 else { 2514 else {
2499 int w =mDatePicker->sizeHint().width() ; 2515 int w =mDatePicker->sizeHint().width() ;
2500 int h = mDatePicker->sizeHint().height() ; 2516 int h = mDatePicker->sizeHint().height() ;
2501 int dw = QApplication::desktop()->width(); 2517 int dw = QApplication::desktop()->width();
2502 int dh = QApplication::desktop()->height(); 2518 int dh = QApplication::desktop()->height();
2503 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2519 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2504 mDateFrame->show(); 2520 mDateFrame->show();
2505 } 2521 }
2506 mDatePickerMode = 1; 2522 mDatePickerMode = 1;
2507 mDatePicker->setDate( mNavigator->selectedDates().first() ); 2523 mDatePicker->setDate( mNavigator->selectedDates().first() );
2508} 2524}
2509 2525
2510void CalendarView::showEventEditor() 2526void CalendarView::showEventEditor()
2511{ 2527{
2512#ifdef DESKTOP_VERSION 2528#ifdef DESKTOP_VERSION
2513 mEventEditor->show(); 2529 mEventEditor->show();
2514#else 2530#else
2515 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { 2531 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) {
2516 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 2532 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2517 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); 2533 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() );
2518 qApp->processEvents(); 2534 qApp->processEvents();
2519 delete mEventEditor; 2535 delete mEventEditor;
2520 mEventEditor = mDialogManager->getEventEditor(); 2536 mEventEditor = mDialogManager->getEventEditor();
2521 topLevelWidget()->setCaption( i18n("") ); 2537 topLevelWidget()->setCaption( i18n("") );
2522 } 2538 }
2523 mEventEditor->showMaximized(); 2539 mEventEditor->showMaximized();
2524#endif 2540#endif
2525} 2541}
2526void CalendarView::showTodoEditor() 2542void CalendarView::showTodoEditor()
2527{ 2543{
2528#ifdef DESKTOP_VERSION 2544#ifdef DESKTOP_VERSION
2529 mTodoEditor->show(); 2545 mTodoEditor->show();
2530#else 2546#else
2531 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { 2547 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) {
2532 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 2548 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2533 qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); 2549 qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() );
2534 qApp->processEvents(); 2550 qApp->processEvents();
2535 delete mTodoEditor; 2551 delete mTodoEditor;
2536 mTodoEditor = mDialogManager->getTodoEditor(); 2552 mTodoEditor = mDialogManager->getTodoEditor();
2537 topLevelWidget()->setCaption( i18n("") ); 2553 topLevelWidget()->setCaption( i18n("") );
2538 } 2554 }
2539 mTodoEditor->showMaximized(); 2555 mTodoEditor->showMaximized();
2540#endif 2556#endif
2541} 2557}
2542 2558
2543void CalendarView::cloneIncidence() 2559void CalendarView::cloneIncidence()
2544{ 2560{
2545 Incidence *incidence = currentSelection(); 2561 Incidence *incidence = currentSelection();
2546 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2562 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2547 if ( incidence ) { 2563 if ( incidence ) {
2548 cloneIncidence(incidence); 2564 cloneIncidence(incidence);
2549 } 2565 }
2550} 2566}
2551void CalendarView::moveIncidence() 2567void CalendarView::moveIncidence()
2552{ 2568{
2553 Incidence *incidence = currentSelection(); 2569 Incidence *incidence = currentSelection();
2554 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2570 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2555 if ( incidence ) { 2571 if ( incidence ) {
2556 moveIncidence(incidence); 2572 moveIncidence(incidence);
2557 } 2573 }
2558} 2574}
2559void CalendarView::beamIncidence() 2575void CalendarView::beamIncidence()
2560{ 2576{
2561 Incidence *incidence = currentSelection(); 2577 Incidence *incidence = currentSelection();
2562 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2578 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2563 if ( incidence ) { 2579 if ( incidence ) {
2564 beamIncidence(incidence); 2580 beamIncidence(incidence);
2565 } 2581 }
2566} 2582}
2567void CalendarView::toggleCancelIncidence() 2583void CalendarView::toggleCancelIncidence()
2568{ 2584{
2569 Incidence *incidence = currentSelection(); 2585 Incidence *incidence = currentSelection();
2570 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2586 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2571 if ( incidence ) { 2587 if ( incidence ) {
2572 cancelIncidence(incidence); 2588 cancelIncidence(incidence);
2573 } 2589 }
2574} 2590}
2575 2591
2576 2592
2577void CalendarView::cancelIncidence(Incidence * inc ) 2593void CalendarView::cancelIncidence(Incidence * inc )
2578{ 2594{
2579 inc->setCancelled( ! inc->cancelled() ); 2595 inc->setCancelled( ! inc->cancelled() );
2580 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); 2596 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED );
2581 updateView(); 2597 updateView();
2582} 2598}
2583void CalendarView::cloneIncidence(Incidence * orgInc ) 2599void CalendarView::cloneIncidence(Incidence * orgInc )
2584{ 2600{
2585 Incidence * newInc = orgInc->clone(); 2601 Incidence * newInc = orgInc->clone();
2586 newInc->recreate(); 2602 newInc->recreate();
2587 2603
2588 if ( newInc->type() == "Todo" ) { 2604 if ( newInc->type() == "Todo" ) {
2589 Todo* t = (Todo*) newInc; 2605 Todo* t = (Todo*) newInc;
2590 showTodoEditor(); 2606 showTodoEditor();
2591 mTodoEditor->editTodo( t ); 2607 mTodoEditor->editTodo( t );
2592 if ( mTodoEditor->exec() ) { 2608 if ( mTodoEditor->exec() ) {
2593 mCalendar->addTodo( t ); 2609 mCalendar->addTodo( t );
2594 updateView(); 2610 updateView();
2595 } else { 2611 } else {
2596 delete t; 2612 delete t;
2597 } 2613 }
2598 } 2614 }
2599 else { 2615 else {
2600 Event* e = (Event*) newInc; 2616 Event* e = (Event*) newInc;
2601 showEventEditor(); 2617 showEventEditor();
2602 mEventEditor->editEvent( e ); 2618 mEventEditor->editEvent( e );
2603 if ( mEventEditor->exec() ) { 2619 if ( mEventEditor->exec() ) {
2604 mCalendar->addEvent( e ); 2620 mCalendar->addEvent( e );
2605 updateView(); 2621 updateView();
2606 } else { 2622 } else {
2607 delete e; 2623 delete e;
2608 } 2624 }
2609 } 2625 }
2610} 2626}
2611 2627
2612void CalendarView::newEvent() 2628void CalendarView::newEvent()
2613{ 2629{
2614 // TODO: Replace this code by a common eventDurationHint of KOBaseView. 2630 // TODO: Replace this code by a common eventDurationHint of KOBaseView.
2615 KOAgendaView *aView = mViewManager->agendaView(); 2631 KOAgendaView *aView = mViewManager->agendaView();
2616 if (aView) { 2632 if (aView) {
2617 if (aView->selectionStart().isValid()) { 2633 if (aView->selectionStart().isValid()) {
2618 if (aView->selectedIsAllDay()) { 2634 if (aView->selectedIsAllDay()) {
2619 newEvent(aView->selectionStart(),aView->selectionEnd(),true); 2635 newEvent(aView->selectionStart(),aView->selectionEnd(),true);
2620 } else { 2636 } else {
2621 newEvent(aView->selectionStart(),aView->selectionEnd()); 2637 newEvent(aView->selectionStart(),aView->selectionEnd());
2622 } 2638 }
2623 return; 2639 return;
2624 } 2640 }
2625 } 2641 }
2626 2642
2627 QDate date = mNavigator->selectedDates().first(); 2643 QDate date = mNavigator->selectedDates().first();
2628 QDateTime current = QDateTime::currentDateTime(); 2644 QDateTime current = QDateTime::currentDateTime();
2629 if ( date <= current.date() ) { 2645 if ( date <= current.date() ) {
2630 int hour = current.time().hour() +1; 2646 int hour = current.time().hour() +1;
2631 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), 2647 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ),
2632 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2648 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2633 } else 2649 } else
2634 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), 2650 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ),
2635 QDateTime( date, QTime( KOPrefs::instance()->mStartTime + 2651 QDateTime( date, QTime( KOPrefs::instance()->mStartTime +
2636 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2652 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2637} 2653}
2638 2654
2639void CalendarView::newEvent(QDateTime fh) 2655void CalendarView::newEvent(QDateTime fh)
2640{ 2656{
2641 newEvent(fh, 2657 newEvent(fh,
2642 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); 2658 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration)));
2643} 2659}
2644 2660
2645void CalendarView::newEvent(QDate dt) 2661void CalendarView::newEvent(QDate dt)
2646{ 2662{
2647 newEvent(QDateTime(dt, QTime(0,0,0)), 2663 newEvent(QDateTime(dt, QTime(0,0,0)),
2648 QDateTime(dt, QTime(0,0,0)), true); 2664 QDateTime(dt, QTime(0,0,0)), true);
2649} 2665}
2650void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint) 2666void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint)
2651{ 2667{
2652 newEvent(fromHint, toHint, false); 2668 newEvent(fromHint, toHint, false);
2653} 2669}
2654void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) 2670void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay)
2655{ 2671{
2656 2672
2657 showEventEditor(); 2673 showEventEditor();
2658 mEventEditor->newEvent(fromHint,toHint,allDay); 2674 mEventEditor->newEvent(fromHint,toHint,allDay);
2659 if ( mFilterView->filtersEnabled() ) { 2675 if ( mFilterView->filtersEnabled() ) {
2660 CalFilter *filter = mFilterView->selectedFilter(); 2676 CalFilter *filter = mFilterView->selectedFilter();
2661 if (filter && filter->showCategories()) { 2677 if (filter && filter->showCategories()) {
2662 mEventEditor->setCategories(filter->categoryList().join(",") ); 2678 mEventEditor->setCategories(filter->categoryList().join(",") );
2663 } 2679 }
2664 if ( filter ) 2680 if ( filter )
2665 mEventEditor->setSecrecy( filter->getSecrecy() ); 2681 mEventEditor->setSecrecy( filter->getSecrecy() );
2666 } 2682 }
2667} 2683}
2668void CalendarView::todoAdded(Todo * t) 2684void CalendarView::todoAdded(Todo * t)
2669{ 2685{
2670 2686
2671 changeTodoDisplay ( t ,KOGlobals::EVENTADDED); 2687 changeTodoDisplay ( t ,KOGlobals::EVENTADDED);
2672 updateTodoViews(); 2688 updateTodoViews();
2673} 2689}
2674void CalendarView::todoChanged(Todo * t) 2690void CalendarView::todoChanged(Todo * t)
2675{ 2691{
2676 emit todoModified( t, 4 ); 2692 emit todoModified( t, 4 );
2677 // updateTodoViews(); 2693 // updateTodoViews();
2678} 2694}
2679void CalendarView::todoToBeDeleted(Todo *) 2695void CalendarView::todoToBeDeleted(Todo *)
2680{ 2696{
2681 //qDebug("todoToBeDeleted(Todo *) "); 2697 //qDebug("todoToBeDeleted(Todo *) ");
2682 updateTodoViews(); 2698 updateTodoViews();
2683} 2699}
2684void CalendarView::todoDeleted() 2700void CalendarView::todoDeleted()
2685{ 2701{
2686 //qDebug(" todoDeleted()"); 2702 //qDebug(" todoDeleted()");
2687 updateTodoViews(); 2703 updateTodoViews();
2688} 2704}
2689 2705
2690 2706
2691void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) 2707void CalendarView::newTodoDateTime( QDateTime dt, bool allday )
2692{ 2708{
2693 showTodoEditor(); 2709 showTodoEditor();
2694 mTodoEditor->newTodo(dt,0,allday); 2710 mTodoEditor->newTodo(dt,0,allday);
2695 if ( mFilterView->filtersEnabled() ) { 2711 if ( mFilterView->filtersEnabled() ) {
2696 CalFilter *filter = mFilterView->selectedFilter(); 2712 CalFilter *filter = mFilterView->selectedFilter();
2697 if (filter && filter->showCategories()) { 2713 if (filter && filter->showCategories()) {
2698 mTodoEditor->setCategories(filter->categoryList().join(",") ); 2714 mTodoEditor->setCategories(filter->categoryList().join(",") );
2699 } 2715 }
2700 if ( filter ) 2716 if ( filter )
2701 mTodoEditor->setSecrecy( filter->getSecrecy() ); 2717 mTodoEditor->setSecrecy( filter->getSecrecy() );
2702 } 2718 }
2703} 2719}
2704 2720
2705void CalendarView::newTodo() 2721void CalendarView::newTodo()
2706{ 2722{
2707 newTodoDateTime( QDateTime(),true ); 2723 newTodoDateTime( QDateTime(),true );
2708} 2724}
2709 2725
2710void CalendarView::newSubTodo() 2726void CalendarView::newSubTodo()
2711{ 2727{
2712 Todo *todo = selectedTodo(); 2728 Todo *todo = selectedTodo();
2713 if ( todo ) newSubTodo( todo ); 2729 if ( todo ) newSubTodo( todo );
2714} 2730}
2715 2731
2716void CalendarView::newSubTodo(Todo *parentEvent) 2732void CalendarView::newSubTodo(Todo *parentEvent)
2717{ 2733{
2718 2734
2719 showTodoEditor(); 2735 showTodoEditor();
2720 mTodoEditor->newTodo(QDateTime(),parentEvent,true); 2736 mTodoEditor->newTodo(QDateTime(),parentEvent,true);
2721} 2737}
2722 2738
2723void CalendarView::newFloatingEvent() 2739void CalendarView::newFloatingEvent()
2724{ 2740{
2725 DateList tmpList = mNavigator->selectedDates(); 2741 DateList tmpList = mNavigator->selectedDates();
2726 QDate date = tmpList.first(); 2742 QDate date = tmpList.first();
2727 2743
2728 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), 2744 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ),
2729 QDateTime( date, QTime( 12, 0, 0 ) ), true ); 2745 QDateTime( date, QTime( 12, 0, 0 ) ), true );
2730} 2746}
2731 2747
2732 2748
2733void CalendarView::editEvent( Event *event ) 2749void CalendarView::editEvent( Event *event )
2734{ 2750{
2735 2751
2736 if ( !event ) return; 2752 if ( !event ) return;
2737 if ( event->isReadOnly() ) { 2753 if ( event->isReadOnly() ) {
2738 showEvent( event ); 2754 showEvent( event );
2739 return; 2755 return;
2740 } 2756 }
2741 showEventEditor(); 2757 showEventEditor();
2742 mEventEditor->editEvent( event , mFlagEditDescription); 2758 mEventEditor->editEvent( event , mFlagEditDescription);
2743} 2759}
2744void CalendarView::editJournal( Journal *jour ) 2760void CalendarView::editJournal( Journal *jour )
2745{ 2761{
2746 if ( !jour ) return; 2762 if ( !jour ) return;
2747 mDialogManager->hideSearchDialog(); 2763 mDialogManager->hideSearchDialog();
2748 mViewManager->showJournalView(); 2764 mViewManager->showJournalView();
2749 mNavigator->slotDaySelect( jour->dtStart().date() ); 2765 mNavigator->slotDaySelect( jour->dtStart().date() );
2750} 2766}
2751void CalendarView::editTodo( Todo *todo ) 2767void CalendarView::editTodo( Todo *todo )
2752{ 2768{
2753 if ( !todo ) return; 2769 if ( !todo ) return;
2754 2770
2755 if ( todo->isReadOnly() ) { 2771 if ( todo->isReadOnly() ) {
2756 showTodo( todo ); 2772 showTodo( todo );
2757 return; 2773 return;
2758 } 2774 }
2759 showTodoEditor(); 2775 showTodoEditor();
2760 mTodoEditor->editTodo( todo ,mFlagEditDescription); 2776 mTodoEditor->editTodo( todo ,mFlagEditDescription);
2761 2777
2762} 2778}
2763 2779
2764KOEventViewerDialog* CalendarView::getEventViewerDialog() 2780KOEventViewerDialog* CalendarView::getEventViewerDialog()
2765{ 2781{
2766 if ( !mEventViewerDialog ) { 2782 if ( !mEventViewerDialog ) {
2767 mEventViewerDialog = new KOEventViewerDialog(this); 2783 mEventViewerDialog = new KOEventViewerDialog(this);
2768 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); 2784 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) );
2769 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); 2785 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig()));
2770 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), 2786 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)),
2771 dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 2787 dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
2772 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), 2788 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ),
2773 viewManager(), SLOT( showAgendaView( bool ) ) ); 2789 viewManager(), SLOT( showAgendaView( bool ) ) );
2774 connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), 2790 connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ),
2775 this, SLOT( todoChanged(Todo *) ) ); 2791 this, SLOT( todoChanged(Todo *) ) );
2776 mEventViewerDialog->resize( 640, 480 ); 2792 mEventViewerDialog->resize( 640, 480 );
2777 2793
2778 } 2794 }
2779 return mEventViewerDialog; 2795 return mEventViewerDialog;
2780} 2796}
2781void CalendarView::showEvent(Event *event) 2797void CalendarView::showEvent(Event *event)
2782{ 2798{
2783 getEventViewerDialog()->setEvent(event); 2799 getEventViewerDialog()->setEvent(event);
2784 getEventViewerDialog()->showMe(); 2800 getEventViewerDialog()->showMe();
2785} 2801}
2786 2802
2787void CalendarView::showTodo(Todo *event) 2803void CalendarView::showTodo(Todo *event)
2788{ 2804{
2789 getEventViewerDialog()->setTodo(event); 2805 getEventViewerDialog()->setTodo(event);
2790 getEventViewerDialog()->showMe(); 2806 getEventViewerDialog()->showMe();
2791} 2807}
2792void CalendarView::showJournal( Journal *jour ) 2808void CalendarView::showJournal( Journal *jour )
2793{ 2809{
2794 getEventViewerDialog()->setJournal(jour); 2810 getEventViewerDialog()->setJournal(jour);
2795 getEventViewerDialog()->showMe(); 2811 getEventViewerDialog()->showMe();
2796 2812
2797} 2813}
2798// void CalendarView::todoModified (Todo *event, int changed) 2814// void CalendarView::todoModified (Todo *event, int changed)
2799// { 2815// {
2800// // if (mDialogList.find (event) != mDialogList.end ()) { 2816// // if (mDialogList.find (event) != mDialogList.end ()) {
2801// // kdDebug() << "Todo modified and open" << endl; 2817// // kdDebug() << "Todo modified and open" << endl;
2802// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; 2818// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event];
2803// // temp->modified (changed); 2819// // temp->modified (changed);
2804 2820
2805// // } 2821// // }
2806 2822
2807// mViewManager->updateView(); 2823// mViewManager->updateView();
2808// } 2824// }
2809 2825
2810void CalendarView::appointment_show() 2826void CalendarView::appointment_show()
2811{ 2827{
2812 Event *anEvent = 0; 2828 Event *anEvent = 0;
2813 2829
2814 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2830 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2815 2831
2816 if (mViewManager->currentView()->isEventView()) { 2832 if (mViewManager->currentView()->isEventView()) {
2817 if ( incidence && incidence->type() == "Event" ) { 2833 if ( incidence && incidence->type() == "Event" ) {
2818 anEvent = static_cast<Event *>(incidence); 2834 anEvent = static_cast<Event *>(incidence);
2819 } 2835 }
2820 } 2836 }
2821 2837
2822 if (!anEvent) { 2838 if (!anEvent) {
2823 KNotifyClient::beep(); 2839 KNotifyClient::beep();
2824 return; 2840 return;
2825 } 2841 }
2826 2842
2827 showEvent(anEvent); 2843 showEvent(anEvent);
2828} 2844}
2829 2845
2830void CalendarView::appointment_edit() 2846void CalendarView::appointment_edit()
2831{ 2847{
2832 Event *anEvent = 0; 2848 Event *anEvent = 0;
2833 2849
2834 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2850 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2835 2851
2836 if (mViewManager->currentView()->isEventView()) { 2852 if (mViewManager->currentView()->isEventView()) {
2837 if ( incidence && incidence->type() == "Event" ) { 2853 if ( incidence && incidence->type() == "Event" ) {
2838 anEvent = static_cast<Event *>(incidence); 2854 anEvent = static_cast<Event *>(incidence);
2839 } 2855 }
2840 } 2856 }
2841 2857
2842 if (!anEvent) { 2858 if (!anEvent) {
2843 KNotifyClient::beep(); 2859 KNotifyClient::beep();
2844 return; 2860 return;
2845 } 2861 }
2846 2862
2847 editEvent(anEvent); 2863 editEvent(anEvent);
2848} 2864}
2849 2865
2850void CalendarView::appointment_delete() 2866void CalendarView::appointment_delete()
2851{ 2867{
2852 Event *anEvent = 0; 2868 Event *anEvent = 0;
2853 2869
2854 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2870 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2855 2871
2856 if (mViewManager->currentView()->isEventView()) { 2872 if (mViewManager->currentView()->isEventView()) {
2857 if ( incidence && incidence->type() == "Event" ) { 2873 if ( incidence && incidence->type() == "Event" ) {
2858 anEvent = static_cast<Event *>(incidence); 2874 anEvent = static_cast<Event *>(incidence);
2859 } 2875 }
2860 } 2876 }
2861 2877
2862 if (!anEvent) { 2878 if (!anEvent) {
2863 KNotifyClient::beep(); 2879 KNotifyClient::beep();
2864 return; 2880 return;
2865 } 2881 }
2866 2882
2867 deleteEvent(anEvent); 2883 deleteEvent(anEvent);
2868} 2884}
2869 2885
2870void CalendarView::todo_resub( Todo * parent, Todo * sub ) 2886void CalendarView::todo_resub( Todo * parent, Todo * sub )
2871{ 2887{
2872 if (!sub) return; 2888 if (!sub) return;
2873 if (!parent) return; 2889 if (!parent) return;
2874 if ( sub->relatedTo() ) 2890 if ( sub->relatedTo() )
2875 sub->relatedTo()->removeRelation(sub); 2891 sub->relatedTo()->removeRelation(sub);
2876 sub->setRelatedTo(parent); 2892 sub->setRelatedTo(parent);
2877 sub->setRelatedToUid(parent->uid()); 2893 sub->setRelatedToUid(parent->uid());
2878 parent->addRelation(sub); 2894 parent->addRelation(sub);
2879 sub->updated(); 2895 sub->updated();
2880 parent->updated(); 2896 parent->updated();
2881 setModified(true); 2897 setModified(true);
2882 updateView(); 2898 updateView();
2883} 2899}
2884void CalendarView::todo_unsub(Todo *anTodo ) 2900void CalendarView::todo_unsub(Todo *anTodo )
2885{ 2901{
2886 // Todo *anTodo = selectedTodo(); 2902 // Todo *anTodo = selectedTodo();
2887 if (!anTodo) return; 2903 if (!anTodo) return;
2888 if (!anTodo->relatedTo()) return; 2904 if (!anTodo->relatedTo()) return;
2889 anTodo->relatedTo()->removeRelation(anTodo); 2905 anTodo->relatedTo()->removeRelation(anTodo);
2890 anTodo->setRelatedTo(0); 2906 anTodo->setRelatedTo(0);
2891 anTodo->updated(); 2907 anTodo->updated();
2892 anTodo->setRelatedToUid(""); 2908 anTodo->setRelatedToUid("");
2893 setModified(true); 2909 setModified(true);
2894 updateView(); 2910 updateView();
2895} 2911}
2896 2912
2897void CalendarView::deleteTodo(Todo *todo) 2913void CalendarView::deleteTodo(Todo *todo)
2898{ 2914{
2899 if (!todo) { 2915 if (!todo) {
2900 KNotifyClient::beep(); 2916 KNotifyClient::beep();
2901 return; 2917 return;
2902 } 2918 }
2903 if (KOPrefs::instance()->mConfirm) { 2919 if (KOPrefs::instance()->mConfirm) {
2904 QString text = todo->summary().left(20); 2920 QString text = todo->summary().left(20);
2905 if (!todo->relations().isEmpty()) { 2921 if (!todo->relations().isEmpty()) {
2906 text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); 2922 text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!");
2907 2923
2908 } 2924 }
2909 switch (msgItemDelete(text)) { 2925 switch (msgItemDelete(text)) {
2910 case KMessageBox::Continue: // OK 2926 case KMessageBox::Continue: // OK
2911 bool deleteT = false; 2927 bool deleteT = false;
2912 if (!todo->relations().isEmpty()) { 2928 if (!todo->relations().isEmpty()) {
2913 deleteT = removeCompletedSubTodos( todo ); 2929 deleteT = removeCompletedSubTodos( todo );
2914 } 2930 }
2915 // deleteT == true: todo already deleted in removeCompletedSubTodos 2931 // deleteT == true: todo already deleted in removeCompletedSubTodos
2916 if ( !deleteT ) { 2932 if ( !deleteT ) {
2917 checkExternalId( todo ); 2933 checkExternalId( todo );
2918 calendar()->deleteTodo(todo); 2934 calendar()->deleteTodo(todo);
2919 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 2935 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
2920 updateView(); 2936 updateView();
2921 } 2937 }
2922 break; 2938 break;
2923 } // switch 2939 } // switch
2924 } else { 2940 } else {
2925 checkExternalId( todo ); 2941 checkExternalId( todo );
2926 mCalendar->deleteTodo(todo); 2942 mCalendar->deleteTodo(todo);
2927 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 2943 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
2928 updateView(); 2944 updateView();
2929 } 2945 }
2930 2946
2931 emit updateSearchDialog(); 2947 emit updateSearchDialog();
2932} 2948}
2933void CalendarView::deleteJournal(Journal *jour) 2949void CalendarView::deleteJournal(Journal *jour)
2934{ 2950{
2935 if (!jour) { 2951 if (!jour) {
2936 KNotifyClient::beep(); 2952 KNotifyClient::beep();
2937 return; 2953 return;
2938 } 2954 }
2939 if (KOPrefs::instance()->mConfirm) { 2955 if (KOPrefs::instance()->mConfirm) {
2940 switch (msgItemDelete( jour->description().left(20))) { 2956 switch (msgItemDelete( jour->description().left(20))) {
2941 case KMessageBox::Continue: // OK 2957 case KMessageBox::Continue: // OK
2942 calendar()->deleteJournal(jour); 2958 calendar()->deleteJournal(jour);
2943 updateView(); 2959 updateView();
2944 break; 2960 break;
2945 } // switch 2961 } // switch
2946 } else { 2962 } else {
2947 calendar()->deleteJournal(jour);; 2963 calendar()->deleteJournal(jour);;
2948 updateView(); 2964 updateView();
2949 } 2965 }
2950 emit updateSearchDialog(); 2966 emit updateSearchDialog();
2951} 2967}
2952 2968
2953void CalendarView::deleteEvent(Event *anEvent) 2969void CalendarView::deleteEvent(Event *anEvent)
2954{ 2970{
2955 if (!anEvent) { 2971 if (!anEvent) {
2956 KNotifyClient::beep(); 2972 KNotifyClient::beep();
2957 return; 2973 return;
2958 } 2974 }
2959 2975
2960 if (anEvent->recurrence()->doesRecur()) { 2976 if (anEvent->recurrence()->doesRecur()) {
2961 QDate itemDate = mViewManager->currentSelectionDate(); 2977 QDate itemDate = mViewManager->currentSelectionDate();
2962 int km; 2978 int km;
2963 if (!itemDate.isValid()) { 2979 if (!itemDate.isValid()) {
2964 //kdDebug() << "Date Not Valid" << endl; 2980 //kdDebug() << "Date Not Valid" << endl;
2965 if (KOPrefs::instance()->mConfirm) { 2981 if (KOPrefs::instance()->mConfirm) {
2966 km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + 2982 km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) +
2967 i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), 2983 i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"),
2968 i18n("KO/Pi Confirmation"),i18n("Delete All")); 2984 i18n("KO/Pi Confirmation"),i18n("Delete All"));
2969 if ( km == KMessageBox::Continue ) 2985 if ( km == KMessageBox::Continue )
2970 km = KMessageBox::No; // No = all below 2986 km = KMessageBox::No; // No = all below
2971 } else 2987 } else
2972 km = KMessageBox::No; 2988 km = KMessageBox::No;
2973 } else { 2989 } else {
2974 km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) + 2990 km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) +
2975 i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ 2991 i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+
2976 KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), 2992 KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"),
2977 i18n("KO/Pi Confirmation"),i18n("Current"), 2993 i18n("KO/Pi Confirmation"),i18n("Current"),
2978 i18n("All")); 2994 i18n("All"));
2979 } 2995 }
2980 switch(km) { 2996 switch(km) {
2981 2997
2982 case KMessageBox::No: // Continue // all 2998 case KMessageBox::No: // Continue // all
2983 //qDebug("KMessageBox::No "); 2999 //qDebug("KMessageBox::No ");
2984 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 3000 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
2985 schedule(Scheduler::Cancel,anEvent); 3001 schedule(Scheduler::Cancel,anEvent);
2986 3002
2987 checkExternalId( anEvent); 3003 checkExternalId( anEvent);
2988 mCalendar->deleteEvent(anEvent); 3004 mCalendar->deleteEvent(anEvent);
2989 changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); 3005 changeEventDisplay(anEvent,KOGlobals::EVENTDELETED);
2990 break; 3006 break;
2991 3007
2992 // Disabled because it does not work 3008 // Disabled because it does not work
2993 //#if 0 3009 //#if 0
2994 case KMessageBox::Yes: // just this one 3010 case KMessageBox::Yes: // just this one
2995 //QDate qd = mNavigator->selectedDates().first(); 3011 //QDate qd = mNavigator->selectedDates().first();
2996 //if (!qd.isValid()) { 3012 //if (!qd.isValid()) {
2997 // kdDebug() << "no date selected, or invalid date" << endl; 3013 // kdDebug() << "no date selected, or invalid date" << endl;
2998 // KNotifyClient::beep(); 3014 // KNotifyClient::beep();
2999 // return; 3015 // return;
3000 //} 3016 //}
3001 //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); 3017 //while (!anEvent->recursOn(qd)) qd = qd.addDays(1);
3002 if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { 3018 if (itemDate!=QDate(1,1,1) || itemDate.isValid()) {
3003 anEvent->addExDate(itemDate); 3019 anEvent->addExDate(itemDate);
3004 int duration = anEvent->recurrence()->duration(); 3020 int duration = anEvent->recurrence()->duration();
3005 if ( duration > 0 ) { 3021 if ( duration > 0 ) {
3006 anEvent->recurrence()->setDuration( duration - 1 ); 3022 anEvent->recurrence()->setDuration( duration - 1 );
3007 } 3023 }
3008 changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); 3024 changeEventDisplay(anEvent, KOGlobals::EVENTEDITED);
3009 } 3025 }
3010 break; 3026 break;
3011 //#endif 3027 //#endif
3012 } // switch 3028 } // switch
3013 } else { 3029 } else {
3014 if (KOPrefs::instance()->mConfirm) { 3030 if (KOPrefs::instance()->mConfirm) {
3015 switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + 3031 switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) +
3016 i18n("\nAre you sure you want\nto delete this event?"), 3032 i18n("\nAre you sure you want\nto delete this event?"),
3017 i18n("KO/Pi Confirmation"),i18n("Delete"))) { 3033 i18n("KO/Pi Confirmation"),i18n("Delete"))) {
3018 case KMessageBox::Continue: // OK 3034 case KMessageBox::Continue: // OK
3019 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 3035 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
3020 schedule(Scheduler::Cancel,anEvent); 3036 schedule(Scheduler::Cancel,anEvent);
3021 checkExternalId( anEvent); 3037 checkExternalId( anEvent);
3022 mCalendar->deleteEvent(anEvent); 3038 mCalendar->deleteEvent(anEvent);
3023 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 3039 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
3024 break; 3040 break;
3025 } // switch 3041 } // switch
3026 } else { 3042 } else {
3027 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 3043 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
3028 schedule(Scheduler::Cancel,anEvent); 3044 schedule(Scheduler::Cancel,anEvent);
3029 checkExternalId( anEvent); 3045 checkExternalId( anEvent);
3030 mCalendar->deleteEvent(anEvent); 3046 mCalendar->deleteEvent(anEvent);
3031 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 3047 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
3032 } 3048 }
3033 } // if-else 3049 } // if-else
3034 emit updateSearchDialog(); 3050 emit updateSearchDialog();
3035} 3051}
3036 3052
3037bool CalendarView::deleteEvent(const QString &uid) 3053bool CalendarView::deleteEvent(const QString &uid)
3038{ 3054{
3039 Event *ev = mCalendar->event(uid); 3055 Event *ev = mCalendar->event(uid);
3040 if (ev) { 3056 if (ev) {
3041 deleteEvent(ev); 3057 deleteEvent(ev);
3042 return true; 3058 return true;
3043 } else { 3059 } else {
3044 return false; 3060 return false;
3045 } 3061 }
3046} 3062}
3047 3063
3048/*****************************************************************************/ 3064/*****************************************************************************/
3049 3065
3050void CalendarView::action_mail() 3066void CalendarView::action_mail()
3051{ 3067{
3052#ifndef KORG_NOMAIL 3068#ifndef KORG_NOMAIL
3053 KOMailClient mailClient; 3069 KOMailClient mailClient;
3054 3070
3055 Incidence *incidence = currentSelection(); 3071 Incidence *incidence = currentSelection();
3056 3072
3057 if (!incidence) { 3073 if (!incidence) {
3058 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 3074 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
3059 return; 3075 return;
3060 } 3076 }
3061 if(incidence->attendeeCount() == 0 ) { 3077 if(incidence->attendeeCount() == 0 ) {
3062 KMessageBox::sorry(this, 3078 KMessageBox::sorry(this,
3063 i18n("Can't generate mail:\nNo attendees defined.\n")); 3079 i18n("Can't generate mail:\nNo attendees defined.\n"));
3064 return; 3080 return;
3065 } 3081 }
3066 3082
3067 CalendarLocal cal_tmp; 3083 CalendarLocal cal_tmp;
3068 Event *event = 0; 3084 Event *event = 0;
3069 Event *ev = 0; 3085 Event *ev = 0;
3070 if ( incidence && incidence->type() == "Event" ) { 3086 if ( incidence && incidence->type() == "Event" ) {
3071 event = static_cast<Event *>(incidence); 3087 event = static_cast<Event *>(incidence);
3072 ev = new Event(*event); 3088 ev = new Event(*event);
3073 cal_tmp.addEvent(ev); 3089 cal_tmp.addEvent(ev);
3074 } 3090 }
3075 ICalFormat mForm(); 3091 ICalFormat mForm();
3076 QString attachment = mForm.toString( &cal_tmp ); 3092 QString attachment = mForm.toString( &cal_tmp );
3077 if (ev) delete(ev); 3093 if (ev) delete(ev);
3078 3094
3079 mailClient.mailAttendees(currentSelection(), attachment); 3095 mailClient.mailAttendees(currentSelection(), attachment);
3080 3096
3081#endif 3097#endif
3082 3098
3083#if 0 3099#if 0
3084 Event *anEvent = 0; 3100 Event *anEvent = 0;
3085 if (mViewManager->currentView()->isEventView()) { 3101 if (mViewManager->currentView()->isEventView()) {
3086 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); 3102 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first());
3087 } 3103 }
3088 3104
3089 if (!anEvent) { 3105 if (!anEvent) {
3090 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 3106 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
3091 return; 3107 return;
3092 } 3108 }
3093 if(anEvent->attendeeCount() == 0 ) { 3109 if(anEvent->attendeeCount() == 0 ) {
3094 KMessageBox::sorry(this, 3110 KMessageBox::sorry(this,
3095 i18n("Can't generate mail:\nNo attendees defined.\n")); 3111 i18n("Can't generate mail:\nNo attendees defined.\n"));
3096 return; 3112 return;
3097 } 3113 }
3098 3114
3099 mailobject.emailEvent(anEvent); 3115 mailobject.emailEvent(anEvent);
3100#endif 3116#endif
3101} 3117}
3102 3118
3103 3119
3104void CalendarView::schedule_publish(Incidence *incidence) 3120void CalendarView::schedule_publish(Incidence *incidence)
3105{ 3121{
3106 Event *event = 0; 3122 Event *event = 0;
3107 Todo *todo = 0; 3123 Todo *todo = 0;
3108 3124
3109 if (incidence == 0) { 3125 if (incidence == 0) {
3110 incidence = mViewManager->currentView()->selectedIncidences().first(); 3126 incidence = mViewManager->currentView()->selectedIncidences().first();
3111 if (incidence == 0) { 3127 if (incidence == 0) {
3112 incidence = mTodoList->selectedIncidences().first(); 3128 incidence = mTodoList->selectedIncidences().first();
3113 } 3129 }
3114 } 3130 }
3115 if ( incidence && incidence->type() == "Event" ) { 3131 if ( incidence && incidence->type() == "Event" ) {
3116 event = static_cast<Event *>(incidence); 3132 event = static_cast<Event *>(incidence);
3117 } else { 3133 } else {
3118 if ( incidence && incidence->type() == "Todo" ) { 3134 if ( incidence && incidence->type() == "Todo" ) {
3119 todo = static_cast<Todo *>(incidence); 3135 todo = static_cast<Todo *>(incidence);
3120 } 3136 }
3121 } 3137 }
3122 3138
3123 if (!event && !todo) { 3139 if (!event && !todo) {
3124 KMessageBox::sorry(this,i18n("No event selected.")); 3140 KMessageBox::sorry(this,i18n("No event selected."));
3125 return; 3141 return;
3126 } 3142 }
3127 3143
3128 PublishDialog *publishdlg = new PublishDialog(); 3144 PublishDialog *publishdlg = new PublishDialog();
3129 if (incidence->attendeeCount()>0) { 3145 if (incidence->attendeeCount()>0) {
3130 QPtrList<Attendee> attendees = incidence->attendees(); 3146 QPtrList<Attendee> attendees = incidence->attendees();
3131 attendees.first(); 3147 attendees.first();
3132 while ( attendees.current()!=0 ) { 3148 while ( attendees.current()!=0 ) {
3133 publishdlg->addAttendee(attendees.current()); 3149 publishdlg->addAttendee(attendees.current());
3134 attendees.next(); 3150 attendees.next();
3135 } 3151 }
3136 } 3152 }
3137 bool send = true; 3153 bool send = true;
3138 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { 3154 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) {
3139 if ( publishdlg->exec() != QDialog::Accepted ) 3155 if ( publishdlg->exec() != QDialog::Accepted )
3140 send = false; 3156 send = false;
3141 } 3157 }
3142 if ( send ) { 3158 if ( send ) {
3143 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3159 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3144 if ( event ) { 3160 if ( event ) {
3145 Event *ev = new Event(*event); 3161 Event *ev = new Event(*event);
3146 ev->registerObserver(0); 3162 ev->registerObserver(0);
3147 ev->clearAttendees(); 3163 ev->clearAttendees();
3148 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { 3164 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
3149 delete(ev); 3165 delete(ev);
3150 } 3166 }
3151 } else { 3167 } else {
3152 if ( todo ) { 3168 if ( todo ) {
3153 Todo *ev = new Todo(*todo); 3169 Todo *ev = new Todo(*todo);
3154 ev->registerObserver(0); 3170 ev->registerObserver(0);
3155 ev->clearAttendees(); 3171 ev->clearAttendees();
3156 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { 3172 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
3157 delete(ev); 3173 delete(ev);
3158 } 3174 }
3159 } 3175 }
3160 } 3176 }
3161 } 3177 }
3162 delete publishdlg; 3178 delete publishdlg;
3163} 3179}
3164 3180
3165void CalendarView::schedule_request(Incidence *incidence) 3181void CalendarView::schedule_request(Incidence *incidence)
3166{ 3182{
3167 schedule(Scheduler::Request,incidence); 3183 schedule(Scheduler::Request,incidence);
3168} 3184}
3169 3185
3170void CalendarView::schedule_refresh(Incidence *incidence) 3186void CalendarView::schedule_refresh(Incidence *incidence)
3171{ 3187{
3172 schedule(Scheduler::Refresh,incidence); 3188 schedule(Scheduler::Refresh,incidence);
3173} 3189}
3174 3190
3175void CalendarView::schedule_cancel(Incidence *incidence) 3191void CalendarView::schedule_cancel(Incidence *incidence)
3176{ 3192{
3177 schedule(Scheduler::Cancel,incidence); 3193 schedule(Scheduler::Cancel,incidence);
3178} 3194}
3179 3195
3180void CalendarView::schedule_add(Incidence *incidence) 3196void CalendarView::schedule_add(Incidence *incidence)
3181{ 3197{
3182 schedule(Scheduler::Add,incidence); 3198 schedule(Scheduler::Add,incidence);
3183} 3199}
3184 3200
3185void CalendarView::schedule_reply(Incidence *incidence) 3201void CalendarView::schedule_reply(Incidence *incidence)
3186{ 3202{
3187 schedule(Scheduler::Reply,incidence); 3203 schedule(Scheduler::Reply,incidence);
3188} 3204}
3189 3205
3190void CalendarView::schedule_counter(Incidence *incidence) 3206void CalendarView::schedule_counter(Incidence *incidence)
3191{ 3207{
3192 schedule(Scheduler::Counter,incidence); 3208 schedule(Scheduler::Counter,incidence);
3193} 3209}
3194 3210
3195void CalendarView::schedule_declinecounter(Incidence *incidence) 3211void CalendarView::schedule_declinecounter(Incidence *incidence)
3196{ 3212{
3197 schedule(Scheduler::Declinecounter,incidence); 3213 schedule(Scheduler::Declinecounter,incidence);
3198} 3214}
3199 3215
3200void CalendarView::schedule_publish_freebusy(int daysToPublish) 3216void CalendarView::schedule_publish_freebusy(int daysToPublish)
3201{ 3217{
3202 QDateTime start = QDateTime::currentDateTime(); 3218 QDateTime start = QDateTime::currentDateTime();
3203 QDateTime end = start.addDays(daysToPublish); 3219 QDateTime end = start.addDays(daysToPublish);
3204 3220
3205 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); 3221 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end);
3206 freebusy->setOrganizer(KOPrefs::instance()->email()); 3222 freebusy->setOrganizer(KOPrefs::instance()->email());
3207 3223
3208 3224
3209 PublishDialog *publishdlg = new PublishDialog(); 3225 PublishDialog *publishdlg = new PublishDialog();
3210 if ( publishdlg->exec() == QDialog::Accepted ) { 3226 if ( publishdlg->exec() == QDialog::Accepted ) {
3211 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3227 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3212 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { 3228 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) {
3213 delete(freebusy); 3229 delete(freebusy);
3214 } 3230 }
3215 } 3231 }
3216 delete publishdlg; 3232 delete publishdlg;
3217} 3233}
3218 3234
3219void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) 3235void CalendarView::schedule(Scheduler::Method method, Incidence *incidence)
3220{ 3236{
3221 Event *event = 0; 3237 Event *event = 0;
3222 Todo *todo = 0; 3238 Todo *todo = 0;
3223 3239
3224 if (incidence == 0) { 3240 if (incidence == 0) {
3225 incidence = mViewManager->currentView()->selectedIncidences().first(); 3241 incidence = mViewManager->currentView()->selectedIncidences().first();
3226 if (incidence == 0) { 3242 if (incidence == 0) {
3227 incidence = mTodoList->selectedIncidences().first(); 3243 incidence = mTodoList->selectedIncidences().first();
3228 } 3244 }
3229 } 3245 }
3230 if ( incidence && incidence->type() == "Event" ) { 3246 if ( incidence && incidence->type() == "Event" ) {
3231 event = static_cast<Event *>(incidence); 3247 event = static_cast<Event *>(incidence);
3232 } 3248 }
3233 if ( incidence && incidence->type() == "Todo" ) { 3249 if ( incidence && incidence->type() == "Todo" ) {
3234 todo = static_cast<Todo *>(incidence); 3250 todo = static_cast<Todo *>(incidence);
3235 } 3251 }
3236 3252
3237 if (!event && !todo) { 3253 if (!event && !todo) {
3238 KMessageBox::sorry(this,i18n("No event selected.")); 3254 KMessageBox::sorry(this,i18n("No event selected."));
3239 return; 3255 return;
3240 } 3256 }
3241 3257
3242 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { 3258 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) {
3243 KMessageBox::sorry(this,i18n("The event has no attendees.")); 3259 KMessageBox::sorry(this,i18n("The event has no attendees."));
3244 return; 3260 return;
3245 } 3261 }
3246 3262
3247 Event *ev = 0; 3263 Event *ev = 0;
3248 if (event) ev = new Event(*event); 3264 if (event) ev = new Event(*event);
3249 Todo *to = 0; 3265 Todo *to = 0;
3250 if (todo) to = new Todo(*todo); 3266 if (todo) to = new Todo(*todo);
3251 3267
3252 if (method == Scheduler::Reply || method == Scheduler::Refresh) { 3268 if (method == Scheduler::Reply || method == Scheduler::Refresh) {
3253 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 3269 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
3254 if (!me) { 3270 if (!me) {
3255 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); 3271 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails."));
3256 return; 3272 return;
3257 } 3273 }
3258 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { 3274 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) {
3259 StatusDialog *statdlg = new StatusDialog(this); 3275 StatusDialog *statdlg = new StatusDialog(this);
3260 if (!statdlg->exec()==QDialog::Accepted) return; 3276 if (!statdlg->exec()==QDialog::Accepted) return;
3261 me->setStatus( statdlg->status() ); 3277 me->setStatus( statdlg->status() );
3262 delete(statdlg); 3278 delete(statdlg);
3263 } 3279 }
3264 Attendee *menew = new Attendee(*me); 3280 Attendee *menew = new Attendee(*me);
3265 if (ev) { 3281 if (ev) {
3266 ev->clearAttendees(); 3282 ev->clearAttendees();
3267 ev->addAttendee(menew,false); 3283 ev->addAttendee(menew,false);
3268 } else { 3284 } else {
3269 if (to) { 3285 if (to) {
3270 todo->clearAttendees(); 3286 todo->clearAttendees();
3271 todo->addAttendee(menew,false); 3287 todo->addAttendee(menew,false);
3272 } 3288 }
3273 } 3289 }
3274 } 3290 }
3275 3291
3276 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3292 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3277 if (ev) { 3293 if (ev) {
3278 if ( !dlg->addMessage(ev,method) ) delete(ev); 3294 if ( !dlg->addMessage(ev,method) ) delete(ev);
3279 } else { 3295 } else {
3280 if (to) { 3296 if (to) {
3281 if ( !dlg->addMessage(to,method) ) delete(to); 3297 if ( !dlg->addMessage(to,method) ) delete(to);
3282 } 3298 }
3283 } 3299 }
3284} 3300}
3285 3301
3286void CalendarView::openAddressbook() 3302void CalendarView::openAddressbook()
3287{ 3303{
3288 KRun::runCommand("kaddressbook"); 3304 KRun::runCommand("kaddressbook");
3289} 3305}
3290 3306
3291void CalendarView::setModified(bool modified) 3307void CalendarView::setModified(bool modified)
3292{ 3308{
3293 if ( modified ) 3309 if ( modified )
3294 emit signalmodified(); 3310 emit signalmodified();
3295 if (mModified != modified) { 3311 if (mModified != modified) {
3296 mModified = modified; 3312 mModified = modified;
3297 emit modifiedChanged(mModified); 3313 emit modifiedChanged(mModified);
3298 } 3314 }
3299} 3315}
3300 3316
3301bool CalendarView::isReadOnly() 3317bool CalendarView::isReadOnly()
3302{ 3318{
3303 return mReadOnly; 3319 return mReadOnly;
3304} 3320}
3305 3321
3306void CalendarView::setReadOnly(bool readOnly) 3322void CalendarView::setReadOnly(bool readOnly)
3307{ 3323{
3308 if (mReadOnly != readOnly) { 3324 if (mReadOnly != readOnly) {
3309 mReadOnly = readOnly; 3325 mReadOnly = readOnly;
3310 emit readOnlyChanged(mReadOnly); 3326 emit readOnlyChanged(mReadOnly);
3311 } 3327 }
3312} 3328}
3313 3329
3314bool CalendarView::isModified() 3330bool CalendarView::isModified()
3315{ 3331{
3316 return mModified; 3332 return mModified;
3317} 3333}
3318 3334
3319void CalendarView::printSetup() 3335void CalendarView::printSetup()
3320{ 3336{
3321#ifndef KORG_NOPRINTER 3337#ifndef KORG_NOPRINTER
3322 createPrinter(); 3338 createPrinter();
3323 3339
3324 mCalPrinter->setupPrinter(); 3340 mCalPrinter->setupPrinter();
3325#endif 3341#endif
3326} 3342}
3327 3343
3328void CalendarView::print() 3344void CalendarView::print()
3329{ 3345{
3330#ifndef KORG_NOPRINTER 3346#ifndef KORG_NOPRINTER
3331 createPrinter(); 3347 createPrinter();
3332 3348
3333 DateList tmpDateList = mNavigator->selectedDates(); 3349 DateList tmpDateList = mNavigator->selectedDates();
3334 mCalPrinter->print(CalPrinter::Month, 3350 mCalPrinter->print(CalPrinter::Month,
3335 tmpDateList.first(), tmpDateList.last()); 3351 tmpDateList.first(), tmpDateList.last());
3336#endif 3352#endif
3337} 3353}
3338 3354
3339void CalendarView::printPreview() 3355void CalendarView::printPreview()
3340{ 3356{
3341#ifndef KORG_NOPRINTER 3357#ifndef KORG_NOPRINTER
3342 kdDebug() << "CalendarView::printPreview()" << endl; 3358 kdDebug() << "CalendarView::printPreview()" << endl;
3343 3359
3344 createPrinter(); 3360 createPrinter();
3345 3361
3346 DateList tmpDateList = mNavigator->selectedDates(); 3362 DateList tmpDateList = mNavigator->selectedDates();
3347 3363
3348 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), 3364 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(),
3349 tmpDateList.last()); 3365 tmpDateList.last());
3350#endif 3366#endif
3351} 3367}
3352 3368
3353void CalendarView::exportICalendar() 3369void CalendarView::exportICalendar()
3354{ 3370{
3355 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); 3371 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this);
3356 3372
3357 // Force correct extension 3373 // Force correct extension
3358 if (filename.right(4) != ".ics") filename += ".ics"; 3374 if (filename.right(4) != ".ics") filename += ".ics";
3359 3375
3360 FileStorage storage( mCalendar, filename, new ICalFormat() ); 3376 FileStorage storage( mCalendar, filename, new ICalFormat() );
3361 storage.save(); 3377 storage.save();
3362} 3378}
3363 3379
3364bool CalendarView::exportVCalendar( QString filename ) 3380bool CalendarView::exportVCalendar( QString filename )
3365{ 3381{
3366 if (mCalendar->journals().count() > 0) { 3382 if (mCalendar->journals().count() > 0) {
3367 int result = KMessageBox::warningContinueCancel(this, 3383 int result = KMessageBox::warningContinueCancel(this,
3368 i18n("The journal entries can not be\nexported to a vCalendar file."), 3384 i18n("The journal entries can not be\nexported to a vCalendar file."),
3369 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), 3385 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
3370 true); 3386 true);
3371 if (result != KMessageBox::Continue) return false; 3387 if (result != KMessageBox::Continue) return false;
3372 } 3388 }
3373 3389
3374 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); 3390 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this);
3375 3391
3376 // Force correct extension 3392 // Force correct extension
3377 if (filename.right(4) != ".vcs") filename += ".vcs"; 3393 if (filename.right(4) != ".vcs") filename += ".vcs";
3378 3394
3379 FileStorage storage( mCalendar, filename, new VCalFormat ); 3395 FileStorage storage( mCalendar, filename, new VCalFormat );
3380 return storage.save(); 3396 return storage.save();
3381 3397
3382} 3398}
3383 3399
3384void CalendarView::eventUpdated(Incidence *) 3400void CalendarView::eventUpdated(Incidence *)
3385{ 3401{
3386 setModified(); 3402 setModified();
3387 // Don't call updateView here. The code, which has caused the update of the 3403 // Don't call updateView here. The code, which has caused the update of the
3388 // event is responsible for updating the view. 3404 // event is responsible for updating the view.
3389 // updateView(); 3405 // updateView();
3390} 3406}
3391 3407
3392void CalendarView::adaptNavigationUnits() 3408void CalendarView::adaptNavigationUnits()
3393{ 3409{
3394 if (mViewManager->currentView()->isEventView()) { 3410 if (mViewManager->currentView()->isEventView()) {
3395 int days = mViewManager->currentView()->currentDateCount(); 3411 int days = mViewManager->currentView()->currentDateCount();
3396 if (days == 1) { 3412 if (days == 1) {
3397 emit changeNavStringPrev(i18n("&Previous Day")); 3413 emit changeNavStringPrev(i18n("&Previous Day"));
3398 emit changeNavStringNext(i18n("&Next Day")); 3414 emit changeNavStringNext(i18n("&Next Day"));
3399 } else { 3415 } else {
3400 emit changeNavStringPrev(i18n("&Previous Week")); 3416 emit changeNavStringPrev(i18n("&Previous Week"));
3401 emit changeNavStringNext(i18n("&Next Week")); 3417 emit changeNavStringNext(i18n("&Next Week"));
3402 } 3418 }
3403 } 3419 }
3404} 3420}
3405 3421
3406void CalendarView::processMainViewSelection( Incidence *incidence ) 3422void CalendarView::processMainViewSelection( Incidence *incidence )
3407{ 3423{
3408 if ( incidence ) mTodoList->clearSelection(); 3424 if ( incidence ) mTodoList->clearSelection();
3409 processIncidenceSelection( incidence ); 3425 processIncidenceSelection( incidence );
3410} 3426}
3411 3427
3412void CalendarView::processTodoListSelection( Incidence *incidence ) 3428void CalendarView::processTodoListSelection( Incidence *incidence )
3413{ 3429{
3414 if ( incidence && mViewManager->currentView() ) { 3430 if ( incidence && mViewManager->currentView() ) {
3415 mViewManager->currentView()->clearSelection(); 3431 mViewManager->currentView()->clearSelection();
3416 } 3432 }
3417 processIncidenceSelection( incidence ); 3433 processIncidenceSelection( incidence );
3418} 3434}
3419 3435
3420void CalendarView::processIncidenceSelection( Incidence *incidence ) 3436void CalendarView::processIncidenceSelection( Incidence *incidence )
3421{ 3437{
3422 if ( incidence == mSelectedIncidence ) return; 3438 if ( incidence == mSelectedIncidence ) return;
3423 3439
3424 mSelectedIncidence = incidence; 3440 mSelectedIncidence = incidence;
3425 3441
3426 emit incidenceSelected( mSelectedIncidence ); 3442 emit incidenceSelected( mSelectedIncidence );
3427 3443
3428 if ( incidence && incidence->type() == "Event" ) { 3444 if ( incidence && incidence->type() == "Event" ) {
3429 Event *event = static_cast<Event *>( incidence ); 3445 Event *event = static_cast<Event *>( incidence );
3430 if ( event->organizer() == KOPrefs::instance()->email() ) { 3446 if ( event->organizer() == KOPrefs::instance()->email() ) {
3431 emit organizerEventsSelected( true ); 3447 emit organizerEventsSelected( true );
3432 } else { 3448 } else {
3433 emit organizerEventsSelected(false); 3449 emit organizerEventsSelected(false);
3434 } 3450 }
3435 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3451 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3436 KOPrefs::instance()->email() ) ) { 3452 KOPrefs::instance()->email() ) ) {
3437 emit groupEventsSelected( true ); 3453 emit groupEventsSelected( true );
3438 } else { 3454 } else {
3439 emit groupEventsSelected(false); 3455 emit groupEventsSelected(false);
3440 } 3456 }
3441 return; 3457 return;
3442 } else { 3458 } else {
3443 if ( incidence && incidence->type() == "Todo" ) { 3459 if ( incidence && incidence->type() == "Todo" ) {
3444 emit todoSelected( true ); 3460 emit todoSelected( true );
3445 Todo *event = static_cast<Todo *>( incidence ); 3461 Todo *event = static_cast<Todo *>( incidence );
3446 if ( event->organizer() == KOPrefs::instance()->email() ) { 3462 if ( event->organizer() == KOPrefs::instance()->email() ) {
3447 emit organizerEventsSelected( true ); 3463 emit organizerEventsSelected( true );
3448 } else { 3464 } else {
3449 emit organizerEventsSelected(false); 3465 emit organizerEventsSelected(false);
3450 } 3466 }
3451 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3467 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3452 KOPrefs::instance()->email() ) ) { 3468 KOPrefs::instance()->email() ) ) {
3453 emit groupEventsSelected( true ); 3469 emit groupEventsSelected( true );
3454 } else { 3470 } else {
3455 emit groupEventsSelected(false); 3471 emit groupEventsSelected(false);
3456 } 3472 }
3457 return; 3473 return;
3458 } else { 3474 } else {
3459 emit todoSelected( false ); 3475 emit todoSelected( false );
3460 emit organizerEventsSelected(false); 3476 emit organizerEventsSelected(false);
3461 emit groupEventsSelected(false); 3477 emit groupEventsSelected(false);
3462 } 3478 }
3463 return; 3479 return;
3464 } 3480 }
3465 3481
3466 /* if ( incidence && incidence->type() == "Todo" ) { 3482 /* if ( incidence && incidence->type() == "Todo" ) {
3467 emit todoSelected( true ); 3483 emit todoSelected( true );
3468 } else { 3484 } else {
3469 emit todoSelected( false ); 3485 emit todoSelected( false );
3470 }*/ 3486 }*/
3471} 3487}
3472 3488
3473 3489
3474void CalendarView::checkClipboard() 3490void CalendarView::checkClipboard()
3475{ 3491{
3476#ifndef KORG_NODND 3492#ifndef KORG_NODND
3477 if (ICalDrag::canDecode(QApplication::clipboard()->data())) { 3493 if (ICalDrag::canDecode(QApplication::clipboard()->data())) {
3478 emit pasteEnabled(true); 3494 emit pasteEnabled(true);
3479 } else { 3495 } else {
3480 emit pasteEnabled(false); 3496 emit pasteEnabled(false);
3481 } 3497 }
3482#endif 3498#endif
3483} 3499}
3484 3500
3485void CalendarView::showDates(const DateList &selectedDates) 3501void CalendarView::showDates(const DateList &selectedDates)
3486{ 3502{
3487 // kdDebug() << "CalendarView::selectDates()" << endl; 3503 // kdDebug() << "CalendarView::selectDates()" << endl;
3488 3504
3489 3505
3490 if ( !mBlockShowDates ) { 3506 if ( !mBlockShowDates ) {
3491 if ( mViewManager->currentView() ) { 3507 if ( mViewManager->currentView() ) {
3492 updateView( selectedDates.first(), selectedDates.last() ); 3508 updateView( selectedDates.first(), selectedDates.last() );
3493 } else { 3509 } else {
3494 mViewManager->showAgendaView(); 3510 mViewManager->showAgendaView();
3495 } 3511 }
3496 } 3512 }
3497 3513
3498 QString selDates; 3514 QString selDates;
3499 selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); 3515 selDates = KGlobal::locale()->formatDate( selectedDates.first(), true);
3500 if (selectedDates.first() < selectedDates.last() ) 3516 if (selectedDates.first() < selectedDates.last() )
3501 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); 3517 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true);
3502 else { 3518 else {
3503 QString addString; 3519 QString addString;
3504 if ( selectedDates.first() == QDateTime::currentDateTime().date() ) 3520 if ( selectedDates.first() == QDateTime::currentDateTime().date() )
3505 addString = i18n("Today"); 3521 addString = i18n("Today");
3506 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) 3522 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(1) )
3507 addString = i18n("Tomorrow"); 3523 addString = i18n("Tomorrow");
3508 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) 3524 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) )
3509 addString = i18n("Yesterday"); 3525 addString = i18n("Yesterday");
3510 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) 3526 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) )
3511 addString = i18n("Day before yesterday"); 3527 addString = i18n("Day before yesterday");
3512 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) 3528 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(2) )
3513 addString = i18n("Day after tomorrow"); 3529 addString = i18n("Day after tomorrow");
3514 if ( !addString.isEmpty() ) { 3530 if ( !addString.isEmpty() ) {
3515 topLevelWidget()->setCaption( addString+", " + selDates ); 3531 topLevelWidget()->setCaption( addString+", " + selDates );
3516 return; 3532 return;
3517 } 3533 }
3518 } 3534 }
3519 topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); 3535 topLevelWidget()->setCaption( i18n("Dates: ") + selDates );
3520 3536
3521} 3537}
3522 3538
3523QPtrList<CalFilter> CalendarView::filters() 3539QPtrList<CalFilter> CalendarView::filters()
3524{ 3540{
3525 return mFilters; 3541 return mFilters;
3526 3542
3527} 3543}
3528void CalendarView::editFilters() 3544void CalendarView::editFilters()
3529{ 3545{
3530 // kdDebug() << "CalendarView::editFilters()" << endl; 3546 // kdDebug() << "CalendarView::editFilters()" << endl;
3531 3547
3532 CalFilter *filter = mFilters.first(); 3548 CalFilter *filter = mFilters.first();
3533 while(filter) { 3549 while(filter) {
3534 kdDebug() << " Filter: " << filter->name() << endl; 3550 kdDebug() << " Filter: " << filter->name() << endl;
3535 filter = mFilters.next(); 3551 filter = mFilters.next();
3536 } 3552 }
3537 3553
3538 mDialogManager->showFilterEditDialog(&mFilters); 3554 mDialogManager->showFilterEditDialog(&mFilters);
3539} 3555}
3540void CalendarView::toggleFilter() 3556void CalendarView::toggleFilter()
3541{ 3557{
3542 showFilter(! mFilterView->isVisible()); 3558 showFilter(! mFilterView->isVisible());
3543} 3559}
3544 3560
3545KOFilterView *CalendarView::filterView() 3561KOFilterView *CalendarView::filterView()
3546{ 3562{
3547 return mFilterView; 3563 return mFilterView;
3548} 3564}
3549void CalendarView::selectFilter( int fil ) 3565void CalendarView::selectFilter( int fil )
3550{ 3566{
3551 mFilterView->setSelectedFilter( fil ); 3567 mFilterView->setSelectedFilter( fil );
3552} 3568}
3553void CalendarView::showFilter(bool visible) 3569void CalendarView::showFilter(bool visible)
3554{ 3570{
3555 if (visible) mFilterView->show(); 3571 if (visible) mFilterView->show();
3556 else mFilterView->hide(); 3572 else mFilterView->hide();
3557} 3573}
3558void CalendarView::toggleFilerEnabled( ) 3574void CalendarView::toggleFilerEnabled( )
3559{ 3575{
3560 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); 3576 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() );
3561 if ( !mFilterView->filtersEnabled() ) 3577 if ( !mFilterView->filtersEnabled() )
3562 topLevelWidget()->setCaption( i18n("Filter disabled ") ); 3578 topLevelWidget()->setCaption( i18n("Filter disabled ") );
3563 3579
3564} 3580}
3565void CalendarView::updateFilter() 3581void CalendarView::updateFilter()
3566{ 3582{
3567 CalFilter *filter = mFilterView->selectedFilter(); 3583 CalFilter *filter = mFilterView->selectedFilter();
3568 if (filter) { 3584 if (filter) {
3569 if (mFilterView->filtersEnabled()) { 3585 if (mFilterView->filtersEnabled()) {
3570 topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() ); 3586 topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() );
3571 filter->setEnabled(true); 3587 filter->setEnabled(true);
3572 } 3588 }
3573 else filter->setEnabled(false); 3589 else filter->setEnabled(false);
3574 mCalendar->setFilter(filter); 3590 mCalendar->setFilter(filter);
3575 updateView(); 3591 updateView();
3576 } 3592 }
3577} 3593}
3578 3594
3579void CalendarView::filterEdited() 3595void CalendarView::filterEdited()
3580{ 3596{
3581 mFilterView->updateFilters(); 3597 mFilterView->updateFilters();
3582 updateFilter(); 3598 updateFilter();
3583 writeSettings(); 3599 writeSettings();
3584} 3600}
3585 3601
3586 3602
3587void CalendarView::takeOverEvent() 3603void CalendarView::takeOverEvent()
3588{ 3604{
3589 Incidence *incidence = currentSelection(); 3605 Incidence *incidence = currentSelection();
3590 3606
3591 if (!incidence) return; 3607 if (!incidence) return;
3592 3608
3593 incidence->setOrganizer(KOPrefs::instance()->email()); 3609 incidence->setOrganizer(KOPrefs::instance()->email());
3594 incidence->recreate(); 3610 incidence->recreate();
3595 incidence->setReadOnly(false); 3611 incidence->setReadOnly(false);
3596 3612
3597 updateView(); 3613 updateView();
3598} 3614}
3599 3615
3600void CalendarView::takeOverCalendar() 3616void CalendarView::takeOverCalendar()
3601{ 3617{
3602 // TODO: Create Calendar::allIncidences() function and use it here 3618 // TODO: Create Calendar::allIncidences() function and use it here
3603 3619
3604 QPtrList<Event> events = mCalendar->events(); 3620 QPtrList<Event> events = mCalendar->events();
3605 for(uint i=0; i<events.count(); ++i) { 3621 for(uint i=0; i<events.count(); ++i) {
3606 events.at(i)->setOrganizer(KOPrefs::instance()->email()); 3622 events.at(i)->setOrganizer(KOPrefs::instance()->email());
3607 events.at(i)->recreate(); 3623 events.at(i)->recreate();
3608 events.at(i)->setReadOnly(false); 3624 events.at(i)->setReadOnly(false);
3609 } 3625 }
3610 3626
3611 QPtrList<Todo> todos = mCalendar->todos(); 3627 QPtrList<Todo> todos = mCalendar->todos();
3612 for(uint i=0; i<todos.count(); ++i) { 3628 for(uint i=0; i<todos.count(); ++i) {
3613 todos.at(i)->setOrganizer(KOPrefs::instance()->email()); 3629 todos.at(i)->setOrganizer(KOPrefs::instance()->email());
3614 todos.at(i)->recreate(); 3630 todos.at(i)->recreate();
3615 todos.at(i)->setReadOnly(false); 3631 todos.at(i)->setReadOnly(false);
3616 } 3632 }
3617 3633
3618 QPtrList<Journal> journals = mCalendar->journals(); 3634 QPtrList<Journal> journals = mCalendar->journals();
3619 for(uint i=0; i<journals.count(); ++i) { 3635 for(uint i=0; i<journals.count(); ++i) {
3620 journals.at(i)->setOrganizer(KOPrefs::instance()->email()); 3636 journals.at(i)->setOrganizer(KOPrefs::instance()->email());
3621 journals.at(i)->recreate(); 3637 journals.at(i)->recreate();
3622 journals.at(i)->setReadOnly(false); 3638 journals.at(i)->setReadOnly(false);
3623 } 3639 }
3624 3640
3625 updateView(); 3641 updateView();
3626} 3642}
3627 3643
3628void CalendarView::showIntro() 3644void CalendarView::showIntro()
3629{ 3645{
3630 kdDebug() << "To be implemented." << endl; 3646 kdDebug() << "To be implemented." << endl;
3631} 3647}
3632 3648
3633QWidgetStack *CalendarView::viewStack() 3649QWidgetStack *CalendarView::viewStack()
3634{ 3650{
3635 return mRightFrame; 3651 return mRightFrame;
3636} 3652}
3637 3653
3638QWidget *CalendarView::leftFrame() 3654QWidget *CalendarView::leftFrame()
3639{ 3655{
3640 return mLeftFrame; 3656 return mLeftFrame;
3641} 3657}
3642 3658
3643DateNavigator *CalendarView::dateNavigator() 3659DateNavigator *CalendarView::dateNavigator()
3644{ 3660{
3645 return mNavigator; 3661 return mNavigator;
3646} 3662}
3647 3663
3648KDateNavigator* CalendarView::dateNavigatorWidget() 3664KDateNavigator* CalendarView::dateNavigatorWidget()
3649{ 3665{
3650 return mDateNavigator; 3666 return mDateNavigator;
3651} 3667}
3652void CalendarView::toggleDateNavigatorWidget() 3668void CalendarView::toggleDateNavigatorWidget()
3653{ 3669{
3654 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; 3670 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ;
3655 if (!KOPrefs::instance()->mShowDateNavigator ) 3671 if (!KOPrefs::instance()->mShowDateNavigator )
3656 mDateNavigator->hide(); 3672 mDateNavigator->hide();
3657 else 3673 else
3658 mDateNavigator->show(); 3674 mDateNavigator->show();
3659} 3675}
3660void CalendarView::addView(KOrg::BaseView *view) 3676void CalendarView::addView(KOrg::BaseView *view)
3661{ 3677{
3662 mViewManager->addView(view); 3678 mViewManager->addView(view);
3663} 3679}
3664 3680
3665void CalendarView::showView(KOrg::BaseView *view) 3681void CalendarView::showView(KOrg::BaseView *view)
3666{ 3682{
3667 mViewManager->showView(view, mLeftFrame->isVisible()); 3683 mViewManager->showView(view, mLeftFrame->isVisible());
3668} 3684}
3669 3685
3670Incidence *CalendarView::currentSelection() 3686Incidence *CalendarView::currentSelection()
3671{ 3687{
3672 return mViewManager->currentSelection(); 3688 return mViewManager->currentSelection();
3673} 3689}
3674void CalendarView::toggleAllDaySize() 3690void CalendarView::toggleAllDaySize()
3675{ 3691{
3676 /* 3692 /*
3677 if ( KOPrefs::instance()->mAllDaySize > 47 ) 3693 if ( KOPrefs::instance()->mAllDaySize > 47 )
3678 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; 3694 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2;
3679 else 3695 else
3680 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; 3696 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2;
3681 */ 3697 */
3682 viewManager()->agendaView()->toggleAllDay(); 3698 viewManager()->agendaView()->toggleAllDay();
3683} 3699}
3684void CalendarView::toggleExpand() 3700void CalendarView::toggleExpand()
3685{ 3701{
3686 // if ( mLeftFrame->isHidden() ) { 3702 // if ( mLeftFrame->isHidden() ) {
3687 // mLeftFrame->show(); 3703 // mLeftFrame->show();
3688 // emit calendarViewExpanded( false ); 3704 // emit calendarViewExpanded( false );
3689 // } else { 3705 // } else {
3690 // mLeftFrame->hide(); 3706 // mLeftFrame->hide();
3691 // emit calendarViewExpanded( true ); 3707 // emit calendarViewExpanded( true );
3692 // } 3708 // }
3693 //qDebug(" CalendarView::toggleExpand()"); 3709 //qDebug(" CalendarView::toggleExpand()");
3694 globalFlagBlockAgenda = 1; 3710 globalFlagBlockAgenda = 1;
3695 emit calendarViewExpanded( !mLeftFrame->isHidden() ); 3711 emit calendarViewExpanded( !mLeftFrame->isHidden() );
3696 globalFlagBlockAgenda = 5; 3712 globalFlagBlockAgenda = 5;
3697 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); 3713 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() );
3698 //mViewManager->showView( 0, true ); 3714 //mViewManager->showView( 0, true );
3699} 3715}
3700 3716
3701void CalendarView::calendarModified( bool modified, Calendar * ) 3717void CalendarView::calendarModified( bool modified, Calendar * )
3702{ 3718{
3703 setModified( modified ); 3719 setModified( modified );
3704} 3720}
3705 3721
3706Todo *CalendarView::selectedTodo() 3722Todo *CalendarView::selectedTodo()
3707{ 3723{
3708 Incidence *incidence = currentSelection(); 3724 Incidence *incidence = currentSelection();
3709 if ( incidence && incidence->type() == "Todo" ) { 3725 if ( incidence && incidence->type() == "Todo" ) {
3710 return static_cast<Todo *>( incidence ); 3726 return static_cast<Todo *>( incidence );
3711 } 3727 }
3712 3728
3713 incidence = mTodoList->selectedIncidences().first(); 3729 incidence = mTodoList->selectedIncidences().first();
3714 if ( incidence && incidence->type() == "Todo" ) { 3730 if ( incidence && incidence->type() == "Todo" ) {
3715 return static_cast<Todo *>( incidence ); 3731 return static_cast<Todo *>( incidence );
3716 } 3732 }
3717 3733
3718 return 0; 3734 return 0;
3719} 3735}
3720 3736
3721void CalendarView::dialogClosing(Incidence *in) 3737void CalendarView::dialogClosing(Incidence *in)
3722{ 3738{
3723 // mDialogList.remove(in); 3739 // mDialogList.remove(in);
3724} 3740}
3725 3741
3726void CalendarView::showIncidence() 3742void CalendarView::showIncidence()
3727{ 3743{
3728 Incidence *incidence = currentSelection(); 3744 Incidence *incidence = currentSelection();
3729 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3745 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3730 if ( incidence ) { 3746 if ( incidence ) {
3731 ShowIncidenceVisitor v; 3747 ShowIncidenceVisitor v;
3732 v.act( incidence, this ); 3748 v.act( incidence, this );
3733 } 3749 }
3734} 3750}
3735void CalendarView::editIncidenceDescription() 3751void CalendarView::editIncidenceDescription()
3736{ 3752{
3737 mFlagEditDescription = true; 3753 mFlagEditDescription = true;
3738 editIncidence(); 3754 editIncidence();
3739 mFlagEditDescription = false; 3755 mFlagEditDescription = false;
3740} 3756}
3741void CalendarView::editIncidence() 3757void CalendarView::editIncidence()
3742{ 3758{
3743 // qDebug("editIncidence() "); 3759 // qDebug("editIncidence() ");
3744 Incidence *incidence = currentSelection(); 3760 Incidence *incidence = currentSelection();
3745 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3761 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3746 if ( incidence ) { 3762 if ( incidence ) {
3747 EditIncidenceVisitor v; 3763 EditIncidenceVisitor v;
3748 v.act( incidence, this ); 3764 v.act( incidence, this );
3749 } 3765 }
3750} 3766}
3751 3767
3752void CalendarView::deleteIncidence() 3768void CalendarView::deleteIncidence()
3753{ 3769{
3754 Incidence *incidence = currentSelection(); 3770 Incidence *incidence = currentSelection();
3755 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3771 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3756 if ( incidence ) { 3772 if ( incidence ) {
3757 deleteIncidence(incidence); 3773 deleteIncidence(incidence);
3758 } 3774 }
3759} 3775}
3760 3776
3761void CalendarView::showIncidence(Incidence *incidence) 3777void CalendarView::showIncidence(Incidence *incidence)
3762{ 3778{
3763 if ( incidence ) { 3779 if ( incidence ) {
3764 ShowIncidenceVisitor v; 3780 ShowIncidenceVisitor v;
3765 v.act( incidence, this ); 3781 v.act( incidence, this );
3766 } 3782 }
3767} 3783}
3768 3784
3769void CalendarView::editIncidence(Incidence *incidence) 3785void CalendarView::editIncidence(Incidence *incidence)
3770{ 3786{
3771 if ( incidence ) { 3787 if ( incidence ) {
3772 3788
3773 EditIncidenceVisitor v; 3789 EditIncidenceVisitor v;
3774 v.act( incidence, this ); 3790 v.act( incidence, this );
3775 3791
3776 } 3792 }
3777} 3793}
3778 3794
3779void CalendarView::deleteIncidence(Incidence *incidence) 3795void CalendarView::deleteIncidence(Incidence *incidence)
3780{ 3796{
3781 //qDebug(" CalendarView::deleteIncidence "); 3797 //qDebug(" CalendarView::deleteIncidence ");
3782 if ( incidence ) { 3798 if ( incidence ) {
3783 DeleteIncidenceVisitor v; 3799 DeleteIncidenceVisitor v;
3784 v.act( incidence, this ); 3800 v.act( incidence, this );
3785 } 3801 }
3786} 3802}
3787 3803
3788 3804
3789void CalendarView::lookForOutgoingMessages() 3805void CalendarView::lookForOutgoingMessages()
3790{ 3806{
3791 OutgoingDialog *ogd = mDialogManager->outgoingDialog(); 3807 OutgoingDialog *ogd = mDialogManager->outgoingDialog();
3792 ogd->loadMessages(); 3808 ogd->loadMessages();
3793} 3809}
3794 3810
3795void CalendarView::lookForIncomingMessages() 3811void CalendarView::lookForIncomingMessages()
3796{ 3812{
3797 IncomingDialog *icd = mDialogManager->incomingDialog(); 3813 IncomingDialog *icd = mDialogManager->incomingDialog();
3798 icd->retrieve(); 3814 icd->retrieve();
3799} 3815}
3800 3816
3801bool CalendarView::removeCompletedSubTodos( Todo* t ) 3817bool CalendarView::removeCompletedSubTodos( Todo* t )
3802{ 3818{
3803 bool deleteTodo = true; 3819 bool deleteTodo = true;
3804 QPtrList<Incidence> subTodos; 3820 QPtrList<Incidence> subTodos;
3805 Incidence *aTodo; 3821 Incidence *aTodo;
3806 subTodos = t->relations(); 3822 subTodos = t->relations();
3807 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 3823 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
3808 if (! removeCompletedSubTodos( (Todo*) aTodo )) 3824 if (! removeCompletedSubTodos( (Todo*) aTodo ))
3809 deleteTodo = false; 3825 deleteTodo = false;
3810 } 3826 }
3811 if ( deleteTodo ) { 3827 if ( deleteTodo ) {
3812 if ( t->isCompleted() ) { 3828 if ( t->isCompleted() ) {
3813 checkExternalId( t ); 3829 checkExternalId( t );
3814 mCalendar->deleteTodo( t ); 3830 mCalendar->deleteTodo( t );
3815 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 3831 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
3816 } 3832 }
3817 else 3833 else
3818 deleteTodo = false; 3834 deleteTodo = false;
3819 } 3835 }
3820 return deleteTodo; 3836 return deleteTodo;
3821 3837
3822} 3838}
3823void CalendarView::purgeCompleted() 3839void CalendarView::purgeCompleted()
3824{ 3840{
3825 int result = KMessageBox::warningContinueCancel(this, 3841 int result = KMessageBox::warningContinueCancel(this,
3826 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); 3842 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge"));
3827 3843
3828 if (result == KMessageBox::Continue) { 3844 if (result == KMessageBox::Continue) {
3829 3845
3830 QPtrList<Todo> todoCal; 3846 QPtrList<Todo> todoCal;
3831 QPtrList<Todo> rootTodos; 3847 QPtrList<Todo> rootTodos;
3832 //QPtrList<Incidence> rel; 3848 //QPtrList<Incidence> rel;
3833 Todo *aTodo;//, *rTodo; 3849 Todo *aTodo;//, *rTodo;
3834 Incidence *rIncidence; 3850 Incidence *rIncidence;
3835 bool childDelete = false; 3851 bool childDelete = false;
3836 bool deletedOne = true; 3852 bool deletedOne = true;
3837 todoCal = calendar()->todos(); 3853 todoCal = calendar()->todos();
3838 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 3854 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
3839 if ( !aTodo->relatedTo() ) 3855 if ( !aTodo->relatedTo() )
3840 rootTodos.append( aTodo ); 3856 rootTodos.append( aTodo );
3841 } 3857 }
3842 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 3858 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
3843 removeCompletedSubTodos( aTodo ); 3859 removeCompletedSubTodos( aTodo );
3844 } 3860 }
3845 3861
3846 updateView(); 3862 updateView();
3847 } 3863 }
3848} 3864}
3849 3865
3850void CalendarView::slotCalendarChanged() 3866void CalendarView::slotCalendarChanged()
3851{ 3867{
3852 ; 3868 ;
3853} 3869}
3854 3870
3855NavigatorBar *CalendarView::navigatorBar() 3871NavigatorBar *CalendarView::navigatorBar()
3856{ 3872{
3857 return mNavigatorBar; 3873 return mNavigatorBar;
3858} 3874}
3859void CalendarView::showNavigatorBar( bool b) 3875void CalendarView::showNavigatorBar( bool b)
3860{ 3876{
3861 if ( b ) mNavigatorBar->show(); 3877 if ( b ) mNavigatorBar->show();
3862 else mNavigatorBar->hide(); 3878 else mNavigatorBar->hide();
3863} 3879}
3864 3880
3865 3881
3866 3882
3867void CalendarView::keyPressEvent ( QKeyEvent *e) 3883void CalendarView::keyPressEvent ( QKeyEvent *e)
3868{ 3884{
3869 //qDebug(" alendarView::keyPressEvent "); 3885 //qDebug(" alendarView::keyPressEvent ");
3870 e->ignore(); 3886 e->ignore();
3871} 3887}
3872 3888
3873 3889
3874bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 3890bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
3875{ 3891{
3876 // mSyncManager = manager; 3892 // mSyncManager = manager;
3877 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { 3893 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
3878 qDebug("KO: SyncKDE request detected!"); 3894 qDebug("KO: SyncKDE request detected!");
3879 } 3895 }
3880 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 3896 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
3881 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 3897 mCurrentSyncName = mSyncManager->getCurrentSyncName();
3882 return syncCalendar( filename, mode ); 3898 return syncCalendar( filename, mode );
3883} 3899}
3884bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 3900bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
3885{ 3901{
3886 //mSyncManager = manager; 3902 //mSyncManager = manager;
3887 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 3903 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
3888 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 3904 mCurrentSyncName = mSyncManager->getCurrentSyncName();
3889 if ( resource == "sharp" ) 3905 if ( resource == "sharp" )
3890 syncExternal( 0 ); 3906 syncExternal( 0 );
3891 if ( resource == "phone" ) 3907 if ( resource == "phone" )
3892 syncExternal( 1 ); 3908 syncExternal( 1 );
3893 // pending setmodified 3909 // pending setmodified
3894 return true; 3910 return true;
3895} 3911}
3896void CalendarView::setSyncManager(KSyncManager* manager) 3912void CalendarView::setSyncManager(KSyncManager* manager)
3897{ 3913{
3898 mSyncManager = manager; 3914 mSyncManager = manager;
3899} 3915}
3900 3916
3901void CalendarView::removeSyncInfo( QString syncProfile) 3917void CalendarView::removeSyncInfo( QString syncProfile)
3902{ 3918{
3903 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); 3919 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1());
3904 mCalendar->removeSyncInfo( syncProfile ); 3920 mCalendar->removeSyncInfo( syncProfile );
3905 3921
3906} 3922}
3907 3923
3908void CalendarView::undo_delete() 3924void CalendarView::undo_delete()
3909{ 3925{
3910 //qDebug("undo_delete() "); 3926 //qDebug("undo_delete() ");
3911 Incidence* undo = mCalendar->undoIncidence(); 3927 Incidence* undo = mCalendar->undoIncidence();
3912 if ( !undo ) { 3928 if ( !undo ) {
3913 KMessageBox::sorry(this,i18n("There is nothing to undo!"), 3929 KMessageBox::sorry(this,i18n("There is nothing to undo!"),
3914 i18n("KO/Pi")); 3930 i18n("KO/Pi"));
3915 return; 3931 return;
3916 } 3932 }
3917 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + 3933 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) +
3918 i18n("\nAre you sure you want\nto restore this?"), 3934 i18n("\nAre you sure you want\nto restore this?"),
3919 i18n("KO/Pi Confirmation"),i18n("Restore"))) { 3935 i18n("KO/Pi Confirmation"),i18n("Restore"))) {
3920 mCalendar->undoDeleteIncidence(); 3936 mCalendar->undoDeleteIncidence();
3921 updateView(); 3937 updateView();
3922 } 3938 }
3923} 3939}
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 6ea8287..8d7ff36 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -1,613 +1,615 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000, 2001 3 Copyright (c) 2000, 2001
4 Cornelius Schumacher <schumacher@kde.org> 4 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef CALENDARVIEW_H 24#ifndef CALENDARVIEW_H
25#define CALENDARVIEW_H 25#define CALENDARVIEW_H
26 26
27#include <qframe.h> 27#include <qframe.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qwidget.h> 29#include <qwidget.h>
30#include <qptrlist.h> 30#include <qptrlist.h>
31#include <qvbox.h> 31#include <qvbox.h>
32#include <qmap.h> 32#include <qmap.h>
33#ifndef DESKTOP_VERSION 33#ifndef DESKTOP_VERSION
34#include <qtopia/ir.h> 34#include <qtopia/ir.h>
35#else 35#else
36#define Ir char 36#define Ir char
37#endif 37#endif
38#include <libkcal/calendar.h> 38#include <libkcal/calendar.h>
39#include <libkcal/scheduler.h> 39#include <libkcal/scheduler.h>
40#include <libkcal/calendarresources.h> 40#include <libkcal/calendarresources.h>
41#include <libkcal/resourcecalendar.h> 41#include <libkcal/resourcecalendar.h>
42 42
43#include <korganizer/calendarviewbase.h> 43#include <korganizer/calendarviewbase.h>
44 44
45#include <ksyncmanager.h> 45#include <ksyncmanager.h>
46 46
47class QWidgetStack; 47class QWidgetStack;
48class QSplitter; 48class QSplitter;
49 49
50class CalPrinter; 50class CalPrinter;
51class KOFilterView; 51class KOFilterView;
52class KOViewManager; 52class KOViewManager;
53class KODialogManager; 53class KODialogManager;
54class KOTodoView; 54class KOTodoView;
55class KDateNavigator; 55class KDateNavigator;
56class DateNavigator; 56class DateNavigator;
57class KOIncidenceEditor; 57class KOIncidenceEditor;
58class KDatePicker; 58class KDatePicker;
59class ResourceView; 59class ResourceView;
60class NavigatorBar; 60class NavigatorBar;
61class KOEventEditor; 61class KOEventEditor;
62class KOTodoEditor ; 62class KOTodoEditor ;
63class KOEventViewerDialog; 63class KOEventViewerDialog;
64class KOBeamPrefs; 64class KOBeamPrefs;
65class KSyncProfile; 65class KSyncProfile;
66class AlarmDialog; 66class AlarmDialog;
67class KCal::Attendee; 67class KCal::Attendee;
68 68
69namespace KCal { class FileStorage; } 69namespace KCal { class FileStorage; }
70 70
71using namespace KCal; 71using namespace KCal;
72 72
73/** 73/**
74 This is the main calendar widget. It provides the different vies on t he 74 This is the main calendar widget. It provides the different vies on t he
75 calendar data as well as the date navigator. It also handles synchronisation 75 calendar data as well as the date navigator. It also handles synchronisation
76 of the different views and controls the different dialogs like preferences, 76 of the different views and controls the different dialogs like preferences,
77 event editor, search dialog etc. 77 event editor, search dialog etc.
78 78
79 @short main calendar view widget 79 @short main calendar view widget
80 @author Cornelius Schumacher 80 @author Cornelius Schumacher
81*/ 81*/
82class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface 82class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface
83{ 83{
84 Q_OBJECT 84 Q_OBJECT
85 public: 85 public:
86 /** 86 /**
87 Constructs a new calendar view widget. 87 Constructs a new calendar view widget.
88 88
89 @param calendar calendar document 89 @param calendar calendar document
90 @param parent parent window 90 @param parent parent window
91 @param name Qt internal widget object name 91 @param name Qt internal widget object name
92 */ 92 */
93 CalendarView( CalendarResources *calendar, QWidget *parent = 0, 93 CalendarView( CalendarResources *calendar, QWidget *parent = 0,
94 const char *name = 0 ); 94 const char *name = 0 );
95 CalendarView( Calendar *calendar, QWidget *parent = 0, 95 CalendarView( Calendar *calendar, QWidget *parent = 0,
96 const char *name = 0 ); 96 const char *name = 0 );
97 virtual ~CalendarView(); 97 virtual ~CalendarView();
98 98
99 Calendar *calendar() { return mCalendar; } 99 Calendar *calendar() { return mCalendar; }
100 100
101 KOViewManager *viewManager(); 101 KOViewManager *viewManager();
102 KODialogManager *dialogManager(); 102 KODialogManager *dialogManager();
103 103
104 QDate startDate(); 104 QDate startDate();
105 QDate endDate(); 105 QDate endDate();
106 106
107 QWidgetStack *viewStack(); 107 QWidgetStack *viewStack();
108 QWidget *leftFrame(); 108 QWidget *leftFrame();
109 NavigatorBar *navigatorBar(); 109 NavigatorBar *navigatorBar();
110 110
111 DateNavigator *dateNavigator(); 111 DateNavigator *dateNavigator();
112 KDateNavigator *dateNavigatorWidget(); 112 KDateNavigator *dateNavigatorWidget();
113 113
114 void addView(KOrg::BaseView *); 114 void addView(KOrg::BaseView *);
115 void showView(KOrg::BaseView *); 115 void showView(KOrg::BaseView *);
116 KOEventViewerDialog* getEventViewerDialog(); 116 KOEventViewerDialog* getEventViewerDialog();
117 Incidence *currentSelection(); 117 Incidence *currentSelection();
118 118
119 signals: 119 signals:
120 void save ();
121 void saveStopTimer ();
120 void tempDisableBR(bool); 122 void tempDisableBR(bool);
121 /** This todo has been modified */ 123 /** This todo has been modified */
122 void todoModified(Todo *, int); 124 void todoModified(Todo *, int);
123 125
124 /** when change is made to options dialog, the topwidget will catch this 126 /** when change is made to options dialog, the topwidget will catch this
125 * and emit this signal which notifies all widgets which have registered 127 * and emit this signal which notifies all widgets which have registered
126 * for notification to update their settings. */ 128 * for notification to update their settings. */
127 void configChanged(); 129 void configChanged();
128 /** emitted when the topwidget is closing down, so that any attached 130 /** emitted when the topwidget is closing down, so that any attached
129 child windows can also close. */ 131 child windows can also close. */
130 void closingDown(); 132 void closingDown();
131 /** emitted right before we die */ 133 /** emitted right before we die */
132 void closed(QWidget *); 134 void closed(QWidget *);
133 135
134 /** Emitted when state of modified flag changes */ 136 /** Emitted when state of modified flag changes */
135 void modifiedChanged(bool); 137 void modifiedChanged(bool);
136 void signalmodified(); 138 void signalmodified();
137 139
138 /** Emitted when state of read-only flag changes */ 140 /** Emitted when state of read-only flag changes */
139 void readOnlyChanged(bool); 141 void readOnlyChanged(bool);
140 142
141 /** Emitted when the unit of navigation changes */ 143 /** Emitted when the unit of navigation changes */
142 void changeNavStringPrev(const QString &); 144 void changeNavStringPrev(const QString &);
143 void changeNavStringNext(const QString &); 145 void changeNavStringNext(const QString &);
144 146
145 /** Emitted when state of events selection has changed and user is organizer*/ 147 /** Emitted when state of events selection has changed and user is organizer*/
146 void organizerEventsSelected(bool); 148 void organizerEventsSelected(bool);
147 /** Emitted when state of events selection has changed and user is attendee*/ 149 /** Emitted when state of events selection has changed and user is attendee*/
148 void groupEventsSelected(bool); 150 void groupEventsSelected(bool);
149 /** 151 /**
150 Emitted when an incidence gets selected. If the selection is cleared the 152 Emitted when an incidence gets selected. If the selection is cleared the
151 signal is emitted with 0 as argument. 153 signal is emitted with 0 as argument.
152 */ 154 */
153 void incidenceSelected( Incidence * ); 155 void incidenceSelected( Incidence * );
154 /** Emitted, when a todoitem is selected or deselected. */ 156 /** Emitted, when a todoitem is selected or deselected. */
155 void todoSelected( bool ); 157 void todoSelected( bool );
156 158
157 /** 159 /**
158 Emitted, when clipboard content changes. Parameter indicates if paste 160 Emitted, when clipboard content changes. Parameter indicates if paste
159 is possible or not. 161 is possible or not.
160 */ 162 */
161 void pasteEnabled(bool); 163 void pasteEnabled(bool);
162 164
163 /** Emitted, when the number of incoming messages has changed. */ 165 /** Emitted, when the number of incoming messages has changed. */
164 void numIncomingChanged(int); 166 void numIncomingChanged(int);
165 167
166 /** Emitted, when the number of outgoing messages has changed. */ 168 /** Emitted, when the number of outgoing messages has changed. */
167 void numOutgoingChanged(int); 169 void numOutgoingChanged(int);
168 170
169 /** Send status message, which can e.g. be displayed in the status bar. */ 171 /** Send status message, which can e.g. be displayed in the status bar. */
170 void statusMessage(const QString &); 172 void statusMessage(const QString &);
171 173
172 void calendarViewExpanded( bool ); 174 void calendarViewExpanded( bool );
173 void updateSearchDialog(); 175 void updateSearchDialog();
174 176
175 177
176 public slots: 178 public slots:
177 void showNavigatorBar(bool); 179 void showNavigatorBar(bool);
178 void showOpenError(); 180 void showOpenError();
179 void watchSavedFile(); 181 void watchSavedFile();
180 void recheckTimerAlarm(); 182 void recheckTimerAlarm();
181 void checkNextTimerAlarm(); 183 void checkNextTimerAlarm();
182 void addAlarm(const QDateTime &qdt, const QString &noti ); 184 void addAlarm(const QDateTime &qdt, const QString &noti );
183 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 185 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
184 void removeAlarm(const QDateTime &qdt, const QString &noti ); 186 void removeAlarm(const QDateTime &qdt, const QString &noti );
185 187
186 /** options dialog made a changed to the configuration. we catch this 188 /** options dialog made a changed to the configuration. we catch this
187 * and notify all widgets which need to update their configuration. */ 189 * and notify all widgets which need to update their configuration. */
188 void updateConfig(); 190 void updateConfig();
189 191
190 void insertBirthdays(const QString& uid, const QStringList& birthdayList, 192 void insertBirthdays(const QString& uid, const QStringList& birthdayList,
191 const QStringList& anniversaryList, const QStringList& realNameList, 193 const QStringList& anniversaryList, const QStringList& realNameList,
192 const QStringList& emailList, const QStringList& assembledNameList, 194 const QStringList& emailList, const QStringList& assembledNameList,
193 const QStringList& uidList); 195 const QStringList& uidList);
194 196
195 /** 197 /**
196 Load calendar from file \a filename. If \a merge is true, load 198 Load calendar from file \a filename. If \a merge is true, load
197 calendar into existing one, if it is false, clear calendar, before 199 calendar into existing one, if it is false, clear calendar, before
198 loading. Return true, if calendar could be successfully loaded. 200 loading. Return true, if calendar could be successfully loaded.
199 */ 201 */
200 bool openCalendar(QString filename, bool merge=false); 202 bool openCalendar(QString filename, bool merge=false);
201 bool syncCalendar(QString filename,int mode = 0 ); 203 bool syncCalendar(QString filename,int mode = 0 );
202 204
203 /** 205 /**
204 Save calendar data to file. Return true if calendar could be 206 Save calendar data to file. Return true if calendar could be
205 successfully saved. 207 successfully saved.
206 */ 208 */
207 bool saveCalendar(QString filename); 209 bool saveCalendar(QString filename);
208 210
209 /** 211 /**
210 Close calendar. Clear calendar data and reset views to display an empty 212 Close calendar. Clear calendar data and reset views to display an empty
211 calendar. 213 calendar.
212 */ 214 */
213 void closeCalendar(); 215 void closeCalendar();
214 216
215 /** Archive old events of calendar */ 217 /** Archive old events of calendar */
216 void archiveCalendar(); 218 void archiveCalendar();
217 219
218 void showIncidence(); 220 void showIncidence();
219 void editIncidence(); 221 void editIncidence();
220 void editIncidenceDescription(); 222 void editIncidenceDescription();
221 void deleteIncidence(); 223 void deleteIncidence();
222 void cloneIncidence(); 224 void cloneIncidence();
223 void moveIncidence(); 225 void moveIncidence();
224 void beamIncidence(); 226 void beamIncidence();
225 void toggleCancelIncidence(); 227 void toggleCancelIncidence();
226 228
227 /** create an editeventwin with supplied date/time, and if bool is true, 229 /** create an editeventwin with supplied date/time, and if bool is true,
228 * make the event take all day. */ 230 * make the event take all day. */
229 void newEvent(QDateTime, QDateTime, bool allDay ); 231 void newEvent(QDateTime, QDateTime, bool allDay );
230 void newEvent(QDateTime, QDateTime); 232 void newEvent(QDateTime, QDateTime);
231 void newEvent(QDateTime fh); 233 void newEvent(QDateTime fh);
232 void newEvent(QDate dt); 234 void newEvent(QDate dt);
233 /** create new event without having a date hint. Takes current date as 235 /** create new event without having a date hint. Takes current date as
234 default hint. */ 236 default hint. */
235 void newEvent(); 237 void newEvent();
236 void newFloatingEvent(); 238 void newFloatingEvent();
237 239
238 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ 240 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
239 void showIncidence(Incidence *); 241 void showIncidence(Incidence *);
240 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ 242 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/
241 void editIncidence(Incidence *); 243 void editIncidence(Incidence *);
242 /** Delete the supplied incidence. It calls the correct deleteXXX method*/ 244 /** Delete the supplied incidence. It calls the correct deleteXXX method*/
243 void deleteIncidence(Incidence *); 245 void deleteIncidence(Incidence *);
244 void cloneIncidence(Incidence *); 246 void cloneIncidence(Incidence *);
245 void cancelIncidence(Incidence *); 247 void cancelIncidence(Incidence *);
246 /** Create an editor for the supplied event. */ 248 /** Create an editor for the supplied event. */
247 void editEvent(Event *); 249 void editEvent(Event *);
248 /** Delete the supplied event. */ 250 /** Delete the supplied event. */
249 void deleteEvent(Event *); 251 void deleteEvent(Event *);
250 /** Delete the event with the given unique ID. Returns false, if event wasn't 252 /** Delete the event with the given unique ID. Returns false, if event wasn't
251 found. */ 253 found. */
252 bool deleteEvent(const QString &uid); 254 bool deleteEvent(const QString &uid);
253 /** Create a read-only viewer dialog for the supplied event. */ 255 /** Create a read-only viewer dialog for the supplied event. */
254 void showEvent(Event *); 256 void showEvent(Event *);
255 257
256 void editJournal(Journal *); 258 void editJournal(Journal *);
257 void showJournal(Journal *); 259 void showJournal(Journal *);
258 void deleteJournal(Journal *); 260 void deleteJournal(Journal *);
259 /** Create an editor dialog for a todo */ 261 /** Create an editor dialog for a todo */
260 void editTodo(Todo *); 262 void editTodo(Todo *);
261 /** Create a read-only viewer dialog for the supplied todo */ 263 /** Create a read-only viewer dialog for the supplied todo */
262 void showTodo(Todo *); 264 void showTodo(Todo *);
263 /** create new todo */ 265 /** create new todo */
264 void newTodo(); 266 void newTodo();
265 void newTodoDateTime(QDateTime, bool allday); 267 void newTodoDateTime(QDateTime, bool allday);
266 /** create new todo with a parent todo */ 268 /** create new todo with a parent todo */
267 void newSubTodo(); 269 void newSubTodo();
268 /** create new todo with a parent todo */ 270 /** create new todo with a parent todo */
269 void newSubTodo(Todo *); 271 void newSubTodo(Todo *);
270 /** Delete todo */ 272 /** Delete todo */
271 void deleteTodo(Todo *); 273 void deleteTodo(Todo *);
272 274
273 275
274 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is 276 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is
275 * emitted as result. */ 277 * emitted as result. */
276 void checkClipboard(); 278 void checkClipboard();
277 279
278 /** using the KConfig associated with the kapp variable, read in the 280 /** using the KConfig associated with the kapp variable, read in the
279 * settings from the config file. 281 * settings from the config file.
280 */ 282 */
281 void readSettings(); 283 void readSettings();
282 284
283 /** write current state to config file. */ 285 /** write current state to config file. */
284 void writeSettings(); 286 void writeSettings();
285 287
286 /** read settings for calendar filters */ 288 /** read settings for calendar filters */
287 void readFilterSettings(KConfig *config); 289 void readFilterSettings(KConfig *config);
288 290
289 /** write settings for calendar filters */ 291 /** write settings for calendar filters */
290 void writeFilterSettings(KConfig *config); 292 void writeFilterSettings(KConfig *config);
291 293
292 /** passes on the message that an event has changed to the currently 294 /** passes on the message that an event has changed to the currently
293 * activated view so that it can make appropriate display changes. */ 295 * activated view so that it can make appropriate display changes. */
294 void changeEventDisplay(Event *, int); 296 void changeEventDisplay(Event *, int);
295 void changeIncidenceDisplay(Incidence *, int); 297 void changeIncidenceDisplay(Incidence *, int);
296 void changeTodoDisplay(Todo *, int); 298 void changeTodoDisplay(Todo *, int);
297 299
298 void eventAdded(Event *); 300 void eventAdded(Event *);
299 void eventChanged(Event *); 301 void eventChanged(Event *);
300 void eventToBeDeleted(Event *); 302 void eventToBeDeleted(Event *);
301 void eventDeleted(); 303 void eventDeleted();
302 304
303 void todoAdded(Todo *); 305 void todoAdded(Todo *);
304 void todoChanged(Todo *); 306 void todoChanged(Todo *);
305 void todoToBeDeleted(Todo *); 307 void todoToBeDeleted(Todo *);
306 void todoDeleted(); 308 void todoDeleted();
307 309
308 void updateView(const QDate &start, const QDate &end); 310 void updateView(const QDate &start, const QDate &end);
309 void updateView(); 311 void updateView();
310 312
311 /** Full update of visible todo views */ 313 /** Full update of visible todo views */
312 void updateTodoViews(); 314 void updateTodoViews();
313 315
314 void updateUnmanagedViews(); 316 void updateUnmanagedViews();
315 317
316 /** cut the current appointment to the clipboard */ 318 /** cut the current appointment to the clipboard */
317 void edit_cut(); 319 void edit_cut();
318 320
319 /** copy the current appointment(s) to the clipboard */ 321 /** copy the current appointment(s) to the clipboard */
320 void edit_copy(); 322 void edit_copy();
321 323
322 /** paste the current vobject(s) in the clipboard buffer into calendar */ 324 /** paste the current vobject(s) in the clipboard buffer into calendar */
323 void edit_paste(); 325 void edit_paste();
324 326
325 /** edit viewing and configuration options. */ 327 /** edit viewing and configuration options. */
326 void edit_options(); 328 void edit_options();
327 /** 329 /**
328 Functions for printing, previewing a print, and setting up printing 330 Functions for printing, previewing a print, and setting up printing
329 parameters. 331 parameters.
330 */ 332 */
331 void print(); 333 void print();
332 void printSetup(); 334 void printSetup();
333 void printPreview(); 335 void printPreview();
334 336
335 /** Export as iCalendar file */ 337 /** Export as iCalendar file */
336 void exportICalendar(); 338 void exportICalendar();
337 339
338 /** Export as vCalendar file */ 340 /** Export as vCalendar file */
339 bool exportVCalendar( QString fn); 341 bool exportVCalendar( QString fn);
340 342
341 /** pop up a dialog to show an existing appointment. */ 343 /** pop up a dialog to show an existing appointment. */
342 void appointment_show(); 344 void appointment_show();
343 /** 345 /**
344 * pop up an Appointment Dialog to edit an existing appointment.Get 346 * pop up an Appointment Dialog to edit an existing appointment.Get
345 * information on the appointment from the list of unique IDs that is 347 * information on the appointment from the list of unique IDs that is
346 * currently in the View, called currIds. 348 * currently in the View, called currIds.
347 */ 349 */
348 void appointment_edit(); 350 void appointment_edit();
349 /** 351 /**
350 * pop up dialog confirming deletion of currently selected event in the 352 * pop up dialog confirming deletion of currently selected event in the
351 * View. 353 * View.
352 */ 354 */
353 void appointment_delete(); 355 void appointment_delete();
354 356
355 /** mails the currently selected event to a particular user as a vCalendar 357 /** mails the currently selected event to a particular user as a vCalendar
356 attachment. */ 358 attachment. */
357 void action_mail(); 359 void action_mail();
358 360
359 /* frees a subtodo from it's relation */ 361 /* frees a subtodo from it's relation */
360 void todo_unsub( Todo * ); 362 void todo_unsub( Todo * );
361 void todo_resub( Todo * parent, Todo * sub ); 363 void todo_resub( Todo * parent, Todo * sub );
362 364
363 /** Take ownership of selected event. */ 365 /** Take ownership of selected event. */
364 void takeOverEvent(); 366 void takeOverEvent();
365 367
366 /** Take ownership of all events in calendar. */ 368 /** Take ownership of all events in calendar. */
367 void takeOverCalendar(); 369 void takeOverCalendar();
368 370
369 /** query whether or not the calendar is "dirty". */ 371 /** query whether or not the calendar is "dirty". */
370 bool isModified(); 372 bool isModified();
371 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ 373 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */
372 void setModified(bool modified=true); 374 void setModified(bool modified=true);
373 375
374 /** query if the calendar is read-only. */ 376 /** query if the calendar is read-only. */
375 bool isReadOnly(); 377 bool isReadOnly();
376 /** set state of calendar to read-only */ 378 /** set state of calendar to read-only */
377 void setReadOnly(bool readOnly=true); 379 void setReadOnly(bool readOnly=true);
378 380
379 void eventUpdated(Incidence *); 381 void eventUpdated(Incidence *);
380 382
381 /* iTIP scheduling actions */ 383 /* iTIP scheduling actions */
382 void schedule_publish(Incidence *incidence = 0); 384 void schedule_publish(Incidence *incidence = 0);
383 void schedule_request(Incidence *incidence = 0); 385 void schedule_request(Incidence *incidence = 0);
384 void schedule_refresh(Incidence *incidence = 0); 386 void schedule_refresh(Incidence *incidence = 0);
385 void schedule_cancel(Incidence *incidence = 0); 387 void schedule_cancel(Incidence *incidence = 0);
386 void schedule_add(Incidence *incidence = 0); 388 void schedule_add(Incidence *incidence = 0);
387 void schedule_reply(Incidence *incidence = 0); 389 void schedule_reply(Incidence *incidence = 0);
388 void schedule_counter(Incidence *incidence = 0); 390 void schedule_counter(Incidence *incidence = 0);
389 void schedule_declinecounter(Incidence *incidence = 0); 391 void schedule_declinecounter(Incidence *incidence = 0);
390 void schedule_publish_freebusy(int daysToPublish = 30); 392 void schedule_publish_freebusy(int daysToPublish = 30);
391 393
392 void openAddressbook(); 394 void openAddressbook();
393 395
394 void editFilters(); 396 void editFilters();
395 void toggleFilerEnabled(); 397 void toggleFilerEnabled();
396 QPtrList<CalFilter> filters(); 398 QPtrList<CalFilter> filters();
397 void toggleFilter(); 399 void toggleFilter();
398 void showFilter(bool visible); 400 void showFilter(bool visible);
399 void updateFilter(); 401 void updateFilter();
400 void filterEdited(); 402 void filterEdited();
401 void selectFilter( int ); 403 void selectFilter( int );
402 KOFilterView *filterView(); 404 KOFilterView *filterView();
403 405
404 void showIntro(); 406 void showIntro();
405 407
406 /** Move the curdatepient view date to today */ 408 /** Move the curdatepient view date to today */
407 void goToday(); 409 void goToday();
408 410
409 /** Move to the next date(s) in the current view */ 411 /** Move to the next date(s) in the current view */
410 void goNext(); 412 void goNext();
411 413
412 /** Move to the previous date(s) in the current view */ 414 /** Move to the previous date(s) in the current view */
413 void goPrevious(); 415 void goPrevious();
414 /** Move to the next date(s) in the current view */ 416 /** Move to the next date(s) in the current view */
415 void goNextMonth(); 417 void goNextMonth();
416 418
417 /** Move to the previous date(s) in the current view */ 419 /** Move to the previous date(s) in the current view */
418 void goPreviousMonth(); 420 void goPreviousMonth();
419 421
420 void toggleExpand(); 422 void toggleExpand();
421 void toggleDateNavigatorWidget(); 423 void toggleDateNavigatorWidget();
422 void toggleAllDaySize(); 424 void toggleAllDaySize();
423 void dialogClosing(Incidence *); 425 void dialogClosing(Incidence *);
424 426
425 /** Look for new messages in the inbox */ 427 /** Look for new messages in the inbox */
426 void lookForIncomingMessages(); 428 void lookForIncomingMessages();
427 /** Look for new messages in the outbox */ 429 /** Look for new messages in the outbox */
428 void lookForOutgoingMessages(); 430 void lookForOutgoingMessages();
429 431
430 void processMainViewSelection( Incidence * ); 432 void processMainViewSelection( Incidence * );
431 void processTodoListSelection( Incidence * ); 433 void processTodoListSelection( Incidence * );
432 434
433 void processIncidenceSelection( Incidence * ); 435 void processIncidenceSelection( Incidence * );
434 436
435 void purgeCompleted(); 437 void purgeCompleted();
436 bool removeCompletedSubTodos( Todo* ); 438 bool removeCompletedSubTodos( Todo* );
437 void slotCalendarChanged(); 439 void slotCalendarChanged();
438 bool importBday(); 440 bool importBday();
439 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); 441 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
440 bool importQtopia( const QString &categoriesFile, 442 bool importQtopia( const QString &categoriesFile,
441 const QString &datebookFile, 443 const QString &datebookFile,
442 const QString &tasklistFile ); 444 const QString &tasklistFile );
443 void syncExternal( int mode ); 445 void syncExternal( int mode );
444 void slotSelectPickerDate( QDate ) ; 446 void slotSelectPickerDate( QDate ) ;
445 void showDatePicker( ) ; 447 void showDatePicker( ) ;
446 void moveIncidence(Incidence *) ; 448 void moveIncidence(Incidence *) ;
447 void beamIncidence(Incidence *) ; 449 void beamIncidence(Incidence *) ;
448 void beamCalendar() ; 450 void beamCalendar() ;
449 void beamFilteredCalendar() ; 451 void beamFilteredCalendar() ;
450 void beamIncidenceList(QPtrList<Incidence>) ; 452 void beamIncidenceList(QPtrList<Incidence>) ;
451 void manageCategories(); 453 void manageCategories();
452 int addCategories(); 454 int addCategories();
453 void removeCategories(); 455 void removeCategories();
454 void setSyncDevice( QString ); 456 void setSyncDevice( QString );
455 void setSyncName( QString ); 457 void setSyncName( QString );
456 void showDay( QDate ); 458 void showDay( QDate );
457 void undo_delete(); 459 void undo_delete();
458 protected slots: 460 protected slots:
459 void timerAlarm(); 461 void timerAlarm();
460 void suspendAlarm(); 462 void suspendAlarm();
461 void beamDone( Ir *ir ); 463 void beamDone( Ir *ir );
462 /** Select a view or adapt the current view to display the specified dates. */ 464 /** Select a view or adapt the current view to display the specified dates. */
463 void showDates( const KCal::DateList & ); 465 void showDates( const KCal::DateList & );
464 void selectWeekNum ( int ); 466 void selectWeekNum ( int );
465 467
466 public: 468 public:
467 // show a standard warning 469 // show a standard warning
468 // returns KMsgBox::yesNoCancel() 470 // returns KMsgBox::yesNoCancel()
469 int msgCalModified(); 471 int msgCalModified();
470 virtual bool sync(KSyncManager* manager, QString filename, int mode); 472 virtual bool sync(KSyncManager* manager, QString filename, int mode);
471 473
472 virtual bool syncExternal(KSyncManager* manager, QString resource); 474 virtual bool syncExternal(KSyncManager* manager, QString resource);
473 virtual void removeSyncInfo( QString syncProfile); 475 virtual void removeSyncInfo( QString syncProfile);
474 void setSyncManager(KSyncManager* manager); 476 void setSyncManager(KSyncManager* manager);
475 void setLoadedFileVersion(QDateTime); 477 void setLoadedFileVersion(QDateTime);
476 bool checkFileVersion(QString fn); 478 bool checkFileVersion(QString fn);
477 bool checkFileChanged(QString fn); 479 bool checkFileChanged(QString fn);
478 Event* getLastSyncEvent(); 480 Event* getLastSyncEvent();
479 /** Adapt navigation units correpsonding to step size of navigation of the 481 /** Adapt navigation units correpsonding to step size of navigation of the
480 * current view. 482 * current view.
481 */ 483 */
482 void adaptNavigationUnits(); 484 void adaptNavigationUnits();
483 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 485 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
484 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 486 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
485 //Attendee* getYourAttendee(Event *event); 487 //Attendee* getYourAttendee(Event *event);
486 void setBlockShowDates( bool b ) { mBlockShowDates = b ;} 488 void setBlockShowDates( bool b ) { mBlockShowDates = b ;}
487 protected: 489 protected:
488 void schedule(Scheduler::Method, Incidence *incidence = 0); 490 void schedule(Scheduler::Method, Incidence *incidence = 0);
489 491
490 // returns KMsgBox::OKCandel() 492 // returns KMsgBox::OKCandel()
491 int msgItemDelete(const QString name); 493 int msgItemDelete(const QString name);
492 void showEventEditor(); 494 void showEventEditor();
493 void showTodoEditor(); 495 void showTodoEditor();
494 void writeLocale(); 496 void writeLocale();
495 Todo *selectedTodo(); 497 Todo *selectedTodo();
496 498
497 private: 499 private:
498 bool mBlockShowDates; 500 bool mBlockShowDates;
499 KSyncManager* mSyncManager; 501 KSyncManager* mSyncManager;
500 AlarmDialog * mAlarmDialog; 502 AlarmDialog * mAlarmDialog;
501 QString mAlarmNotification; 503 QString mAlarmNotification;
502 QString mSuspendAlarmNotification; 504 QString mSuspendAlarmNotification;
503 QTimer* mSuspendTimer; 505 QTimer* mSuspendTimer;
504 QTimer* mAlarmTimer; 506 QTimer* mAlarmTimer;
505 QTimer* mRecheckAlarmTimer; 507 QTimer* mRecheckAlarmTimer;
506 void computeAlarm( QString ); 508 void computeAlarm( QString );
507 void startAlarm( QString, QString ); 509 void startAlarm( QString, QString );
508 void setSyncEventsReadOnly(); 510 void setSyncEventsReadOnly();
509 511
510 QDateTime loadedFileVersion; 512 QDateTime loadedFileVersion;
511 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); 513 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
512 void checkExternalId( Incidence * inc ); 514 void checkExternalId( Incidence * inc );
513 int mGlobalSyncMode; 515 int mGlobalSyncMode;
514 QString mCurrentSyncDevice; 516 QString mCurrentSyncDevice;
515 QString mCurrentSyncName; 517 QString mCurrentSyncName;
516 KOBeamPrefs* beamDialog; 518 KOBeamPrefs* beamDialog;
517 void init(); 519 void init();
518 int mDatePickerMode; 520 int mDatePickerMode;
519 bool mFlagEditDescription; 521 bool mFlagEditDescription;
520 QDateTime mLastCalendarSync; 522 QDateTime mLastCalendarSync;
521 void createPrinter(); 523 void createPrinter();
522 524
523 void calendarModified( bool, Calendar * ); 525 void calendarModified( bool, Calendar * );
524 526
525 CalPrinter *mCalPrinter; 527 CalPrinter *mCalPrinter;
526 528
527 QSplitter *mPanner; 529 QSplitter *mPanner;
528 QSplitter *mLeftSplitter; 530 QSplitter *mLeftSplitter;
529 QWidget *mLeftFrame; 531 QWidget *mLeftFrame;
530 QWidgetStack *mRightFrame; 532 QWidgetStack *mRightFrame;
531 533
532 KDatePicker* mDatePicker; 534 KDatePicker* mDatePicker;
533 QVBox* mDateFrame; 535 QVBox* mDateFrame;
534 NavigatorBar *mNavigatorBar; 536 NavigatorBar *mNavigatorBar;
535 537
536 KDateNavigator *mDateNavigator; // widget showing small month view. 538 KDateNavigator *mDateNavigator; // widget showing small month view.
537 539
538 KOFilterView *mFilterView; 540 KOFilterView *mFilterView;
539 541
540 ResourceView *mResourceView; 542 ResourceView *mResourceView;
541 543
542 // calendar object for this viewing instance 544 // calendar object for this viewing instance
543 Calendar *mCalendar; 545 Calendar *mCalendar;
544 546
545 CalendarResourceManager *mResourceManager; 547 CalendarResourceManager *mResourceManager;
546 548
547 FileStorage *mStorage; 549 FileStorage *mStorage;
548 550
549 DateNavigator *mNavigator; 551 DateNavigator *mNavigator;
550 552
551 KOViewManager *mViewManager; 553 KOViewManager *mViewManager;
552 KODialogManager *mDialogManager; 554 KODialogManager *mDialogManager;
553 555
554 // Calendar filters 556 // Calendar filters
555 QPtrList<CalFilter> mFilters; 557 QPtrList<CalFilter> mFilters;
556 558
557 // various housekeeping variables. 559 // various housekeeping variables.
558 bool mModified; // flag indicating if calendar is modified 560 bool mModified; // flag indicating if calendar is modified
559 bool mReadOnly; // flag indicating if calendar is read-only 561 bool mReadOnly; // flag indicating if calendar is read-only
560 QDate mSaveSingleDate; 562 QDate mSaveSingleDate;
561 563
562 Incidence *mSelectedIncidence; 564 Incidence *mSelectedIncidence;
563 Incidence *mMoveIncidence; 565 Incidence *mMoveIncidence;
564 QDate mMoveIncidenceOldDate; 566 QDate mMoveIncidenceOldDate;
565 KOTodoView *mTodoList; 567 KOTodoView *mTodoList;
566 KOEventEditor * mEventEditor; 568 KOEventEditor * mEventEditor;
567 KOTodoEditor * mTodoEditor; 569 KOTodoEditor * mTodoEditor;
568 KOEventViewerDialog * mEventViewerDialog; 570 KOEventViewerDialog * mEventViewerDialog;
569 void keyPressEvent ( QKeyEvent *e) ; 571 void keyPressEvent ( QKeyEvent *e) ;
570 //QMap<Incidence*,KOIncidenceEditor*> mDialogList; 572 //QMap<Incidence*,KOIncidenceEditor*> mDialogList;
571}; 573};
572 574
573 575
574class CalendarViewVisitor : public Incidence::Visitor 576class CalendarViewVisitor : public Incidence::Visitor
575{ 577{
576 public: 578 public:
577 CalendarViewVisitor() : mView( 0 ) {} 579 CalendarViewVisitor() : mView( 0 ) {}
578 580
579 bool act( Incidence *incidence, CalendarView *view ) 581 bool act( Incidence *incidence, CalendarView *view )
580 { 582 {
581 mView = view; 583 mView = view;
582 return incidence->accept( *this ); 584 return incidence->accept( *this );
583 } 585 }
584 586
585 protected: 587 protected:
586 CalendarView *mView; 588 CalendarView *mView;
587}; 589};
588 590
589class ShowIncidenceVisitor : public CalendarViewVisitor 591class ShowIncidenceVisitor : public CalendarViewVisitor
590{ 592{
591 protected: 593 protected:
592 bool visit( Event *event ) { mView->showEvent( event ); return true; } 594 bool visit( Event *event ) { mView->showEvent( event ); return true; }
593 bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } 595 bool visit( Todo *todo ) { mView->showTodo( todo ); return true; }
594 bool visit( Journal * j ) { mView->showJournal( j );return true; } 596 bool visit( Journal * j ) { mView->showJournal( j );return true; }
595}; 597};
596 598
597class EditIncidenceVisitor : public CalendarViewVisitor 599class EditIncidenceVisitor : public CalendarViewVisitor
598{ 600{
599 protected: 601 protected:
600 bool visit( Event *event ) { mView->editEvent( event ); return true; } 602 bool visit( Event *event ) { mView->editEvent( event ); return true; }
601 bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } 603 bool visit( Todo *todo ) { mView->editTodo( todo ); return true; }
602 bool visit( Journal *j ) { mView->editJournal( j); return true; } 604 bool visit( Journal *j ) { mView->editJournal( j); return true; }
603}; 605};
604 606
605class DeleteIncidenceVisitor : public CalendarViewVisitor 607class DeleteIncidenceVisitor : public CalendarViewVisitor
606{ 608{
607 protected: 609 protected:
608 bool visit( Event *event ) { mView->deleteEvent( event ); return true; } 610 bool visit( Event *event ) { mView->deleteEvent( event ); return true; }
609 bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } 611 bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; }
610 bool visit( Journal * j) {mView->deleteJournal( j ); return true; } 612 bool visit( Journal * j) {mView->deleteJournal( j ); return true; }
611}; 613};
612 614
613#endif 615#endif
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 3feb4ab..a2c20a8 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,1929 +1,1942 @@
1#include <stdlib.h> 1#include <stdlib.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#include <qpainter.h> 5#include <qpainter.h>
6#include <qwhatsthis.h> 6#include <qwhatsthis.h>
7#include <qpushbutton.h> 7#include <qpushbutton.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qlineedit.h> 9#include <qlineedit.h>
10#include <qtextcodec.h> 10#include <qtextcodec.h>
11#include <qfile.h> 11#include <qfile.h>
12#include <qdir.h> 12#include <qdir.h>
13#include <qapp.h> 13#include <qapp.h>
14#include <qfileinfo.h> 14#include <qfileinfo.h>
15#include <qlabel.h> 15#include <qlabel.h>
16#include <qspinbox.h> 16#include <qspinbox.h>
17#include <qcheckbox.h> 17#include <qcheckbox.h>
18#include <qmap.h> 18#include <qmap.h>
19#include <qwmatrix.h> 19#include <qwmatrix.h>
20#include <qtextbrowser.h> 20#include <qtextbrowser.h>
21#include <qtextstream.h> 21#include <qtextstream.h>
22#ifndef DESKTOP_VERSION 22#ifndef DESKTOP_VERSION
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/qpemenubar.h> 24#include <qpe/qpemenubar.h>
25#include <qpe/qpetoolbar.h> 25#include <qpe/qpetoolbar.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qtopia/alarmserver.h> 28#include <qtopia/alarmserver.h>
29#include <qtopia/qcopenvelope_qws.h> 29#include <qtopia/qcopenvelope_qws.h>
30#include <unistd.h> // for sleep 30#include <unistd.h> // for sleep
31#else 31#else
32#include <qmenubar.h> 32#include <qmenubar.h>
33#include <qtoolbar.h> 33#include <qtoolbar.h>
34#include <qapplication.h> 34#include <qapplication.h>
35//#include <resource.h> 35//#include <resource.h>
36 36
37#endif 37#endif
38#include <libkcal/calendarlocal.h> 38#include <libkcal/calendarlocal.h>
39#include <libkcal/todo.h> 39#include <libkcal/todo.h>
40#include <libkcal/phoneformat.h> 40#include <libkcal/phoneformat.h>
41#include <libkdepim/ksyncprofile.h> 41#include <libkdepim/ksyncprofile.h>
42#include <libkdepim/phoneaccess.h> 42#include <libkdepim/phoneaccess.h>
43#include <libkcal/kincidenceformatter.h> 43#include <libkcal/kincidenceformatter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
46#include "calendarview.h" 46#include "calendarview.h"
47#include "koviewmanager.h" 47#include "koviewmanager.h"
48#include "datenavigator.h" 48#include "datenavigator.h"
49#include "koagendaview.h" 49#include "koagendaview.h"
50#include "koagenda.h" 50#include "koagenda.h"
51#include "kodialogmanager.h" 51#include "kodialogmanager.h"
52#include "kdialogbase.h" 52#include "kdialogbase.h"
53#include "kapplication.h" 53#include "kapplication.h"
54#include "kofilterview.h" 54#include "kofilterview.h"
55#include "kstandarddirs.h" 55#include "kstandarddirs.h"
56#include "koprefs.h" 56#include "koprefs.h"
57#include "kfiledialog.h" 57#include "kfiledialog.h"
58#include "koglobals.h" 58#include "koglobals.h"
59#include "kglobal.h" 59#include "kglobal.h"
60#include "klocale.h" 60#include "klocale.h"
61#include "kconfig.h" 61#include "kconfig.h"
62#include "simplealarmclient.h" 62#include "simplealarmclient.h"
63#include "externalapphandler.h" 63#include "externalapphandler.h"
64 64
65using namespace KCal; 65using namespace KCal;
66#ifndef _WIN32_ 66#ifndef _WIN32_
67#include <unistd.h> 67#include <unistd.h>
68#else 68#else
69#ifdef _OL_IMPORT_ 69#ifdef _OL_IMPORT_
70#include "koimportoldialog.h" 70#include "koimportoldialog.h"
71#endif 71#endif
72#endif 72#endif
73#include "mainwindow.h" 73#include "mainwindow.h"
74 74
75class KOex2phonePrefs : public QDialog 75class KOex2phonePrefs : public QDialog
76{ 76{
77 public: 77 public:
78 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 78 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
79 QDialog( parent, name, true ) 79 QDialog( parent, name, true )
80 { 80 {
81 setCaption( i18n("Export to phone options") ); 81 setCaption( i18n("Export to phone options") );
82 QVBoxLayout* lay = new QVBoxLayout( this ); 82 QVBoxLayout* lay = new QVBoxLayout( this );
83 lay->setSpacing( 3 ); 83 lay->setSpacing( 3 );
84 lay->setMargin( 3 ); 84 lay->setMargin( 3 );
85 QLabel *lab; 85 QLabel *lab;
86 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 86 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
87 lab->setAlignment (AlignHCenter ); 87 lab->setAlignment (AlignHCenter );
88 QHBox* temphb; 88 QHBox* temphb;
89 temphb = new QHBox( this ); 89 temphb = new QHBox( this );
90 new QLabel( i18n("I/O device: "), temphb ); 90 new QLabel( i18n("I/O device: "), temphb );
91 mPhoneDevice = new QLineEdit( temphb); 91 mPhoneDevice = new QLineEdit( temphb);
92 lay->addWidget( temphb ); 92 lay->addWidget( temphb );
93 temphb = new QHBox( this ); 93 temphb = new QHBox( this );
94 new QLabel( i18n("Connection: "), temphb ); 94 new QLabel( i18n("Connection: "), temphb );
95 mPhoneConnection = new QLineEdit( temphb); 95 mPhoneConnection = new QLineEdit( temphb);
96 lay->addWidget( temphb ); 96 lay->addWidget( temphb );
97 temphb = new QHBox( this ); 97 temphb = new QHBox( this );
98 new QLabel( i18n("Model(opt.): "), temphb ); 98 new QLabel( i18n("Model(opt.): "), temphb );
99 mPhoneModel = new QLineEdit( temphb); 99 mPhoneModel = new QLineEdit( temphb);
100 lay->addWidget( temphb ); 100 lay->addWidget( temphb );
101 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 101 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
102 mWriteBackFuture->setChecked( true ); 102 mWriteBackFuture->setChecked( true );
103 lay->addWidget( mWriteBackFuture ); 103 lay->addWidget( mWriteBackFuture );
104 temphb = new QHBox( this ); 104 temphb = new QHBox( this );
105 new QLabel( i18n("Max. weeks in future: ") , temphb ); 105 new QLabel( i18n("Max. weeks in future: ") , temphb );
106 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 106 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
107 mWriteBackFutureWeeks->setValue( 8 ); 107 mWriteBackFutureWeeks->setValue( 8 );
108 lay->addWidget( temphb ); 108 lay->addWidget( temphb );
109 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 109 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
110 lab->setAlignment (AlignHCenter ); 110 lab->setAlignment (AlignHCenter );
111 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 111 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
112 lay->addWidget( ok ); 112 lay->addWidget( ok );
113 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 113 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
114 lay->addWidget( cancel ); 114 lay->addWidget( cancel );
115 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 115 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
116 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 116 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
117 resize( 220, 240 ); 117 resize( 220, 240 );
118 qApp->processEvents(); 118 qApp->processEvents();
119 int dw = QApplication::desktop()->width(); 119 int dw = QApplication::desktop()->width();
120 int dh = QApplication::desktop()->height(); 120 int dh = QApplication::desktop()->height();
121 move( (dw-width())/2, (dh - height() )/2 ); 121 move( (dw-width())/2, (dh - height() )/2 );
122 } 122 }
123 123
124public: 124public:
125 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 125 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
126 QCheckBox* mWriteBackFuture; 126 QCheckBox* mWriteBackFuture;
127 QSpinBox* mWriteBackFutureWeeks; 127 QSpinBox* mWriteBackFutureWeeks;
128}; 128};
129 129
130int globalFlagBlockStartup; 130int globalFlagBlockStartup;
131MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 131MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
132 QMainWindow( parent, name ) 132 QMainWindow( parent, name )
133{ 133{
134 134
135#ifdef DESKTOP_VERSION 135#ifdef DESKTOP_VERSION
136 setFont( QFont("Arial"), 14 ); 136 setFont( QFont("Arial"), 14 );
137#endif 137#endif
138 mClosed = false; 138 mClosed = false;
139 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 139 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
140 QString confFile = locateLocal("config","korganizerrc"); 140 QString confFile = locateLocal("config","korganizerrc");
141 QFileInfo finf ( confFile ); 141 QFileInfo finf ( confFile );
142 bool showWarning = !finf.exists(); 142 bool showWarning = !finf.exists();
143 setIcon(SmallIcon( "ko24" ) ); 143 setIcon(SmallIcon( "ko24" ) );
144 mBlockAtStartup = true; 144 mBlockAtStartup = true;
145 mFlagKeyPressed = false; 145 mFlagKeyPressed = false;
146 setCaption("KOrganizer/Pi"); 146 setCaption("KOrganizer/Pi");
147 KOPrefs *p = KOPrefs::instance(); 147 KOPrefs *p = KOPrefs::instance();
148 KPimGlobalPrefs::instance()->setGlobalConfig(); 148 KPimGlobalPrefs::instance()->setGlobalConfig();
149 if ( p->mHourSize > 18 ) 149 if ( p->mHourSize > 18 )
150 p->mHourSize = 18; 150 p->mHourSize = 18;
151 QMainWindow::ToolBarDock tbd; 151 QMainWindow::ToolBarDock tbd;
152 if ( p->mToolBarHor ) { 152 if ( p->mToolBarHor ) {
153 if ( p->mToolBarUp ) 153 if ( p->mToolBarUp )
154 tbd = Bottom; 154 tbd = Bottom;
155 else 155 else
156 tbd = Top; 156 tbd = Top;
157 } 157 }
158 else { 158 else {
159 if ( p->mToolBarUp ) 159 if ( p->mToolBarUp )
160 tbd = Right; 160 tbd = Right;
161 else 161 else
162 tbd = Left; 162 tbd = Left;
163 } 163 }
164 if ( KOPrefs::instance()->mUseAppColors ) 164 if ( KOPrefs::instance()->mUseAppColors )
165 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 165 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
166 globalFlagBlockStartup = 1; 166 globalFlagBlockStartup = 1;
167 iconToolBar = new QPEToolBar( this ); 167 iconToolBar = new QPEToolBar( this );
168 addToolBar (iconToolBar , tbd ); 168 addToolBar (iconToolBar , tbd );
169 mCalendarModifiedFlag = false; 169 mCalendarModifiedFlag = false;
170 170
171 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 171 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
172 splash->setAlignment ( AlignCenter ); 172 splash->setAlignment ( AlignCenter );
173 setCentralWidget( splash ); 173 setCentralWidget( splash );
174#ifndef DESKTOP_VERSION 174#ifndef DESKTOP_VERSION
175 showMaximized(); 175 showMaximized();
176#endif 176#endif
177 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 177 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
178 setDefaultPreferences(); 178 setDefaultPreferences();
179 mCalendar = new CalendarLocal(); 179 mCalendar = new CalendarLocal();
180 mView = new CalendarView( mCalendar, this,"mCalendar " ); 180 mView = new CalendarView( mCalendar, this,"mCalendar " );
181 mView->hide(); 181 mView->hide();
182 //mView->resize(splash->size() ); 182 //mView->resize(splash->size() );
183 initActions(); 183 initActions();
184 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 184 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
185 mSyncManager->setBlockSave(false); 185 mSyncManager->setBlockSave(false);
186 mView->setSyncManager(mSyncManager); 186 mView->setSyncManager(mSyncManager);
187#ifndef DESKTOP_VERSION 187#ifndef DESKTOP_VERSION
188 iconToolBar->show(); 188 iconToolBar->show();
189 qApp->processEvents(); 189 qApp->processEvents();
190#endif 190#endif
191 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 191 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
192 int vh = height() ; 192 int vh = height() ;
193 int vw = width(); 193 int vw = width();
194 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 194 //qDebug("Toolbar hei %d ",iconToolBar->height() );
195 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 195 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
196 vh -= iconToolBar->height(); 196 vh -= iconToolBar->height();
197 } else { 197 } else {
198 vw -= iconToolBar->height(); 198 vw -= iconToolBar->height();
199 } 199 }
200 //mView->setMaximumSize( splash->size() ); 200 //mView->setMaximumSize( splash->size() );
201 //mView->resize( splash->size() ); 201 //mView->resize( splash->size() );
202 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 202 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
203 mView->readSettings(); 203 mView->readSettings();
204 bool newFile = false; 204 bool newFile = false;
205 if( !QFile::exists( defaultFileName() ) ) { 205 if( !QFile::exists( defaultFileName() ) ) {
206 QFileInfo finfo ( defaultFileName() ); 206 QFileInfo finfo ( defaultFileName() );
207 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 207 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
208 qDebug("oldfile %s ", oldFile.latin1()); 208 qDebug("oldfile %s ", oldFile.latin1());
209 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; 209 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n";
210 finfo.setFile( oldFile ); 210 finfo.setFile( oldFile );
211 if (finfo.exists() ) { 211 if (finfo.exists() ) {
212 KMessageBox::information( this, message); 212 KMessageBox::information( this, message);
213 mView->openCalendar( oldFile ); 213 mView->openCalendar( oldFile );
214 qApp->processEvents(); 214 qApp->processEvents();
215 } else { 215 } else {
216 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 216 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
217 finfo.setFile( oldFile ); 217 finfo.setFile( oldFile );
218 if (finfo.exists() ) { 218 if (finfo.exists() ) {
219 KMessageBox::information( this, message); 219 KMessageBox::information( this, message);
220 mView->openCalendar( oldFile ); 220 mView->openCalendar( oldFile );
221 qApp->processEvents(); 221 qApp->processEvents();
222 } 222 }
223 } 223 }
224 mView->saveCalendar( defaultFileName() ); 224 mView->saveCalendar( defaultFileName() );
225 newFile = true; 225 newFile = true;
226 } 226 }
227 227
228 QTime neededSaveTime = QDateTime::currentDateTime().time(); 228 QTime neededSaveTime = QDateTime::currentDateTime().time();
229 mView->openCalendar( defaultFileName() ); 229 mView->openCalendar( defaultFileName() );
230 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 230 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
231 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 231 qDebug("KO: Calendar loading time: %d ms",msNeeded );
232 232
233 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 233 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
234 KOPrefs::instance()->setCategoryDefaults(); 234 KOPrefs::instance()->setCategoryDefaults();
235 int count = mView->addCategories(); 235 int count = mView->addCategories();
236 } 236 }
237 processIncidenceSelection( 0 ); 237 processIncidenceSelection( 0 );
238 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 238 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
239 SLOT( processIncidenceSelection( Incidence * ) ) ); 239 SLOT( processIncidenceSelection( Incidence * ) ) );
240 connect( mView, SIGNAL( modifiedChanged( bool ) ), 240 connect( mView, SIGNAL( modifiedChanged( bool ) ),
241 SLOT( slotModifiedChanged( bool ) ) ); 241 SLOT( slotModifiedChanged( bool ) ) );
242 242
243 243
244 connect( mView, SIGNAL( tempDisableBR(bool) ), 244 connect( mView, SIGNAL( tempDisableBR(bool) ),
245 SLOT( disableBR(bool) ) ); 245 SLOT( disableBR(bool) ) );
246 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 246 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
247 mView->setModified( false ); 247 mView->setModified( false );
248 mBlockAtStartup = false; 248 mBlockAtStartup = false;
249 mView->setModified( false ); 249 mView->setModified( false );
250 setCentralWidget( mView ); 250 setCentralWidget( mView );
251 globalFlagBlockStartup = 0; 251 globalFlagBlockStartup = 0;
252 mView->show(); 252 mView->show();
253 delete splash; 253 delete splash;
254 if ( newFile ) 254 if ( newFile )
255 mView->updateConfig(); 255 mView->updateConfig();
256 // qApp->processEvents(); 256 // qApp->processEvents();
257 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 257 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
258 //fillSyncMenu(); 258 //fillSyncMenu();
259 259
260 260
261 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 261 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
262 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
263 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
262 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 264 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
263 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 265 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
264 mSyncManager->setDefaultFileName( defaultFileName()); 266 mSyncManager->setDefaultFileName( defaultFileName());
265 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 267 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
266 mSyncManager->fillSyncMenu(); 268 mSyncManager->fillSyncMenu();
267 269
268 270
269 271
270 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 272 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
271 if ( showWarning ) { 273 if ( showWarning ) {
272 KMessageBox::information( this, 274 KMessageBox::information( this,
273 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 275 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
274 qApp->processEvents(); 276 qApp->processEvents();
275 mView->dialogManager()->showSyncOptions(); 277 mView->dialogManager()->showSyncOptions();
276 } 278 }
277 279
278 //US listen for result adressed from Ka/Pi 280 //US listen for result adressed from Ka/Pi
279#ifndef DESKTOP_VERSION 281#ifndef DESKTOP_VERSION
280 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 282 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
281#endif 283#endif
282#ifndef DESKTOP_VERSION 284#ifndef DESKTOP_VERSION
283 infrared = 0; 285 infrared = 0;
284#endif 286#endif
285 287
286 mBRdisabled = false; 288 mBRdisabled = false;
287 //toggleBeamReceive(); 289 //toggleBeamReceive();
288} 290}
289MainWindow::~MainWindow() 291MainWindow::~MainWindow()
290{ 292{
291 //qDebug("MainWindow::~MainWindow() "); 293 //qDebug("MainWindow::~MainWindow() ");
292 //save toolbar location 294 //save toolbar location
293 delete mCalendar; 295 delete mCalendar;
294 delete mSyncManager; 296 delete mSyncManager;
295#ifndef DESKTOP_VERSION 297#ifndef DESKTOP_VERSION
296 if ( infrared ) 298 if ( infrared )
297 delete infrared; 299 delete infrared;
298#endif 300#endif
299 301
300 302
301} 303}
302 304
303void MainWindow::disableBR(bool b) 305void MainWindow::disableBR(bool b)
304{ 306{
305#ifndef DESKTOP_VERSION 307#ifndef DESKTOP_VERSION
306 if ( b ) { 308 if ( b ) {
307 if ( infrared ) { 309 if ( infrared ) {
308 toggleBeamReceive(); 310 toggleBeamReceive();
309 mBRdisabled = true; 311 mBRdisabled = true;
310 } 312 }
311 mBRdisabled = true; 313 mBRdisabled = true;
312 } else { 314 } else {
313 if ( mBRdisabled ) { 315 if ( mBRdisabled ) {
314 mBRdisabled = false; 316 mBRdisabled = false;
315 //makes no sense,because other cal ap is probably running 317 //makes no sense,because other cal ap is probably running
316 // toggleBeamReceive(); 318 // toggleBeamReceive();
317 } 319 }
318 } 320 }
319#endif 321#endif
320 322
321} 323}
322bool MainWindow::beamReceiveEnabled() 324bool MainWindow::beamReceiveEnabled()
323{ 325{
324#ifndef DESKTOP_VERSION 326#ifndef DESKTOP_VERSION
325 return ( infrared != 0 ); 327 return ( infrared != 0 );
326#endif 328#endif
327 return false; 329 return false;
328} 330}
329 331
330void MainWindow::toggleBeamReceive() 332void MainWindow::toggleBeamReceive()
331{ 333{
332 if ( mBRdisabled ) 334 if ( mBRdisabled )
333 return; 335 return;
334#ifndef DESKTOP_VERSION 336#ifndef DESKTOP_VERSION
335 if ( infrared ) { 337 if ( infrared ) {
336 qDebug("disable BeamReceive "); 338 qDebug("disable BeamReceive ");
337 delete infrared; 339 delete infrared;
338 infrared = 0; 340 infrared = 0;
339 brAction->setOn(false); 341 brAction->setOn(false);
340 return; 342 return;
341 } 343 }
342 qDebug("enable BeamReceive "); 344 qDebug("enable BeamReceive ");
343 brAction->setOn(true); 345 brAction->setOn(true);
344 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 346 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
345 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 347 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
346#endif 348#endif
347} 349}
348void MainWindow::showMaximized () 350void MainWindow::showMaximized ()
349{ 351{
350#ifndef DESKTOP_VERSION 352#ifndef DESKTOP_VERSION
351 if ( ! globalFlagBlockStartup ) 353 if ( ! globalFlagBlockStartup )
352 if ( mClosed ) 354 if ( mClosed )
353 mView->goToday(); 355 mView->goToday();
354#endif 356#endif
355 QWidget::showMaximized () ; 357 QWidget::showMaximized () ;
356 mClosed = false; 358 mClosed = false;
357} 359}
358void MainWindow::closeEvent( QCloseEvent* ce ) 360void MainWindow::closeEvent( QCloseEvent* ce )
359{ 361{
360 362
361 363
362 364
363 if ( ! KOPrefs::instance()->mAskForQuit ) { 365 if ( ! KOPrefs::instance()->mAskForQuit ) {
364 saveOnClose(); 366 saveOnClose();
365 mClosed = true; 367 mClosed = true;
366 ce->accept(); 368 ce->accept();
367 return; 369 return;
368 370
369 } 371 }
370 372
371 switch( QMessageBox::information( this, "KO/Pi", 373 switch( QMessageBox::information( this, "KO/Pi",
372 i18n("Do you really want\nto close KO/Pi?"), 374 i18n("Do you really want\nto close KO/Pi?"),
373 i18n("Close"), i18n("No"), 375 i18n("Close"), i18n("No"),
374 0, 0 ) ) { 376 0, 0 ) ) {
375 case 0: 377 case 0:
376 saveOnClose(); 378 saveOnClose();
377 mClosed = true; 379 mClosed = true;
378 ce->accept(); 380 ce->accept();
379 break; 381 break;
380 case 1: 382 case 1:
381 ce->ignore(); 383 ce->ignore();
382 break; 384 break;
383 case 2: 385 case 2:
384 386
385 default: 387 default:
386 break; 388 break;
387 } 389 }
388 390
389 391
390} 392}
391 393
392void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 394void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
393{ 395{
394 QDataStream stream( data, IO_ReadOnly ); 396 QDataStream stream( data, IO_ReadOnly );
395 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 397 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
396 //QString datamess; 398 //QString datamess;
397 //qDebug("message "); 399 //qDebug("message ");
398 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 400 qDebug("KO: QCOP message received: %s ", cmsg.data() );
399 401
400 if ( cmsg == "setDocument(QString)" ) { 402 if ( cmsg == "setDocument(QString)" ) {
401 QDataStream stream( data, IO_ReadOnly ); 403 QDataStream stream( data, IO_ReadOnly );
402 QString fileName; 404 QString fileName;
403 stream >> fileName; 405 stream >> fileName;
404 //qDebug("filename %s ", fileName.latin1()); 406 //qDebug("filename %s ", fileName.latin1());
405 showMaximized(); 407 showMaximized();
406 raise(); 408 raise();
407 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 409 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
408 mSyncManager->slotSyncMenu( 1002 ); 410 mSyncManager->slotSyncMenu( 1002 );
409 return; 411 return;
410 } 412 }
411 413
412 if ( cmsg == "-writeFile" ) { 414 if ( cmsg == "-writeFile" ) {
413 // I made from the "-writeFile" an "-writeAlarm" 415 // I made from the "-writeFile" an "-writeAlarm"
414 mView->viewManager()->showWhatsNextView(); 416 mView->viewManager()->showWhatsNextView();
415 mCalendar->checkAlarmForIncidence( 0, true); 417 mCalendar->checkAlarmForIncidence( 0, true);
416 showMaximized(); 418 showMaximized();
417 raise(); 419 raise();
418 return; 420 return;
419 421
420 } 422 }
421 if ( cmsg == "-writeFileSilent" ) { 423 if ( cmsg == "-writeFileSilent" ) {
422 // I made from the "-writeFile" an "-writeAlarm" 424 // I made from the "-writeFile" an "-writeAlarm"
423 // mView->viewManager()->showWhatsNextView(); 425 // mView->viewManager()->showWhatsNextView();
424 mCalendar->checkAlarmForIncidence( 0, true); 426 mCalendar->checkAlarmForIncidence( 0, true);
425 //showMaximized(); 427 //showMaximized();
426 //raise(); 428 //raise();
427 hide(); 429 hide();
428 return; 430 return;
429 } 431 }
430 if ( cmsg == "-newCountdown" ) { 432 if ( cmsg == "-newCountdown" ) {
431 qDebug("newCountdown "); 433 qDebug("newCountdown ");
432 434
433 } 435 }
434 QString msg ; 436 QString msg ;
435 QString allmsg = cmsg; 437 QString allmsg = cmsg;
436 while ( allmsg.length() > 0 ) { 438 while ( allmsg.length() > 0 ) {
437 int nextC = allmsg.find( "-", 1 ); 439 int nextC = allmsg.find( "-", 1 );
438 if ( nextC == -1 ) { 440 if ( nextC == -1 ) {
439 msg = allmsg; 441 msg = allmsg;
440 allmsg = ""; 442 allmsg = "";
441 } else{ 443 } else{
442 msg = allmsg.left( nextC ); 444 msg = allmsg.left( nextC );
443 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 445 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
444 } 446 }
445 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 447 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
446 if ( msg == "-newEvent" ) { 448 if ( msg == "-newEvent" ) {
447 mView->newEvent(); 449 mView->newEvent();
448 } 450 }
449 if ( msg == "-newTodo" ) { 451 if ( msg == "-newTodo" ) {
450 mView->newTodo(); 452 mView->newTodo();
451 453
452 } 454 }
453 if ( msg == "-showWN" ) { 455 if ( msg == "-showWN" ) {
454 mView->viewManager()->showWhatsNextView(); 456 mView->viewManager()->showWhatsNextView();
455 } 457 }
456 if ( msg == "-showTodo" ) { 458 if ( msg == "-showTodo" ) {
457 mView->viewManager()->showTodoView(); 459 mView->viewManager()->showTodoView();
458 } 460 }
459 if ( msg == "-showList" ) { 461 if ( msg == "-showList" ) {
460 mView->viewManager()->showListView(); 462 mView->viewManager()->showListView();
461 } 463 }
462 else if ( msg == "-showDay" ) { 464 else if ( msg == "-showDay" ) {
463 mView->viewManager()->showDayView(); 465 mView->viewManager()->showDayView();
464 } 466 }
465 else if ( msg == "-showWWeek" ) { 467 else if ( msg == "-showWWeek" ) {
466 mView->viewManager()->showWorkWeekView(); 468 mView->viewManager()->showWorkWeekView();
467 } 469 }
468 else if ( msg == "-ringSync" ) { 470 else if ( msg == "-ringSync" ) {
469 mSyncManager->multiSync( false ); 471 mSyncManager->multiSync( false );
470 } 472 }
471 else if ( msg == "-showWeek" ) { 473 else if ( msg == "-showWeek" ) {
472 mView->viewManager()->showWeekView(); 474 mView->viewManager()->showWeekView();
473 } 475 }
474 else if ( msg == "-showTodo" ) { 476 else if ( msg == "-showTodo" ) {
475 mView->viewManager()->showTodoView(); 477 mView->viewManager()->showTodoView();
476 } 478 }
477 else if ( msg == "-showJournal" ) { 479 else if ( msg == "-showJournal" ) {
478 mView->dateNavigator()->selectDates( 1 ); 480 mView->dateNavigator()->selectDates( 1 );
479 mView->dateNavigator()->selectToday(); 481 mView->dateNavigator()->selectToday();
480 mView->viewManager()->showJournalView(); 482 mView->viewManager()->showJournalView();
481 } 483 }
482 else if ( msg == "-showKO" ) { 484 else if ( msg == "-showKO" ) {
483 mView->viewManager()->showNextXView(); 485 mView->viewManager()->showNextXView();
484 } 486 }
485 else if ( msg == "-showWNext" || msg == "nextView()" ) { 487 else if ( msg == "-showWNext" || msg == "nextView()" ) {
486 mView->viewManager()->showWhatsNextView(); 488 mView->viewManager()->showWhatsNextView();
487 } 489 }
488 else if ( msg == "-showNextXView" ) { 490 else if ( msg == "-showNextXView" ) {
489 mView->viewManager()->showNextXView(); 491 mView->viewManager()->showNextXView();
490 } 492 }
491 493
492 494
493 } 495 }
494 496
495 showMaximized(); 497 showMaximized();
496 raise(); 498 raise();
497} 499}
498 500
499QPixmap MainWindow::loadPixmap( QString name ) 501QPixmap MainWindow::loadPixmap( QString name )
500{ 502{
501 return SmallIcon( name ); 503 return SmallIcon( name );
502 504
503} 505}
504void MainWindow::initActions() 506void MainWindow::initActions()
505{ 507{
506 //KOPrefs::instance()->mShowFullMenu 508 //KOPrefs::instance()->mShowFullMenu
507 iconToolBar->clear(); 509 iconToolBar->clear();
508 KOPrefs *p = KOPrefs::instance(); 510 KOPrefs *p = KOPrefs::instance();
509 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 511 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
510 512
511 QPopupMenu *viewMenu = new QPopupMenu( this ); 513 QPopupMenu *viewMenu = new QPopupMenu( this );
512 QPopupMenu *actionMenu = new QPopupMenu( this ); 514 QPopupMenu *actionMenu = new QPopupMenu( this );
513 QPopupMenu *importMenu = new QPopupMenu( this ); 515 QPopupMenu *importMenu = new QPopupMenu( this );
514 selectFilterMenu = new QPopupMenu( this ); 516 selectFilterMenu = new QPopupMenu( this );
515 selectFilterMenu->setCheckable( true ); 517 selectFilterMenu->setCheckable( true );
516 syncMenu = new QPopupMenu( this ); 518 syncMenu = new QPopupMenu( this );
517 configureAgendaMenu = new QPopupMenu( this ); 519 configureAgendaMenu = new QPopupMenu( this );
518 configureToolBarMenu = new QPopupMenu( this ); 520 configureToolBarMenu = new QPopupMenu( this );
519 QPopupMenu *helpMenu = new QPopupMenu( this ); 521 QPopupMenu *helpMenu = new QPopupMenu( this );
520 if ( KOPrefs::instance()->mShowFullMenu ) { 522 if ( KOPrefs::instance()->mShowFullMenu ) {
521 QMenuBar *menuBar1; 523 QMenuBar *menuBar1;
522 menuBar1 = menuBar(); 524 menuBar1 = menuBar();
523 menuBar1->insertItem( i18n("File"), importMenu ); 525 menuBar1->insertItem( i18n("File"), importMenu );
524 menuBar1->insertItem( i18n("View"), viewMenu ); 526 menuBar1->insertItem( i18n("View"), viewMenu );
525 menuBar1->insertItem( i18n("Actions"), actionMenu ); 527 menuBar1->insertItem( i18n("Actions"), actionMenu );
526#ifdef DESKTOP_VERSION 528#ifdef DESKTOP_VERSION
527 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 529 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
528 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 530 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
529#else 531#else
530 menuBar1->insertItem( i18n("Sync"), syncMenu ); 532 menuBar1->insertItem( i18n("Sync"), syncMenu );
531 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 533 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
532#endif 534#endif
533 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 535 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
534 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 536 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
535 menuBar1->insertItem( i18n("Help"), helpMenu ); 537 menuBar1->insertItem( i18n("Help"), helpMenu );
536 } else { 538 } else {
537 QPEMenuBar *menuBar1; 539 QPEMenuBar *menuBar1;
538 menuBar1 = new QPEMenuBar( iconToolBar ); 540 menuBar1 = new QPEMenuBar( iconToolBar );
539 QPopupMenu *menuBar = new QPopupMenu( this ); 541 QPopupMenu *menuBar = new QPopupMenu( this );
540 menuBar1->insertItem( i18n("ME"), menuBar); 542 menuBar1->insertItem( i18n("ME"), menuBar);
541 menuBar->insertItem( i18n("File"), importMenu ); 543 menuBar->insertItem( i18n("File"), importMenu );
542 menuBar->insertItem( i18n("View"), viewMenu ); 544 menuBar->insertItem( i18n("View"), viewMenu );
543 menuBar->insertItem( i18n("Actions"), actionMenu ); 545 menuBar->insertItem( i18n("Actions"), actionMenu );
544 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 546 menuBar->insertItem( i18n("Synchronize"), syncMenu );
545 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 547 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
546 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 548 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
547 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 549 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
548 menuBar->insertItem( i18n("Help"), helpMenu ); 550 menuBar->insertItem( i18n("Help"), helpMenu );
549 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 551 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
550 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 552 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
551 } 553 }
552 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 554 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
553 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 555 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
554 556
555 // ****************** 557 // ******************
556 QAction *action; 558 QAction *action;
557 QIconSet icon; 559 QIconSet icon;
558 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 560 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
559 configureToolBarMenu->setCheckable( true ); 561 configureToolBarMenu->setCheckable( true );
560 562
561 QString pathString = ""; 563 QString pathString = "";
562 if ( !p->mToolBarMiniIcons ) { 564 if ( !p->mToolBarMiniIcons ) {
563 if ( QApplication::desktop()->width() < 480 ) 565 if ( QApplication::desktop()->width() < 480 )
564 pathString += "icons16/"; 566 pathString += "icons16/";
565 } else 567 } else
566 pathString += "iconsmini/"; 568 pathString += "iconsmini/";
567 configureAgendaMenu->setCheckable( true ); 569 configureAgendaMenu->setCheckable( true );
568 int iii ; 570 int iii ;
569 for ( iii = 1;iii<= 10 ;++iii ){ 571 for ( iii = 1;iii<= 10 ;++iii ){
570 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 572 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
571 } 573 }
572 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 574 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
573 575
574 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 576 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
575 this, SLOT( showConfigureAgenda( ) ) ); 577 this, SLOT( showConfigureAgenda( ) ) );
576 578
577 icon = loadPixmap( pathString + "configure" ); 579 icon = loadPixmap( pathString + "configure" );
578 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 580 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
579 action->addTo( actionMenu ); 581 action->addTo( actionMenu );
580 connect( action, SIGNAL( activated() ), 582 connect( action, SIGNAL( activated() ),
581 mView, SLOT( edit_options() ) ); 583 mView, SLOT( edit_options() ) );
582 actionMenu->insertSeparator(); 584 actionMenu->insertSeparator();
583 585
584 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 586 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
585 action->addTo( actionMenu ); 587 action->addTo( actionMenu );
586 connect( action, SIGNAL( activated() ), 588 connect( action, SIGNAL( activated() ),
587 mView, SLOT( undo_delete() ) ); 589 mView, SLOT( undo_delete() ) );
588 actionMenu->insertSeparator(); 590 actionMenu->insertSeparator();
589 591
590 icon = loadPixmap( pathString + "newevent" ); 592 icon = loadPixmap( pathString + "newevent" );
591 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 593 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
592 configureToolBarMenu->insertSeparator(); 594 configureToolBarMenu->insertSeparator();
593 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 595 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
594 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 596 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
595 ne_action->addTo( actionMenu ); 597 ne_action->addTo( actionMenu );
596 connect( ne_action, SIGNAL( activated() ), 598 connect( ne_action, SIGNAL( activated() ),
597 mView, SLOT( newEvent() ) ); 599 mView, SLOT( newEvent() ) );
598 icon = loadPixmap( pathString + "newtodo" ); 600 icon = loadPixmap( pathString + "newtodo" );
599 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 601 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
600 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 602 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
601 nt_action->addTo( actionMenu ); 603 nt_action->addTo( actionMenu );
602 connect( nt_action, SIGNAL( activated() ), 604 connect( nt_action, SIGNAL( activated() ),
603 mView, SLOT( newTodo() ) ); 605 mView, SLOT( newTodo() ) );
604 606
605 icon = loadPixmap( pathString + "today" ); 607 icon = loadPixmap( pathString + "today" );
606 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 608 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
607 today_action->addTo( viewMenu ); 609 today_action->addTo( viewMenu );
608 connect( today_action, SIGNAL( activated() ), 610 connect( today_action, SIGNAL( activated() ),
609 mView, SLOT( goToday() ) ); 611 mView, SLOT( goToday() ) );
610 viewMenu->insertSeparator(); 612 viewMenu->insertSeparator();
611 613
612 icon = loadPixmap( pathString + "navi" ); 614 icon = loadPixmap( pathString + "navi" );
613 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 615 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
614 action->addTo( viewMenu ); 616 action->addTo( viewMenu );
615 connect( action, SIGNAL( activated() ), 617 connect( action, SIGNAL( activated() ),
616 mView, SLOT( toggleDateNavigatorWidget() ) ); 618 mView, SLOT( toggleDateNavigatorWidget() ) );
617 mToggleNav = action ; 619 mToggleNav = action ;
618 icon = loadPixmap( pathString + "filter" ); 620 icon = loadPixmap( pathString + "filter" );
619 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 621 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
620 action->addTo( viewMenu ); 622 action->addTo( viewMenu );
621 connect( action, SIGNAL( activated() ), 623 connect( action, SIGNAL( activated() ),
622 mView, SLOT( toggleFilter() ) ); 624 mView, SLOT( toggleFilter() ) );
623 mToggleFilter = action; 625 mToggleFilter = action;
624 icon = loadPixmap( pathString + "allday" ); 626 icon = loadPixmap( pathString + "allday" );
625 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 627 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
626 action->addTo( viewMenu ); 628 action->addTo( viewMenu );
627 connect( action, SIGNAL( activated() ), 629 connect( action, SIGNAL( activated() ),
628 mView, SLOT( toggleAllDaySize() ) ); 630 mView, SLOT( toggleAllDaySize() ) );
629 mToggleAllday = action; 631 mToggleAllday = action;
630 632
631 633
632 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 634 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
633 mToggleNav, SLOT( setEnabled ( bool ) ) ); 635 mToggleNav, SLOT( setEnabled ( bool ) ) );
634 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 636 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
635 mToggleFilter, SLOT( setEnabled ( bool ) ) ); 637 mToggleFilter, SLOT( setEnabled ( bool ) ) );
636 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 638 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
637 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 639 mToggleAllday, SLOT( setEnabled ( bool ) ) );
638 640
639 viewMenu->insertSeparator(); 641 viewMenu->insertSeparator();
640 icon = loadPixmap( pathString + "picker" ); 642 icon = loadPixmap( pathString + "picker" );
641 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 643 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
642 action->addTo( viewMenu ); 644 action->addTo( viewMenu );
643 connect( action, SIGNAL( activated() ), 645 connect( action, SIGNAL( activated() ),
644 mView, SLOT( showDatePicker() ) ); 646 mView, SLOT( showDatePicker() ) );
645 action->addTo( iconToolBar ); 647 action->addTo( iconToolBar );
646 viewMenu->insertSeparator(); 648 viewMenu->insertSeparator();
647 icon = loadPixmap( pathString + "list" ); 649 icon = loadPixmap( pathString + "list" );
648 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 650 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
649 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 651 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
650 showlist_action->addTo( viewMenu ); 652 showlist_action->addTo( viewMenu );
651 connect( showlist_action, SIGNAL( activated() ), 653 connect( showlist_action, SIGNAL( activated() ),
652 mView->viewManager(), SLOT( showListView() ) ); 654 mView->viewManager(), SLOT( showListView() ) );
653 655
654 656
655 icon = loadPixmap( pathString + "day" ); 657 icon = loadPixmap( pathString + "day" );
656 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 658 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
657 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 659 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
658 day1_action->addTo( viewMenu ); 660 day1_action->addTo( viewMenu );
659 // action->addTo( toolBar ); 661 // action->addTo( toolBar );
660 connect( day1_action, SIGNAL( activated() ), 662 connect( day1_action, SIGNAL( activated() ),
661 mView->viewManager(), SLOT( showDayView() ) ); 663 mView->viewManager(), SLOT( showDayView() ) );
662 664
663 icon = loadPixmap( pathString + "workweek" ); 665 icon = loadPixmap( pathString + "workweek" );
664 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 666 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
665 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 667 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
666 day5_action->addTo( viewMenu ); 668 day5_action->addTo( viewMenu );
667 connect( day5_action, SIGNAL( activated() ), 669 connect( day5_action, SIGNAL( activated() ),
668 mView->viewManager(), SLOT( showWorkWeekView() ) ); 670 mView->viewManager(), SLOT( showWorkWeekView() ) );
669 671
670 icon = loadPixmap( pathString + "week" ); 672 icon = loadPixmap( pathString + "week" );
671 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 673 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
672 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 674 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
673 day7_action->addTo( viewMenu ); 675 day7_action->addTo( viewMenu );
674 connect( day7_action, SIGNAL( activated() ), 676 connect( day7_action, SIGNAL( activated() ),
675 mView->viewManager(), SLOT( showWeekView() ) ); 677 mView->viewManager(), SLOT( showWeekView() ) );
676 678
677 icon = loadPixmap( pathString + "month" ); 679 icon = loadPixmap( pathString + "month" );
678 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 680 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
679 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 681 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
680 month_action->addTo( viewMenu ); 682 month_action->addTo( viewMenu );
681 connect( month_action, SIGNAL( activated() ), 683 connect( month_action, SIGNAL( activated() ),
682 mView->viewManager(), SLOT( showMonthView() ) ); 684 mView->viewManager(), SLOT( showMonthView() ) );
683 685
684 icon = loadPixmap( pathString + "todo" ); 686 icon = loadPixmap( pathString + "todo" );
685 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 687 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
686 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 688 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
687 todoview_action->addTo( viewMenu ); 689 todoview_action->addTo( viewMenu );
688 connect( todoview_action, SIGNAL( activated() ), 690 connect( todoview_action, SIGNAL( activated() ),
689 mView->viewManager(), SLOT( showTodoView() ) ); 691 mView->viewManager(), SLOT( showTodoView() ) );
690 692
691 icon = loadPixmap( pathString + "journal" ); 693 icon = loadPixmap( pathString + "journal" );
692 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 694 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
693 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 695 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
694 viewjournal_action->addTo( viewMenu ); 696 viewjournal_action->addTo( viewMenu );
695 connect( viewjournal_action, SIGNAL( activated() ), 697 connect( viewjournal_action, SIGNAL( activated() ),
696 mView->viewManager(), SLOT( showJournalView() ) ); 698 mView->viewManager(), SLOT( showJournalView() ) );
697 699
698 icon = loadPixmap( pathString + "xdays" ); 700 icon = loadPixmap( pathString + "xdays" );
699 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 701 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
700 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 702 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
701 xdays_action->addTo( viewMenu ); 703 xdays_action->addTo( viewMenu );
702 connect( xdays_action, SIGNAL( activated() ), 704 connect( xdays_action, SIGNAL( activated() ),
703 mView->viewManager(), SLOT( showNextXView() ) ); 705 mView->viewManager(), SLOT( showNextXView() ) );
704 706
705 icon = loadPixmap( pathString + "whatsnext" ); 707 icon = loadPixmap( pathString + "whatsnext" );
706 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 708 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
707 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 709 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
708 whatsnext_action->addTo( viewMenu ); 710 whatsnext_action->addTo( viewMenu );
709 connect( whatsnext_action, SIGNAL( activated() ), 711 connect( whatsnext_action, SIGNAL( activated() ),
710 mView->viewManager(), SLOT( showWhatsNextView() ) ); 712 mView->viewManager(), SLOT( showWhatsNextView() ) );
711 713
712#if 0 714#if 0
713 action = new QAction( "view_timespan", "Time Span", 0, this ); 715 action = new QAction( "view_timespan", "Time Span", 0, this );
714 action->addTo( viewMenu ); 716 action->addTo( viewMenu );
715 connect( action, SIGNAL( activated() ), 717 connect( action, SIGNAL( activated() ),
716 mView->viewManager(), SLOT( showTimeSpanView() ) ); 718 mView->viewManager(), SLOT( showTimeSpanView() ) );
717#endif 719#endif
718 720
719 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 721 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
720 this ); 722 this );
721 mNewSubTodoAction->addTo( actionMenu ); 723 mNewSubTodoAction->addTo( actionMenu );
722 connect( mNewSubTodoAction, SIGNAL( activated() ), 724 connect( mNewSubTodoAction, SIGNAL( activated() ),
723 mView, SLOT( newSubTodo() ) ); 725 mView, SLOT( newSubTodo() ) );
724 726
725 actionMenu->insertSeparator(); 727 actionMenu->insertSeparator();
726 728
727 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 729 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
728 mShowAction->addTo( actionMenu ); 730 mShowAction->addTo( actionMenu );
729 connect( mShowAction, SIGNAL( activated() ), 731 connect( mShowAction, SIGNAL( activated() ),
730 mView, SLOT( showIncidence() ) ); 732 mView, SLOT( showIncidence() ) );
731 733
732 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 734 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
733 mEditAction->addTo( actionMenu ); 735 mEditAction->addTo( actionMenu );
734 connect( mEditAction, SIGNAL( activated() ), 736 connect( mEditAction, SIGNAL( activated() ),
735 mView, SLOT( editIncidence() ) ); 737 mView, SLOT( editIncidence() ) );
736 738
737 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 739 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
738 mDeleteAction->addTo( actionMenu ); 740 mDeleteAction->addTo( actionMenu );
739 connect( mDeleteAction, SIGNAL( activated() ), 741 connect( mDeleteAction, SIGNAL( activated() ),
740 mView, SLOT( deleteIncidence() ) ); 742 mView, SLOT( deleteIncidence() ) );
741 743
742 744
743 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 745 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
744 mCloneAction->addTo( actionMenu ); 746 mCloneAction->addTo( actionMenu );
745 connect( mCloneAction, SIGNAL( activated() ), 747 connect( mCloneAction, SIGNAL( activated() ),
746 mView, SLOT( cloneIncidence() ) ); 748 mView, SLOT( cloneIncidence() ) );
747 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 749 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
748 mMoveAction->addTo( actionMenu ); 750 mMoveAction->addTo( actionMenu );
749 connect( mMoveAction, SIGNAL( activated() ), 751 connect( mMoveAction, SIGNAL( activated() ),
750 mView, SLOT( moveIncidence() ) ); 752 mView, SLOT( moveIncidence() ) );
751 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 753 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
752 mBeamAction->addTo( actionMenu ); 754 mBeamAction->addTo( actionMenu );
753 connect( mBeamAction, SIGNAL( activated() ), 755 connect( mBeamAction, SIGNAL( activated() ),
754 mView, SLOT( beamIncidence() ) ); 756 mView, SLOT( beamIncidence() ) );
755 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 757 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
756 mCancelAction->addTo( actionMenu ); 758 mCancelAction->addTo( actionMenu );
757 connect( mCancelAction, SIGNAL( activated() ), 759 connect( mCancelAction, SIGNAL( activated() ),
758 mView, SLOT( toggleCancelIncidence() ) ); 760 mView, SLOT( toggleCancelIncidence() ) );
759 761
760 actionMenu->insertSeparator(); 762 actionMenu->insertSeparator();
761 763
762 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 764 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
763 this ); 765 this );
764 action->addTo( actionMenu ); 766 action->addTo( actionMenu );
765 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 767 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
766 768
767 icon = loadPixmap( pathString + "search" ); 769 icon = loadPixmap( pathString + "search" );
768 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 770 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
769 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 771 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
770 search_action->addTo( actionMenu ); 772 search_action->addTo( actionMenu );
771 connect( search_action, SIGNAL( activated() ), 773 connect( search_action, SIGNAL( activated() ),
772 mView->dialogManager(), SLOT( showSearchDialog() ) ); 774 mView->dialogManager(), SLOT( showSearchDialog() ) );
773 775
774 776
775 777
776 if ( KOPrefs::instance()->mShowFullMenu ) { 778 if ( KOPrefs::instance()->mShowFullMenu ) {
777 actionMenu->insertSeparator(); 779 actionMenu->insertSeparator();
778 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 780 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
779 781
780 } 782 }
781 // actionMenu->insertSeparator(); 783 // actionMenu->insertSeparator();
782 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 784 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
783 this ); 785 this );
784 action->addTo( importMenu ); 786 action->addTo( importMenu );
785 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 787 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
786 action = new QAction( "import_quick", i18n("Import last file"), 0, 788 action = new QAction( "import_quick", i18n("Import last file"), 0,
787 this ); 789 this );
788 action->addTo( importMenu ); 790 action->addTo( importMenu );
789 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 791 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
790 importMenu->insertSeparator(); 792 importMenu->insertSeparator();
791 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 793 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
792 this ); 794 this );
793 action->addTo( importMenu ); 795 action->addTo( importMenu );
794 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 796 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
795#ifndef DESKTOP_VERSION 797#ifndef DESKTOP_VERSION
796 importMenu->insertSeparator(); 798 importMenu->insertSeparator();
797 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 799 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
798 this ); 800 this );
799 action->addTo( importMenu ); 801 action->addTo( importMenu );
800 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 802 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
801#else 803#else
802#ifdef _OL_IMPORT_ 804#ifdef _OL_IMPORT_
803 importMenu->insertSeparator(); 805 importMenu->insertSeparator();
804 action = new QAction( "import_ol", i18n("Import from OL"), 0, 806 action = new QAction( "import_ol", i18n("Import from OL"), 0,
805 this ); 807 this );
806 action->addTo( importMenu ); 808 action->addTo( importMenu );
807 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 809 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
808#endif 810#endif
809#endif 811#endif
810 812
811 importMenu->insertSeparator(); 813 importMenu->insertSeparator();
812 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 814 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
813 this ); 815 this );
814 action->addTo( importMenu ); 816 action->addTo( importMenu );
815 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 817 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
816 818
817 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 819 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
818 this ); 820 this );
819 action->addTo( importMenu ); 821 action->addTo( importMenu );
820 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 822 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
821 823
822 importMenu->insertSeparator(); 824 importMenu->insertSeparator();
823 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 825 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
824 this ); 826 this );
825 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 827 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
826 828
827 829
828 //LR 830 //LR
829 QPopupMenu *ex2phone = new QPopupMenu( this ); 831 QPopupMenu *ex2phone = new QPopupMenu( this );
830 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 832 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
831 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 833 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
832 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 834 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
833 importMenu->insertItem( i18n("Export to phone"), ex2phone ); 835 importMenu->insertItem( i18n("Export to phone"), ex2phone );
834 836
835 importMenu->insertSeparator(); 837 importMenu->insertSeparator();
836 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 838 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
837 this ); 839 this );
838 action->addTo( importMenu ); 840 action->addTo( importMenu );
839 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 841 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
840#ifndef DESKTOP_VERSION 842#ifndef DESKTOP_VERSION
841 importMenu->insertSeparator(); 843 importMenu->insertSeparator();
842 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 844 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
843 this ); 845 this );
844 brAction->addTo( importMenu ); 846 brAction->addTo( importMenu );
845 brAction->setToggleAction (true ) ; 847 brAction->setToggleAction (true ) ;
846 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 848 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
847 849
848 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 850 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
849 this ); 851 this );
850 action->addTo( importMenu ); 852 action->addTo( importMenu );
851 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 853 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
852 854
853 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 855 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
854 this ); 856 this );
855 action->addTo( importMenu ); 857 action->addTo( importMenu );
856 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 858 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
857#else 859#else
858 importMenu->insertSeparator(); 860 importMenu->insertSeparator();
859 icon = loadPixmap( pathString + "print" ); 861 icon = loadPixmap( pathString + "print" );
860 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 862 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
861 action->addTo( importMenu ); 863 action->addTo( importMenu );
862 connect( action, SIGNAL( activated() ), 864 connect( action, SIGNAL( activated() ),
863 this, SLOT( printCal() ) ); 865 this, SLOT( printCal() ) );
864 866
865 icon = loadPixmap( pathString + "print" ); 867 icon = loadPixmap( pathString + "print" );
866 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 868 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
867 action->addTo( importMenu ); 869 action->addTo( importMenu );
868 connect( action, SIGNAL( activated() ), 870 connect( action, SIGNAL( activated() ),
869 this, SLOT( printSel() ) ); 871 this, SLOT( printSel() ) );
870 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 872 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
871 action->addTo( importMenu ); 873 action->addTo( importMenu );
872 connect( action, SIGNAL( activated() ), 874 connect( action, SIGNAL( activated() ),
873 mView->viewManager(), SIGNAL( printWNV() ) ); 875 mView->viewManager(), SIGNAL( printWNV() ) );
874#endif 876#endif
875 importMenu->insertSeparator(); 877 importMenu->insertSeparator();
876 action = new QAction( "beam all", i18n("Save"), 0, 878 action = new QAction( "beam all", i18n("Save"), 0,
877 this ); 879 this );
878 action->addTo( importMenu ); 880 action->addTo( importMenu );
879 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 881 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
880 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 882 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
881 this ); 883 this );
882 action->addTo( importMenu ); 884 action->addTo( importMenu );
883 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 885 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
884 886
885 //menuBar->insertItem( "Configure",configureMenu ); 887 //menuBar->insertItem( "Configure",configureMenu );
886 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 888 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
887 icon = loadPixmap( "korganizer/korganizer" ); 889 icon = loadPixmap( "korganizer/korganizer" );
888 890
889 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 891 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
890 action->addTo( helpMenu ); 892 action->addTo( helpMenu );
891 connect( action, SIGNAL( activated() ), 893 connect( action, SIGNAL( activated() ),
892 SLOT( whatsNew() ) ); 894 SLOT( whatsNew() ) );
893 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 895 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
894 action->addTo( helpMenu ); 896 action->addTo( helpMenu );
895 connect( action, SIGNAL( activated() ), 897 connect( action, SIGNAL( activated() ),
896 SLOT( features() ) ); 898 SLOT( features() ) );
897 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 899 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
898 action->addTo( helpMenu ); 900 action->addTo( helpMenu );
899 connect( action, SIGNAL( activated() ), 901 connect( action, SIGNAL( activated() ),
900 SLOT( keyBindings() ) ); 902 SLOT( keyBindings() ) );
901 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 903 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
902 action->addTo( helpMenu ); 904 action->addTo( helpMenu );
903 connect( action, SIGNAL( activated() ), 905 connect( action, SIGNAL( activated() ),
904 SLOT( synchowto() ) ); 906 SLOT( synchowto() ) );
905 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 907 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
906 action->addTo( helpMenu ); 908 action->addTo( helpMenu );
907 connect( action, SIGNAL( activated() ), 909 connect( action, SIGNAL( activated() ),
908 SLOT( kdesynchowto() ) ); 910 SLOT( kdesynchowto() ) );
909 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 911 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
910 action->addTo( helpMenu ); 912 action->addTo( helpMenu );
911 connect( action, SIGNAL( activated() ), 913 connect( action, SIGNAL( activated() ),
912 SLOT( multisynchowto() ) ); 914 SLOT( multisynchowto() ) );
913 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 915 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
914 action->addTo( helpMenu ); 916 action->addTo( helpMenu );
915 connect( action, SIGNAL( activated() ), 917 connect( action, SIGNAL( activated() ),
916 SLOT( aboutAutoSaving() ) ); 918 SLOT( aboutAutoSaving() ) );
917 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 919 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
918 action->addTo( helpMenu ); 920 action->addTo( helpMenu );
919 connect( action, SIGNAL( activated() ), 921 connect( action, SIGNAL( activated() ),
920 SLOT( aboutKnownBugs() ) ); 922 SLOT( aboutKnownBugs() ) );
921 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 923 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
922 action->addTo( helpMenu ); 924 action->addTo( helpMenu );
923 connect( action, SIGNAL( activated() ), 925 connect( action, SIGNAL( activated() ),
924 SLOT( usertrans() ) ); 926 SLOT( usertrans() ) );
925 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 927 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
926 action->addTo( helpMenu ); 928 action->addTo( helpMenu );
927 connect( action, SIGNAL( activated() ), 929 connect( action, SIGNAL( activated() ),
928 SLOT( faq() ) ); 930 SLOT( faq() ) );
929 action = new QAction( "licence", i18n("Licence..."), 0, this ); 931 action = new QAction( "licence", i18n("Licence..."), 0, this );
930 action->addTo( helpMenu ); 932 action->addTo( helpMenu );
931 connect( action, SIGNAL( activated() ), 933 connect( action, SIGNAL( activated() ),
932 SLOT( licence() ) ); 934 SLOT( licence() ) );
933 action = new QAction( "about", i18n("About..."), 0, this ); 935 action = new QAction( "about", i18n("About..."), 0, this );
934 action->addTo( helpMenu ); 936 action->addTo( helpMenu );
935 connect( action, SIGNAL( activated() ), 937 connect( action, SIGNAL( activated() ),
936 SLOT( about() ) ); 938 SLOT( about() ) );
937 //menuBar->insertSeparator(); 939 //menuBar->insertSeparator();
938 940
939 // ****************************************************** 941 // ******************************************************
940 // menubar icons 942 // menubar icons
941 943
942 944
943 iconToolBar->setHorizontalStretchable (true ); 945 iconToolBar->setHorizontalStretchable (true );
944 //menuBar->insertItem( iconToolBar ); 946 //menuBar->insertItem( iconToolBar );
945 //xdays_action 947 //xdays_action
946 if (p-> mShowIconNewEvent) 948 if (p-> mShowIconNewEvent)
947 ne_action->addTo( iconToolBar ); 949 ne_action->addTo( iconToolBar );
948 if (p->mShowIconNewTodo ) 950 if (p->mShowIconNewTodo )
949 nt_action->addTo( iconToolBar ); 951 nt_action->addTo( iconToolBar );
950 if (p-> mShowIconSearch) 952 if (p-> mShowIconSearch)
951 search_action->addTo( iconToolBar ); 953 search_action->addTo( iconToolBar );
952 if (p-> mShowIconNext) 954 if (p-> mShowIconNext)
953 whatsnext_action->addTo( iconToolBar ); 955 whatsnext_action->addTo( iconToolBar );
954 if (p-> mShowIconNextDays) 956 if (p-> mShowIconNextDays)
955 xdays_action->addTo( iconToolBar ); 957 xdays_action->addTo( iconToolBar );
956 if (p-> mShowIconList) 958 if (p-> mShowIconList)
957 showlist_action->addTo( iconToolBar ); 959 showlist_action->addTo( iconToolBar );
958 if (p-> mShowIconDay1) 960 if (p-> mShowIconDay1)
959 day1_action->addTo( iconToolBar ); 961 day1_action->addTo( iconToolBar );
960 if (p-> mShowIconDay5) 962 if (p-> mShowIconDay5)
961 day5_action->addTo( iconToolBar ); 963 day5_action->addTo( iconToolBar );
962 if (p-> mShowIconDay7) 964 if (p-> mShowIconDay7)
963 day7_action->addTo( iconToolBar ); 965 day7_action->addTo( iconToolBar );
964 if (p-> mShowIconMonth) 966 if (p-> mShowIconMonth)
965 month_action->addTo( iconToolBar ); 967 month_action->addTo( iconToolBar );
966 if (p-> mShowIconTodoview) 968 if (p-> mShowIconTodoview)
967 todoview_action->addTo( iconToolBar ); 969 todoview_action->addTo( iconToolBar );
968 if (p-> mShowIconJournal) 970 if (p-> mShowIconJournal)
969 viewjournal_action->addTo( iconToolBar ); 971 viewjournal_action->addTo( iconToolBar );
970 icon = loadPixmap( pathString + "2leftarrowB" ); 972 icon = loadPixmap( pathString + "2leftarrowB" );
971 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 973 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
972 if (p-> mShowIconBackFast) { 974 if (p-> mShowIconBackFast) {
973 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 975 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
974 connect( action, SIGNAL( activated() ), 976 connect( action, SIGNAL( activated() ),
975 mView, SLOT( goPreviousMonth() ) ); 977 mView, SLOT( goPreviousMonth() ) );
976 action->addTo( iconToolBar ); 978 action->addTo( iconToolBar );
977 } 979 }
978 icon = loadPixmap( pathString + "1leftarrowB" ); 980 icon = loadPixmap( pathString + "1leftarrowB" );
979 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 981 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
980 if (p-> mShowIconBack) { 982 if (p-> mShowIconBack) {
981 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 983 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
982 connect( action, SIGNAL( activated() ), 984 connect( action, SIGNAL( activated() ),
983 mView, SLOT( goPrevious() ) ); 985 mView, SLOT( goPrevious() ) );
984 action->addTo( iconToolBar ); 986 action->addTo( iconToolBar );
985 } 987 }
986 icon = loadPixmap( pathString + "today" ); 988 icon = loadPixmap( pathString + "today" );
987 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 989 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
988 if (p-> mShowIconToday) 990 if (p-> mShowIconToday)
989 today_action->addTo( iconToolBar ); 991 today_action->addTo( iconToolBar );
990 icon = loadPixmap( pathString + "1rightarrowB" ); 992 icon = loadPixmap( pathString + "1rightarrowB" );
991 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 993 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
992 if (p-> mShowIconForward) { 994 if (p-> mShowIconForward) {
993 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 995 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
994 connect( action, SIGNAL( activated() ), 996 connect( action, SIGNAL( activated() ),
995 mView, SLOT( goNext() ) ); 997 mView, SLOT( goNext() ) );
996 action->addTo( iconToolBar ); 998 action->addTo( iconToolBar );
997 } 999 }
998 icon = loadPixmap( pathString + "2rightarrowB" ); 1000 icon = loadPixmap( pathString + "2rightarrowB" );
999 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1001 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1000 if (p-> mShowIconForwardFast) { 1002 if (p-> mShowIconForwardFast) {
1001 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1003 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1002 connect( action, SIGNAL( activated() ), 1004 connect( action, SIGNAL( activated() ),
1003 mView, SLOT( goNextMonth() ) ); 1005 mView, SLOT( goNextMonth() ) );
1004 action->addTo( iconToolBar ); 1006 action->addTo( iconToolBar );
1005 } 1007 }
1006 1008
1007 1009
1008 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 1010 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
1009 1011
1010 if (p-> mShowIconNewEvent) 1012 if (p-> mShowIconNewEvent)
1011 configureToolBarMenu->setItemChecked( 10, true ); 1013 configureToolBarMenu->setItemChecked( 10, true );
1012 if (p->mShowIconNewTodo ) 1014 if (p->mShowIconNewTodo )
1013 configureToolBarMenu->setItemChecked( 20, true ); 1015 configureToolBarMenu->setItemChecked( 20, true );
1014 if (p-> mShowIconSearch) 1016 if (p-> mShowIconSearch)
1015 configureToolBarMenu->setItemChecked( 120, true ); 1017 configureToolBarMenu->setItemChecked( 120, true );
1016 if (p-> mShowIconList) 1018 if (p-> mShowIconList)
1017 configureToolBarMenu->setItemChecked( 30, true ); 1019 configureToolBarMenu->setItemChecked( 30, true );
1018 if (p-> mShowIconDay1) 1020 if (p-> mShowIconDay1)
1019 configureToolBarMenu->setItemChecked( 40, true ); 1021 configureToolBarMenu->setItemChecked( 40, true );
1020 if (p-> mShowIconDay5) 1022 if (p-> mShowIconDay5)
1021 configureToolBarMenu->setItemChecked( 50, true ); 1023 configureToolBarMenu->setItemChecked( 50, true );
1022 if (p-> mShowIconDay7) 1024 if (p-> mShowIconDay7)
1023 configureToolBarMenu->setItemChecked( 60, true ); 1025 configureToolBarMenu->setItemChecked( 60, true );
1024 if (p-> mShowIconMonth) 1026 if (p-> mShowIconMonth)
1025 configureToolBarMenu->setItemChecked( 70, true ); 1027 configureToolBarMenu->setItemChecked( 70, true );
1026 if (p-> mShowIconTodoview) 1028 if (p-> mShowIconTodoview)
1027 configureToolBarMenu->setItemChecked( 80, true ); 1029 configureToolBarMenu->setItemChecked( 80, true );
1028 if (p-> mShowIconBackFast) 1030 if (p-> mShowIconBackFast)
1029 configureToolBarMenu->setItemChecked( 200, true ); 1031 configureToolBarMenu->setItemChecked( 200, true );
1030 if (p-> mShowIconBack) 1032 if (p-> mShowIconBack)
1031 configureToolBarMenu->setItemChecked( 210, true ); 1033 configureToolBarMenu->setItemChecked( 210, true );
1032 if (p-> mShowIconToday) 1034 if (p-> mShowIconToday)
1033 configureToolBarMenu->setItemChecked( 130, true ); 1035 configureToolBarMenu->setItemChecked( 130, true );
1034 if (p-> mShowIconForward) 1036 if (p-> mShowIconForward)
1035 configureToolBarMenu->setItemChecked( 220, true ); 1037 configureToolBarMenu->setItemChecked( 220, true );
1036 if (p-> mShowIconForwardFast) 1038 if (p-> mShowIconForwardFast)
1037 configureToolBarMenu->setItemChecked( 230, true ); 1039 configureToolBarMenu->setItemChecked( 230, true );
1038 if (p-> mShowIconNextDays) 1040 if (p-> mShowIconNextDays)
1039 configureToolBarMenu->setItemChecked( 100, true ); 1041 configureToolBarMenu->setItemChecked( 100, true );
1040 if (p-> mShowIconNext) 1042 if (p-> mShowIconNext)
1041 configureToolBarMenu->setItemChecked( 110, true ); 1043 configureToolBarMenu->setItemChecked( 110, true );
1042 if (p-> mShowIconJournal) 1044 if (p-> mShowIconJournal)
1043 configureToolBarMenu->setItemChecked( 90, true ); 1045 configureToolBarMenu->setItemChecked( 90, true );
1044 if (p-> mShowIconWhatsThis) 1046 if (p-> mShowIconWhatsThis)
1045 configureToolBarMenu->setItemChecked( 300, true ); 1047 configureToolBarMenu->setItemChecked( 300, true );
1046 1048
1047 QLabel* dummy = new QLabel( iconToolBar ); 1049 QLabel* dummy = new QLabel( iconToolBar );
1048 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1050 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1049 if (!p-> mShowIconStretch) 1051 if (!p-> mShowIconStretch)
1050 iconToolBar->setStretchableWidget ( dummy ) ; 1052 iconToolBar->setStretchableWidget ( dummy ) ;
1051 else 1053 else
1052 configureToolBarMenu->setItemChecked( 5, true ); 1054 configureToolBarMenu->setItemChecked( 5, true );
1053 if (p-> mShowIconWhatsThis) 1055 if (p-> mShowIconWhatsThis)
1054 QWhatsThis::whatsThisButton ( iconToolBar ); 1056 QWhatsThis::whatsThisButton ( iconToolBar );
1055 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1057 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1056 configureAgenda( p->mHourSize ); 1058 configureAgenda( p->mHourSize );
1057 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1059 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1058} 1060}
1059 1061
1060void MainWindow::exportToPhone( int mode ) 1062void MainWindow::exportToPhone( int mode )
1061{ 1063{
1062 1064
1063 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1065 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1064 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1066 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1065 KOex2phonePrefs ex2phone; 1067 KOex2phonePrefs ex2phone;
1066 1068
1067 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1069 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1068 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1070 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1069 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1071 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1070 if ( mode == 1 ) 1072 if ( mode == 1 )
1071 ex2phone.setCaption(i18n("Export complete calendar")); 1073 ex2phone.setCaption(i18n("Export complete calendar"));
1072 if ( mode == 2 ) 1074 if ( mode == 2 )
1073 ex2phone.setCaption(i18n("Export filtered calendar")); 1075 ex2phone.setCaption(i18n("Export filtered calendar"));
1074 1076
1075 if ( !ex2phone.exec() ) { 1077 if ( !ex2phone.exec() ) {
1076 return; 1078 return;
1077 } 1079 }
1078 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1080 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1079 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1081 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1080 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1082 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1081 1083
1082 int inFuture = 0; 1084 int inFuture = 0;
1083 if ( ex2phone.mWriteBackFuture->isChecked() ) 1085 if ( ex2phone.mWriteBackFuture->isChecked() )
1084 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1086 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1085 QPtrList<Incidence> delSel; 1087 QPtrList<Incidence> delSel;
1086 if ( mode == 1 ) 1088 if ( mode == 1 )
1087 delSel = mCalendar->rawIncidences(); 1089 delSel = mCalendar->rawIncidences();
1088 if ( mode == 2 ) 1090 if ( mode == 2 )
1089 delSel = mCalendar->incidences(); 1091 delSel = mCalendar->incidences();
1090 CalendarLocal* cal = new CalendarLocal(); 1092 CalendarLocal* cal = new CalendarLocal();
1091 cal->setLocalTime(); 1093 cal->setLocalTime();
1092 Incidence *incidence = delSel.first(); 1094 Incidence *incidence = delSel.first();
1093 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1095 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1094 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1096 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1095 while ( incidence ) { 1097 while ( incidence ) {
1096 if ( incidence->type() != "Journal" ) { 1098 if ( incidence->type() != "Journal" ) {
1097 bool add = true; 1099 bool add = true;
1098 if ( inFuture ) { 1100 if ( inFuture ) {
1099 QDateTime dt; 1101 QDateTime dt;
1100 if ( incidence->type() == "Todo" ) { 1102 if ( incidence->type() == "Todo" ) {
1101 Todo * t = (Todo*)incidence; 1103 Todo * t = (Todo*)incidence;
1102 if ( t->hasDueDate() ) 1104 if ( t->hasDueDate() )
1103 dt = t->dtDue(); 1105 dt = t->dtDue();
1104 else 1106 else
1105 dt = cur.addSecs( 62 ); 1107 dt = cur.addSecs( 62 );
1106 } 1108 }
1107 else { 1109 else {
1108 bool ok; 1110 bool ok;
1109 dt = incidence->getNextOccurence( cur, &ok ); 1111 dt = incidence->getNextOccurence( cur, &ok );
1110 if ( !ok ) 1112 if ( !ok )
1111 dt = cur.addSecs( -62 ); 1113 dt = cur.addSecs( -62 );
1112 } 1114 }
1113 if ( dt < cur || dt > end ) { 1115 if ( dt < cur || dt > end ) {
1114 add = false; 1116 add = false;
1115 } 1117 }
1116 } 1118 }
1117 if ( add ) { 1119 if ( add ) {
1118 Incidence *in = incidence->clone(); 1120 Incidence *in = incidence->clone();
1119 cal->addIncidence( in ); 1121 cal->addIncidence( in );
1120 } 1122 }
1121 } 1123 }
1122 incidence = delSel.next(); 1124 incidence = delSel.next();
1123 } 1125 }
1124 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1126 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1125 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1127 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1126 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1128 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1127 1129
1128 setCaption( i18n("Writing to phone...")); 1130 setCaption( i18n("Writing to phone..."));
1129 if ( PhoneFormat::writeToPhone( cal ) ) 1131 if ( PhoneFormat::writeToPhone( cal ) )
1130 setCaption( i18n("Export to phone successful!")); 1132 setCaption( i18n("Export to phone successful!"));
1131 else 1133 else
1132 setCaption( i18n("Error exporting to phone!")); 1134 setCaption( i18n("Error exporting to phone!"));
1133 delete cal; 1135 delete cal;
1134} 1136}
1135 1137
1136 1138
1137void MainWindow::setDefaultPreferences() 1139void MainWindow::setDefaultPreferences()
1138{ 1140{
1139 KOPrefs *p = KOPrefs::instance(); 1141 KOPrefs *p = KOPrefs::instance();
1140 1142
1141 p->mCompactDialogs = true; 1143 p->mCompactDialogs = true;
1142 p->mConfirm = true; 1144 p->mConfirm = true;
1143 // p->mEnableQuickTodo = false; 1145 // p->mEnableQuickTodo = false;
1144 1146
1145} 1147}
1146 1148
1147QString MainWindow::resourcePath() 1149QString MainWindow::resourcePath()
1148{ 1150{
1149 return KGlobal::iconLoader()->iconPath(); 1151 return KGlobal::iconLoader()->iconPath();
1150} 1152}
1151 1153
1152void MainWindow::displayText( QString text ,QString cap ) 1154void MainWindow::displayText( QString text ,QString cap )
1153{ 1155{
1154 QDialog dia( this, "name", true ); ; 1156 QDialog dia( this, "name", true ); ;
1155 dia.setCaption( cap ); 1157 dia.setCaption( cap );
1156 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1158 QVBoxLayout* lay = new QVBoxLayout( &dia );
1157 lay->setSpacing( 3 ); 1159 lay->setSpacing( 3 );
1158 lay->setMargin( 3 ); 1160 lay->setMargin( 3 );
1159 QTextBrowser tb ( &dia ); 1161 QTextBrowser tb ( &dia );
1160 lay->addWidget( &tb ); 1162 lay->addWidget( &tb );
1161 tb.setText( text ); 1163 tb.setText( text );
1162#ifdef DESKTOP_VERSION 1164#ifdef DESKTOP_VERSION
1163 dia.resize( 640, 480); 1165 dia.resize( 640, 480);
1164#else 1166#else
1165 dia.showMaximized(); 1167 dia.showMaximized();
1166#endif 1168#endif
1167 dia.exec(); 1169 dia.exec();
1168} 1170}
1169 1171
1170void MainWindow::features() 1172void MainWindow::features()
1171{ 1173{
1172 1174
1173 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1175 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1174} 1176}
1175 1177
1176void MainWindow::usertrans() 1178void MainWindow::usertrans()
1177{ 1179{
1178 1180
1179 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1181 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1180} 1182}
1181 1183
1182void MainWindow::kdesynchowto() 1184void MainWindow::kdesynchowto()
1183{ 1185{
1184 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1186 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1185} 1187}
1186void MainWindow::multisynchowto() 1188void MainWindow::multisynchowto()
1187{ 1189{
1188 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1190 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1189} 1191}
1190void MainWindow::synchowto() 1192void MainWindow::synchowto()
1191{ 1193{
1192 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1194 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1193} 1195}
1194void MainWindow::faq() 1196void MainWindow::faq()
1195{ 1197{
1196 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1198 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1197 1199
1198} 1200}
1199void MainWindow::whatsNew() 1201void MainWindow::whatsNew()
1200{ 1202{
1201 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1203 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1202 1204
1203} 1205}
1204void MainWindow::licence() 1206void MainWindow::licence()
1205{ 1207{
1206 KApplication::showLicence(); 1208 KApplication::showLicence();
1207 1209
1208} 1210}
1209void MainWindow::about() 1211void MainWindow::about()
1210{ 1212{
1211 QString version; 1213 QString version;
1212#include <../version> 1214#include <../version>
1213 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1215 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1214 i18n("KOrganizer/Platform-independent\n") + 1216 i18n("KOrganizer/Platform-independent\n") +
1215 "(KO/Pi) " + version + " - " + 1217 "(KO/Pi) " + version + " - " +
1216 1218
1217#ifdef DESKTOP_VERSION 1219#ifdef DESKTOP_VERSION
1218 i18n("Desktop Edition\n") + 1220 i18n("Desktop Edition\n") +
1219#else 1221#else
1220 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + 1222 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") +
1221#endif 1223#endif
1222 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); 1224 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") );
1223} 1225}
1224void MainWindow::keyBindings() 1226void MainWindow::keyBindings()
1225{ 1227{
1226 QString cap = i18n("KO/Pi Keys + Colors"); 1228 QString cap = i18n("KO/Pi Keys + Colors");
1227 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1229 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1228 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1230 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1229 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1231 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1230 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1232 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1231 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1233 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1232 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1234 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1233 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1235 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1234 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1236 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1235 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1237 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1236 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1238 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1237 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1239 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1238 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1240 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1239 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1241 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1240 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1242 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1241 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1243 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1242 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1244 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1243 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1245 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1244 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1246 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1245 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1247 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1246 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1248 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1247 i18n("<p><h3>In agenda view:</h3></p>\n") + 1249 i18n("<p><h3>In agenda view:</h3></p>\n") +
1248 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1250 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1249 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1251 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1250 i18n("<p><h3>In todo view:</h3></p>\n") + 1252 i18n("<p><h3>In todo view:</h3></p>\n") +
1251 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1253 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1252 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1254 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1253 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1255 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1254 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1256 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1255 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1257 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1256 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1258 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1257 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1259 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1258 i18n("<p><h3>In list view:</h3></p>\n") + 1260 i18n("<p><h3>In list view:</h3></p>\n") +
1259 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1261 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1260 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1262 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1261 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1263 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1262 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1264 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1263 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1265 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1264 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1266 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1265 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1267 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1266 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1268 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1267 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1269 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1268 i18n("<p><b>E</b>: Edit item</p>\n") + 1270 i18n("<p><b>E</b>: Edit item</p>\n") +
1269 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1271 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1270 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1272 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1271 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1273 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1272 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1274 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1273 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1275 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1274 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1276 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1275 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1277 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1276 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1278 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1277 i18n("<p><b>White</b>: Item readonly</p>\n"); 1279 i18n("<p><b>White</b>: Item readonly</p>\n");
1278 displayText( text, cap); 1280 displayText( text, cap);
1279} 1281}
1280void MainWindow::aboutAutoSaving() 1282void MainWindow::aboutAutoSaving()
1281{ 1283{
1282 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); 1284 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n");
1283 1285
1284 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1286 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1285 1287
1286} 1288}
1287void MainWindow::aboutKnownBugs() 1289void MainWindow::aboutKnownBugs()
1288{ 1290{
1289 QMessageBox* msg; 1291 QMessageBox* msg;
1290 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1292 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1291 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1293 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1292 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1294 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1293 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1295 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1294 i18n("\nor report them in the bugtracker on\n") + 1296 i18n("\nor report them in the bugtracker on\n") +
1295 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1297 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1296 QMessageBox::NoIcon, 1298 QMessageBox::NoIcon,
1297 QMessageBox::Ok, 1299 QMessageBox::Ok,
1298 QMessageBox::NoButton, 1300 QMessageBox::NoButton,
1299 QMessageBox::NoButton); 1301 QMessageBox::NoButton);
1300 msg->exec(); 1302 msg->exec();
1301 delete msg; 1303 delete msg;
1302 1304
1303} 1305}
1304 1306
1305QString MainWindow::defaultFileName() 1307QString MainWindow::defaultFileName()
1306{ 1308{
1307 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1309 return locateLocal( "data", "korganizer/mycalendar.ics" );
1308} 1310}
1309QString MainWindow::syncFileName() 1311QString MainWindow::syncFileName()
1310{ 1312{
1311#ifdef DESKTOP_VERSION 1313#ifdef DESKTOP_VERSION
1312 return locateLocal( "tmp", "synccalendar.ics" ); 1314 return locateLocal( "tmp", "synccalendar.ics" );
1313#else 1315#else
1314 return QString( "/tmp/synccalendar.ics" ); 1316 return QString( "/tmp/synccalendar.ics" );
1315#endif 1317#endif
1316} 1318}
1317 1319
1318void MainWindow::processIncidenceSelection( Incidence *incidence ) 1320void MainWindow::processIncidenceSelection( Incidence *incidence )
1319{ 1321{
1320 if ( !incidence ) { 1322 if ( !incidence ) {
1321 enableIncidenceActions( false ); 1323 enableIncidenceActions( false );
1322 1324
1323 mNewSubTodoAction->setEnabled( false ); 1325 mNewSubTodoAction->setEnabled( false );
1324 setCaptionToDates(); 1326 setCaptionToDates();
1325 return; 1327 return;
1326 1328
1327 } 1329 }
1328 1330
1329 //KGlobal::locale()->formatDateTime(nextA, true); 1331 //KGlobal::locale()->formatDateTime(nextA, true);
1330 QString startString = ""; 1332 QString startString = "";
1331 if ( incidence->type() != "Todo" ) { 1333 if ( incidence->type() != "Todo" ) {
1332 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1334 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1333 if ( incidence->doesFloat() ) { 1335 if ( incidence->doesFloat() ) {
1334 startString += ": "+incidence->dtStartDateStr( true ); 1336 startString += ": "+incidence->dtStartDateStr( true );
1335 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1337 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1336 1338
1337 } else { 1339 } else {
1338 startString = ": "+incidence->dtStartStr(true); 1340 startString = ": "+incidence->dtStartStr(true);
1339 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1341 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1340 1342
1341 } 1343 }
1342 1344
1343 } else { 1345 } else {
1344 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1346 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1345 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1347 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1346 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1348 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1347 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1349 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1348 } 1350 }
1349 1351
1350 } 1352 }
1351 else 1353 else
1352 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1354 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1353 if ( !incidence->location().isEmpty() ) 1355 if ( !incidence->location().isEmpty() )
1354 startString += " (" +incidence->location()+")"; 1356 startString += " (" +incidence->location()+")";
1355 setCaption( incidence->summary()+startString); 1357 setCaption( incidence->summary()+startString);
1356 1358
1357 enableIncidenceActions( true ); 1359 enableIncidenceActions( true );
1358 1360
1359 if ( incidence->type() == "Event" ) { 1361 if ( incidence->type() == "Event" ) {
1360 mShowAction->setText( i18n("Show Event...") ); 1362 mShowAction->setText( i18n("Show Event...") );
1361 mEditAction->setText( i18n("Edit Event...") ); 1363 mEditAction->setText( i18n("Edit Event...") );
1362 mDeleteAction->setText( i18n("Delete Event...") ); 1364 mDeleteAction->setText( i18n("Delete Event...") );
1363 1365
1364 mNewSubTodoAction->setEnabled( false ); 1366 mNewSubTodoAction->setEnabled( false );
1365 } else if ( incidence->type() == "Todo" ) { 1367 } else if ( incidence->type() == "Todo" ) {
1366 mShowAction->setText( i18n("Show Todo...") ); 1368 mShowAction->setText( i18n("Show Todo...") );
1367 mEditAction->setText( i18n("Edit Todo...") ); 1369 mEditAction->setText( i18n("Edit Todo...") );
1368 mDeleteAction->setText( i18n("Delete Todo...") ); 1370 mDeleteAction->setText( i18n("Delete Todo...") );
1369 1371
1370 mNewSubTodoAction->setEnabled( true ); 1372 mNewSubTodoAction->setEnabled( true );
1371 } else { 1373 } else {
1372 mShowAction->setText( i18n("Show...") ); 1374 mShowAction->setText( i18n("Show...") );
1373 mShowAction->setText( i18n("Edit...") ); 1375 mShowAction->setText( i18n("Edit...") );
1374 mShowAction->setText( i18n("Delete...") ); 1376 mShowAction->setText( i18n("Delete...") );
1375 1377
1376 mNewSubTodoAction->setEnabled( false ); 1378 mNewSubTodoAction->setEnabled( false );
1377 } 1379 }
1378} 1380}
1379 1381
1380void MainWindow::enableIncidenceActions( bool enabled ) 1382void MainWindow::enableIncidenceActions( bool enabled )
1381{ 1383{
1382 mShowAction->setEnabled( enabled ); 1384 mShowAction->setEnabled( enabled );
1383 mEditAction->setEnabled( enabled ); 1385 mEditAction->setEnabled( enabled );
1384 mDeleteAction->setEnabled( enabled ); 1386 mDeleteAction->setEnabled( enabled );
1385 1387
1386 mCloneAction->setEnabled( enabled ); 1388 mCloneAction->setEnabled( enabled );
1387 mMoveAction->setEnabled( enabled ); 1389 mMoveAction->setEnabled( enabled );
1388 mBeamAction->setEnabled( enabled ); 1390 mBeamAction->setEnabled( enabled );
1389 mCancelAction->setEnabled( enabled ); 1391 mCancelAction->setEnabled( enabled );
1390} 1392}
1391 1393
1392void MainWindow::importOL() 1394void MainWindow::importOL()
1393{ 1395{
1394#ifdef _OL_IMPORT_ 1396#ifdef _OL_IMPORT_
1395 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1397 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1396 id->exec(); 1398 id->exec();
1397 delete id; 1399 delete id;
1398 mView->updateView(); 1400 mView->updateView();
1399#endif 1401#endif
1400} 1402}
1401void MainWindow::importBday() 1403void MainWindow::importBday()
1402{ 1404{
1403 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1405 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1404 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1406 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1405 i18n("Import!"), i18n("Cancel"), 0, 1407 i18n("Import!"), i18n("Cancel"), 0,
1406 0, 1 ); 1408 0, 1 );
1407 if ( result == 0 ) { 1409 if ( result == 0 ) {
1408 mView->importBday(); 1410 mView->importBday();
1409 1411
1410 } 1412 }
1411 1413
1412 1414
1413} 1415}
1414void MainWindow::importQtopia() 1416void MainWindow::importQtopia()
1415{ 1417{
1416#ifndef DESKTOP_VERSION 1418#ifndef DESKTOP_VERSION
1417 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1419 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1418 i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), 1420 i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"),
1419 i18n("Import!"), i18n("Cancel"), 0, 1421 i18n("Import!"), i18n("Cancel"), 0,
1420 0, 1 ); 1422 0, 1 );
1421 if ( result == 0 ) { 1423 if ( result == 0 ) {
1422 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1424 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1423 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1425 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1424 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1426 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1425 mView->importQtopia( categories, datebook, todolist ); 1427 mView->importQtopia( categories, datebook, todolist );
1426 } 1428 }
1427#else 1429#else
1428 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1430 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1429 i18n("Not supported \non desktop!\n"), 1431 i18n("Not supported \non desktop!\n"),
1430 i18n("Ok"), i18n("Cancel"), 0, 1432 i18n("Ok"), i18n("Cancel"), 0,
1431 0, 1 ); 1433 0, 1 );
1432 1434
1433#endif 1435#endif
1434} 1436}
1435 1437
1436void MainWindow::saveOnClose() 1438void MainWindow::saveOnClose()
1437{ 1439{
1438 KOPrefs *p = KOPrefs::instance(); 1440 KOPrefs *p = KOPrefs::instance();
1439 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1441 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1440 p->mToolBarUp = iconToolBar->x() > width()/2 || 1442 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1441 iconToolBar->y() > height()/2; 1443 iconToolBar->y() > height()/2;
1442 mView->writeSettings(); 1444 mView->writeSettings();
1443 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1445 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1444 save(); 1446 save();
1445} 1447}
1446void MainWindow::slotModifiedChanged( bool changed ) 1448void MainWindow::slotModifiedChanged( bool changed )
1447{ 1449{
1448 if ( mBlockAtStartup ) 1450 if ( mBlockAtStartup )
1449 return; 1451 return;
1452
1450 int msec; 1453 int msec;
1451 // we store the changes after 1 minute, 1454 // we store the changes after 1 minute,
1452 // and for safety reasons after 10 minutes again 1455 // and for safety reasons after 10 minutes again
1453 if ( !mSyncManager->blockSave() ) 1456 if ( !mSyncManager->blockSave() )
1454 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1457 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1455 else 1458 else
1456 msec = 1000 * 600; 1459 msec = 1000 * 600;
1457 mSaveTimer.start( msec, true ); // 1 minute 1460 mSaveTimer.start( msec, true ); // 1 minute
1458 qDebug("KO: Saving File in %d secs!", msec/1000); 1461 qDebug("KO: Saving File in %d secs!", msec/1000);
1459 mCalendarModifiedFlag = true; 1462 mCalendarModifiedFlag = true;
1460} 1463}
1464void MainWindow::saveStopTimer()
1465{
1466 mSaveTimer.stop();
1467 if (mSaveTimer.isActive() )
1468 qDebug("ti active ");
1469 else
1470 qDebug("KO: Save timer stopped");
1471}
1461void MainWindow::save() 1472void MainWindow::save()
1462{ 1473{
1474 if ( !mCalendarModifiedFlag ) {
1475 qDebug("KO: Calendar not modified. Nothing saved.");
1476 return;
1477 }
1463 if ( mSyncManager->blockSave() ) 1478 if ( mSyncManager->blockSave() )
1464 return; 1479 return;
1465 mSyncManager->setBlockSave(true); 1480 mSyncManager->setBlockSave(true);
1466 if ( mView->checkFileVersion( defaultFileName()) ) { 1481 if ( mView->checkFileVersion( defaultFileName()) ) {
1467
1468 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1482 QTime neededSaveTime = QDateTime::currentDateTime().time();
1469 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1483 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1470 qDebug("KO: Start saving data to file!"); 1484 qDebug("KO: Start saving data to file!");
1471 mView->saveCalendar( defaultFileName() ); 1485 mView->saveCalendar( defaultFileName() );
1472 1486 mCalendarModifiedFlag = false;
1473 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1487 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1474 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1488 qDebug("KO: Needed %d ms for saving.",msNeeded );
1475 QString savemes; 1489 QString savemes;
1476 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1490 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1477 setCaption(savemes); 1491 setCaption(savemes);
1478 } else 1492 } else
1479 setCaption(i18n("Saving cancelled!")); 1493 setCaption(i18n("Saving cancelled!"));
1480 mCalendarModifiedFlag = false;
1481 mSyncManager->setBlockSave( false ); 1494 mSyncManager->setBlockSave( false );
1482} 1495}
1483 1496
1484void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1497void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1485{ 1498{
1486 if ( !e->isAutoRepeat() ) { 1499 if ( !e->isAutoRepeat() ) {
1487 mFlagKeyPressed = false; 1500 mFlagKeyPressed = false;
1488 } 1501 }
1489} 1502}
1490void MainWindow::keyPressEvent ( QKeyEvent * e ) 1503void MainWindow::keyPressEvent ( QKeyEvent * e )
1491{ 1504{
1492 qApp->processEvents(); 1505 qApp->processEvents();
1493 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1506 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1494 e->ignore(); 1507 e->ignore();
1495 // qDebug(" ignore %d",e->isAutoRepeat() ); 1508 // qDebug(" ignore %d",e->isAutoRepeat() );
1496 return; 1509 return;
1497 } 1510 }
1498 if (! e->isAutoRepeat() ) 1511 if (! e->isAutoRepeat() )
1499 mFlagKeyPressed = true; 1512 mFlagKeyPressed = true;
1500 KOPrefs *p = KOPrefs::instance(); 1513 KOPrefs *p = KOPrefs::instance();
1501 bool showSelectedDates = false; 1514 bool showSelectedDates = false;
1502 int size; 1515 int size;
1503 int pro = 0; 1516 int pro = 0;
1504 //qDebug("MainWindow::keyPressEvent "); 1517 //qDebug("MainWindow::keyPressEvent ");
1505 switch ( e->key() ) { 1518 switch ( e->key() ) {
1506 case Qt::Key_Right: 1519 case Qt::Key_Right:
1507 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1520 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1508 mView->goNextMonth(); 1521 mView->goNextMonth();
1509 else 1522 else
1510 mView->goNext(); 1523 mView->goNext();
1511 showSelectedDates = true; 1524 showSelectedDates = true;
1512 break; 1525 break;
1513 case Qt::Key_Left: 1526 case Qt::Key_Left:
1514 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1527 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1515 mView->goPreviousMonth(); 1528 mView->goPreviousMonth();
1516 else 1529 else
1517 mView->goPrevious(); 1530 mView->goPrevious();
1518 showSelectedDates = true; 1531 showSelectedDates = true;
1519 break; 1532 break;
1520 case Qt::Key_Down: 1533 case Qt::Key_Down:
1521 mView->viewManager()->agendaView()->scrollOneHourDown(); 1534 mView->viewManager()->agendaView()->scrollOneHourDown();
1522 break; 1535 break;
1523 case Qt::Key_Up: 1536 case Qt::Key_Up:
1524 mView->viewManager()->agendaView()->scrollOneHourUp(); 1537 mView->viewManager()->agendaView()->scrollOneHourUp();
1525 break; 1538 break;
1526 case Qt::Key_I: 1539 case Qt::Key_I:
1527 mView->showIncidence(); 1540 mView->showIncidence();
1528 break; 1541 break;
1529 case Qt::Key_Delete: 1542 case Qt::Key_Delete:
1530 case Qt::Key_Backspace: 1543 case Qt::Key_Backspace:
1531 mView->deleteIncidence(); 1544 mView->deleteIncidence();
1532 break; 1545 break;
1533 case Qt::Key_D: 1546 case Qt::Key_D:
1534 mView->viewManager()->showDayView(); 1547 mView->viewManager()->showDayView();
1535 showSelectedDates = true; 1548 showSelectedDates = true;
1536 break; 1549 break;
1537 case Qt::Key_O: 1550 case Qt::Key_O:
1538 mView->toggleFilerEnabled( ); 1551 mView->toggleFilerEnabled( );
1539 break; 1552 break;
1540 case Qt::Key_0: 1553 case Qt::Key_0:
1541 case Qt::Key_1: 1554 case Qt::Key_1:
1542 case Qt::Key_2: 1555 case Qt::Key_2:
1543 case Qt::Key_3: 1556 case Qt::Key_3:
1544 case Qt::Key_4: 1557 case Qt::Key_4:
1545 case Qt::Key_5: 1558 case Qt::Key_5:
1546 case Qt::Key_6: 1559 case Qt::Key_6:
1547 case Qt::Key_7: 1560 case Qt::Key_7:
1548 case Qt::Key_8: 1561 case Qt::Key_8:
1549 case Qt::Key_9: 1562 case Qt::Key_9:
1550 pro = e->key()-48; 1563 pro = e->key()-48;
1551 if ( pro == 0 ) 1564 if ( pro == 0 )
1552 pro = 10; 1565 pro = 10;
1553 if ( e->state() == Qt::ControlButton) 1566 if ( e->state() == Qt::ControlButton)
1554 pro += 10; 1567 pro += 10;
1555 break; 1568 break;
1556 case Qt::Key_M: 1569 case Qt::Key_M:
1557 mView->viewManager()->showMonthView(); 1570 mView->viewManager()->showMonthView();
1558 showSelectedDates = true; 1571 showSelectedDates = true;
1559 break; 1572 break;
1560 case Qt::Key_Insert: 1573 case Qt::Key_Insert:
1561 mView->newEvent(); 1574 mView->newEvent();
1562 break; 1575 break;
1563 case Qt::Key_S : 1576 case Qt::Key_S :
1564 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1577 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1565 mView->newSubTodo(); 1578 mView->newSubTodo();
1566 else 1579 else
1567 mView->dialogManager()->showSearchDialog(); 1580 mView->dialogManager()->showSearchDialog();
1568 break; 1581 break;
1569 case Qt::Key_Y : 1582 case Qt::Key_Y :
1570 case Qt::Key_Z : 1583 case Qt::Key_Z :
1571 mView->viewManager()->showWorkWeekView(); 1584 mView->viewManager()->showWorkWeekView();
1572 showSelectedDates = true; 1585 showSelectedDates = true;
1573 break; 1586 break;
1574 case Qt::Key_U : 1587 case Qt::Key_U :
1575 mView->viewManager()->showWeekView(); 1588 mView->viewManager()->showWeekView();
1576 showSelectedDates = true; 1589 showSelectedDates = true;
1577 break; 1590 break;
1578 case Qt::Key_H : 1591 case Qt::Key_H :
1579 keyBindings(); 1592 keyBindings();
1580 break; 1593 break;
1581 case Qt::Key_W: 1594 case Qt::Key_W:
1582 mView->viewManager()->showWhatsNextView(); 1595 mView->viewManager()->showWhatsNextView();
1583 break; 1596 break;
1584 case Qt::Key_L: 1597 case Qt::Key_L:
1585 mView->viewManager()->showListView(); 1598 mView->viewManager()->showListView();
1586 break; 1599 break;
1587 case Qt::Key_N: 1600 case Qt::Key_N:
1588 mView->viewManager()->showNextXView(); 1601 mView->viewManager()->showNextXView();
1589 showSelectedDates = true; 1602 showSelectedDates = true;
1590 break; 1603 break;
1591 case Qt::Key_V: 1604 case Qt::Key_V:
1592 mView->viewManager()->showTodoView(); 1605 mView->viewManager()->showTodoView();
1593 break; 1606 break;
1594 case Qt::Key_C: 1607 case Qt::Key_C:
1595 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1608 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1596 break; 1609 break;
1597 case Qt::Key_P: 1610 case Qt::Key_P:
1598 mView->showDatePicker( ); 1611 mView->showDatePicker( );
1599 break; 1612 break;
1600 case Qt::Key_F: 1613 case Qt::Key_F:
1601 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1614 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1602 mView->editFilters(); 1615 mView->editFilters();
1603 else 1616 else
1604 mView->toggleFilter(); 1617 mView->toggleFilter();
1605 break; 1618 break;
1606 case Qt::Key_X: 1619 case Qt::Key_X:
1607 mView->toggleDateNavigatorWidget(); 1620 mView->toggleDateNavigatorWidget();
1608 break; 1621 break;
1609 case Qt::Key_Space: 1622 case Qt::Key_Space:
1610 mView->toggleExpand(); 1623 mView->toggleExpand();
1611 break; 1624 break;
1612 case Qt::Key_A: 1625 case Qt::Key_A:
1613 mView->toggleAllDaySize(); 1626 mView->toggleAllDaySize();
1614 break; 1627 break;
1615 case Qt::Key_T: 1628 case Qt::Key_T:
1616 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1629 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1617 mView->newTodo(); 1630 mView->newTodo();
1618 else { 1631 else {
1619 mView->goToday(); 1632 mView->goToday();
1620 showSelectedDates = true; 1633 showSelectedDates = true;
1621 } 1634 }
1622 break; 1635 break;
1623 case Qt::Key_J: 1636 case Qt::Key_J:
1624 mView->viewManager()->showJournalView(); 1637 mView->viewManager()->showJournalView();
1625 break; 1638 break;
1626 case Qt::Key_B: 1639 case Qt::Key_B:
1627 mView->editIncidenceDescription();; 1640 mView->editIncidenceDescription();;
1628 break; 1641 break;
1629 // case Qt::Key_Return: 1642 // case Qt::Key_Return:
1630 case Qt::Key_E: 1643 case Qt::Key_E:
1631 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1644 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1632 mView->newEvent(); 1645 mView->newEvent();
1633 else 1646 else
1634 mView->editIncidence(); 1647 mView->editIncidence();
1635 break; 1648 break;
1636 case Qt::Key_Plus: 1649 case Qt::Key_Plus:
1637 size = p->mHourSize +2; 1650 size = p->mHourSize +2;
1638 if ( size <= 18 ) 1651 if ( size <= 18 )
1639 configureAgenda( size ); 1652 configureAgenda( size );
1640 break; 1653 break;
1641 case Qt::Key_Minus: 1654 case Qt::Key_Minus:
1642 size = p->mHourSize - 2; 1655 size = p->mHourSize - 2;
1643 if ( size >= 4 ) 1656 if ( size >= 4 )
1644 configureAgenda( size ); 1657 configureAgenda( size );
1645 break; 1658 break;
1646 1659
1647 1660
1648 default: 1661 default:
1649 e->ignore(); 1662 e->ignore();
1650 } 1663 }
1651 if ( pro > 0 ) { 1664 if ( pro > 0 ) {
1652 mView->selectFilter( pro-1 ); 1665 mView->selectFilter( pro-1 );
1653 } 1666 }
1654 if ( showSelectedDates ) { 1667 if ( showSelectedDates ) {
1655 ;// setCaptionToDates(); 1668 ;// setCaptionToDates();
1656 } 1669 }
1657 1670
1658} 1671}
1659 1672
1660void MainWindow::fillFilterMenu() 1673void MainWindow::fillFilterMenu()
1661{ 1674{
1662 selectFilterMenu->clear(); 1675 selectFilterMenu->clear();
1663 bool disable = false; 1676 bool disable = false;
1664 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 1677 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
1665 selectFilterMenu->insertSeparator(); 1678 selectFilterMenu->insertSeparator();
1666 if ( mView->filterView()->filtersEnabled() ) { 1679 if ( mView->filterView()->filtersEnabled() ) {
1667 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); 1680 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 );
1668 } 1681 }
1669 else { 1682 else {
1670 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); 1683 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 );
1671 disable = true; 1684 disable = true;
1672 } 1685 }
1673 selectFilterMenu->insertSeparator(); 1686 selectFilterMenu->insertSeparator();
1674 QPtrList<CalFilter> fili = mView->filters(); 1687 QPtrList<CalFilter> fili = mView->filters();
1675 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1688 CalFilter *curfilter = mView->filterView()->selectedFilter();
1676 CalFilter *filter = fili.first(); 1689 CalFilter *filter = fili.first();
1677 int iii = 2; 1690 int iii = 2;
1678 while(filter) { 1691 while(filter) {
1679 selectFilterMenu->insertItem( filter->name(), iii ); 1692 selectFilterMenu->insertItem( filter->name(), iii );
1680 if ( filter == curfilter) 1693 if ( filter == curfilter)
1681 selectFilterMenu->setItemChecked( iii, true ); 1694 selectFilterMenu->setItemChecked( iii, true );
1682 if ( disable ) 1695 if ( disable )
1683 selectFilterMenu->setItemEnabled( iii, false ); 1696 selectFilterMenu->setItemEnabled( iii, false );
1684 filter = fili.next(); 1697 filter = fili.next();
1685 ++iii; 1698 ++iii;
1686 } 1699 }
1687} 1700}
1688void MainWindow::selectFilter( int fil ) 1701void MainWindow::selectFilter( int fil )
1689{ 1702{
1690 if ( fil == 0 ) { 1703 if ( fil == 0 ) {
1691 mView->editFilters( ); 1704 mView->editFilters( );
1692 } else if ( fil == 1 ){ 1705 } else if ( fil == 1 ){
1693 mView->toggleFilerEnabled( ); 1706 mView->toggleFilerEnabled( );
1694 } else { 1707 } else {
1695 mView->selectFilter( fil-2 ); 1708 mView->selectFilter( fil-2 );
1696 } 1709 }
1697} 1710}
1698void MainWindow::configureToolBar( int item ) 1711void MainWindow::configureToolBar( int item )
1699{ 1712{
1700 1713
1701 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1714 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1702 KOPrefs *p = KOPrefs::instance(); 1715 KOPrefs *p = KOPrefs::instance();
1703 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 1716 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
1704 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 1717 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
1705 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 1718 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
1706 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 1719 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
1707 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 1720 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
1708 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 1721 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
1709 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 1722 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
1710 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 1723 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
1711 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 1724 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
1712 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 1725 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
1713 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 1726 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
1714 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 1727 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
1715 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 1728 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
1716 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 1729 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
1717 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 1730 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
1718 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 1731 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
1719 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 1732 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
1720 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 1733 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
1721 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 1734 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
1722 // initActions(); 1735 // initActions();
1723} 1736}
1724 1737
1725void MainWindow::setCaptionToDates() 1738void MainWindow::setCaptionToDates()
1726{ 1739{
1727 QString selDates; 1740 QString selDates;
1728 selDates = KGlobal::locale()->formatDate(mView->startDate(), true); 1741 selDates = KGlobal::locale()->formatDate(mView->startDate(), true);
1729 if (mView->startDate() < mView->endDate() ) 1742 if (mView->startDate() < mView->endDate() )
1730 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 1743 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
1731 else { 1744 else {
1732 QString addString; 1745 QString addString;
1733 if ( mView->startDate() == QDateTime::currentDateTime().date() ) 1746 if ( mView->startDate() == QDateTime::currentDateTime().date() )
1734 addString = i18n("Today"); 1747 addString = i18n("Today");
1735 else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) 1748 else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) )
1736 addString = i18n("Tomorrow"); 1749 addString = i18n("Tomorrow");
1737 if ( !addString.isEmpty() ) 1750 if ( !addString.isEmpty() )
1738 selDates = addString+", "+selDates ; 1751 selDates = addString+", "+selDates ;
1739 } 1752 }
1740 setCaption( i18n("Dates: ") + selDates ); 1753 setCaption( i18n("Dates: ") + selDates );
1741 1754
1742} 1755}
1743void MainWindow::showConfigureAgenda( ) 1756void MainWindow::showConfigureAgenda( )
1744{ 1757{
1745 int iii; 1758 int iii;
1746 for ( iii = 1;iii<= 10 ;++iii ){ 1759 for ( iii = 1;iii<= 10 ;++iii ){
1747 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 1760 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
1748 } 1761 }
1749 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 1762 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
1750} 1763}
1751void MainWindow::configureAgenda( int item ) 1764void MainWindow::configureAgenda( int item )
1752{ 1765{
1753 if ( KOPrefs::instance()->mHourSize == item ) 1766 if ( KOPrefs::instance()->mHourSize == item )
1754 return; 1767 return;
1755 KOPrefs::instance()->mHourSize=item; 1768 KOPrefs::instance()->mHourSize=item;
1756 mView->viewManager()->agendaView()->updateConfig(); 1769 mView->viewManager()->agendaView()->updateConfig();
1757} 1770}
1758 1771
1759void MainWindow::saveCalendar() 1772void MainWindow::saveCalendar()
1760{ 1773{
1761 QString fn = KOPrefs::instance()->mLastSaveFile; 1774 QString fn = KOPrefs::instance()->mLastSaveFile;
1762 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 1775 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
1763 1776
1764 if ( fn == "" ) 1777 if ( fn == "" )
1765 return; 1778 return;
1766 QFileInfo info; 1779 QFileInfo info;
1767 info.setFile( fn ); 1780 info.setFile( fn );
1768 QString mes; 1781 QString mes;
1769 bool createbup = true; 1782 bool createbup = true;
1770 if ( info. exists() ) { 1783 if ( info. exists() ) {
1771 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 1784 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
1772 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1785 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1773 i18n("Overwrite!"), i18n("Cancel"), 0, 1786 i18n("Overwrite!"), i18n("Cancel"), 0,
1774 0, 1 ); 1787 0, 1 );
1775 if ( result != 0 ) { 1788 if ( result != 0 ) {
1776 createbup = false; 1789 createbup = false;
1777 } 1790 }
1778 } 1791 }
1779 if ( createbup ) { 1792 if ( createbup ) {
1780 mView->saveCalendar( fn ); 1793 mView->saveCalendar( fn );
1781 mes = i18n("KO/Pi:Saved %1").arg(fn); 1794 mes = i18n("KO/Pi:Saved %1").arg(fn);
1782 KOPrefs::instance()->mLastSaveFile = fn; 1795 KOPrefs::instance()->mLastSaveFile = fn;
1783 setCaption(mes); 1796 setCaption(mes);
1784 } 1797 }
1785} 1798}
1786void MainWindow::loadCalendar() 1799void MainWindow::loadCalendar()
1787{ 1800{
1788 1801
1789 QString fn = KOPrefs::instance()->mLastLoadFile; 1802 QString fn = KOPrefs::instance()->mLastLoadFile;
1790 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 1803 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
1791 1804
1792 if ( fn == "" ) 1805 if ( fn == "" )
1793 return; 1806 return;
1794 QFileInfo info; 1807 QFileInfo info;
1795 info.setFile( fn ); 1808 info.setFile( fn );
1796 QString mess; 1809 QString mess;
1797 bool loadbup = true; 1810 bool loadbup = true;
1798 if ( info. exists() ) { 1811 if ( info. exists() ) {
1799 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1812 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1800 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 1813 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
1801 mess, 1814 mess,
1802 i18n("Load!"), i18n("Cancel"), 0, 1815 i18n("Load!"), i18n("Cancel"), 0,
1803 0, 1 ); 1816 0, 1 );
1804 if ( result != 0 ) { 1817 if ( result != 0 ) {
1805 loadbup = false; 1818 loadbup = false;
1806 } 1819 }
1807 } else { 1820 } else {
1808 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1821 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1809 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 1822 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
1810 0, 1 ); 1823 0, 1 );
1811 1824
1812 return; 1825 return;
1813 } 1826 }
1814 if ( loadbup ) { 1827 if ( loadbup ) {
1815 mView->openCalendar( fn ); 1828 mView->openCalendar( fn );
1816 KOPrefs::instance()->mLastLoadFile = fn; 1829 KOPrefs::instance()->mLastLoadFile = fn;
1817 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 1830 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
1818 setCaption(mess); 1831 setCaption(mess);
1819 } 1832 }
1820 1833
1821} 1834}
1822void MainWindow::quickImportIcal() 1835void MainWindow::quickImportIcal()
1823{ 1836{
1824 importFile( KOPrefs::instance()->mLastImportFile, false ); 1837 importFile( KOPrefs::instance()->mLastImportFile, false );
1825} 1838}
1826void MainWindow::importFile( QString fn, bool quick ) 1839void MainWindow::importFile( QString fn, bool quick )
1827{ 1840{
1828 QFileInfo info; 1841 QFileInfo info;
1829 info.setFile( fn ); 1842 info.setFile( fn );
1830 QString mess; 1843 QString mess;
1831 bool loadbup = true; 1844 bool loadbup = true;
1832 if ( !info. exists() ) { 1845 if ( !info. exists() ) {
1833 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 1846 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
1834 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1847 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1835 mess ); 1848 mess );
1836 return; 1849 return;
1837 } 1850 }
1838 int result = 0; 1851 int result = 0;
1839 if ( !quick ) { 1852 if ( !quick ) {
1840 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1853 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1841 result = QMessageBox::warning( this, "KO/Pi: Warning!", 1854 result = QMessageBox::warning( this, "KO/Pi: Warning!",
1842 mess, 1855 mess,
1843 "Import", "Cancel", 0, 1856 "Import", "Cancel", 0,
1844 0, 1 ); 1857 0, 1 );
1845 } 1858 }
1846 if ( result == 0 ) { 1859 if ( result == 0 ) {
1847 if ( mView->openCalendar( fn, true )) { 1860 if ( mView->openCalendar( fn, true )) {
1848 KOPrefs::instance()->mLastImportFile = fn; 1861 KOPrefs::instance()->mLastImportFile = fn;
1849 setCaption(i18n("Imported file successfully")); 1862 setCaption(i18n("Imported file successfully"));
1850 } else { 1863 } else {
1851 setCaption(i18n("Error importing file")); 1864 setCaption(i18n("Error importing file"));
1852 } 1865 }
1853 } 1866 }
1854} 1867}
1855 1868
1856void MainWindow::importIcal() 1869void MainWindow::importIcal()
1857{ 1870{
1858 1871
1859 QString fn =KOPrefs::instance()->mLastImportFile; 1872 QString fn =KOPrefs::instance()->mLastImportFile;
1860 1873
1861 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 1874 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
1862 if ( fn == "" ) 1875 if ( fn == "" )
1863 return; 1876 return;
1864 importFile( fn, true ); 1877 importFile( fn, true );
1865 1878
1866} 1879}
1867 1880
1868void MainWindow::exportVCalendar() 1881void MainWindow::exportVCalendar()
1869{ 1882{
1870 QString fn = KOPrefs::instance()->mLastVcalFile; 1883 QString fn = KOPrefs::instance()->mLastVcalFile;
1871 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 1884 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
1872 if ( fn == "" ) 1885 if ( fn == "" )
1873 return; 1886 return;
1874 QFileInfo info; 1887 QFileInfo info;
1875 info.setFile( fn ); 1888 info.setFile( fn );
1876 QString mes; 1889 QString mes;
1877 bool createbup = true; 1890 bool createbup = true;
1878 if ( info. exists() ) { 1891 if ( info. exists() ) {
1879 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 1892 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
1880 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1893 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1881 i18n("Overwrite!"), i18n("Cancel"), 0, 1894 i18n("Overwrite!"), i18n("Cancel"), 0,
1882 0, 1 ); 1895 0, 1 );
1883 if ( result != 0 ) { 1896 if ( result != 0 ) {
1884 createbup = false; 1897 createbup = false;
1885 } 1898 }
1886 } 1899 }
1887 if ( createbup ) { 1900 if ( createbup ) {
1888 if ( mView->exportVCalendar( fn ) ) { 1901 if ( mView->exportVCalendar( fn ) ) {
1889 KOPrefs::instance()->mLastVcalFile = fn; 1902 KOPrefs::instance()->mLastVcalFile = fn;
1890 if ( fn.length() > 20 ) 1903 if ( fn.length() > 20 )
1891 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 1904 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
1892 else 1905 else
1893 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 1906 mes = i18n("KO/Pi:Exported to %1").arg(fn );
1894 setCaption(mes); 1907 setCaption(mes);
1895 } 1908 }
1896 } 1909 }
1897 1910
1898} 1911}
1899 1912
1900void MainWindow::syncFileRequest() 1913void MainWindow::syncFileRequest()
1901{ 1914{
1902 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 1915 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
1903 mSyncManager->slotSyncMenu( 999 ); 1916 mSyncManager->slotSyncMenu( 999 );
1904 } 1917 }
1905 save(); 1918 save();
1906} 1919}
1907void MainWindow::getFile( bool success ) 1920void MainWindow::getFile( bool success )
1908{ 1921{
1909 if ( ! success ) { 1922 if ( ! success ) {
1910 setCaption( i18n("Error receiving file. Nothing changed!") ); 1923 setCaption( i18n("Error receiving file. Nothing changed!") );
1911 return; 1924 return;
1912 } 1925 }
1913 mView->openCalendar( defaultFileName() ); 1926 mView->openCalendar( defaultFileName() );
1914 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 1927 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
1915 mSyncManager->slotSyncMenu( 999 ); 1928 mSyncManager->slotSyncMenu( 999 );
1916 } 1929 }
1917 setCaption( i18n("Pi-Sync successful!") ); 1930 setCaption( i18n("Pi-Sync successful!") );
1918} 1931}
1919 1932
1920void MainWindow::printSel( ) 1933void MainWindow::printSel( )
1921{ 1934{
1922 mView->viewManager()->agendaView()->agenda()->printSelection(); 1935 mView->viewManager()->agendaView()->agenda()->printSelection();
1923} 1936}
1924 1937
1925void MainWindow::printCal() 1938void MainWindow::printCal()
1926{ 1939{
1927 mView->print();//mCp->showDialog(); 1940 mView->print();//mCp->showDialog();
1928} 1941}
1929 1942
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 6de0543..8dd55ac 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,141 +1,142 @@
1#ifndef KORGE_MAINWINDOW_H 1#ifndef KORGE_MAINWINDOW_H
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <qdict.h>
7#include <qfile.h> 7#include <qfile.h>
8#include <qtextstream.h> 8#include <qtextstream.h>
9#include <qregexp.h> 9#include <qregexp.h>
10 10
11#include <libkcal/incidence.h> 11#include <libkcal/incidence.h>
12#include "simplealarmclient.h" 12#include "simplealarmclient.h"
13#include <ksyncmanager.h> 13#include <ksyncmanager.h>
14#ifndef DESKTOP_VERSION 14#ifndef DESKTOP_VERSION
15#include <qcopchannel_qws.h> 15#include <qcopchannel_qws.h>
16#endif 16#endif
17class QAction; 17class QAction;
18class CalendarView; 18class CalendarView;
19class KSyncProfile; 19class KSyncProfile;
20#ifdef DESKTOP_VERSION 20#ifdef DESKTOP_VERSION
21 21
22#define QPEToolBar QToolBar 22#define QPEToolBar QToolBar
23#define QPEMenuBar QMenuBar 23#define QPEMenuBar QMenuBar
24#endif 24#endif
25class QPEToolBar; 25class QPEToolBar;
26 26
27 27
28namespace KCal { 28namespace KCal {
29class CalendarLocal; 29class CalendarLocal;
30} 30}
31 31
32using namespace KCal; 32using namespace KCal;
33 33
34class MainWindow : public QMainWindow 34class MainWindow : public QMainWindow
35{ 35{
36 Q_OBJECT 36 Q_OBJECT
37 public: 37 public:
38 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 38 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
39 ~MainWindow(); 39 ~MainWindow();
40 bool beamReceiveEnabled(); 40 bool beamReceiveEnabled();
41 static QString defaultFileName(); 41 static QString defaultFileName();
42 static QString syncFileName(); 42 static QString syncFileName();
43 static QString resourcePath(); 43 static QString resourcePath();
44 public slots: 44 public slots:
45 virtual void showMaximized (); 45 virtual void showMaximized ();
46 void configureAgenda( int ); 46 void configureAgenda( int );
47 void recieve( const QCString& msg, const QByteArray& data ); 47 void recieve( const QCString& msg, const QByteArray& data );
48 protected slots: 48 protected slots:
49 void setCaptionToDates(); 49 void setCaptionToDates();
50 void about(); 50 void about();
51 void licence(); 51 void licence();
52 void faq(); 52 void faq();
53 void usertrans(); 53 void usertrans();
54 void features(); 54 void features();
55 void synchowto(); 55 void synchowto();
56 void kdesynchowto(); 56 void kdesynchowto();
57 void multisynchowto(); 57 void multisynchowto();
58 void whatsNew(); 58 void whatsNew();
59 void keyBindings(); 59 void keyBindings();
60 void aboutAutoSaving();; 60 void aboutAutoSaving();;
61 void aboutKnownBugs(); 61 void aboutKnownBugs();
62 62
63 void processIncidenceSelection( Incidence * ); 63 void processIncidenceSelection( Incidence * );
64 64
65 void importQtopia(); 65 void importQtopia();
66 void importBday(); 66 void importBday();
67 void importOL(); 67 void importOL();
68 void importIcal(); 68 void importIcal();
69 void importFile( QString, bool ); 69 void importFile( QString, bool );
70 void quickImportIcal(); 70 void quickImportIcal();
71 71
72 void slotModifiedChanged( bool ); 72 void slotModifiedChanged( bool );
73 73
74 void save(); 74 void save();
75 void saveStopTimer();
75 void configureToolBar( int ); 76 void configureToolBar( int );
76 void printSel(); 77 void printSel();
77 void printCal(); 78 void printCal();
78 void saveCalendar(); 79 void saveCalendar();
79 void loadCalendar(); 80 void loadCalendar();
80 void exportVCalendar(); 81 void exportVCalendar();
81 void fillFilterMenu(); 82 void fillFilterMenu();
82 void selectFilter( int ); 83 void selectFilter( int );
83 void exportToPhone( int ); 84 void exportToPhone( int );
84 void toggleBeamReceive(); 85 void toggleBeamReceive();
85 void disableBR(bool); 86 void disableBR(bool);
86 87
87 private slots: 88 private slots:
88 void showConfigureAgenda(); 89 void showConfigureAgenda();
89 void getFile( bool ); 90 void getFile( bool );
90 void syncFileRequest(); 91 void syncFileRequest();
91 92
92 protected: 93 protected:
93 void displayText( QString, QString); 94 void displayText( QString, QString);
94 void enableIncidenceActions( bool ); 95 void enableIncidenceActions( bool );
95 96
96 private: 97 private:
97 bool mBRdisabled; 98 bool mBRdisabled;
98#ifndef DESKTOP_VERSION 99#ifndef DESKTOP_VERSION
99 QCopChannel* infrared; 100 QCopChannel* infrared;
100#endif 101#endif
101 QAction* brAction; 102 QAction* brAction;
102 KSyncManager* mSyncManager; 103 KSyncManager* mSyncManager;
103 bool mClosed; 104 bool mClosed;
104 void saveOnClose(); 105 void saveOnClose();
105 bool mFlagKeyPressed; 106 bool mFlagKeyPressed;
106 bool mBlockAtStartup; 107 bool mBlockAtStartup;
107 QPEToolBar *iconToolBar; 108 QPEToolBar *iconToolBar;
108 void initActions(); 109 void initActions();
109 void setDefaultPreferences(); 110 void setDefaultPreferences();
110 void keyPressEvent ( QKeyEvent * ) ; 111 void keyPressEvent ( QKeyEvent * ) ;
111 void keyReleaseEvent ( QKeyEvent * ) ; 112 void keyReleaseEvent ( QKeyEvent * ) ;
112 QPopupMenu *configureToolBarMenu; 113 QPopupMenu *configureToolBarMenu;
113 QPopupMenu *selectFilterMenu; 114 QPopupMenu *selectFilterMenu;
114 QPopupMenu *configureAgendaMenu, *syncMenu; 115 QPopupMenu *configureAgendaMenu, *syncMenu;
115 CalendarLocal *mCalendar; 116 CalendarLocal *mCalendar;
116 CalendarView *mView; 117 CalendarView *mView;
117 QAction *mNewSubTodoAction; 118 QAction *mNewSubTodoAction;
118 119
119 QAction *mShowAction; 120 QAction *mShowAction;
120 QAction *mEditAction; 121 QAction *mEditAction;
121 QAction *mDeleteAction; 122 QAction *mDeleteAction;
122 QAction *mCloneAction; 123 QAction *mCloneAction;
123 QAction *mMoveAction; 124 QAction *mMoveAction;
124 QAction *mBeamAction; 125 QAction *mBeamAction;
125 QAction *mCancelAction; 126 QAction *mCancelAction;
126 127
127 QAction *mToggleNav; 128 QAction *mToggleNav;
128 QAction *mToggleFilter; 129 QAction *mToggleFilter;
129 QAction *mToggleAllday; 130 QAction *mToggleAllday;
130 131
131 132
132 void closeEvent( QCloseEvent* ce ); 133 void closeEvent( QCloseEvent* ce );
133 SimpleAlarmClient mAlarmClient; 134 SimpleAlarmClient mAlarmClient;
134 QTimer mSaveTimer; 135 QTimer mSaveTimer;
135 //bool mBlockSaveFlag; 136 //bool mBlockSaveFlag;
136 bool mCalendarModifiedFlag; 137 bool mCalendarModifiedFlag;
137 QPixmap loadPixmap( QString ); 138 QPixmap loadPixmap( QString );
138}; 139};
139 140
140 141
141#endif 142#endif