summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt6
-rw-r--r--korganizer/calendarview.cpp5
-rw-r--r--korganizer/datenavigator.cpp6
-rw-r--r--korganizer/datenavigator.h1
-rw-r--r--korganizer/interfaces/korganizer/baseview.h1
-rw-r--r--korganizer/komonthview.h1
6 files changed, 19 insertions, 1 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index eb7cf13..4fff7e1 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,611 +1,617 @@
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 1.9.14 ************ 3********** VERSION 1.9.14 ************
4 4
5Fixed some problems with the dialog sizes when switching 5Fixed some problems with the dialog sizes when switching
6portrait/landscape mode on 640x480 PDA display. 6portrait/landscape mode on 640x480 PDA display.
7 7
8Fixed some other small bugs. 8Fixed some other small bugs.
9 9
10Fixed an ugly bug in KOpieMail: 10Fixed an ugly bug in KOpieMail:
11KOpieMail was not able to write files (mails) to MSDOS file system, 11KOpieMail was not able to write files (mails) to MSDOS file system,
12like on an usual preformatted SD card. That should work now. 12like on an usual preformatted SD card. That should work now.
13To save your mail data on the Sd card do the following: 13To save your mail data on the Sd card do the following:
14Create a dir on the SD card: 14Create a dir on the SD card:
15mkdir /mnt/card/localmail 15mkdir /mnt/card/localmail
16Go to your home dir: 16Go to your home dir:
17cd 17cd
18Go to kopiemail data storage dir: 18Go to kopiemail data storage dir:
19cd kdepim/apps/kopiemail 19cd kdepim/apps/kopiemail
20Create a symlink to the SD card: 20Create a symlink to the SD card:
21ls -s /mnt/card/localmail 21ls -s /mnt/card/localmail
22Now KOpieMail will store all mails on the SD card. 22Now KOpieMail will store all mails on the SD card.
23 23
24KO/Pi Monthview:
25Now "Go to Today" selects the current month from day 1-end,
26not the current date + some days.
27I.e. "Go to Today" shows now always
28the current month with first day of month in the first row.
29
24 30
25********** VERSION 1.9.13 ************ 31********** VERSION 1.9.13 ************
26 32
27Fixed nasty PwM/Pi file reading bug, when 33Fixed nasty PwM/Pi file reading bug, when
28the used hash algo of file is different then the global 34the used hash algo of file is different then the global
29hash algo. 35hash algo.
30 36
31Added KA/Pi support for opie mailit mailapplication. 37Added KA/Pi support for opie mailit mailapplication.
32 38
33Fixed some bugs in OM/Pi. 39Fixed some bugs in OM/Pi.
34Now character conversion tables are available for the Zaurus 40Now character conversion tables are available for the Zaurus
35to make OM/Pi working properly. 41to make OM/Pi working properly.
36To get the character conversion in OM/Pi working, please download 42To get the character conversion in OM/Pi working, please download
37at the sourceforge project site the package 43at the sourceforge project site the package
38sr-character-conversion_SharpROM_arm.ipk.zip 44sr-character-conversion_SharpROM_arm.ipk.zip
39(or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) 45(or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms)
40from the section "general files for KDE/Pim" 46from the section "general files for KDE/Pim"
41Instructions how to install this package are in a ReadMe in this file. 47Instructions how to install this package are in a ReadMe in this file.
42 48
43 49
44Fixed the orientation change problem in KA/Pi when switching 50Fixed the orientation change problem in KA/Pi when switching
45portrait/landscape mode. 51portrait/landscape mode.
46 52
47French translation available for KA/Pi and OM/Pi. 53French translation available for KA/Pi and OM/Pi.
48 54
49Fixed some problems with categories in KO/Pi in DTM sync. 55Fixed some problems with categories in KO/Pi in DTM sync.
50 56
51Added selection dialog for export to phone in KA/Pi. 57Added selection dialog for export to phone in KA/Pi.
52 58
53If in KO/Pi is an attendee selected to add to a meeting and this 59If in KO/Pi is an attendee selected to add to a meeting and this
54attendee is already in the list of attendees, this person is not added 60attendee is already in the list of attendees, this person is not added
55again. 61again.
56 62
57Some menu cleanup in KA/Pi. 63Some menu cleanup in KA/Pi.
58 64
59********** VERSION 1.9.12 ************ 65********** VERSION 1.9.12 ************
60 66
61Fix for the bug in KO/Pi What's Next view of version 1.9.11. 67Fix for the bug in KO/Pi What's Next view of version 1.9.11.
62 68
63Bugfix: Licence file is now shown again. 69Bugfix: Licence file is now shown again.
64 70
65OM/Pi now supports Unicode (utf8 charset). 71OM/Pi now supports Unicode (utf8 charset).
66Fixed some bugs in OM/Pi. 72Fixed some bugs in OM/Pi.
67 73
68KA/Pi has more German translation. 74KA/Pi has more German translation.
69 75
70 76
71********** VERSION 1.9.11 ************ 77********** VERSION 1.9.11 ************
72 78
73Fixed several problems in PWM/Pi, like 79Fixed several problems in PWM/Pi, like
74asking the user, if unsaved changed are pending 80asking the user, if unsaved changed are pending
75when closing the app. 81when closing the app.
76And PwM/Pi handles now different texts for the 82And PwM/Pi handles now different texts for the
77fields Description, Username, Password, configurable per category. 83fields Description, Username, Password, configurable per category.
78 84
79Fixed a crash in KO/Pi , when importing/loading vcs files 85Fixed a crash in KO/Pi , when importing/loading vcs files
80which have an entry with an attendee with state: 86which have an entry with an attendee with state:
81NEEDS ACTION 87NEEDS ACTION
82 88
83Fixed some problems in the German translation of OM/Pi, 89Fixed some problems in the German translation of OM/Pi,
84which makes some dialogs not fitting on the screen 90which makes some dialogs not fitting on the screen
85of the Z 5500. 91of the Z 5500.
86 92
87Fixed Qtopia crash, when disabling/deinstalling 93Fixed Qtopia crash, when disabling/deinstalling
88KO/Pi alarm applet. 94KO/Pi alarm applet.
89 95
90Implemented direct KDE<->KA/Pi sync for KA/Pi running 96Implemented direct KDE<->KA/Pi sync for KA/Pi running
91on Linux desktop. 97on Linux desktop.
92 98
93Added feature "remove sync info" to sync menu. 99Added feature "remove sync info" to sync menu.
94 100
95Tweaked the KO/Pi What's next view a bit, added 101Tweaked the KO/Pi What's next view a bit, added
96setting to hide events that are done. 102setting to hide events that are done.
97 103
98Disabled "beam receive enabled" on startup to 104Disabled "beam receive enabled" on startup to
99avoid problems if Fastload is enabled. 105avoid problems if Fastload is enabled.
100Please set "beam receive enabled", 106Please set "beam receive enabled",
101if you want to receive data via IR. 107if you want to receive data via IR.
102 108
103Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running 109Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running
104on Linux desktop. 110on Linux desktop.
105 111
106Made in KA/Pi scrolling possible, if details view is selected. 112Made in KA/Pi scrolling possible, if details view is selected.
107(The keyboard focus is set automatically to the search line) 113(The keyboard focus is set automatically to the search line)
108 114
109Fixed a bug in DMT sync, that a new entry in DTM was added 115Fixed a bug in DMT sync, that a new entry in DTM was added
110on every sync to Kx/Pi. 116on every sync to Kx/Pi.
111 117
112Fixed missing writing of KA/Pi categories to DMT entries when syncing. 118Fixed missing writing of KA/Pi categories to DMT entries when syncing.
113 119
114Fixed a bug in DMT sync with todos created in KO/Pi containing 120Fixed a bug in DMT sync with todos created in KO/Pi containing
115non-latin1 characters. 121non-latin1 characters.
116 122
117Rearranged package contents of Sharp-ipks and made all 123Rearranged package contents of Sharp-ipks and made all
118packages installable on SD again. 124packages installable on SD again.
119 125
120Fixed the writing of addressbook data in DTM sync. 126Fixed the writing of addressbook data in DTM sync.
121Empty fields in KA/Pi were not removed. 127Empty fields in KA/Pi were not removed.
122 128
123Added better category handling in KA/Pi: 129Added better category handling in KA/Pi:
124Added item 130Added item
125Edit Categories and 131Edit Categories and
126Manage new categories 132Manage new categories
127to the settings menu. 133to the settings menu.
128Possible to configure a view to display categories. 134Possible to configure a view to display categories.
129 135
130Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. 136Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu.
131 137
132Fixed displaying of "free" days and time in KO Monthview and Agendaview. 138Fixed displaying of "free" days and time in KO Monthview and Agendaview.
133 139
134... and many other bugfixes. 140... and many other bugfixes.
135 141
136********** VERSION 1.9.10 ************ 142********** VERSION 1.9.10 ************
137 143
138Many internal small bugfixes. 144Many internal small bugfixes.
139And fix of the "big" bug in KO/Pi, 145And fix of the "big" bug in KO/Pi,
140that after Syncing the appointments had an offset by several hours. 146that after Syncing the appointments had an offset by several hours.
141That was a problem with the internal timezone setting, 147That was a problem with the internal timezone setting,
142introduced by the changed timezone configuration settings. 148introduced by the changed timezone configuration settings.
143 149
144German translation for OM/Pi is now available. 150German translation for OM/Pi is now available.
145 151
146 152
147********** VERSION 1.9.9 ************ 153********** VERSION 1.9.9 ************
148 154
149KDE-Pim/Pi has a new Member! 155KDE-Pim/Pi has a new Member!
150It is called PWM/Pi (Passwordmanager/platform-independent) 156It is called PWM/Pi (Passwordmanager/platform-independent)
151and it is available for the Zaurus. 157and it is available for the Zaurus.
152It is planned, that it will be available later for Windows. 158It is planned, that it will be available later for Windows.
153(And for Linux, of course). 159(And for Linux, of course).
154It is a port of the Passwordmanager of KDE. 160It is a port of the Passwordmanager of KDE.
155It will need the MicroKDElibs to run. 161It will need the MicroKDElibs to run.
156 162
157Made loading of addressbooks in KA/Pi up to 7 times faster! 163Made loading of addressbooks in KA/Pi up to 7 times faster!
158The bigger your addressbook file, the more starting speed 164The bigger your addressbook file, the more starting speed
159will you gain. (relatively) 165will you gain. (relatively)
160 166
161The Qtopia addressbook connector is now platform independend 167The Qtopia addressbook connector is now platform independend
162as well and should work on any platform for importing/exporting 168as well and should work on any platform for importing/exporting
163Qtopia and Opie XML files. 169Qtopia and Opie XML files.
164 170
165Added a +30min feature to the timezone settings to make 171Added a +30min feature to the timezone settings to make
166KDE-Pim/Pi useable in Australia and other parts on the 172KDE-Pim/Pi useable in Australia and other parts on the
167world with strange timezones ;-) 173world with strange timezones ;-)
168 174
169German "Umlaute" should now be sorted correctly on the Z in KA/Pi. 175German "Umlaute" should now be sorted correctly on the Z in KA/Pi.
170 176
171It is now possible to disable the 177It is now possible to disable the
172"receive data via infrared" feature, such that syncing with 178"receive data via infrared" feature, such that syncing with
173Outlook is now possible again with Kx/Pi runing. 179Outlook is now possible again with Kx/Pi runing.
174Please disable it, before syncing Sharp DTM with Outlook. 180Please disable it, before syncing Sharp DTM with Outlook.
175For your convenience, the "receive data via infrared" feature 181For your convenience, the "receive data via infrared" feature
176is disabled automatically, if you sync Kx/Pi with DTM. 182is disabled automatically, if you sync Kx/Pi with DTM.
177You have to enable it again manually after syncing. 183You have to enable it again manually after syncing.
178Enabling this feature makes it impossible to start the 184Enabling this feature makes it impossible to start the
179Sharp DTM apps. If this feature is enabled, you will only get the 185Sharp DTM apps. If this feature is enabled, you will only get the
180alarm notification from KO/Pi and not from the Sharp calendar. 186alarm notification from KO/Pi and not from the Sharp calendar.
181This is very useful if you sync KO/Pi with Sharp DTM, 187This is very useful if you sync KO/Pi with Sharp DTM,
182because after syncing you usually would get notified about 188because after syncing you usually would get notified about
183an alarm by KO/Pi and the Sharp Calendar. 189an alarm by KO/Pi and the Sharp Calendar.
184 190
185Together with the Linux desktop version of KO/Pi 191Together with the Linux desktop version of KO/Pi
186it is now possible to sync KO/Pi on the Zaurus 192it is now possible to sync KO/Pi on the Zaurus
187with the complete KDE-desktop (3.3 or later) 193with the complete KDE-desktop (3.3 or later)
188calendar data easily. 194calendar data easily.
189That makes it possible to sync the Z with one 195That makes it possible to sync the Z with one
190click of a mouse with the KDE-Desktop. 196click of a mouse with the KDE-Desktop.
191This feature it available for all Zaurus platforms KO/Pi 197This feature it available for all Zaurus platforms KO/Pi
192is running on. 198is running on.
193The only thing needed is a running KO/Pi on Linux and 199The only thing needed is a running KO/Pi on Linux and
194a compiled version of the small 200a compiled version of the small
195KDE-Pim/Pi<->KDE-Desktop access command line program, 201KDE-Pim/Pi<->KDE-Desktop access command line program,
196which is in the KDE-Pim/Pi sources available. 202which is in the KDE-Pim/Pi sources available.
197 203
198The "KDE-desktop" syncing feature for KA/Pi will follow 204The "KDE-desktop" syncing feature for KA/Pi will follow
199in the next releases. 205in the next releases.
200 206
201Fixed the vcard export bug, which had the version 1.9.8. 207Fixed the vcard export bug, which had the version 1.9.8.
202 208
203Added missing GERMAN translation to KO/Pi. 209Added missing GERMAN translation to KO/Pi.
204Hi PsionX, could you add the missing french translation?Thx! 210Hi PsionX, could you add the missing french translation?Thx!
205 211
206Translation files for KA/Pi are available as well. 212Translation files for KA/Pi are available as well.
207GERMAN translation will be available in the next release. 213GERMAN translation will be available in the next release.
208PsionX ( yres, you again ;-) ), could you start translating 214PsionX ( yres, you again ;-) ), could you start translating
209KA/Pi? Thx! 215KA/Pi? Thx!
210 216
211You can download the version 1.9.9 at 217You can download the version 1.9.9 at
212 218
213http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 219http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604
214 220
215Note: 221Note:
216To run the mail program OM/Pi you need libopenssl. 222To run the mail program OM/Pi you need libopenssl.
217A link to a download loaction is available at 223A link to a download loaction is available at
218ZSI at www.killefiz.de 224ZSI at www.killefiz.de
219 225
220 226
221********** VERSION 1.9.8 ************ 227********** VERSION 1.9.8 ************
222 228
223Fixed character decoding in OM/Pi. 229Fixed character decoding in OM/Pi.
224(e.g. German "Umlaute" were not displayed properly.) 230(e.g. German "Umlaute" were not displayed properly.)
225 231
226Made is possible to reparent todos in KO/Pi. 232Made is possible to reparent todos in KO/Pi.
227Use contextmenu or keys (look at Help-Keys + Colors) for that. 233Use contextmenu or keys (look at Help-Keys + Colors) for that.
228 234
229Added the missing Sync-Howto and WhatsNew to the packages. 235Added the missing Sync-Howto and WhatsNew to the packages.
230 236
231KO/Pi on Linux desktop can now sync with KDE desktop. 237KO/Pi on Linux desktop can now sync with KDE desktop.
232That means: When using KO/Pi on Linux desktop for syncing with 238That means: When using KO/Pi on Linux desktop for syncing with
233KDE desktop and the Zaurus, the Zaurus can be synced now 239KDE desktop and the Zaurus, the Zaurus can be synced now
234with all KDE-Calendar resources, not only with one local file. 240with all KDE-Calendar resources, not only with one local file.
235(That makes it possible to sync the Zaurus with the 241(That makes it possible to sync the Zaurus with the
236calendar data on a Kolab server) 242calendar data on a Kolab server)
237 243
238KA/Pi syncing with KDE desktop will be available in the next version. 244KA/Pi syncing with KDE desktop will be available in the next version.
239 245
240 246
241********** VERSION 1.9.7 ************ 247********** VERSION 1.9.7 ************
242 248
243KO/Pi - KA/Pi on Windows: 249KO/Pi - KA/Pi on Windows:
244Now a directory can be defined by the user, where the 250Now a directory can be defined by the user, where the
245application/config data should be saved. 251application/config data should be saved.
246 Define your desired path in the evironment variable 252 Define your desired path in the evironment variable
247 MICROKDEHOME 253 MICROKDEHOME
248 before starting KO/Pi or KA/Pi. 254 before starting KO/Pi or KA/Pi.
249 255
250An easy Kx/Pi to Kx/Pi syncing is now possible 256An easy Kx/Pi to Kx/Pi syncing is now possible
251(it is called Pi-Sync) via network. 257(it is called Pi-Sync) via network.
252Please look at the Sync Howto. 258Please look at the Sync Howto.
253 259
254Exporting of calendar data and contacts to mobile phones is now possible. 260Exporting of calendar data and contacts to mobile phones is now possible.
255The SyncHowto is updated with information howto 261The SyncHowto is updated with information howto
256access/sync mobile phones. 262access/sync mobile phones.
257Please look at the Sync Howto. 263Please look at the Sync Howto.
258 264
259Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly. 265Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly.
260Please disable Fastload for the original contact/calendar applications 266Please disable Fastload for the original contact/calendar applications
261and close them. 267and close them.
262KO/Pi and KA/Pi must be running in order to receive the data. 268KO/Pi and KA/Pi must be running in order to receive the data.
263(KO/Pi and KA/Pi are always running if Fastload for them is enabled!) 269(KO/Pi and KA/Pi are always running if Fastload for them is enabled!)
264 270
265In the KA/Pi details view are now the preferred tel. numbers displayed on top 271In the KA/Pi details view are now the preferred tel. numbers displayed on top
266of the other data ( emails/tel.numbers/addresses) 272of the other data ( emails/tel.numbers/addresses)
267 273
268Fixed some syncing problems in KA/Pi. 274Fixed some syncing problems in KA/Pi.
269 275
270Added font settings for the KA/Pi details view. 276Added font settings for the KA/Pi details view.
271Added fields "children's name" and "gender" to KA/Pi. 277Added fields "children's name" and "gender" to KA/Pi.
272 278
273Made searching in KA/Pi better: 279Made searching in KA/Pi better:
274Now the first item in a view is selected after a search automatically and 280Now the first item in a view is selected after a search automatically and
275the views can be scrolled up/down when the search input field has the keyboard focus. 281the views can be scrolled up/down when the search input field has the keyboard focus.
276 282
277And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi. 283And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi.
278 284
279 285
280********** VERSION 1.9.6 ************ 286********** VERSION 1.9.6 ************
281 287
282Changes in the external application communication on the Zaurus 288Changes in the external application communication on the Zaurus
283in order to use less RAM when the apps are running. 289in order to use less RAM when the apps are running.
284First syncing of addressbooks (KA/Pi) is possible. 290First syncing of addressbooks (KA/Pi) is possible.
285 291
286 292
287********** VERSION 1.9.5a ************ 293********** VERSION 1.9.5a ************
288 294
289Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5. 295Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5.
290Fixed some small bugs. 296Fixed some small bugs.
291KA/Pi shows now the birthday in summary view. 297KA/Pi shows now the birthday in summary view.
292Now OM/Pi and KA/Pi are using the date format defined in KO/Pi 298Now OM/Pi and KA/Pi are using the date format defined in KO/Pi
293for displaying dates. 299for displaying dates.
294 300
295 301
296********** VERSION 1.9.5 ************ 302********** VERSION 1.9.5 ************
297 303
298There is still no Addressbook syncing! 304There is still no Addressbook syncing!
299 305
300New in 1.9.5: 306New in 1.9.5:
301 307
302Many bugfixes. 308Many bugfixes.
303Better searching in KA/Pi. 309Better searching in KA/Pi.
304You can configure in KA/Pi if you want to search only after 310You can configure in KA/Pi if you want to search only after
305<return> key pressed. 311<return> key pressed.
306 312
307Better mail downloading in OM/Pi. 313Better mail downloading in OM/Pi.
308 314
309First experimental alpha version of sync of KO/Pi with mobile phones. 315First experimental alpha version of sync of KO/Pi with mobile phones.
310See gammu documentation for supported phones. 316See gammu documentation for supported phones.
311You 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. 317You 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.
312Quick hint how to use: 318Quick hint how to use:
313NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL! 319NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL!
314Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp. 320Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp.
315Create syncprofile - mobile device 321Create syncprofile - mobile device
316Remove entry for model. (Leave empty ). 322Remove entry for model. (Leave empty ).
317Enable infrared on Zaurus and your Phone. 323Enable infrared on Zaurus and your Phone.
318Sync. 324Sync.
319To get a more detailed log, start kopi from konsole. 325To get a more detailed log, start kopi from konsole.
320 326
321********** VERSION 1.9.4 ************ 327********** VERSION 1.9.4 ************
322 328
323This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. 329This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus.
324 330
325WARNING: 331WARNING:
326PLEASE BACKUP ALL YOUR DATA! 332PLEASE BACKUP ALL YOUR DATA!
327We have changed a lot and maybe there are some unknown problems. 333We have changed a lot and maybe there are some unknown problems.
328 334
329SYNC HANDLING HAS CHANGED! 335SYNC HANDLING HAS CHANGED!
330Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. 336Such that, if you sync now with an already synded device, you will duplicated entries after the first sync.
331(This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). 337(This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks).
332 338
333You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs. 339You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs.
334If 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. 340If 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.
335 341
336As programs are available: 342As programs are available:
337KO/Pi (korganizer ipk) - a calendar program. 343KO/Pi (korganizer ipk) - a calendar program.
338KA/Pi (kaddressbook ipk ) - an addressbook 344KA/Pi (kaddressbook ipk ) - an addressbook
339OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support. 345OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support.
340 346
341An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode. 347An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode.
342(If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia) 348(If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia)
343 349
344All the applications are installed in a "Pim" TAB. 350All the applications are installed in a "Pim" TAB.
345If 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 351If 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
346 352
347All the application are integrated. 353All the application are integrated.
348Such 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. 354Such 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.
349 355
350HINT: 356HINT:
351If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number. 357If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number.
352 358
353What's new? 359What's new?
354 360
355SYNC HANDLING HAS CHANGED! 361SYNC HANDLING HAS CHANGED!
356Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. 362Such that, if you sync now with an already synded device, you will duplicated entries after the first sync.
357(This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). 363(This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks).
358 364
359New in OM/Pi: 365New in OM/Pi:
360When 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. 366When 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.
361 367
362New in KO/Pi: 368New in KO/Pi:
363French is now available for KO/Pi. 369French is now available for KO/Pi.
364Choose menu:Actions - Configure:TAB locale 370Choose menu:Actions - Configure:TAB locale
365Syncing has changed. 371Syncing has changed.
366Phone sync available soon. 372Phone sync available soon.
367Not much changes, I cannot remember them ... 373Not much changes, I cannot remember them ...
368 374
369New in KA/Pi: 375New in KA/Pi:
370Beaming possible. 376Beaming possible.
371Sharp DTM readonly access possible( create a new DTM resource ); 377Sharp DTM readonly access possible( create a new DTM resource );
372Better searching possible. 378Better searching possible.
373Search is performed only after pressing the return key. 379Search is performed only after pressing the return key.
374Use wildcard * to specify parts of a name. 380Use wildcard * to specify parts of a name.
375 381
376Better 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 * . 382Better 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 * .
377 383
378A big improvement is the new management of the contact access. 384A big improvement is the new management of the contact access.
379In version 1.9.3, every application was using their own addressbook access data. 385In version 1.9.3, every application was using their own addressbook access data.
380That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi. 386That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi.
381That was wasting of memory, if you had several hundreds of contacts. 387That was wasting of memory, if you had several hundreds of contacts.
382 388
383Now only KA/Pi accesses the addressbook. 389Now only KA/Pi accesses the addressbook.
384If 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. 390If 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.
385If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly. 391If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly.
386That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first. 392That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first.
387 393
388New in the KO/Pi alarm applet: 394New in the KO/Pi alarm applet:
389Configure your own timer popup menu! 395Configure your own timer popup menu!
390(Text and minutes for timer countdown) 396(Text and minutes for timer countdown)
391Just edit the file 397Just edit the file
392(yourhomedir)/.kopialarmtimerrc 398(yourhomedir)/.kopialarmtimerrc
393and start/stop a timer to get a new menu with the data of this file. 399and start/stop a timer to get a new menu with the data of this file.
394 400
395********** VERSION 1.9.3 ************ 401********** VERSION 1.9.3 ************
3961) 4021)
397Now KO/Pi on Windows imports directly the calendar data of 403Now KO/Pi on Windows imports directly the calendar data of
398an installed Outlook. Should work with OL version >= 2000. 404an installed Outlook. Should work with OL version >= 2000.
399 405
400********** VERSION 1.9.2 ************ 406********** VERSION 1.9.2 ************
4011) 4071)
402KDE-Pim/Pi has got a new member: 408KDE-Pim/Pi has got a new member:
403KmicroMail (KM/Pi) is a mail program, 409KmicroMail (KM/Pi) is a mail program,
404which can handle IMAP and POP mail access. 410which can handle IMAP and POP mail access.
405It is based on Opie-Mail v3. 411It is based on Opie-Mail v3.
406All dependencies to the Opie libraries ar removed, 412All dependencies to the Opie libraries ar removed,
407such that no additional Opie lib is needed. 413such that no additional Opie lib is needed.
408It is already integrated in KO/Pi and KA/Pi. 414It is already integrated in KO/Pi and KA/Pi.
409It it now available for the Zaurus,probably it 415It it now available for the Zaurus,probably it
410will be available for other platforms later. 416will be available for other platforms later.
411Hint: 417Hint:
412Create your own contact (name + email) 418Create your own contact (name + email)
413in KA/Pi, select this contact and choose menu: 419in KA/Pi, select this contact and choose menu:
414Settings - Set Who Am I. 420Settings - Set Who Am I.
415Now the settings of this contact are used as 421Now the settings of this contact are used as
416the sender data in KM/Pi. 422the sender data in KM/Pi.
4172) 4232)
418KDE-Pim/Pi is split up in five different 424KDE-Pim/Pi is split up in five different
419packages now precompiled for Sharp Zaurus: 425packages now precompiled for Sharp Zaurus:
420--kmicrokdelibs_1.9.2_arm.ipk 426--kmicrokdelibs_1.9.2_arm.ipk
421The libs are needed for any 427The libs are needed for any
422of the following programs: 428of the following programs:
423--kaddressbook_1.9.2_arm.ipk 429--kaddressbook_1.9.2_arm.ipk
424--kmicromail_1.9.2_arm.ipk 430--kmicromail_1.9.2_arm.ipk
425--korganizer_1.9.2_arm.ipk 431--korganizer_1.9.2_arm.ipk
426Independ from that, there is the alarm applet 432Independ from that, there is the alarm applet
427available for KO/Pi, which also offers 433available for KO/Pi, which also offers
428quick access for a new mail or 434quick access for a new mail or
429showing the addressbook.: 435showing the addressbook.:
430--korganizer-alarm_1.9.2_arm.ipk 436--korganizer-alarm_1.9.2_arm.ipk
431Independend means, that the alarm applet 437Independend means, that the alarm applet
432does not need any of the libs or programs above to run. 438does not need any of the libs or programs above to run.
433But it would be quite useless without these programs. 439But it would be quite useless without these programs.
434NOTE: 440NOTE:
435If you get a 441If you get a
436"This application depends on other programs" 442"This application depends on other programs"
437during installation of 443during installation of
438--kmicrokdelibs_1.9.2_arm.ipk 444--kmicrokdelibs_1.9.2_arm.ipk
439you probably do not have to care about that. 445you probably do not have to care about that.
440kmicrokdelibs_1.9.2 will come with some 446kmicrokdelibs_1.9.2 will come with some
441resource plugins, which needs additional libraries. 447resource plugins, which needs additional libraries.
442(E.g. libopie1, if you want to use the 448(E.g. libopie1, if you want to use the
443opie resource connector in KA/Pi). 449opie resource connector in KA/Pi).
444If you do not have this libraries installed, 450If you do not have this libraries installed,
445you simply cannot use the resource. 451you simply cannot use the resource.
446To make it clear: 452To make it clear:
447If the libraries are missing, the applications 453If the libraries are missing, the applications
448using kmicrokdelibs will start, 454using kmicrokdelibs will start,
449because the resources are plugins. 455because the resources are plugins.
4503) 4563)
451KO/Pi and friends are now installable on SD-Card! 457KO/Pi and friends are now installable on SD-Card!
452It is recommended to install all libs and apps 458It is recommended to install all libs and apps
453on the SD card or all in the internal storage. 459on the SD card or all in the internal storage.
454There may be problems, if this is mixed. 460There may be problems, if this is mixed.
4554) 4614)
456Fixed two bugs in the alarm notification on Windows. 462Fixed two bugs in the alarm notification on Windows.
4575) 4635)
458Great improvement! 464Great improvement!
459KO/Pi uses now the latest version of libical. 465KO/Pi uses now the latest version of libical.
460Libical is the library which actually reads 466Libical is the library which actually reads
461the calendar files and extract the data from it. 467the calendar files and extract the data from it.
462With the old version, there were problems 468With the old version, there were problems
463(crashes or program hangs) when licical did read 469(crashes or program hangs) when licical did read
464files, which were not stored from KO/Pi. 470files, which were not stored from KO/Pi.
465I do not know, if the new libical works perfect, 471I do not know, if the new libical works perfect,
466but actually it works much better than 472but actually it works much better than
467the old version. 473the old version.
468There are no problems with compatibility with 474There are no problems with compatibility with
469old calendar files of KO/Pi, of course! 475old calendar files of KO/Pi, of course!
4706) 4766)
471New in KA/Pi: 477New in KA/Pi:
472Opie addressbook resource connector available! 478Opie addressbook resource connector available!
473You will need libopie1 and the opie addressbook, 479You will need libopie1 and the opie addressbook,
474of course. 480of course.
475With the Opie addressbook resource connector, 481With the Opie addressbook resource connector,
476you can access the Opie addressbook readonly in KA/Pi. 482you can access the Opie addressbook readonly in KA/Pi.
477If you want to edit or import the data into KA/Pi, 483If you want to edit or import the data into KA/Pi,
478do this: 484do this:
479a) Create an Opie resource. 485a) Create an Opie resource.
480 (Menu: Settings-Configure Resources). 486 (Menu: Settings-Configure Resources).
481After configuration and restarting KA/Pi you should see 487After configuration and restarting KA/Pi you should see
482the Opie contacts in KA/Pi. 488the Opie contacts in KA/Pi.
483b) Select some or all Opie contacts. 489b) Select some or all Opie contacts.
484(NOTE: +++++ 490(NOTE: +++++
485To know exactly, what contacts are Opie contacts, 491To know exactly, what contacts are Opie contacts,
486do this: Choose menu: 492do this: Choose menu:
487View-Modify View - TAB Fields. 493View-Modify View - TAB Fields.
488Select in the above list "Resource" and click 494Select in the above list "Resource" and click
489down arrow to add it to the "Selected fields". 495down arrow to add it to the "Selected fields".
490Click OK. 496Click OK.
491Now you have a new column "Resource" in your list, 497Now you have a new column "Resource" in your list,
492where you can see, what an Opie resource is. 498where you can see, what an Opie resource is.
493++++ NOTE end.) 499++++ NOTE end.)
494Ok, we do have now some Opie contacts seleted. 500Ok, we do have now some Opie contacts seleted.
495(Use SHIFT or CTRL key in order to multiple select). 501(Use SHIFT or CTRL key in order to multiple select).
496c) Choose menu: Edit-Copy. 502c) Choose menu: Edit-Copy.
497d) Choose menu: Edit-Paste. 503d) Choose menu: Edit-Paste.
498e) Select the resource, you want to add the contacts to. 504e) Select the resource, you want to add the contacts to.
499Congrats! Now you have read/write access to the copied 505Congrats! Now you have read/write access to the copied
500opie contacts as "real" KA/Pi contacts. 506opie contacts as "real" KA/Pi contacts.
501 507
502 508
503********** VERSION 1.9.1 ************ 509********** VERSION 1.9.1 ************
5041) 5101)
505 +++ IMPORTANT 1 +++ 511 +++ IMPORTANT 1 +++
506 512
507The storing place of the default calendar 513The storing place of the default calendar
508file has changed! 514file has changed!
509The default calendar file was 515The default calendar file was
510Applications/korganizer/mycalendar.ics 516Applications/korganizer/mycalendar.ics
511on Zaurus and 517on Zaurus and
512(yourHomeDir)/korganizer/mycalendar.ics 518(yourHomeDir)/korganizer/mycalendar.ics
513on Windows/Linux desktop. Now it is 519on Windows/Linux desktop. Now it is
514(yourHomeDir)/kdepim/korganizer/mycalendar.ics 520(yourHomeDir)/kdepim/korganizer/mycalendar.ics
515on Zaurus, Windows and Linux. 521on Zaurus, Windows and Linux.
516To load the old file, choose menu 522To load the old file, choose menu
517File-Load calendar backup. 523File-Load calendar backup.
518(It should be loaded automatically 524(It should be loaded automatically
519at startup with a warning message displayed). 525at startup with a warning message displayed).
520The place of the configuration file has changed too. 526The place of the configuration file has changed too.
521If you want to use your old KO/Pi config, 527If you want to use your old KO/Pi config,
522copy it to 528copy it to
523(yourHomeDir)/kdepim/config/korganizerrc 529(yourHomeDir)/kdepim/config/korganizerrc
524Please read VERSION 1.9.0 - topic 3) as well! 530Please read VERSION 1.9.0 - topic 3) as well!
525 531
526 +++ IMPORTANT 2 +++ 532 +++ IMPORTANT 2 +++
527 533
528Because of the new paths, you will need 534Because of the new paths, you will need
529a new version of the KO/Pi alarm applet 535a new version of the KO/Pi alarm applet
530for Zaurus. 536for Zaurus.
531Use version >= 1.9.1 537Use version >= 1.9.1
532 538
5332) 5392)
534Now the QWhat'sThis Icon works for items 540Now the QWhat'sThis Icon works for items
535in the month view as well. 541in the month view as well.
536(See VERSION 1.7.8 Topic 1) ). 542(See VERSION 1.7.8 Topic 1) ).
5373) 5433)
538You can import birtsdays/anniversaries 544You can import birtsdays/anniversaries
539from KA/Pi into KO/Pi. 545from KA/Pi into KO/Pi.
540Choose menu File-Import birthdays. 546Choose menu File-Import birthdays.
541If you import twice, already imported items 547If you import twice, already imported items
542will not be imported again, if they 548will not be imported again, if they
543have not been changed in KO/Pi. 549have not been changed in KO/Pi.
5444) 5504)
545When syncing with sharp DTM, now a progress 551When syncing with sharp DTM, now a progress
546is shown, when the data is written back. 552is shown, when the data is written back.
547If there is much data in KO/Pi and no data 553If there is much data in KO/Pi and no data
548in DTM, that can take a long time. 554in DTM, that can take a long time.
549(But only for the first time ). 555(But only for the first time ).
5505) 5565)
551In the search dialog, you can search 557In the search dialog, you can search
552now for the name/email of an attendee 558now for the name/email of an attendee
553of an event/todo. 559of an event/todo.
554To get more space for displaying 560To get more space for displaying
555search results, the buttons 561search results, the buttons
556for "search" and "close" on the 562for "search" and "close" on the
557bottom are removed in the PDA version. 563bottom are removed in the PDA version.
558You have to click OK in the top right 564You have to click OK in the top right
559corner to do a search. 565corner to do a search.
5606) 5666)
561Now it is possible to disable the displaying 567Now it is possible to disable the displaying
562of todo items in the Allday part of the Agenda. 568of todo items in the Allday part of the Agenda.
563Choose Menu Action-Configure, 569Choose Menu Action-Configure,
564TAB Todo View, checkbox 570TAB Todo View, checkbox
565"Allday Agenda view shows todos" 571"Allday Agenda view shows todos"
5667) 5727)
567If FastLoad is enabled, now the settings and the 573If FastLoad is enabled, now the settings and the
568calendar data are saved, when KO/Pi is closed. 574calendar data are saved, when KO/Pi is closed.
569(If no Fastload is enabled, KO/Pi saves 575(If no Fastload is enabled, KO/Pi saves
570the data as well, of course) 576the data as well, of course)
5718) 5778)
572The Agenda View has a minimize-splitter now, 578The Agenda View has a minimize-splitter now,
573such that the height of the allday part can be 579such that the height of the allday part can be
574changed quickly. 580changed quickly.
575 581
576********** VERSION 1.9.0 ************ 582********** VERSION 1.9.0 ************
5771) 5831)
578KO/Pi is now merged with the new microKDE from KA/Pi. 584KO/Pi is now merged with the new microKDE from KA/Pi.
579KO/Pi accesses now KA/Pi as the addressbook. 585KO/Pi accesses now KA/Pi as the addressbook.
580The other ddressbook-plugins are not working any longer. 586The other ddressbook-plugins are not working any longer.
581(It is planned, that later KA/Pi itself uses these plugins) 587(It is planned, that later KA/Pi itself uses these plugins)
582New versions of KO/Pi are only available 588New versions of KO/Pi are only available
583together with KA/Pi as the KDE-Pim/Pi package. 589together with KA/Pi as the KDE-Pim/Pi package.
5842) 5902)
585If you click on an attendee of a meeting in the 591If you click on an attendee of a meeting in the
586event viewer, a detailed summary of the 592event viewer, a detailed summary of the
587attendee is shown. 593attendee is shown.
5883) 5943)
589The place of the configuration file has changed. 595The place of the configuration file has changed.
590If you want to use your old KO/Pi config, copy 596If you want to use your old KO/Pi config, copy
591Applications/korganizer/config_korganizerrc 597Applications/korganizer/config_korganizerrc
592to 598to
593Applications/korganizer/config/korganizerrc 599Applications/korganizer/config/korganizerrc
594 600
595********** VERSION 1.7.8 ************ 601********** VERSION 1.7.8 ************
5961) 6021)
597Now the QWhat'sThis ist working. 603Now the QWhat'sThis ist working.
598Enable the QWhat'sThis icon in the toolbar. 604Enable the QWhat'sThis icon in the toolbar.
599(You have to restart to reload the changed toolbar config). 605(You have to restart to reload the changed toolbar config).
600Now click on the QWhat'sThis Icon 606Now click on the QWhat'sThis Icon
601in the top right corner of KO/Pi. 607in the top right corner of KO/Pi.
602Then click on an item in the Agenda View: 608Then click on an item in the Agenda View:
603You will get a detailed display of the items content. 609You will get a detailed display of the items content.
6042) 6102)
605Some other very minor changes. 611Some other very minor changes.
606But I have forgotten the details ... 612But I have forgotten the details ...
607For that reason I start this log here: 613For that reason I start this log here:
608To document my changes, when I am doing it. 614To document my changes, when I am doing it.
609 615
610********** VERSION 1.7.7 ************ 616********** VERSION 1.7.7 ************
611Stable Version of KO/Pi 617Stable Version of KO/Pi
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 3908dbb..47cd488 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -458,3073 +458,3076 @@ void CalendarView::init()
458 mTodoEditor = mDialogManager->getTodoEditor(); 458 mTodoEditor = mDialogManager->getTodoEditor();
459 459
460 mFlagEditDescription = false; 460 mFlagEditDescription = false;
461 461
462 mSuspendTimer = new QTimer( this ); 462 mSuspendTimer = new QTimer( this );
463 mAlarmTimer = new QTimer( this ); 463 mAlarmTimer = new QTimer( this );
464 mRecheckAlarmTimer = new QTimer( this ); 464 mRecheckAlarmTimer = new QTimer( this );
465 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 465 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
466 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 466 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
467 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 467 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
468 mAlarmDialog = new AlarmDialog( this ); 468 mAlarmDialog = new AlarmDialog( this );
469 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 469 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
470 mAlarmDialog->setServerNotification( false ); 470 mAlarmDialog->setServerNotification( false );
471 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 471 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
472 472
473 473
474#ifndef DESKTOP_VERSION 474#ifndef DESKTOP_VERSION
475//US listen for arriving address resultsets 475//US listen for arriving address resultsets
476 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 476 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
477 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 477 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
478#endif 478#endif
479 479
480} 480}
481 481
482 482
483CalendarView::~CalendarView() 483CalendarView::~CalendarView()
484{ 484{
485 // kdDebug() << "~CalendarView()" << endl; 485 // kdDebug() << "~CalendarView()" << endl;
486 //qDebug("CalendarView::~CalendarView() "); 486 //qDebug("CalendarView::~CalendarView() ");
487 delete mDialogManager; 487 delete mDialogManager;
488 delete mViewManager; 488 delete mViewManager;
489 delete mStorage; 489 delete mStorage;
490 delete mDateFrame ; 490 delete mDateFrame ;
491 delete beamDialog; 491 delete beamDialog;
492 //kdDebug() << "~CalendarView() done" << endl; 492 //kdDebug() << "~CalendarView() done" << endl;
493} 493}
494void CalendarView::timerAlarm() 494void CalendarView::timerAlarm()
495{ 495{
496 //qDebug("CalendarView::timerAlarm() "); 496 //qDebug("CalendarView::timerAlarm() ");
497 computeAlarm(mAlarmNotification ); 497 computeAlarm(mAlarmNotification );
498} 498}
499 499
500void CalendarView::suspendAlarm() 500void CalendarView::suspendAlarm()
501{ 501{
502 //qDebug(" CalendarView::suspendAlarm() "); 502 //qDebug(" CalendarView::suspendAlarm() ");
503 computeAlarm(mSuspendAlarmNotification ); 503 computeAlarm(mSuspendAlarmNotification );
504 504
505} 505}
506 506
507void CalendarView::startAlarm( QString mess , QString filename) 507void CalendarView::startAlarm( QString mess , QString filename)
508{ 508{
509 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 509 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
510 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 510 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
511 511
512} 512}
513 513
514void CalendarView::checkNextTimerAlarm() 514void CalendarView::checkNextTimerAlarm()
515{ 515{
516 mCalendar->checkAlarmForIncidence( 0, true ); 516 mCalendar->checkAlarmForIncidence( 0, true );
517} 517}
518 518
519void CalendarView::computeAlarm( QString msg ) 519void CalendarView::computeAlarm( QString msg )
520{ 520{
521 521
522 QString mess = msg; 522 QString mess = msg;
523 QString mAlarmMessage = mess.mid( 9 ); 523 QString mAlarmMessage = mess.mid( 9 );
524 QString filename = MainWindow::resourcePath(); 524 QString filename = MainWindow::resourcePath();
525 filename += "koalarm.wav"; 525 filename += "koalarm.wav";
526 QString tempfilename; 526 QString tempfilename;
527 if ( mess.left( 13 ) == "suspend_alarm") { 527 if ( mess.left( 13 ) == "suspend_alarm") {
528 bool error = false; 528 bool error = false;
529 int len = mess.mid( 13 ).find("+++"); 529 int len = mess.mid( 13 ).find("+++");
530 if ( len < 2 ) 530 if ( len < 2 )
531 error = true; 531 error = true;
532 else { 532 else {
533 tempfilename = mess.mid( 13, len ); 533 tempfilename = mess.mid( 13, len );
534 if ( !QFile::exists( tempfilename ) ) 534 if ( !QFile::exists( tempfilename ) )
535 error = true; 535 error = true;
536 } 536 }
537 if ( ! error ) { 537 if ( ! error ) {
538 filename = tempfilename; 538 filename = tempfilename;
539 } 539 }
540 mAlarmMessage = mess.mid( 13+len+3 ); 540 mAlarmMessage = mess.mid( 13+len+3 );
541 //qDebug("suspend file %s ",tempfilename.latin1() ); 541 //qDebug("suspend file %s ",tempfilename.latin1() );
542 startAlarm( mAlarmMessage, filename); 542 startAlarm( mAlarmMessage, filename);
543 return; 543 return;
544 } 544 }
545 if ( mess.left( 11 ) == "timer_alarm") { 545 if ( mess.left( 11 ) == "timer_alarm") {
546 //mTimerTime = 0; 546 //mTimerTime = 0;
547 startAlarm( mess.mid( 11 ), filename ); 547 startAlarm( mess.mid( 11 ), filename );
548 return; 548 return;
549 } 549 }
550 if ( mess.left( 10 ) == "proc_alarm") { 550 if ( mess.left( 10 ) == "proc_alarm") {
551 bool error = false; 551 bool error = false;
552 int len = mess.mid( 10 ).find("+++"); 552 int len = mess.mid( 10 ).find("+++");
553 if ( len < 2 ) 553 if ( len < 2 )
554 error = true; 554 error = true;
555 else { 555 else {
556 tempfilename = mess.mid( 10, len ); 556 tempfilename = mess.mid( 10, len );
557 if ( !QFile::exists( tempfilename ) ) 557 if ( !QFile::exists( tempfilename ) )
558 error = true; 558 error = true;
559 } 559 }
560 if ( error ) { 560 if ( error ) {
561 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 561 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
562 mAlarmMessage += mess.mid( 10+len+3+9 ); 562 mAlarmMessage += mess.mid( 10+len+3+9 );
563 } else { 563 } else {
564 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 564 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
565 //qDebug("-----system command %s ",tempfilename.latin1() ); 565 //qDebug("-----system command %s ",tempfilename.latin1() );
566#ifndef _WIN32_ 566#ifndef _WIN32_
567 if ( vfork () == 0 ) { 567 if ( vfork () == 0 ) {
568 execl ( tempfilename.latin1(), 0 ); 568 execl ( tempfilename.latin1(), 0 );
569 return; 569 return;
570 } 570 }
571#else 571#else
572 QProcess* p = new QProcess(); 572 QProcess* p = new QProcess();
573 p->addArgument( tempfilename.latin1() ); 573 p->addArgument( tempfilename.latin1() );
574 p->start(); 574 p->start();
575 return; 575 return;
576#endif 576#endif
577 577
578 return; 578 return;
579 } 579 }
580 580
581 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 581 //qDebug("+++++++system command %s ",tempfilename.latin1() );
582 } 582 }
583 if ( mess.left( 11 ) == "audio_alarm") { 583 if ( mess.left( 11 ) == "audio_alarm") {
584 bool error = false; 584 bool error = false;
585 int len = mess.mid( 11 ).find("+++"); 585 int len = mess.mid( 11 ).find("+++");
586 if ( len < 2 ) 586 if ( len < 2 )
587 error = true; 587 error = true;
588 else { 588 else {
589 tempfilename = mess.mid( 11, len ); 589 tempfilename = mess.mid( 11, len );
590 if ( !QFile::exists( tempfilename ) ) 590 if ( !QFile::exists( tempfilename ) )
591 error = true; 591 error = true;
592 } 592 }
593 if ( ! error ) { 593 if ( ! error ) {
594 filename = tempfilename; 594 filename = tempfilename;
595 } 595 }
596 mAlarmMessage = mess.mid( 11+len+3+9 ); 596 mAlarmMessage = mess.mid( 11+len+3+9 );
597 //qDebug("audio file command %s ",tempfilename.latin1() ); 597 //qDebug("audio file command %s ",tempfilename.latin1() );
598 } 598 }
599 if ( mess.left( 9 ) == "cal_alarm") { 599 if ( mess.left( 9 ) == "cal_alarm") {
600 mAlarmMessage = mess.mid( 9 ) ; 600 mAlarmMessage = mess.mid( 9 ) ;
601 } 601 }
602 602
603 startAlarm( mAlarmMessage, filename ); 603 startAlarm( mAlarmMessage, filename );
604 604
605 605
606} 606}
607 607
608void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti ) 608void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
609{ 609{
610 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 610 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
611 611
612 mSuspendAlarmNotification = noti; 612 mSuspendAlarmNotification = noti;
613 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 613 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
614 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 614 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
615 mSuspendTimer->start( ms , true ); 615 mSuspendTimer->start( ms , true );
616 616
617} 617}
618 618
619void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 619void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
620{ 620{
621 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 621 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
622 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 622 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
623#ifndef DESKTOP_VERSION 623#ifndef DESKTOP_VERSION
624 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); 624 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() );
625#endif 625#endif
626 return; 626 return;
627 } 627 }
628 int maxSec; 628 int maxSec;
629 //maxSec = 5; //testing only 629 //maxSec = 5; //testing only
630 maxSec = 86400+3600; // one day+1hour 630 maxSec = 86400+3600; // one day+1hour
631 mAlarmNotification = noti; 631 mAlarmNotification = noti;
632 int sec = QDateTime::currentDateTime().secsTo( qdt ); 632 int sec = QDateTime::currentDateTime().secsTo( qdt );
633 if ( sec > maxSec ) { 633 if ( sec > maxSec ) {
634 mRecheckAlarmTimer->start( maxSec * 1000 ); 634 mRecheckAlarmTimer->start( maxSec * 1000 );
635 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 635 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
636 return; 636 return;
637 } else { 637 } else {
638 mRecheckAlarmTimer->stop(); 638 mRecheckAlarmTimer->stop();
639 } 639 }
640 //qDebug("Alarm timer started with secs: %d ", sec); 640 //qDebug("Alarm timer started with secs: %d ", sec);
641 mAlarmTimer->start( sec *1000 , true ); 641 mAlarmTimer->start( sec *1000 , true );
642 642
643} 643}
644// called by mRecheckAlarmTimer to get next alarm 644// called by mRecheckAlarmTimer to get next alarm
645// we need this, because a QTimer has only a max range of 25 days 645// we need this, because a QTimer has only a max range of 25 days
646void CalendarView::recheckTimerAlarm() 646void CalendarView::recheckTimerAlarm()
647{ 647{
648 mAlarmTimer->stop(); 648 mAlarmTimer->stop();
649 mRecheckAlarmTimer->stop(); 649 mRecheckAlarmTimer->stop();
650 mCalendar->checkAlarmForIncidence( 0, true ); 650 mCalendar->checkAlarmForIncidence( 0, true );
651} 651}
652void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti ) 652void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
653{ 653{
654 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 654 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
655 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 655 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
656#ifndef DESKTOP_VERSION 656#ifndef DESKTOP_VERSION
657 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); 657 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() );
658#endif 658#endif
659 return; 659 return;
660 } 660 }
661 mAlarmTimer->stop(); 661 mAlarmTimer->stop();
662} 662}
663void CalendarView::selectWeekNum ( int num ) 663void CalendarView::selectWeekNum ( int num )
664{ 664{
665 dateNavigator()->selectWeek( num ); 665 dateNavigator()->selectWeek( num );
666 mViewManager->showWeekView(); 666 mViewManager->showWeekView();
667} 667}
668KOViewManager *CalendarView::viewManager() 668KOViewManager *CalendarView::viewManager()
669{ 669{
670 return mViewManager; 670 return mViewManager;
671} 671}
672 672
673KODialogManager *CalendarView::dialogManager() 673KODialogManager *CalendarView::dialogManager()
674{ 674{
675 return mDialogManager; 675 return mDialogManager;
676} 676}
677 677
678QDate CalendarView::startDate() 678QDate CalendarView::startDate()
679{ 679{
680 DateList dates = mNavigator->selectedDates(); 680 DateList dates = mNavigator->selectedDates();
681 681
682 return dates.first(); 682 return dates.first();
683} 683}
684 684
685QDate CalendarView::endDate() 685QDate CalendarView::endDate()
686{ 686{
687 DateList dates = mNavigator->selectedDates(); 687 DateList dates = mNavigator->selectedDates();
688 688
689 return dates.last(); 689 return dates.last();
690} 690}
691 691
692 692
693void CalendarView::createPrinter() 693void CalendarView::createPrinter()
694{ 694{
695#ifndef KORG_NOPRINTER 695#ifndef KORG_NOPRINTER
696 if (!mCalPrinter) { 696 if (!mCalPrinter) {
697 mCalPrinter = new CalPrinter(this, mCalendar); 697 mCalPrinter = new CalPrinter(this, mCalendar);
698 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); 698 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig()));
699 } 699 }
700#endif 700#endif
701} 701}
702 702
703 703
704//KOPrefs::instance()->mWriteBackFile 704//KOPrefs::instance()->mWriteBackFile
705//KOPrefs::instance()->mWriteBackExistingOnly 705//KOPrefs::instance()->mWriteBackExistingOnly
706 706
707// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 707// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
708// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 708// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
709// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 709// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
710// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 710// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
711// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 711// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
712// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 712// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
713 713
714int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) 714int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full )
715{ 715{
716 716
717 // 0 equal 717 // 0 equal
718 // 1 take local 718 // 1 take local
719 // 2 take remote 719 // 2 take remote
720 // 3 cancel 720 // 3 cancel
721 QDateTime lastSync = mLastCalendarSync; 721 QDateTime lastSync = mLastCalendarSync;
722 QDateTime localMod = local->lastModified(); 722 QDateTime localMod = local->lastModified();
723 QDateTime remoteMod = remote->lastModified(); 723 QDateTime remoteMod = remote->lastModified();
724 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 724 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
725 bool remCh, locCh; 725 bool remCh, locCh;
726 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 726 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
727 //if ( remCh ) 727 //if ( remCh )
728 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 728 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
729 locCh = ( localMod > mLastCalendarSync ); 729 locCh = ( localMod > mLastCalendarSync );
730 if ( !remCh && ! locCh ) { 730 if ( !remCh && ! locCh ) {
731 //qDebug("both not changed "); 731 //qDebug("both not changed ");
732 lastSync = localMod.addDays(1); 732 lastSync = localMod.addDays(1);
733 if ( mode <= SYNC_PREF_ASK ) 733 if ( mode <= SYNC_PREF_ASK )
734 return 0; 734 return 0;
735 } else { 735 } else {
736 if ( locCh ) { 736 if ( locCh ) {
737 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); 737 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1());
738 lastSync = localMod.addDays( -1 ); 738 lastSync = localMod.addDays( -1 );
739 if ( !remCh ) 739 if ( !remCh )
740 remoteMod = ( lastSync.addDays( -1 ) ); 740 remoteMod = ( lastSync.addDays( -1 ) );
741 } else { 741 } else {
742 //qDebug(" not loc changed "); 742 //qDebug(" not loc changed ");
743 lastSync = localMod.addDays( 1 ); 743 lastSync = localMod.addDays( 1 );
744 if ( remCh ) 744 if ( remCh )
745 remoteMod =( lastSync.addDays( 1 ) ); 745 remoteMod =( lastSync.addDays( 1 ) );
746 746
747 } 747 }
748 } 748 }
749 full = true; 749 full = true;
750 if ( mode < SYNC_PREF_ASK ) 750 if ( mode < SYNC_PREF_ASK )
751 mode = SYNC_PREF_ASK; 751 mode = SYNC_PREF_ASK;
752 } else { 752 } else {
753 if ( localMod == remoteMod ) 753 if ( localMod == remoteMod )
754 // if ( local->revision() == remote->revision() ) 754 // if ( local->revision() == remote->revision() )
755 return 0; 755 return 0;
756 756
757 } 757 }
758 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 758 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
759 759
760 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); 760 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision());
761 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); 761 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() );
762 //full = true; //debug only 762 //full = true; //debug only
763 if ( full ) { 763 if ( full ) {
764 bool equ = false; 764 bool equ = false;
765 if ( local->type() == "Event" ) { 765 if ( local->type() == "Event" ) {
766 equ = (*((Event*) local) == *((Event*) remote)); 766 equ = (*((Event*) local) == *((Event*) remote));
767 } 767 }
768 else if ( local->type() =="Todo" ) 768 else if ( local->type() =="Todo" )
769 equ = (*((Todo*) local) == (*(Todo*) remote)); 769 equ = (*((Todo*) local) == (*(Todo*) remote));
770 else if ( local->type() =="Journal" ) 770 else if ( local->type() =="Journal" )
771 equ = (*((Journal*) local) == *((Journal*) remote)); 771 equ = (*((Journal*) local) == *((Journal*) remote));
772 if ( equ ) { 772 if ( equ ) {
773 //qDebug("equal "); 773 //qDebug("equal ");
774 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 774 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
775 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 775 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
776 } 776 }
777 if ( mode < SYNC_PREF_FORCE_LOCAL ) 777 if ( mode < SYNC_PREF_FORCE_LOCAL )
778 return 0; 778 return 0;
779 779
780 }//else //debug only 780 }//else //debug only
781 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 781 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
782 } 782 }
783 int result; 783 int result;
784 bool localIsNew; 784 bool localIsNew;
785 //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() ); 785 //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() );
786 786
787 if ( full && mode < SYNC_PREF_NEWEST ) 787 if ( full && mode < SYNC_PREF_NEWEST )
788 mode = SYNC_PREF_ASK; 788 mode = SYNC_PREF_ASK;
789 789
790 switch( mode ) { 790 switch( mode ) {
791 case SYNC_PREF_LOCAL: 791 case SYNC_PREF_LOCAL:
792 if ( lastSync > remoteMod ) 792 if ( lastSync > remoteMod )
793 return 1; 793 return 1;
794 if ( lastSync > localMod ) 794 if ( lastSync > localMod )
795 return 2; 795 return 2;
796 return 1; 796 return 1;
797 break; 797 break;
798 case SYNC_PREF_REMOTE: 798 case SYNC_PREF_REMOTE:
799 if ( lastSync > remoteMod ) 799 if ( lastSync > remoteMod )
800 return 1; 800 return 1;
801 if ( lastSync > localMod ) 801 if ( lastSync > localMod )
802 return 2; 802 return 2;
803 return 2; 803 return 2;
804 break; 804 break;
805 case SYNC_PREF_NEWEST: 805 case SYNC_PREF_NEWEST:
806 if ( localMod > remoteMod ) 806 if ( localMod > remoteMod )
807 return 1; 807 return 1;
808 else 808 else
809 return 2; 809 return 2;
810 break; 810 break;
811 case SYNC_PREF_ASK: 811 case SYNC_PREF_ASK:
812 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 812 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
813 if ( lastSync > remoteMod ) 813 if ( lastSync > remoteMod )
814 return 1; 814 return 1;
815 if ( lastSync > localMod ) 815 if ( lastSync > localMod )
816 return 2; 816 return 2;
817 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 817 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
818 localIsNew = localMod >= remoteMod; 818 localIsNew = localMod >= remoteMod;
819 if ( localIsNew ) 819 if ( localIsNew )
820 getEventViewerDialog()->setColorMode( 1 ); 820 getEventViewerDialog()->setColorMode( 1 );
821 else 821 else
822 getEventViewerDialog()->setColorMode( 2 ); 822 getEventViewerDialog()->setColorMode( 2 );
823 getEventViewerDialog()->setIncidence(local); 823 getEventViewerDialog()->setIncidence(local);
824 if ( localIsNew ) 824 if ( localIsNew )
825 getEventViewerDialog()->setColorMode( 2 ); 825 getEventViewerDialog()->setColorMode( 2 );
826 else 826 else
827 getEventViewerDialog()->setColorMode( 1 ); 827 getEventViewerDialog()->setColorMode( 1 );
828 getEventViewerDialog()->addIncidence(remote); 828 getEventViewerDialog()->addIncidence(remote);
829 getEventViewerDialog()->setColorMode( 0 ); 829 getEventViewerDialog()->setColorMode( 0 );
830 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); 830 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() );
831 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); 831 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!"));
832 getEventViewerDialog()->showMe(); 832 getEventViewerDialog()->showMe();
833 result = getEventViewerDialog()->executeS( localIsNew ); 833 result = getEventViewerDialog()->executeS( localIsNew );
834 return result; 834 return result;
835 835
836 break; 836 break;
837 case SYNC_PREF_FORCE_LOCAL: 837 case SYNC_PREF_FORCE_LOCAL:
838 return 1; 838 return 1;
839 break; 839 break;
840 case SYNC_PREF_FORCE_REMOTE: 840 case SYNC_PREF_FORCE_REMOTE:
841 return 2; 841 return 2;
842 break; 842 break;
843 843
844 default: 844 default:
845 // SYNC_PREF_TAKE_BOTH not implemented 845 // SYNC_PREF_TAKE_BOTH not implemented
846 break; 846 break;
847 } 847 }
848 return 0; 848 return 0;
849} 849}
850Event* CalendarView::getLastSyncEvent() 850Event* CalendarView::getLastSyncEvent()
851{ 851{
852 Event* lse; 852 Event* lse;
853 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 853 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
854 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); 854 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice );
855 if (!lse) { 855 if (!lse) {
856 lse = new Event(); 856 lse = new Event();
857 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); 857 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice );
858 QString sum = ""; 858 QString sum = "";
859 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) 859 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
860 sum = "E: "; 860 sum = "E: ";
861 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); 861 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
862 lse->setDtStart( mLastCalendarSync ); 862 lse->setDtStart( mLastCalendarSync );
863 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 863 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
864 lse->setCategories( i18n("SyncEvent") ); 864 lse->setCategories( i18n("SyncEvent") );
865 lse->setReadOnly( true ); 865 lse->setReadOnly( true );
866 mCalendar->addEvent( lse ); 866 mCalendar->addEvent( lse );
867 } 867 }
868 868
869 return lse; 869 return lse;
870 870
871} 871}
872 872
873// we check, if the to delete event has a id for a profile 873// we check, if the to delete event has a id for a profile
874// if yes, we set this id in the profile to delete 874// if yes, we set this id in the profile to delete
875void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) 875void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete )
876{ 876{
877 if ( lastSync.count() == 0 ) { 877 if ( lastSync.count() == 0 ) {
878 //qDebug(" lastSync.count() == 0"); 878 //qDebug(" lastSync.count() == 0");
879 return; 879 return;
880 } 880 }
881 if ( toDelete->type() == "Journal" ) 881 if ( toDelete->type() == "Journal" )
882 return; 882 return;
883 883
884 Event* eve = lastSync.first(); 884 Event* eve = lastSync.first();
885 885
886 while ( eve ) { 886 while ( eve ) {
887 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name 887 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
888 if ( !id.isEmpty() ) { 888 if ( !id.isEmpty() ) {
889 QString des = eve->description(); 889 QString des = eve->description();
890 QString pref = "e"; 890 QString pref = "e";
891 if ( toDelete->type() == "Todo" ) 891 if ( toDelete->type() == "Todo" )
892 pref = "t"; 892 pref = "t";
893 des += pref+ id + ","; 893 des += pref+ id + ",";
894 eve->setReadOnly( false ); 894 eve->setReadOnly( false );
895 eve->setDescription( des ); 895 eve->setDescription( des );
896 //qDebug("setdes %s ", des.latin1()); 896 //qDebug("setdes %s ", des.latin1());
897 eve->setReadOnly( true ); 897 eve->setReadOnly( true );
898 } 898 }
899 eve = lastSync.next(); 899 eve = lastSync.next();
900 } 900 }
901 901
902} 902}
903void CalendarView::checkExternalId( Incidence * inc ) 903void CalendarView::checkExternalId( Incidence * inc )
904{ 904{
905 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; 905 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ;
906 checkExternSyncEvent( lastSync, inc ); 906 checkExternSyncEvent( lastSync, inc );
907 907
908} 908}
909bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) 909bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
910{ 910{
911 bool syncOK = true; 911 bool syncOK = true;
912 int addedEvent = 0; 912 int addedEvent = 0;
913 int addedEventR = 0; 913 int addedEventR = 0;
914 int deletedEventR = 0; 914 int deletedEventR = 0;
915 int deletedEventL = 0; 915 int deletedEventL = 0;
916 int changedLocal = 0; 916 int changedLocal = 0;
917 int changedRemote = 0; 917 int changedRemote = 0;
918 //QPtrList<Event> el = local->rawEvents(); 918 //QPtrList<Event> el = local->rawEvents();
919 Event* eventR; 919 Event* eventR;
920 QString uid; 920 QString uid;
921 int take; 921 int take;
922 Event* eventL; 922 Event* eventL;
923 Event* eventRSync; 923 Event* eventRSync;
924 Event* eventLSync; 924 Event* eventLSync;
925 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); 925 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
926 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); 926 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
927 bool fullDateRange = false; 927 bool fullDateRange = false;
928 local->resetTempSyncStat(); 928 local->resetTempSyncStat();
929 mLastCalendarSync = QDateTime::currentDateTime(); 929 mLastCalendarSync = QDateTime::currentDateTime();
930 if ( mSyncManager->syncWithDesktop() ) { 930 if ( mSyncManager->syncWithDesktop() ) {
931 remote->resetPilotStat(1); 931 remote->resetPilotStat(1);
932 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 932 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
933 mLastCalendarSync = KSyncManager::mRequestedSyncEvent; 933 mLastCalendarSync = KSyncManager::mRequestedSyncEvent;
934 qDebug("using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); 934 qDebug("using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() );
935 } else { 935 } else {
936 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); 936 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime ");
937 } 937 }
938 } 938 }
939 QDateTime modifiedCalendar = mLastCalendarSync; 939 QDateTime modifiedCalendar = mLastCalendarSync;
940 eventLSync = getLastSyncEvent(); 940 eventLSync = getLastSyncEvent();
941 eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); 941 eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
942 if ( eventR ) { 942 if ( eventR ) {
943 eventRSync = (Event*) eventR->clone(); 943 eventRSync = (Event*) eventR->clone();
944 remote->deleteEvent(eventR ); 944 remote->deleteEvent(eventR );
945 945
946 } else { 946 } else {
947 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { 947 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) {
948 eventRSync = (Event*)eventLSync->clone(); 948 eventRSync = (Event*)eventLSync->clone();
949 } else { 949 } else {
950 fullDateRange = true; 950 fullDateRange = true;
951 eventRSync = new Event(); 951 eventRSync = new Event();
952 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); 952 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
953 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); 953 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName );
954 eventRSync->setDtStart( mLastCalendarSync ); 954 eventRSync->setDtStart( mLastCalendarSync );
955 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 955 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
956 eventRSync->setCategories( i18n("SyncEvent") ); 956 eventRSync->setCategories( i18n("SyncEvent") );
957 } 957 }
958 } 958 }
959 if ( eventLSync->dtStart() == mLastCalendarSync ) 959 if ( eventLSync->dtStart() == mLastCalendarSync )
960 fullDateRange = true; 960 fullDateRange = true;
961 961
962 if ( ! fullDateRange ) { 962 if ( ! fullDateRange ) {
963 if ( eventLSync->dtStart() != eventRSync->dtStart() ) { 963 if ( eventLSync->dtStart() != eventRSync->dtStart() ) {
964 964
965 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); 965 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() );
966 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); 966 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec());
967 fullDateRange = true; 967 fullDateRange = true;
968 } 968 }
969 } 969 }
970 if ( mSyncManager->syncWithDesktop() ) { 970 if ( mSyncManager->syncWithDesktop() ) {
971 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); 971 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync );
972 } 972 }
973 if ( fullDateRange ) 973 if ( fullDateRange )
974 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); 974 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
975 else 975 else
976 mLastCalendarSync = eventLSync->dtStart(); 976 mLastCalendarSync = eventLSync->dtStart();
977 // for resyncing if own file has changed 977 // for resyncing if own file has changed
978 if ( mCurrentSyncDevice == "deleteaftersync" ) { 978 if ( mCurrentSyncDevice == "deleteaftersync" ) {
979 mLastCalendarSync = loadedFileVersion; 979 mLastCalendarSync = loadedFileVersion;
980 //qDebug("setting mLastCalendarSync "); 980 //qDebug("setting mLastCalendarSync ");
981 } 981 }
982 //qDebug("*************************** "); 982 //qDebug("*************************** ");
983 qDebug("mLastCalendarSync %s full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); 983 qDebug("mLastCalendarSync %s full: %d",mLastCalendarSync.toString().latin1(), fullDateRange);
984 QPtrList<Incidence> er = remote->rawIncidences(); 984 QPtrList<Incidence> er = remote->rawIncidences();
985 Incidence* inR = er.first(); 985 Incidence* inR = er.first();
986 Incidence* inL; 986 Incidence* inL;
987 QProgressBar bar( er.count(),0 ); 987 QProgressBar bar( er.count(),0 );
988 bar.setCaption (i18n("Syncing - close to abort!") ); 988 bar.setCaption (i18n("Syncing - close to abort!") );
989 989
990 int w = 300; 990 int w = 300;
991 if ( QApplication::desktop()->width() < 320 ) 991 if ( QApplication::desktop()->width() < 320 )
992 w = 220; 992 w = 220;
993 int h = bar.sizeHint().height() ; 993 int h = bar.sizeHint().height() ;
994 int dw = QApplication::desktop()->width(); 994 int dw = QApplication::desktop()->width();
995 int dh = QApplication::desktop()->height(); 995 int dh = QApplication::desktop()->height();
996 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 996 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
997 bar.show(); 997 bar.show();
998 int modulo = (er.count()/10)+1; 998 int modulo = (er.count()/10)+1;
999 int incCounter = 0; 999 int incCounter = 0;
1000 while ( inR ) { 1000 while ( inR ) {
1001 if ( ! bar.isVisible() ) 1001 if ( ! bar.isVisible() )
1002 return false; 1002 return false;
1003 if ( incCounter % modulo == 0 ) 1003 if ( incCounter % modulo == 0 )
1004 bar.setProgress( incCounter ); 1004 bar.setProgress( incCounter );
1005 ++incCounter; 1005 ++incCounter;
1006 uid = inR->uid(); 1006 uid = inR->uid();
1007 bool skipIncidence = false; 1007 bool skipIncidence = false;
1008 if ( uid.left(15) == QString("last-syncEvent-") ) 1008 if ( uid.left(15) == QString("last-syncEvent-") )
1009 skipIncidence = true; 1009 skipIncidence = true;
1010 QString idS; 1010 QString idS;
1011 qApp->processEvents(); 1011 qApp->processEvents();
1012 if ( !skipIncidence ) { 1012 if ( !skipIncidence ) {
1013 inL = local->incidence( uid ); 1013 inL = local->incidence( uid );
1014 if ( inL ) { // maybe conflict - same uid in both calendars 1014 if ( inL ) { // maybe conflict - same uid in both calendars
1015 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { 1015 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) {
1016 //qDebug("take %d %s ", take, inL->summary().latin1()); 1016 //qDebug("take %d %s ", take, inL->summary().latin1());
1017 if ( take == 3 ) 1017 if ( take == 3 )
1018 return false; 1018 return false;
1019 if ( take == 1 ) {// take local ********************** 1019 if ( take == 1 ) {// take local **********************
1020 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 1020 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
1021 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1021 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1022 else 1022 else
1023 idS = inR->IDStr(); 1023 idS = inR->IDStr();
1024 remote->deleteIncidence( inR ); 1024 remote->deleteIncidence( inR );
1025 inR = inL->clone(); 1025 inR = inL->clone();
1026 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1026 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1027 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) 1027 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL )
1028 inR->setIDStr( idS ); 1028 inR->setIDStr( idS );
1029 remote->addIncidence( inR ); 1029 remote->addIncidence( inR );
1030 if ( mSyncManager->syncWithDesktop() ) 1030 if ( mSyncManager->syncWithDesktop() )
1031 inR->setPilotId( 2 ); 1031 inR->setPilotId( 2 );
1032 ++changedRemote; 1032 ++changedRemote;
1033 } else {// take remote ********************** 1033 } else {// take remote **********************
1034 idS = inL->IDStr(); 1034 idS = inL->IDStr();
1035 int pid = inL->pilotId(); 1035 int pid = inL->pilotId();
1036 local->deleteIncidence( inL ); 1036 local->deleteIncidence( inL );
1037 inL = inR->clone(); 1037 inL = inR->clone();
1038 if ( mSyncManager->syncWithDesktop() ) 1038 if ( mSyncManager->syncWithDesktop() )
1039 inL->setPilotId( pid ); 1039 inL->setPilotId( pid );
1040 inL->setIDStr( idS ); 1040 inL->setIDStr( idS );
1041 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1041 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1042 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1042 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1043 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1043 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1044 } 1044 }
1045 local->addIncidence( inL ); 1045 local->addIncidence( inL );
1046 ++changedLocal; 1046 ++changedLocal;
1047 } 1047 }
1048 } 1048 }
1049 } else { // no conflict ********** add or delete remote 1049 } else { // no conflict ********** add or delete remote
1050 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1050 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1051 QString des = eventLSync->description(); 1051 QString des = eventLSync->description();
1052 QString pref = "e"; 1052 QString pref = "e";
1053 if ( inR->type() == "Todo" ) 1053 if ( inR->type() == "Todo" )
1054 pref = "t"; 1054 pref = "t";
1055 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 1055 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
1056 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 1056 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
1057 //remote->deleteIncidence( inR ); 1057 //remote->deleteIncidence( inR );
1058 ++deletedEventR; 1058 ++deletedEventR;
1059 } else { 1059 } else {
1060 inR->setLastModified( modifiedCalendar ); 1060 inR->setLastModified( modifiedCalendar );
1061 inL = inR->clone(); 1061 inL = inR->clone();
1062 inL->setIDStr( ":" ); 1062 inL->setIDStr( ":" );
1063 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1063 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1064 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1064 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1065 local->addIncidence( inL ); 1065 local->addIncidence( inL );
1066 ++addedEvent; 1066 ++addedEvent;
1067 } 1067 }
1068 } else { 1068 } else {
1069 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { 1069 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
1070 inR->setLastModified( modifiedCalendar ); 1070 inR->setLastModified( modifiedCalendar );
1071 inL = inR->clone(); 1071 inL = inR->clone();
1072 inL->setIDStr( ":" ); 1072 inL->setIDStr( ":" );
1073 local->addIncidence( inL ); 1073 local->addIncidence( inL );
1074 ++addedEvent; 1074 ++addedEvent;
1075 } else { 1075 } else {
1076 checkExternSyncEvent(eventRSyncSharp, inR); 1076 checkExternSyncEvent(eventRSyncSharp, inR);
1077 remote->deleteIncidence( inR ); 1077 remote->deleteIncidence( inR );
1078 ++deletedEventR; 1078 ++deletedEventR;
1079 } 1079 }
1080 } 1080 }
1081 } 1081 }
1082 } 1082 }
1083 inR = er.next(); 1083 inR = er.next();
1084 } 1084 }
1085 QPtrList<Incidence> el = local->rawIncidences(); 1085 QPtrList<Incidence> el = local->rawIncidences();
1086 inL = el.first(); 1086 inL = el.first();
1087 modulo = (el.count()/10)+1; 1087 modulo = (el.count()/10)+1;
1088 bar.setCaption (i18n("Add / remove events") ); 1088 bar.setCaption (i18n("Add / remove events") );
1089 bar.setTotalSteps ( el.count() ) ; 1089 bar.setTotalSteps ( el.count() ) ;
1090 bar.show(); 1090 bar.show();
1091 incCounter = 0; 1091 incCounter = 0;
1092 1092
1093 while ( inL ) { 1093 while ( inL ) {
1094 1094
1095 qApp->processEvents(); 1095 qApp->processEvents();
1096 if ( ! bar.isVisible() ) 1096 if ( ! bar.isVisible() )
1097 return false; 1097 return false;
1098 if ( incCounter % modulo == 0 ) 1098 if ( incCounter % modulo == 0 )
1099 bar.setProgress( incCounter ); 1099 bar.setProgress( incCounter );
1100 ++incCounter; 1100 ++incCounter;
1101 uid = inL->uid(); 1101 uid = inL->uid();
1102 bool skipIncidence = false; 1102 bool skipIncidence = false;
1103 if ( uid.left(15) == QString("last-syncEvent-") ) 1103 if ( uid.left(15) == QString("last-syncEvent-") )
1104 skipIncidence = true; 1104 skipIncidence = true;
1105 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) 1105 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
1106 skipIncidence = true; 1106 skipIncidence = true;
1107 if ( !skipIncidence ) { 1107 if ( !skipIncidence ) {
1108 inR = remote->incidence( uid ); 1108 inR = remote->incidence( uid );
1109 if ( ! inR ) { // no conflict ********** add or delete local 1109 if ( ! inR ) { // no conflict ********** add or delete local
1110 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1110 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1111 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 1111 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
1112 checkExternSyncEvent(eventLSyncSharp, inL); 1112 checkExternSyncEvent(eventLSyncSharp, inL);
1113 local->deleteIncidence( inL ); 1113 local->deleteIncidence( inL );
1114 ++deletedEventL; 1114 ++deletedEventL;
1115 } else { 1115 } else {
1116 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1116 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1117 inL->removeID(mCurrentSyncDevice ); 1117 inL->removeID(mCurrentSyncDevice );
1118 ++addedEventR; 1118 ++addedEventR;
1119 //qDebug("remote added Incidence %s ", inL->summary().latin1()); 1119 //qDebug("remote added Incidence %s ", inL->summary().latin1());
1120 inL->setLastModified( modifiedCalendar ); 1120 inL->setLastModified( modifiedCalendar );
1121 inR = inL->clone(); 1121 inR = inL->clone();
1122 inR->setIDStr( ":" ); 1122 inR->setIDStr( ":" );
1123 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1123 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1124 remote->addIncidence( inR ); 1124 remote->addIncidence( inR );
1125 } 1125 }
1126 } 1126 }
1127 } else { 1127 } else {
1128 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { 1128 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
1129 checkExternSyncEvent(eventLSyncSharp, inL); 1129 checkExternSyncEvent(eventLSyncSharp, inL);
1130 local->deleteIncidence( inL ); 1130 local->deleteIncidence( inL );
1131 ++deletedEventL; 1131 ++deletedEventL;
1132 } else { 1132 } else {
1133 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1133 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1134 ++addedEventR; 1134 ++addedEventR;
1135 inL->setLastModified( modifiedCalendar ); 1135 inL->setLastModified( modifiedCalendar );
1136 inR = inL->clone(); 1136 inR = inL->clone();
1137 inR->setIDStr( ":" ); 1137 inR->setIDStr( ":" );
1138 remote->addIncidence( inR ); 1138 remote->addIncidence( inR );
1139 } 1139 }
1140 } 1140 }
1141 } 1141 }
1142 } 1142 }
1143 } 1143 }
1144 inL = el.next(); 1144 inL = el.next();
1145 } 1145 }
1146 int delFut = 0; 1146 int delFut = 0;
1147 int remRem = 0; 1147 int remRem = 0;
1148 if ( mSyncManager->mWriteBackInFuture ) { 1148 if ( mSyncManager->mWriteBackInFuture ) {
1149 er = remote->rawIncidences(); 1149 er = remote->rawIncidences();
1150 remRem = er.count(); 1150 remRem = er.count();
1151 inR = er.first(); 1151 inR = er.first();
1152 QDateTime dt; 1152 QDateTime dt;
1153 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1153 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1154 QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 ); 1154 QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 );
1155 while ( inR ) { 1155 while ( inR ) {
1156 if ( inR->type() == "Todo" ) { 1156 if ( inR->type() == "Todo" ) {
1157 Todo * t = (Todo*)inR; 1157 Todo * t = (Todo*)inR;
1158 if ( t->hasDueDate() ) 1158 if ( t->hasDueDate() )
1159 dt = t->dtDue(); 1159 dt = t->dtDue();
1160 else 1160 else
1161 dt = cur.addSecs( 62 ); 1161 dt = cur.addSecs( 62 );
1162 } 1162 }
1163 else if (inR->type() == "Event" ) { 1163 else if (inR->type() == "Event" ) {
1164 bool ok; 1164 bool ok;
1165 dt = inR->getNextOccurence( cur, &ok ); 1165 dt = inR->getNextOccurence( cur, &ok );
1166 if ( !ok ) 1166 if ( !ok )
1167 dt = cur.addSecs( -62 ); 1167 dt = cur.addSecs( -62 );
1168 } 1168 }
1169 else 1169 else
1170 dt = inR->dtStart(); 1170 dt = inR->dtStart();
1171 if ( dt < cur || dt > end ) { 1171 if ( dt < cur || dt > end ) {
1172 remote->deleteIncidence( inR ); 1172 remote->deleteIncidence( inR );
1173 ++delFut; 1173 ++delFut;
1174 } 1174 }
1175 inR = er.next(); 1175 inR = er.next();
1176 } 1176 }
1177 } 1177 }
1178 bar.hide(); 1178 bar.hide();
1179 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1179 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1180 eventLSync->setReadOnly( false ); 1180 eventLSync->setReadOnly( false );
1181 eventLSync->setDtStart( mLastCalendarSync ); 1181 eventLSync->setDtStart( mLastCalendarSync );
1182 eventRSync->setDtStart( mLastCalendarSync ); 1182 eventRSync->setDtStart( mLastCalendarSync );
1183 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1183 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1184 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1184 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1185 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1185 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1186 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1186 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1187 eventLSync->setReadOnly( true ); 1187 eventLSync->setReadOnly( true );
1188 qDebug("********** %d %d ", mGlobalSyncMode == SYNC_MODE_NORMAL, mSyncManager->syncWithDesktop() ); 1188 qDebug("********** %d %d ", mGlobalSyncMode == SYNC_MODE_NORMAL, mSyncManager->syncWithDesktop() );
1189 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... 1189 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal...
1190 remote->addEvent( eventRSync ); 1190 remote->addEvent( eventRSync );
1191 else 1191 else
1192 delete eventRSync; 1192 delete eventRSync;
1193 QString mes; 1193 QString mes;
1194 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"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); 1194 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"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR );
1195 QString delmess; 1195 QString delmess;
1196 if ( delFut ) { 1196 if ( delFut ) {
1197 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut); 1197 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut);
1198 mes += delmess; 1198 mes += delmess;
1199 } 1199 }
1200 mes = i18n("Local calendar changed!\n") +mes; 1200 mes = i18n("Local calendar changed!\n") +mes;
1201 mCalendar->checkAlarmForIncidence( 0, true ); 1201 mCalendar->checkAlarmForIncidence( 0, true );
1202 qDebug( mes ); 1202 qDebug( mes );
1203 if ( mSyncManager->mShowSyncSummary ) { 1203 if ( mSyncManager->mShowSyncSummary ) {
1204 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, 1204 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
1205 i18n("KO/Pi Synchronization"),i18n("Write back"))) { 1205 i18n("KO/Pi Synchronization"),i18n("Write back"))) {
1206 qDebug("cancelled "); 1206 qDebug("cancelled ");
1207 return false; 1207 return false;
1208 } 1208 }
1209 } 1209 }
1210 return syncOK; 1210 return syncOK;
1211} 1211}
1212 1212
1213void CalendarView::setSyncDevice( QString s ) 1213void CalendarView::setSyncDevice( QString s )
1214{ 1214{
1215 mCurrentSyncDevice= s; 1215 mCurrentSyncDevice= s;
1216} 1216}
1217void CalendarView::setSyncName( QString s ) 1217void CalendarView::setSyncName( QString s )
1218{ 1218{
1219 mCurrentSyncName= s; 1219 mCurrentSyncName= s;
1220} 1220}
1221bool CalendarView::syncCalendar(QString filename, int mode) 1221bool CalendarView::syncCalendar(QString filename, int mode)
1222{ 1222{
1223 //qDebug("syncCalendar %s ", filename.latin1()); 1223 //qDebug("syncCalendar %s ", filename.latin1());
1224 mGlobalSyncMode = SYNC_MODE_NORMAL; 1224 mGlobalSyncMode = SYNC_MODE_NORMAL;
1225 CalendarLocal* calendar = new CalendarLocal(); 1225 CalendarLocal* calendar = new CalendarLocal();
1226 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1226 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1227 FileStorage* storage = new FileStorage( calendar ); 1227 FileStorage* storage = new FileStorage( calendar );
1228 bool syncOK = false; 1228 bool syncOK = false;
1229 storage->setFileName( filename ); 1229 storage->setFileName( filename );
1230 // qDebug("loading ... "); 1230 // qDebug("loading ... ");
1231 if ( storage->load() ) { 1231 if ( storage->load() ) {
1232 getEventViewerDialog()->setSyncMode( true ); 1232 getEventViewerDialog()->setSyncMode( true );
1233 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1233 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1234 getEventViewerDialog()->setSyncMode( false ); 1234 getEventViewerDialog()->setSyncMode( false );
1235 if ( syncOK ) { 1235 if ( syncOK ) {
1236 if ( mSyncManager->mWriteBackFile ) 1236 if ( mSyncManager->mWriteBackFile )
1237 { 1237 {
1238 storage->setSaveFormat( new ICalFormat() ); 1238 storage->setSaveFormat( new ICalFormat() );
1239 storage->save(); 1239 storage->save();
1240 } 1240 }
1241 } 1241 }
1242 setModified( true ); 1242 setModified( true );
1243 } 1243 }
1244 delete storage; 1244 delete storage;
1245 delete calendar; 1245 delete calendar;
1246 if ( syncOK ) 1246 if ( syncOK )
1247 updateView(); 1247 updateView();
1248 return syncOK; 1248 return syncOK;
1249} 1249}
1250 1250
1251void CalendarView::syncExternal( int mode ) 1251void CalendarView::syncExternal( int mode )
1252{ 1252{
1253 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1253 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1254 1254
1255 qApp->processEvents(); 1255 qApp->processEvents();
1256 CalendarLocal* calendar = new CalendarLocal(); 1256 CalendarLocal* calendar = new CalendarLocal();
1257 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1257 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1258 bool syncOK = false; 1258 bool syncOK = false;
1259 bool loadSuccess = false; 1259 bool loadSuccess = false;
1260 PhoneFormat* phoneFormat = 0; 1260 PhoneFormat* phoneFormat = 0;
1261 emit tempDisableBR(true); 1261 emit tempDisableBR(true);
1262#ifndef DESKTOP_VERSION 1262#ifndef DESKTOP_VERSION
1263 SharpFormat* sharpFormat = 0; 1263 SharpFormat* sharpFormat = 0;
1264 if ( mode == 0 ) { // sharp 1264 if ( mode == 0 ) { // sharp
1265 sharpFormat = new SharpFormat () ; 1265 sharpFormat = new SharpFormat () ;
1266 loadSuccess = sharpFormat->load( calendar, mCalendar ); 1266 loadSuccess = sharpFormat->load( calendar, mCalendar );
1267 1267
1268 } else 1268 } else
1269#endif 1269#endif
1270 if ( mode == 1 ) { // phone 1270 if ( mode == 1 ) { // phone
1271 phoneFormat = new PhoneFormat (mCurrentSyncDevice, 1271 phoneFormat = new PhoneFormat (mCurrentSyncDevice,
1272 mSyncManager->mPhoneDevice, 1272 mSyncManager->mPhoneDevice,
1273 mSyncManager->mPhoneConnection, 1273 mSyncManager->mPhoneConnection,
1274 mSyncManager->mPhoneModel); 1274 mSyncManager->mPhoneModel);
1275 loadSuccess = phoneFormat->load( calendar,mCalendar); 1275 loadSuccess = phoneFormat->load( calendar,mCalendar);
1276 1276
1277 } else { 1277 } else {
1278 emit tempDisableBR(false); 1278 emit tempDisableBR(false);
1279 return; 1279 return;
1280 } 1280 }
1281 if ( loadSuccess ) { 1281 if ( loadSuccess ) {
1282 getEventViewerDialog()->setSyncMode( true ); 1282 getEventViewerDialog()->setSyncMode( true );
1283 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1283 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1284 getEventViewerDialog()->setSyncMode( false ); 1284 getEventViewerDialog()->setSyncMode( false );
1285 qApp->processEvents(); 1285 qApp->processEvents();
1286 if ( syncOK ) { 1286 if ( syncOK ) {
1287 if ( mSyncManager->mWriteBackFile ) 1287 if ( mSyncManager->mWriteBackFile )
1288 { 1288 {
1289 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1289 QPtrList<Incidence> iL = mCalendar->rawIncidences();
1290 Incidence* inc = iL.first(); 1290 Incidence* inc = iL.first();
1291 if ( phoneFormat ) { 1291 if ( phoneFormat ) {
1292 while ( inc ) { 1292 while ( inc ) {
1293 inc->removeID(mCurrentSyncDevice); 1293 inc->removeID(mCurrentSyncDevice);
1294 inc = iL.next(); 1294 inc = iL.next();
1295 } 1295 }
1296 } 1296 }
1297#ifndef DESKTOP_VERSION 1297#ifndef DESKTOP_VERSION
1298 if ( sharpFormat ) 1298 if ( sharpFormat )
1299 sharpFormat->save(calendar); 1299 sharpFormat->save(calendar);
1300#endif 1300#endif
1301 if ( phoneFormat ) 1301 if ( phoneFormat )
1302 phoneFormat->save(calendar); 1302 phoneFormat->save(calendar);
1303 iL = calendar->rawIncidences(); 1303 iL = calendar->rawIncidences();
1304 inc = iL.first(); 1304 inc = iL.first();
1305 Incidence* loc; 1305 Incidence* loc;
1306 while ( inc ) { 1306 while ( inc ) {
1307 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 1307 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
1308 loc = mCalendar->incidence(inc->uid() ); 1308 loc = mCalendar->incidence(inc->uid() );
1309 if ( loc ) { 1309 if ( loc ) {
1310 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); 1310 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
1311 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); 1311 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
1312 } 1312 }
1313 } 1313 }
1314 inc = iL.next(); 1314 inc = iL.next();
1315 } 1315 }
1316 Incidence* lse = getLastSyncEvent(); 1316 Incidence* lse = getLastSyncEvent();
1317 if ( lse ) { 1317 if ( lse ) {
1318 lse->setReadOnly( false ); 1318 lse->setReadOnly( false );
1319 lse->setDescription( "" ); 1319 lse->setDescription( "" );
1320 lse->setReadOnly( true ); 1320 lse->setReadOnly( true );
1321 } 1321 }
1322 } 1322 }
1323 } else { 1323 } else {
1324 topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); 1324 topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") );
1325 } 1325 }
1326 setModified( true ); 1326 setModified( true );
1327 } else { 1327 } else {
1328 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; 1328 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
1329 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), 1329 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
1330 question, i18n("Ok")) ; 1330 question, i18n("Ok")) ;
1331 1331
1332 } 1332 }
1333 delete calendar; 1333 delete calendar;
1334 updateView(); 1334 updateView();
1335 emit tempDisableBR(false); 1335 emit tempDisableBR(false);
1336 return ;//syncOK; 1336 return ;//syncOK;
1337 1337
1338} 1338}
1339 1339
1340bool CalendarView::importBday() 1340bool CalendarView::importBday()
1341{ 1341{
1342#ifndef KORG_NOKABC 1342#ifndef KORG_NOKABC
1343 1343
1344#ifdef DESKTOP_VERSION 1344#ifdef DESKTOP_VERSION
1345 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 1345 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
1346 KABC::AddressBook::Iterator it; 1346 KABC::AddressBook::Iterator it;
1347 int count = 0; 1347 int count = 0;
1348 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1348 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1349 ++count; 1349 ++count;
1350 } 1350 }
1351 QProgressBar bar(count,0 ); 1351 QProgressBar bar(count,0 );
1352 int w = 300; 1352 int w = 300;
1353 if ( QApplication::desktop()->width() < 320 ) 1353 if ( QApplication::desktop()->width() < 320 )
1354 w = 220; 1354 w = 220;
1355 int h = bar.sizeHint().height() ; 1355 int h = bar.sizeHint().height() ;
1356 int dw = QApplication::desktop()->width(); 1356 int dw = QApplication::desktop()->width();
1357 int dh = QApplication::desktop()->height(); 1357 int dh = QApplication::desktop()->height();
1358 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1358 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1359 bar.show(); 1359 bar.show();
1360 bar.setCaption (i18n("Reading addressbook - close to abort!") ); 1360 bar.setCaption (i18n("Reading addressbook - close to abort!") );
1361 qApp->processEvents(); 1361 qApp->processEvents();
1362 count = 0; 1362 count = 0;
1363 int addCount = 0; 1363 int addCount = 0;
1364 KCal::Attendee* a = 0; 1364 KCal::Attendee* a = 0;
1365 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1365 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1366 if ( ! bar.isVisible() ) 1366 if ( ! bar.isVisible() )
1367 return false; 1367 return false;
1368 bar.setProgress( count++ ); 1368 bar.setProgress( count++ );
1369 qApp->processEvents(); 1369 qApp->processEvents();
1370 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); 1370 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() );
1371 if ( (*it).birthday().date().isValid() ){ 1371 if ( (*it).birthday().date().isValid() ){
1372 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1372 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1373 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) 1373 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) )
1374 ++addCount; 1374 ++addCount;
1375 } 1375 }
1376 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); 1376 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d");
1377 if ( anni.isValid() ){ 1377 if ( anni.isValid() ){
1378 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1378 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1379 if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) 1379 if ( addAnniversary( anni, (*it).assembledName(), a, false ) )
1380 ++addCount; 1380 ++addCount;
1381 } 1381 }
1382 } 1382 }
1383 updateView(); 1383 updateView();
1384 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1384 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1385#else //DESKTOP_VERSION 1385#else //DESKTOP_VERSION
1386 1386
1387 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 1387 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
1388 // the result should now arrive through method insertBirthdays 1388 // the result should now arrive through method insertBirthdays
1389 1389
1390#endif //DESKTOP_VERSION 1390#endif //DESKTOP_VERSION
1391 1391
1392#endif //KORG_NOKABC 1392#endif //KORG_NOKABC
1393 1393
1394 1394
1395 return true; 1395 return true;
1396} 1396}
1397 1397
1398// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI 1398// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI
1399void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, 1399void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList,
1400 const QStringList& anniversaryList, const QStringList& realNameList, 1400 const QStringList& anniversaryList, const QStringList& realNameList,
1401 const QStringList& emailList, const QStringList& assembledNameList, 1401 const QStringList& emailList, const QStringList& assembledNameList,
1402 const QStringList& uidList) 1402 const QStringList& uidList)
1403{ 1403{
1404 qDebug("CalendarView::insertBirthdays"); 1404 qDebug("CalendarView::insertBirthdays");
1405 if (uid == this->name()) 1405 if (uid == this->name())
1406 { 1406 {
1407 int count = birthdayList.count(); 1407 int count = birthdayList.count();
1408 int addCount = 0; 1408 int addCount = 0;
1409 KCal::Attendee* a = 0; 1409 KCal::Attendee* a = 0;
1410 1410
1411 qDebug("CalView 1 %i", count); 1411 qDebug("CalView 1 %i", count);
1412 1412
1413 QProgressBar bar(count,0 ); 1413 QProgressBar bar(count,0 );
1414 int w = 300; 1414 int w = 300;
1415 if ( QApplication::desktop()->width() < 320 ) 1415 if ( QApplication::desktop()->width() < 320 )
1416 w = 220; 1416 w = 220;
1417 int h = bar.sizeHint().height() ; 1417 int h = bar.sizeHint().height() ;
1418 int dw = QApplication::desktop()->width(); 1418 int dw = QApplication::desktop()->width();
1419 int dh = QApplication::desktop()->height(); 1419 int dh = QApplication::desktop()->height();
1420 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1420 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1421 bar.show(); 1421 bar.show();
1422 bar.setCaption (i18n("inserting birthdays - close to abort!") ); 1422 bar.setCaption (i18n("inserting birthdays - close to abort!") );
1423 qApp->processEvents(); 1423 qApp->processEvents();
1424 1424
1425 QDate birthday; 1425 QDate birthday;
1426 QDate anniversary; 1426 QDate anniversary;
1427 QString realName; 1427 QString realName;
1428 QString email; 1428 QString email;
1429 QString assembledName; 1429 QString assembledName;
1430 QString uid; 1430 QString uid;
1431 bool ok = true; 1431 bool ok = true;
1432 for ( int i = 0; i < count; i++) 1432 for ( int i = 0; i < count; i++)
1433 { 1433 {
1434 if ( ! bar.isVisible() ) 1434 if ( ! bar.isVisible() )
1435 return; 1435 return;
1436 bar.setProgress( i ); 1436 bar.setProgress( i );
1437 qApp->processEvents(); 1437 qApp->processEvents();
1438 1438
1439 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); 1439 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok);
1440 if (!ok) { 1440 if (!ok) {
1441 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); 1441 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1());
1442 } 1442 }
1443 1443
1444 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); 1444 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok);
1445 if (!ok) { 1445 if (!ok) {
1446 ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); 1446 ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1());
1447 } 1447 }
1448 realName = realNameList[i]; 1448 realName = realNameList[i];
1449 email = emailList[i]; 1449 email = emailList[i];
1450 assembledName = assembledNameList[i]; 1450 assembledName = assembledNameList[i];
1451 uid = uidList[i]; 1451 uid = uidList[i];
1452 //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() ); 1452 //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() );
1453 1453
1454 if ( birthday.isValid() ){ 1454 if ( birthday.isValid() ){
1455 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, 1455 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1456 KCal::Attendee::ReqParticipant,uid) ; 1456 KCal::Attendee::ReqParticipant,uid) ;
1457 if ( addAnniversary( birthday, assembledName, a, true ) ) 1457 if ( addAnniversary( birthday, assembledName, a, true ) )
1458 ++addCount; 1458 ++addCount;
1459 } 1459 }
1460 1460
1461 if ( anniversary.isValid() ){ 1461 if ( anniversary.isValid() ){
1462 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, 1462 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1463 KCal::Attendee::ReqParticipant,uid) ; 1463 KCal::Attendee::ReqParticipant,uid) ;
1464 if ( addAnniversary( anniversary, assembledName, a, false ) ) 1464 if ( addAnniversary( anniversary, assembledName, a, false ) )
1465 ++addCount; 1465 ++addCount;
1466 } 1466 }
1467 } 1467 }
1468 1468
1469 updateView(); 1469 updateView();
1470 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1470 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1471 1471
1472 } 1472 }
1473 1473
1474} 1474}
1475 1475
1476 1476
1477 1477
1478bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) 1478bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday)
1479{ 1479{
1480 //qDebug("addAnni "); 1480 //qDebug("addAnni ");
1481 Event * ev = new Event(); 1481 Event * ev = new Event();
1482 if ( a ) { 1482 if ( a ) {
1483 ev->addAttendee( a ); 1483 ev->addAttendee( a );
1484 } 1484 }
1485 QString kind; 1485 QString kind;
1486 if ( birthday ) 1486 if ( birthday )
1487 kind = i18n( "Birthday" ); 1487 kind = i18n( "Birthday" );
1488 else 1488 else
1489 kind = i18n( "Anniversary" ); 1489 kind = i18n( "Anniversary" );
1490 ev->setSummary( name + " - " + kind ); 1490 ev->setSummary( name + " - " + kind );
1491 ev->setOrganizer(a->email()); 1491 ev->setOrganizer(a->email());
1492 ev->setCategories( kind ); 1492 ev->setCategories( kind );
1493 ev->setDtStart( QDateTime(date) ); 1493 ev->setDtStart( QDateTime(date) );
1494 ev->setDtEnd( QDateTime(date) ); 1494 ev->setDtEnd( QDateTime(date) );
1495 ev->setFloats( true ); 1495 ev->setFloats( true );
1496 Recurrence * rec = ev->recurrence(); 1496 Recurrence * rec = ev->recurrence();
1497 rec->setYearly(Recurrence::rYearlyMonth,1,-1); 1497 rec->setYearly(Recurrence::rYearlyMonth,1,-1);
1498 rec->addYearlyNum( date.month() ); 1498 rec->addYearlyNum( date.month() );
1499 if ( !mCalendar->addAnniversaryNoDup( ev ) ) { 1499 if ( !mCalendar->addAnniversaryNoDup( ev ) ) {
1500 delete ev; 1500 delete ev;
1501 return false; 1501 return false;
1502 } 1502 }
1503 return true; 1503 return true;
1504 1504
1505} 1505}
1506bool CalendarView::importQtopia( const QString &categories, 1506bool CalendarView::importQtopia( const QString &categories,
1507 const QString &datebook, 1507 const QString &datebook,
1508 const QString &todolist ) 1508 const QString &todolist )
1509{ 1509{
1510 1510
1511 QtopiaFormat qtopiaFormat; 1511 QtopiaFormat qtopiaFormat;
1512 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1512 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1513 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); 1513 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories );
1514 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); 1514 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook );
1515 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); 1515 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist );
1516 1516
1517 updateView(); 1517 updateView();
1518 return true; 1518 return true;
1519 1519
1520#if 0 1520#if 0
1521 mGlobalSyncMode = SYNC_MODE_QTOPIA; 1521 mGlobalSyncMode = SYNC_MODE_QTOPIA;
1522 mCurrentSyncDevice = "qtopia-XML"; 1522 mCurrentSyncDevice = "qtopia-XML";
1523 if ( mSyncManager->mAskForPreferences ) 1523 if ( mSyncManager->mAskForPreferences )
1524 edit_sync_options(); 1524 edit_sync_options();
1525 qApp->processEvents(); 1525 qApp->processEvents();
1526 CalendarLocal* calendar = new CalendarLocal(); 1526 CalendarLocal* calendar = new CalendarLocal();
1527 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1527 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1528 bool syncOK = false; 1528 bool syncOK = false;
1529 QtopiaFormat qtopiaFormat; 1529 QtopiaFormat qtopiaFormat;
1530 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1530 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1531 bool loadOk = true; 1531 bool loadOk = true;
1532 if ( !categories.isEmpty() ) 1532 if ( !categories.isEmpty() )
1533 loadOk = qtopiaFormat.load( calendar, categories ); 1533 loadOk = qtopiaFormat.load( calendar, categories );
1534 if ( loadOk && !datebook.isEmpty() ) 1534 if ( loadOk && !datebook.isEmpty() )
1535 loadOk = qtopiaFormat.load( calendar, datebook ); 1535 loadOk = qtopiaFormat.load( calendar, datebook );
1536 if ( loadOk && !todolist.isEmpty() ) 1536 if ( loadOk && !todolist.isEmpty() )
1537 loadOk = qtopiaFormat.load( calendar, todolist ); 1537 loadOk = qtopiaFormat.load( calendar, todolist );
1538 1538
1539 if ( loadOk ) { 1539 if ( loadOk ) {
1540 getEventViewerDialog()->setSyncMode( true ); 1540 getEventViewerDialog()->setSyncMode( true );
1541 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1541 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1542 getEventViewerDialog()->setSyncMode( false ); 1542 getEventViewerDialog()->setSyncMode( false );
1543 qApp->processEvents(); 1543 qApp->processEvents();
1544 if ( syncOK ) { 1544 if ( syncOK ) {
1545 if ( mSyncManager->mWriteBackFile ) 1545 if ( mSyncManager->mWriteBackFile )
1546 { 1546 {
1547 // write back XML file 1547 // write back XML file
1548 1548
1549 } 1549 }
1550 setModified( true ); 1550 setModified( true );
1551 } 1551 }
1552 } else { 1552 } else {
1553 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; 1553 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ;
1554 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), 1554 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"),
1555 question, i18n("Ok")) ; 1555 question, i18n("Ok")) ;
1556 } 1556 }
1557 delete calendar; 1557 delete calendar;
1558 updateView(); 1558 updateView();
1559 return syncOK; 1559 return syncOK;
1560 1560
1561 1561
1562#endif 1562#endif
1563 1563
1564} 1564}
1565 1565
1566void CalendarView::setSyncEventsReadOnly() 1566void CalendarView::setSyncEventsReadOnly()
1567{ 1567{
1568 Event * ev; 1568 Event * ev;
1569 QPtrList<Event> eL = mCalendar->rawEvents(); 1569 QPtrList<Event> eL = mCalendar->rawEvents();
1570 ev = eL.first(); 1570 ev = eL.first();
1571 while ( ev ) { 1571 while ( ev ) {
1572 if ( ev->uid().left(15) == QString("last-syncEvent-") ) 1572 if ( ev->uid().left(15) == QString("last-syncEvent-") )
1573 ev->setReadOnly( true ); 1573 ev->setReadOnly( true );
1574 ev = eL.next(); 1574 ev = eL.next();
1575 } 1575 }
1576} 1576}
1577bool CalendarView::openCalendar(QString filename, bool merge) 1577bool CalendarView::openCalendar(QString filename, bool merge)
1578{ 1578{
1579 1579
1580 if (filename.isEmpty()) { 1580 if (filename.isEmpty()) {
1581 return false; 1581 return false;
1582 } 1582 }
1583 1583
1584 if (!QFile::exists(filename)) { 1584 if (!QFile::exists(filename)) {
1585 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); 1585 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename));
1586 return false; 1586 return false;
1587 } 1587 }
1588 1588
1589 globalFlagBlockAgenda = 1; 1589 globalFlagBlockAgenda = 1;
1590 if (!merge) mCalendar->close(); 1590 if (!merge) mCalendar->close();
1591 1591
1592 mStorage->setFileName( filename ); 1592 mStorage->setFileName( filename );
1593 1593
1594 if ( mStorage->load() ) { 1594 if ( mStorage->load() ) {
1595 if ( merge ) ;//setModified( true ); 1595 if ( merge ) ;//setModified( true );
1596 else { 1596 else {
1597 //setModified( true ); 1597 //setModified( true );
1598 mViewManager->setDocumentId( filename ); 1598 mViewManager->setDocumentId( filename );
1599 mDialogManager->setDocumentId( filename ); 1599 mDialogManager->setDocumentId( filename );
1600 mTodoList->setDocumentId( filename ); 1600 mTodoList->setDocumentId( filename );
1601 } 1601 }
1602 globalFlagBlockAgenda = 2; 1602 globalFlagBlockAgenda = 2;
1603 // if ( getLastSyncEvent() ) 1603 // if ( getLastSyncEvent() )
1604 // getLastSyncEvent()->setReadOnly( true ); 1604 // getLastSyncEvent()->setReadOnly( true );
1605 mCalendar->reInitAlarmSettings(); 1605 mCalendar->reInitAlarmSettings();
1606 setSyncEventsReadOnly(); 1606 setSyncEventsReadOnly();
1607 updateUnmanagedViews(); 1607 updateUnmanagedViews();
1608 updateView(); 1608 updateView();
1609 if ( filename != MainWindow::defaultFileName() ) { 1609 if ( filename != MainWindow::defaultFileName() ) {
1610 saveCalendar( MainWindow::defaultFileName() ); 1610 saveCalendar( MainWindow::defaultFileName() );
1611 } else { 1611 } else {
1612 QFileInfo finf ( MainWindow::defaultFileName()); 1612 QFileInfo finf ( MainWindow::defaultFileName());
1613 if ( finf.exists() ) { 1613 if ( finf.exists() ) {
1614 setLoadedFileVersion( finf.lastModified () ); 1614 setLoadedFileVersion( finf.lastModified () );
1615 } 1615 }
1616 } 1616 }
1617 return true; 1617 return true;
1618 } else { 1618 } else {
1619 // while failing to load, the calendar object could 1619 // while failing to load, the calendar object could
1620 // have become partially populated. Clear it out. 1620 // have become partially populated. Clear it out.
1621 if ( !merge ) { 1621 if ( !merge ) {
1622 mCalendar->close(); 1622 mCalendar->close();
1623 mViewManager->setDocumentId( filename ); 1623 mViewManager->setDocumentId( filename );
1624 mDialogManager->setDocumentId( filename ); 1624 mDialogManager->setDocumentId( filename );
1625 mTodoList->setDocumentId( filename ); 1625 mTodoList->setDocumentId( filename );
1626 } 1626 }
1627 1627
1628 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); 1628 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename));
1629 1629
1630 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); 1630 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) );
1631 globalFlagBlockAgenda = 2; 1631 globalFlagBlockAgenda = 2;
1632 mCalendar->reInitAlarmSettings(); 1632 mCalendar->reInitAlarmSettings();
1633 setSyncEventsReadOnly(); 1633 setSyncEventsReadOnly();
1634 updateUnmanagedViews(); 1634 updateUnmanagedViews();
1635 updateView(); 1635 updateView();
1636 } 1636 }
1637 return false; 1637 return false;
1638} 1638}
1639void CalendarView::showOpenError() 1639void CalendarView::showOpenError()
1640{ 1640{
1641 KMessageBox::error(this,i18n("Couldn't load calendar\n.")); 1641 KMessageBox::error(this,i18n("Couldn't load calendar\n."));
1642} 1642}
1643void CalendarView::setLoadedFileVersion(QDateTime dt) 1643void CalendarView::setLoadedFileVersion(QDateTime dt)
1644{ 1644{
1645 loadedFileVersion = dt; 1645 loadedFileVersion = dt;
1646} 1646}
1647bool CalendarView::checkFileChanged(QString fn) 1647bool CalendarView::checkFileChanged(QString fn)
1648{ 1648{
1649 QFileInfo finf ( fn ); 1649 QFileInfo finf ( fn );
1650 if ( !finf.exists() ) 1650 if ( !finf.exists() )
1651 return true; 1651 return true;
1652 QDateTime dt = finf.lastModified (); 1652 QDateTime dt = finf.lastModified ();
1653 if ( dt <= loadedFileVersion ) 1653 if ( dt <= loadedFileVersion )
1654 return false; 1654 return false;
1655 return true; 1655 return true;
1656 1656
1657} 1657}
1658void CalendarView::watchSavedFile() 1658void CalendarView::watchSavedFile()
1659{ 1659{
1660 QFileInfo finf ( MainWindow::defaultFileName()); 1660 QFileInfo finf ( MainWindow::defaultFileName());
1661 if ( !finf.exists() ) 1661 if ( !finf.exists() )
1662 return; 1662 return;
1663 QDateTime dt = finf.lastModified (); 1663 QDateTime dt = finf.lastModified ();
1664 if ( dt < loadedFileVersion ) { 1664 if ( dt < loadedFileVersion ) {
1665 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); 1665 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1());
1666 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); 1666 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) );
1667 return; 1667 return;
1668 } 1668 }
1669 loadedFileVersion = dt; 1669 loadedFileVersion = dt;
1670} 1670}
1671 1671
1672bool CalendarView::checkFileVersion(QString fn) 1672bool CalendarView::checkFileVersion(QString fn)
1673{ 1673{
1674 QFileInfo finf ( fn ); 1674 QFileInfo finf ( fn );
1675 if ( !finf.exists() ) 1675 if ( !finf.exists() )
1676 return true; 1676 return true;
1677 QDateTime dt = finf.lastModified (); 1677 QDateTime dt = finf.lastModified ();
1678 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); 1678 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1());
1679 //qDebug("file on disk version %s",dt.toString().latin1()); 1679 //qDebug("file on disk version %s",dt.toString().latin1());
1680 if ( dt <= loadedFileVersion ) 1680 if ( dt <= loadedFileVersion )
1681 return true; 1681 return true;
1682 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)) , 1682 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)) ,
1683 i18n("KO/Pi Warning"),i18n("Overwrite"), 1683 i18n("KO/Pi Warning"),i18n("Overwrite"),
1684 i18n("Sync+save")); 1684 i18n("Sync+save"));
1685 1685
1686 if ( km == KMessageBox::Cancel ) 1686 if ( km == KMessageBox::Cancel )
1687 return false; 1687 return false;
1688 if ( km == KMessageBox::Yes ) 1688 if ( km == KMessageBox::Yes )
1689 return true; 1689 return true;
1690 1690
1691 setSyncDevice("deleteaftersync" ); 1691 setSyncDevice("deleteaftersync" );
1692 mSyncManager->mAskForPreferences = true; 1692 mSyncManager->mAskForPreferences = true;
1693 mSyncManager->mSyncAlgoPrefs = 3; 1693 mSyncManager->mSyncAlgoPrefs = 3;
1694 mSyncManager->mWriteBackFile = false; 1694 mSyncManager->mWriteBackFile = false;
1695 mSyncManager->mWriteBackExistingOnly = false; 1695 mSyncManager->mWriteBackExistingOnly = false;
1696 mSyncManager->mShowSyncSummary = false; 1696 mSyncManager->mShowSyncSummary = false;
1697 syncCalendar( fn, 3 ); 1697 syncCalendar( fn, 3 );
1698 Event * e = getLastSyncEvent(); 1698 Event * e = getLastSyncEvent();
1699 mCalendar->deleteEvent ( e ); 1699 mCalendar->deleteEvent ( e );
1700 updateView(); 1700 updateView();
1701 return true; 1701 return true;
1702} 1702}
1703 1703
1704bool CalendarView::saveCalendar( QString filename ) 1704bool CalendarView::saveCalendar( QString filename )
1705{ 1705{
1706 1706
1707 // Store back all unsaved data into calendar object 1707 // Store back all unsaved data into calendar object
1708 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); 1708 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() );
1709 if ( mViewManager->currentView() ) 1709 if ( mViewManager->currentView() )
1710 mViewManager->currentView()->flushView(); 1710 mViewManager->currentView()->flushView();
1711 1711
1712 1712
1713 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); 1713 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2);
1714 mStorage->setSaveFormat( new ICalFormat() ); 1714 mStorage->setSaveFormat( new ICalFormat() );
1715 mStorage->setFileName( filename ); 1715 mStorage->setFileName( filename );
1716 bool success; 1716 bool success;
1717 success = mStorage->save(); 1717 success = mStorage->save();
1718 if ( !success ) { 1718 if ( !success ) {
1719 return false; 1719 return false;
1720 } 1720 }
1721 if ( filename == MainWindow::defaultFileName() ) { 1721 if ( filename == MainWindow::defaultFileName() ) {
1722 setLoadedFileVersion( lfv ); 1722 setLoadedFileVersion( lfv );
1723 watchSavedFile(); 1723 watchSavedFile();
1724 } 1724 }
1725 return true; 1725 return true;
1726} 1726}
1727 1727
1728void CalendarView::closeCalendar() 1728void CalendarView::closeCalendar()
1729{ 1729{
1730 1730
1731 // child windows no longer valid 1731 // child windows no longer valid
1732 emit closingDown(); 1732 emit closingDown();
1733 1733
1734 mCalendar->close(); 1734 mCalendar->close();
1735 setModified(false); 1735 setModified(false);
1736 updateView(); 1736 updateView();
1737} 1737}
1738 1738
1739void CalendarView::archiveCalendar() 1739void CalendarView::archiveCalendar()
1740{ 1740{
1741 mDialogManager->showArchiveDialog(); 1741 mDialogManager->showArchiveDialog();
1742} 1742}
1743 1743
1744 1744
1745void CalendarView::readSettings() 1745void CalendarView::readSettings()
1746{ 1746{
1747 1747
1748 1748
1749 // mViewManager->showAgendaView(); 1749 // mViewManager->showAgendaView();
1750 QString str; 1750 QString str;
1751 //qDebug("CalendarView::readSettings() "); 1751 //qDebug("CalendarView::readSettings() ");
1752 // read settings from the KConfig, supplying reasonable 1752 // read settings from the KConfig, supplying reasonable
1753 // defaults where none are to be found 1753 // defaults where none are to be found
1754 KConfig *config = KOGlobals::config(); 1754 KConfig *config = KOGlobals::config();
1755#ifndef KORG_NOSPLITTER 1755#ifndef KORG_NOSPLITTER
1756 config->setGroup("KOrganizer Geometry"); 1756 config->setGroup("KOrganizer Geometry");
1757 1757
1758 QValueList<int> sizes = config->readIntListEntry("Separator1"); 1758 QValueList<int> sizes = config->readIntListEntry("Separator1");
1759 if (sizes.count() != 2) { 1759 if (sizes.count() != 2) {
1760 sizes << mDateNavigator->minimumSizeHint().width(); 1760 sizes << mDateNavigator->minimumSizeHint().width();
1761 sizes << 300; 1761 sizes << 300;
1762 } 1762 }
1763 mPanner->setSizes(sizes); 1763 mPanner->setSizes(sizes);
1764 1764
1765 sizes = config->readIntListEntry("Separator2"); 1765 sizes = config->readIntListEntry("Separator2");
1766 if ( ( mResourceView && sizes.count() == 4 ) || 1766 if ( ( mResourceView && sizes.count() == 4 ) ||
1767 ( !mResourceView && sizes.count() == 3 ) ) { 1767 ( !mResourceView && sizes.count() == 3 ) ) {
1768 mLeftSplitter->setSizes(sizes); 1768 mLeftSplitter->setSizes(sizes);
1769 } 1769 }
1770#endif 1770#endif
1771 globalFlagBlockAgenda = 1; 1771 globalFlagBlockAgenda = 1;
1772 mViewManager->showAgendaView(); 1772 mViewManager->showAgendaView();
1773 //mViewManager->readSettings( config ); 1773 //mViewManager->readSettings( config );
1774 mTodoList->restoreLayout(config,QString("Todo Layout")); 1774 mTodoList->restoreLayout(config,QString("Todo Layout"));
1775 readFilterSettings(config); 1775 readFilterSettings(config);
1776 config->setGroup( "Views" ); 1776 config->setGroup( "Views" );
1777 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 1777 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
1778 if ( dateCount == 5 ) mNavigator->selectWorkWeek(); 1778 if ( dateCount == 5 ) mNavigator->selectWorkWeek();
1779 else if ( dateCount == 7 ) mNavigator->selectWeek(); 1779 else if ( dateCount == 7 ) mNavigator->selectWeek();
1780 else mNavigator->selectDates( dateCount ); 1780 else mNavigator->selectDates( dateCount );
1781 // mViewManager->readSettings( config ); 1781 // mViewManager->readSettings( config );
1782 updateConfig(); 1782 updateConfig();
1783 globalFlagBlockAgenda = 2; 1783 globalFlagBlockAgenda = 2;
1784 mViewManager->readSettings( config ); 1784 mViewManager->readSettings( config );
1785#ifdef DESKTOP_VERSION 1785#ifdef DESKTOP_VERSION
1786 config->setGroup("WidgetLayout"); 1786 config->setGroup("WidgetLayout");
1787 QStringList list; 1787 QStringList list;
1788 list = config->readListEntry("MainLayout"); 1788 list = config->readListEntry("MainLayout");
1789 int x,y,w,h; 1789 int x,y,w,h;
1790 if ( ! list.isEmpty() ) { 1790 if ( ! list.isEmpty() ) {
1791 x = list[0].toInt(); 1791 x = list[0].toInt();
1792 y = list[1].toInt(); 1792 y = list[1].toInt();
1793 w = list[2].toInt(); 1793 w = list[2].toInt();
1794 h = list[3].toInt(); 1794 h = list[3].toInt();
1795 topLevelWidget()->setGeometry(x,y,w,h); 1795 topLevelWidget()->setGeometry(x,y,w,h);
1796 1796
1797 } else { 1797 } else {
1798 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 1798 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
1799 } 1799 }
1800 list = config->readListEntry("EditEventLayout"); 1800 list = config->readListEntry("EditEventLayout");
1801 if ( ! list.isEmpty() ) { 1801 if ( ! list.isEmpty() ) {
1802 x = list[0].toInt(); 1802 x = list[0].toInt();
1803 y = list[1].toInt(); 1803 y = list[1].toInt();
1804 w = list[2].toInt(); 1804 w = list[2].toInt();
1805 h = list[3].toInt(); 1805 h = list[3].toInt();
1806 mEventEditor->setGeometry(x,y,w,h); 1806 mEventEditor->setGeometry(x,y,w,h);
1807 1807
1808 } 1808 }
1809 list = config->readListEntry("EditTodoLayout"); 1809 list = config->readListEntry("EditTodoLayout");
1810 if ( ! list.isEmpty() ) { 1810 if ( ! list.isEmpty() ) {
1811 x = list[0].toInt(); 1811 x = list[0].toInt();
1812 y = list[1].toInt(); 1812 y = list[1].toInt();
1813 w = list[2].toInt(); 1813 w = list[2].toInt();
1814 h = list[3].toInt(); 1814 h = list[3].toInt();
1815 mTodoEditor->setGeometry(x,y,w,h); 1815 mTodoEditor->setGeometry(x,y,w,h);
1816 1816
1817 } 1817 }
1818 list = config->readListEntry("ViewerLayout"); 1818 list = config->readListEntry("ViewerLayout");
1819 if ( ! list.isEmpty() ) { 1819 if ( ! list.isEmpty() ) {
1820 x = list[0].toInt(); 1820 x = list[0].toInt();
1821 y = list[1].toInt(); 1821 y = list[1].toInt();
1822 w = list[2].toInt(); 1822 w = list[2].toInt();
1823 h = list[3].toInt(); 1823 h = list[3].toInt();
1824 getEventViewerDialog()->setGeometry(x,y,w,h); 1824 getEventViewerDialog()->setGeometry(x,y,w,h);
1825 } 1825 }
1826#endif 1826#endif
1827 1827
1828} 1828}
1829 1829
1830 1830
1831void CalendarView::writeSettings() 1831void CalendarView::writeSettings()
1832{ 1832{
1833 // kdDebug() << "CalendarView::writeSettings" << endl; 1833 // kdDebug() << "CalendarView::writeSettings" << endl;
1834 1834
1835 KConfig *config = KOGlobals::config(); 1835 KConfig *config = KOGlobals::config();
1836 1836
1837#ifndef KORG_NOSPLITTER 1837#ifndef KORG_NOSPLITTER
1838 config->setGroup("KOrganizer Geometry"); 1838 config->setGroup("KOrganizer Geometry");
1839 1839
1840 QValueList<int> list = mPanner->sizes(); 1840 QValueList<int> list = mPanner->sizes();
1841 config->writeEntry("Separator1",list); 1841 config->writeEntry("Separator1",list);
1842 1842
1843 list = mLeftSplitter->sizes(); 1843 list = mLeftSplitter->sizes();
1844 config->writeEntry("Separator2",list); 1844 config->writeEntry("Separator2",list);
1845#endif 1845#endif
1846 1846
1847 mViewManager->writeSettings( config ); 1847 mViewManager->writeSettings( config );
1848 mTodoList->saveLayout(config,QString("Todo Layout")); 1848 mTodoList->saveLayout(config,QString("Todo Layout"));
1849 mDialogManager->writeSettings( config ); 1849 mDialogManager->writeSettings( config );
1850 //KOPrefs::instance()->usrWriteConfig(); 1850 //KOPrefs::instance()->usrWriteConfig();
1851 KOPrefs::instance()->writeConfig(); 1851 KOPrefs::instance()->writeConfig();
1852 1852
1853 writeFilterSettings(config); 1853 writeFilterSettings(config);
1854 1854
1855 config->setGroup( "Views" ); 1855 config->setGroup( "Views" );
1856 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); 1856 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
1857 1857
1858#ifdef DESKTOP_VERSION 1858#ifdef DESKTOP_VERSION
1859 config->setGroup("WidgetLayout"); 1859 config->setGroup("WidgetLayout");
1860 QStringList list ;//= config->readListEntry("MainLayout"); 1860 QStringList list ;//= config->readListEntry("MainLayout");
1861 int x,y,w,h; 1861 int x,y,w,h;
1862 QWidget* wid; 1862 QWidget* wid;
1863 wid = topLevelWidget(); 1863 wid = topLevelWidget();
1864 x = wid->geometry().x(); 1864 x = wid->geometry().x();
1865 y = wid->geometry().y(); 1865 y = wid->geometry().y();
1866 w = wid->width(); 1866 w = wid->width();
1867 h = wid->height(); 1867 h = wid->height();
1868 list.clear(); 1868 list.clear();
1869 list << QString::number( x ); 1869 list << QString::number( x );
1870 list << QString::number( y ); 1870 list << QString::number( y );
1871 list << QString::number( w ); 1871 list << QString::number( w );
1872 list << QString::number( h ); 1872 list << QString::number( h );
1873 config->writeEntry("MainLayout",list ); 1873 config->writeEntry("MainLayout",list );
1874 1874
1875 wid = mEventEditor; 1875 wid = mEventEditor;
1876 x = wid->geometry().x(); 1876 x = wid->geometry().x();
1877 y = wid->geometry().y(); 1877 y = wid->geometry().y();
1878 w = wid->width(); 1878 w = wid->width();
1879 h = wid->height(); 1879 h = wid->height();
1880 list.clear(); 1880 list.clear();
1881 list << QString::number( x ); 1881 list << QString::number( x );
1882 list << QString::number( y ); 1882 list << QString::number( y );
1883 list << QString::number( w ); 1883 list << QString::number( w );
1884 list << QString::number( h ); 1884 list << QString::number( h );
1885 config->writeEntry("EditEventLayout",list ); 1885 config->writeEntry("EditEventLayout",list );
1886 1886
1887 wid = mTodoEditor; 1887 wid = mTodoEditor;
1888 x = wid->geometry().x(); 1888 x = wid->geometry().x();
1889 y = wid->geometry().y(); 1889 y = wid->geometry().y();
1890 w = wid->width(); 1890 w = wid->width();
1891 h = wid->height(); 1891 h = wid->height();
1892 list.clear(); 1892 list.clear();
1893 list << QString::number( x ); 1893 list << QString::number( x );
1894 list << QString::number( y ); 1894 list << QString::number( y );
1895 list << QString::number( w ); 1895 list << QString::number( w );
1896 list << QString::number( h ); 1896 list << QString::number( h );
1897 config->writeEntry("EditTodoLayout",list ); 1897 config->writeEntry("EditTodoLayout",list );
1898 wid = getEventViewerDialog(); 1898 wid = getEventViewerDialog();
1899 x = wid->geometry().x(); 1899 x = wid->geometry().x();
1900 y = wid->geometry().y(); 1900 y = wid->geometry().y();
1901 w = wid->width(); 1901 w = wid->width();
1902 h = wid->height(); 1902 h = wid->height();
1903 list.clear(); 1903 list.clear();
1904 list << QString::number( x ); 1904 list << QString::number( x );
1905 list << QString::number( y ); 1905 list << QString::number( y );
1906 list << QString::number( w ); 1906 list << QString::number( w );
1907 list << QString::number( h ); 1907 list << QString::number( h );
1908 config->writeEntry("ViewerLayout",list ); 1908 config->writeEntry("ViewerLayout",list );
1909 wid = mDialogManager->getSearchDialog(); 1909 wid = mDialogManager->getSearchDialog();
1910 if ( wid ) { 1910 if ( wid ) {
1911 x = wid->geometry().x(); 1911 x = wid->geometry().x();
1912 y = wid->geometry().y(); 1912 y = wid->geometry().y();
1913 w = wid->width(); 1913 w = wid->width();
1914 h = wid->height(); 1914 h = wid->height();
1915 list.clear(); 1915 list.clear();
1916 list << QString::number( x ); 1916 list << QString::number( x );
1917 list << QString::number( y ); 1917 list << QString::number( y );
1918 list << QString::number( w ); 1918 list << QString::number( w );
1919 list << QString::number( h ); 1919 list << QString::number( h );
1920 config->writeEntry("SearchLayout",list ); 1920 config->writeEntry("SearchLayout",list );
1921 } 1921 }
1922#endif 1922#endif
1923 1923
1924 1924
1925 config->sync(); 1925 config->sync();
1926} 1926}
1927 1927
1928void CalendarView::readFilterSettings(KConfig *config) 1928void CalendarView::readFilterSettings(KConfig *config)
1929{ 1929{
1930 // kdDebug() << "CalendarView::readFilterSettings()" << endl; 1930 // kdDebug() << "CalendarView::readFilterSettings()" << endl;
1931 1931
1932 mFilters.clear(); 1932 mFilters.clear();
1933 1933
1934 config->setGroup("General"); 1934 config->setGroup("General");
1935 QStringList filterList = config->readListEntry("CalendarFilters"); 1935 QStringList filterList = config->readListEntry("CalendarFilters");
1936 1936
1937 QStringList::ConstIterator it = filterList.begin(); 1937 QStringList::ConstIterator it = filterList.begin();
1938 QStringList::ConstIterator end = filterList.end(); 1938 QStringList::ConstIterator end = filterList.end();
1939 while(it != end) { 1939 while(it != end) {
1940 // kdDebug() << " filter: " << (*it) << endl; 1940 // kdDebug() << " filter: " << (*it) << endl;
1941 1941
1942 CalFilter *filter; 1942 CalFilter *filter;
1943 filter = new CalFilter(*it); 1943 filter = new CalFilter(*it);
1944 config->setGroup("Filter_" + (*it)); 1944 config->setGroup("Filter_" + (*it));
1945 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); 1945 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) );
1946 filter->setCriteria(config->readNumEntry("Criteria",0)); 1946 filter->setCriteria(config->readNumEntry("Criteria",0));
1947 filter->setCategoryList(config->readListEntry("CategoryList")); 1947 filter->setCategoryList(config->readListEntry("CategoryList"));
1948 mFilters.append(filter); 1948 mFilters.append(filter);
1949 1949
1950 ++it; 1950 ++it;
1951 } 1951 }
1952 1952
1953 if (mFilters.count() == 0) { 1953 if (mFilters.count() == 0) {
1954 CalFilter *filter = new CalFilter(i18n("Default")); 1954 CalFilter *filter = new CalFilter(i18n("Default"));
1955 mFilters.append(filter); 1955 mFilters.append(filter);
1956 } 1956 }
1957 mFilterView->updateFilters(); 1957 mFilterView->updateFilters();
1958 config->setGroup("FilterView"); 1958 config->setGroup("FilterView");
1959 1959
1960 mFilterView->blockSignals(true); 1960 mFilterView->blockSignals(true);
1961 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); 1961 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled"));
1962 mFilterView->setSelectedFilter(config->readEntry("Current Filter")); 1962 mFilterView->setSelectedFilter(config->readEntry("Current Filter"));
1963 mFilterView->blockSignals(false); 1963 mFilterView->blockSignals(false);
1964 // We do it manually to avoid it being done twice by the above calls 1964 // We do it manually to avoid it being done twice by the above calls
1965 updateFilter(); 1965 updateFilter();
1966} 1966}
1967 1967
1968void CalendarView::writeFilterSettings(KConfig *config) 1968void CalendarView::writeFilterSettings(KConfig *config)
1969{ 1969{
1970 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 1970 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
1971 1971
1972 QStringList filterList; 1972 QStringList filterList;
1973 1973
1974 CalFilter *filter = mFilters.first(); 1974 CalFilter *filter = mFilters.first();
1975 while(filter) { 1975 while(filter) {
1976 // kdDebug() << " fn: " << filter->name() << endl; 1976 // kdDebug() << " fn: " << filter->name() << endl;
1977 filterList << filter->name(); 1977 filterList << filter->name();
1978 config->setGroup("Filter_" + filter->name()); 1978 config->setGroup("Filter_" + filter->name());
1979 config->writeEntry("Criteria",filter->criteria()); 1979 config->writeEntry("Criteria",filter->criteria());
1980 config->writeEntry("CategoryList",filter->categoryList()); 1980 config->writeEntry("CategoryList",filter->categoryList());
1981 filter = mFilters.next(); 1981 filter = mFilters.next();
1982 } 1982 }
1983 config->setGroup("General"); 1983 config->setGroup("General");
1984 config->writeEntry("CalendarFilters",filterList); 1984 config->writeEntry("CalendarFilters",filterList);
1985 1985
1986 config->setGroup("FilterView"); 1986 config->setGroup("FilterView");
1987 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 1987 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
1988 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 1988 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
1989} 1989}
1990 1990
1991 1991
1992void CalendarView::goToday() 1992void CalendarView::goToday()
1993{ 1993{
1994 mNavigator->selectToday(); 1994 if ( mViewManager->currentView()->isMonthView() )
1995 mNavigator->selectTodayMonth();
1996 else
1997 mNavigator->selectToday();
1995} 1998}
1996 1999
1997void CalendarView::goNext() 2000void CalendarView::goNext()
1998{ 2001{
1999 mNavigator->selectNext(); 2002 mNavigator->selectNext();
2000} 2003}
2001 2004
2002void CalendarView::goPrevious() 2005void CalendarView::goPrevious()
2003{ 2006{
2004 mNavigator->selectPrevious(); 2007 mNavigator->selectPrevious();
2005} 2008}
2006void CalendarView::goNextMonth() 2009void CalendarView::goNextMonth()
2007{ 2010{
2008 mNavigator->selectNextMonth(); 2011 mNavigator->selectNextMonth();
2009} 2012}
2010 2013
2011void CalendarView::goPreviousMonth() 2014void CalendarView::goPreviousMonth()
2012{ 2015{
2013 mNavigator->selectPreviousMonth(); 2016 mNavigator->selectPreviousMonth();
2014} 2017}
2015void CalendarView::writeLocale() 2018void CalendarView::writeLocale()
2016{ 2019{
2017 //KPimGlobalPrefs::instance()->setGlobalConfig(); 2020 //KPimGlobalPrefs::instance()->setGlobalConfig();
2018#if 0 2021#if 0
2019 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); 2022 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
2020 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); 2023 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
2021 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); 2024 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
2022 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); 2025 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
2023 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 2026 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
2024 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 2027 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
2025 dummy = KOPrefs::instance()->mUserDateFormatShort; 2028 dummy = KOPrefs::instance()->mUserDateFormatShort;
2026 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 2029 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
2027 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 2030 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
2028 KOPrefs::instance()->mDaylightsavingStart, 2031 KOPrefs::instance()->mDaylightsavingStart,
2029 KOPrefs::instance()->mDaylightsavingEnd ); 2032 KOPrefs::instance()->mDaylightsavingEnd );
2030 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); 2033 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId );
2031#endif 2034#endif
2032} 2035}
2033void CalendarView::updateConfig() 2036void CalendarView::updateConfig()
2034{ 2037{
2035 writeLocale(); 2038 writeLocale();
2036 if ( KOPrefs::instance()->mUseAppColors ) 2039 if ( KOPrefs::instance()->mUseAppColors )
2037 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2040 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2038 emit configChanged(); 2041 emit configChanged();
2039 mTodoList->updateConfig(); 2042 mTodoList->updateConfig();
2040 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2043 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2041 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2044 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2042 // To make the "fill window" configurations work 2045 // To make the "fill window" configurations work
2043 //mViewManager->raiseCurrentView(); 2046 //mViewManager->raiseCurrentView();
2044} 2047}
2045 2048
2046 2049
2047void CalendarView::eventChanged(Event *event) 2050void CalendarView::eventChanged(Event *event)
2048{ 2051{
2049 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2052 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2050 //updateUnmanagedViews(); 2053 //updateUnmanagedViews();
2051} 2054}
2052 2055
2053void CalendarView::eventAdded(Event *event) 2056void CalendarView::eventAdded(Event *event)
2054{ 2057{
2055 changeEventDisplay(event,KOGlobals::EVENTADDED); 2058 changeEventDisplay(event,KOGlobals::EVENTADDED);
2056} 2059}
2057 2060
2058void CalendarView::eventToBeDeleted(Event *) 2061void CalendarView::eventToBeDeleted(Event *)
2059{ 2062{
2060 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2063 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2061} 2064}
2062 2065
2063void CalendarView::eventDeleted() 2066void CalendarView::eventDeleted()
2064{ 2067{
2065 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2068 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2066} 2069}
2067void CalendarView::changeTodoDisplay(Todo *which, int action) 2070void CalendarView::changeTodoDisplay(Todo *which, int action)
2068{ 2071{
2069 changeIncidenceDisplay((Incidence *)which, action); 2072 changeIncidenceDisplay((Incidence *)which, action);
2070 mDateNavigator->updateView(); //LR 2073 mDateNavigator->updateView(); //LR
2071 //mDialogManager->updateSearchDialog(); 2074 //mDialogManager->updateSearchDialog();
2072 2075
2073 if (which) { 2076 if (which) {
2074 mViewManager->updateWNview(); 2077 mViewManager->updateWNview();
2075 //mTodoList->updateView(); 2078 //mTodoList->updateView();
2076 } 2079 }
2077 2080
2078} 2081}
2079 2082
2080void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2083void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2081{ 2084{
2082 updateUnmanagedViews(); 2085 updateUnmanagedViews();
2083 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2086 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2084 if ( action == KOGlobals::EVENTDELETED ) { //delete 2087 if ( action == KOGlobals::EVENTDELETED ) { //delete
2085 mCalendar->checkAlarmForIncidence( 0, true ); 2088 mCalendar->checkAlarmForIncidence( 0, true );
2086 if ( mEventViewerDialog ) 2089 if ( mEventViewerDialog )
2087 mEventViewerDialog->hide(); 2090 mEventViewerDialog->hide();
2088 } 2091 }
2089 else 2092 else
2090 mCalendar->checkAlarmForIncidence( which , false ); 2093 mCalendar->checkAlarmForIncidence( which , false );
2091} 2094}
2092 2095
2093// most of the changeEventDisplays() right now just call the view's 2096// most of the changeEventDisplays() right now just call the view's
2094// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2097// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2095void CalendarView::changeEventDisplay(Event *which, int action) 2098void CalendarView::changeEventDisplay(Event *which, int action)
2096{ 2099{
2097 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2100 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2098 changeIncidenceDisplay((Incidence *)which, action); 2101 changeIncidenceDisplay((Incidence *)which, action);
2099 mDateNavigator->updateView(); 2102 mDateNavigator->updateView();
2100 //mDialogManager->updateSearchDialog(); 2103 //mDialogManager->updateSearchDialog();
2101 2104
2102 if (which) { 2105 if (which) {
2103 // If there is an event view visible update the display 2106 // If there is an event view visible update the display
2104 mViewManager->currentView()->changeEventDisplay(which,action); 2107 mViewManager->currentView()->changeEventDisplay(which,action);
2105 // TODO: check, if update needed 2108 // TODO: check, if update needed
2106 // if (which->getTodoStatus()) { 2109 // if (which->getTodoStatus()) {
2107 mTodoList->updateView(); 2110 mTodoList->updateView();
2108 // } 2111 // }
2109 } else { 2112 } else {
2110 mViewManager->currentView()->updateView(); 2113 mViewManager->currentView()->updateView();
2111 } 2114 }
2112} 2115}
2113 2116
2114 2117
2115void CalendarView::updateTodoViews() 2118void CalendarView::updateTodoViews()
2116{ 2119{
2117 2120
2118 mTodoList->updateView(); 2121 mTodoList->updateView();
2119 mViewManager->currentView()->updateView(); 2122 mViewManager->currentView()->updateView();
2120 2123
2121} 2124}
2122 2125
2123 2126
2124void CalendarView::updateView(const QDate &start, const QDate &end) 2127void CalendarView::updateView(const QDate &start, const QDate &end)
2125{ 2128{
2126 mTodoList->updateView(); 2129 mTodoList->updateView();
2127 mViewManager->updateView(start, end); 2130 mViewManager->updateView(start, end);
2128 //mDateNavigator->updateView(); 2131 //mDateNavigator->updateView();
2129} 2132}
2130 2133
2131void CalendarView::updateView() 2134void CalendarView::updateView()
2132{ 2135{
2133 DateList tmpList = mNavigator->selectedDates(); 2136 DateList tmpList = mNavigator->selectedDates();
2134 2137
2135 // We assume that the navigator only selects consecutive days. 2138 // We assume that the navigator only selects consecutive days.
2136 updateView( tmpList.first(), tmpList.last() ); 2139 updateView( tmpList.first(), tmpList.last() );
2137} 2140}
2138 2141
2139void CalendarView::updateUnmanagedViews() 2142void CalendarView::updateUnmanagedViews()
2140{ 2143{
2141 mDateNavigator->updateDayMatrix(); 2144 mDateNavigator->updateDayMatrix();
2142} 2145}
2143 2146
2144int CalendarView::msgItemDelete() 2147int CalendarView::msgItemDelete()
2145{ 2148{
2146 return KMessageBox::warningContinueCancel(this, 2149 return KMessageBox::warningContinueCancel(this,
2147 i18n("This item will be\npermanently deleted."), 2150 i18n("This item will be\npermanently deleted."),
2148 i18n("KO/Pi Confirmation"),i18n("Delete")); 2151 i18n("KO/Pi Confirmation"),i18n("Delete"));
2149} 2152}
2150 2153
2151 2154
2152void CalendarView::edit_cut() 2155void CalendarView::edit_cut()
2153{ 2156{
2154 Event *anEvent=0; 2157 Event *anEvent=0;
2155 2158
2156 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2159 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2157 2160
2158 if (mViewManager->currentView()->isEventView()) { 2161 if (mViewManager->currentView()->isEventView()) {
2159 if ( incidence && incidence->type() == "Event" ) { 2162 if ( incidence && incidence->type() == "Event" ) {
2160 anEvent = static_cast<Event *>(incidence); 2163 anEvent = static_cast<Event *>(incidence);
2161 } 2164 }
2162 } 2165 }
2163 2166
2164 if (!anEvent) { 2167 if (!anEvent) {
2165 KNotifyClient::beep(); 2168 KNotifyClient::beep();
2166 return; 2169 return;
2167 } 2170 }
2168 DndFactory factory( mCalendar ); 2171 DndFactory factory( mCalendar );
2169 factory.cutEvent(anEvent); 2172 factory.cutEvent(anEvent);
2170 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2173 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2171} 2174}
2172 2175
2173void CalendarView::edit_copy() 2176void CalendarView::edit_copy()
2174{ 2177{
2175 Event *anEvent=0; 2178 Event *anEvent=0;
2176 2179
2177 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2180 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2178 2181
2179 if (mViewManager->currentView()->isEventView()) { 2182 if (mViewManager->currentView()->isEventView()) {
2180 if ( incidence && incidence->type() == "Event" ) { 2183 if ( incidence && incidence->type() == "Event" ) {
2181 anEvent = static_cast<Event *>(incidence); 2184 anEvent = static_cast<Event *>(incidence);
2182 } 2185 }
2183 } 2186 }
2184 2187
2185 if (!anEvent) { 2188 if (!anEvent) {
2186 KNotifyClient::beep(); 2189 KNotifyClient::beep();
2187 return; 2190 return;
2188 } 2191 }
2189 DndFactory factory( mCalendar ); 2192 DndFactory factory( mCalendar );
2190 factory.copyEvent(anEvent); 2193 factory.copyEvent(anEvent);
2191} 2194}
2192 2195
2193void CalendarView::edit_paste() 2196void CalendarView::edit_paste()
2194{ 2197{
2195 QDate date = mNavigator->selectedDates().first(); 2198 QDate date = mNavigator->selectedDates().first();
2196 2199
2197 DndFactory factory( mCalendar ); 2200 DndFactory factory( mCalendar );
2198 Event *pastedEvent = factory.pasteEvent( date ); 2201 Event *pastedEvent = factory.pasteEvent( date );
2199 2202
2200 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2203 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2201} 2204}
2202 2205
2203void CalendarView::edit_options() 2206void CalendarView::edit_options()
2204{ 2207{
2205 mDialogManager->showOptionsDialog(); 2208 mDialogManager->showOptionsDialog();
2206 //writeSettings(); 2209 //writeSettings();
2207} 2210}
2208 2211
2209void CalendarView::slotSelectPickerDate( QDate d) 2212void CalendarView::slotSelectPickerDate( QDate d)
2210{ 2213{
2211 mDateFrame->hide(); 2214 mDateFrame->hide();
2212 if ( mDatePickerMode == 1 ) { 2215 if ( mDatePickerMode == 1 ) {
2213 mNavigator->slotDaySelect( d ); 2216 mNavigator->slotDaySelect( d );
2214 } else if ( mDatePickerMode == 2 ) { 2217 } else if ( mDatePickerMode == 2 ) {
2215 if ( mMoveIncidence->type() == "Todo" ) { 2218 if ( mMoveIncidence->type() == "Todo" ) {
2216 Todo * to = (Todo *) mMoveIncidence; 2219 Todo * to = (Todo *) mMoveIncidence;
2217 QTime tim; 2220 QTime tim;
2218 if ( to->hasDueDate() ) 2221 if ( to->hasDueDate() )
2219 tim = to->dtDue().time(); 2222 tim = to->dtDue().time();
2220 else { 2223 else {
2221 tim = QTime ( 0,0,0 ); 2224 tim = QTime ( 0,0,0 );
2222 to->setFloats( true ); 2225 to->setFloats( true );
2223 to->setHasDueDate( true ); 2226 to->setHasDueDate( true );
2224 } 2227 }
2225 QDateTime dt ( d,tim ); 2228 QDateTime dt ( d,tim );
2226 to->setDtDue( dt ); 2229 to->setDtDue( dt );
2227 todoChanged( to ); 2230 todoChanged( to );
2228 } else { 2231 } else {
2229 QTime tim = mMoveIncidence->dtStart().time(); 2232 QTime tim = mMoveIncidence->dtStart().time();
2230 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2233 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2231 QDateTime dt ( d,tim ); 2234 QDateTime dt ( d,tim );
2232 mMoveIncidence->setDtStart( dt ); 2235 mMoveIncidence->setDtStart( dt );
2233 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2236 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2234 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2237 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2235 } 2238 }
2236 2239
2237 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2240 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2238 } 2241 }
2239} 2242}
2240 2243
2241void CalendarView::removeCategories() 2244void CalendarView::removeCategories()
2242{ 2245{
2243 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2246 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2244 QStringList catList = KOPrefs::instance()->mCustomCategories; 2247 QStringList catList = KOPrefs::instance()->mCustomCategories;
2245 QStringList catIncList; 2248 QStringList catIncList;
2246 QStringList newCatList; 2249 QStringList newCatList;
2247 Incidence* inc = incList.first(); 2250 Incidence* inc = incList.first();
2248 int i; 2251 int i;
2249 int count = 0; 2252 int count = 0;
2250 while ( inc ) { 2253 while ( inc ) {
2251 newCatList.clear(); 2254 newCatList.clear();
2252 catIncList = inc->categories() ; 2255 catIncList = inc->categories() ;
2253 for( i = 0; i< catIncList.count(); ++i ) { 2256 for( i = 0; i< catIncList.count(); ++i ) {
2254 if ( catList.contains (catIncList[i])) 2257 if ( catList.contains (catIncList[i]))
2255 newCatList.append( catIncList[i] ); 2258 newCatList.append( catIncList[i] );
2256 } 2259 }
2257 newCatList.sort(); 2260 newCatList.sort();
2258 inc->setCategories( newCatList.join(",") ); 2261 inc->setCategories( newCatList.join(",") );
2259 inc = incList.next(); 2262 inc = incList.next();
2260 } 2263 }
2261} 2264}
2262 2265
2263int CalendarView::addCategories() 2266int CalendarView::addCategories()
2264{ 2267{
2265 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2268 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2266 QStringList catList = KOPrefs::instance()->mCustomCategories; 2269 QStringList catList = KOPrefs::instance()->mCustomCategories;
2267 QStringList catIncList; 2270 QStringList catIncList;
2268 Incidence* inc = incList.first(); 2271 Incidence* inc = incList.first();
2269 int i; 2272 int i;
2270 int count = 0; 2273 int count = 0;
2271 while ( inc ) { 2274 while ( inc ) {
2272 catIncList = inc->categories() ; 2275 catIncList = inc->categories() ;
2273 for( i = 0; i< catIncList.count(); ++i ) { 2276 for( i = 0; i< catIncList.count(); ++i ) {
2274 if ( !catList.contains (catIncList[i])) { 2277 if ( !catList.contains (catIncList[i])) {
2275 catList.append( catIncList[i] ); 2278 catList.append( catIncList[i] );
2276 //qDebug("add cat %s ", catIncList[i].latin1()); 2279 //qDebug("add cat %s ", catIncList[i].latin1());
2277 ++count; 2280 ++count;
2278 } 2281 }
2279 } 2282 }
2280 inc = incList.next(); 2283 inc = incList.next();
2281 } 2284 }
2282 catList.sort(); 2285 catList.sort();
2283 KOPrefs::instance()->mCustomCategories = catList; 2286 KOPrefs::instance()->mCustomCategories = catList;
2284 return count; 2287 return count;
2285} 2288}
2286 2289
2287void CalendarView::manageCategories() 2290void CalendarView::manageCategories()
2288{ 2291{
2289 KOCatPrefs* cp = new KOCatPrefs(); 2292 KOCatPrefs* cp = new KOCatPrefs();
2290 cp->show(); 2293 cp->show();
2291 int w =cp->sizeHint().width() ; 2294 int w =cp->sizeHint().width() ;
2292 int h = cp->sizeHint().height() ; 2295 int h = cp->sizeHint().height() ;
2293 int dw = QApplication::desktop()->width(); 2296 int dw = QApplication::desktop()->width();
2294 int dh = QApplication::desktop()->height(); 2297 int dh = QApplication::desktop()->height();
2295 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2298 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2296 if ( !cp->exec() ) { 2299 if ( !cp->exec() ) {
2297 delete cp; 2300 delete cp;
2298 return; 2301 return;
2299 } 2302 }
2300 int count = 0; 2303 int count = 0;
2301 if ( cp->addCat() ) { 2304 if ( cp->addCat() ) {
2302 count = addCategories(); 2305 count = addCategories();
2303 if ( count ) { 2306 if ( count ) {
2304 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2307 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2305 writeSettings(); 2308 writeSettings();
2306 } else 2309 } else
2307 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); 2310 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! "));
2308 } else { 2311 } else {
2309 removeCategories(); 2312 removeCategories();
2310 updateView(); 2313 updateView();
2311 } 2314 }
2312 delete cp; 2315 delete cp;
2313} 2316}
2314 2317
2315void CalendarView::beamIncidence(Incidence * Inc) 2318void CalendarView::beamIncidence(Incidence * Inc)
2316{ 2319{
2317 QPtrList<Incidence> delSel ; 2320 QPtrList<Incidence> delSel ;
2318 delSel.append(Inc); 2321 delSel.append(Inc);
2319 beamIncidenceList( delSel ); 2322 beamIncidenceList( delSel );
2320} 2323}
2321void CalendarView::beamCalendar() 2324void CalendarView::beamCalendar()
2322{ 2325{
2323 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2326 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2324 //qDebug("beamCalendar() "); 2327 //qDebug("beamCalendar() ");
2325 beamIncidenceList( delSel ); 2328 beamIncidenceList( delSel );
2326} 2329}
2327void CalendarView::beamFilteredCalendar() 2330void CalendarView::beamFilteredCalendar()
2328{ 2331{
2329 QPtrList<Incidence> delSel = mCalendar->incidences(); 2332 QPtrList<Incidence> delSel = mCalendar->incidences();
2330 //qDebug("beamFilteredCalendar() "); 2333 //qDebug("beamFilteredCalendar() ");
2331 beamIncidenceList( delSel ); 2334 beamIncidenceList( delSel );
2332} 2335}
2333void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2336void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2334{ 2337{
2335 if ( beamDialog->exec () == QDialog::Rejected ) 2338 if ( beamDialog->exec () == QDialog::Rejected )
2336 return; 2339 return;
2337#ifdef DESKTOP_VERSION 2340#ifdef DESKTOP_VERSION
2338 QString fn = locateLocal( "tmp", "kopibeamfile" ); 2341 QString fn = locateLocal( "tmp", "kopibeamfile" );
2339#else 2342#else
2340 QString fn = "/tmp/kopibeamfile"; 2343 QString fn = "/tmp/kopibeamfile";
2341#endif 2344#endif
2342 QString mes; 2345 QString mes;
2343 bool createbup = true; 2346 bool createbup = true;
2344 if ( createbup ) { 2347 if ( createbup ) {
2345 QString description = "\n"; 2348 QString description = "\n";
2346 CalendarLocal* cal = new CalendarLocal(); 2349 CalendarLocal* cal = new CalendarLocal();
2347 if ( beamDialog->beamLocal() ) 2350 if ( beamDialog->beamLocal() )
2348 cal->setLocalTime(); 2351 cal->setLocalTime();
2349 else 2352 else
2350 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2353 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2351 Incidence *incidence = delSel.first(); 2354 Incidence *incidence = delSel.first();
2352 bool addText = false; 2355 bool addText = false;
2353 if ( delSel.count() < 10 ) 2356 if ( delSel.count() < 10 )
2354 addText = true; 2357 addText = true;
2355 else { 2358 else {
2356 description.sprintf(i18n(" %d items?"),delSel.count() ); 2359 description.sprintf(i18n(" %d items?"),delSel.count() );
2357 } 2360 }
2358 while ( incidence ) { 2361 while ( incidence ) {
2359 Incidence *in = incidence->clone(); 2362 Incidence *in = incidence->clone();
2360 if ( ! in->summary().isEmpty() ) { 2363 if ( ! in->summary().isEmpty() ) {
2361 in->setDescription(""); 2364 in->setDescription("");
2362 } else { 2365 } else {
2363 in->setSummary( in->description().left(20)); 2366 in->setSummary( in->description().left(20));
2364 in->setDescription(""); 2367 in->setDescription("");
2365 } 2368 }
2366 if ( addText ) 2369 if ( addText )
2367 description += in->summary() + "\n"; 2370 description += in->summary() + "\n";
2368 cal->addIncidence( in ); 2371 cal->addIncidence( in );
2369 incidence = delSel.next(); 2372 incidence = delSel.next();
2370 } 2373 }
2371 if ( beamDialog->beamVcal() ) { 2374 if ( beamDialog->beamVcal() ) {
2372 fn += ".vcs"; 2375 fn += ".vcs";
2373 FileStorage storage( cal, fn, new VCalFormat ); 2376 FileStorage storage( cal, fn, new VCalFormat );
2374 storage.save(); 2377 storage.save();
2375 } else { 2378 } else {
2376 fn += ".ics"; 2379 fn += ".ics";
2377 FileStorage storage( cal, fn, new ICalFormat( ) ); 2380 FileStorage storage( cal, fn, new ICalFormat( ) );
2378 storage.save(); 2381 storage.save();
2379 } 2382 }
2380 delete cal; 2383 delete cal;
2381 mes = i18n("KO/Pi: Ready for beaming"); 2384 mes = i18n("KO/Pi: Ready for beaming");
2382 topLevelWidget()->setCaption(mes); 2385 topLevelWidget()->setCaption(mes);
2383 KApplication::convert2latin1( fn ); 2386 KApplication::convert2latin1( fn );
2384#ifndef DESKTOP_VERSION 2387#ifndef DESKTOP_VERSION
2385 Ir *ir = new Ir( this ); 2388 Ir *ir = new Ir( this );
2386 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2389 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2387 ir->send( fn, description, "text/x-vCalendar" ); 2390 ir->send( fn, description, "text/x-vCalendar" );
2388#endif 2391#endif
2389 } 2392 }
2390} 2393}
2391void CalendarView::beamDone( Ir *ir ) 2394void CalendarView::beamDone( Ir *ir )
2392{ 2395{
2393#ifndef DESKTOP_VERSION 2396#ifndef DESKTOP_VERSION
2394 delete ir; 2397 delete ir;
2395#endif 2398#endif
2396 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); 2399 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
2397 topLevelWidget()->raise(); 2400 topLevelWidget()->raise();
2398} 2401}
2399 2402
2400void CalendarView::moveIncidence(Incidence * inc ) 2403void CalendarView::moveIncidence(Incidence * inc )
2401{ 2404{
2402 if ( !inc ) return; 2405 if ( !inc ) return;
2403 // qDebug("showDatePickerForIncidence( ) "); 2406 // qDebug("showDatePickerForIncidence( ) ");
2404 if ( mDateFrame->isVisible() ) 2407 if ( mDateFrame->isVisible() )
2405 mDateFrame->hide(); 2408 mDateFrame->hide();
2406 else { 2409 else {
2407 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; 2410 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ;
2408 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; 2411 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ;
2409 int dw = QApplication::desktop()->width(); 2412 int dw = QApplication::desktop()->width();
2410 int dh = QApplication::desktop()->height(); 2413 int dh = QApplication::desktop()->height();
2411 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2414 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2412 mDateFrame->show(); 2415 mDateFrame->show();
2413 } 2416 }
2414 mDatePickerMode = 2; 2417 mDatePickerMode = 2;
2415 mMoveIncidence = inc ; 2418 mMoveIncidence = inc ;
2416 QDate da; 2419 QDate da;
2417 if ( mMoveIncidence->type() == "Todo" ) { 2420 if ( mMoveIncidence->type() == "Todo" ) {
2418 Todo * to = (Todo *) mMoveIncidence; 2421 Todo * to = (Todo *) mMoveIncidence;
2419 if ( to->hasDueDate() ) 2422 if ( to->hasDueDate() )
2420 da = to->dtDue().date(); 2423 da = to->dtDue().date();
2421 else 2424 else
2422 da = QDate::currentDate(); 2425 da = QDate::currentDate();
2423 } else { 2426 } else {
2424 da = mMoveIncidence->dtStart().date(); 2427 da = mMoveIncidence->dtStart().date();
2425 } 2428 }
2426 mDatePicker->setDate( da ); 2429 mDatePicker->setDate( da );
2427} 2430}
2428void CalendarView::showDatePicker( ) 2431void CalendarView::showDatePicker( )
2429{ 2432{
2430 //qDebug("CalendarView::showDatePicker( ) "); 2433 //qDebug("CalendarView::showDatePicker( ) ");
2431 if ( mDateFrame->isVisible() ) 2434 if ( mDateFrame->isVisible() )
2432 mDateFrame->hide(); 2435 mDateFrame->hide();
2433 else { 2436 else {
2434 int w =mDatePicker->sizeHint().width() ; 2437 int w =mDatePicker->sizeHint().width() ;
2435 int h = mDatePicker->sizeHint().height() ; 2438 int h = mDatePicker->sizeHint().height() ;
2436 int dw = QApplication::desktop()->width(); 2439 int dw = QApplication::desktop()->width();
2437 int dh = QApplication::desktop()->height(); 2440 int dh = QApplication::desktop()->height();
2438 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2441 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2439 mDateFrame->show(); 2442 mDateFrame->show();
2440 } 2443 }
2441 mDatePickerMode = 1; 2444 mDatePickerMode = 1;
2442 mDatePicker->setDate( mNavigator->selectedDates().first() ); 2445 mDatePicker->setDate( mNavigator->selectedDates().first() );
2443} 2446}
2444 2447
2445void CalendarView::showEventEditor() 2448void CalendarView::showEventEditor()
2446{ 2449{
2447#ifdef DESKTOP_VERSION 2450#ifdef DESKTOP_VERSION
2448 mEventEditor->show(); 2451 mEventEditor->show();
2449#else 2452#else
2450 if ( mEventEditor->width() != QApplication::desktop()->width() ) 2453 if ( mEventEditor->width() != QApplication::desktop()->width() )
2451 mEventEditor->hide(); 2454 mEventEditor->hide();
2452 mEventEditor->showMaximized(); 2455 mEventEditor->showMaximized();
2453#endif 2456#endif
2454} 2457}
2455void CalendarView::showTodoEditor() 2458void CalendarView::showTodoEditor()
2456{ 2459{
2457#ifdef DESKTOP_VERSION 2460#ifdef DESKTOP_VERSION
2458 mTodoEditor->show(); 2461 mTodoEditor->show();
2459#else 2462#else
2460 if ( mTodoEditor->width() != QApplication::desktop()->width() ) 2463 if ( mTodoEditor->width() != QApplication::desktop()->width() )
2461 mTodoEditor->hide(); 2464 mTodoEditor->hide();
2462 mTodoEditor->showMaximized(); 2465 mTodoEditor->showMaximized();
2463#endif 2466#endif
2464} 2467}
2465 2468
2466void CalendarView::cloneIncidence() 2469void CalendarView::cloneIncidence()
2467{ 2470{
2468 Incidence *incidence = currentSelection(); 2471 Incidence *incidence = currentSelection();
2469 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2472 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2470 if ( incidence ) { 2473 if ( incidence ) {
2471 cloneIncidence(incidence); 2474 cloneIncidence(incidence);
2472 } 2475 }
2473} 2476}
2474void CalendarView::moveIncidence() 2477void CalendarView::moveIncidence()
2475{ 2478{
2476 Incidence *incidence = currentSelection(); 2479 Incidence *incidence = currentSelection();
2477 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2480 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2478 if ( incidence ) { 2481 if ( incidence ) {
2479 moveIncidence(incidence); 2482 moveIncidence(incidence);
2480 } 2483 }
2481} 2484}
2482void CalendarView::beamIncidence() 2485void CalendarView::beamIncidence()
2483{ 2486{
2484 Incidence *incidence = currentSelection(); 2487 Incidence *incidence = currentSelection();
2485 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2488 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2486 if ( incidence ) { 2489 if ( incidence ) {
2487 beamIncidence(incidence); 2490 beamIncidence(incidence);
2488 } 2491 }
2489} 2492}
2490void CalendarView::toggleCancelIncidence() 2493void CalendarView::toggleCancelIncidence()
2491{ 2494{
2492 Incidence *incidence = currentSelection(); 2495 Incidence *incidence = currentSelection();
2493 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2496 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2494 if ( incidence ) { 2497 if ( incidence ) {
2495 cancelIncidence(incidence); 2498 cancelIncidence(incidence);
2496 } 2499 }
2497} 2500}
2498 2501
2499 2502
2500void CalendarView::cancelIncidence(Incidence * inc ) 2503void CalendarView::cancelIncidence(Incidence * inc )
2501{ 2504{
2502 inc->setCancelled( ! inc->cancelled() ); 2505 inc->setCancelled( ! inc->cancelled() );
2503 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); 2506 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED );
2504 updateView(); 2507 updateView();
2505} 2508}
2506void CalendarView::cloneIncidence(Incidence * orgInc ) 2509void CalendarView::cloneIncidence(Incidence * orgInc )
2507{ 2510{
2508 Incidence * newInc = orgInc->clone(); 2511 Incidence * newInc = orgInc->clone();
2509 newInc->recreate(); 2512 newInc->recreate();
2510 2513
2511 if ( newInc->type() == "Todo" ) { 2514 if ( newInc->type() == "Todo" ) {
2512 Todo* t = (Todo*) newInc; 2515 Todo* t = (Todo*) newInc;
2513 mTodoEditor->editTodo( t ); 2516 mTodoEditor->editTodo( t );
2514 showTodoEditor(); 2517 showTodoEditor();
2515 if ( mTodoEditor->exec() ) { 2518 if ( mTodoEditor->exec() ) {
2516 mCalendar->addTodo( t ); 2519 mCalendar->addTodo( t );
2517 updateView(); 2520 updateView();
2518 } else { 2521 } else {
2519 delete t; 2522 delete t;
2520 } 2523 }
2521 } 2524 }
2522 else { 2525 else {
2523 Event* e = (Event*) newInc; 2526 Event* e = (Event*) newInc;
2524 mEventEditor->editEvent( e ); 2527 mEventEditor->editEvent( e );
2525 showEventEditor(); 2528 showEventEditor();
2526 if ( mEventEditor->exec() ) { 2529 if ( mEventEditor->exec() ) {
2527 mCalendar->addEvent( e ); 2530 mCalendar->addEvent( e );
2528 updateView(); 2531 updateView();
2529 } else { 2532 } else {
2530 delete e; 2533 delete e;
2531 } 2534 }
2532 } 2535 }
2533} 2536}
2534 2537
2535void CalendarView::newEvent() 2538void CalendarView::newEvent()
2536{ 2539{
2537 // TODO: Replace this code by a common eventDurationHint of KOBaseView. 2540 // TODO: Replace this code by a common eventDurationHint of KOBaseView.
2538 KOAgendaView *aView = mViewManager->agendaView(); 2541 KOAgendaView *aView = mViewManager->agendaView();
2539 if (aView) { 2542 if (aView) {
2540 if (aView->selectionStart().isValid()) { 2543 if (aView->selectionStart().isValid()) {
2541 if (aView->selectedIsAllDay()) { 2544 if (aView->selectedIsAllDay()) {
2542 newEvent(aView->selectionStart(),aView->selectionEnd(),true); 2545 newEvent(aView->selectionStart(),aView->selectionEnd(),true);
2543 } else { 2546 } else {
2544 newEvent(aView->selectionStart(),aView->selectionEnd()); 2547 newEvent(aView->selectionStart(),aView->selectionEnd());
2545 } 2548 }
2546 return; 2549 return;
2547 } 2550 }
2548 } 2551 }
2549 2552
2550 QDate date = mNavigator->selectedDates().first(); 2553 QDate date = mNavigator->selectedDates().first();
2551 QDateTime current = QDateTime::currentDateTime(); 2554 QDateTime current = QDateTime::currentDateTime();
2552 if ( date <= current.date() ) { 2555 if ( date <= current.date() ) {
2553 int hour = current.time().hour() +1; 2556 int hour = current.time().hour() +1;
2554 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), 2557 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ),
2555 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2558 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2556 } else 2559 } else
2557 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), 2560 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ),
2558 QDateTime( date, QTime( KOPrefs::instance()->mStartTime + 2561 QDateTime( date, QTime( KOPrefs::instance()->mStartTime +
2559 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2562 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2560} 2563}
2561 2564
2562void CalendarView::newEvent(QDateTime fh) 2565void CalendarView::newEvent(QDateTime fh)
2563{ 2566{
2564 newEvent(fh, 2567 newEvent(fh,
2565 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); 2568 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration)));
2566} 2569}
2567 2570
2568void CalendarView::newEvent(QDate dt) 2571void CalendarView::newEvent(QDate dt)
2569{ 2572{
2570 newEvent(QDateTime(dt, QTime(0,0,0)), 2573 newEvent(QDateTime(dt, QTime(0,0,0)),
2571 QDateTime(dt, QTime(0,0,0)), true); 2574 QDateTime(dt, QTime(0,0,0)), true);
2572} 2575}
2573 2576
2574void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) 2577void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay)
2575{ 2578{
2576 2579
2577 mEventEditor->newEvent(fromHint,toHint,allDay); 2580 mEventEditor->newEvent(fromHint,toHint,allDay);
2578 if ( mFilterView->filtersEnabled() ) { 2581 if ( mFilterView->filtersEnabled() ) {
2579 CalFilter *filter = mFilterView->selectedFilter(); 2582 CalFilter *filter = mFilterView->selectedFilter();
2580 if (filter && filter->showCategories()) { 2583 if (filter && filter->showCategories()) {
2581 mEventEditor->setCategories(filter->categoryList().join(",") ); 2584 mEventEditor->setCategories(filter->categoryList().join(",") );
2582 } 2585 }
2583 if ( filter ) 2586 if ( filter )
2584 mEventEditor->setSecrecy( filter->getSecrecy() ); 2587 mEventEditor->setSecrecy( filter->getSecrecy() );
2585 } 2588 }
2586 showEventEditor(); 2589 showEventEditor();
2587} 2590}
2588void CalendarView::todoAdded(Todo * t) 2591void CalendarView::todoAdded(Todo * t)
2589{ 2592{
2590 2593
2591 changeTodoDisplay ( t ,KOGlobals::EVENTADDED); 2594 changeTodoDisplay ( t ,KOGlobals::EVENTADDED);
2592 updateTodoViews(); 2595 updateTodoViews();
2593} 2596}
2594void CalendarView::todoChanged(Todo * t) 2597void CalendarView::todoChanged(Todo * t)
2595{ 2598{
2596 emit todoModified( t, 4 ); 2599 emit todoModified( t, 4 );
2597 // updateTodoViews(); 2600 // updateTodoViews();
2598} 2601}
2599void CalendarView::todoToBeDeleted(Todo *) 2602void CalendarView::todoToBeDeleted(Todo *)
2600{ 2603{
2601 //qDebug("todoToBeDeleted(Todo *) "); 2604 //qDebug("todoToBeDeleted(Todo *) ");
2602 updateTodoViews(); 2605 updateTodoViews();
2603} 2606}
2604void CalendarView::todoDeleted() 2607void CalendarView::todoDeleted()
2605{ 2608{
2606 //qDebug(" todoDeleted()"); 2609 //qDebug(" todoDeleted()");
2607 updateTodoViews(); 2610 updateTodoViews();
2608} 2611}
2609 2612
2610 2613
2611 2614
2612void CalendarView::newTodo() 2615void CalendarView::newTodo()
2613{ 2616{
2614 2617
2615 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true); 2618 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true);
2616 if ( mFilterView->filtersEnabled() ) { 2619 if ( mFilterView->filtersEnabled() ) {
2617 CalFilter *filter = mFilterView->selectedFilter(); 2620 CalFilter *filter = mFilterView->selectedFilter();
2618 if (filter && filter->showCategories()) { 2621 if (filter && filter->showCategories()) {
2619 mTodoEditor->setCategories(filter->categoryList().join(",") ); 2622 mTodoEditor->setCategories(filter->categoryList().join(",") );
2620 } 2623 }
2621 if ( filter ) 2624 if ( filter )
2622 mTodoEditor->setSecrecy( filter->getSecrecy() ); 2625 mTodoEditor->setSecrecy( filter->getSecrecy() );
2623 } 2626 }
2624 showTodoEditor(); 2627 showTodoEditor();
2625} 2628}
2626 2629
2627void CalendarView::newSubTodo() 2630void CalendarView::newSubTodo()
2628{ 2631{
2629 Todo *todo = selectedTodo(); 2632 Todo *todo = selectedTodo();
2630 if ( todo ) newSubTodo( todo ); 2633 if ( todo ) newSubTodo( todo );
2631} 2634}
2632 2635
2633void CalendarView::newSubTodo(Todo *parentEvent) 2636void CalendarView::newSubTodo(Todo *parentEvent)
2634{ 2637{
2635 2638
2636 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true); 2639 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true);
2637 showTodoEditor(); 2640 showTodoEditor();
2638} 2641}
2639 2642
2640void CalendarView::newFloatingEvent() 2643void CalendarView::newFloatingEvent()
2641{ 2644{
2642 DateList tmpList = mNavigator->selectedDates(); 2645 DateList tmpList = mNavigator->selectedDates();
2643 QDate date = tmpList.first(); 2646 QDate date = tmpList.first();
2644 2647
2645 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), 2648 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ),
2646 QDateTime( date, QTime( 12, 0, 0 ) ), true ); 2649 QDateTime( date, QTime( 12, 0, 0 ) ), true );
2647} 2650}
2648 2651
2649 2652
2650void CalendarView::editEvent( Event *event ) 2653void CalendarView::editEvent( Event *event )
2651{ 2654{
2652 2655
2653 if ( !event ) return; 2656 if ( !event ) return;
2654 if ( event->isReadOnly() ) { 2657 if ( event->isReadOnly() ) {
2655 showEvent( event ); 2658 showEvent( event );
2656 return; 2659 return;
2657 } 2660 }
2658 mEventEditor->editEvent( event , mFlagEditDescription); 2661 mEventEditor->editEvent( event , mFlagEditDescription);
2659 showEventEditor(); 2662 showEventEditor();
2660} 2663}
2661void CalendarView::editJournal( Journal *jour ) 2664void CalendarView::editJournal( Journal *jour )
2662{ 2665{
2663 if ( !jour ) return; 2666 if ( !jour ) return;
2664 mDialogManager->hideSearchDialog(); 2667 mDialogManager->hideSearchDialog();
2665 mViewManager->showJournalView(); 2668 mViewManager->showJournalView();
2666 mNavigator->slotDaySelect( jour->dtStart().date() ); 2669 mNavigator->slotDaySelect( jour->dtStart().date() );
2667} 2670}
2668void CalendarView::editTodo( Todo *todo ) 2671void CalendarView::editTodo( Todo *todo )
2669{ 2672{
2670 if ( !todo ) return; 2673 if ( !todo ) return;
2671 2674
2672 if ( todo->isReadOnly() ) { 2675 if ( todo->isReadOnly() ) {
2673 showTodo( todo ); 2676 showTodo( todo );
2674 return; 2677 return;
2675 } 2678 }
2676 mTodoEditor->editTodo( todo ,mFlagEditDescription); 2679 mTodoEditor->editTodo( todo ,mFlagEditDescription);
2677 showTodoEditor(); 2680 showTodoEditor();
2678 2681
2679} 2682}
2680 2683
2681KOEventViewerDialog* CalendarView::getEventViewerDialog() 2684KOEventViewerDialog* CalendarView::getEventViewerDialog()
2682{ 2685{
2683 if ( !mEventViewerDialog ) { 2686 if ( !mEventViewerDialog ) {
2684 mEventViewerDialog = new KOEventViewerDialog(this); 2687 mEventViewerDialog = new KOEventViewerDialog(this);
2685 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); 2688 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) );
2686 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); 2689 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig()));
2687 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), 2690 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)),
2688 dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 2691 dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
2689 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), 2692 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ),
2690 viewManager(), SLOT( showAgendaView( bool ) ) ); 2693 viewManager(), SLOT( showAgendaView( bool ) ) );
2691 mEventViewerDialog->resize( 640, 480 ); 2694 mEventViewerDialog->resize( 640, 480 );
2692 2695
2693 } 2696 }
2694 return mEventViewerDialog; 2697 return mEventViewerDialog;
2695} 2698}
2696void CalendarView::showEvent(Event *event) 2699void CalendarView::showEvent(Event *event)
2697{ 2700{
2698 getEventViewerDialog()->setEvent(event); 2701 getEventViewerDialog()->setEvent(event);
2699 getEventViewerDialog()->showMe(); 2702 getEventViewerDialog()->showMe();
2700} 2703}
2701 2704
2702void CalendarView::showTodo(Todo *event) 2705void CalendarView::showTodo(Todo *event)
2703{ 2706{
2704 getEventViewerDialog()->setTodo(event); 2707 getEventViewerDialog()->setTodo(event);
2705 getEventViewerDialog()->showMe(); 2708 getEventViewerDialog()->showMe();
2706} 2709}
2707void CalendarView::showJournal( Journal *jour ) 2710void CalendarView::showJournal( Journal *jour )
2708{ 2711{
2709 getEventViewerDialog()->setJournal(jour); 2712 getEventViewerDialog()->setJournal(jour);
2710 getEventViewerDialog()->showMe(); 2713 getEventViewerDialog()->showMe();
2711 2714
2712} 2715}
2713// void CalendarView::todoModified (Todo *event, int changed) 2716// void CalendarView::todoModified (Todo *event, int changed)
2714// { 2717// {
2715// // if (mDialogList.find (event) != mDialogList.end ()) { 2718// // if (mDialogList.find (event) != mDialogList.end ()) {
2716// // kdDebug() << "Todo modified and open" << endl; 2719// // kdDebug() << "Todo modified and open" << endl;
2717// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; 2720// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event];
2718// // temp->modified (changed); 2721// // temp->modified (changed);
2719 2722
2720// // } 2723// // }
2721 2724
2722// mViewManager->updateView(); 2725// mViewManager->updateView();
2723// } 2726// }
2724 2727
2725void CalendarView::appointment_show() 2728void CalendarView::appointment_show()
2726{ 2729{
2727 Event *anEvent = 0; 2730 Event *anEvent = 0;
2728 2731
2729 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2732 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2730 2733
2731 if (mViewManager->currentView()->isEventView()) { 2734 if (mViewManager->currentView()->isEventView()) {
2732 if ( incidence && incidence->type() == "Event" ) { 2735 if ( incidence && incidence->type() == "Event" ) {
2733 anEvent = static_cast<Event *>(incidence); 2736 anEvent = static_cast<Event *>(incidence);
2734 } 2737 }
2735 } 2738 }
2736 2739
2737 if (!anEvent) { 2740 if (!anEvent) {
2738 KNotifyClient::beep(); 2741 KNotifyClient::beep();
2739 return; 2742 return;
2740 } 2743 }
2741 2744
2742 showEvent(anEvent); 2745 showEvent(anEvent);
2743} 2746}
2744 2747
2745void CalendarView::appointment_edit() 2748void CalendarView::appointment_edit()
2746{ 2749{
2747 Event *anEvent = 0; 2750 Event *anEvent = 0;
2748 2751
2749 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2752 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2750 2753
2751 if (mViewManager->currentView()->isEventView()) { 2754 if (mViewManager->currentView()->isEventView()) {
2752 if ( incidence && incidence->type() == "Event" ) { 2755 if ( incidence && incidence->type() == "Event" ) {
2753 anEvent = static_cast<Event *>(incidence); 2756 anEvent = static_cast<Event *>(incidence);
2754 } 2757 }
2755 } 2758 }
2756 2759
2757 if (!anEvent) { 2760 if (!anEvent) {
2758 KNotifyClient::beep(); 2761 KNotifyClient::beep();
2759 return; 2762 return;
2760 } 2763 }
2761 2764
2762 editEvent(anEvent); 2765 editEvent(anEvent);
2763} 2766}
2764 2767
2765void CalendarView::appointment_delete() 2768void CalendarView::appointment_delete()
2766{ 2769{
2767 Event *anEvent = 0; 2770 Event *anEvent = 0;
2768 2771
2769 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2772 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2770 2773
2771 if (mViewManager->currentView()->isEventView()) { 2774 if (mViewManager->currentView()->isEventView()) {
2772 if ( incidence && incidence->type() == "Event" ) { 2775 if ( incidence && incidence->type() == "Event" ) {
2773 anEvent = static_cast<Event *>(incidence); 2776 anEvent = static_cast<Event *>(incidence);
2774 } 2777 }
2775 } 2778 }
2776 2779
2777 if (!anEvent) { 2780 if (!anEvent) {
2778 KNotifyClient::beep(); 2781 KNotifyClient::beep();
2779 return; 2782 return;
2780 } 2783 }
2781 2784
2782 deleteEvent(anEvent); 2785 deleteEvent(anEvent);
2783} 2786}
2784 2787
2785void CalendarView::todo_resub( Todo * parent, Todo * sub ) 2788void CalendarView::todo_resub( Todo * parent, Todo * sub )
2786{ 2789{
2787 if (!sub) return; 2790 if (!sub) return;
2788 if (!parent) return; 2791 if (!parent) return;
2789 if ( sub->relatedTo() ) 2792 if ( sub->relatedTo() )
2790 sub->relatedTo()->removeRelation(sub); 2793 sub->relatedTo()->removeRelation(sub);
2791 sub->setRelatedTo(parent); 2794 sub->setRelatedTo(parent);
2792 sub->setRelatedToUid(parent->uid()); 2795 sub->setRelatedToUid(parent->uid());
2793 parent->addRelation(sub); 2796 parent->addRelation(sub);
2794 sub->updated(); 2797 sub->updated();
2795 parent->updated(); 2798 parent->updated();
2796 setModified(true); 2799 setModified(true);
2797 updateView(); 2800 updateView();
2798} 2801}
2799void CalendarView::todo_unsub(Todo *anTodo ) 2802void CalendarView::todo_unsub(Todo *anTodo )
2800{ 2803{
2801 // Todo *anTodo = selectedTodo(); 2804 // Todo *anTodo = selectedTodo();
2802 if (!anTodo) return; 2805 if (!anTodo) return;
2803 if (!anTodo->relatedTo()) return; 2806 if (!anTodo->relatedTo()) return;
2804 anTodo->relatedTo()->removeRelation(anTodo); 2807 anTodo->relatedTo()->removeRelation(anTodo);
2805 anTodo->setRelatedTo(0); 2808 anTodo->setRelatedTo(0);
2806 anTodo->updated(); 2809 anTodo->updated();
2807 anTodo->setRelatedToUid(""); 2810 anTodo->setRelatedToUid("");
2808 setModified(true); 2811 setModified(true);
2809 updateView(); 2812 updateView();
2810} 2813}
2811 2814
2812void CalendarView::deleteTodo(Todo *todo) 2815void CalendarView::deleteTodo(Todo *todo)
2813{ 2816{
2814 if (!todo) { 2817 if (!todo) {
2815 KNotifyClient::beep(); 2818 KNotifyClient::beep();
2816 return; 2819 return;
2817 } 2820 }
2818 if (KOPrefs::instance()->mConfirm) { 2821 if (KOPrefs::instance()->mConfirm) {
2819 switch (msgItemDelete()) { 2822 switch (msgItemDelete()) {
2820 case KMessageBox::Continue: // OK 2823 case KMessageBox::Continue: // OK
2821 if (!todo->relations().isEmpty()) { 2824 if (!todo->relations().isEmpty()) {
2822 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), 2825 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."),
2823 i18n("Delete To-Do")); 2826 i18n("Delete To-Do"));
2824 } else { 2827 } else {
2825 checkExternalId( todo ); 2828 checkExternalId( todo );
2826 calendar()->deleteTodo(todo); 2829 calendar()->deleteTodo(todo);
2827 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 2830 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
2828 updateView(); 2831 updateView();
2829 } 2832 }
2830 break; 2833 break;
2831 } // switch 2834 } // switch
2832 } else { 2835 } else {
2833 if (!todo->relations().isEmpty()) { 2836 if (!todo->relations().isEmpty()) {
2834 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), 2837 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."),
2835 i18n("Delete To-Do")); 2838 i18n("Delete To-Do"));
2836 } else { 2839 } else {
2837 checkExternalId( todo ); 2840 checkExternalId( todo );
2838 mCalendar->deleteTodo(todo); 2841 mCalendar->deleteTodo(todo);
2839 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 2842 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
2840 updateView(); 2843 updateView();
2841 } 2844 }
2842 } 2845 }
2843 emit updateSearchDialog(); 2846 emit updateSearchDialog();
2844} 2847}
2845void CalendarView::deleteJournal(Journal *jour) 2848void CalendarView::deleteJournal(Journal *jour)
2846{ 2849{
2847 if (!jour) { 2850 if (!jour) {
2848 KNotifyClient::beep(); 2851 KNotifyClient::beep();
2849 return; 2852 return;
2850 } 2853 }
2851 if (KOPrefs::instance()->mConfirm) { 2854 if (KOPrefs::instance()->mConfirm) {
2852 switch (msgItemDelete()) { 2855 switch (msgItemDelete()) {
2853 case KMessageBox::Continue: // OK 2856 case KMessageBox::Continue: // OK
2854 calendar()->deleteJournal(jour); 2857 calendar()->deleteJournal(jour);
2855 updateView(); 2858 updateView();
2856 break; 2859 break;
2857 } // switch 2860 } // switch
2858 } else { 2861 } else {
2859 calendar()->deleteJournal(jour);; 2862 calendar()->deleteJournal(jour);;
2860 updateView(); 2863 updateView();
2861 } 2864 }
2862 emit updateSearchDialog(); 2865 emit updateSearchDialog();
2863} 2866}
2864 2867
2865void CalendarView::deleteEvent(Event *anEvent) 2868void CalendarView::deleteEvent(Event *anEvent)
2866{ 2869{
2867 if (!anEvent) { 2870 if (!anEvent) {
2868 KNotifyClient::beep(); 2871 KNotifyClient::beep();
2869 return; 2872 return;
2870 } 2873 }
2871 2874
2872 if (anEvent->recurrence()->doesRecur()) { 2875 if (anEvent->recurrence()->doesRecur()) {
2873 QDate itemDate = mViewManager->currentSelectionDate(); 2876 QDate itemDate = mViewManager->currentSelectionDate();
2874 int km; 2877 int km;
2875 if (!itemDate.isValid()) { 2878 if (!itemDate.isValid()) {
2876 //kdDebug() << "Date Not Valid" << endl; 2879 //kdDebug() << "Date Not Valid" << endl;
2877 if (KOPrefs::instance()->mConfirm) { 2880 if (KOPrefs::instance()->mConfirm) {
2878 km = KMessageBox::warningContinueCancel(this,anEvent->summary() + 2881 km = KMessageBox::warningContinueCancel(this,anEvent->summary() +
2879 i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), 2882 i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"),
2880 i18n("KO/Pi Confirmation"),i18n("Delete All")); 2883 i18n("KO/Pi Confirmation"),i18n("Delete All"));
2881 if ( km == KMessageBox::Continue ) 2884 if ( km == KMessageBox::Continue )
2882 km = KMessageBox::No; // No = all below 2885 km = KMessageBox::No; // No = all below
2883 } else 2886 } else
2884 km = KMessageBox::No; 2887 km = KMessageBox::No;
2885 } else { 2888 } else {
2886 km = KMessageBox::warningYesNoCancel(this,anEvent->summary() + 2889 km = KMessageBox::warningYesNoCancel(this,anEvent->summary() +
2887 i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ 2890 i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+
2888 KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), 2891 KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"),
2889 i18n("KO/Pi Confirmation"),i18n("Current"), 2892 i18n("KO/Pi Confirmation"),i18n("Current"),
2890 i18n("All")); 2893 i18n("All"));
2891 } 2894 }
2892 switch(km) { 2895 switch(km) {
2893 2896
2894 case KMessageBox::No: // Continue // all 2897 case KMessageBox::No: // Continue // all
2895 //qDebug("KMessageBox::No "); 2898 //qDebug("KMessageBox::No ");
2896 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 2899 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
2897 schedule(Scheduler::Cancel,anEvent); 2900 schedule(Scheduler::Cancel,anEvent);
2898 2901
2899 checkExternalId( anEvent); 2902 checkExternalId( anEvent);
2900 mCalendar->deleteEvent(anEvent); 2903 mCalendar->deleteEvent(anEvent);
2901 changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); 2904 changeEventDisplay(anEvent,KOGlobals::EVENTDELETED);
2902 break; 2905 break;
2903 2906
2904 // Disabled because it does not work 2907 // Disabled because it does not work
2905 //#if 0 2908 //#if 0
2906 case KMessageBox::Yes: // just this one 2909 case KMessageBox::Yes: // just this one
2907 //QDate qd = mNavigator->selectedDates().first(); 2910 //QDate qd = mNavigator->selectedDates().first();
2908 //if (!qd.isValid()) { 2911 //if (!qd.isValid()) {
2909 // kdDebug() << "no date selected, or invalid date" << endl; 2912 // kdDebug() << "no date selected, or invalid date" << endl;
2910 // KNotifyClient::beep(); 2913 // KNotifyClient::beep();
2911 // return; 2914 // return;
2912 //} 2915 //}
2913 //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); 2916 //while (!anEvent->recursOn(qd)) qd = qd.addDays(1);
2914 if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { 2917 if (itemDate!=QDate(1,1,1) || itemDate.isValid()) {
2915 anEvent->addExDate(itemDate); 2918 anEvent->addExDate(itemDate);
2916 int duration = anEvent->recurrence()->duration(); 2919 int duration = anEvent->recurrence()->duration();
2917 if ( duration > 0 ) { 2920 if ( duration > 0 ) {
2918 anEvent->recurrence()->setDuration( duration - 1 ); 2921 anEvent->recurrence()->setDuration( duration - 1 );
2919 } 2922 }
2920 changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); 2923 changeEventDisplay(anEvent, KOGlobals::EVENTEDITED);
2921 } 2924 }
2922 break; 2925 break;
2923 //#endif 2926 //#endif
2924 } // switch 2927 } // switch
2925 } else { 2928 } else {
2926 if (KOPrefs::instance()->mConfirm) { 2929 if (KOPrefs::instance()->mConfirm) {
2927 switch (KMessageBox::warningContinueCancel(this,anEvent->summary() + 2930 switch (KMessageBox::warningContinueCancel(this,anEvent->summary() +
2928 i18n("\nAre you sure you want\nto delete this event?"), 2931 i18n("\nAre you sure you want\nto delete this event?"),
2929 i18n("KO/Pi Confirmation"),i18n("Delete"))) { 2932 i18n("KO/Pi Confirmation"),i18n("Delete"))) {
2930 case KMessageBox::Continue: // OK 2933 case KMessageBox::Continue: // OK
2931 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 2934 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
2932 schedule(Scheduler::Cancel,anEvent); 2935 schedule(Scheduler::Cancel,anEvent);
2933 checkExternalId( anEvent); 2936 checkExternalId( anEvent);
2934 mCalendar->deleteEvent(anEvent); 2937 mCalendar->deleteEvent(anEvent);
2935 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2938 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2936 break; 2939 break;
2937 } // switch 2940 } // switch
2938 } else { 2941 } else {
2939 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 2942 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
2940 schedule(Scheduler::Cancel,anEvent); 2943 schedule(Scheduler::Cancel,anEvent);
2941 checkExternalId( anEvent); 2944 checkExternalId( anEvent);
2942 mCalendar->deleteEvent(anEvent); 2945 mCalendar->deleteEvent(anEvent);
2943 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2946 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2944 } 2947 }
2945 } // if-else 2948 } // if-else
2946 emit updateSearchDialog(); 2949 emit updateSearchDialog();
2947} 2950}
2948 2951
2949bool CalendarView::deleteEvent(const QString &uid) 2952bool CalendarView::deleteEvent(const QString &uid)
2950{ 2953{
2951 Event *ev = mCalendar->event(uid); 2954 Event *ev = mCalendar->event(uid);
2952 if (ev) { 2955 if (ev) {
2953 deleteEvent(ev); 2956 deleteEvent(ev);
2954 return true; 2957 return true;
2955 } else { 2958 } else {
2956 return false; 2959 return false;
2957 } 2960 }
2958} 2961}
2959 2962
2960/*****************************************************************************/ 2963/*****************************************************************************/
2961 2964
2962void CalendarView::action_mail() 2965void CalendarView::action_mail()
2963{ 2966{
2964#ifndef KORG_NOMAIL 2967#ifndef KORG_NOMAIL
2965 KOMailClient mailClient; 2968 KOMailClient mailClient;
2966 2969
2967 Incidence *incidence = currentSelection(); 2970 Incidence *incidence = currentSelection();
2968 2971
2969 if (!incidence) { 2972 if (!incidence) {
2970 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 2973 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
2971 return; 2974 return;
2972 } 2975 }
2973 if(incidence->attendeeCount() == 0 ) { 2976 if(incidence->attendeeCount() == 0 ) {
2974 KMessageBox::sorry(this, 2977 KMessageBox::sorry(this,
2975 i18n("Can't generate mail:\nNo attendees defined.\n")); 2978 i18n("Can't generate mail:\nNo attendees defined.\n"));
2976 return; 2979 return;
2977 } 2980 }
2978 2981
2979 CalendarLocal cal_tmp; 2982 CalendarLocal cal_tmp;
2980 Event *event = 0; 2983 Event *event = 0;
2981 Event *ev = 0; 2984 Event *ev = 0;
2982 if ( incidence && incidence->type() == "Event" ) { 2985 if ( incidence && incidence->type() == "Event" ) {
2983 event = static_cast<Event *>(incidence); 2986 event = static_cast<Event *>(incidence);
2984 ev = new Event(*event); 2987 ev = new Event(*event);
2985 cal_tmp.addEvent(ev); 2988 cal_tmp.addEvent(ev);
2986 } 2989 }
2987 ICalFormat mForm(); 2990 ICalFormat mForm();
2988 QString attachment = mForm.toString( &cal_tmp ); 2991 QString attachment = mForm.toString( &cal_tmp );
2989 if (ev) delete(ev); 2992 if (ev) delete(ev);
2990 2993
2991 mailClient.mailAttendees(currentSelection(), attachment); 2994 mailClient.mailAttendees(currentSelection(), attachment);
2992 2995
2993#endif 2996#endif
2994 2997
2995#if 0 2998#if 0
2996 Event *anEvent = 0; 2999 Event *anEvent = 0;
2997 if (mViewManager->currentView()->isEventView()) { 3000 if (mViewManager->currentView()->isEventView()) {
2998 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); 3001 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first());
2999 } 3002 }
3000 3003
3001 if (!anEvent) { 3004 if (!anEvent) {
3002 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 3005 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
3003 return; 3006 return;
3004 } 3007 }
3005 if(anEvent->attendeeCount() == 0 ) { 3008 if(anEvent->attendeeCount() == 0 ) {
3006 KMessageBox::sorry(this, 3009 KMessageBox::sorry(this,
3007 i18n("Can't generate mail:\nNo attendees defined.\n")); 3010 i18n("Can't generate mail:\nNo attendees defined.\n"));
3008 return; 3011 return;
3009 } 3012 }
3010 3013
3011 mailobject.emailEvent(anEvent); 3014 mailobject.emailEvent(anEvent);
3012#endif 3015#endif
3013} 3016}
3014 3017
3015 3018
3016void CalendarView::schedule_publish(Incidence *incidence) 3019void CalendarView::schedule_publish(Incidence *incidence)
3017{ 3020{
3018 Event *event = 0; 3021 Event *event = 0;
3019 Todo *todo = 0; 3022 Todo *todo = 0;
3020 3023
3021 if (incidence == 0) { 3024 if (incidence == 0) {
3022 incidence = mViewManager->currentView()->selectedIncidences().first(); 3025 incidence = mViewManager->currentView()->selectedIncidences().first();
3023 if (incidence == 0) { 3026 if (incidence == 0) {
3024 incidence = mTodoList->selectedIncidences().first(); 3027 incidence = mTodoList->selectedIncidences().first();
3025 } 3028 }
3026 } 3029 }
3027 if ( incidence && incidence->type() == "Event" ) { 3030 if ( incidence && incidence->type() == "Event" ) {
3028 event = static_cast<Event *>(incidence); 3031 event = static_cast<Event *>(incidence);
3029 } else { 3032 } else {
3030 if ( incidence && incidence->type() == "Todo" ) { 3033 if ( incidence && incidence->type() == "Todo" ) {
3031 todo = static_cast<Todo *>(incidence); 3034 todo = static_cast<Todo *>(incidence);
3032 } 3035 }
3033 } 3036 }
3034 3037
3035 if (!event && !todo) { 3038 if (!event && !todo) {
3036 KMessageBox::sorry(this,i18n("No event selected.")); 3039 KMessageBox::sorry(this,i18n("No event selected."));
3037 return; 3040 return;
3038 } 3041 }
3039 3042
3040 PublishDialog *publishdlg = new PublishDialog(); 3043 PublishDialog *publishdlg = new PublishDialog();
3041 if (incidence->attendeeCount()>0) { 3044 if (incidence->attendeeCount()>0) {
3042 QPtrList<Attendee> attendees = incidence->attendees(); 3045 QPtrList<Attendee> attendees = incidence->attendees();
3043 attendees.first(); 3046 attendees.first();
3044 while ( attendees.current()!=0 ) { 3047 while ( attendees.current()!=0 ) {
3045 publishdlg->addAttendee(attendees.current()); 3048 publishdlg->addAttendee(attendees.current());
3046 attendees.next(); 3049 attendees.next();
3047 } 3050 }
3048 } 3051 }
3049 bool send = true; 3052 bool send = true;
3050 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { 3053 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) {
3051 if ( publishdlg->exec() != QDialog::Accepted ) 3054 if ( publishdlg->exec() != QDialog::Accepted )
3052 send = false; 3055 send = false;
3053 } 3056 }
3054 if ( send ) { 3057 if ( send ) {
3055 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3058 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3056 if ( event ) { 3059 if ( event ) {
3057 Event *ev = new Event(*event); 3060 Event *ev = new Event(*event);
3058 ev->registerObserver(0); 3061 ev->registerObserver(0);
3059 ev->clearAttendees(); 3062 ev->clearAttendees();
3060 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { 3063 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
3061 delete(ev); 3064 delete(ev);
3062 } 3065 }
3063 } else { 3066 } else {
3064 if ( todo ) { 3067 if ( todo ) {
3065 Todo *ev = new Todo(*todo); 3068 Todo *ev = new Todo(*todo);
3066 ev->registerObserver(0); 3069 ev->registerObserver(0);
3067 ev->clearAttendees(); 3070 ev->clearAttendees();
3068 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { 3071 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
3069 delete(ev); 3072 delete(ev);
3070 } 3073 }
3071 } 3074 }
3072 } 3075 }
3073 } 3076 }
3074 delete publishdlg; 3077 delete publishdlg;
3075} 3078}
3076 3079
3077void CalendarView::schedule_request(Incidence *incidence) 3080void CalendarView::schedule_request(Incidence *incidence)
3078{ 3081{
3079 schedule(Scheduler::Request,incidence); 3082 schedule(Scheduler::Request,incidence);
3080} 3083}
3081 3084
3082void CalendarView::schedule_refresh(Incidence *incidence) 3085void CalendarView::schedule_refresh(Incidence *incidence)
3083{ 3086{
3084 schedule(Scheduler::Refresh,incidence); 3087 schedule(Scheduler::Refresh,incidence);
3085} 3088}
3086 3089
3087void CalendarView::schedule_cancel(Incidence *incidence) 3090void CalendarView::schedule_cancel(Incidence *incidence)
3088{ 3091{
3089 schedule(Scheduler::Cancel,incidence); 3092 schedule(Scheduler::Cancel,incidence);
3090} 3093}
3091 3094
3092void CalendarView::schedule_add(Incidence *incidence) 3095void CalendarView::schedule_add(Incidence *incidence)
3093{ 3096{
3094 schedule(Scheduler::Add,incidence); 3097 schedule(Scheduler::Add,incidence);
3095} 3098}
3096 3099
3097void CalendarView::schedule_reply(Incidence *incidence) 3100void CalendarView::schedule_reply(Incidence *incidence)
3098{ 3101{
3099 schedule(Scheduler::Reply,incidence); 3102 schedule(Scheduler::Reply,incidence);
3100} 3103}
3101 3104
3102void CalendarView::schedule_counter(Incidence *incidence) 3105void CalendarView::schedule_counter(Incidence *incidence)
3103{ 3106{
3104 schedule(Scheduler::Counter,incidence); 3107 schedule(Scheduler::Counter,incidence);
3105} 3108}
3106 3109
3107void CalendarView::schedule_declinecounter(Incidence *incidence) 3110void CalendarView::schedule_declinecounter(Incidence *incidence)
3108{ 3111{
3109 schedule(Scheduler::Declinecounter,incidence); 3112 schedule(Scheduler::Declinecounter,incidence);
3110} 3113}
3111 3114
3112void CalendarView::schedule_publish_freebusy(int daysToPublish) 3115void CalendarView::schedule_publish_freebusy(int daysToPublish)
3113{ 3116{
3114 QDateTime start = QDateTime::currentDateTime(); 3117 QDateTime start = QDateTime::currentDateTime();
3115 QDateTime end = start.addDays(daysToPublish); 3118 QDateTime end = start.addDays(daysToPublish);
3116 3119
3117 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); 3120 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end);
3118 freebusy->setOrganizer(KOPrefs::instance()->email()); 3121 freebusy->setOrganizer(KOPrefs::instance()->email());
3119 3122
3120 3123
3121 PublishDialog *publishdlg = new PublishDialog(); 3124 PublishDialog *publishdlg = new PublishDialog();
3122 if ( publishdlg->exec() == QDialog::Accepted ) { 3125 if ( publishdlg->exec() == QDialog::Accepted ) {
3123 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3126 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3124 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { 3127 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) {
3125 delete(freebusy); 3128 delete(freebusy);
3126 } 3129 }
3127 } 3130 }
3128 delete publishdlg; 3131 delete publishdlg;
3129} 3132}
3130 3133
3131void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) 3134void CalendarView::schedule(Scheduler::Method method, Incidence *incidence)
3132{ 3135{
3133 Event *event = 0; 3136 Event *event = 0;
3134 Todo *todo = 0; 3137 Todo *todo = 0;
3135 3138
3136 if (incidence == 0) { 3139 if (incidence == 0) {
3137 incidence = mViewManager->currentView()->selectedIncidences().first(); 3140 incidence = mViewManager->currentView()->selectedIncidences().first();
3138 if (incidence == 0) { 3141 if (incidence == 0) {
3139 incidence = mTodoList->selectedIncidences().first(); 3142 incidence = mTodoList->selectedIncidences().first();
3140 } 3143 }
3141 } 3144 }
3142 if ( incidence && incidence->type() == "Event" ) { 3145 if ( incidence && incidence->type() == "Event" ) {
3143 event = static_cast<Event *>(incidence); 3146 event = static_cast<Event *>(incidence);
3144 } 3147 }
3145 if ( incidence && incidence->type() == "Todo" ) { 3148 if ( incidence && incidence->type() == "Todo" ) {
3146 todo = static_cast<Todo *>(incidence); 3149 todo = static_cast<Todo *>(incidence);
3147 } 3150 }
3148 3151
3149 if (!event && !todo) { 3152 if (!event && !todo) {
3150 KMessageBox::sorry(this,i18n("No event selected.")); 3153 KMessageBox::sorry(this,i18n("No event selected."));
3151 return; 3154 return;
3152 } 3155 }
3153 3156
3154 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { 3157 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) {
3155 KMessageBox::sorry(this,i18n("The event has no attendees.")); 3158 KMessageBox::sorry(this,i18n("The event has no attendees."));
3156 return; 3159 return;
3157 } 3160 }
3158 3161
3159 Event *ev = 0; 3162 Event *ev = 0;
3160 if (event) ev = new Event(*event); 3163 if (event) ev = new Event(*event);
3161 Todo *to = 0; 3164 Todo *to = 0;
3162 if (todo) to = new Todo(*todo); 3165 if (todo) to = new Todo(*todo);
3163 3166
3164 if (method == Scheduler::Reply || method == Scheduler::Refresh) { 3167 if (method == Scheduler::Reply || method == Scheduler::Refresh) {
3165 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 3168 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
3166 if (!me) { 3169 if (!me) {
3167 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); 3170 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails."));
3168 return; 3171 return;
3169 } 3172 }
3170 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { 3173 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) {
3171 StatusDialog *statdlg = new StatusDialog(this); 3174 StatusDialog *statdlg = new StatusDialog(this);
3172 if (!statdlg->exec()==QDialog::Accepted) return; 3175 if (!statdlg->exec()==QDialog::Accepted) return;
3173 me->setStatus( statdlg->status() ); 3176 me->setStatus( statdlg->status() );
3174 delete(statdlg); 3177 delete(statdlg);
3175 } 3178 }
3176 Attendee *menew = new Attendee(*me); 3179 Attendee *menew = new Attendee(*me);
3177 if (ev) { 3180 if (ev) {
3178 ev->clearAttendees(); 3181 ev->clearAttendees();
3179 ev->addAttendee(menew,false); 3182 ev->addAttendee(menew,false);
3180 } else { 3183 } else {
3181 if (to) { 3184 if (to) {
3182 todo->clearAttendees(); 3185 todo->clearAttendees();
3183 todo->addAttendee(menew,false); 3186 todo->addAttendee(menew,false);
3184 } 3187 }
3185 } 3188 }
3186 } 3189 }
3187 3190
3188 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3191 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3189 if (ev) { 3192 if (ev) {
3190 if ( !dlg->addMessage(ev,method) ) delete(ev); 3193 if ( !dlg->addMessage(ev,method) ) delete(ev);
3191 } else { 3194 } else {
3192 if (to) { 3195 if (to) {
3193 if ( !dlg->addMessage(to,method) ) delete(to); 3196 if ( !dlg->addMessage(to,method) ) delete(to);
3194 } 3197 }
3195 } 3198 }
3196} 3199}
3197 3200
3198void CalendarView::openAddressbook() 3201void CalendarView::openAddressbook()
3199{ 3202{
3200 KRun::runCommand("kaddressbook"); 3203 KRun::runCommand("kaddressbook");
3201} 3204}
3202 3205
3203void CalendarView::setModified(bool modified) 3206void CalendarView::setModified(bool modified)
3204{ 3207{
3205 if ( modified ) 3208 if ( modified )
3206 emit signalmodified(); 3209 emit signalmodified();
3207 if (mModified != modified) { 3210 if (mModified != modified) {
3208 mModified = modified; 3211 mModified = modified;
3209 emit modifiedChanged(mModified); 3212 emit modifiedChanged(mModified);
3210 } 3213 }
3211} 3214}
3212 3215
3213bool CalendarView::isReadOnly() 3216bool CalendarView::isReadOnly()
3214{ 3217{
3215 return mReadOnly; 3218 return mReadOnly;
3216} 3219}
3217 3220
3218void CalendarView::setReadOnly(bool readOnly) 3221void CalendarView::setReadOnly(bool readOnly)
3219{ 3222{
3220 if (mReadOnly != readOnly) { 3223 if (mReadOnly != readOnly) {
3221 mReadOnly = readOnly; 3224 mReadOnly = readOnly;
3222 emit readOnlyChanged(mReadOnly); 3225 emit readOnlyChanged(mReadOnly);
3223 } 3226 }
3224} 3227}
3225 3228
3226bool CalendarView::isModified() 3229bool CalendarView::isModified()
3227{ 3230{
3228 return mModified; 3231 return mModified;
3229} 3232}
3230 3233
3231void CalendarView::printSetup() 3234void CalendarView::printSetup()
3232{ 3235{
3233#ifndef KORG_NOPRINTER 3236#ifndef KORG_NOPRINTER
3234 createPrinter(); 3237 createPrinter();
3235 3238
3236 mCalPrinter->setupPrinter(); 3239 mCalPrinter->setupPrinter();
3237#endif 3240#endif
3238} 3241}
3239 3242
3240void CalendarView::print() 3243void CalendarView::print()
3241{ 3244{
3242#ifndef KORG_NOPRINTER 3245#ifndef KORG_NOPRINTER
3243 createPrinter(); 3246 createPrinter();
3244 3247
3245 DateList tmpDateList = mNavigator->selectedDates(); 3248 DateList tmpDateList = mNavigator->selectedDates();
3246 mCalPrinter->print(CalPrinter::Month, 3249 mCalPrinter->print(CalPrinter::Month,
3247 tmpDateList.first(), tmpDateList.last()); 3250 tmpDateList.first(), tmpDateList.last());
3248#endif 3251#endif
3249} 3252}
3250 3253
3251void CalendarView::printPreview() 3254void CalendarView::printPreview()
3252{ 3255{
3253#ifndef KORG_NOPRINTER 3256#ifndef KORG_NOPRINTER
3254 kdDebug() << "CalendarView::printPreview()" << endl; 3257 kdDebug() << "CalendarView::printPreview()" << endl;
3255 3258
3256 createPrinter(); 3259 createPrinter();
3257 3260
3258 DateList tmpDateList = mNavigator->selectedDates(); 3261 DateList tmpDateList = mNavigator->selectedDates();
3259 3262
3260 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), 3263 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(),
3261 tmpDateList.last()); 3264 tmpDateList.last());
3262#endif 3265#endif
3263} 3266}
3264 3267
3265void CalendarView::exportICalendar() 3268void CalendarView::exportICalendar()
3266{ 3269{
3267 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); 3270 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this);
3268 3271
3269 // Force correct extension 3272 // Force correct extension
3270 if (filename.right(4) != ".ics") filename += ".ics"; 3273 if (filename.right(4) != ".ics") filename += ".ics";
3271 3274
3272 FileStorage storage( mCalendar, filename, new ICalFormat() ); 3275 FileStorage storage( mCalendar, filename, new ICalFormat() );
3273 storage.save(); 3276 storage.save();
3274} 3277}
3275 3278
3276bool CalendarView::exportVCalendar( QString filename ) 3279bool CalendarView::exportVCalendar( QString filename )
3277{ 3280{
3278 if (mCalendar->journals().count() > 0) { 3281 if (mCalendar->journals().count() > 0) {
3279 int result = KMessageBox::warningContinueCancel(this, 3282 int result = KMessageBox::warningContinueCancel(this,
3280 i18n("The journal entries can not be\nexported to a vCalendar file."), 3283 i18n("The journal entries can not be\nexported to a vCalendar file."),
3281 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), 3284 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
3282 true); 3285 true);
3283 if (result != KMessageBox::Continue) return false; 3286 if (result != KMessageBox::Continue) return false;
3284 } 3287 }
3285 3288
3286 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); 3289 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this);
3287 3290
3288 // Force correct extension 3291 // Force correct extension
3289 if (filename.right(4) != ".vcs") filename += ".vcs"; 3292 if (filename.right(4) != ".vcs") filename += ".vcs";
3290 3293
3291 FileStorage storage( mCalendar, filename, new VCalFormat ); 3294 FileStorage storage( mCalendar, filename, new VCalFormat );
3292 return storage.save(); 3295 return storage.save();
3293 3296
3294} 3297}
3295 3298
3296void CalendarView::eventUpdated(Incidence *) 3299void CalendarView::eventUpdated(Incidence *)
3297{ 3300{
3298 setModified(); 3301 setModified();
3299 // Don't call updateView here. The code, which has caused the update of the 3302 // Don't call updateView here. The code, which has caused the update of the
3300 // event is responsible for updating the view. 3303 // event is responsible for updating the view.
3301 // updateView(); 3304 // updateView();
3302} 3305}
3303 3306
3304void CalendarView::adaptNavigationUnits() 3307void CalendarView::adaptNavigationUnits()
3305{ 3308{
3306 if (mViewManager->currentView()->isEventView()) { 3309 if (mViewManager->currentView()->isEventView()) {
3307 int days = mViewManager->currentView()->currentDateCount(); 3310 int days = mViewManager->currentView()->currentDateCount();
3308 if (days == 1) { 3311 if (days == 1) {
3309 emit changeNavStringPrev(i18n("&Previous Day")); 3312 emit changeNavStringPrev(i18n("&Previous Day"));
3310 emit changeNavStringNext(i18n("&Next Day")); 3313 emit changeNavStringNext(i18n("&Next Day"));
3311 } else { 3314 } else {
3312 emit changeNavStringPrev(i18n("&Previous Week")); 3315 emit changeNavStringPrev(i18n("&Previous Week"));
3313 emit changeNavStringNext(i18n("&Next Week")); 3316 emit changeNavStringNext(i18n("&Next Week"));
3314 } 3317 }
3315 } 3318 }
3316} 3319}
3317 3320
3318void CalendarView::processMainViewSelection( Incidence *incidence ) 3321void CalendarView::processMainViewSelection( Incidence *incidence )
3319{ 3322{
3320 if ( incidence ) mTodoList->clearSelection(); 3323 if ( incidence ) mTodoList->clearSelection();
3321 processIncidenceSelection( incidence ); 3324 processIncidenceSelection( incidence );
3322} 3325}
3323 3326
3324void CalendarView::processTodoListSelection( Incidence *incidence ) 3327void CalendarView::processTodoListSelection( Incidence *incidence )
3325{ 3328{
3326 if ( incidence && mViewManager->currentView() ) { 3329 if ( incidence && mViewManager->currentView() ) {
3327 mViewManager->currentView()->clearSelection(); 3330 mViewManager->currentView()->clearSelection();
3328 } 3331 }
3329 processIncidenceSelection( incidence ); 3332 processIncidenceSelection( incidence );
3330} 3333}
3331 3334
3332void CalendarView::processIncidenceSelection( Incidence *incidence ) 3335void CalendarView::processIncidenceSelection( Incidence *incidence )
3333{ 3336{
3334 if ( incidence == mSelectedIncidence ) return; 3337 if ( incidence == mSelectedIncidence ) return;
3335 3338
3336 mSelectedIncidence = incidence; 3339 mSelectedIncidence = incidence;
3337 3340
3338 emit incidenceSelected( mSelectedIncidence ); 3341 emit incidenceSelected( mSelectedIncidence );
3339 3342
3340 if ( incidence && incidence->type() == "Event" ) { 3343 if ( incidence && incidence->type() == "Event" ) {
3341 Event *event = static_cast<Event *>( incidence ); 3344 Event *event = static_cast<Event *>( incidence );
3342 if ( event->organizer() == KOPrefs::instance()->email() ) { 3345 if ( event->organizer() == KOPrefs::instance()->email() ) {
3343 emit organizerEventsSelected( true ); 3346 emit organizerEventsSelected( true );
3344 } else { 3347 } else {
3345 emit organizerEventsSelected(false); 3348 emit organizerEventsSelected(false);
3346 } 3349 }
3347 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3350 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3348 KOPrefs::instance()->email() ) ) { 3351 KOPrefs::instance()->email() ) ) {
3349 emit groupEventsSelected( true ); 3352 emit groupEventsSelected( true );
3350 } else { 3353 } else {
3351 emit groupEventsSelected(false); 3354 emit groupEventsSelected(false);
3352 } 3355 }
3353 return; 3356 return;
3354 } else { 3357 } else {
3355 if ( incidence && incidence->type() == "Todo" ) { 3358 if ( incidence && incidence->type() == "Todo" ) {
3356 emit todoSelected( true ); 3359 emit todoSelected( true );
3357 Todo *event = static_cast<Todo *>( incidence ); 3360 Todo *event = static_cast<Todo *>( incidence );
3358 if ( event->organizer() == KOPrefs::instance()->email() ) { 3361 if ( event->organizer() == KOPrefs::instance()->email() ) {
3359 emit organizerEventsSelected( true ); 3362 emit organizerEventsSelected( true );
3360 } else { 3363 } else {
3361 emit organizerEventsSelected(false); 3364 emit organizerEventsSelected(false);
3362 } 3365 }
3363 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3366 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3364 KOPrefs::instance()->email() ) ) { 3367 KOPrefs::instance()->email() ) ) {
3365 emit groupEventsSelected( true ); 3368 emit groupEventsSelected( true );
3366 } else { 3369 } else {
3367 emit groupEventsSelected(false); 3370 emit groupEventsSelected(false);
3368 } 3371 }
3369 return; 3372 return;
3370 } else { 3373 } else {
3371 emit todoSelected( false ); 3374 emit todoSelected( false );
3372 emit organizerEventsSelected(false); 3375 emit organizerEventsSelected(false);
3373 emit groupEventsSelected(false); 3376 emit groupEventsSelected(false);
3374 } 3377 }
3375 return; 3378 return;
3376 } 3379 }
3377 3380
3378 /* if ( incidence && incidence->type() == "Todo" ) { 3381 /* if ( incidence && incidence->type() == "Todo" ) {
3379 emit todoSelected( true ); 3382 emit todoSelected( true );
3380 } else { 3383 } else {
3381 emit todoSelected( false ); 3384 emit todoSelected( false );
3382 }*/ 3385 }*/
3383} 3386}
3384 3387
3385 3388
3386void CalendarView::checkClipboard() 3389void CalendarView::checkClipboard()
3387{ 3390{
3388#ifndef KORG_NODND 3391#ifndef KORG_NODND
3389 if (ICalDrag::canDecode(QApplication::clipboard()->data())) { 3392 if (ICalDrag::canDecode(QApplication::clipboard()->data())) {
3390 emit pasteEnabled(true); 3393 emit pasteEnabled(true);
3391 } else { 3394 } else {
3392 emit pasteEnabled(false); 3395 emit pasteEnabled(false);
3393 } 3396 }
3394#endif 3397#endif
3395} 3398}
3396 3399
3397void CalendarView::showDates(const DateList &selectedDates) 3400void CalendarView::showDates(const DateList &selectedDates)
3398{ 3401{
3399 // kdDebug() << "CalendarView::selectDates()" << endl; 3402 // kdDebug() << "CalendarView::selectDates()" << endl;
3400 3403
3401 if ( mViewManager->currentView() ) { 3404 if ( mViewManager->currentView() ) {
3402 updateView( selectedDates.first(), selectedDates.last() ); 3405 updateView( selectedDates.first(), selectedDates.last() );
3403 } else { 3406 } else {
3404 mViewManager->showAgendaView(); 3407 mViewManager->showAgendaView();
3405 } 3408 }
3406 3409
3407 QString selDates; 3410 QString selDates;
3408 selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); 3411 selDates = KGlobal::locale()->formatDate( selectedDates.first(), true);
3409 if (selectedDates.first() < selectedDates.last() ) 3412 if (selectedDates.first() < selectedDates.last() )
3410 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); 3413 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true);
3411 topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); 3414 topLevelWidget()->setCaption( i18n("Dates: ") + selDates );
3412 3415
3413} 3416}
3414 3417
3415QPtrList<CalFilter> CalendarView::filters() 3418QPtrList<CalFilter> CalendarView::filters()
3416{ 3419{
3417 return mFilters; 3420 return mFilters;
3418 3421
3419} 3422}
3420void CalendarView::editFilters() 3423void CalendarView::editFilters()
3421{ 3424{
3422 // kdDebug() << "CalendarView::editFilters()" << endl; 3425 // kdDebug() << "CalendarView::editFilters()" << endl;
3423 3426
3424 CalFilter *filter = mFilters.first(); 3427 CalFilter *filter = mFilters.first();
3425 while(filter) { 3428 while(filter) {
3426 kdDebug() << " Filter: " << filter->name() << endl; 3429 kdDebug() << " Filter: " << filter->name() << endl;
3427 filter = mFilters.next(); 3430 filter = mFilters.next();
3428 } 3431 }
3429 3432
3430 mDialogManager->showFilterEditDialog(&mFilters); 3433 mDialogManager->showFilterEditDialog(&mFilters);
3431} 3434}
3432void CalendarView::toggleFilter() 3435void CalendarView::toggleFilter()
3433{ 3436{
3434 showFilter(! mFilterView->isVisible()); 3437 showFilter(! mFilterView->isVisible());
3435} 3438}
3436 3439
3437KOFilterView *CalendarView::filterView() 3440KOFilterView *CalendarView::filterView()
3438{ 3441{
3439 return mFilterView; 3442 return mFilterView;
3440} 3443}
3441void CalendarView::selectFilter( int fil ) 3444void CalendarView::selectFilter( int fil )
3442{ 3445{
3443 mFilterView->setSelectedFilter( fil ); 3446 mFilterView->setSelectedFilter( fil );
3444} 3447}
3445void CalendarView::showFilter(bool visible) 3448void CalendarView::showFilter(bool visible)
3446{ 3449{
3447 if (visible) mFilterView->show(); 3450 if (visible) mFilterView->show();
3448 else mFilterView->hide(); 3451 else mFilterView->hide();
3449} 3452}
3450void CalendarView::toggleFilerEnabled( ) 3453void CalendarView::toggleFilerEnabled( )
3451{ 3454{
3452 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); 3455 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() );
3453 if ( !mFilterView->filtersEnabled() ) 3456 if ( !mFilterView->filtersEnabled() )
3454 topLevelWidget()->setCaption( i18n("Filter disabled ") ); 3457 topLevelWidget()->setCaption( i18n("Filter disabled ") );
3455 3458
3456} 3459}
3457void CalendarView::updateFilter() 3460void CalendarView::updateFilter()
3458{ 3461{
3459 CalFilter *filter = mFilterView->selectedFilter(); 3462 CalFilter *filter = mFilterView->selectedFilter();
3460 if (filter) { 3463 if (filter) {
3461 if (mFilterView->filtersEnabled()) { 3464 if (mFilterView->filtersEnabled()) {
3462 topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() ); 3465 topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() );
3463 filter->setEnabled(true); 3466 filter->setEnabled(true);
3464 } 3467 }
3465 else filter->setEnabled(false); 3468 else filter->setEnabled(false);
3466 mCalendar->setFilter(filter); 3469 mCalendar->setFilter(filter);
3467 updateView(); 3470 updateView();
3468 } 3471 }
3469} 3472}
3470 3473
3471void CalendarView::filterEdited() 3474void CalendarView::filterEdited()
3472{ 3475{
3473 mFilterView->updateFilters(); 3476 mFilterView->updateFilters();
3474 updateFilter(); 3477 updateFilter();
3475 writeSettings(); 3478 writeSettings();
3476} 3479}
3477 3480
3478 3481
3479void CalendarView::takeOverEvent() 3482void CalendarView::takeOverEvent()
3480{ 3483{
3481 Incidence *incidence = currentSelection(); 3484 Incidence *incidence = currentSelection();
3482 3485
3483 if (!incidence) return; 3486 if (!incidence) return;
3484 3487
3485 incidence->setOrganizer(KOPrefs::instance()->email()); 3488 incidence->setOrganizer(KOPrefs::instance()->email());
3486 incidence->recreate(); 3489 incidence->recreate();
3487 incidence->setReadOnly(false); 3490 incidence->setReadOnly(false);
3488 3491
3489 updateView(); 3492 updateView();
3490} 3493}
3491 3494
3492void CalendarView::takeOverCalendar() 3495void CalendarView::takeOverCalendar()
3493{ 3496{
3494 // TODO: Create Calendar::allIncidences() function and use it here 3497 // TODO: Create Calendar::allIncidences() function and use it here
3495 3498
3496 QPtrList<Event> events = mCalendar->events(); 3499 QPtrList<Event> events = mCalendar->events();
3497 for(uint i=0; i<events.count(); ++i) { 3500 for(uint i=0; i<events.count(); ++i) {
3498 events.at(i)->setOrganizer(KOPrefs::instance()->email()); 3501 events.at(i)->setOrganizer(KOPrefs::instance()->email());
3499 events.at(i)->recreate(); 3502 events.at(i)->recreate();
3500 events.at(i)->setReadOnly(false); 3503 events.at(i)->setReadOnly(false);
3501 } 3504 }
3502 3505
3503 QPtrList<Todo> todos = mCalendar->todos(); 3506 QPtrList<Todo> todos = mCalendar->todos();
3504 for(uint i=0; i<todos.count(); ++i) { 3507 for(uint i=0; i<todos.count(); ++i) {
3505 todos.at(i)->setOrganizer(KOPrefs::instance()->email()); 3508 todos.at(i)->setOrganizer(KOPrefs::instance()->email());
3506 todos.at(i)->recreate(); 3509 todos.at(i)->recreate();
3507 todos.at(i)->setReadOnly(false); 3510 todos.at(i)->setReadOnly(false);
3508 } 3511 }
3509 3512
3510 QPtrList<Journal> journals = mCalendar->journals(); 3513 QPtrList<Journal> journals = mCalendar->journals();
3511 for(uint i=0; i<journals.count(); ++i) { 3514 for(uint i=0; i<journals.count(); ++i) {
3512 journals.at(i)->setOrganizer(KOPrefs::instance()->email()); 3515 journals.at(i)->setOrganizer(KOPrefs::instance()->email());
3513 journals.at(i)->recreate(); 3516 journals.at(i)->recreate();
3514 journals.at(i)->setReadOnly(false); 3517 journals.at(i)->setReadOnly(false);
3515 } 3518 }
3516 3519
3517 updateView(); 3520 updateView();
3518} 3521}
3519 3522
3520void CalendarView::showIntro() 3523void CalendarView::showIntro()
3521{ 3524{
3522 kdDebug() << "To be implemented." << endl; 3525 kdDebug() << "To be implemented." << endl;
3523} 3526}
3524 3527
3525QWidgetStack *CalendarView::viewStack() 3528QWidgetStack *CalendarView::viewStack()
3526{ 3529{
3527 return mRightFrame; 3530 return mRightFrame;
3528} 3531}
3529 3532
3530QWidget *CalendarView::leftFrame() 3533QWidget *CalendarView::leftFrame()
diff --git a/korganizer/datenavigator.cpp b/korganizer/datenavigator.cpp
index e26e20b..3156b2b 100644
--- a/korganizer/datenavigator.cpp
+++ b/korganizer/datenavigator.cpp
@@ -1,287 +1,293 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include "datenavigator.h" 24#include "datenavigator.h"
25 25
26#include "koglobals.h" 26#include "koglobals.h"
27 27
28#include <kcalendarsystem.h> 28#include <kcalendarsystem.h>
29 29
30#include <kdebug.h> 30#include <kdebug.h>
31#include <kglobal.h> 31#include <kglobal.h>
32#include <klocale.h> 32#include <klocale.h>
33 33
34using namespace KCal; 34using namespace KCal;
35 35
36DateNavigator::DateNavigator( QObject *parent, const char *name , KOViewManager * v) 36DateNavigator::DateNavigator( QObject *parent, const char *name , KOViewManager * v)
37 : QObject( parent, name ) 37 : QObject( parent, name )
38{ 38{
39 mViewManager = v; 39 mViewManager = v;
40 mSelectedDates.append( QDate::currentDate() ); 40 mSelectedDates.append( QDate::currentDate() );
41} 41}
42 42
43DateNavigator::~DateNavigator() 43DateNavigator::~DateNavigator()
44{ 44{
45} 45}
46 46
47void DateNavigator::slotMonthSelect( int m ) 47void DateNavigator::slotMonthSelect( int m )
48{ 48{
49 QDate firstSelected = mSelectedDates.first(); 49 QDate firstSelected = mSelectedDates.first();
50 int weekDay = firstSelected.dayOfWeek(); 50 int weekDay = firstSelected.dayOfWeek();
51 int diff = m - firstSelected.month() ; 51 int diff = m - firstSelected.month() ;
52 firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, diff ); 52 firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, diff );
53 53
54 if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) 54 if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 )
55 selectMonthByDate( firstSelected ); 55 selectMonthByDate( firstSelected );
56 else 56 else
57 selectWeekByDay( weekDay, firstSelected ); 57 selectWeekByDay( weekDay, firstSelected );
58 58
59} 59}
60 60
61void DateNavigator::slotDaySelect( QDate d ) 61void DateNavigator::slotDaySelect( QDate d )
62{ 62{
63 QDate firstSelected = mSelectedDates.first(); 63 QDate firstSelected = mSelectedDates.first();
64 int weekDay = firstSelected.dayOfWeek(); 64 int weekDay = firstSelected.dayOfWeek();
65 //int diff = firstSelected.daysTo( d ) ; 65 //int diff = firstSelected.daysTo( d ) ;
66 firstSelected = firstSelected.addDays( firstSelected .daysTo( d ) ); 66 firstSelected = firstSelected.addDays( firstSelected .daysTo( d ) );
67 67
68 selectWeekByDay( weekDay, firstSelected ); 68 selectWeekByDay( weekDay, firstSelected );
69 69
70} 70}
71 71
72void DateNavigator::selectMonthByDate( const QDate & firstSelected ) 72void DateNavigator::selectMonthByDate( const QDate & firstSelected )
73{ 73{
74 74
75 int monthDay = firstSelected.day(); 75 int monthDay = firstSelected.day();
76 QDate date = firstSelected.addDays( 1-monthDay ); 76 QDate date = firstSelected.addDays( 1-monthDay );
77 selectDates( date , date.daysInMonth ()); 77 selectDates( date , date.daysInMonth ());
78 78
79} 79}
80void DateNavigator::selectMonth() 80void DateNavigator::selectMonth()
81{ 81{
82 82
83 QDate date =mSelectedDates.first(); 83 QDate date =mSelectedDates.first();
84 selectMonthByDate( date ); 84 selectMonthByDate( date );
85} 85}
86 86
87DateList DateNavigator::selectedDates() 87DateList DateNavigator::selectedDates()
88{ 88{
89 return mSelectedDates; 89 return mSelectedDates;
90} 90}
91 91
92int DateNavigator::datesCount() const 92int DateNavigator::datesCount() const
93{ 93{
94 return mSelectedDates.count(); 94 return mSelectedDates.count();
95} 95}
96 96
97void DateNavigator::selectDates( const DateList& dateList ) 97void DateNavigator::selectDates( const DateList& dateList )
98{ 98{
99 if (dateList.count() > 0) { 99 if (dateList.count() > 0) {
100 mSelectedDates = dateList; 100 mSelectedDates = dateList;
101 emitSelected(); 101 emitSelected();
102 } 102 }
103} 103}
104 104
105void DateNavigator::selectDate( const QDate &date ) 105void DateNavigator::selectDate( const QDate &date )
106{ 106{
107 QDate d = date; 107 QDate d = date;
108 108
109 if ( !d.isValid() ) { 109 if ( !d.isValid() ) {
110 d = QDate::currentDate(); 110 d = QDate::currentDate();
111 } 111 }
112 112
113 mSelectedDates.clear(); 113 mSelectedDates.clear();
114 mSelectedDates.append( d ); 114 mSelectedDates.append( d );
115 115
116 emitSelected(); 116 emitSelected();
117} 117}
118 118
119void DateNavigator::selectDates( int count ) 119void DateNavigator::selectDates( int count )
120{ 120{
121 121
122 QDate d = mSelectedDates.first(); 122 QDate d = mSelectedDates.first();
123 selectDates( d, count ); 123 selectDates( d, count );
124} 124}
125 125
126void DateNavigator::selectDates( const QDate &d, int count ) 126void DateNavigator::selectDates( const QDate &d, int count )
127{ 127{
128 DateList dates; 128 DateList dates;
129 129
130 int i; 130 int i;
131 for( i = 0; i < count; ++i ) { 131 for( i = 0; i < count; ++i ) {
132 dates.append( d.addDays( i ) ); 132 dates.append( d.addDays( i ) );
133 } 133 }
134 134
135 mSelectedDates = dates; 135 mSelectedDates = dates;
136 136
137 emitSelected(); 137 emitSelected();
138} 138}
139 139
140void DateNavigator::selectWeekByDay( int weekDay, const QDate &d ) 140void DateNavigator::selectWeekByDay( int weekDay, const QDate &d )
141{ 141{
142 // qDebug("selectWeekByDay( %d %s ", weekDay, d.toString().latin1()); 142 // qDebug("selectWeekByDay( %d %s ", weekDay, d.toString().latin1());
143 int dateCount = mSelectedDates.count(); 143 int dateCount = mSelectedDates.count();
144 bool weekStart = ( weekDay == KGlobal::locale()->weekStartDay() ); 144 bool weekStart = ( weekDay == KGlobal::locale()->weekStartDay() );
145 if ( weekDay == 1 && dateCount == 5 ) selectWorkWeek( d ); 145 if ( weekDay == 1 && dateCount == 5 ) selectWorkWeek( d );
146 else if ( weekStart && dateCount == 7 ) selectWeek( d ); 146 else if ( weekStart && dateCount == 7 ) selectWeek( d );
147 else selectDates( d, dateCount ); 147 else selectDates( d, dateCount );
148} 148}
149 149
150void DateNavigator::selectWeek() 150void DateNavigator::selectWeek()
151{ 151{
152 QDate d = mSelectedDates.first(); 152 QDate d = mSelectedDates.first();
153 selectWeek( d ); 153 selectWeek( d );
154} 154}
155void DateNavigator::selectWeek( int num ) 155void DateNavigator::selectWeek( int num )
156{ 156{
157 int year = mSelectedDates.first().year(); 157 int year = mSelectedDates.first().year();
158 if ( mSelectedDates.first().dayOfYear() > 300 && num < 10 ) 158 if ( mSelectedDates.first().dayOfYear() > 300 && num < 10 )
159 ++year; 159 ++year;
160 if ( mSelectedDates.first().dayOfYear() < 70 && num > 40 ) 160 if ( mSelectedDates.first().dayOfYear() < 70 && num > 40 )
161 --year; 161 --year;
162 QDate d = QDate ( year, 1,1); 162 QDate d = QDate ( year, 1,1);
163 while ( d.dayOfWeek() != 4 ) 163 while ( d.dayOfWeek() != 4 )
164 d = d.addDays( 1 ); 164 d = d.addDays( 1 );
165 selectWeek( d.addDays ( (num-1) *7 ) ); 165 selectWeek( d.addDays ( (num-1) *7 ) );
166} 166}
167void DateNavigator::selectWeek( const QDate &d ) 167void DateNavigator::selectWeek( const QDate &d )
168{ 168{
169 int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); 169 int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d );
170 170
171 int weekStart = KGlobal::locale()->weekStartDay(); 171 int weekStart = KGlobal::locale()->weekStartDay();
172 QDate firstDate = d.addDays( weekStart - dayOfWeek ); 172 QDate firstDate = d.addDays( weekStart - dayOfWeek );
173 173
174 if ( weekStart != 1 && dayOfWeek < weekStart ) { 174 if ( weekStart != 1 && dayOfWeek < weekStart ) {
175 firstDate = firstDate.addDays(-7 ); 175 firstDate = firstDate.addDays(-7 );
176 } 176 }
177 177
178 178
179 selectDates( firstDate, 7 ); 179 selectDates( firstDate, 7 );
180} 180}
181 181
182void DateNavigator::selectWorkWeek() 182void DateNavigator::selectWorkWeek()
183{ 183{
184 QDate d = mSelectedDates.first(); 184 QDate d = mSelectedDates.first();
185 selectWorkWeek( d ); 185 selectWorkWeek( d );
186} 186}
187 187
188void DateNavigator::selectWorkWeek( const QDate &d ) 188void DateNavigator::selectWorkWeek( const QDate &d )
189{ 189{
190 int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); 190 int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d );
191 191
192 QDate firstDate = d.addDays( 1 - dayOfWeek ); 192 QDate firstDate = d.addDays( 1 - dayOfWeek );
193 193
194 int weekStart = KGlobal::locale()->weekStartDay(); 194 int weekStart = KGlobal::locale()->weekStartDay();
195 if ( weekStart != 1 && dayOfWeek >= weekStart ) { 195 if ( weekStart != 1 && dayOfWeek >= weekStart ) {
196 firstDate = firstDate.addDays( 7 ); 196 firstDate = firstDate.addDays( 7 );
197 } 197 }
198 198
199 selectDates( firstDate, 5 ); 199 selectDates( firstDate, 5 );
200} 200}
201 201
202void DateNavigator::selectTodayMonth()
203{
204 QDate date = QDate::currentDate().addDays( 1-QDate::currentDate().day() );
205 selectDates( date , date.daysInMonth ());
206
207}
202void DateNavigator::selectToday() 208void DateNavigator::selectToday()
203{ 209{
204 QDate d = QDate::currentDate(); 210 QDate d = QDate::currentDate();
205 211
206 int dateCount = mSelectedDates.count(); 212 int dateCount = mSelectedDates.count();
207 213
208 if ( dateCount == 5 ) selectWorkWeek( d ); 214 if ( dateCount == 5 ) selectWorkWeek( d );
209 else if ( dateCount == 7 ) selectWeek( d ); 215 else if ( dateCount == 7 ) selectWeek( d );
210 else selectDates( d, dateCount ); 216 else selectDates( d, dateCount );
211} 217}
212 218
213void DateNavigator::selectPreviousYear() 219void DateNavigator::selectPreviousYear()
214{ 220{
215 QDate firstSelected = mSelectedDates.first(); 221 QDate firstSelected = mSelectedDates.first();
216 int weekDay = firstSelected.dayOfWeek(); 222 int weekDay = firstSelected.dayOfWeek();
217 firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, -1 ); 223 firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, -1 );
218 224
219 selectWeekByDay( weekDay, firstSelected ); 225 selectWeekByDay( weekDay, firstSelected );
220} 226}
221 227
222void DateNavigator::selectPreviousMonth() 228void DateNavigator::selectPreviousMonth()
223{ 229{
224 QDate firstSelected = mSelectedDates.first(); 230 QDate firstSelected = mSelectedDates.first();
225 int weekDay = firstSelected.dayOfWeek(); 231 int weekDay = firstSelected.dayOfWeek();
226 firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, -1 ); 232 firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, -1 );
227 233
228 234
229 if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) 235 if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 )
230 selectMonthByDate( firstSelected ); 236 selectMonthByDate( firstSelected );
231 else 237 else
232 selectWeekByDay( weekDay, firstSelected ); 238 selectWeekByDay( weekDay, firstSelected );
233} 239}
234 240
235void DateNavigator::selectNextMonth() 241void DateNavigator::selectNextMonth()
236{ 242{
237 QDate firstSelected = mSelectedDates.first(); 243 QDate firstSelected = mSelectedDates.first();
238 int weekDay = firstSelected.dayOfWeek(); 244 int weekDay = firstSelected.dayOfWeek();
239 245
240 firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, 1 ); 246 firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, 1 );
241 247
242 if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) 248 if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 )
243 selectMonthByDate( firstSelected ); 249 selectMonthByDate( firstSelected );
244 else 250 else
245 selectWeekByDay( weekDay, firstSelected ); 251 selectWeekByDay( weekDay, firstSelected );
246 252
247} 253}
248 254
249void DateNavigator::selectNextYear() 255void DateNavigator::selectNextYear()
250{ 256{
251 QDate firstSelected = mSelectedDates.first(); 257 QDate firstSelected = mSelectedDates.first();
252 int weekDay = firstSelected.dayOfWeek(); 258 int weekDay = firstSelected.dayOfWeek();
253 firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, 1 ); 259 firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, 1 );
254 260
255 selectWeekByDay( weekDay, firstSelected ); 261 selectWeekByDay( weekDay, firstSelected );
256} 262}
257 263
258void DateNavigator::selectPrevious() 264void DateNavigator::selectPrevious()
259{ 265{
260 int offset = -7; 266 int offset = -7;
261 if ( datesCount() == 1 ) { 267 if ( datesCount() == 1 ) {
262 offset = -1; 268 offset = -1;
263 } 269 }
264 if ( mViewManager ) 270 if ( mViewManager )
265 if ( mViewManager->showsNextDays() ) 271 if ( mViewManager->showsNextDays() )
266 offset = -datesCount(); 272 offset = -datesCount();
267 selectDates( mSelectedDates.first().addDays( offset ), datesCount() ); 273 selectDates( mSelectedDates.first().addDays( offset ), datesCount() );
268} 274}
269 275
270void DateNavigator::selectNext() 276void DateNavigator::selectNext()
271{ 277{
272 int offset = 7; 278 int offset = 7;
273 if ( datesCount() == 1 ) { 279 if ( datesCount() == 1 ) {
274 offset = 1; 280 offset = 1;
275 } 281 }
276 if ( mViewManager ) 282 if ( mViewManager )
277 if ( mViewManager->showsNextDays() ) 283 if ( mViewManager->showsNextDays() )
278 offset = datesCount(); 284 offset = datesCount();
279 selectDates( mSelectedDates.first().addDays( offset ), datesCount() ); 285 selectDates( mSelectedDates.first().addDays( offset ), datesCount() );
280} 286}
281 287
282void DateNavigator::emitSelected() 288void DateNavigator::emitSelected()
283{ 289{
284 emit datesSelected( mSelectedDates ); 290 emit datesSelected( mSelectedDates );
285} 291}
286 292
287//#include "datenavigator.moc" 293//#include "datenavigator.moc"
diff --git a/korganizer/datenavigator.h b/korganizer/datenavigator.h
index 747e3d3..4a19e17 100644
--- a/korganizer/datenavigator.h
+++ b/korganizer/datenavigator.h
@@ -1,89 +1,90 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef DATENAVIGATOR_H 23#ifndef DATENAVIGATOR_H
24#define DATENAVIGATOR_H 24#define DATENAVIGATOR_H
25 25
26#include <libkcal/incidencebase.h> 26#include <libkcal/incidencebase.h>
27 27
28#include <qobject.h> 28#include <qobject.h>
29#include "koviewmanager.h" 29#include "koviewmanager.h"
30 30
31/** 31/**
32 This class controls date navigation. All requests to move the views to another 32 This class controls date navigation. All requests to move the views to another
33 date are sent to the DateNavigator. The DateNavigator processes the new 33 date are sent to the DateNavigator. The DateNavigator processes the new
34 selection of dates and emits the required signals for the views. 34 selection of dates and emits the required signals for the views.
35*/ 35*/
36class DateNavigator : public QObject 36class DateNavigator : public QObject
37{ 37{
38 Q_OBJECT 38 Q_OBJECT
39 public: 39 public:
40 DateNavigator( QObject *parent = 0, const char *name = 0 , KOViewManager * v = 0); 40 DateNavigator( QObject *parent = 0, const char *name = 0 , KOViewManager * v = 0);
41 ~DateNavigator(); 41 ~DateNavigator();
42 42
43 KCal::DateList selectedDates(); 43 KCal::DateList selectedDates();
44 44
45 int datesCount() const; 45 int datesCount() const;
46 46
47 public slots: 47 public slots:
48 void selectDates( const KCal::DateList & ); 48 void selectDates( const KCal::DateList & );
49 void selectDate( const QDate & ); 49 void selectDate( const QDate & );
50 50
51 void selectDates( int count ); 51 void selectDates( int count );
52 void selectDates( const QDate &, int count ); 52 void selectDates( const QDate &, int count );
53 53
54 void selectWeek(); 54 void selectWeek();
55 void selectWeek( int weeknum ); 55 void selectWeek( int weeknum );
56 void selectWeek( const QDate & ); 56 void selectWeek( const QDate & );
57 57
58 void selectWorkWeek(); 58 void selectWorkWeek();
59 void selectWorkWeek( const QDate & ); 59 void selectWorkWeek( const QDate & );
60 60
61 void selectWeekByDay( int weekDay, const QDate & ); 61 void selectWeekByDay( int weekDay, const QDate & );
62 62
63 void selectToday(); 63 void selectToday();
64 void selectTodayMonth();
64 65
65 void selectPreviousYear(); 66 void selectPreviousYear();
66 void selectPreviousMonth(); 67 void selectPreviousMonth();
67 void selectNextMonth(); 68 void selectNextMonth();
68 void selectNextYear(); 69 void selectNextYear();
69 70
70 void selectMonth(); 71 void selectMonth();
71 void selectMonthByDate( const QDate & ); 72 void selectMonthByDate( const QDate & );
72 73
73 void selectPrevious(); 74 void selectPrevious();
74 void selectNext(); 75 void selectNext();
75 void slotMonthSelect( int ); 76 void slotMonthSelect( int );
76 void slotDaySelect( QDate d ); 77 void slotDaySelect( QDate d );
77 78
78 signals: 79 signals:
79 void datesSelected( const KCal::DateList & ); 80 void datesSelected( const KCal::DateList & );
80 81
81 protected: 82 protected:
82 void emitSelected(); 83 void emitSelected();
83 84
84 private: 85 private:
85 KOViewManager * mViewManager; 86 KOViewManager * mViewManager;
86 KCal::DateList mSelectedDates; 87 KCal::DateList mSelectedDates;
87}; 88};
88 89
89#endif 90#endif
diff --git a/korganizer/interfaces/korganizer/baseview.h b/korganizer/interfaces/korganizer/baseview.h
index 09f8ba3..2ac9de1 100644
--- a/korganizer/interfaces/korganizer/baseview.h
+++ b/korganizer/interfaces/korganizer/baseview.h
@@ -1,192 +1,193 @@
1/* 1/*
2 This file is part of the KOrganizer interfaces. 2 This file is part of the KOrganizer interfaces.
3 Copyright (c) 1999 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 1999 Cornelius Schumacher <schumacher@kde.org>
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version. 9 version 2 of the License, or (at your option) any later version.
10 10
11 This library is distributed in the hope that it will be useful, 11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details. 14 Library General Public License for more details.
15 15
16 You should have received a copy of the GNU Library General Public License 16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to 17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. 19 Boston, MA 02111-1307, USA.
20*/ 20*/
21#ifndef KORG_BASEVIEW_H 21#ifndef KORG_BASEVIEW_H
22#define KORG_BASEVIEW_H 22#define KORG_BASEVIEW_H
23// $Id$ 23// $Id$
24// KOBaseView is the abstract base class of all calendar views. 24// KOBaseView is the abstract base class of all calendar views.
25 25
26#include <qwidget.h> 26#include <qwidget.h>
27#include <qptrlist.h> 27#include <qptrlist.h>
28#include <qvaluelist.h> 28#include <qvaluelist.h>
29 29
30#include <klocale.h> 30#include <klocale.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kmessagebox.h> 32#include <kmessagebox.h>
33 33
34#include <libkcal/event.h> 34#include <libkcal/event.h>
35#include <libkcal/calendar.h> 35#include <libkcal/calendar.h>
36 36
37using namespace KCal; 37using namespace KCal;
38 38
39class CalPrinter; 39class CalPrinter;
40 40
41namespace KOrg { 41namespace KOrg {
42 42
43class CalPrinterBase 43class CalPrinterBase
44{ 44{
45 public: 45 public:
46 enum PrintType { Day, Week, Month, Todolist }; 46 enum PrintType { Day, Week, Month, Todolist };
47}; 47};
48 48
49 49
50/** 50/**
51 This class provides an interface for all views being displayed within the main 51 This class provides an interface for all views being displayed within the main
52 calendar view. It has functions to update the view, to specify date range and 52 calendar view. It has functions to update the view, to specify date range and
53 other display parameter and to return selected objects. An important class, 53 other display parameter and to return selected objects. An important class,
54 which inherits KOBaseView is KOEventView, which provides the interface for all 54 which inherits KOBaseView is KOEventView, which provides the interface for all
55 views of event data like the agenda or the month view. 55 views of event data like the agenda or the month view.
56 56
57 @short Base class for calendar views 57 @short Base class for calendar views
58 @author Preston Brown, Cornelius Schumacher 58 @author Preston Brown, Cornelius Schumacher
59 @see KOTodoView, KOEventView, KOListView, KOAgendaView, KOMonthView 59 @see KOTodoView, KOEventView, KOListView, KOAgendaView, KOMonthView
60*/ 60*/
61class BaseView : public QWidget 61class BaseView : public QWidget
62{ 62{
63 Q_OBJECT 63 Q_OBJECT
64 public: 64 public:
65 /** 65 /**
66 Constructs a view. 66 Constructs a view.
67 67
68 @param cal Pointer to the calendar object from which events 68 @param cal Pointer to the calendar object from which events
69 will be retrieved for display. 69 will be retrieved for display.
70 @param parent parent widget. 70 @param parent parent widget.
71 @param name name of this widget. 71 @param name name of this widget.
72 */ 72 */
73 BaseView(Calendar *cal, QWidget *parent = 0, const char *name = 0) : 73 BaseView(Calendar *cal, QWidget *parent = 0, const char *name = 0) :
74 QWidget(parent, name), mCalendar(cal) {} 74 QWidget(parent, name), mCalendar(cal) {}
75 75
76 /** 76 /**
77 Destructor. Views will do view-specific cleanups here. 77 Destructor. Views will do view-specific cleanups here.
78 */ 78 */
79 virtual ~BaseView() {} 79 virtual ~BaseView() {}
80 80
81 /** 81 /**
82 Return calendar object of this view. 82 Return calendar object of this view.
83 */ 83 */
84 Calendar *calendar() { return mCalendar; } 84 Calendar *calendar() { return mCalendar; }
85 85
86 /** 86 /**
87 @return a list of selected events. Most views can probably only 87 @return a list of selected events. Most views can probably only
88 select a single event at a time, but some may be able to select 88 select a single event at a time, but some may be able to select
89 more than one. 89 more than one.
90 */ 90 */
91 virtual QPtrList<Incidence> selectedIncidences() = 0; 91 virtual QPtrList<Incidence> selectedIncidences() = 0;
92 92
93 /** 93 /**
94 @return a list of the dates of selected events. Most views can probably only 94 @return a list of the dates of selected events. Most views can probably only
95 select a single event at a time, but some may be able to select 95 select a single event at a time, but some may be able to select
96 more than one. 96 more than one.
97 */ 97 */
98 virtual DateList selectedDates() = 0; 98 virtual DateList selectedDates() = 0;
99 99
100 /** 100 /**
101 Generate a print preview of this event view. 101 Generate a print preview of this event view.
102 102
103 @param calPrinter Calendar printer object used for printing 103 @param calPrinter Calendar printer object used for printing
104 @param fd from date 104 @param fd from date
105 @param td to date 105 @param td to date
106 */ 106 */
107/* 107/*
108 The date parameters should be determined by the view itself and not given as 108 The date parameters should be determined by the view itself and not given as
109 parameters. At the moment I just move the code from the topwidget to the 109 parameters. At the moment I just move the code from the topwidget to the
110 individual views. 110 individual views.
111*/ 111*/
112 virtual void printPreview(CalPrinter *, 112 virtual void printPreview(CalPrinter *,
113 const QDate &, const QDate &) 113 const QDate &, const QDate &)
114 { 114 {
115 KMessageBox::sorry(this, i18n("Unfortunately, we don't handle printing for\n" 115 KMessageBox::sorry(this, i18n("Unfortunately, we don't handle printing for\n"
116 "that view yet.\n")); 116 "that view yet.\n"));
117 } 117 }
118 118
119 /** 119 /**
120 Print this view. 120 Print this view.
121 121
122 @param calPrinter Calendar printer object used for printing 122 @param calPrinter Calendar printer object used for printing
123 */ 123 */
124 virtual void print(CalPrinter *) 124 virtual void print(CalPrinter *)
125 { 125 {
126 KMessageBox::sorry(this, i18n("Unfortunately, we don't handle printing for\n" 126 KMessageBox::sorry(this, i18n("Unfortunately, we don't handle printing for\n"
127 "that view yet.\n")); 127 "that view yet.\n"));
128 } 128 }
129 129
130 /** 130 /**
131 Return number of currently shown dates. A return value of 0 means no idea. 131 Return number of currently shown dates. A return value of 0 means no idea.
132 */ 132 */
133 virtual int currentDateCount() = 0; 133 virtual int currentDateCount() = 0;
134 134
135 /** Return if this view is a view for displaying events. */ 135 /** Return if this view is a view for displaying events. */
136 virtual bool isEventView() { return false; } 136 virtual bool isEventView() { return false; }
137 virtual bool isMonthView() { return false; }
137 138
138 public slots: 139 public slots:
139 /** 140 /**
140 Show incidences for the given date range. The date range actually shown may be 141 Show incidences for the given date range. The date range actually shown may be
141 different from the requested range, depending on the particular requirements 142 different from the requested range, depending on the particular requirements
142 of the view. 143 of the view.
143 144
144 @param start Start of date range. 145 @param start Start of date range.
145 @param end End of date range. 146 @param end End of date range.
146 */ 147 */
147 virtual void showDates( const QDate &start, const QDate &end ) = 0; 148 virtual void showDates( const QDate &start, const QDate &end ) = 0;
148 149
149 /** 150 /**
150 Show given events. Depending on the actual view it might not be possible to 151 Show given events. Depending on the actual view it might not be possible to
151 show all given events. 152 show all given events.
152 153
153 @param eventList a list of events to show. 154 @param eventList a list of events to show.
154 */ 155 */
155 virtual void showEvents(QPtrList<Event> eventList) = 0; 156 virtual void showEvents(QPtrList<Event> eventList) = 0;
156 157
157 /** 158 /**
158 Updates the current display to reflect changes that may have happened 159 Updates the current display to reflect changes that may have happened
159 in the calendar since the last display refresh. 160 in the calendar since the last display refresh.
160 */ 161 */
161 virtual void updateView() = 0; 162 virtual void updateView() = 0;
162 163
163 /** 164 /**
164 Write all unsaved data back to calendar store. 165 Write all unsaved data back to calendar store.
165 */ 166 */
166 virtual void flushView() {} 167 virtual void flushView() {}
167 168
168 /** 169 /**
169 Updates the current display to reflect the changes to one particular event. 170 Updates the current display to reflect the changes to one particular event.
170 */ 171 */
171 virtual void changeEventDisplay(Event *, int) = 0; 172 virtual void changeEventDisplay(Event *, int) = 0;
172 173
173 /** 174 /**
174 Re-reads the KOrganizer configuration and picks up relevant 175 Re-reads the KOrganizer configuration and picks up relevant
175 changes which are applicable to the view. 176 changes which are applicable to the view.
176 */ 177 */
177 virtual void updateConfig() {} 178 virtual void updateConfig() {}
178 179
179 /** 180 /**
180 Clear selection. The incidenceSelected signal is not emitted. 181 Clear selection. The incidenceSelected signal is not emitted.
181 */ 182 */
182 virtual void clearSelection() {} 183 virtual void clearSelection() {}
183 184
184 signals: 185 signals:
185 void incidenceSelected( Incidence * ); 186 void incidenceSelected( Incidence * );
186 187
187 protected: 188 protected:
188 Calendar *mCalendar; 189 Calendar *mCalendar;
189}; 190};
190 191
191} 192}
192#endif 193#endif
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index d976246..e94952f 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -1,252 +1,253 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#ifndef _KOMONTHVIEW_H 20#ifndef _KOMONTHVIEW_H
21#define _KOMONTHVIEW_H 21#define _KOMONTHVIEW_H
22 22
23#include <qlabel.h> 23#include <qlabel.h>
24#include <qframe.h> 24#include <qframe.h>
25#include <qdatetime.h> 25#include <qdatetime.h>
26#include <qlistbox.h> 26#include <qlistbox.h>
27#include <qpoint.h> 27#include <qpoint.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qintdict.h> 29#include <qintdict.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31#include <qvaluelist.h> 31#include <qvaluelist.h>
32#include <qptrvector.h> 32#include <qptrvector.h>
33 33
34#include <libkcal/calendar.h> 34#include <libkcal/calendar.h>
35#include <libkcal/event.h> 35#include <libkcal/event.h>
36 36
37#include "koeventview.h" 37#include "koeventview.h"
38 38
39class KOWeekButton : public QPushButton 39class KOWeekButton : public QPushButton
40{ 40{
41 Q_OBJECT 41 Q_OBJECT
42 public: 42 public:
43 KOWeekButton( QWidget *parent=0, const char *name=0 ) : 43 KOWeekButton( QWidget *parent=0, const char *name=0 ) :
44 QPushButton( parent, name) 44 QPushButton( parent, name)
45 { 45 {
46 connect( this, SIGNAL( clicked() ), 46 connect( this, SIGNAL( clicked() ),
47 SLOT( bottonClicked() )); 47 SLOT( bottonClicked() ));
48 mNumber = -1; 48 mNumber = -1;
49 } 49 }
50 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} 50 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));}
51 signals: 51 signals:
52 void selectWeekNum ( int ); 52 void selectWeekNum ( int );
53private: 53private:
54 int mNumber; 54 int mNumber;
55private slots : 55private slots :
56 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } 56 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); }
57}; 57};
58 58
59class KNoScrollListBox: public QListBox 59class KNoScrollListBox: public QListBox
60{ 60{
61 Q_OBJECT 61 Q_OBJECT
62 public: 62 public:
63 KNoScrollListBox(QWidget *parent=0, const char *name=0); 63 KNoScrollListBox(QWidget *parent=0, const char *name=0);
64 ~KNoScrollListBox() {} 64 ~KNoScrollListBox() {}
65 QString getWhatsThisText(QPoint p) ; 65 QString getWhatsThisText(QPoint p) ;
66 66
67 signals: 67 signals:
68 void shiftDown(); 68 void shiftDown();
69 void shiftUp(); 69 void shiftUp();
70 void rightClick(); 70 void rightClick();
71 71
72 protected slots: 72 protected slots:
73 void keyPressEvent(QKeyEvent *); 73 void keyPressEvent(QKeyEvent *);
74 void keyReleaseEvent(QKeyEvent *); 74 void keyReleaseEvent(QKeyEvent *);
75 void mousePressEvent(QMouseEvent *); 75 void mousePressEvent(QMouseEvent *);
76}; 76};
77 77
78 78
79class MonthViewItem: public QListBoxItem 79class MonthViewItem: public QListBoxItem
80{ 80{
81 public: 81 public:
82 MonthViewItem( Incidence *, QDate qd, const QString & title ); 82 MonthViewItem( Incidence *, QDate qd, const QString & title );
83 83
84 void setRecur(bool on) { mRecur = on; } 84 void setRecur(bool on) { mRecur = on; }
85 void setAlarm(bool on) { mAlarm = on; } 85 void setAlarm(bool on) { mAlarm = on; }
86 void setReply(bool on) { mReply = on; } 86 void setReply(bool on) { mReply = on; }
87 void setMoreInfo(bool on) { mInfo = on; } 87 void setMoreInfo(bool on) { mInfo = on; }
88 88
89 89
90 void setPalette(const QPalette &p) { mPalette = p; } 90 void setPalette(const QPalette &p) { mPalette = p; }
91 QPalette palette() const { return mPalette; } 91 QPalette palette() const { return mPalette; }
92 92
93 Incidence *incidence() const { return mIncidence; } 93 Incidence *incidence() const { return mIncidence; }
94 QDate incidenceDate() { return mDate; } 94 QDate incidenceDate() { return mDate; }
95 95
96 protected: 96 protected:
97 virtual void paint(QPainter *); 97 virtual void paint(QPainter *);
98 virtual int height(const QListBox *) const; 98 virtual int height(const QListBox *) const;
99 virtual int width(const QListBox *) const; 99 virtual int width(const QListBox *) const;
100 100
101 private: 101 private:
102 bool mRecur; 102 bool mRecur;
103 bool mAlarm; 103 bool mAlarm;
104 bool mReply; 104 bool mReply;
105 bool mInfo; 105 bool mInfo;
106 106
107 QPalette mPalette; 107 QPalette mPalette;
108 QDate mDate; 108 QDate mDate;
109 109
110 Incidence *mIncidence; 110 Incidence *mIncidence;
111}; 111};
112 112
113 113
114class KOMonthView; 114class KOMonthView;
115 115
116class MonthViewCell : public QWidget 116class MonthViewCell : public QWidget
117{ 117{
118 Q_OBJECT 118 Q_OBJECT
119 public: 119 public:
120 MonthViewCell( KOMonthView * ); 120 MonthViewCell( KOMonthView * );
121 121
122 void setDate( const QDate & ); 122 void setDate( const QDate & );
123 QDate date() const; 123 QDate date() const;
124 124
125 void setPrimary( bool ); 125 void setPrimary( bool );
126 bool isPrimary() const; 126 bool isPrimary() const;
127 127
128 void setHoliday( bool ); 128 void setHoliday( bool );
129 void setHoliday( const QString & ); 129 void setHoliday( const QString & );
130 130
131 void updateCell(); 131 void updateCell();
132 132
133 void updateConfig(); 133 void updateConfig();
134 134
135 void enableScrollBars( bool ); 135 void enableScrollBars( bool );
136 136
137 Incidence *selectedIncidence(); 137 Incidence *selectedIncidence();
138 QDate selectedIncidenceDate(); 138 QDate selectedIncidenceDate();
139 139
140 void deselect(); 140 void deselect();
141 void select(); 141 void select();
142 142
143 signals: 143 signals:
144 void defaultAction( Incidence * ); 144 void defaultAction( Incidence * );
145 void newEventSignal( QDateTime ); 145 void newEventSignal( QDateTime );
146 146
147 protected: 147 protected:
148 void resizeEvent( QResizeEvent * ); 148 void resizeEvent( QResizeEvent * );
149 149
150 protected slots: 150 protected slots:
151 void defaultAction( QListBoxItem * ); 151 void defaultAction( QListBoxItem * );
152 void contextMenu( QListBoxItem * ); 152 void contextMenu( QListBoxItem * );
153 void selection( QListBoxItem * ); 153 void selection( QListBoxItem * );
154 void cellClicked( QListBoxItem * ); 154 void cellClicked( QListBoxItem * );
155 void newEvent(); 155 void newEvent();
156 156
157 private: 157 private:
158 KOMonthView *mMonthView; 158 KOMonthView *mMonthView;
159 159
160 QDate mDate; 160 QDate mDate;
161 bool mPrimary; 161 bool mPrimary;
162 bool mHoliday; 162 bool mHoliday;
163 QString mHolidayString; 163 QString mHolidayString;
164 164
165 //QLabel *mLabel; 165 //QLabel *mLabel;
166 QPushButton *mLabel; 166 QPushButton *mLabel;
167 QListBox *mItemList; 167 QListBox *mItemList;
168 168
169 QSize mLabelSize; 169 QSize mLabelSize;
170 QSize mLabelBigSize; 170 QSize mLabelBigSize;
171 QPalette mHolidayPalette; 171 QPalette mHolidayPalette;
172 QPalette mStandardPalette; 172 QPalette mStandardPalette;
173 QPalette mPrimaryPalette; 173 QPalette mPrimaryPalette;
174 QPalette mNonPrimaryPalette; 174 QPalette mNonPrimaryPalette;
175 void setMyPalette(); 175 void setMyPalette();
176 QPalette getPalette (); 176 QPalette getPalette ();
177 void keyPressEvent ( QKeyEvent * ) ; 177 void keyPressEvent ( QKeyEvent * ) ;
178 178
179}; 179};
180 180
181 181
182class KOMonthView: public KOEventView 182class KOMonthView: public KOEventView
183{ 183{
184 Q_OBJECT 184 Q_OBJECT
185 public: 185 public:
186 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); 186 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 );
187 ~KOMonthView(); 187 ~KOMonthView();
188 188
189 /** Returns maximum number of days supported by the komonthview */ 189 /** Returns maximum number of days supported by the komonthview */
190 virtual int maxDatesHint(); 190 virtual int maxDatesHint();
191 191
192 /** Returns number of currently shown dates. */ 192 /** Returns number of currently shown dates. */
193 virtual int currentDateCount(); 193 virtual int currentDateCount();
194 194
195 /** returns the currently selected events */ 195 /** returns the currently selected events */
196 virtual QPtrList<Incidence> selectedIncidences(); 196 virtual QPtrList<Incidence> selectedIncidences();
197 197
198 /** returns dates of the currently selected events */ 198 /** returns dates of the currently selected events */
199 virtual DateList selectedDates(); 199 virtual DateList selectedDates();
200 200
201 virtual void printPreview(CalPrinter *calPrinter, 201 virtual void printPreview(CalPrinter *calPrinter,
202 const QDate &, const QDate &); 202 const QDate &, const QDate &);
203 bool isMonthView() { return true; }
203 204
204 MonthViewCell * selectedCell(); 205 MonthViewCell * selectedCell();
205 public slots: 206 public slots:
206 virtual void updateView(); 207 virtual void updateView();
207 virtual void updateConfig(); 208 virtual void updateConfig();
208 virtual void showDates(const QDate &start, const QDate &end); 209 virtual void showDates(const QDate &start, const QDate &end);
209 virtual void showEvents(QPtrList<Event> eventList); 210 virtual void showEvents(QPtrList<Event> eventList);
210 211
211 void changeEventDisplay(Event *, int); 212 void changeEventDisplay(Event *, int);
212 213
213 void clearSelection(); 214 void clearSelection();
214 215
215 void showContextMenu( Incidence * ); 216 void showContextMenu( Incidence * );
216 217
217 void setSelectedCell( MonthViewCell * ); 218 void setSelectedCell( MonthViewCell * );
218 219
219 protected slots: 220 protected slots:
220 void processSelectionChange(); 221 void processSelectionChange();
221 signals: 222 signals:
222 void selectWeekNum ( int ); 223 void selectWeekNum ( int );
223 protected: 224 protected:
224 void resizeEvent(QResizeEvent *); 225 void resizeEvent(QResizeEvent *);
225 void viewChanged(); 226 void viewChanged();
226 void updateDayLabels(); 227 void updateDayLabels();
227 228
228 private: 229 private:
229 int mDaysPerWeek; 230 int mDaysPerWeek;
230 int mNumWeeks; 231 int mNumWeeks;
231 int mNumCells; 232 int mNumCells;
232 bool mWeekStartsMonday; 233 bool mWeekStartsMonday;
233 bool mShowSatSunComp; 234 bool mShowSatSunComp;
234 void computeLayout(); 235 void computeLayout();
235 236
236 QPtrVector<MonthViewCell> mCells; 237 QPtrVector<MonthViewCell> mCells;
237 QPtrVector<QLabel> mDayLabels; 238 QPtrVector<QLabel> mDayLabels;
238 QPtrVector<KOWeekButton> mWeekLabels; 239 QPtrVector<KOWeekButton> mWeekLabels;
239 240
240 bool mShortDayLabels; 241 bool mShortDayLabels;
241 int mWidthLongDayLabel; 242 int mWidthLongDayLabel;
242 243
243 QDate mStartDate; 244 QDate mStartDate;
244 245
245 MonthViewCell *mSelectedCell; 246 MonthViewCell *mSelectedCell;
246 247
247 KOEventPopupMenu *mContextMenu; 248 KOEventPopupMenu *mContextMenu;
248 void keyPressEvent ( QKeyEvent * ) ; 249 void keyPressEvent ( QKeyEvent * ) ;
249 250
250}; 251};
251 252
252#endif 253#endif